Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornhauge2010-06-30 13:40:20 -0400
committernhauge2010-06-30 13:40:20 -0400
commitcf5275ac64f3f2adb39831ac0b47eda2ab6e21cd (patch)
treec5f4deeab7235646d28d0e0a9998a1dcca80914a
parentd651ee54c7c3739bc88867be75af3d4a8d55feba (diff)
downloadwebtools.dali-cf5275ac64f3f2adb39831ac0b47eda2ab6e21cd.tar.gz
webtools.dali-cf5275ac64f3f2adb39831ac0b47eda2ab6e21cd.tar.xz
webtools.dali-cf5275ac64f3f2adb39831ac0b47eda2ab6e21cd.zip
314541 - handle empty property names. Patch from Tran.
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/caching/EclipseLinkCaching.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/customization/EclipseLinkCustomization.java11
2 files changed, 35 insertions, 9 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/caching/EclipseLinkCaching.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/caching/EclipseLinkCaching.java
index 8a34c6de29..8587fbc214 100644
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/caching/EclipseLinkCaching.java
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/caching/EclipseLinkCaching.java
@@ -21,6 +21,7 @@ import org.eclipse.jpt.eclipselink.core.context.persistence.caching.CacheType;
import org.eclipse.jpt.eclipselink.core.context.persistence.caching.Caching;
import org.eclipse.jpt.eclipselink.core.context.persistence.caching.FlushClearCache;
import org.eclipse.jpt.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnitProperties;
+import org.eclipse.jpt.utility.internal.StringTools;
import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
@@ -236,8 +237,10 @@ public class EclipseLinkCaching extends EclipseLinkPersistenceUnitProperties
private void cacheTypeChanged(String propertyName, String stringValue) {
String entityName = this.extractEntityNameOf(propertyName);
- Entity old = this.setEntityCacheTypeOf(entityName, stringValue);
- this.firePropertyChanged(CACHE_TYPE_PROPERTY, old, this.getEntityNamed(entityName));
+ if( ! StringTools.stringIsEmpty(entityName)) {
+ Entity old = this.setEntityCacheTypeOf(entityName, stringValue);
+ this.firePropertyChanged(CACHE_TYPE_PROPERTY, old, this.getEntityNamed(entityName));
+ }
}
public CacheType getDefaultCacheType() {
@@ -258,8 +261,10 @@ public class EclipseLinkCaching extends EclipseLinkPersistenceUnitProperties
private void cacheSizeChanged(String propertyName, String stringValue) {
String entityName = this.extractEntityNameOf(propertyName);
- Entity old = this.setEntityCacheSizeOf(entityName, stringValue);
- this.firePropertyChanged(CACHE_SIZE_PROPERTY, old, this.getEntityNamed(entityName));
+ if( ! StringTools.stringIsEmpty(entityName)) {
+ Entity old = this.setEntityCacheSizeOf(entityName, stringValue);
+ this.firePropertyChanged(CACHE_SIZE_PROPERTY, old, this.getEntityNamed(entityName));
+ }
}
public Integer getDefaultCacheSize() {
@@ -280,8 +285,10 @@ public class EclipseLinkCaching extends EclipseLinkPersistenceUnitProperties
private void sharedCacheChanged(String propertyName, String stringValue) {
String entityName = this.extractEntityNameOf(propertyName);
- Entity old = this.setEntitySharedCacheOf(entityName, stringValue);
- this.firePropertyChanged(SHARED_CACHE_PROPERTY, old, this.getEntityNamed(entityName));
+ if( ! StringTools.stringIsEmpty(entityName)) {
+ Entity old = this.setEntitySharedCacheOf(entityName, stringValue);
+ this.firePropertyChanged(SHARED_CACHE_PROPERTY, old, this.getEntityNamed(entityName));
+ }
}
public Boolean getDefaultSharedCache() {
@@ -387,6 +394,10 @@ public class EclipseLinkCaching extends EclipseLinkPersistenceUnitProperties
* Returns the old Entity
*/
private Entity setEntityCacheTypeOf(String entityName, String stringValue) {
+ if(( ! this.entityExists(entityName)) && StringTools.stringIsEmpty(stringValue)) {
+ //this is a property that is currently being added, we don't need to deal with it until the value is set
+ return null;
+ }
CacheType newValue = getEnumValueOf(stringValue, CacheType.values());
return this.setEntityCacheTypeOf(entityName, newValue);
}
@@ -423,6 +434,10 @@ public class EclipseLinkCaching extends EclipseLinkPersistenceUnitProperties
* Returns the old Entity
*/
private Entity setEntityCacheSizeOf(String entityName, String stringValue) {
+ if(( ! this.entityExists(entityName)) && StringTools.stringIsEmpty(stringValue)) {
+ //this is a property that is currently being added, we don't need to deal with it until the value is set
+ return null;
+ }
Integer newValue = getIntegerValueOf(stringValue);
return this.setEntityCacheSizeOf(entityName, newValue);
}
@@ -459,6 +474,10 @@ public class EclipseLinkCaching extends EclipseLinkPersistenceUnitProperties
* Returns the old Entity
*/
private Entity setEntitySharedCacheOf(String entityName, String stringValue) {
+ if(( ! this.entityExists(entityName)) && StringTools.stringIsEmpty(stringValue)) {
+ //this is a property that is currently being added, we don't need to deal with it until the value is set
+ return null;
+ }
Boolean newValue = getBooleanValueOf(stringValue);
return this.setEntitySharedCacheOf(entityName, newValue);
}
@@ -520,7 +539,7 @@ public class EclipseLinkCaching extends EclipseLinkPersistenceUnitProperties
private Entity buildEntity(String name) {
return new Entity(this, name);
}
-
+
private void removeEntity(Entity entity) {
if(entity == null) {
throw new IllegalArgumentException();
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/customization/EclipseLinkCustomization.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/customization/EclipseLinkCustomization.java
index 9e6239f0e8..5df14565e1 100644
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/customization/EclipseLinkCustomization.java
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/customization/EclipseLinkCustomization.java
@@ -21,6 +21,7 @@ import org.eclipse.jpt.eclipselink.core.context.persistence.customization.Custom
import org.eclipse.jpt.eclipselink.core.context.persistence.customization.Profiler;
import org.eclipse.jpt.eclipselink.core.context.persistence.customization.Weaving;
import org.eclipse.jpt.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnitProperties;
+import org.eclipse.jpt.utility.internal.StringTools;
import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
@@ -617,8 +618,10 @@ public class EclipseLinkCustomization extends EclipseLinkPersistenceUnitProperti
private void descriptorCustomizerChanged(String propertyName, String stringValue) {
String entityName = this.extractEntityNameOf(propertyName);
- Entity old = this.setEntityDescriptorCustomizerOf(entityName, stringValue);
- this.firePropertyChanged(DESCRIPTOR_CUSTOMIZER_PROPERTY, old, this.getEntityNamed(entityName));
+ if( ! StringTools.stringIsEmpty(entityName)) {
+ Entity old = this.setEntityDescriptorCustomizerOf(entityName, stringValue);
+ this.firePropertyChanged(DESCRIPTOR_CUSTOMIZER_PROPERTY, old, this.getEntityNamed(entityName));
+ }
}
public String getDefaultDescriptorCustomizer() {
@@ -629,6 +632,10 @@ public class EclipseLinkCustomization extends EclipseLinkPersistenceUnitProperti
* Returns the old Entity
*/
private Entity setEntityDescriptorCustomizerOf(String entityName, String descriptorCustomizerClassName) {
+ if(( ! this.entityExists(entityName)) && StringTools.stringIsEmpty(descriptorCustomizerClassName)) {
+ //this is a property that is currently being added, we don't need to deal with it until the value is set
+ return null;
+ }
Entity entity = (this.entityExists(entityName)) ?
this.getEntityNamed(entityName) :
this.addEntity(entityName);

Back to the top