There's always a non-official way, dependent on the version (that can change). See the Sofa.class method setLocalSofaData.
It, in turn, calls a method which checks if it's been set (and if so, throws). But you "could" just call the method it would have called... ( _setStringValueNcWj(wrapGetIntCatchException(_FH_sofaString), aString); ) The DocumentAnnotation singleton needs to be updated as a side effect (the end value changes if the sofa length changes). We could make some kind of official thing here, if it is warranted. -Marshall On 1/18/2018 4:52 PM, Richard Eckart de Castilho wrote: > On 18.01.2018, at 20:06, Marshall Schor <m...@schor.com> wrote: >> Got to the point where I'm getting a JCas feature offset incompatibility - >> starting debug... > Great :) > > Meanwhile, I'm working off the things you found... > > Btw. trying to run the WebAnno UIMAv3 build from the command line, I > found that the tests of the WebAnno remote API fail now. The reason > seems to be that you blocked a sneaky little way that I used to change > the SOFA string even after the CAS has been locked down: > > org.apache.uima.cas.CASRuntimeException: Can''t use standard set methods with > SofaFS features. > at org.apache.uima.jcas.cas.Sofa.setStringValue(Sofa.java:267) > ~[classes/:na] > at > org.apache.uima.cas.impl.CASImpl.ll_setStringValue(CASImpl.java:3291) > ~[classes/:na] > at > de.tudarmstadt.ukp.clarin.webanno.webapp.remoteapi.RemoteApiController2.forceSetFeatureValue(RemoteApiController2.java:1066) > ~[classes/:na] > at > de.tudarmstadt.ukp.clarin.webanno.webapp.remoteapi.RemoteApiController2.createCompatibleCas(RemoteApiController2.java:1003) > ~[classes/:na] > at > de.tudarmstadt.ukp.clarin.webanno.webapp.remoteapi.RemoteApiController2.annotationsCreate(RemoteApiController2.java:703) > ~[classes/:na] > > The code triggering this is here (for your entertainment): > > // Just in case we really had to chomp off a trailing line break from > the annotation CAS, > // make sure we copy over the proper text from the initial CAS > // NOT AT HOME THIS YOU SHOULD TRY > // SETTING THE SOFA STRING FORCEFULLY FOLLOWING THE DARK SIDE IS! > forceSetFeatureValue(annotationCas.getSofa(), > CAS.FEATURE_BASE_NAME_SOFASTRING, > initialCas.getDocumentText()); > > So Master Schor... you defeated me. > > I introduced this because it can happen that an annotation file uploaded > through the > remote API might have a trailing line break while the corresponding reference > document > that is already in WebAnno does not (or vice versa) - and I am here trying to > fix this > situation to ensure that the sofa strings are equal. > > Assuming you had to do that, how would you patch the sofa string? > > Cheers, > > -- Richard