Added debug info to the servlet version.

This commit is contained in:
amontano 2005-02-27 05:48:03 +00:00
parent 9507ff3694
commit 107fcce565
8 changed files with 210 additions and 200 deletions

View file

@ -229,6 +229,7 @@ public class FileSyllableListTree implements SyllableListTree
catch (Exception e)
{
System.out.println(e);
e.printStackTrace();
return null;
}
}
@ -252,6 +253,7 @@ public class FileSyllableListTree implements SyllableListTree
catch (Exception e)
{
System.out.println(e);
e.printStackTrace();
return null;
}
}

View file

@ -379,7 +379,6 @@ public class OnLineScannerFilter extends HttpServlet
pw.print(pm + " ");
}
}
}
}
pw.println("</p>");
@ -389,7 +388,7 @@ public class OnLineScannerFilter extends HttpServlet
{
int i, j;
Word words[];
SwingWord word;
SwingWord word=null;
Definitions defs;
String tag;
DictionarySource ds;
@ -402,10 +401,13 @@ public class OnLineScannerFilter extends HttpServlet
for (j=0; j<words.length; j++)
{
try
{
word = new SwingWord(words[j]);
defs = word.getDefs();
ds = defs.getDictionarySource();
if (ds==null) continue;
if (ds==null || ds.isEmpty()) continue;
pw.println(" <tr>");
tag = ds.getTag(0);
// else tag = null;
@ -435,6 +437,13 @@ public class OnLineScannerFilter extends HttpServlet
pw.println(" </tr>");
}
}
catch (Exception e)
{
sl.writeLog("Crash\tOnLineScannerFilter\t" + word.getWylie());
sl.writeException(e);
}
}
pw.println("</table>");
}

View file

@ -62,8 +62,7 @@ public class RemoteScannerFilter extends GenericServlet
res.setContentType ("text/plain");
sl.setUserIP(req.getRemoteAddr());
Token token[] = null;
Word word = null;
Word word = null, words[] = null;
PrintWriter out;
try
@ -117,27 +116,28 @@ public class RemoteScannerFilter extends GenericServlet
}
/* FIXME: sometimes getDef returns raises a NullPointerException.
/* FIXME: sometimes getDef raises a NullPointerException.
In the meantime, I'll just keep it from crashing
*/
sl.writeLog("Translation\tRemoteScannerFilter");
try
{
scanner.clearTokens();
while((linea = br.readLine())!= null)
scanner.scanLine(linea);
br.close();
scanner.finishUp();
token = scanner.getTokenArray();
words = scanner.getWordArray();
for (i=0; i<token.length; i++)
for (i=0; i<words.length; i++)
{
if (!(token[i] instanceof Word)) continue;
word = (Word) token[i];
out.println(word.getWylie());
out.println(word.getDef());
linea = words[i].getDef();
if (linea == null) continue;
out.println(words[i].getWylie());
out.println(linea);
out.println();
}
}

View file

@ -53,6 +53,7 @@ public class ScannerLogger
{
PrintStream pw = getPrintStream();
if (lastIP!=null) pw.print(lastIP);
else pw.print("-");
pw.println("\t" + getCurrentTime() + "\t" + s);
pw.flush();
pw.close();

View file

@ -332,7 +332,6 @@ public abstract class TibetanScanner
if (includeRepeated)
{
n = ll.size();
if (n==0) return null;
array = new Word[n];
@ -352,7 +351,6 @@ public abstract class TibetanScanner
while(li.hasNext())
{
word = (Word) li.next();
if (!ll2.contains(word)) ll2.addLast(word);
}