You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Although this may not happen on desktop or laptop machine, directly using metamaplite in android produces w/system: a resource failed to call end(close). This error is basically caused by un-released fileinputstream or fileoutputstream. On android, the newly opened fileinputstream or fileoutputstream needs to be closed explicitly. In particular, this error comes from 2 sides when using metamaplite on android:
from metamaplite:
For example, in Example.java and Example2.java, the newly created FileReader is not closed after usage, so they need to be explicitly closed as shown below:
If more attention is paied, here I replaced the final ZipInputStream zip = new ZipInputStream(in); with ZipInputStream zip = new ZipInputStream((InputStream)in);. Yes, only in this way I can re-compile the the opennlp source code into a jar file in maven. If there is an alternative, please let me know.
The text was updated successfully, but these errors were encountered:
Fixed error where File resource was not closed when loading properties
from file.
Also updated incorrect examples.
This update addresses part #1 of issue #13
(#13)
Although this may not happen on desktop or laptop machine, directly using metamaplite in android produces
w/system: a resource failed to call end(close)
. This error is basically caused by un-releasedfileinputstream
orfileoutputstream
. On android, the newly openedfileinputstream
orfileoutputstream
needs to be closed explicitly. In particular, this error comes from 2 sides when using metamaplite on android:For example, in Example.java and Example2.java, the newly created
FileReader
is not closed after usage, so they need to be explicitly closed as shown below:For example, in org.apache.opennlp, opennlp/tools/util/model/BaseModel.java(loadModel) and opennlp/tools/util/model/BaseModel.java(finishLoadingArtifacts),
ZipInputStream zip
is not explicitly closed. This can be achieved by the following:loadModel
method:finishLoadingArtifacts
If more attention is paied, here I replaced the
final ZipInputStream zip = new ZipInputStream(in);
withZipInputStream zip = new ZipInputStream((InputStream)in);
. Yes, only in this way I can re-compile the the opennlp source code into a jar file in maven. If there is an alternative, please let me know.The text was updated successfully, but these errors were encountered: