Author: manik.surtani(a)jboss.com
Date: 2008-06-27 07:29:56 -0400 (Fri, 27 Jun 2008)
New Revision: 6086
Modified:
core/trunk/src/main/java/org/jboss/cache/commands/read/GetChildrenNamesCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/write/VersionedInvalidateCommand.java
Log:
Null checks
Modified:
core/trunk/src/main/java/org/jboss/cache/commands/read/GetChildrenNamesCommand.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/commands/read/GetChildrenNamesCommand.java 2008-06-27
11:10:02 UTC (rev 6085)
+++
core/trunk/src/main/java/org/jboss/cache/commands/read/GetChildrenNamesCommand.java 2008-06-27
11:29:56 UTC (rev 6086)
@@ -41,7 +41,7 @@
*/
public Object perform(InvocationContext ctx)
{
- NodeSPI n = ctx.lookUpNode(fqn);
+ NodeSPI n = fqn == null ? null : ctx.lookUpNode(fqn);
if (n == null) return null;
Map childrenMap = n.getChildrenMapDirect();
if (childrenMap == null || childrenMap.isEmpty()) return Collections.emptySet();
Modified:
core/trunk/src/main/java/org/jboss/cache/commands/write/VersionedInvalidateCommand.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/commands/write/VersionedInvalidateCommand.java 2008-06-27
11:10:02 UTC (rev 6085)
+++
core/trunk/src/main/java/org/jboss/cache/commands/write/VersionedInvalidateCommand.java 2008-06-27
11:29:56 UTC (rev 6086)
@@ -83,7 +83,8 @@
{
throw new NullPointerException("Node " + node.getFqn() + " has a
null data version, and is of type " + node.getClass().getSimpleName() + ". This
command expects versioned nodes.");
}
- else if (node.getVersion().newerThan(dataVersion))
+ else
+ if (dataVersion != null && node.getVersion().newerThan(dataVersion)) //
dataVersion *could* be null if the invalidate was triggered by removing a node that did
not exist in the first place.
{
String errMsg = new StringBuilder("Node found, but version is not equal to
or less than the expected [").append(dataVersion).append("]. Is
[").append(node.getVersion()).append("] instead!").toString();
log.warn(errMsg);
Show replies by date