Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OPENNLP-1619 - Fix possible NPE for PerformanceMonitor in *Tools #663

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,10 @@ public void run(String[] args) {

ChunkerME chunker = new ChunkerME(model);

PerformanceMonitor perfMon = null;
PerformanceMonitor perfMon = new PerformanceMonitor("sent");

try (ObjectStream<String> lineStream = new PlainTextByLineStream(
new SystemInputStreamFactory(), SystemInputStreamFactory.encoding())) {
perfMon = new PerformanceMonitor("sent");
perfMon.start();
String line;
while ((line = lineStream.read()) != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,10 @@ public void run(String[] args) {

Parser parser = ParserFactory.create(model, beamSize, advancePercentage);

PerformanceMonitor perfMon = null;
PerformanceMonitor perfMon = new PerformanceMonitor("sent");
try (ObjectStream<String> lineStream = new PlainTextByLineStream(
new SystemInputStreamFactory(), SystemInputStreamFactory.encoding())) {

perfMon = new PerformanceMonitor("sent");
perfMon.start();
String line;
while ((line = lineStream.read()) != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,11 @@ public void run(String[] args) {

POSTaggerME tagger = new POSTaggerME(model);

PerformanceMonitor perfMon = null;
PerformanceMonitor perfMon = new PerformanceMonitor("sent");

try (ObjectStream<String> lineStream = new PlainTextByLineStream(
new SystemInputStreamFactory(), SystemInputStreamFactory.encoding())) {

perfMon = new PerformanceMonitor("sent");
perfMon.start();
String line;
while ((line = lineStream.read()) != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,14 @@ void process() {
ObjectStream<String> untokenizedLineStream;

ObjectStream<String> tokenizedLineStream;
PerformanceMonitor perfMon = null;
PerformanceMonitor perfMon = new PerformanceMonitor("sent");
try {
untokenizedLineStream =
new PlainTextByLineStream(new SystemInputStreamFactory(), SystemInputStreamFactory.encoding());

tokenizedLineStream = new WhitespaceTokenStream(
new TokenizerStream(tokenizer, untokenizedLineStream));

perfMon = new PerformanceMonitor("sent");
perfMon.start();


Expand Down