Mercurial > hg > Database > Christie
changeset 251:e8f6c35e6b69
minor fix
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 25 Jan 2020 14:45:25 +0900 |
parents | 9697be80d1f6 |
children | be7063c0684b |
files | build.gradle src/main/java/christie/datagear/command/CommandBuilder.java src/test/java/christie/example/RemoteTake/StartRemoteTake.java |
diffstat | 3 files changed, 13 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/build.gradle Fri Jan 24 20:47:53 2020 +0900 +++ b/build.gradle Sat Jan 25 14:45:25 2020 +0900 @@ -16,7 +16,7 @@ dependencies { compile fileTree(dir: 'lib', include: '*.jar') testCompile('org.junit.jupiter:junit-jupiter-api:5.2.0') - //compile group: 'org.msgpack', name: 'msgpack-core', version: '0.8.16' + //compile group: 'org.msgpack', name: 'msgpack-core', version: '0.8.20' //compile group: 'org.msgpack', name: 'jackson-dataformat-msgpack', version: '0.8.16' compile group: 'org.msgpack', name: 'msgpack', version: '0.6.12' compile group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.11.1'
--- a/src/main/java/christie/datagear/command/CommandBuilder.java Fri Jan 24 20:47:53 2020 +0900 +++ b/src/main/java/christie/datagear/command/CommandBuilder.java Sat Jan 25 14:45:25 2020 +0900 @@ -71,18 +71,17 @@ return this; } - public Command build(){ + public Command build() { if(type == null) throw new NullPointerException(); return factory.getCommand(type, this); } - private class CommandFactory{ + private class CommandFactory { public Command getCommand(CommandType type, CommandBuilder cb) { switch (type) { case PUT: //check need param - checkNull(cb.key, cb.dg); return new PutCommand(cb); case TAKE: @@ -93,15 +92,18 @@ checkNull(cb.cgmID, cb.cg, cb.toDgmName, cb.key, cb.dg); return new PeekCommand(cb); case REMOTETAKE: - if (cb.fromDgmName.equals("local")) throw new NullPointerException(); + if (cb.fromDgmName.equals("local")) + throw new NullPointerException(); checkNull(cb.key, cb.connection, cb.clazz); return new RemoteTakeCommand(cb); case REMOTEPEEK: - if (cb.fromDgmName.equals("local")) throw new NullPointerException(); + if (cb.fromDgmName.equals("local")) + throw new NullPointerException(); checkNull(cb.key, cb.connection, cb.clazz); return new RemotePeekCommand(cb); case REPLY: - if (cb.fromDgmName.equals("local")) throw new NullPointerException(); + //if (cb.fromDgmName.equals("local")) + // throw new NullPointerException(); checkNull(cb.key, cb.connection, cb.dg); return new ReplyCommand(cb); case CLOSE: @@ -113,11 +115,10 @@ return null; } - public void checkNull(Object... params){ - for(Object param: params){ - if(param == null){ + public void checkNull(Object... params) { + for(Object param: params) { + if(param == null) { throw new NullPointerException(); - } } }
--- a/src/test/java/christie/example/RemoteTake/StartRemoteTake.java Fri Jan 24 20:47:53 2020 +0900 +++ b/src/test/java/christie/example/RemoteTake/StartRemoteTake.java Sat Jan 25 14:45:25 2020 +0900 @@ -9,7 +9,7 @@ super(cgm); } - public static void main(String args[]){ + public static void main(String args[]) { CodeGearManager cgm = createCGM(10000); new StartRemoteTake(cgm); cgm.createRemoteDGM("remote", "localhost", 10000);