From db86a19d2bfa450eec39aa0c69c966749e6b52a1 Mon Sep 17 00:00:00 2001 From: amontano Date: Sun, 6 Mar 2005 10:00:24 +0000 Subject: [PATCH] Added code to not fall into a ArrayIndexOutOfBounds. Still not clear why it happens. --- .../org/thdl/tib/scanner/ByteDictionarySource.java | 12 ++++++++++-- source/org/thdl/tib/scanner/OnLineScannerFilter.java | 2 ++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/source/org/thdl/tib/scanner/ByteDictionarySource.java b/source/org/thdl/tib/scanner/ByteDictionarySource.java index a95efe0..eb8e775 100644 --- a/source/org/thdl/tib/scanner/ByteDictionarySource.java +++ b/source/org/thdl/tib/scanner/ByteDictionarySource.java @@ -305,14 +305,22 @@ public class ByteDictionarySource extends DictionarySource String tag; if (defTags==null) tag = Integer.toString(source[0]+1); - else tag = defTags[source[0]]; + else + { + if (source[0]<0 || source[0]>=defTags.length) return null; + tag = defTags[source[0]]; + } for (i=1; i=defTags.length) return null; + tag += defTags[source[i]]; + } } return tag; diff --git a/source/org/thdl/tib/scanner/OnLineScannerFilter.java b/source/org/thdl/tib/scanner/OnLineScannerFilter.java index 7ea4e63..b93125c 100644 --- a/source/org/thdl/tib/scanner/OnLineScannerFilter.java +++ b/source/org/thdl/tib/scanner/OnLineScannerFilter.java @@ -410,6 +410,7 @@ public class OnLineScannerFilter extends HttpServlet pw.println(" "); if (ds!=null && !ds.isEmpty()) tag = ds.getTag(0); else tag = " "; + if (tag==null) tag = " "; pw.println(" "+ word.getBookmark(tibetan) +""); pw.println(" "+ tag +""); @@ -421,6 +422,7 @@ public class OnLineScannerFilter extends HttpServlet pw.println(" "); if (ds!=null && !ds.isEmpty()) tag = ds.getTag(i); else tag = " "; + if (tag==null) tag = " "; pw.println(" "+ tag +""); pw.println(" " + defs.def[i] + ""); //else pw.println(" " + defs.def[i] + "");