You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@uima.apache.org by Jörn Kottmann <ko...@gmail.com> on 2009/07/09 09:18:44 UTC

XmiCasDeserializer.readFS(String, String, String, Attributes)

At the end of the mentioned method is an exception created
in an error case but not thrown.

I guess that can be fixed by inserting "throw e;".

Can somebody please have a look ?

...
if (this.allowPreexistingFS == AllowPreexistingFS.disallow) {
              CASRuntimeException e = new CASRuntimeException(
                          
CASRuntimeException.DELTA_CAS_PREEXISTING_FS_DISALLOWED,
                          new String[] {ID_ATTR_NAME + "=" + idStr,
                                        nameSpaceURI,
                                        localName,
                                        qualifiedName});
            }
...

Jörn

Re: XmiCasDeserializer.readFS(String, String, String, Attributes)

Posted by Jörn Kottmann <ko...@gmail.com>.
Tommaso Teofili wrote:
> Ok,I think throwing is ok (+1), but declaring in the public methods could be
> useful for developers in my opinion cause it's thrown explicitly.
Based on your reply I did a quick search through uimaj-core code
and look for references for the CASRuntimeException.
There are many interface which explicitly declare it.

Most important for a developer is to know under which circumstances
the exception is thrown. Since the exception if not self documenting
it must always be explained in the javadocs.

Jörn

Re: XmiCasDeserializer.readFS(String, String, String, Attributes)

Posted by Tommaso Teofili <to...@gmail.com>.
Ok,I think throwing is ok (+1), but declaring in the public methods could be
useful for developers in my opinion cause it's thrown explicitly.
Regards,
Tommaso Teofili

2009/7/9 Thilo Goetz <tw...@gmx.de>

>
>
> Jörn Kottmann wrote:
> > Tommaso Teofili wrote:
> >> Hi Jörn,
> >> I think you're right, the "throws CASRuntimeException" has to be
> >> declared in
> >> the readFS method signature too
> > In my opinion its ok to not declare it, since its an internal
> > private method and the CASRuntimeException is usually
> > only thrown when there is a programming mistake in the client code.
>
> +1, both to throwing and to not declaring it.
>
> >
> > Maybe I am wrong.
> >
> > Jörn
>

Re: XmiCasDeserializer.readFS(String, String, String, Attributes)

Posted by Thilo Goetz <tw...@gmx.de>.

Jörn Kottmann wrote:
> Tommaso Teofili wrote:
>> Hi Jörn,
>> I think you're right, the "throws CASRuntimeException" has to be
>> declared in
>> the readFS method signature too
> In my opinion its ok to not declare it, since its an internal
> private method and the CASRuntimeException is usually
> only thrown when there is a programming mistake in the client code.

+1, both to throwing and to not declaring it.

> 
> Maybe I am wrong.
> 
> Jörn

Re: XmiCasDeserializer.readFS(String, String, String, Attributes)

Posted by Jörn Kottmann <ko...@gmail.com>.
Tommaso Teofili wrote:
> Hi Jörn,
> I think you're right, the "throws CASRuntimeException" has to be declared in
> the readFS method signature too
In my opinion its ok to not declare it, since its an internal
private method and the CASRuntimeException is usually
only thrown when there is a programming mistake in the client code.

Maybe I am wrong.

Jörn

Re: XmiCasDeserializer.readFS(String, String, String, Attributes)

Posted by Tommaso Teofili <to...@gmail.com>.
Hi Jörn,
I think you're right, the "throws CASRuntimeException" has to be declared in
the readFS method signature too.
Consequently the thrown CASRuntimeException has to be thrown in the
referencig startElement method; by the way the CASRuntimeException is
already thrown in the code (row 367) but not declared in the startElement
signature.
Best regards,
Tommaso Teofili


2009/7/9 Jörn Kottmann <ko...@gmail.com>

> At the end of the mentioned method is an exception created
> in an error case but not thrown.
>
> I guess that can be fixed by inserting "throw e;".
>
> Can somebody please have a look ?
>
> ...
> if (this.allowPreexistingFS == AllowPreexistingFS.disallow) {
>             CASRuntimeException e = new CASRuntimeException(
>
> CASRuntimeException.DELTA_CAS_PREEXISTING_FS_DISALLOWED,
>                         new String[] {ID_ATTR_NAME + "=" + idStr,
>                                       nameSpaceURI,
>                                       localName,
>                                       qualifiedName});
>           }
> ...
>
> Jörn
>