turn off some annoying compiler warnings
authorlajoie <lajoie@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Thu, 21 Feb 2008 08:22:56 +0000 (08:22 +0000)
committerlajoie <lajoie@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Thu, 21 Feb 2008 08:22:56 +0000 (08:22 +0000)
Cleanup new context loading code
Cleanup locking of resources during new context loads

git-svn-id: https://subversion.switch.ch/svn/shibboleth/java-idp/trunk@2635 ab3bd59b-922f-494d-bb5f-6f0a3c29deca

.settings/org.eclipse.jdt.core.prefs
src/edu/internet2/middleware/shibboleth/idp/profile/IdPProfileHandlerManager.java

index c98fe64..c711d35 100644 (file)
@@ -1,4 +1,4 @@
-#Thu Feb 08 11:30:51 EST 2007
+#Thu Feb 21 07:29:42 CET 2008
 eclipse.preferences.version=1
 org.eclipse.jdt.core.codeComplete.argumentPrefixes=
 org.eclipse.jdt.core.codeComplete.argumentSuffixes=
@@ -15,8 +15,62 @@ org.eclipse.jdt.core.compiler.compliance=1.5
 org.eclipse.jdt.core.compiler.debug.lineNumber=generate
 org.eclipse.jdt.core.compiler.debug.localVariable=generate
 org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
 org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
+org.eclipse.jdt.core.compiler.problem.nullReference=ignore
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=warning
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
 org.eclipse.jdt.core.compiler.source=1.5
 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
index bf03359..6b88b23 100644 (file)
@@ -32,6 +32,7 @@ import edu.internet2.middleware.shibboleth.common.profile.AbstractErrorHandler;
 import edu.internet2.middleware.shibboleth.common.profile.ProfileHandler;
 import edu.internet2.middleware.shibboleth.common.profile.ProfileHandlerManager;
 import edu.internet2.middleware.shibboleth.common.profile.provider.AbstractRequestURIMappedProfileHandler;
+import edu.internet2.middleware.shibboleth.common.service.ServiceException;
 import edu.internet2.middleware.shibboleth.idp.authn.LoginHandler;
 
 /**
@@ -116,18 +117,21 @@ public class IdPProfileHandlerManager extends BaseReloadableService implements P
     }
 
     /** {@inheritDoc} */
-    protected void onNewContextCreated(ApplicationContext newServiceContext) {
+    protected void onNewContextCreated(ApplicationContext newServiceContext) throws ServiceException {
         log.debug("{}: Loading new configuration into service", getId());
-        Lock writeLock = getReadWriteLock().writeLock();
+        AbstractErrorHandler oldErrorHandler = errorHandler;
+        Map<String, AbstractRequestURIMappedProfileHandler> oldProfileHandlers = profileHandlers;
+        Map<String, LoginHandler> oldLoginHandlers = loginHandlers;
+
         try {
-            writeLock.lock();
             loadNewErrorHandler(newServiceContext);
             loadNewProfileHandlers(newServiceContext);
-            loadNewAuthenticationHandlers(newServiceContext);
+            loadNewLoginHandlers(newServiceContext);
         } catch (Exception e) {
-            log.error("Error loading information from new context", e);
-        } finally {
-            writeLock.unlock();
+            errorHandler = oldErrorHandler;
+            profileHandlers = oldProfileHandlers;
+            loginHandlers = oldLoginHandlers;
+            throw new ServiceException(getId() + " configuration is not valid, retaining old configuration", e);
         }
     }
 
@@ -153,15 +157,16 @@ public class IdPProfileHandlerManager extends BaseReloadableService implements P
         String[] profileBeanNames = newServiceContext.getBeanNamesForType(AbstractRequestURIMappedProfileHandler.class);
         log.debug("{}: Loading {} new profile handlers.", getId(), profileBeanNames.length);
 
-        profileHandlers.clear();
+        Map<String, AbstractRequestURIMappedProfileHandler> newProfileHandlers = new HashMap<String, AbstractRequestURIMappedProfileHandler>();
         AbstractRequestURIMappedProfileHandler<?, ?> profileHandler;
         for (String profileBeanName : profileBeanNames) {
             profileHandler = (AbstractRequestURIMappedProfileHandler) newServiceContext.getBean(profileBeanName);
             for (String requestPath : profileHandler.getRequestPaths()) {
-                profileHandlers.put(requestPath, profileHandler);
+                newProfileHandlers.put(requestPath, profileHandler);
                 log.debug("{}: Loaded profile handler for handling requests to request path {}", getId(), requestPath);
             }
         }
+        profileHandlers = newProfileHandlers;
     }
 
     /**
@@ -169,11 +174,11 @@ public class IdPProfileHandlerManager extends BaseReloadableService implements P
      * 
      * @param newServiceContext newly created application context
      */
-    protected void loadNewAuthenticationHandlers(ApplicationContext newServiceContext) {
+    protected void loadNewLoginHandlers(ApplicationContext newServiceContext) {
         String[] authnBeanNames = newServiceContext.getBeanNamesForType(LoginHandler.class);
         log.debug("{}: Loading {} new authentication handlers.", getId(), authnBeanNames.length);
 
-        loginHandlers.clear();
+        Map<String, LoginHandler> newLoginHandlers = new HashMap<String, LoginHandler>();
         LoginHandler authnHandler;
         for (String authnBeanName : authnBeanNames) {
             authnHandler = (LoginHandler) newServiceContext.getBean(authnBeanName);
@@ -181,8 +186,9 @@ public class IdPProfileHandlerManager extends BaseReloadableService implements P
                     authnHandler.getSupportedAuthenticationMethods());
 
             for (String authnMethod : authnHandler.getSupportedAuthenticationMethods()) {
-                loginHandlers.put(authnMethod, authnHandler);
+                newLoginHandlers.put(authnMethod, authnHandler);
             }
         }
+        loginHandlers = newLoginHandlers;
     }
 }
\ No newline at end of file