Richard Eckart de Castilho created UIMA-5054:
------------------------------------------------

             Summary: JCas returning generic class instead of JCas cover class
                 Key: UIMA-5054
                 URL: https://issues.apache.org/jira/browse/UIMA-5054
             Project: UIMA
          Issue Type: Bug
          Components: Collection Processing
    Affects Versions: 2.8.1SDK
            Reporter: Richard Eckart de Castilho
             Fix For: 2.9.0SDK


A DKPro Core user reported that when deploying an AE in a CPE 
he was unable to access a JCas cover class in the 
entityProcessComplete(...) CPE callback. See: 
https://groups.google.com/d/msg/dkpro-core-user/-DtO5Ivnk9I/sjQAPPv1BwAJ

{noformat}
        public void entityProcessComplete(CAS cas, EntityProcessStatus status) {
            try {
                JCas jcas = cas.getJCas();
                // here getting a JCas cover class fails. Instead,
                // an AnnotationImpl is returned from the jcas.
            } catch (CASException e) {
                e.printStackTrace();
            }
        }
{noformat}

The problem appears to be that the static CAS classloaders are restored
*before* invoking the entityProcessComplete() callback (CPMEngine 3468):

{noformat}
      try {
        if (null != cas)
          ((CASImpl)cas).switchClassLoaderLockCas(statCL);
        statCL.entityProcessComplete(cas, eps);
      } finally {
        if (null != cas) 
          ((CASImpl)cas).restoreClassLoaderUnlockCas();
      }
{noformat}

Is there any reason that the classloaders are switched out before invoking the 
callback? If not, any objection if I change the code such that the callback is 
invoked before the classloaders are switched out?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to