[Httpunit-commit] CVS: httpunit/src/com/meterware/httpunit WebTable.java,1.29,1.30
Brought to you by:
russgold
|
From: Russell G. <rus...@us...> - 2005-01-13 04:16:01
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28560/src/com/meterware/httpunit Modified Files: WebTable.java Log Message: Prevent array out of bounds exception while purging spanning cells Index: WebTable.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebTable.java,v retrieving revision 1.29 retrieving revision 1.30 diff -u -r1.29 -r1.30 --- WebTable.java 27 Jun 2004 19:29:15 -0000 1.29 +++ WebTable.java 13 Jan 2005 04:15:46 -0000 1.30 @@ -2,7 +2,7 @@ /******************************************************************************************************************** * $Id$ * -* Copyright (c) 2000-2004, Russell Gold +* Copyright (c) 2000-2005, Russell Gold * * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated * documentation files (the "Software"), to deal in the Software without restriction, including without limitation @@ -19,12 +19,14 @@ * DEALINGS IN THE SOFTWARE. * *******************************************************************************************************************/ -import java.net.URL; - -import java.util.*; - -import org.w3c.dom.*; import com.meterware.httpunit.scripting.ScriptableDelegate; +import org.w3c.dom.Element; +import org.w3c.dom.Node; + +import java.net.URL; +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.Hashtable; /** * This class represents a table in an HTML page. @@ -140,10 +142,10 @@ int coords[] = (int[]) spanningCells.get( cell ); boolean neededInRow = true; boolean neededInCol = true; - for (int i = coords[0]; neededInRow && (i < coords[0] + cell.getRowSpan()); i++) { + for (int i = coords[0]; neededInRow && (i < rowHasText.length) && (i < coords[0] + cell.getRowSpan()); i++) { neededInRow = !rowHasText[i]; } - for (int j = coords[1]; neededInCol && (j < coords[1] + cell.getColSpan()); j++) { + for (int j = coords[1]; neededInCol && (j < columnHasText.length) && (j < coords[1] + cell.getColSpan()); j++) { neededInCol = !columnHasText[j]; } if (neededInRow) { |