You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xmlbeans.apache.org by wy...@apache.org on 2009/11/19 21:55:44 UTC

svn commit: r882294 - in /xmlbeans/trunk: src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeImpl.java test/src/misc/detailed/JiraRegression251_300Test.java

Author: wypoon
Date: Thu Nov 19 20:55:44 2009
New Revision: 882294

URL: http://svn.apache.org/viewvc?rev=882294&view=rev
Log:
Fix for XMLBEANS-260. Add a test for verification.

Added:
    xmlbeans/trunk/test/src/misc/detailed/JiraRegression251_300Test.java
Modified:
    xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeImpl.java

Modified: xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeImpl.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeImpl.java?rev=882294&r1=882293&r2=882294&view=diff
==============================================================================
--- xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeImpl.java (original)
+++ xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeImpl.java Thu Nov 19 20:55:44 2009
@@ -531,8 +531,12 @@
         { assertJavaizing(); _isCompiled = f; }
 
     public boolean isSkippedAnonymousType()
-        { return _outerSchemaTypeRef.get().getBaseType() == this ||
-                _outerSchemaTypeRef.get().getContentBasedOnType() == this; }
+    {
+        SchemaType outerType = getOuterType();
+        return ((outerType == null) ? false :
+                (outerType.getBaseType() == this ||
+                 outerType.getContentBasedOnType() == this));
+    }
 
     public String getShortJavaName()
         { return _shortJavaName; }

Added: xmlbeans/trunk/test/src/misc/detailed/JiraRegression251_300Test.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/misc/detailed/JiraRegression251_300Test.java?rev=882294&view=auto
==============================================================================
--- xmlbeans/trunk/test/src/misc/detailed/JiraRegression251_300Test.java (added)
+++ xmlbeans/trunk/test/src/misc/detailed/JiraRegression251_300Test.java Thu Nov 19 20:55:44 2009
@@ -0,0 +1,41 @@
+/*
+ *   Copyright 2009 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package misc.detailed;
+
+import misc.common.JiraTestBase;
+import com.easypo.*;
+
+public class JiraRegression251_300Test extends JiraTestBase
+{
+    public JiraRegression251_300Test(String name)
+    {
+        super(name);
+    }
+
+    /*
+    * [XMLBEANS-260]: SchemaType#isSkippedAnonymousType() throws an NPE
+    * if _outerSchemaTypeRef is not set
+    */
+    public void test_jira_xmlbeans260()
+    {
+        // construct an instance of a non-anonymous type
+        XmlShipperBean xbean = XmlShipperBean.Factory.newInstance();
+        // the following call should not throw an NPE;
+        // it should return false instead
+        boolean isSkipped = xbean.schemaType().isSkippedAnonymousType();
+        assertFalse(isSkipped);
+    }
+}



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