diff options
author | pfullbright | 2007-06-12 13:59:08 +0000 |
---|---|---|
committer | pfullbright | 2007-06-12 13:59:08 +0000 |
commit | 2909b8e88f89a8ed84b2e5950ac2cb45b03b6920 (patch) | |
tree | 28aaef126e19f2154c8608fd394573bbd6aeabbb /jpa/plugins | |
parent | 269ee50eb1aacd06ff8e1f1d70b70339b670662e (diff) | |
download | webtools.dali-2909b8e88f89a8ed84b2e5950ac2cb45b03b6920.tar.gz webtools.dali-2909b8e88f89a8ed84b2e5950ac2cb45b03b6920.tar.xz webtools.dali-2909b8e88f89a8ed84b2e5950ac2cb45b03b6920.zip |
bug 191287 - fixed NPE when inserting <mapping-file> tags
Diffstat (limited to 'jpa/plugins')
6 files changed, 8 insertions, 11 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.core/model/persistence.ecore b/jpa/plugins/org.eclipse.jpt.core/model/persistence.ecore index 1e27c5bb59..b26c36781e 100644 --- a/jpa/plugins/org.eclipse.jpt.core/model/persistence.ecore +++ b/jpa/plugins/org.eclipse.jpt.core/model/persistence.ecore @@ -43,7 +43,8 @@ </eClassifiers> <eClassifiers xsi:type="ecore:EClass" name="MappingFileRef" eSuperTypes="core.ecore#//XmlEObject"> <eStructuralFeatures xsi:type="ecore:EAttribute" name="fileName" ordered="false" - unique="false" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EString"/> + unique="false" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EString" + defaultValueLiteral=""/> </eClassifiers> <eClassifiers xsi:type="ecore:EClass" name="JavaClassRef" eSuperTypes="core.ecore#//XmlEObject"> <eStructuralFeatures xsi:type="ecore:EAttribute" name="javaClass" ordered="false" diff --git a/jpa/plugins/org.eclipse.jpt.core/plugin.properties b/jpa/plugins/org.eclipse.jpt.core/plugin.properties index 9a70728388..b7fb3b7d62 100644 --- a/jpa/plugins/org.eclipse.jpt.core/plugin.properties +++ b/jpa/plugins/org.eclipse.jpt.core/plugin.properties @@ -36,4 +36,4 @@ JPA_TEMPLATE_LABEL=JPA Project JPA_VALIDATOR=JPA Validator ORM_XML_CONTENT = ORM XML Content -PERSISTENCE_XML_CONTENT = Persistence XML Content
\ No newline at end of file +PERSISTENCE_XML_CONTENT = Persistence XML Content diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/JavaClassRef.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/JavaClassRef.java index 9d1c134d7e..c99506262d 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/JavaClassRef.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/JavaClassRef.java @@ -118,7 +118,6 @@ public class JavaClassRef extends XmlEObject int dotIndex = fqClassName.lastIndexOf('.'); String packageName = (dotIndex >= 0) ? fqClassName.substring(0, dotIndex) : ""; String className = (dotIndex >= 0) ? fqClassName.substring(dotIndex + 1, fqClassName.length()) : fqClassName; - return JDTTools.findType(packageName, className, getJpaProject().getJavaProject()); } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/MappingFileRef.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/MappingFileRef.java index 8dd632f0b2..3b577aeb45 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/MappingFileRef.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/MappingFileRef.java @@ -51,7 +51,7 @@ public class MappingFileRef extends XmlEObject * @generated * @ordered */ - protected static final String FILE_NAME_EDEFAULT = null; + protected static final String FILE_NAME_EDEFAULT = ""; /** * The cached value of the '{@link #getFileName() <em>File Name</em>}' attribute. @@ -84,6 +84,7 @@ public class MappingFileRef extends XmlEObject /** * Returns the value of the '<em><b>File Name</b></em>' attribute. + * The default value is <code>""</code>. * <!-- begin-user-doc --> * <p> * If the meaning of the '<em>File Name</em>' attribute isn't clear, @@ -93,7 +94,7 @@ public class MappingFileRef extends XmlEObject * @return the value of the '<em>File Name</em>' attribute. * @see #setFileName(String) * @see org.eclipse.jpt.core.internal.content.persistence.PersistencePackage#getMappingFileRef_FileName() - * @model unique="false" ordered="false" + * @model default="" unique="false" ordered="false" * @generated */ public String getFileName() { @@ -200,21 +201,19 @@ public class MappingFileRef extends XmlEObject IVirtualComponent component = ComponentCore.createComponent(getJpaProject().getProject()); IVirtualFolder virtualRootFolder = component.getRootFolder(); IVirtualFile virtualMappingFile = virtualRootFolder.getFile(new Path(fileName)); - // keep track of whether one has been found so that we may know if multiple exist IJpaFile mappingFile = null; for (IFile underlyingFile : virtualMappingFile.getUnderlyingFiles()) { IJpaFile jpaFile = JptCorePlugin.getJpaFile(underlyingFile); if (jpaFile != null) { if (mappingFile != null) { - return null; // multiple do exist + return null; // multiple do exist } else { mappingFile = jpaFile; } } } - return mappingFile; } } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/PersistencePackage.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/PersistencePackage.java index 11012c7c1a..92f9870d35 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/PersistencePackage.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/PersistencePackage.java @@ -1081,7 +1081,7 @@ public class PersistencePackage extends EPackageImpl initEAttribute(getPersistenceUnit_Name(), theXMLTypePackage.getString(), "name", null, 1, 1, PersistenceUnit.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEAttribute(getPersistenceUnit_TransactionType(), this.getPersistenceUnitTransactionType(), "transactionType", "JTA", 0, 1, PersistenceUnit.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEClass(mappingFileRefEClass, MappingFileRef.class, "MappingFileRef", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEAttribute(getMappingFileRef_FileName(), theEcorePackage.getEString(), "fileName", null, 0, 1, MappingFileRef.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, !IS_ORDERED); + initEAttribute(getMappingFileRef_FileName(), theEcorePackage.getEString(), "fileName", "", 0, 1, MappingFileRef.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, !IS_ORDERED); initEClass(javaClassRefEClass, JavaClassRef.class, "JavaClassRef", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEAttribute(getJavaClassRef_JavaClass(), theEcorePackage.getEString(), "javaClass", null, 0, 1, JavaClassRef.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, !IS_ORDERED); initEClass(propertiesEClass, Properties.class, "Properties", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/PersistenceUnitTransactionType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/PersistenceUnitTransactionType.java index 8a9ad2853d..cc3658a166 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/PersistenceUnitTransactionType.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/PersistenceUnitTransactionType.java @@ -8,8 +8,6 @@ *******************************************************************************/ package org.eclipse.jpt.core.internal.content.persistence; -import static org.eclipse.jpt.core.internal.content.persistence.PersistenceUnitTransactionType.JTA_VALUE; -import static org.eclipse.jpt.core.internal.content.persistence.PersistenceUnitTransactionType.RESOURCE_LOCAL_VALUE; import java.util.Arrays; import java.util.Collections; import java.util.List; |