Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeil Hauge2012-12-19 22:35:44 +0000
committerNeil Hauge2012-12-19 22:35:44 +0000
commit8ce5c10a96438d09634774264173493d796c6000 (patch)
treee2523a39f2edfeb1c08871d970f3d0c449d359c2
parent68efcb0ba290ba0f969caa15d7407efd47243b64 (diff)
downloadwebtools.dali-8ce5c10a96438d09634774264173493d796c6000.tar.gz
webtools.dali-8ce5c10a96438d09634774264173493d796c6000.tar.xz
webtools.dali-8ce5c10a96438d09634774264173493d796c6000.zip
394063 - Fix invalid validation where adapters are binary.
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlElement.java31
1 files changed, 20 insertions, 11 deletions
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlElement.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlElement.java
index e207b7f13e..dbbef3f1e8 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlElement.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlElement.java
@@ -25,6 +25,7 @@ import org.eclipse.jpt.jaxb.core.context.JaxbPackageInfo;
import org.eclipse.jpt.jaxb.core.context.JaxbPersistentAttribute;
import org.eclipse.jpt.jaxb.core.context.JaxbQName;
import org.eclipse.jpt.jaxb.core.context.JaxbTypeMapping;
+import org.eclipse.jpt.jaxb.core.context.XmlAdaptableMapping;
import org.eclipse.jpt.jaxb.core.context.XmlElement;
import org.eclipse.jpt.jaxb.core.context.XmlElementWrapper;
import org.eclipse.jpt.jaxb.core.context.XmlSchemaType;
@@ -374,19 +375,27 @@ public class GenericJavaXmlElement
this,
getTypeTextRange(astRoot)));
}
- else if (! StringTools.stringIsEmpty(this.specifiedType)
+ else {
+ //TODO - the following check can be removed once proper binary support is added to JAXB projects
+ //verify that a binary XmlAdapter is not being used before continuing with validation (to avoid invalid errors) - see bug 394063
+ XmlAdaptableMapping mapping = (XmlAdaptableMapping) getAttributeMapping();
+ if (mapping.getXmlJavaTypeAdapter() != null && mapping.getXmlAdapter() == null) { // XmlAdapter is either binary or invalid (which results in other validation errors)
+ return;
+ }
+ if (! StringTools.stringIsEmpty(this.specifiedType)
// verify that type actually exists before validating
&& JDTTools.findType(getJaxbProject().getJavaProject(), fqType) != null) {
- String attributeBaseType = getAttributeMapping().getValueTypeName();
- if (! JDTTools.typeIsSubType(getJaxbProject().getJavaProject(), fqType, attributeBaseType)) {
- messages.add(
- DefaultValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JaxbValidationMessages.XML_ELEMENT__ILLEGAL_TYPE,
- new String[] { attributeBaseType },
- this,
- getTypeTextRange(astRoot)));
-
+ String attributeBaseType = getAttributeMapping().getValueTypeName();
+ if (! JDTTools.typeIsSubType(getJaxbProject().getJavaProject(), fqType, attributeBaseType)) {
+ messages.add(
+ DefaultValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JaxbValidationMessages.XML_ELEMENT__ILLEGAL_TYPE,
+ new String[] { attributeBaseType },
+ this,
+ getTypeTextRange(astRoot)));
+
+ }
}
}
}

Back to the top