Author: azeez Date: Tue May 22 23:25:33 2007 New Revision: 540854 URL: http://svn.apache.org/viewvc?view=rev&rev=540854 Log: Handling possible NPEs
Modified: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/context/ContextClusteringCommandFactory.java webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/context/PropertyUpdater.java webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/context/commands/UpdateConfigurationContextCommand.java webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/context/commands/UpdateServiceContextCommand.java webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/context/commands/UpdateServiceGroupContextCommand.java webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/ChannelSender.java Modified: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/context/ContextClusteringCommandFactory.java URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/context/ContextClusteringCommandFactory.java?view=diff&rev=540854&r1=540853&r2=540854 ============================================================================== --- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/context/ContextClusteringCommandFactory.java (original) +++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/context/ContextClusteringCommandFactory.java Tue May 22 23:25:33 2007 @@ -33,41 +33,37 @@ Map excludedPropertyPatterns) { ContextClusteringCommand cmd = null; - UpdateContextCommand updateCmd = (UpdateContextCommand) cmd; if (context instanceof ConfigurationContext) { - updateCmd = new UpdateConfigurationContextCommand(); - fillProperties(updateCmd, + cmd = new UpdateConfigurationContextCommand(); + fillProperties((UpdateContextCommand) cmd, context, excludedPropertyPatterns); } else if (context instanceof ServiceGroupContext) { ServiceGroupContext sgCtx = (ServiceGroupContext) context; - updateCmd = new UpdateServiceGroupContextCommand(); + cmd = new UpdateServiceGroupContextCommand(); UpdateServiceGroupContextCommand updateSgCmd = - (UpdateServiceGroupContextCommand) updateCmd; + (UpdateServiceGroupContextCommand) cmd; updateSgCmd.setServiceGroupName(sgCtx.getDescription().getServiceGroupName()); updateSgCmd.setServiceGroupContextId(sgCtx.getId()); - fillProperties(updateCmd, + fillProperties((UpdateContextCommand) cmd, context, excludedPropertyPatterns); - //TODO: impl } else if (context instanceof ServiceContext) { ServiceContext serviceCtx = (ServiceContext) context; - updateCmd = new UpdateServiceContextCommand(); + cmd = new UpdateServiceContextCommand(); UpdateServiceContextCommand updateServiceCmd = - (UpdateServiceContextCommand) updateCmd; - - // TODO impl + (UpdateServiceContextCommand) cmd; updateServiceCmd.setServiceGroupName(serviceCtx.getGroupName()); updateServiceCmd.setServiceName(serviceCtx.getAxisService().getName()); - fillProperties(updateCmd, + fillProperties((UpdateContextCommand) cmd, context, excludedPropertyPatterns); } - context.clearPropertyDifferences(); // Once we send the diffs, we should clear the diffs - if(updateCmd != null && updateCmd.isPropertiesEmpty()){ + if (cmd != null && ((UpdateContextCommand) cmd).isPropertiesEmpty()) { cmd = null; } + context.clearPropertyDifferences(); // Once we send the diffs, we should clear the diffs return cmd; } @@ -98,7 +94,7 @@ // First check in the default excludes List defaultExcludes = (List) excludedPropertyPatterns.get(DeploymentConstants.TAG_DEFAULTS); - if(defaultExcludes == null){ + if (defaultExcludes == null) { return false; } if (isExcluded(defaultExcludes, propertyName)) { Modified: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/context/PropertyUpdater.java URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/context/PropertyUpdater.java?view=diff&rev=540854&r1=540853&r2=540854 ============================================================================== --- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/context/PropertyUpdater.java (original) +++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/context/PropertyUpdater.java Tue May 22 23:25:33 2007 @@ -21,6 +21,7 @@ import java.io.Serializable; import java.util.Iterator; import java.util.Map; +import java.util.Properties; /** * Modified: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/context/commands/UpdateConfigurationContextCommand.java URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/context/commands/UpdateConfigurationContextCommand.java?view=diff&rev=540854&r1=540853&r2=540854 ============================================================================== --- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/context/commands/UpdateConfigurationContextCommand.java (original) +++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/context/commands/UpdateConfigurationContextCommand.java Tue May 22 23:25:33 2007 @@ -40,6 +40,10 @@ } public boolean isPropertiesEmpty(){ + if (propertyUpdater.getProperties() == null) { + propertyUpdater.setProperties(new HashMap()); + return true; + } return propertyUpdater.getProperties().isEmpty(); } Modified: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/context/commands/UpdateServiceContextCommand.java URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/context/commands/UpdateServiceContextCommand.java?view=diff&rev=540854&r1=540853&r2=540854 ============================================================================== --- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/context/commands/UpdateServiceContextCommand.java (original) +++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/context/commands/UpdateServiceContextCommand.java Tue May 22 23:25:33 2007 @@ -66,6 +66,10 @@ } public boolean isPropertiesEmpty() { + if (propertyUpdater.getProperties() == null) { + propertyUpdater.setProperties(new HashMap()); + return true; + } return propertyUpdater.getProperties().isEmpty(); } Modified: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/context/commands/UpdateServiceGroupContextCommand.java URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/context/commands/UpdateServiceGroupContextCommand.java?view=diff&rev=540854&r1=540853&r2=540854 ============================================================================== --- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/context/commands/UpdateServiceGroupContextCommand.java (original) +++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/context/commands/UpdateServiceGroupContextCommand.java Tue May 22 23:25:33 2007 @@ -42,9 +42,13 @@ } public boolean isPropertiesEmpty() { + if (propertyUpdater.getProperties() == null) { + propertyUpdater.setProperties(new HashMap()); + return true; + } return propertyUpdater.getProperties().isEmpty(); } - + public void addProperty(PropertyDifference diff) { if (propertyUpdater.getProperties() == null) { propertyUpdater.setProperties(new HashMap()); Modified: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/ChannelSender.java URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/ChannelSender.java?view=diff&rev=540854&r1=540853&r2=540854 ============================================================================== --- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/ChannelSender.java (original) +++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/ChannelSender.java Tue May 22 23:25:33 2007 @@ -32,6 +32,7 @@ private static final Log log = LogFactory.getLog(ChannelSender.class); public void sendToGroup(ClusteringCommand msg) throws ClusteringFault { + if(channel == null) return; Member[] group = channel.getMembers(); log.debug("Group size " + group.length); // send the message @@ -52,6 +53,7 @@ } public void sendToSelf(ClusteringCommand msg) throws ClusteringFault { + if(channel == null) return; try { channel.send(new Member[]{channel.getLocalMember(true)}, msg, @@ -62,6 +64,7 @@ } public void sendToGroup(Throwable throwable) throws ClusteringFault { + if(channel == null) return; Member[] group = channel.getMembers(); log.debug("Group size " + group.length); // send the message --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]