Added code to not fall into a ArrayIndexOutOfBounds. Still not clear why it happens.

This commit is contained in:
amontano 2005-03-06 10:00:24 +00:00
parent fb5173c2e2
commit db86a19d2b
2 changed files with 12 additions and 2 deletions

View file

@ -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<source.length; i++)
{
tag += ", ";
if (defTags==null) tag += Integer.toString(source[i]+1);
else tag += defTags[source[i]];
else
{
if (source[i]<0 || source[i]>=defTags.length) return null;
tag += defTags[source[i]];
}
}
return tag;

View file

@ -410,6 +410,7 @@ public class OnLineScannerFilter extends HttpServlet
pw.println(" <tr>");
if (ds!=null && !ds.isEmpty()) tag = ds.getTag(0);
else tag = "&nbsp;";
if (tag==null) tag = "&nbsp;";
pw.println(" <td width=\"20%\" rowspan=\""+ defs.def.length +"\" valign=\"top\">"+ word.getBookmark(tibetan) +"</td>");
pw.println(" <td width=\"12%\">"+ tag +"</td>");
@ -421,6 +422,7 @@ public class OnLineScannerFilter extends HttpServlet
pw.println(" <tr>");
if (ds!=null && !ds.isEmpty()) tag = ds.getTag(i);
else tag = "&nbsp;";
if (tag==null) tag = "&nbsp;";
pw.println(" <td width=\"12%\">"+ tag +"</td>");
pw.println(" <td width=\"68%\">" + defs.def[i] + "</td>");
//else pw.println(" <td width=\"80%\" colspan=\"2\">" + defs.def[i] + "</td>");