struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From musa...@apache.org
Subject svn commit: r743883 - in /struts/struts2/trunk/plugins/convention/src: main/java/org/apache/struts2/convention/ main/java/org/apache/struts2/convention/classloader/ test/java/org/apache/struts2/convention/
Date Thu, 12 Feb 2009 21:06:42 GMT
Author: musachy
Date: Thu Feb 12 21:06:41 2009
New Revision: 743883

URL: http://svn.apache.org/viewvc?rev=743883&view=rev
Log:
Cleanup some warnings

Modified:
    struts/struts2/trunk/plugins/convention/src/main/java/org/apache/struts2/convention/ClasspathConfigurationProvider.java
    struts/struts2/trunk/plugins/convention/src/main/java/org/apache/struts2/convention/DefaultInterceptorMapBuilder.java
    struts/struts2/trunk/plugins/convention/src/main/java/org/apache/struts2/convention/PackageBasedActionConfigBuilder.java
    struts/struts2/trunk/plugins/convention/src/main/java/org/apache/struts2/convention/classloader/ResourceStore.java
    struts/struts2/trunk/plugins/convention/src/main/java/org/apache/struts2/convention/classloader/ResourceStoreClassLoader.java
    struts/struts2/trunk/plugins/convention/src/test/java/org/apache/struts2/convention/PackageBasedActionConfigBuilderTest.java

Modified: struts/struts2/trunk/plugins/convention/src/main/java/org/apache/struts2/convention/ClasspathConfigurationProvider.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/convention/src/main/java/org/apache/struts2/convention/ClasspathConfigurationProvider.java?rev=743883&r1=743882&r2=743883&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/convention/src/main/java/org/apache/struts2/convention/ClasspathConfigurationProvider.java
(original)
+++ struts/struts2/trunk/plugins/convention/src/main/java/org/apache/struts2/convention/ClasspathConfigurationProvider.java
Thu Feb 12 21:06:41 2009
@@ -94,10 +94,11 @@
     }
 
     /**
+     * Depends on devMode, relead and actionConfigBuilder.needsReload()
      * @return Always false.
      */
     public boolean needsReload() {
-        return devMode && reload ? actionConfigBuilder.needsReload() : false;
+        return devMode && reload && actionConfigBuilder.needsReload();
     }
 
     public void dispatcherInitialized(Dispatcher du) {

Modified: struts/struts2/trunk/plugins/convention/src/main/java/org/apache/struts2/convention/DefaultInterceptorMapBuilder.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/convention/src/main/java/org/apache/struts2/convention/DefaultInterceptorMapBuilder.java?rev=743883&r1=743882&r2=743883&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/convention/src/main/java/org/apache/struts2/convention/DefaultInterceptorMapBuilder.java
(original)
+++ struts/struts2/trunk/plugins/convention/src/main/java/org/apache/struts2/convention/DefaultInterceptorMapBuilder.java
Thu Feb 12 21:06:41 2009
@@ -98,7 +98,7 @@
 			PackageConfig.Builder builder, InterceptorRef ref, Map params) {
 		return InterceptorBuilder.constructInterceptorReference(builder, ref
 				.value(), params, builder.build().getLocation(),
-				(ObjectFactory) configuration.getContainer().getInstance(
+                configuration.getContainer().getInstance(
 						ObjectFactory.class));
 	}
 

Modified: struts/struts2/trunk/plugins/convention/src/main/java/org/apache/struts2/convention/PackageBasedActionConfigBuilder.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/convention/src/main/java/org/apache/struts2/convention/PackageBasedActionConfigBuilder.java?rev=743883&r1=743882&r2=743883&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/convention/src/main/java/org/apache/struts2/convention/PackageBasedActionConfigBuilder.java
(original)
+++ struts/struts2/trunk/plugins/convention/src/main/java/org/apache/struts2/convention/PackageBasedActionConfigBuilder.java
Thu Feb 12 21:06:41 2009
@@ -45,6 +45,7 @@
 import org.apache.struts2.convention.annotation.ParentPackage;
 import org.apache.struts2.convention.classloader.ReloadingClassLoader;
 import org.apache.struts2.StrutsConstants;
+import org.apache.struts2.StrutsException;
 
 import com.opensymphony.xwork2.ObjectFactory;
 import com.opensymphony.xwork2.config.Configuration;
@@ -117,7 +118,7 @@
         this.configuration = configuration;
         this.actionNameBuilder = container.getInstance(ActionNameBuilder.class, container.getInstance(String.class,
ConventionConstants.CONVENTION_ACTION_NAME_BUILDER));
         this.resultMapBuilder = container.getInstance(ResultMapBuilder.class, container.getInstance(String.class,
ConventionConstants.CONVENTION_RESULT_MAP_BUILDER));
-        this.interceptorMapBuilder = container.getInstance(InterceptorMapBuilder.class, container.getInstance(String.class,
ConventionConstants.CONVENTION_INTERCEPTOR_MAP_BUILDER));;
+        this.interceptorMapBuilder = container.getInstance(InterceptorMapBuilder.class, container.getInstance(String.class,
ConventionConstants.CONVENTION_INTERCEPTOR_MAP_BUILDER));
         this.objectFactory = objectFactory;
         this.redirectToSlash = Boolean.parseBoolean(redirectToSlash);
 
@@ -435,9 +436,9 @@
             try {
                 objectFactory.getClassInstance(actionClass.getName());
             } catch (ClassNotFoundException e) {
-                // Impossible
-                new Throwable().printStackTrace();
-                System.exit(1);
+                if (LOG.isErrorEnabled())
+                    LOG.error("Object Factory was unable to load class [#0]", e, actionClass.getName());
+                throw new StrutsException("Object Factory was unable to load class " + actionClass.getName(),
e);
             }
 
             // Determine the action package

Modified: struts/struts2/trunk/plugins/convention/src/main/java/org/apache/struts2/convention/classloader/ResourceStore.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/convention/src/main/java/org/apache/struts2/convention/classloader/ResourceStore.java?rev=743883&r1=743882&r2=743883&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/convention/src/main/java/org/apache/struts2/convention/classloader/ResourceStore.java
(original)
+++ struts/struts2/trunk/plugins/convention/src/main/java/org/apache/struts2/convention/classloader/ResourceStore.java
Thu Feb 12 21:06:41 2009
@@ -29,7 +29,6 @@
 
     byte[] read(final String pResourceName);
 
-    //FIXME: return the result of the remove
     void remove(final String pResourceName);
 }
 

