saad120 / dkpro-wsd

Automatically exported from code.google.com/p/dkpro-wsd
0 stars 0 forks source link

Clean up use of CAS/jCAS #71

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
This suggestion comes from Richard:

In most cases, you should inherit from JCas-based components, e.g.

<pre>
public class MASCReader
    extends JCasResourceCollectionReader_ImplBase
</pre>

This is because getting the CAS from a JCas is a safe operation
while getting the JCas from a CAS requires handling a potential exception.

Bad:

<pre>
    public void getNext(CAS aCAS)
        throws IOException, CollectionException
    {
        JCas jCas;
        try {
            jCas = aCAS.getJCas();
        }
        catch (CASException e) {
            throw new CollectionException(e);
        }

</pre>

Good:

<pre>
    public void getNext(JCas jCas)
        throws IOException, CollectionException
    {
</pre>

Original issue reported on code.google.com by tristan.miller@nothingisreal.com on 9 Jan 2015 at 2:03

GoogleCodeExporter commented 9 years ago

Original comment by tristan.miller@nothingisreal.com on 9 Jan 2015 at 5:15