You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xmlbeans.apache.org by "Luke Peters (JIRA)" <xm...@xml.apache.org> on 2006/03/29 16:43:25 UTC

[jira] Created: (XMLBEANS-260) Calling SchemaType.isSkippedAnonymousType() can throw a NPE

Calling SchemaType.isSkippedAnonymousType() can throw a NPE
-----------------------------------------------------------

         Key: XMLBEANS-260
         URL: http://issues.apache.org/jira/browse/XMLBEANS-260
     Project: XMLBeans
        Type: Bug
  Components: XmlObject  
    Versions: Version 2.1    
 Environment: Java 1.5, Windows XP
    Reporter: Luke Peters
     Fix For: Version 2.1


If isSkippedAnonymousType()  is called on a SchemaType instance that does not have _outerSchemaTypeRef set, then a NPE will be thrown. Example:

  MyXmlBean myBean = MyXmlBean.Factory.newInstance();
  boolean isSkipped = myBean.schemaType().isSkippedAnonymousType();  <- throws a NPE

It seems that it should return false in this instance, rather than throw an exception. All this needs to fix is to add a null check. I'm not sure which versions exactly are effected, but it is an issue in 2.1.

Current code:

    public boolean isSkippedAnonymousType()
        { return  _outerSchemaTypeRef.get().getBaseType() == this ||
                _outerSchemaTypeRef.get().getContentBasedOnType() == this; }

Potential fix:

    public boolean isSkippedAnonymousType()
        { return _outerSchemaTypeRef == null ? false : _outerSchemaTypeRef.get().getBaseType() == this ||
                _outerSchemaTypeRef.get().getContentBasedOnType() == this; }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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


[jira] Assigned: (XMLBEANS-260) Calling SchemaType.isSkippedAnonymousType() can throw a NPE

Posted by "Wing Yew Poon (JIRA)" <xm...@xml.apache.org>.
     [ https://issues.apache.org/jira/browse/XMLBEANS-260?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Wing Yew Poon reassigned XMLBEANS-260:
--------------------------------------

    Assignee: Wing Yew Poon

> Calling SchemaType.isSkippedAnonymousType() can throw a NPE
> -----------------------------------------------------------
>
>                 Key: XMLBEANS-260
>                 URL: https://issues.apache.org/jira/browse/XMLBEANS-260
>             Project: XMLBeans
>          Issue Type: Bug
>          Components: XmlObject
>    Affects Versions: Version 2.1
>         Environment: Java 1.5, Windows XP
>            Reporter: Luke Peters
>            Assignee: Wing Yew Poon
>             Fix For: Version 2.1
>
>
> If isSkippedAnonymousType()  is called on a SchemaType instance that does not have _outerSchemaTypeRef set, then a NPE will be thrown. Example:
>   MyXmlBean myBean = MyXmlBean.Factory.newInstance();
>   boolean isSkipped = myBean.schemaType().isSkippedAnonymousType();  <- throws a NPE
> It seems that it should return false in this instance, rather than throw an exception. All this needs to fix is to add a null check. I'm not sure which versions exactly are effected, but it is an issue in 2.1.
> Current code:
>     public boolean isSkippedAnonymousType()
>         { return  _outerSchemaTypeRef.get().getBaseType() == this ||
>                 _outerSchemaTypeRef.get().getContentBasedOnType() == this; }
> Potential fix:
>     public boolean isSkippedAnonymousType()
>         { return _outerSchemaTypeRef == null ? false : _outerSchemaTypeRef.get().getBaseType() == this ||
>                 _outerSchemaTypeRef.get().getContentBasedOnType() == this; }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (XMLBEANS-260) Calling SchemaType.isSkippedAnonymousType() can throw a NPE

Posted by "Wing Yew Poon (JIRA)" <xm...@xml.apache.org>.
    [ https://issues.apache.org/jira/browse/XMLBEANS-260?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12772751#action_12772751 ] 

Wing Yew Poon commented on XMLBEANS-260:
----------------------------------------

The isSkippedAnonymousType method should only be called on a SchemaType instance that *is* in fact an anonymous type.


> Calling SchemaType.isSkippedAnonymousType() can throw a NPE
> -----------------------------------------------------------
>
>                 Key: XMLBEANS-260
>                 URL: https://issues.apache.org/jira/browse/XMLBEANS-260
>             Project: XMLBeans
>          Issue Type: Bug
>          Components: XmlObject
>    Affects Versions: Version 2.1
>         Environment: Java 1.5, Windows XP
>            Reporter: Luke Peters
>            Assignee: Wing Yew Poon
>             Fix For: Version 2.1
>
>
> If isSkippedAnonymousType()  is called on a SchemaType instance that does not have _outerSchemaTypeRef set, then a NPE will be thrown. Example:
>   MyXmlBean myBean = MyXmlBean.Factory.newInstance();
>   boolean isSkipped = myBean.schemaType().isSkippedAnonymousType();  <- throws a NPE
> It seems that it should return false in this instance, rather than throw an exception. All this needs to fix is to add a null check. I'm not sure which versions exactly are effected, but it is an issue in 2.1.
> Current code:
>     public boolean isSkippedAnonymousType()
>         { return  _outerSchemaTypeRef.get().getBaseType() == this ||
>                 _outerSchemaTypeRef.get().getContentBasedOnType() == this; }
> Potential fix:
>     public boolean isSkippedAnonymousType()
>         { return _outerSchemaTypeRef == null ? false : _outerSchemaTypeRef.get().getBaseType() == this ||
>                 _outerSchemaTypeRef.get().getContentBasedOnType() == this; }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Resolved: (XMLBEANS-260) Calling SchemaType.isSkippedAnonymousType() can throw a NPE

Posted by "Wing Yew Poon (JIRA)" <xm...@xml.apache.org>.
     [ https://issues.apache.org/jira/browse/XMLBEANS-260?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Wing Yew Poon resolved XMLBEANS-260.
------------------------------------

       Resolution: Fixed
    Fix Version/s:     (was: Version 2.1)
                   Version 2.4.1 

Fix should go into the next release (expected to be 2.5).


> Calling SchemaType.isSkippedAnonymousType() can throw a NPE
> -----------------------------------------------------------
>
>                 Key: XMLBEANS-260
>                 URL: https://issues.apache.org/jira/browse/XMLBEANS-260
>             Project: XMLBeans
>          Issue Type: Bug
>          Components: XmlObject
>    Affects Versions: Version 2.1
>         Environment: Java 1.5, Windows XP
>            Reporter: Luke Peters
>            Assignee: Wing Yew Poon
>             Fix For: Version 2.4.1 
>
>
> If isSkippedAnonymousType()  is called on a SchemaType instance that does not have _outerSchemaTypeRef set, then a NPE will be thrown. Example:
>   MyXmlBean myBean = MyXmlBean.Factory.newInstance();
>   boolean isSkipped = myBean.schemaType().isSkippedAnonymousType();  <- throws a NPE
> It seems that it should return false in this instance, rather than throw an exception. All this needs to fix is to add a null check. I'm not sure which versions exactly are effected, but it is an issue in 2.1.
> Current code:
>     public boolean isSkippedAnonymousType()
>         { return  _outerSchemaTypeRef.get().getBaseType() == this ||
>                 _outerSchemaTypeRef.get().getContentBasedOnType() == this; }
> Potential fix:
>     public boolean isSkippedAnonymousType()
>         { return _outerSchemaTypeRef == null ? false : _outerSchemaTypeRef.get().getBaseType() == this ||
>                 _outerSchemaTypeRef.get().getContentBasedOnType() == this; }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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