You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@uima.apache.org by "Tommaso Teofili (JIRA)" <ui...@incubator.apache.org> on 2009/08/06 15:22:14 UTC

[jira] Created: (UIMA-1478) possible NullPointerException on CASInitializer

possible NullPointerException on CASInitializer
-----------------------------------------------

                 Key: UIMA-1478
                 URL: https://issues.apache.org/jira/browse/UIMA-1478
             Project: UIMA
          Issue Type: Bug
          Components: Core Java Framework
    Affects Versions: 2.2.2
         Environment: MacOSX 10.5
            Reporter: Tommaso Teofili
             Fix For: 2.3S


code at lline 69
return casMgr.getCAS().getCurrentView();
could raise a not handled NPE on casMgr and getCAS()

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


[jira] Commented: (UIMA-1478) possible NullPointerException on CASInitializer

Posted by "Thilo Goetz (JIRA)" <ui...@incubator.apache.org>.
    [ https://issues.apache.org/jira/browse/UIMA-1478?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12740097#action_12740097 ] 

Thilo Goetz commented on UIMA-1478:
-----------------------------------

Tommaso, I agree with Jörn.  In the case of the tests, we don't want to recover from the situation.  If this fails, it probably means the test case needs to be fixed.  So it should fail as close as possible to the location of whatever causes the failure, and an NPE would be just fine.  If this wasn't test code, it would be a different story.  Do you agree?


> possible NullPointerException on CASInitializer
> -----------------------------------------------
>
>                 Key: UIMA-1478
>                 URL: https://issues.apache.org/jira/browse/UIMA-1478
>             Project: UIMA
>          Issue Type: Bug
>          Components: Core Java Framework
>    Affects Versions: 2.2.2
>         Environment: MacOSX 10.5
>            Reporter: Tommaso Teofili
>             Fix For: 2.3S
>
>         Attachments: patch1478.txt
>
>
> code at lline 69
> return casMgr.getCAS().getCurrentView();
> could raise a not handled NPE on casMgr and getCAS()

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


[jira] Commented: (UIMA-1478) possible NullPointerException on CASInitializer

Posted by "Jörn Kottmann (JIRA)" <ui...@incubator.apache.org>.
    [ https://issues.apache.org/jira/browse/UIMA-1478?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12740126#action_12740126 ] 

Jörn Kottmann commented on UIMA-1478:
-------------------------------------

No you are right.The exception handling in the method should be improved. If the exceptions can really occur and the method cannot return a cas object it throws a NPE. I just tried to say that returning null does not help to improve the situation at all.
To improve the situation we have to find out if the exceptions can really be thrown and then we can replace
the NPE by another explicit exception which also contains a message.

The method should also have a short javadoc comment explaining what it does and maybe explain under which
circumstances it throws an exception.

Please feel free to refactor the method.

> possible NullPointerException on CASInitializer
> -----------------------------------------------
>
>                 Key: UIMA-1478
>                 URL: https://issues.apache.org/jira/browse/UIMA-1478
>             Project: UIMA
>          Issue Type: Bug
>          Components: Core Java Framework
>    Affects Versions: 2.2.2
>         Environment: MacOSX 10.5
>            Reporter: Tommaso Teofili
>             Fix For: 2.3S
>
>         Attachments: patch1478.txt
>
>
> code at lline 69
> return casMgr.getCAS().getCurrentView();
> could raise a not handled NPE on casMgr and getCAS()

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


[jira] Commented: (UIMA-1478) possible NullPointerException on CASInitializer

Posted by "Tommaso Teofili (JIRA)" <ui...@incubator.apache.org>.
    [ https://issues.apache.org/jira/browse/UIMA-1478?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12740105#action_12740105 ] 

Tommaso Teofili commented on UIMA-1478:
---------------------------------------

I see it's a test support class, not a TestCase itself, so I thought more correctness would have been a plus to ensure potential test failures' cause is not in the support but in the testcase class. However I get your point of view, maybe I am wrong.

> possible NullPointerException on CASInitializer
> -----------------------------------------------
>
>                 Key: UIMA-1478
>                 URL: https://issues.apache.org/jira/browse/UIMA-1478
>             Project: UIMA
>          Issue Type: Bug
>          Components: Core Java Framework
>    Affects Versions: 2.2.2
>         Environment: MacOSX 10.5
>            Reporter: Tommaso Teofili
>             Fix For: 2.3S
>
>         Attachments: patch1478.txt
>
>
> code at lline 69
> return casMgr.getCAS().getCurrentView();
> could raise a not handled NPE on casMgr and getCAS()

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


[jira] Commented: (UIMA-1478) possible NullPointerException on CASInitializer

Posted by "Jörn Kottmann (JIRA)" <ui...@incubator.apache.org>.
    [ https://issues.apache.org/jira/browse/UIMA-1478?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12740066#action_12740066 ] 

Jörn Kottmann commented on UIMA-1478:
-------------------------------------

We are speaking here about test code and I do not agree that returning null instead of throwing a NPE improves the situation.
I searched the test code for invocations of the method in question and at many places the returned cas was accessed just after
it was created to get a reference to its Type System. Though in some places it was not accessed directly, which means that these 
tests would fail later and not at the place of the actual cause, which I think should be avoided.


> possible NullPointerException on CASInitializer
> -----------------------------------------------
>
>                 Key: UIMA-1478
>                 URL: https://issues.apache.org/jira/browse/UIMA-1478
>             Project: UIMA
>          Issue Type: Bug
>          Components: Core Java Framework
>    Affects Versions: 2.2.2
>         Environment: MacOSX 10.5
>            Reporter: Tommaso Teofili
>             Fix For: 2.3S
>
>         Attachments: patch1478.txt
>
>
> code at lline 69
> return casMgr.getCAS().getCurrentView();
> could raise a not handled NPE on casMgr and getCAS()

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


[jira] Updated: (UIMA-1478) possible NullPointerException on CASInitializer

Posted by "Tommaso Teofili (JIRA)" <ui...@incubator.apache.org>.
     [ https://issues.apache.org/jira/browse/UIMA-1478?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tommaso Teofili updated UIMA-1478:
----------------------------------

    Attachment: patch1478.txt

if clause added to avoid possible NullPointerExceptions

> possible NullPointerException on CASInitializer
> -----------------------------------------------
>
>                 Key: UIMA-1478
>                 URL: https://issues.apache.org/jira/browse/UIMA-1478
>             Project: UIMA
>          Issue Type: Bug
>          Components: Core Java Framework
>    Affects Versions: 2.2.2
>         Environment: MacOSX 10.5
>            Reporter: Tommaso Teofili
>             Fix For: 2.3S
>
>         Attachments: patch1478.txt
>
>
> code at lline 69
> return casMgr.getCAS().getCurrentView();
> could raise a not handled NPE on casMgr and getCAS()

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


[jira] Updated: (UIMA-1478) possible NullPointerException on CASInitializer

Posted by "Marshall Schor (JIRA)" <ui...@incubator.apache.org>.
     [ https://issues.apache.org/jira/browse/UIMA-1478?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Marshall Schor updated UIMA-1478:
---------------------------------

    Affects Version/s: 2.3S
        Fix Version/s:     (was: 2.3S)

defer past 2.3.0

> possible NullPointerException on CASInitializer
> -----------------------------------------------
>
>                 Key: UIMA-1478
>                 URL: https://issues.apache.org/jira/browse/UIMA-1478
>             Project: UIMA
>          Issue Type: Bug
>          Components: Core Java Framework
>    Affects Versions: 2.3S, 2.2.2
>         Environment: MacOSX 10.5
>            Reporter: Tommaso Teofili
>         Attachments: patch1478.txt
>
>
> code at lline 69
> return casMgr.getCAS().getCurrentView();
> could raise a not handled NPE on casMgr and getCAS()

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