From 79b77adb8fef08386ee640cd7fe41e845f34093d Mon Sep 17 00:00:00 2001 From: lresende Date: Fri, 22 May 2009 16:19:10 +0000 Subject: Merging changes from 1.5 release branch to avoid NPE when running some samples git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@777599 13f79535-47bb-0310-9956-ffa450edef68 --- ...AuthenticationImplementationPolicyProvider.java | 4 ++-- ...APRealmAuthenticationServicePolicyProvider.java | 28 ++++++++++------------ ...AuthenticationImplementationPolicyProvider.java | 2 +- .../JaasAuthenticationServicePolicyProvider.java | 14 +++++------ 4 files changed, 21 insertions(+), 27 deletions(-) (limited to 'branches') diff --git a/branches/sca-java-1.x/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/security/http/LDAPRealmAuthenticationImplementationPolicyProvider.java b/branches/sca-java-1.x/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/security/http/LDAPRealmAuthenticationImplementationPolicyProvider.java index bb1950f7f8..88f153c064 100644 --- a/branches/sca-java-1.x/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/security/http/LDAPRealmAuthenticationImplementationPolicyProvider.java +++ b/branches/sca-java-1.x/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/security/http/LDAPRealmAuthenticationImplementationPolicyProvider.java @@ -71,7 +71,7 @@ public class LDAPRealmAuthenticationImplementationPolicyProvider implements Poli if (implementation instanceof OperationsConfigurator) { OperationsConfigurator operationsConfigurator = (OperationsConfigurator)implementation; for (ConfiguredOperation cop : operationsConfigurator.getConfiguredOperations()) { - if (cop.getName().equals(op.getName())) { + if (cop != null && cop.getName() != null && cop.getName().equals(op.getName())) { for (PolicySet ps : cop.getPolicySets()) { for (Object p : ps.getPolicies()) { if (LDAPRealmAuthenticationPolicy.class.isInstance(p)) { @@ -99,7 +99,7 @@ public class LDAPRealmAuthenticationImplementationPolicyProvider implements Poli if (implementation instanceof OperationsConfigurator) { OperationsConfigurator operationsConfigurator = (OperationsConfigurator)implementation; for (ConfiguredOperation cop : operationsConfigurator.getConfiguredOperations()) { - if (cop.getName().equals(op.getName())) { + if (cop != null && cop.getName() != null && cop.getName().equals(op.getName())) { for (PolicySet ps : cop.getPolicySets()) { for (Object p : ps.getPolicies()) { if (AuthorizationPolicy.class.isInstance(p)) { diff --git a/branches/sca-java-1.x/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/security/http/LDAPRealmAuthenticationServicePolicyProvider.java b/branches/sca-java-1.x/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/security/http/LDAPRealmAuthenticationServicePolicyProvider.java index 4b2bb1ad1c..6189de5a5a 100644 --- a/branches/sca-java-1.x/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/security/http/LDAPRealmAuthenticationServicePolicyProvider.java +++ b/branches/sca-java-1.x/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/security/http/LDAPRealmAuthenticationServicePolicyProvider.java @@ -89,13 +89,11 @@ public class LDAPRealmAuthenticationServicePolicyProvider implements PolicyProvi List polices = new ArrayList(); // FIXME: How do we get a list of effective policySets for a given operation? for(Operation operation : operations) { - if (operation!= null && operation.getName() != null) { - if (operation.getName().equals(op.getName())) { - for (PolicySet ps : operation.getPolicySets()) { - for (Object p : ps.getPolicies()) { - if (LDAPRealmAuthenticationPolicy.class.isInstance(p)) { - polices.add((LDAPRealmAuthenticationPolicy)p); - } + if (operation!= null && operation.getName() != null && operation.getName().equals(op.getName())) { + for (PolicySet ps : operation.getPolicySets()) { + for (Object p : ps.getPolicies()) { + if (LDAPRealmAuthenticationPolicy.class.isInstance(p)) { + polices.add((LDAPRealmAuthenticationPolicy)p); } } } @@ -105,7 +103,7 @@ public class LDAPRealmAuthenticationServicePolicyProvider implements PolicyProvi if (service instanceof OperationsConfigurator) { OperationsConfigurator operationsConfigurator = (OperationsConfigurator)service; for (ConfiguredOperation cop : operationsConfigurator.getConfiguredOperations()) { - if (cop.getName().equals(op.getName())) { + if (cop!= null && cop.getName() != null && cop.getName().equals(op.getName())) { for (PolicySet ps : cop.getApplicablePolicySets()) { for (Object p : ps.getPolicies()) { if (LDAPRealmAuthenticationPolicy.class.isInstance(p)) { @@ -138,13 +136,11 @@ public class LDAPRealmAuthenticationServicePolicyProvider implements PolicyProvi List polices = new ArrayList(); // FIXME: How do we get a list of effective policySets for a given operation? for(Operation operation : operations) { - if (operation!= null && operation.getName() != null) { - if (operation.getName().equals(op.getName())) { - for (PolicySet ps : operation.getPolicySets()) { - for (Object p : ps.getPolicies()) { - if (AuthorizationPolicy.class.isInstance(p)) { - polices.add((AuthorizationPolicy)p); - } + if (operation!= null && operation.getName() != null && operation.getName().equals(op.getName())) { + for (PolicySet ps : operation.getPolicySets()) { + for (Object p : ps.getPolicies()) { + if (AuthorizationPolicy.class.isInstance(p)) { + polices.add((AuthorizationPolicy)p); } } } @@ -154,7 +150,7 @@ public class LDAPRealmAuthenticationServicePolicyProvider implements PolicyProvi if (service instanceof OperationsConfigurator) { OperationsConfigurator operationsConfigurator = (OperationsConfigurator)service; for (ConfiguredOperation cop : operationsConfigurator.getConfiguredOperations()) { - if (cop.getName().equals(op.getName())) { + if (cop != null && cop.getName() != null && cop.getName().equals(op.getName())) { for (PolicySet ps : cop.getApplicablePolicySets()) { for (Object p : ps.getPolicies()) { if (AuthorizationPolicy.class.isInstance(p)) { diff --git a/branches/sca-java-1.x/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/jaas/JaasAuthenticationImplementationPolicyProvider.java b/branches/sca-java-1.x/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/jaas/JaasAuthenticationImplementationPolicyProvider.java index 185982a749..981c29df6a 100644 --- a/branches/sca-java-1.x/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/jaas/JaasAuthenticationImplementationPolicyProvider.java +++ b/branches/sca-java-1.x/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/jaas/JaasAuthenticationImplementationPolicyProvider.java @@ -52,7 +52,7 @@ public class JaasAuthenticationImplementationPolicyProvider implements PolicyPro if (implementation instanceof OperationsConfigurator) { OperationsConfigurator operationsConfigurator = (OperationsConfigurator)implementation; for (ConfiguredOperation cop : operationsConfigurator.getConfiguredOperations()) { - if (cop.getName().equals(op.getName())) { + if (cop != null && cop.getName() != null && cop.getName().equals(op.getName())) { for (PolicySet ps : cop.getPolicySets()) { for (Object p : ps.getPolicies()) { if (JaasAuthenticationPolicy.class.isInstance(p)) { diff --git a/branches/sca-java-1.x/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/jaas/JaasAuthenticationServicePolicyProvider.java b/branches/sca-java-1.x/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/jaas/JaasAuthenticationServicePolicyProvider.java index 56927be6bb..220ebd937f 100644 --- a/branches/sca-java-1.x/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/jaas/JaasAuthenticationServicePolicyProvider.java +++ b/branches/sca-java-1.x/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/jaas/JaasAuthenticationServicePolicyProvider.java @@ -57,13 +57,11 @@ public class JaasAuthenticationServicePolicyProvider implements PolicyProvider { List polices = new ArrayList(); // FIXME: How do we get a list of effective policySets for a given operation? for(Operation operation : operations) { - if (operation!= null && operation.getName() != null) { - if (operation.getName().equals(op.getName())) { - for (PolicySet ps : operation.getPolicySets()) { - for (Object p : ps.getPolicies()) { - if (JaasAuthenticationPolicy.class.isInstance(p)) { - polices.add((JaasAuthenticationPolicy)p); - } + if (operation!= null && operation.getName() != null && operation.getName().equals(op.getName())) { + for (PolicySet ps : operation.getPolicySets()) { + for (Object p : ps.getPolicies()) { + if (JaasAuthenticationPolicy.class.isInstance(p)) { + polices.add((JaasAuthenticationPolicy)p); } } } @@ -73,7 +71,7 @@ public class JaasAuthenticationServicePolicyProvider implements PolicyProvider { if (service instanceof OperationsConfigurator) { OperationsConfigurator operationsConfigurator = (OperationsConfigurator)service; for (ConfiguredOperation cop : operationsConfigurator.getConfiguredOperations()) { - if (cop.getName().equals(op.getName())) { + if (cop != null && cop.getName() != null && cop.getName().equals(op.getName())) { for (PolicySet ps : cop.getApplicablePolicySets()) { for (Object p : ps.getPolicies()) { if (JaasAuthenticationPolicy.class.isInstance(p)) { -- cgit v1.2.3