From b1cc500abf28234c1b0e79796f5b58040edf6dfa Mon Sep 17 00:00:00 2001 From: amontano Date: Tue, 8 Mar 2005 09:50:52 +0000 Subject: [PATCH] Fixed stability bug --- .../thdl/tib/scanner/OnLineScannerFilter.java | 105 ++++++++++-------- 1 file changed, 61 insertions(+), 44 deletions(-) diff --git a/source/org/thdl/tib/scanner/OnLineScannerFilter.java b/source/org/thdl/tib/scanner/OnLineScannerFilter.java index b93125c..c8d3a68 100644 --- a/source/org/thdl/tib/scanner/OnLineScannerFilter.java +++ b/source/org/thdl/tib/scanner/OnLineScannerFilter.java @@ -384,57 +384,74 @@ public class OnLineScannerFilter extends HttpServlet pw.println("

"); } - public void printAllDefs(PrintWriter pw, boolean tibetan) - { - int i, j; + public void printAllDefs(PrintWriter pw, boolean tibetan) { + int i, j, k=0; Word words[]; - SwingWord word=null; + SwingWord word = null; Definitions defs; String tag; DictionarySource ds; + ByteDictionarySource sourceb=null; words = scanner.getWordArray(false); - - if (words == null) return; - - pw.println(""); - - for (j=0; j"); - if (ds!=null && !ds.isEmpty()) tag = ds.getTag(0); - else tag = " "; - if (tag==null) tag = " "; - - pw.println(" "); - pw.println(" "); - pw.println(" "); - pw.println(" "); - for (i=1; i"); - if (ds!=null && !ds.isEmpty()) tag = ds.getTag(i); - else tag = " "; - if (tag==null) tag = " "; - pw.println(" "); - pw.println(" "); - //else pw.println(" "); - pw.println(" "); - } - } - catch (Exception e) - { - sl.writeLog("Crash\tOnLineScannerFilter\t" + word.getWylie()); - sl.writeException(e); - } - + if (words == null) + return; + + pw.println("
"+ word.getBookmark(tibetan) +""+ tag +"" + defs.def[0] + "
"+ tag +"" + defs.def[i] + "" + defs.def[i] + "
"); + + for (j = 0; j < words.length; j++) { + try { + + word = new SwingWord(words[j]); + defs = word.getDefs(); + ds = defs.getDictionarySource(); + pw.println(" "); + if (ds == null) { + tag = " "; + } + else { + if (FileSyllableListTree.versionNumber==2) { + tag = ds.getTag(0); + } + else { + sourceb = (ByteDictionarySource) ds; + k=0; + while (sourceb.isEmpty(k)) k++; + tag = sourceb.getTag(k); + k++; + } + } + + pw.println(" "); + pw.println(" "); + pw.println(" "); + + pw.println(" "); + for (i = 1; i < defs.def.length; i++) { + pw.println(" "); + + if (FileSyllableListTree.versionNumber==2) { + tag = ds.getTag(i); + } + else { + while (sourceb.isEmpty(k)) k++; + tag = sourceb.getTag(k); + k++; + } + + pw.println(" "); + pw.println(" "); + //else pw.println(" "); + pw.println(" "); + } + } catch (Exception e) { + sl.writeLog("Crash\tOnLineScannerFilter\t" + word.getWylie()); + sl.writeException(e); + } + } pw.println("
" + word.getBookmark(tibetan) + + "" + tag + "" + defs.def[0] + "
" + tag + "" + defs.def[i] + "" + defs.def[i] + "
"); }