Updated EL to 2.2 and made code and tests work under java 1.5.

This commit is contained in:
Willem Cazander 2012-09-26 21:49:08 +02:00
parent c38c283fe9
commit 4844df7f84
23 changed files with 215 additions and 178 deletions

View file

@ -2,10 +2,22 @@
Building X4O Building X4O
You need a few software packages; You need a few software packages;
- java sdk 1.5 or higher. - java 1.5 or higher.
- maven 3 or higher. - maven 3 or higher.
-- Run multi jvm test --
todo make maven like;
note2: this does need maven 3.0.3++ in 3.0.1 there is some java6 classes.
export JAVA_HOME=/usr/lib/jvm/java-6-openjdk-amd64/;mvn clean test
export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64/;mvn clean test
export JAVA_HOME=/usr/lib/jvm/j2sdk1.6-oracle/;mvn clean test
export JAVA_HOME=/usr/lib/jvm/j2sdk1.7-oracle/;mvn clean test
export JAVA_HOME=/usr/lib/jvm/jdk1.5.0_22/;~/bin/mvn3/apache-maven-3.0.3/bin/mvn clean test
#not working;
#export JAVA_HOME=/usr/lib/jvm/java-1.5.0-gcj-4.7/;~/bin/mvn3/apache-maven-3.0.3/bin/mvn clean test
-- Create package -- -- Create package --

View file

@ -96,9 +96,10 @@
<mockito-all.version>1.9.0</mockito-all.version> <mockito-all.version>1.9.0</mockito-all.version>
<testng.version>6.3.1</testng.version> <testng.version>6.3.1</testng.version>
<junit.version>4.10</junit.version> <junit.version>4.10</junit.version>
<xerces.version>2.10.0</xerces.version><!-- Only needed in jdk1.5 -->
<!-- Application lib versions --> <!-- Application lib versions -->
<java.el.version>1.2</java.el.version> <jasper-el.version>6.0.20</jasper-el.version>
<juel.version>2.1.0</juel.version> <juel.version>2.1.0</juel.version>
</properties> </properties>
<build> <build>

View file

@ -11,14 +11,9 @@
<description>x4o-core</description> <description>x4o-core</description>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>javax.el</groupId> <groupId>org.apache.tomcat</groupId>
<artifactId>el-api</artifactId> <artifactId>jasper-el</artifactId>
<version>${java.el.version}</version> <version>${jasper-el.version}</version>
</dependency>
<dependency>
<groupId>javax.el</groupId>
<artifactId>el-ri</artifactId>
<version>${java.el.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>de.odysseus.juel</groupId> <groupId>de.odysseus.juel</groupId>
@ -31,7 +26,13 @@
<artifactId>junit</artifactId> <artifactId>junit</artifactId>
<version>${junit.version}</version> <version>${junit.version}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>${xerces.version}</version>
<scope>test</scope>
</dependency>
</dependencies> </dependencies>
<build> <build>
<pluginManagement> <pluginManagement>

View file

@ -124,7 +124,8 @@ public class X4OEntityResolver implements EntityResolver {
in.setSystemId(systemId); in.setSystemId(systemId);
return in; return in;
} catch (IOException e) { } catch (IOException e) {
throw new IOException("Could not open: "+schemaFile+" error: "+e.getMessage(),e); // note; IOException(String,Exception) is java6
throw new SAXException("Could not open: "+schemaFile+" error: "+e.getMessage(),e);
} }
} }
} }
@ -142,7 +143,7 @@ public class X4OEntityResolver implements EntityResolver {
in.setSystemId(systemId); in.setSystemId(systemId);
return in; return in;
} catch (IOException e) { } catch (IOException e) {
throw new IOException("Could not open: "+resource+" error: "+e.getMessage(),e); throw new SAXException("Could not open: "+resource+" error: "+e.getMessage(),e);
} }
} }
} }
@ -155,7 +156,7 @@ public class X4OEntityResolver implements EntityResolver {
in.setSystemId(systemId); in.setSystemId(systemId);
return in; return in;
} catch (IOException e) { } catch (IOException e) {
throw new IOException("Could not open: "+systemId+" error: "+e.getMessage(),e); throw new SAXException("Could not open: "+systemId+" error: "+e.getMessage(),e);
} }
} }

