Here is a patch so Castor doesn't generate code that doesn't compile for a list with a default value.
I am having trouble with the build of castor in that some classes are not being compiled. Can someone tell me after a build if they have these class files or if it is just me.... org.exolab.castor.xml.schema.AttributeGroupEnumeration.class org.exolab.castor.xml.scehma.SimpleTypesFactoryException.class FactoryException comes from inside SimpleTypesFactory.java(bottom of) while the Enum class above comes from AttributeGroupDecl.java file(bottom of) Because they are not getting compiled, when I run the CTF framework, I am getting class not found errors. My steps were 1. create a new view 2. ./build.sh jars 3. ./build.sh tests 4. CTFRun.sh src/tests Many many tests are getting these class not found errors. Does no one else get this? I wish the automated build was set up with test cases(hint hint) because I would not have to ask this question. thanks, Dean
? list-patch.txt
? schema
? main/org/exolab/castor/xml/schema/SimpleTypesFactory.class
? main/org/exolab/castor/xml/schema/SimpleTypesFactoryException.class
Index: main/org/exolab/castor/builder/CollectionInfo.java
===================================================================
RCS file: /cvs/castor/castor/src/main/org/exolab/castor/builder/CollectionInfo.java,v
retrieving revision 1.22
diff -u -r1.22 CollectionInfo.java
--- main/org/exolab/castor/builder/CollectionInfo.java 20 Dec 2002 14:27:27 -0000
1.22
+++ main/org/exolab/castor/builder/CollectionInfo.java 5 Feb 2003 19:10:00 -0000
@@ -100,8 +100,8 @@
* @param jsc the JSourceCode in which to add the source to
**/
public void generateInitializerCode(JSourceCode jsc) {
- jsc.add(getName());
- jsc.append(" = new Vector();");
+// jsc.add(getName());
+// jsc.append(" = new Vector();");
} //-- generateConstructorCode
public String getReadMethodName() {
Index: main/org/exolab/javasource/JClass.java
===================================================================
RCS file: /cvs/castor/castor/src/main/org/exolab/javasource/JClass.java,v
retrieving revision 1.21
diff -u -r1.21 JClass.java
--- main/org/exolab/javasource/JClass.java 20 Dec 2002 10:13:14 -0000 1.21
+++ main/org/exolab/javasource/JClass.java 5 Feb 2003 19:10:14 -0000
@@ -57,6 +57,7 @@
import java.io.Writer;
import java.io.PrintWriter;
+import java.util.StringTokenizer;
import java.util.Enumeration;
import java.util.Vector;
@@ -645,7 +646,29 @@
String init = jField.getInitString();
if (init != null) {
jsw.write(" = ");
- jsw.write(init);
+ if("java.util.Vector".equals(typeName)) {
+ jsw.write("new
+java.util.Vector(java.util.Arrays.asList(");
+ jsw.write("new String[] {");
+
+ //delimited by spaces
+ StringTokenizer tok = new
+StringTokenizer(init, " ");
+
+ //will have at least one element or init
+should have been null
+ if(!tok.hasMoreElements())
+ throw new RuntimeException("There is a
+blank default for list. This should not be possible");
+
+ jsw.write(""+tok.nextElement());
+
+ while(tok.hasMoreElements())
+ {
+ jsw.write(","+tok.nextElement());
+ }
+
+ jsw.write("}");
+ jsw.write("))");
+ }
+ else
+ jsw.write(init);
}
jsw.writeln(';');
test-list.zip
Description: Zip archive
