xmlbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ce...@apache.org
Subject svn commit: r732430 - in /xmlbeans/trunk: ./ src/typeimpl/org/apache/xmlbeans/impl/schema/ src/typeimpl/org/apache/xmlbeans/impl/values/
Date Wed, 07 Jan 2009 18:46:00 GMT
Author: cezar
Date: Wed Jan  7 10:46:00 2009
New Revision: 732430

URL: http://svn.apache.org/viewvc?rev=732430&view=rev
Log:
- fix compilation of generated sources for schemas using substitution groups
- disable deadlock when setting an entire array



Modified:
    xmlbeans/trunk/build.xml
    xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeCodePrinter.java
    xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/values/XmlComplexContentImpl.java
    xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/values/XmlObjectBase.java

Modified: xmlbeans/trunk/build.xml
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/build.xml?rev=732430&r1=732429&r2=732430&view=diff
==============================================================================
--- xmlbeans/trunk/build.xml (original)
+++ xmlbeans/trunk/build.xml Wed Jan  7 10:46:00 2009
@@ -83,7 +83,7 @@
     <target name="sources" depends="dirs">
         <zip destfile="build/ar/xbeansrc.zip"
           basedir="."
-          excludes="build/**, test/perf/**"/>
+          excludes="build/**, test/perf/**, mytest/**"/>
     </target>
 
     <property environment="env"/>

Modified: xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeCodePrinter.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeCodePrinter.java?rev=732430&r1=732429&r2=732430&view=diff
==============================================================================
--- xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeCodePrinter.java
(original)
+++ xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeCodePrinter.java
Wed Jan  7 10:46:00 2009
@@ -2220,16 +2220,8 @@
             printJavaDoc((several ? "Sets first " : "Sets the ") + propdesc);
             emit("public void set" + propertyName + "(" + type + " " + safeVarName + ")");
             startBlock();
