aboutsummaryrefslogtreecommitdiff
path: root/id/ConfigWebTool/src/main/java/at
diff options
context:
space:
mode:
authorThomas Lenz <tlenz@iaik.tugraz.at>2014-05-12 09:57:50 +0200
committerThomas Lenz <tlenz@iaik.tugraz.at>2014-05-12 09:57:50 +0200
commitd1e00d9ef6d48819f1b56e0d6b0a4f1ddb1c316f (patch)
treefd368f3c52c5fb49924bbb417c0ee80d2aac5db4 /id/ConfigWebTool/src/main/java/at
parentee87dced5b54e34ba65686b0a6c19b6745753e15 (diff)
downloadmoa-id-spss-d1e00d9ef6d48819f1b56e0d6b0a4f1ddb1c316f.tar.gz
moa-id-spss-d1e00d9ef6d48819f1b56e0d6b0a4f1ddb1c316f.tar.bz2
moa-id-spss-d1e00d9ef6d48819f1b56e0d6b0a4f1ddb1c316f.zip
solve null pointer exception
Diffstat (limited to 'id/ConfigWebTool/src/main/java/at')
-rw-r--r--id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditOAAction.java5
-rw-r--r--id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/oa/OAPVP2ConfigValidation.java88
2 files changed, 49 insertions, 44 deletions
diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditOAAction.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditOAAction.java
index 6d735a85b..e15d1e958 100644
--- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditOAAction.java
+++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditOAAction.java
@@ -92,6 +92,11 @@ public class EditOAAction extends BasicOAAction {
OnlineApplication onlineapplication = populateOnlineApplicationFromRequest();
+ if (onlineapplication == null) {
+ addActionError(LanguageHelper.getErrorString("errors.listOAs.noOA", request));
+ return Constants.STRUTS_SUCCESS;
+ }
+
List<String> errors = new ArrayList<String>();
for (IOnlineApplicationData form : formList.values()) {
List<String> error = form.parse(onlineapplication, authUser, request);
diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/oa/OAPVP2ConfigValidation.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/oa/OAPVP2ConfigValidation.java
index 62fc83ab9..c9488706a 100644
--- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/oa/OAPVP2ConfigValidation.java
+++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/oa/OAPVP2ConfigValidation.java
@@ -78,58 +78,58 @@ public class OAPVP2ConfigValidation {
certSerialized = oa.getAuthComponentOA().getOAPVP2().getCertificate();
}
}
-
- if (certSerialized == null) {
- log.info("No certificate for metadata validation");
- errors.add(LanguageHelper.getErrorString("validation.pvp2.certificate.notfound", request));
- }
-
-
+
String check = form.getMetaDataURL();
if (MiscUtil.isNotEmpty(check)) {
+
if (!ValidationHelper.validateURL(check)) {
log.info("MetaDataURL has no valid form.");
errors.add(LanguageHelper.getErrorString("validation.pvp2.metadataurl.valid", request));
} else {
- if (certSerialized != null) {
- X509Certificate cert = new X509Certificate(certSerialized);
- BasicX509Credential credential = new BasicX509Credential();
- credential.setEntityCertificate(cert);
-
- timer = new Timer();
- httpClient = new MOAHttpClient();
-
- if (form.getMetaDataURL().startsWith("https:"))
- try {
- MOAHttpProtocolSocketFactory protoSocketFactory = new MOAHttpProtocolSocketFactory(
- "MOAMetaDataProvider",
- ConfigurationProvider.getInstance().getCertStoreDirectory(),
- ConfigurationProvider.getInstance().getTrustStoreDirectory(),
- null,
- ChainingModeType.PKIX,
- true);
-
- httpClient.setCustomSSLTrustStore(
- form.getMetaDataURL(),
- protoSocketFactory);
-
- } catch (MOAHttpProtocolSocketFactoryException e) {
- log.warn("MOA SSL-TrustStore can not initialized. Use default Java TrustStore.");
-
- } catch (ConfigurationException e) {
- log.info("No MOA specific SSL-TrustStore configured. Use default Java TrustStore.");
-
- }
-
- httpProvider =
- new HTTPMetadataProvider(timer, httpClient, form.getMetaDataURL());
- httpProvider.setParserPool(new BasicParserPool());
- httpProvider.setRequireValidMetadata(true);
- MetadataFilter filter = new MetaDataVerificationFilter(credential);
- httpProvider.setMetadataFilter(filter);
- httpProvider.initialize();
+ if (certSerialized == null) {
+ log.info("No certificate for metadata validation");
+ errors.add(LanguageHelper.getErrorString("validation.pvp2.certificate.notfound", request));
+
+ } else {
+
+ X509Certificate cert = new X509Certificate(certSerialized);
+ BasicX509Credential credential = new BasicX509Credential();
+ credential.setEntityCertificate(cert);
+
+ timer = new Timer();
+ httpClient = new MOAHttpClient();
+
+ if (form.getMetaDataURL().startsWith("https:"))
+ try {
+ MOAHttpProtocolSocketFactory protoSocketFactory = new MOAHttpProtocolSocketFactory(
+ "MOAMetaDataProvider",
+ ConfigurationProvider.getInstance().getCertStoreDirectory(),
+ ConfigurationProvider.getInstance().getTrustStoreDirectory(),
+ null,
+ ChainingModeType.PKIX,
+ true);
+
+ httpClient.setCustomSSLTrustStore(
+ form.getMetaDataURL(),
+ protoSocketFactory);
+
+ } catch (MOAHttpProtocolSocketFactoryException e) {
+ log.warn("MOA SSL-TrustStore can not initialized. Use default Java TrustStore.");
+
+ } catch (ConfigurationException e) {
+ log.info("No MOA specific SSL-TrustStore configured. Use default Java TrustStore.");
+
+ }
+
+ httpProvider =
+ new HTTPMetadataProvider(timer, httpClient, form.getMetaDataURL());
+ httpProvider.setParserPool(new BasicParserPool());
+ httpProvider.setRequireValidMetadata(true);
+ MetadataFilter filter = new MetaDataVerificationFilter(credential);
+ httpProvider.setMetadataFilter(filter);
+ httpProvider.initialize();
}
}
}