Modified: struts/struts2/trunk/plugins/convention/src/main/java/org/apache/struts2/convention/classloader/ResourceStoreClassLoader.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/convention/src/main/java/org/apache/struts2/convention/classloader/ResourceStoreClassLoader.java?rev=743883&r1=743882&r2=743883&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/convention/src/main/java/org/apache/struts2/convention/classloader/ResourceStoreClassLoader.java
(original)
+++ struts/struts2/trunk/plugins/convention/src/main/java/org/apache/struts2/convention/classloader/ResourceStoreClassLoader.java
Thu Feb 12 21:06:41 2009
@@ -42,8 +42,7 @@
     private Class fastFindClass(final String name) {
 
         if (stores != null) {
-            for (int i = 0; i < stores.length; i++) {
-                final ResourceStore store = stores[i];
+            for (final ResourceStore store : stores) {
                 final byte[] clazzBytes = store.read(name.replace('.', '/') + ".class");
                 if (clazzBytes != null) {
                     return defineClass(name, clazzBytes, 0, clazzBytes.length);

Modified: struts/struts2/trunk/plugins/convention/src/test/java/org/apache/struts2/convention/PackageBasedActionConfigBuilderTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/convention/src/test/java/org/apache/struts2/convention/PackageBasedActionConfigBuilderTest.java?rev=743883&r1=743882&r2=743883&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/convention/src/test/java/org/apache/struts2/convention/PackageBasedActionConfigBuilderTest.java
(original)
+++ struts/struts2/trunk/plugins/convention/src/test/java/org/apache/struts2/convention/PackageBasedActionConfigBuilderTest.java
Thu Feb 12 21:06:41 2009
@@ -505,7 +505,8 @@
         assertNotNull(result);
         assertTrue(result instanceof ActionChainResult);
         ActionChainResult chainResult = (ActionChainResult) result;
-        ActionChainResult chainResultToCompare = new ActionChainResult("/chain", "foo-bar",
"bar");
+        ActionChainResult chainResultToCompare = new ActionChainResult(null, "foo-bar", null);
+        assertEquals(chainResultToCompare, chainResult);
     }
 
     private void verifyActionConfig(PackageConfig pkgConfig, String actionName, Class<?>
actionClass,



Mime
View raw message