summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpelder2006-04-13 13:44:45 (EDT)
committerpelder2006-04-13 13:44:45 (EDT)
commit02b987734a7f62018bf391a1b19a0e2470fb871e (patch)
treee1b9d41f6c3c7213136febaf388a38ef0e62ca81
parent3af757e95c26600261cca52a302f344a60d3fb32 (diff)
downloadorg.eclipse.jet-02b987734a7f62018bf391a1b19a0e2470fb871e.zip
org.eclipse.jet-02b987734a7f62018bf391a1b19a0e2470fb871e.tar.gz
org.eclipse.jet-02b987734a7f62018bf391a1b19a0e2470fb871e.tar.bz2
[133151] Handle case where attribute is unset and the default value is null. Also be a bit more defensive on null values.
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/xpath/functions/StringFunction.java6
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/xpath/inspectors/EObjectInspector.java3
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/xpath/inspector/InspectorManager.java4
3 files changed, 11 insertions, 2 deletions
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/xpath/functions/StringFunction.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/xpath/functions/StringFunction.java
index d48e89b..f2e09f7 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/xpath/functions/StringFunction.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/xpath/functions/StringFunction.java
@@ -71,7 +71,11 @@ public class StringFunction implements XPathFunction, XPathFunctionWithContext
public static String evaluate(Object object)
{
- if (object instanceof String)
+ if(object == null)
+ {
+ return ""; //$NON-NLS-1$
+ }
+ else if (object instanceof String)
{
return (String)object;
}
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/xpath/inspectors/EObjectInspector.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/xpath/inspectors/EObjectInspector.java
index 274cfd5..071d69d 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/xpath/inspectors/EObjectInspector.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/xpath/inspectors/EObjectInspector.java
@@ -136,7 +136,8 @@ public class EObjectInspector implements IElementInspector, INodeInspectorExtens
EObject eObject = (EObject)contextNode;
final Setting setting = getNamedAttributeInternal(eObject, nameTestExpandedName);
// return setting == null || !setting.isSet() ? null : setting;
- return setting; // Fix bug 133151
+ // Fix bug 133151
+ return setting == null || (!setting.isSet() && setting.get(true) == null) ? null : setting;
}
/**
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 d620994..debc84f 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
@@ -132,6 +132,10 @@ public final class InspectorManager
public INodeInspector getInspector(Object object)
{
+ if(object == null)
+ {
+ return null;
+ }
String inspectableClassName = object.getClass().getName();
// make a local copy to avoid concurrent flush
Map cache = cachedInspectorsByConcreteClass;