From aed2e307bab7ff1f41c6f8625c3f8cee5566bc9c Mon Sep 17 00:00:00 2001 From: amontano Date: Thu, 27 Aug 2009 22:20:12 +0000 Subject: [PATCH] Fixed json api to handle words not found. --- .../thdl/tib/scanner/RemoteScannerFilter.java | 46 ++++++++++++------- 1 file changed, 29 insertions(+), 17 deletions(-) diff --git a/source/org/thdl/tib/scanner/RemoteScannerFilter.java b/source/org/thdl/tib/scanner/RemoteScannerFilter.java index 733d8ec..33388f0 100644 --- a/source/org/thdl/tib/scanner/RemoteScannerFilter.java +++ b/source/org/thdl/tib/scanner/RemoteScannerFilter.java @@ -73,7 +73,7 @@ public class RemoteScannerFilter extends GenericServlet { // do nothing } - String linea, dicts = req.getParameter("dicts"), dicDescrip[], jwf = req.getParameter("jwf"), tag; + String linea = null, dicts = req.getParameter("dicts"), dicDescrip[], jwf = req.getParameter("jwf"), tag; Definitions defs; ByteDictionarySource dict_source; if (jwf!=null) format = JSON; @@ -132,9 +132,9 @@ public class RemoteScannerFilter extends GenericServlet { out.println(jwf + "({\"words\":{"); } + scanner.clearTokens(); try { - scanner.clearTokens(); switch (format) { case INTERNAL: @@ -154,35 +154,48 @@ public class RemoteScannerFilter extends GenericServlet scanner.scanLine(linea); } } - scanner.finishUp(); + } + catch (Exception e) + { + if (linea!=null) sl.writeLog("1\t2\t" + linea); + sl.writeException(e); + } + scanner.finishUp(); + try + { words = scanner.getWordArray(); if (words!=null) { for (i=0; i