xmlbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kkro...@apache.org
Subject svn commit: r149470 - xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeSystemImpl.java
Date Wed, 02 Feb 2005 02:55:43 GMT
Author: kkrouse
Date: Tue Feb  1 18:55:41 2005
New Revision: 149470

URL: http://svn.apache.org/viewcvs?view=rev&rev=149470
Log:
XMLBEANS-105: NPE while initializing a type system w/ a type that extends an a complex type
from a different type system
save external type signatures out instead of just type QNames

reviewed: radup
checkintest: passes

Modified:
    xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeSystemImpl.java

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?view=diff&r1=149469&r2=149470
==============================================================================
--- xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeSystemImpl.java
(original)
+++ xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeSystemImpl.java
Tue Feb  1 18:55:41 2005
@@ -1978,11 +1978,24 @@
                 case 'D': // _XD_ - external identity constraint
                     return _linker.findIdentityConstraintRef(QNameHelper.forPretty(handle,
4));
                 case 'R': // _XR_ - external ref to attribute's type
-                    return _linker.findAttribute(QNameHelper.forPretty(handle, 4)).getType().getRef();
+                    // deprecated: replaced by _XY_
+                    SchemaGlobalAttribute attr = _linker.findAttribute(QNameHelper.forPretty(handle,
4));
+                    if (attr == null)
+                        throw new SchemaTypeLoaderException("Cannot resolve attribute for
handle " + handle, _name, _handle, SchemaTypeLoaderException.BAD_HANDLE);
+                    return attr.getType().getRef();
                 case 'S': // _XS_ - external ref to element's type
-                    return _linker.findElement(QNameHelper.forPretty(handle, 4)).getType().getRef();
+                    // deprecated: replaced by _XY_
+                    SchemaGlobalElement elem = _linker.findElement(QNameHelper.forPretty(handle,
4));
+                    if (elem == null)
+                        throw new SchemaTypeLoaderException("Cannot resolve element for handle
" + handle, _name, _handle, SchemaTypeLoaderException.BAD_HANDLE);
+                    return elem.getType().getRef();
                 case 'O': // _XO_ - external ref to document type
                     return _linker.findDocumentTypeRef(QNameHelper.forPretty(handle, 4));
+                case 'Y': // _XY_ - external ref to any possible type
+                    SchemaType type = _linker.typeForSignature(handle.substring(4));
+                    if (type == null)
+                        throw new SchemaTypeLoaderException("Cannot resolve type for handle
" + handle, _name, _handle, SchemaTypeLoaderException.BAD_HANDLE);
+                    return type.getRef();
                 default:
                     throw new SchemaTypeLoaderException("Cannot resolve handle " + handle,
_name, _handle, SchemaTypeLoaderException.BAD_HANDLE);
             }
@@ -2026,6 +2039,7 @@
                     // uses ref to refer to an attribute or element in another
                     // schema and the type of that attribute or element
                     // is an anonymous (local) type
+                    // kkrouse 02/1/2005: _XR_ and _XS_ refs are replaced by _XY_
                     if (type.getName() != null)
                     {
                         writeString("_XT_" + QNameHelper.pretty(type.getName()));
@@ -2039,16 +2053,9 @@
                     }
                     else
                     {
-                        SchemaField sf = type.getContainerField();
-                        assert (sf != null);
-                        if (sf.isAttribute())
-                        {
-                            writeString("_XR_" + QNameHelper.pretty(sf.getName()));
-                        }
-                        else
-                        {
-                            writeString("_XS_" + QNameHelper.pretty(sf.getName()));
-                        }
+                        // fix for XMLBEANS-105:
+                        // save out the external type reference using the type's signature.
+                        writeString("_XY_" + type.toString());
                     }
 
                     return;



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


Mime
View raw message