[103327] JS Protecting data models from returning null when getting valid property descriptors.
diff --git a/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/datamodel/DataModelImpl.java b/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/datamodel/DataModelImpl.java
index a1afaa5..04ba292 100644
--- a/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/datamodel/DataModelImpl.java
+++ b/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/datamodel/DataModelImpl.java
@@ -36,6 +36,8 @@
private static final String PROPERTY_NOT_LOCATED_ = WTPResourceHandler.getString("20"); //$NON-NLS-1$
private static final String NESTED_MODEL_NOT_LOCATED = WTPResourceHandler.getString("21"); //$NON-NLS-1$
+
+ private static final DataModelPropertyDescriptor [] NO_DESCRIPTORS = new DataModelPropertyDescriptor[0];
private Collection basePropertyNames;
private Collection allPropertyNames;
@@ -312,7 +314,7 @@
public DataModelPropertyDescriptor[] getValidPropertyDescriptors(String propertyName) {
DataModelImpl dataModel = getOwningDataModel(propertyName);
DataModelPropertyDescriptor[] descriptors = dataModel.provider.getValidPropertyDescriptors(propertyName);
- return descriptors == null ? new DataModelPropertyDescriptor[0] : descriptors;
+ return descriptors == null ? NO_DESCRIPTORS : descriptors;
}
public DataModelPropertyDescriptor getPropertyDescriptor(String propertyName) {
diff --git a/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/operations/WTPOperationDataModel.java b/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/operations/WTPOperationDataModel.java
index 26ba941..ae829e9 100644
--- a/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/operations/WTPOperationDataModel.java
+++ b/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/operations/WTPOperationDataModel.java
@@ -123,6 +123,8 @@
private static final String PROPERTY_NOT_LOCATED_ = WTPResourceHandler.getString("20"); //$NON-NLS-1$
private static final String NESTED_MODEL_NOT_LOCATED = WTPResourceHandler.getString("21"); //$NON-NLS-1$
private static final String NESTED_MODEL_DUPLICATE = WTPResourceHandler.getString("33"); //$NON-NLS-1$
+
+ private static final WTPPropertyDescriptor[] NO_DESCRIPTORS = new WTPPropertyDescriptor[0];
private Set validProperties = new HashSet();
private Set validBaseProperties = new HashSet();
@@ -418,7 +420,11 @@
public final WTPPropertyDescriptor[] getValidPropertyDescriptors(String propertyName) {
checkValidPropertyName(propertyName);
if (isBaseProperty(propertyName)) {
- return doGetValidPropertyDescriptors(propertyName);
+ WTPPropertyDescriptor[] descriptors = doGetValidPropertyDescriptors(propertyName);
+ if(null == descriptors){
+ descriptors = NO_DESCRIPTORS;
+ }
+ return descriptors;
} else if (nestedModels != null) {
WTPOperationDataModel dataModel = null;
Object[] keys = nestedModels.keySet().toArray();
@@ -442,7 +448,7 @@
* @see #getValidPropertyDescriptors(String)
*/
protected WTPPropertyDescriptor[] doGetValidPropertyDescriptors(String propertyName) {
- return new WTPPropertyDescriptor[0];
+ return NO_DESCRIPTORS;
}
/**