-            if ( xmltype )
+            if ( xmltype && !isSubstGroup )
             {
-                emit("/*");
-                emitImplementationPreamble();
-                emitPre(sType, PrePostExtension.OPERATION_SET, identifier, isAttr, several
? "0" : "-1");
-                emitGetTarget(setIdentifier, identifier, isAttr, "0", ADD_NEW_VALUE, jtargetType);
-                emit(jSet + "(" + safeVarName + ");");
-                emitPost(sType, PrePostExtension.OPERATION_SET, identifier, isAttr, several
? "0" : "-1");
-                emitImplementationPostamble();
-                emit("*/");
                 emitPre(sType, PrePostExtension.OPERATION_SET, identifier, isAttr, several
? "0" : "-1");
                 emit("generatedSetterHelperImpl(" + safeVarName + ", " + setIdentifier +
", 0, " +
                         "org.apache.xmlbeans.impl.values.XmlObjectBase.KIND_SETTERHELPER_SINGLETON);");
@@ -2313,45 +2305,68 @@
         {
             String arrayName = propertyName + "Array";
 
-            // JSET_INDEX
-            printJavaDoc("Sets array of all " + propdesc);
-            emit("public void set" + arrayName + "(" + type + "[] " + safeVarName + "Array)");
-            startBlock();
-            emitImplementationPreamble();
-            emitPre(sType, PrePostExtension.OPERATION_SET, identifier, isAttr);
-
-            if (isobj)
+            if ( xmltype )
             {
-                if (!isSubstGroup)
-                    emit("unionArraySetterHelper(" + safeVarName + "Array" + ", " + identifier
+ ");" );
+                printJavaDoc("Sets array of all " + propdesc + "  WARNING: This method is
not atomicaly synchronized.");
+                emit("public void set" + arrayName + "(" + type + "[] " + safeVarName + "Array)");
+                startBlock();
+                // do not use synchronize (monitor()) {  and GlobalLock inside  } !!! deadlock
+                //emitImplementationPreamble();
+                emit("check_orphaned();");
+                emitPre(sType, PrePostExtension.OPERATION_SET, identifier, isAttr);
+
+                if (isobj)
+                {
+                    if (!isSubstGroup)
+                        emit("unionArraySetterHelper(" + safeVarName + "Array" + ", " + identifier
+ ");" );
+                    else
+                        emit("unionArraySetterHelper(" + safeVarName + "Array" + ", " + identifier
+ ", " + setIdentifier + ");" );
+                }
                 else
-                    emit("unionArraySetterHelper(" + safeVarName + "Array" + ", " + identifier
+ ", " + setIdentifier + ");" );
+                {
+                    if (!isSubstGroup)
+                        emit("arraySetterHelper(" + safeVarName + "Array" + ", " + identifier
+ ");" );
+                    else
+                        emit("arraySetterHelper(" + safeVarName + "Array" + ", " + identifier
+ ", " + setIdentifier + ");" );
+                }
+
+                emitPost(sType, PrePostExtension.OPERATION_SET, identifier, isAttr);
+                //emitImplementationPostamble();  to avoid deadlock
+                endBlock();
             }
             else
             {
-                if (!isSubstGroup)
-                    emit("arraySetterHelper(" + safeVarName + "Array" + ", " + identifier
+ ");" );
+                printJavaDoc("Sets array of all " + propdesc );
+                emit("public void set" + arrayName + "(" + type + "[] " + safeVarName + "Array)");
+                startBlock();
+                emitImplementationPreamble();
+                emitPre(sType, PrePostExtension.OPERATION_SET, identifier, isAttr);
+
+                if (isobj)
+                {
+                    if (!isSubstGroup)
+                        emit("unionArraySetterHelper(" + safeVarName + "Array" + ", " + identifier
+ ");" );
+                    else
+                        emit("unionArraySetterHelper(" + safeVarName + "Array" + ", " + identifier
+ ", " + setIdentifier + ");" );
+                }
                 else
-                    emit("arraySetterHelper(" + safeVarName + "Array" + ", " + identifier
+ ", " + setIdentifier + ");" );
-            }
+                {
+                    if (!isSubstGroup)
+                        emit("arraySetterHelper(" + safeVarName + "Array" + ", " + identifier
+ ");" );
+                    else
+                        emit("arraySetterHelper(" + safeVarName + "Array" + ", " + identifier
+ ", " + setIdentifier + ");" );
+                }
 
-            emitPost(sType, PrePostExtension.OPERATION_SET, identifier, isAttr);
-            emitImplementationPostamble();
-            endBlock();
+                emitPost(sType, PrePostExtension.OPERATION_SET, identifier, isAttr);
+                emitImplementationPostamble();
+                endBlock();
+            }
 
             printJavaDoc("Sets ith " + propdesc);
             emit("public void set" + arrayName + "(int i, " + type + " " + safeVarName +
")");
             startBlock();
-            if (javaType == SchemaProperty.XML_OBJECT)
+            if ( isobj )
             {
-                emit("/*");
-                emitImplementationPreamble();
-                emitPre(sType, PrePostExtension.OPERATION_SET, identifier, isAttr, "i");
-                emitGetTarget(setIdentifier, identifier, isAttr, "i", THROW_EXCEPTION, jtargetType);
-                emit(jSet + "(" + safeVarName + ");");
-                emitPost(sType, PrePostExtension.OPERATION_SET, identifier, isAttr, "i");
-                emitImplementationPostamble();
-                emit("*/");
                 emitPre(sType, PrePostExtension.OPERATION_SET, identifier, isAttr, "i");
                 emit("generatedSetterHelperImpl(" + safeVarName + ", " + setIdentifier +
", i, " +
                         "org.apache.xmlbeans.impl.values.XmlObjectBase.KIND_SETTERHELPER_ARRAYITEM);");

Modified: xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/values/XmlComplexContentImpl.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/values/XmlComplexContentImpl.java?rev=732430&r1=732429&r2=732430&view=diff
==============================================================================
--- xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/values/XmlComplexContentImpl.java
(original)
+++ xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/values/XmlComplexContentImpl.java
Wed Jan  7 10:46:00 2009
@@ -25,7 +25,6 @@
 import java.util.Calendar;
 import javax.xml.namespace.QName;
 
-import javax.xml.namespace.QName;
 import org.apache.xmlbeans.impl.schema.SchemaTypeImpl;
 import org.apache.xmlbeans.impl.schema.SchemaTypeVisitorImpl;
 

Modified: xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/values/XmlObjectBase.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/values/XmlObjectBase.java?rev=732430&r1=732429&r2=732430&view=diff
==============================================================================
--- xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/values/XmlObjectBase.java (original)
+++ xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/values/XmlObjectBase.java Wed Jan
 7 10:46:00 2009
@@ -90,8 +90,7 @@
     public static final short MINOR_VERSION_NUMBER = (short) 1; // for serialization
 
     public static final short KIND_SETTERHELPER_SINGLETON = 1;
-    public static final short KIND_SETTERHELPER_ARRAYALL  = 2;
-    public static final short KIND_SETTERHELPER_ARRAYITEM = 3;
+    public static final short KIND_SETTERHELPER_ARRAYITEM = 2;
 
     public final Object monitor()
     {
@@ -2215,12 +2214,6 @@
                 return target;
             }
 
-            case KIND_SETTERHELPER_ARRAYALL:
-                check_orphaned();
-                //arraySetterHelper(lineItemArray, LINEITEM$4);
-                throw new IllegalArgumentException("Unknown kindSetterHelper: ARRAYALL");
-                //return null;
-
             case KIND_SETTERHELPER_ARRAYITEM:
             {
                 check_orphaned();



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: commits-help@xmlbeans.apache.org


Mime
View raw message