Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpelder2009-04-08 12:47:28 -0400
committerpelder2009-04-08 12:47:28 -0400
commita886d25844621c46d3b0026e58383fa089578a9e (patch)
tree1ee031f8ded312c5303fce1aed235d64dd351f27
parentcc1cc437df8448c6845147467aa80dd707060e2e (diff)
downloadorg.eclipse.jet-a886d25844621c46d3b0026e58383fa089578a9e.tar.gz
org.eclipse.jet-a886d25844621c46d3b0026e58383fa089578a9e.tar.xz
org.eclipse.jet-a886d25844621c46d3b0026e58383fa089578a9e.zip
[271662] JDT AST Inspector returns missing attributes/elements as null
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/xpath/inspectors/jdt/InspectASTNode.java14
1 files changed, 8 insertions, 6 deletions
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/xpath/inspectors/jdt/InspectASTNode.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/xpath/inspectors/jdt/InspectASTNode.java
index c86ef83..68dbb0c 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/xpath/inspectors/jdt/InspectASTNode.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/xpath/inspectors/jdt/InspectASTNode.java
@@ -280,7 +280,9 @@ public class InspectASTNode implements INodeInspector, IElementInspector, INodeI
result.addAll(nonspds);
for (final Iterator i = spds.iterator(); i.hasNext();) {
final SimplePropertyDescriptor spd = (SimplePropertyDescriptor) i.next();
- result.add(new SimplePropertyDescriptorAttribute(astNode,spd));
+ if(astNode.getStructuralProperty(spd) != null) {
+ result.add(new SimplePropertyDescriptorAttribute(astNode,spd));
+ }
}
return result.toArray();
}
@@ -298,11 +300,10 @@ public class InspectASTNode implements INodeInspector, IElementInspector, INodeI
final StructuralPropertyDescriptor spd = getPropertyDescriptor(astNode, propertyName);
- if(spd != null && spd.isSimpleProperty()) {
+ if(spd != null && spd.isSimpleProperty() && astNode.getStructuralProperty(spd) != null) {
return new SimplePropertyDescriptorAttribute(astNode, (SimplePropertyDescriptor)spd);
}
-
return null;
}
@@ -332,10 +333,11 @@ public class InspectASTNode implements INodeInspector, IElementInspector, INodeI
if(spd == null) {
return new Object[0];
}
- if(spd.isChildProperty()) {
- return new Object[] {astNode.getStructuralProperty(spd)};
+ final Object structuralProperty = astNode.getStructuralProperty(spd);
+ if(spd.isChildProperty()) {
+ return structuralProperty != null ? new Object[] {structuralProperty} : null;
} else if(spd.isChildListProperty()) {
- return ((List)astNode.getStructuralProperty(spd)).toArray();
+ return structuralProperty != null ? ((List)structuralProperty).toArray() : null;
}

Back to the top