Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpelder2007-12-06 14:03:05 -0500
committerpelder2007-12-06 14:03:05 -0500
commit9976ccb7bf7f65f559565d428f29dd57d03c91cf (patch)
treec98f68eef163c63a568ff33906654578b1527141
parentdcff51d99754130c296a22e206133fed1801af64 (diff)
downloadorg.eclipse.jet-9976ccb7bf7f65f559565d428f29dd57d03c91cf.tar.gz
org.eclipse.jet-9976ccb7bf7f65f559565d428f29dd57d03c91cf.tar.xz
org.eclipse.jet-9976ccb7bf7f65f559565d428f29dd57d03c91cf.zip
[211591] NullPointerException from local-name() XPath function.
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/xpath/inspector/InspectorManager.java56
1 files changed, 54 insertions, 2 deletions
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/xpath/inspector/InspectorManager.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/xpath/inspector/InspectorManager.java
index 6aa00e7..da19490 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/xpath/inspector/InspectorManager.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/xpath/inspector/InspectorManager.java
@@ -33,6 +33,57 @@ import java.util.Set;
public final class InspectorManager
{
+ /**
+ * Inspector for unknown nodes.
+ */
+ private static final class UnknownObjectInspector implements INodeInspector {
+
+ private static final Object[] EMPTY_OBJECT_ARRAY = new Object[0];
+
+ public ExpandedName expandedNameOf(Object node)
+ {
+ return new ExpandedName(""); //$NON-NLS-1$
+ }
+
+ public Object[] getChildren(Object node)
+ {
+ return EMPTY_OBJECT_ARRAY;
+ }
+
+ public Object getDocumentRoot(Object node)
+ {
+ return null;
+ }
+
+ public NodeKind getNodeKind(Object obj)
+ {
+ return null;
+ }
+
+ public Object getParent(Object obj)
+ {
+ return null;
+ }
+
+ public String nameOf(Object node)
+ {
+ return ""; //$NON-NLS-1$
+ }
+
+ public String stringValueOf(Object node)
+ {
+ return node.toString();
+ }
+
+ public boolean testExpandedName(Object node, ExpandedName testName)
+ {
+ return false;
+ }
+
+ }
+
+ private final INodeInspector unknownObjectInspector = new UnknownObjectInspector();
+
private static InspectorManager instance = null;
private Map inspectorInstances = new HashMap();
@@ -156,10 +207,11 @@ public final class InspectorManager
}
}
- if (inspector != null)
+ if (inspector == null)
{
- cache.put(inspectableClassName, inspector);
+ inspector = unknownObjectInspector;
}
+ cache.put(inspectableClassName, inspector);
}
return inspector;
}

Back to the top