From: Niels Erik G. Nielsen Date: Tue, 25 Jun 2013 16:37:33 +0000 (-0400) Subject: Fixes npe and return type of auth.run() X-Git-Tag: v0.0.7~32 X-Git-Url: http://jsfdemo.indexdata.com/cgi-bin?a=commitdiff_plain;h=c04872faf566a8d312f5f3f82eb652fae7327ce3;p=mkjsf-moved-to-github.git Fixes npe and return type of auth.run() --- diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/InitCommand.java b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/InitCommand.java index 890e4ab..632e139 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/InitCommand.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/InitCommand.java @@ -75,7 +75,7 @@ public class InitCommand extends Pazpar2Command implements ServiceProxyCommand { newCommand.setParameterInState(parameters.get(parameterName).copy()); } newCommand.spCommand = new InitCommandSp(this); - if (spCommand.getUploadedInitDoc()!=null) { + if (spCommand != null && spCommand.getUploadedInitDoc()!=null) { newCommand.spCommand.setUploadedInitDoc(spCommand.getUploadedInitDoc()); } return newCommand; diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/Pazpar2Command.java b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/Pazpar2Command.java index a4fa51f..25ea8db 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/Pazpar2Command.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/Pazpar2Command.java @@ -95,7 +95,7 @@ public abstract class Pazpar2Command implements Serializable { } return run(); } - + /** * Executes the command in a thread. * diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/sp/AuthCommand.java b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/sp/AuthCommand.java index 75d46aa..8869d83 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/sp/AuthCommand.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/sp/AuthCommand.java @@ -7,6 +7,7 @@ import com.indexdata.mkjsf.pazpar2.Pz2Service; import com.indexdata.mkjsf.pazpar2.commands.CommandParameter; import com.indexdata.mkjsf.pazpar2.commands.Pazpar2Command; import com.indexdata.mkjsf.pazpar2.data.ResponseParser; +import com.indexdata.mkjsf.pazpar2.data.sp.AuthResponse; import com.indexdata.mkjsf.pazpar2.data.sp.SpResponseDataObject; /** @@ -32,7 +33,7 @@ public class AuthCommand extends Pazpar2Command implements ServiceProxyCommand { ClientCommandResponse response = (ClientCommandResponse) Pz2Service.get().getSearchClient().executeCommand(this); String renamedResponse = renameResponseElement(response.getResponseString(), "auth"); response.setResponseToParse(renamedResponse); - SpResponseDataObject responseObject = (SpResponseDataObject) ResponseParser.getParser().getDataObject(response); + AuthResponse responseObject = (AuthResponse) ResponseParser.getParser().getDataObject(response); if (ResponseParser.docTypes.contains(responseObject.getType())) { Pz2Service.get().getPzresp().put(getCommandName(), responseObject); }