From c04872faf566a8d312f5f3f82eb652fae7327ce3 Mon Sep 17 00:00:00 2001 From: "Niels Erik G. Nielsen" Date: Tue, 25 Jun 2013 12:37:33 -0400 Subject: [PATCH] Fixes npe and return type of auth.run() --- src/main/java/com/indexdata/mkjsf/pazpar2/commands/InitCommand.java | 2 +- .../java/com/indexdata/mkjsf/pazpar2/commands/Pazpar2Command.java | 2 +- .../java/com/indexdata/mkjsf/pazpar2/commands/sp/AuthCommand.java | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) 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); } -- 1.7.10.4