View file

@ -127,7 +127,7 @@ public class X4OParser extends AbstractXMLParser implements X4OParserSupport {
if (name==null) { if (name==null) {
throw new NullPointerException("Can't add null name."); throw new NullPointerException("Can't add null name.");
} }
if (name.isEmpty()) { if (name.length()==0) {
throw new NullPointerException("Can't add empty name."); throw new NullPointerException("Can't add empty name.");
} }
if (bean==null) { if (bean==null) {

View file

@ -220,10 +220,10 @@ public class X4OTagHandler extends DefaultHandler2 {
return; // no text return; // no text
} }
String text = new String(ch,start,length); String text = new String(ch,start,length);
if (text.isEmpty()) { if (text.length()==0) {
return; // no text return; // no text
} }
if (elementStack.empty()) { if (elementStack.isEmpty()) {
return; // no element return; // no element
} }
Element e = elementStack.peek(); Element e = elementStack.peek();

View file

@ -208,7 +208,7 @@ public enum X4OLanguageProperty {
if (uri==null) { if (uri==null) {
throw new NullPointerException("Can't search null uri."); throw new NullPointerException("Can't search null uri.");
} }
if (uri.isEmpty()) { if (uri.length()==0) {
throw new IllegalArgumentException("Can't search empty uri."); throw new IllegalArgumentException("Can't search empty uri.");
} }
if (uri.startsWith(URI_PREFIX)==false) { if (uri.startsWith(URI_PREFIX)==false) {

View file

@ -48,7 +48,7 @@ public class AttributeFromBodyConfigurator extends AbstractElementConfigurator {
if (name==null) { if (name==null) {
throw new ElementConfiguratorException(this,"name attribute is not set."); throw new ElementConfiguratorException(this,"name attribute is not set.");
} }
if (name.isEmpty()) { if (name.length()==0) {
throw new ElementConfiguratorException(this,"name attribute is empty."); throw new ElementConfiguratorException(this,"name attribute is empty.");
} }
if (bodyType==null) { if (bodyType==null) {
@ -64,7 +64,7 @@ public class AttributeFromBodyConfigurator extends AbstractElementConfigurator {
} else { } else {
throw new ElementConfiguratorException(this,"bodyType attribute value is unknown; "+bodyType); throw new ElementConfiguratorException(this,"bodyType attribute value is unknown; "+bodyType);
} }
if (value.isEmpty()) { if (value.length()==0) {
return; return;
} }
element.getAttributes().put(name, value); element.getAttributes().put(name, value);

View file

@ -65,11 +65,18 @@ public class ElementRefectionBindingHandler extends AbstractElementBindingHandle
} }
Method[] ms = parentObject.getClass().getMethods(); Method[] ms = parentObject.getClass().getMethods();
for (Method m:ms) { for (Method m:ms) {
if (method.equalsIgnoreCase(m.getName())) { Class<?>[] types = m.getParameterTypes();
if (types.length == 0) {
continue;
}
if (types.length > 1) {
continue;
}
if (types[0].isAssignableFrom(childClass)) {
try { try {
m.invoke(parentObject, childObject); m.invoke(parentObject, childObject);
} catch (Exception e) { } catch (Exception e) {
throw new ElementBindingHandlerException("Error in binding beans: "+e.getMessage(),e); throw new ElementBindingHandlerException("Error invoke binding method of: "+getId()+" error: "+e.getMessage(),e);
} }
return; return;
} }

View file

@ -54,7 +54,7 @@ public class EldXsdXmlGenerator {
if (ns.getSchemaResource()==null) { if (ns.getSchemaResource()==null) {
throw new NullPointerException("Can't generate xsd for namespace without schemaResource uri: "+ns.getUri()); throw new NullPointerException("Can't generate xsd for namespace without schemaResource uri: "+ns.getUri());
} }
if (ns.getSchemaResource().isEmpty()) { if (ns.getSchemaResource().length()==0) {
throw new NullPointerException("Can't generate xsd for namespace with empty schemaResource uri: "+ns.getUri()); throw new NullPointerException("Can't generate xsd for namespace with empty schemaResource uri: "+ns.getUri());
} }
} }

View file

@ -46,6 +46,64 @@ public class DefaultElementObjectPropertyValue implements ElementObjectPropertyV
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private Logger logger = Logger.getLogger(DefaultElementObjectPropertyValue.class.getName());
private Method findMethod(Object object,String parameterName,Object parameter) {
// Get class but can be null.
Class<?> parameterClass = null;
if(parameter!=null) {
parameterClass=parameter.getClass();
}
logger.finer("Trying value: pn="+parameterName+" o="+object+" p="+parameter+"("+parameterClass+")");
String parameterNameSet = "set"+parameterName;
Method[] methodes = object.getClass().getMethods();
Method lastMethodFall = null;
for (int i=0;i<methodes.length;i++) {
Method method = methodes[i];
Class<?>[] types = method.getParameterTypes();
if (types.length == 0) {
continue;
}
if (types.length > 1) {
continue;
}
if (method.getName().equalsIgnoreCase(parameterNameSet)) {
lastMethodFall = method;
if (parameterClass!=null) {
// Check for class based parameters.
if (types[0].isAssignableFrom(parameterClass)) {
logger.finest("Found method type: "+method.getParameterTypes()[0]+" for parameter: "+parameterName);
return method;
}
// Check the native parameter types.
if (parameterClass.isAssignableFrom(Boolean.class) && types[0].isAssignableFrom(Boolean.TYPE) ) {
return method;
}
if (parameterClass.isAssignableFrom(Integer.class) && types[0].isAssignableFrom(Integer.TYPE) ) {
return method;
}
if (parameterClass.isAssignableFrom(Long.class) && types[0].isAssignableFrom(Long.TYPE) ) {
return method;
}
if (parameterClass.isAssignableFrom(Double.class) && types[0].isAssignableFrom(Double.TYPE) ) {
return method;
}
if (parameterClass.isAssignableFrom(Float.class) && types[0].isAssignableFrom(Float.TYPE) ) {
return method;
}
if (parameterClass.isAssignableFrom(Byte.class) && types[0].isAssignableFrom(Byte.TYPE) ) {
return method;
}
if (parameterClass.isAssignableFrom(Character.class) && types[0].isAssignableFrom(Character.TYPE) ) {
return method;
}
}
}
}
return lastMethodFall;
}
/** /**
* TODO: this function is not completed !! * TODO: this function is not completed !!
* *
@ -59,61 +117,37 @@ public class DefaultElementObjectPropertyValue implements ElementObjectPropertyV
*/ */
public void setProperty(Object object,String parameterName,Object parameter) throws ElementObjectPropertyValueException { public void setProperty(Object object,String parameterName,Object parameter) throws ElementObjectPropertyValueException {
// a bit hackie // find the method for the parameter
Class<?> parameterClass = null; Method lastMethod = findMethod(object,parameterName,parameter);
if(parameter!=null) {
parameterClass=parameter.getClass();
}
Logger logger = Logger.getLogger(DefaultElementObjectPropertyValue.class.getName());
logger.finer("Trying value: pn="+parameterName+" o="+object+" p="+parameter+"("+parameterClass+")");
String parameterNameSet = "set"+parameterName;
Method[] methodes = object.getClass().getMethods();
Method lastMethod = null;
Method lastMethodFall = null;
for (int i=0;i<methodes.length;i++) {
Method method = methodes[i];
if (method.getName().equalsIgnoreCase(parameterNameSet)) {
lastMethodFall = method;
if (parameterClass!=null && method.getParameterTypes()[0].isAssignableFrom(parameterClass)) {
logger.finest("Found method type: "+method.getParameterTypes()[0]+" for parameter: "+parameterName);
lastMethod = method;
break;
}
}
}
// old loop is now fallback code
if (lastMethod==null && lastMethodFall!=null) {
lastMethod=lastMethodFall;
}
if (lastMethod==null) { if (lastMethod==null) {
logger.finest("No method found, aborting parameter: "+parameterName); logger.finest("No method found, aborting parameter: "+parameterName);
return; return;
} }
// Special case for null value.
if (parameter==null) { if (parameter==null) {
logger.finest("Found parameter is null Setting method: "+lastMethod.getParameterTypes()[0]+" for parameter: "+parameterName); logger.finest("Found parameter is null Setting method: "+lastMethod.getParameterTypes()[0]+" for parameter: "+parameterName);
try { try {
lastMethod.invoke(object,new Object[]{parameter}); lastMethod.invoke(object,new Object[]{parameter});
return;
} catch (Exception e) { } catch (Exception e) {
throw new ElementObjectPropertyValueException(e.getMessage(),e); throw new ElementObjectPropertyValueException(e.getMessage(),e);
} }
return;
} }
// Invoke for class based parameters
if (lastMethod.getParameterTypes()[0].isAssignableFrom(parameter.getClass())) { if (lastMethod.getParameterTypes()[0].isAssignableFrom(parameter.getClass())) {
logger.finest("Found parameter type: "+lastMethod.getParameterTypes()[0]+" for parameter: "+parameterName+" setting value: "+parameter); logger.finest("Found parameter type: "+lastMethod.getParameterTypes()[0]+" for parameter: "+parameterName+" setting value: "+parameter);
try { try {
lastMethod.invoke(object,new Object[]{parameter}); lastMethod.invoke(object,new Object[]{parameter});
return;
} catch (Exception e) { } catch (Exception e) {
throw new ElementObjectPropertyValueException(e.getMessage(),e); throw new ElementObjectPropertyValueException(e.getMessage(),e);
} }
return;
} }
// Invoke for native based types
// not found 2sec try // not found 2sec try
logger.finest("No corresoning class is found, trying convert manualy"); logger.finest("No corresoning class is found, trying convert manualy");
@ -140,117 +174,55 @@ public class DefaultElementObjectPropertyValue implements ElementObjectPropertyV
Object parameter2 = null; Object parameter2 = null;
try { try {
DefaultObjectConverterProvider convProvider = new DefaultObjectConverterProvider(); DefaultObjectConverterProvider convProvider = new DefaultObjectConverterProvider();
convProvider.addDefaults(); convProvider.addDefaults();
ObjectConverter conv = convProvider.getObjectConverterForClass(lastMethod.getParameterTypes()[0]); ObjectConverter conv = convProvider.getObjectConverterForClass(lastMethod.getParameterTypes()[0]);
if (conv!=null) { if (conv!=null) {
parameter2 = conv.convertTo(parameter.toString(), Locale.getDefault()); parameter2 = conv.convertTo(parameter.toString(), Locale.getDefault());
} }
/* /*
if (lastMethod.getParameterTypes()[0].isAssignableFrom(Integer.class) ) { * JAVA NATIVE TYPES:
logger.finest("found Integer"); *
parameter2 = Integer.parseInt(parameter.toString()); * TYPE: Size in bits:
} * boolean 8, unsigned
if (lastMethod.getParameterTypes()[0].isAssignableFrom(Long.class) ) { * byte 8
logger.finest("found Long"); * char 16, unsigned
parameter2 = Long.parseLong(parameter.toString()); * short 16
} * int 32
if (lastMethod.getParameterTypes()[0].isAssignableFrom(Double.class) ) { * long 64
logger.finest("found Double"); * float 32
parameter2 = Double.parseDouble(parameter.toString()); * double 64
} * void n/a
if (lastMethod.getParameterTypes()[0].isAssignableFrom(Float.class) ) { */
logger.finest("found Float"); if (lastMethod.getParameterTypes()[0].isAssignableFrom(Boolean.TYPE) ) {
parameter2 = Float.parseFloat(parameter.toString()); conv = convProvider.getObjectConverterForClass(Boolean.class);
} parameter2 = conv.convertTo(parameter.toString(), Locale.getDefault());
if (lastMethod.getParameterTypes()[0].isAssignableFrom(Byte.class) ) { }
logger.finest("found Byte"); if (lastMethod.getParameterTypes()[0].isAssignableFrom(Integer.TYPE) ) {
parameter2 = Byte.parseByte(parameter.toString()); conv = convProvider.getObjectConverterForClass(Integer.class);
} parameter2 = conv.convertTo(parameter.toString(), Locale.getDefault());
if (lastMethod.getParameterTypes()[0].isAssignableFrom(Character.class) ) { }
logger.finest("found Character"); if (lastMethod.getParameterTypes()[0].isAssignableFrom(Long.TYPE) ) {
parameter2 = new Character(parameter.toString().charAt(0)); conv = convProvider.getObjectConverterForClass(Long.class);
} parameter2 = conv.convertTo(parameter.toString(), Locale.getDefault());
if (lastMethod.getParameterTypes()[0].isAssignableFrom(Boolean.class) ) { }
logger.finest("found Boolean"); if (lastMethod.getParameterTypes()[0].isAssignableFrom(Double.TYPE) ) {
// WARNING: this alway returns a boolean :''( conv = convProvider.getObjectConverterForClass(Double.class);
parameter2 = Boolean.parseBoolean(parameter.toString()); parameter2 = conv.convertTo(parameter.toString(), Locale.getDefault());
}*/ }
if (lastMethod.getParameterTypes()[0].isAssignableFrom(Float.TYPE) ) {
/* conv = convProvider.getObjectConverterForClass(Float.class);
* JAVA NATIVE TYPES: parameter2 = conv.convertTo(parameter.toString(), Locale.getDefault());
* }
* TYPE: Size in bits: if (lastMethod.getParameterTypes()[0].isAssignableFrom(Byte.TYPE) ) {
* boolean 8, unsigned conv = convProvider.getObjectConverterForClass(Byte.class);
* byte 8 parameter2 = conv.convertTo(parameter.toString(), Locale.getDefault());
* char 16, unsigned }
* short 16 if (lastMethod.getParameterTypes()[0].isAssignableFrom(Character.TYPE) ) {
* int 32 conv = convProvider.getObjectConverterForClass(Character.class);
* long 64 parameter2 = conv.convertTo(parameter.toString(), Locale.getDefault());
* float 32 }
* double 64
* void n/a
*/
/*
if (lastMethod.getParameterTypes()[0].isAssignableFrom(Boolean.TYPE) ) {
logger.finest("found boolean");
parameter2 = Boolean.parseBoolean(parameter.toString());
}
if (lastMethod.getParameterTypes()[0].isAssignableFrom(Integer.TYPE) ) {
logger.finest("found int");
parameter2 = Integer.parseInt(parameter.toString());
}
if (lastMethod.getParameterTypes()[0].isAssignableFrom(Long.TYPE) ) {
logger.finest("found long");
parameter2 = Long.parseLong(parameter.toString());
}
if (lastMethod.getParameterTypes()[0].isAssignableFrom(Double.TYPE) ) {
logger.finest("found int");
parameter2 = Double.parseDouble(parameter.toString());
}
if (lastMethod.getParameterTypes()[0].isAssignableFrom(Float.TYPE) ) {
logger.finest("found float");
parameter2 = Float.parseFloat(parameter.toString());
}
if (lastMethod.getParameterTypes()[0].isAssignableFrom(Byte.TYPE) ) {
logger.finest("found byte");
parameter2 = Byte.parseByte(parameter.toString());
}
if (lastMethod.getParameterTypes()[0].isAssignableFrom(Character.TYPE) ) {
logger.finest("found char");
parameter2 = new Character(parameter.toString().charAt(0));
}
*/
if (lastMethod.getParameterTypes()[0].isAssignableFrom(Boolean.TYPE) ) {
conv = convProvider.getObjectConverterForClass(Boolean.class);
parameter2 = conv.convertTo(parameter.toString(), Locale.getDefault());
}
if (lastMethod.getParameterTypes()[0].isAssignableFrom(Integer.TYPE) ) {
conv = convProvider.getObjectConverterForClass(Integer.class);
parameter2 = conv.convertTo(parameter.toString(), Locale.getDefault());
}
if (lastMethod.getParameterTypes()[0].isAssignableFrom(Long.TYPE) ) {
conv = convProvider.getObjectConverterForClass(Long.class);
parameter2 = conv.convertTo(parameter.toString(), Locale.getDefault());
}
if (lastMethod.getParameterTypes()[0].isAssignableFrom(Double.TYPE) ) {
conv = convProvider.getObjectConverterForClass(Double.class);
parameter2 = conv.convertTo(parameter.toString(), Locale.getDefault());
}
if (lastMethod.getParameterTypes()[0].isAssignableFrom(Float.TYPE) ) {
conv = convProvider.getObjectConverterForClass(Float.class);
parameter2 = conv.convertTo(parameter.toString(), Locale.getDefault());
}
if (lastMethod.getParameterTypes()[0].isAssignableFrom(Byte.TYPE) ) {
conv = convProvider.getObjectConverterForClass(Byte.class);
parameter2 = conv.convertTo(parameter.toString(), Locale.getDefault());
}
if (lastMethod.getParameterTypes()[0].isAssignableFrom(Character.TYPE) ) {
conv = convProvider.getObjectConverterForClass(Character.class);
parameter2 = conv.convertTo(parameter.toString(), Locale.getDefault());
}
} catch (ObjectConverterException oce) { } catch (ObjectConverterException oce) {
throw new ElementObjectPropertyValueException(oce.getMessage(),oce); throw new ElementObjectPropertyValueException(oce.getMessage(),oce);

View file

@ -71,13 +71,13 @@ public class DefaultX4OLanguageConfiguration implements X4OLanguageConfiguration
if (language==null) { if (language==null) {
throw new NullPointerException("language may not be null"); throw new NullPointerException("language may not be null");
} }
if (language.isEmpty()) { if (language.length()==0) {
throw new IllegalArgumentException("language may not be empty"); throw new IllegalArgumentException("language may not be empty");
} }
if (languageVersion==null) { if (languageVersion==null) {
throw new NullPointerException("languageVersion may not be null"); throw new NullPointerException("languageVersion may not be null");
} }
if (languageVersion.isEmpty()) { if (languageVersion.length()==0) {
throw new IllegalArgumentException("languageVersion may not be empty"); throw new IllegalArgumentException("languageVersion may not be empty");
} }
languageProperties = new HashMap<X4OLanguageProperty,Object>(20); languageProperties = new HashMap<X4OLanguageProperty,Object>(20);

View file

@ -251,7 +251,7 @@ public class DefaultX4OLanguageLoader implements X4OLanguageLoader {
@Override @Override
public void characters(char[] ch, int start, int length) throws SAXException { public void characters(char[] ch, int start, int length) throws SAXException {
String text = new String(ch,start,length).trim(); String text = new String(ch,start,length).trim();
if (text.isEmpty()) { if (text.length()==0) {
return; return;
} }
buf.append(text); buf.append(text);

View file

@ -67,7 +67,7 @@ public class X4OELResolver extends ELResolver {
} }
@Override @Override
@SuppressWarnings("rawtypes") @SuppressWarnings({ "rawtypes", "unchecked" })
public Iterator getFeatureDescriptors(ELContext context,Object base) { public Iterator getFeatureDescriptors(ELContext context,Object base) {
base = checkBase(base); base = checkBase(base);
return delegate.getFeatureDescriptors(context, base); return delegate.getFeatureDescriptors(context, base);

View file

@ -200,6 +200,12 @@ public class XMLWriter extends DefaultHandler2 {
if (attributeValue.contains("\"")) { if (attributeValue.contains("\"")) {
attributeValue=attributeValue.replaceAll("\"", "&quote;"); attributeValue=attributeValue.replaceAll("\"", "&quote;");
} }
if (attributeValue.contains("<")) {
attributeValue=attributeValue.replaceAll("<", "&lt;");
}
if (attributeValue.contains(">")) {
attributeValue=attributeValue.replaceAll(">", "&gt;");
}
startElement.append(attributeValue); startElement.append(attributeValue);
startElement.append('"'); startElement.append('"');

View file

@ -91,7 +91,12 @@ public class EmptyXmlTest extends TestCase {
try { try {
parser.parseResource("tests/empty-xml/empty-xml.xml"); parser.parseResource("tests/empty-xml/empty-xml.xml");
} catch (SAXException e) { } catch (SAXException e) {
assertEquals(true,e.getMessage().contains("Premature end of file.")); boolean hasError = e.getMessage().contains("Premature end of file.");
if (System.getProperty("java.version").startsWith("1.5")) {
hasError = e.getMessage().contains("A well-formed document requires a root element.");
}
assertEquals(true,hasError);
return; return;
} }
assertEquals(true,false); assertEquals(true,false);

View file

@ -50,7 +50,7 @@ public class ColorConverter extends AbstractStringObjectConverter {
public Object convertStringTo(String str, Locale locale) throws ObjectConverterException { public Object convertStringTo(String str, Locale locale) throws ObjectConverterException {
try { try {
if (str.isEmpty()) { if (str.length()==0) {
throw new ObjectConverterException(this,"Can't convert empty color."); throw new ObjectConverterException(this,"Can't convert empty color.");
} }
if (Character.isDigit(str.charAt(0))) { if (Character.isDigit(str.charAt(0))) {

View file

@ -39,7 +39,7 @@
<classBindingHandler id="JDesktopPane-JInternalFrame" parentClass="javax.swing.JDesktopPane" childClass="javax.swing.JInternalFrame" method="add"/> <classBindingHandler id="JDesktopPane-JInternalFrame" parentClass="javax.swing.JDesktopPane" childClass="javax.swing.JInternalFrame" method="add"/>
<classBindingHandler id="JFrame-JDesktopPane" parentClass="javax.swing.JFrame" childClass="javax.swing.JDesktopPane" method="setContentPane"/> <classBindingHandler id="JFrame-JDesktopPane" parentClass="javax.swing.JFrame" childClass="javax.swing.JDesktopPane" method="setContentPane"/>
<classBindingHandler id="JMenuBar-JMenu" parentClass="javax.swing.JMenuBar" childClass="javax.swing.JMenu" method="add"/> <classBindingHandler id="JMenuBar-JMenu" parentClass="javax.swing.JMenuBar" childClass="javax.swing.JMenu" method="add"/>
<classBindingHandler id="JMenu-JMenuItem" parentClass="javax.swing.JMenu" childClass="javax.swing.JMenuItem" method="add"/> <classBindingHandler id="JMenu-JMenuItem" parentClass="javax.swing.JMenu" childClass="javax.swing.JMenuItem" method="add"/>
<elementInterface id="Component" interfaceClass="java.awt.Component"> <elementInterface id="Component" interfaceClass="java.awt.Component">
<attribute name="bounds"> <attribute name="bounds">
@ -109,6 +109,7 @@
<conv:beanConverter bean.class="org.x4o.xml.test.swixml.conv.KeyStrokeConverter"/> <conv:beanConverter bean.class="org.x4o.xml.test.swixml.conv.KeyStrokeConverter"/>
<attributeAlias name="Accelerator"/> <attributeAlias name="Accelerator"/>
</attribute> </attribute>
<attribute name="mnemonic" runBeanFill="false"/>
<attribute name="Action" runBeanFill="false"/> <attribute name="Action" runBeanFill="false"/>
<configurator id="menuitem-action" bean.class="org.x4o.xml.test.swixml.SwiXmlActionConfigurator"/> <configurator id="menuitem-action" bean.class="org.x4o.xml.test.swixml.SwiXmlActionConfigurator"/>
</element> </element>
@ -118,6 +119,9 @@
<attribute name="orientation"> <attribute name="orientation">
<conv:beanConverter bean.class="org.x4o.xml.test.swixml.conv.JSplitPaneOrientationConverter"/> <conv:beanConverter bean.class="org.x4o.xml.test.swixml.conv.JSplitPaneOrientationConverter"/>
</attribute> </attribute>
<attribute name="dividerLocation">
<conv:integerConverter/>
</attribute>
</element> </element>
<element tag="scrollPane" objectClass="javax.swing.JScrollPane"/> <element tag="scrollPane" objectClass="javax.swing.JScrollPane"/>
<element tag="tree" objectClass="javax.swing.JTree"/> <element tag="tree" objectClass="javax.swing.JTree"/>

View file

@ -39,7 +39,7 @@
<classBindingHandler id="JDesktopPane-JInternalFrame" parentClass="javax.swing.JDesktopPane" childClass="javax.swing.JInternalFrame" method="add"/> <classBindingHandler id="JDesktopPane-JInternalFrame" parentClass="javax.swing.JDesktopPane" childClass="javax.swing.JInternalFrame" method="add"/>
<classBindingHandler id="JFrame-JDesktopPane" parentClass="javax.swing.JFrame" childClass="javax.swing.JDesktopPane" method="setContentPane"/> <classBindingHandler id="JFrame-JDesktopPane" parentClass="javax.swing.JFrame" childClass="javax.swing.JDesktopPane" method="setContentPane"/>
<classBindingHandler id="JMenuBar-JMenu" parentClass="javax.swing.JMenuBar" childClass="javax.swing.JMenu" method="add"/> <classBindingHandler id="JMenuBar-JMenu" parentClass="javax.swing.JMenuBar" childClass="javax.swing.JMenu" method="add"/>
<classBindingHandler id="JMenu-JMenuItem" parentClass="javax.swing.JMenu" childClass="javax.swing.JMenuItem" method="add"/> <classBindingHandler id="JMenu-JMenuItem" parentClass="javax.swing.JMenu" childClass="javax.swing.JMenuItem" method="add"/>
<elementInterface id="Component" interfaceClass="java.awt.Component"> <elementInterface id="Component" interfaceClass="java.awt.Component">
<attribute name="bounds"> <attribute name="bounds">
@ -103,6 +103,7 @@
<conv:beanConverter bean.class="org.x4o.xml.test.swixml.conv.KeyStrokeConverter"/> <conv:beanConverter bean.class="org.x4o.xml.test.swixml.conv.KeyStrokeConverter"/>
<attributeAlias name="Accelerator"/> <attributeAlias name="Accelerator"/>
</attribute> </attribute>
<attribute name="mnemonic" runBeanFill="false"/>
<attribute name="Action" runBeanFill="false"/> <attribute name="Action" runBeanFill="false"/>
<configurator id="menuitem-action" bean.class="org.x4o.xml.test.swixml.SwiXmlActionConfigurator"/> <configurator id="menuitem-action" bean.class="org.x4o.xml.test.swixml.SwiXmlActionConfigurator"/>
</element> </element>
@ -112,6 +113,9 @@
<attribute name="orientation"> <attribute name="orientation">
<conv:beanConverter bean.class="org.x4o.xml.test.swixml.conv.JSplitPaneOrientationConverter"/> <conv:beanConverter bean.class="org.x4o.xml.test.swixml.conv.JSplitPaneOrientationConverter"/>
</attribute> </attribute>
<attribute name="dividerLocation">
<conv:integerConverter/>
</attribute>
</element> </element>
<element tag="JScrollPane" objectClass="javax.swing.JScrollPane"/> <element tag="JScrollPane" objectClass="javax.swing.JScrollPane"/>
<element tag="JTree" objectClass="javax.swing.JTree"/> <element tag="JTree" objectClass="javax.swing.JTree"/>

View file

@ -34,6 +34,12 @@
<type>test-jar</type> <type>test-jar</type>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>${xerces.version}</version>
<scope>test</scope>
</dependency>
</dependencies> </dependencies>
<build> <build>
<pluginManagement> <pluginManagement>

View file

@ -27,7 +27,13 @@
<artifactId>junit</artifactId> <artifactId>junit</artifactId>
<version>${junit.version}</version> <version>${junit.version}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>${xerces.version}</version>
<scope>test</scope>
</dependency>
</dependencies> </dependencies>
<build> <build>
<pluginManagement> <pluginManagement>

View file

@ -51,6 +51,12 @@
<type>test-jar</type> <type>test-jar</type>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>${xerces.version}</version>
<scope>test</scope>
</dependency>
</dependencies> </dependencies>
<build> <build>
<pluginManagement> <pluginManagement>

View file

@ -45,6 +45,12 @@
<type>test-jar</type> <type>test-jar</type>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>${xerces.version}</version>
<scope>test</scope>
</dependency>
</dependencies> </dependencies>
<build> <build>
<pluginManagement> <pluginManagement>