Commit 1b2f8fd9 authored by Tobias Wich's avatar Tobias Wich
Browse files

Expose minor code of the process to the activator

parent 9efe096e
...@@ -36,5 +36,6 @@ public class AuxDataKeys { ...@@ -36,5 +36,6 @@ public class AuxDataKeys {
public static final String REDIRECT_LOCATION = PREFIX + "redirect_location" ; public static final String REDIRECT_LOCATION = PREFIX + "redirect_location" ;
public static final String RESPONSE_HEADERS = PREFIX + "response_headers"; public static final String RESPONSE_HEADERS = PREFIX + "response_headers";
public static final String MINOR_PROCESS_RESULT = PREFIX + "minor_result";
} }
...@@ -381,16 +381,20 @@ public class TCTokenHandler { ...@@ -381,16 +381,20 @@ public class TCTokenHandler {
} else if (innerException instanceof PAOSConnectionException) { } else if (innerException instanceof PAOSConnectionException) {
response.setResult(WSHelper.makeResultError(ResultMinor.TRUSTED_CHANNEL_ESTABLISHMENT_FAILED, response.setResult(WSHelper.makeResultError(ResultMinor.TRUSTED_CHANNEL_ESTABLISHMENT_FAILED,
w.getLocalizedMessage())); w.getLocalizedMessage()));
response.setAdditionalResultMinor(ECardConstants.Minor.Disp.COMM_ERROR);
} else if (innerException instanceof InterruptedException) { } else if (innerException instanceof InterruptedException) {
response.setResultCode(BindingResultCode.INTERRUPTED); response.setResultCode(BindingResultCode.INTERRUPTED);
response.setResult(WSHelper.makeResultError(ResultMinor.CANCELLATION_BY_USER, errorMsg)); response.setResult(WSHelper.makeResultError(ResultMinor.CANCELLATION_BY_USER, errorMsg));
response.setAdditionalResultMinor(ECardConstants.Minor.App.SESS_TERMINATED);
} else if (innerException instanceof DocumentValidatorException) { } else if (innerException instanceof DocumentValidatorException) {
errorMsg = LANG_TR.translationForKey(SCHEMA_VALIDATION_FAILED); errorMsg = LANG_TR.translationForKey(SCHEMA_VALIDATION_FAILED);
// it is ridiculous, that this should be a client error, but the test spec demands this // it is ridiculous, that this should be a client error, but the test spec demands this
response.setResult(WSHelper.makeResultError(ResultMinor.CLIENT_ERROR, w.getMessage())); response.setResult(WSHelper.makeResultError(ResultMinor.CLIENT_ERROR, w.getMessage()));
response.setAdditionalResultMinor(ECardConstants.Minor.SAL.Support.SCHEMA_VAILD_FAILED);
} else { } else {
errorMsg = createMessageFromUnknownError(w); errorMsg = createMessageFromUnknownError(w);
response.setResult(WSHelper.makeResultError(ResultMinor.CLIENT_ERROR, w.getMessage())); response.setResult(WSHelper.makeResultError(ResultMinor.CLIENT_ERROR, w.getMessage()));
response.setAdditionalResultMinor(ECardConstants.Minor.App.UNKNOWN_ERROR);
} }
showErrorMessage(errorMsg); showErrorMessage(errorMsg);
...@@ -548,7 +552,9 @@ public class TCTokenHandler { ...@@ -548,7 +552,9 @@ public class TCTokenHandler {
private String createResponseFromWsEx(WSException ex, TCTokenResponse response) { private String createResponseFromWsEx(WSException ex, TCTokenResponse response) {
String errorMsg; String errorMsg;
switch (ex.getResultMinor()) { String minor = ex.getResultMinor();
switch (minor) {
case ECardConstants.Minor.Disp.TIMEOUT: case ECardConstants.Minor.Disp.TIMEOUT:
case ECardConstants.Minor.SAL.CANCELLATION_BY_USER: case ECardConstants.Minor.SAL.CANCELLATION_BY_USER:
case ECardConstants.Minor.IFD.CANCELLATION_BY_USER: case ECardConstants.Minor.IFD.CANCELLATION_BY_USER:
...@@ -595,6 +601,9 @@ public class TCTokenHandler { ...@@ -595,6 +601,9 @@ public class TCTokenHandler {
errorMsg = LANG_TR.translationForKey(ERROR_WHILE_AUTHENTICATION); errorMsg = LANG_TR.translationForKey(ERROR_WHILE_AUTHENTICATION);
response.setResult(WSHelper.makeResultError(ResultMinor.SERVER_ERROR, errorMsg)); response.setResult(WSHelper.makeResultError(ResultMinor.SERVER_ERROR, errorMsg));
} }
response.setAdditionalResultMinor(minor);
return errorMsg; return errorMsg;
} }
......
/**************************************************************************** /****************************************************************************
* Copyright (C) 2012-2014 ecsec GmbH. * Copyright (C) 2012-2019 ecsec GmbH.
* All rights reserved. * All rights reserved.
* Contact: ecsec GmbH (info@ecsec.de) * Contact: ecsec GmbH (info@ecsec.de)
* *
...@@ -42,10 +42,12 @@ import org.openecard.common.util.UrlBuilder; ...@@ -42,10 +42,12 @@ import org.openecard.common.util.UrlBuilder;
* *
* @author Moritz Horsch * @author Moritz Horsch
* @author Hans-Martin Haase * @author Hans-Martin Haase
* @author Tobias Wich
*/ */
public class TCTokenResponse extends BindingResult { public class TCTokenResponse extends BindingResult {
private static final I18n lang = I18n.getTranslation("tr03112"); private static final I18n LANG = I18n.getTranslation("tr03112");
private Result result; private Result result;
private TCToken token; private TCToken token;
private Future<?> bindingTask; private Future<?> bindingTask;
...@@ -71,6 +73,10 @@ public class TCTokenResponse extends BindingResult { ...@@ -71,6 +73,10 @@ public class TCTokenResponse extends BindingResult {
this.result = result; this.result = result;
} }
public void setAdditionalResultMinor(String minor) {
this.addAuxResultData(AuxDataKeys.MINOR_PROCESS_RESULT, minor);
}
/** /**
* Sets the TCToken as received in the request. * Sets the TCToken as received in the request.
* *
...@@ -151,7 +157,7 @@ public class TCTokenResponse extends BindingResult { ...@@ -151,7 +157,7 @@ public class TCTokenResponse extends BindingResult {
} catch (URISyntaxException ex) { } catch (URISyntaxException ex) {
// this is a code failure as the URLs are verified upfront // this is a code failure as the URLs are verified upfront
// TODO: translate when exception changes // TODO: translate when exception changes
throw new IllegalArgumentException(lang.getOriginalMessage(INVALID_URL), ex); throw new IllegalArgumentException(LANG.getOriginalMessage(INVALID_URL), ex);
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment