You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xmlbeans.apache.org by ra...@apache.org on 2006/04/04 03:35:01 UTC

svn commit: r391210 - in /xmlbeans/trunk: external/lib/oldxbean.jar src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeSystemImpl.java src/xmlcomp/org/apache/xmlbeans/impl/tool/XsbDumper.java

Author: radup
Date: Mon Apr  3 18:34:59 2006
New Revision: 391210

URL: http://svn.apache.org/viewcvs?rev=391210&view=rev
Log:
Changed the meaning of all the short values in the .xsb format to unsigned short, thus increasing the size (in components) of the Schemas that can be processed and bringing it in line with the Java class format conventions.

Modified:
    xmlbeans/trunk/external/lib/oldxbean.jar
    xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeSystemImpl.java
    xmlbeans/trunk/src/xmlcomp/org/apache/xmlbeans/impl/tool/XsbDumper.java

Modified: xmlbeans/trunk/external/lib/oldxbean.jar
URL: http://svn.apache.org/viewcvs/xmlbeans/trunk/external/lib/oldxbean.jar?rev=391210&r1=391209&r2=391210&view=diff
==============================================================================
Binary files - no diff available.

Modified: xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeSystemImpl.java
URL: http://svn.apache.org/viewcvs/xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeSystemImpl.java?rev=391210&r1=391209&r2=391210&view=diff
==============================================================================
--- xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeSystemImpl.java (original)
+++ xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeSystemImpl.java Mon Apr  3 18:34:59 2006
@@ -81,7 +81,7 @@
 {
     public static final int DATA_BABE = 0xDA7ABABE;
     public static final int MAJOR_VERSION = 2;  // must match == to be compatible
-    public static final int MINOR_VERSION = 23; // must be <= to be compatible
+    public static final int MINOR_VERSION = 24; // must be <= to be compatible
     public static final int RELEASE_NUMBER = 0; // should be compatible even if < or >
 
     public static final int FILETYPE_SCHEMAINDEX = 1;
@@ -505,6 +505,8 @@
     private static final int CONSTANT_INTERFACEMETHOD = 11;
     private static final int CONSTANT_NAMEANDTYPE = 12;
 
+    // MAX_UNSIGNED_SHORT
+    private static final int MAX_UNSIGNED_SHORT = Short.MAX_VALUE * 2 + 1;
 
     private static String repackageConstant(String value, String[] replace, Repackager repackager)
     {
@@ -1530,7 +1532,7 @@
                 _releaseno = readShort();
 
             int actualfiletype = readShort();
-            if (actualfiletype != filetype && filetype != -1)
+            if (actualfiletype != filetype && filetype != 0xFFFF)
                 throw new SchemaTypeLoaderException("XML-BEANS compiled schema: File has the wrong type - expecting type " + filetype + ", got type " + actualfiletype, _name, handle, SchemaTypeLoaderException.WRONG_FILE_TYPE);
 
             _stringPool = new StringPool(_handle, _name);
@@ -1722,7 +1724,7 @@
             for (int i = 0; i < size; i++)
             {
                 String handle = readString();
-                short code = readShort();
+                int code = readShort();
                 Object result;
                 switch (code)
                 {
@@ -1751,11 +1753,11 @@
             }
         }
 
-        short readShort()
+        int readShort()
         {
             try
             {
-                return _input.readShort();
+                return _input.readUnsignedShort();
             }
             catch (IOException e)
             {
@@ -1765,8 +1767,8 @@
 
         void writeShort(int s)
         {
-            if (s > Short.MAX_VALUE || s < Short.MIN_VALUE)
-                throw new SchemaTypeLoaderException("Value " + s + " out of range: must fit in a 16-bit short.", _name, _handle, SchemaTypeLoaderException.INT_TOO_LARGE);
+            if (s >= MAX_UNSIGNED_SHORT || s < -1)
+                throw new SchemaTypeLoaderException("Value " + s + " out of range: must fit in a 16-bit unsigned short.", _name, _handle, SchemaTypeLoaderException.INT_TOO_LARGE);
             if (_output != null)
             {
                 try
@@ -2228,10 +2230,10 @@
             String handle = null;
             try
             {
-                short particleType = readShort();
+                int particleType = readShort();
                 if (particleType != SchemaParticle.ELEMENT)
                     throw new SchemaTypeLoaderException("Wrong particle type ", _name, _handle, SchemaTypeLoaderException.BAD_PARTICLE_TYPE);
-                short particleFlags = readShort();
+                int particleFlags = readShort();
                 BigInteger minOccurs = readBigInteger();
                 BigInteger maxOccurs = readBigInteger();
                 QNameSet transitionRules = readQNameSet();
@@ -2262,7 +2264,7 @@
                 if (atLeast(2, 17, 0))
                     impl.setSubstitutionGroup((SchemaGlobalElement.Ref)readHandle());
 
-                short substGroupCount = readShort();
+                int substGroupCount = readShort();
                 for (int i = 0; i < substGroupCount; i++)
                 {
                     impl.addSubstitutionGroupMember(readQName());
@@ -2475,7 +2477,7 @@
                 impl.setAttributeType((flags & FLAG_ATTRIBUTE_TYPE) != 0);
                 impl.setSimpleType(!isComplexType);
 
-                short complexVariety = SchemaType.NOT_COMPLEX_TYPE;
+                int complexVariety = SchemaType.NOT_COMPLEX_TYPE;
                 if (isComplexType)
                 {
                     impl.setAbstractFinal((flags & FLAG_ABSTRACT) != 0,
@@ -2496,7 +2498,7 @@
                     // Attribute Model Table
                     SchemaAttributeModelImpl attrModel = new SchemaAttributeModelImpl();
 
-                    short attrCount = readShort();
+                    int attrCount = readShort();
                     for (int i = 0; i < attrCount; i++)
                         attrModel.addAttribute(readAttributeData());
 
@@ -2505,7 +2507,7 @@
 
                     // Attribute Property Table
                     Map attrProperties = new LinkedHashMap();
-                    short attrPropCount = readShort();
+                    int attrPropCount = readShort();
                     for (int i = 0; i < attrPropCount; i++)
                     {
                         SchemaProperty prop = readPropertyData();
@@ -2516,7 +2518,7 @@
 
                     SchemaParticle contentModel = null;
                     Map elemProperties = null;
-                    short isAll = 0;
+                    int isAll = 0;
 
                     if (complexVariety == SchemaType.ELEMENT_CONTENT || complexVariety == SchemaType.MIXED_CONTENT)
                     {
@@ -2533,7 +2535,7 @@
                         // Element Property Table
 
                         elemProperties = new LinkedHashMap();
-                        short elemPropCount = readShort();
+                        int elemPropCount = readShort();
                         for (int i = 0; i < elemPropCount; i++)
                         {
                             SchemaProperty prop = readPropertyData();
@@ -2551,7 +2553,7 @@
 
                 if (!isComplexType || complexVariety == SchemaType.SIMPLE_CONTENT)
                 {
-                    short simpleVariety = readShort();
+                    int simpleVariety = readShort();
                     impl.setSimpleTypeVariety(simpleVariety);
 
                     boolean isStringEnum = ((flags & FLAG_STRINGENUM) != 0);
@@ -2567,10 +2569,10 @@
 
                     XmlValueRef[] facets = new XmlValueRef[SchemaType.LAST_FACET + 1];
                     boolean[] fixedFacets = new boolean[SchemaType.LAST_FACET + 1];
-                    short facetCount = readShort();
+                    int facetCount = readShort();
                     for (int i = 0; i < facetCount; i++)
                     {
-                        short facetCode = readShort();
+                        int facetCode = readShort();
                         facets[facetCode] = readXmlValueObject();
                         fixedFacets[facetCode] = (readShort() == 1);
                     }
@@ -2580,7 +2582,7 @@
 
                     impl.setPatternFacet((flags & FLAG_HAS_PATTERN) != 0);
 
-                    short patternCount = readShort();
+                    int patternCount = readShort();
                     org.apache.xmlbeans.impl.regex.RegularExpression[] patterns = new org.apache.xmlbeans.impl.regex.RegularExpression[patternCount];
                     for (int i = 0; i < patternCount; i++)
                     {
@@ -2588,7 +2590,7 @@
                     }
                     impl.setPatterns(patterns);
 
-                    short enumCount = readShort();
+                    int enumCount = readShort();
                     XmlValueRef[] enumValues = new XmlValueRef[enumCount];
                     for (int i = 0; i < enumCount; i++)
                     {
@@ -2599,7 +2601,7 @@
                     impl.setBaseEnumTypeRef(readTypeRef());
                     if (isStringEnum)
                     {
-                        short seCount = readShort();
+                        int seCount = readShort();
                         SchemaStringEnumEntry[] entries = new SchemaStringEnumEntry[seCount];
                         for (int i = 0; i < seCount; i++)
                         {
@@ -2950,7 +2952,7 @@
 
         SchemaParticle readParticleData()
         {
-            short particleType = readShort();
+            int particleType = readShort();
             SchemaParticleImpl result;
             if (particleType != SchemaParticle.ELEMENT)
                 result = new SchemaParticleImpl();
@@ -2962,7 +2964,7 @@
 
         void loadParticle(SchemaParticleImpl result, int particleType)
         {
-            short particleFlags = readShort();
+            int particleFlags = readShort();
 
             result.setParticleType(particleType);
             result.setMinOccurs(readBigInteger());
@@ -3099,7 +3101,7 @@
             SchemaPropertyImpl prop = new SchemaPropertyImpl();
             prop.setName(readQName());
             prop.setTypeRef(readTypeRef());
-            short propflags = readShort();
+            int propflags = readShort();
             prop.setAttribute((propflags & FLAG_PROP_ISATTR) != 0);
             prop.setContainerTypeRef(readTypeRef());
             prop.setMinOccurs(readBigInteger());
@@ -3122,7 +3124,7 @@
 
             if (!prop.isAttribute() && atLeast(2, 17, 0))
             {
-                short size = readShort();
+                int size = readShort();
                 LinkedHashSet qnames = new LinkedHashSet(size);
                 for (int i = 0 ; i < size ; i++)
                     qnames.add(readQName());
@@ -3201,7 +3203,7 @@
                     assert(false);
                 case 0:
                     return new XmlValueRef(typeref, null);
-                case -1:
+                case 0xFFFF:
                     {
                         int size = readShort();
                         List values = new ArrayList();
@@ -3339,20 +3341,20 @@
 
         QNameSet readQNameSet()
         {
-            short flag = readShort();
+            int flag = readShort();
 
             Set uriSet = new HashSet();
-            short uriCount = readShort();
+            int uriCount = readShort();
             for (int i = 0; i < uriCount; i++)
                 uriSet.add(readString());
 
             Set qnameSet1 = new HashSet();
-            short qncount1 = readShort();
+            int qncount1 = readShort();
             for (int i = 0; i < qncount1; i++)
                 qnameSet1.add(readQName());
 
             Set qnameSet2 = new HashSet();
-            short qncount2 = readShort();
+            int qncount2 = readShort();
             for (int i = 0; i < qncount2; i++)
                 qnameSet2.add(readQName());
 
@@ -3387,7 +3389,7 @@
         {
             try
             {
-                short len = _input.readShort();
+                int len = _input.readShort();
                 byte[] result = new byte[len];
                 _input.readFully(result);
                 return result;
@@ -3468,7 +3470,7 @@
         }
         if (result == null)
         {
-            XsbReader reader = new XsbReader(handle, -1);
+            XsbReader reader = new XsbReader(handle, 0xFFFF);
             int filetype = reader.getActualFiletype();
             switch (filetype)
             {

Modified: xmlbeans/trunk/src/xmlcomp/org/apache/xmlbeans/impl/tool/XsbDumper.java
URL: http://svn.apache.org/viewcvs/xmlbeans/trunk/src/xmlcomp/org/apache/xmlbeans/impl/tool/XsbDumper.java?rev=391210&r1=391209&r2=391210&view=diff
==============================================================================
--- xmlbeans/trunk/src/xmlcomp/org/apache/xmlbeans/impl/tool/XsbDumper.java (original)
+++ xmlbeans/trunk/src/xmlcomp/org/apache/xmlbeans/impl/tool/XsbDumper.java Mon Apr  3 18:34:59 2006
@@ -154,7 +154,7 @@
 
     public static final int DATA_BABE = 0xDA7ABABE;
     public static final int MAJOR_VERSION = 2;
-    public static final int MINOR_VERSION = 23;
+    public static final int MINOR_VERSION = 24;
 
     public static final int FILETYPE_SCHEMAINDEX = 1;
     public static final int FILETYPE_SCHEMATYPE = 2;
@@ -372,7 +372,7 @@
         for (int i = 0; i < size; i++)
         {
             String handle = readString();
-            short code = readShort();
+            int code = readShort();
             emit(handle + " (" + filetypeString(code) + ")");
         }
         outdent();
@@ -481,11 +481,11 @@
     DataInputStream _input;
     StringPool _stringPool;
 
-    short readShort()
+    int readShort()
     {
         try
         {
-            return _input.readShort();
+            return _input.readUnsignedShort();
         }
         catch (IOException e)
         {
@@ -707,10 +707,10 @@
 
     void dumpParticleData(boolean global)
     {
-        short particleType = readShort();
+        int particleType = readShort();
         emit(particleTypeString(particleType) + ":");
         indent();
-        short particleFlags = readShort();
+        int particleFlags = readShort();
         emit("Flags: " + particleflagsString(particleFlags));
 
         emit("MinOccurs: " + bigIntegerString(readBigInteger()));
@@ -737,7 +737,7 @@
                 {
                     if (atLeast(2, 17, 0))
                         emit("Substitution group ref: " + readHandle());
-                    short substGroupCount = readShort();
+                    int substGroupCount = readShort();
                     emit("Substitution group members (" + substGroupCount + ")");
                     indent();
                     for (int i = 0; i < substGroupCount; i++)
@@ -886,7 +886,7 @@
         emit("Flags: " + typeflagsString(flags));
         boolean isComplexType = ((flags & FLAG_SIMPLE_TYPE) == 0);
 
-        short complexVariety = SchemaType.NOT_COMPLEX_TYPE;
+        int complexVariety = SchemaType.NOT_COMPLEX_TYPE;
         if (isComplexType)
         {
             complexVariety = readShort();
@@ -895,7 +895,7 @@
             if (atLeast(2, 23, 0))
                 emit("Content based on type: " + readType());
 
-            short attrCount = readShort();
+            int attrCount = readShort();
             emit("Attribute model (" + attrCount + "):");
             indent();
             for (int i = 0; i < attrCount; i++)
@@ -906,7 +906,7 @@
             outdent();
 
             // Attribute Property Table
-            short attrPropCount = readShort();
+            int attrPropCount = readShort();
             emit("Attribute properties (" + attrPropCount + "):");
             indent();
             for (int i = 0; i < attrPropCount; i++)
@@ -923,7 +923,7 @@
                 dumpParticleArray("Content model");
 
                 // Element Property Table
-                short elemPropCount = readShort();
+                int elemPropCount = readShort();
                 emit("Element properties (" + elemPropCount + "):");
                 indent();
                 for (int i = 0; i < elemPropCount; i++)
@@ -936,12 +936,12 @@
 
         if (!isComplexType || complexVariety == SchemaType.SIMPLE_CONTENT)
         {
-            short simpleVariety = readShort();
+            int simpleVariety = readShort();
             emit("Simple type variety: " + simpleVarietyString(simpleVariety));
 
             boolean isStringEnum = ((flags & FLAG_STRINGENUM) != 0);
 
-            short facetCount = readShort();
+            int facetCount = readShort();
             emit("Facets (" + facetCount + "):");
             indent();
             for (int i = 0; i < facetCount; i++)
@@ -954,7 +954,7 @@
 
             emit("Whitespace rule: " + whitespaceCodeString(readShort()));
 
-            short patternCount = readShort();
+            int patternCount = readShort();
             emit("Patterns (" + patternCount + "):");
             indent();
             for (int i = 0; i < patternCount; i++)
@@ -963,7 +963,7 @@
             }
             outdent();
 
-            short enumCount = readShort();
+            int enumCount = readShort();
             emit("Enumeration values (" + enumCount + "):");
             indent();
             for (int i = 0; i < enumCount; i++)
@@ -975,7 +975,7 @@
             emit("Base enum type: " + readType());
             if (isStringEnum)
             {
-                short seCount = readShort();
+                int seCount = readShort();
                 emit("String enum entries (" + seCount + "):");
                 indent();
                 for (int i = 0; i < seCount; i++)
@@ -1136,7 +1136,7 @@
         indent();
         emit("Name: " + qnameString(readQName()));
         emit("Type: " + readType());
-        short propflags = readShort();
+        int propflags = readShort();
         emit("Flags: " + propertyflagsString(propflags));
         emit("Container type: " + readType());
         emit("Min occurances: " + bigIntegerString(readBigInteger()));
@@ -1154,7 +1154,7 @@
             emit("Default value: " + readXmlValueObject());
         if (((propflags & FLAG_PROP_ISATTR) == 0) && atLeast(2, 17, 0))
         {
-            short size = readShort();
+            int size = readShort();
             emit("Accepted substitutions (" + size + "):");
             for (int i = 0 ; i < size ; i++)
                 emit("  Accepted name " + readQName());
@@ -1248,20 +1248,20 @@
 
     QNameSet readQNameSet()
     {
-        short flag = readShort();
+        int flag = readShort();
 
         Set uriSet = new HashSet();
-        short uriCount = readShort();
+        int uriCount = readShort();
         for (int i = 0; i < uriCount; i++)
             uriSet.add(readString());
 
         Set qnameSet1 = new HashSet();
-        short qncount1 = readShort();
+        int qncount1 = readShort();
         for (int i = 0; i < qncount1; i++)
             qnameSet1.add(readQName());
 
         Set qnameSet2 = new HashSet();
-        short qncount2 = readShort();
+        int qncount2 = readShort();
         for (int i = 0; i < qncount2; i++)
             qnameSet2.add(readQName());
 
@@ -1275,7 +1275,7 @@
     {
         try
         {
-            short len = _input.readShort();
+            int len = _input.readShort();
             byte[] result = new byte[len];
             _input.readFully(result);
             return result;



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