Author: jonesde
Date: Thu Mar 5 20:09:53 2009 New Revision: 750572 URL: http://svn.apache.org/viewvc?rev=750572&view=rev Log: Fixed issue with serialization exceptions on shutdown and startup: the RequestHandler class no longer implements serializable, it was never serializable anyway because it has member fields of types ServletContext, ViewFactory, and EventFactory which are not serializable; I tried making those transient or removing them to load dynamically after a bunch of changes realized that it doesn't make sense to serialize this class anyway, it contains no useful data that a user would care about, and all of its information comes from configuration files that we would want to reload on a restart or in another system or whatever Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilMisc.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilMisc.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilMisc.java?rev=750572&r1=750571&r2=750572&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilMisc.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilMisc.java Thu Mar 5 20:09:53 2009 @@ -31,8 +31,6 @@ import java.util.TreeMap; import java.util.TreeSet; -import javax.servlet.ServletContext; - import javolution.util.FastList; import javolution.util.FastMap; import javolution.util.FastSet; @@ -200,32 +198,26 @@ /** * This change a Map to be Serializable by removing all entries with values that are not Serializable. * - * @param <K> * @param <V> * @param map * @return */ - public static <K, V> void makeMapSerializable(Map<K, V> map) { + public static <V> void makeMapSerializable(Map<String, V> map) { // now filter out all non-serializable values - Set<K> keysToRemove = FastSet.newInstance(); - for (Map.Entry<K, V> mapEntry: map.entrySet()) { + Set<String> keysToRemove = FastSet.newInstance(); + for (Map.Entry<String, V> mapEntry: map.entrySet()) { Object entryValue = mapEntry.getValue(); if (entryValue != null && !(entryValue instanceof Serializable)) { keysToRemove.add(mapEntry.getKey()); - Debug.logInfo("Found Map value that is not Serializable: " + mapEntry.getKey() + "=" + mapEntry.getValue(), module); + //Debug.logInfo("Found Map value that is not Serializable: " + mapEntry.getKey() + "=" + mapEntry.getValue(), module); } - // this is very admittedly a hack, but this object seems to implement Serializable and may not really be, without this keep getting the error: "java.io.NotSerializableException: org.apache.catalina.core.ApplicationContextFacade" - if (entryValue instanceof ServletContext) { - keysToRemove.add(mapEntry.getKey()); - Debug.logInfo("Found Map value that is a ServletContext: " + mapEntry.getKey() + "=" + mapEntry.getValue(), module); - } } - for (K keyToRemove: keysToRemove) { map.remove(keyToRemove); } + for (String keyToRemove: keysToRemove) { map.remove(keyToRemove); } //if (!(map instanceof Serializable)) { // Debug.logInfo("Parameter Map is not Serializable!", module); //} - //for (Map.Entry<K, V> mapEntry: map.entrySet()) { + //for (Map.Entry<String, V> mapEntry: map.entrySet()) { // Debug.logInfo("Entry in Map made serializable: " + mapEntry.getKey() + "=" + mapEntry.getValue(), module); //} } Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java?rev=750572&r1=750571&r2=750572&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java Thu Mar 5 20:09:53 2009 @@ -28,7 +28,6 @@ import java.util.List; import java.util.Locale; import java.util.Map; -import java.util.Set; import javax.servlet.ServletContext; import javax.servlet.http.HttpServletRequest; @@ -36,7 +35,6 @@ import javax.servlet.http.HttpSession; import javolution.util.FastMap; -import javolution.util.FastSet; import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.SSLUtil; @@ -64,8 +62,7 @@ /** * RequestHandler - Request Processor Object */ -@SuppressWarnings("serial") -public class RequestHandler implements Serializable { +public class RequestHandler { public static final String module = RequestHandler.class.getName(); public static final String err_resource = "WebappUiLabels"; |
Free forum by Nabble | Edit this page |