Permalink
Browse files

more cleanup

  • Loading branch information...
1 parent ec7de94 commit 6c449e7d481702fa63794f60b74ce4669849c66d derrickoswald committed Apr 25, 2011
Showing with 244 additions and 222 deletions.
  1. +1 −1 filterbuilder/src/main/java/org/htmlparser/parserapplications/filterbuilder/Filter.java
  2. +3 −3 filterbuilder/src/main/java/org/htmlparser/parserapplications/filterbuilder/FilterBuilder.java
  3. +0 −2 ...erbuilder/src/main/java/org/htmlparser/parserapplications/filterbuilder/HtmlTreeCellRenderer.java
  4. +1 −1 filterbuilder/src/main/java/org/htmlparser/parserapplications/filterbuilder/HtmlTreeModel.java
  5. +2 −2 ...main/java/org/htmlparser/parserapplications/filterbuilder/wrappers/HasAttributeFilterWrapper.java
  6. +156 −126 lexer/src/main/java/org/htmlparser/http/ConnectionManager.java
  7. +0 −2 parser/src/main/java/org/htmlparser/beans/HTMLLinkBean.java
  8. +0 −2 parser/src/main/java/org/htmlparser/beans/HTMLTextBean.java
  9. +14 −16 parser/src/main/java/org/htmlparser/util/ParserUtils.java
  10. +4 −2 parser/src/test/java/org/htmlparser/tests/lexerTests/LexerTests.java
  11. +42 −42 parser/src/test/java/org/htmlparser/tests/lexerTests/PageTests.java
  12. +4 −2 parser/src/test/java/org/htmlparser/tests/tagTests/BodyTagTest.java
  13. +2 −2 parser/src/test/java/org/htmlparser/tests/tagTests/OptionTagTest.java
  14. +1 −1 parser/src/test/java/org/htmlparser/tests/tagTests/SelectTagTest.java
  15. +1 −1 parser/src/test/java/org/htmlparser/tests/tagTests/TextareaTagTest.java
  16. +6 −3 parser/src/test/java/org/htmlparser/tests/tagTests/TitleTagTest.java
  17. +6 −11 parser/src/test/java/org/htmlparser/tests/utilTests/BeanTest.java
  18. +1 −2 parser/src/test/java/org/htmlparser/tests/utilTests/NonEnglishTest.java
  19. +0 −1 pom.xml
View
2 filterbuilder/src/main/java/org/htmlparser/parserapplications/filterbuilder/Filter.java
@@ -426,7 +426,7 @@ public static Filter wrap (NodeFilter filter, Parser context)
ret = null;
class_name = filter.getClass ().getName ();
- class_name = (String)mWrappers.get (class_name);
+ class_name = mWrappers.get (class_name);
if (null != class_name)
{
try
View
6 ...rbuilder/src/main/java/org/htmlparser/parserapplications/filterbuilder/FilterBuilder.java
@@ -1760,7 +1760,7 @@ protected void selectSelection (boolean select)
count = mSelection.size ();
for (int i = 0; i < count; i++)
{
- filter = (Filter)mSelection.elementAt (i);
+ filter = mSelection.elementAt (i);
filter.setSelected (select);
}
}
@@ -1787,7 +1787,7 @@ protected void moveSelection (Point translation)
count = mSelection.size ();
for (int i = 0; i < count; i++)
{
- filter = (Filter)mSelection.elementAt (i);
+ filter = mSelection.elementAt (i);
point = filter.getLocation ();
point.translate (translation.x, translation.y);
synchronized (filter.getTreeLock ())
@@ -1821,7 +1821,7 @@ protected Filter lastSelected ()
ret = null;
if (0 < mSelection.size ())
- ret = (Filter)mSelection.lastElement ();
+ ret = mSelection.lastElement ();
return (ret);
}
View
2 ...r/src/main/java/org/htmlparser/parserapplications/filterbuilder/HtmlTreeCellRenderer.java
@@ -44,8 +44,6 @@
public class HtmlTreeCellRenderer
extends
DefaultTreeCellRenderer
- implements
- TreeCellRenderer
{
/**
*
View
2 ...rbuilder/src/main/java/org/htmlparser/parserapplications/filterbuilder/HtmlTreeModel.java
@@ -221,7 +221,7 @@ public void valueForPathChanged (TreePath path, Object newValue)
for (int i = 0; i < v.size (); i++)
{
- TreeModelListener listener = (TreeModelListener)v.elementAt (i);
+ TreeModelListener listener = v.elementAt (i);
listener.treeStructureChanged (event);
}
}
View
4 ...a/org/htmlparser/parserapplications/filterbuilder/wrappers/HasAttributeFilterWrapper.java
@@ -143,7 +143,7 @@ protected void addAttributes (Set<String> set, Node node)
attributes = ((Tag)node).getAttributesEx ();
for (int i = 1; i < attributes.size (); i++)
{
- attribute = (Attribute)attributes.elementAt (i);
+ attribute = attributes.elementAt (i);
name = attribute.getName ();
if (null != name)
set.add (name);
@@ -175,7 +175,7 @@ protected void addAttributeValues (Set<String> set, Node node)
attributes = ((Tag)node).getAttributesEx ();
for (int i = 1; i < attributes.size (); i++)
{
- attribute = (Attribute)attributes.elementAt (i);
+ attribute = attributes.elementAt (i);
if (null != attribute.getName ())
{
value = attribute.getValue ();
View
282 lexer/src/main/java/org/htmlparser/http/ConnectionManager.java
@@ -545,178 +545,208 @@ protected String getLocation (HttpURLConnection http)
}
/**
- * Opens a connection using the given url.
- * @param url The url to open.
+ * Opens a prepared connection.
+ * @param connection The connection to open.
* @return The connection.
* @exception ParserException if an i/o exception occurs accessing the url.
*/
- public URLConnection openConnection (URL url)
+ public URLConnection openConnection (URLConnection connection)
throws
ParserException
{
boolean repeat;
int repeated;
- Properties sysprops;
- Hashtable<String,String> properties;
- Enumeration<String> enumeration;
- String key;
- String value;
- String set = null; // old proxySet value
- String host = null; // old proxyHost value
- String port = null; // old proxyPort value
- String host2 = null; // old http.proxyHost value
- String port2 = null; // old http.proxyPort value
+ URL url;
HttpURLConnection http;
String auth;
String encoded;
int code;
String uri;
- URLConnection ret;
+ Hashtable<String,String> properties;
+ Enumeration<String> enumeration;
+ String key;
+ String value;
+ url = null;
repeated = 0;
do
{
repeat = false;
try
{
- try
+ if (connection instanceof HttpURLConnection)
{
- // set up for proxy
- if ((null != getProxyHost ()) && (0 != getProxyPort ()))
- {
- sysprops = System.getProperties ();
- set = (String)sysprops.put ("proxySet", "true");
- host = (String)sysprops.put ("proxyHost", getProxyHost ());
- port = (String)sysprops.put ("proxyPort",
- Integer.toString (getProxyPort ()));
- // see http://java.sun.com/j2se/1.4.2/docs/guide/net/properties.html
- host2 = (String)sysprops.put ("http.proxyHost",
- getProxyHost ());
- port2 = (String)sysprops.put ("http.proxyPort",
- Integer.toString (getProxyPort ()));
- System.setProperties (sysprops);
+ http = (HttpURLConnection)connection;
- }
+ http.setInstanceFollowRedirects (!getRedirectionProcessingEnabled ());
- // open the connection... but don't connect yet
- ret = url.openConnection ();
- if (ret instanceof HttpURLConnection)
- {
- http = (HttpURLConnection)ret;
+ // set the fixed request properties
+ properties = getRequestProperties ();
+ if (null != properties)
+ for (enumeration = properties.keys ();
+ enumeration.hasMoreElements ();)
+ {
+ key = enumeration.nextElement ();
+ value = properties.get (key);
+ connection.setRequestProperty (key, value);
+ }
- if (getRedirectionProcessingEnabled ())
- http.setInstanceFollowRedirects (false);
+ // set the proxy name and password
+ if ((null != getProxyUser ())
+ && (null != getProxyPassword ()))
+ {
+ auth = getProxyUser () + ":" + getProxyPassword ();
+ encoded = encode (auth.getBytes("ISO-8859-1"));
+ connection.setRequestProperty ("Proxy-Authorization", "Basic " + encoded);
+ }
- // set the fixed request properties
- properties = getRequestProperties ();
- if (null != properties)
- for (enumeration = properties.keys ();
- enumeration.hasMoreElements ();)
- {
- key = enumeration.nextElement ();
- value = properties.get (key);
- ret.setRequestProperty (key, value);
- }
+ // set the URL name and password
+ if ((null != getUser ()) && (null != getPassword ()))
+ {
+ auth = getUser () + ":" + getPassword ();
+ encoded = encode (auth.getBytes("ISO-8859-1"));
+ connection.setRequestProperty ("Authorization",
+ "Basic " + encoded);
+ }
- // set the proxy name and password
- if ((null != getProxyUser ())
- && (null != getProxyPassword ()))
- {
- auth = getProxyUser () + ":" + getProxyPassword ();
- encoded = encode (auth.getBytes("ISO-8859-1"));
- ret.setRequestProperty ("Proxy-Authorization", "Basic " + encoded);
- }
+ if (getCookieProcessingEnabled ())
+ // set the cookies based on the url
+ addCookies (connection);
- // set the URL name and password
- if ((null != getUser ()) && (null != getPassword ()))
- {
- auth = getUser () + ":" + getPassword ();
- encoded = encode (auth.getBytes("ISO-8859-1"));
- ret.setRequestProperty ("Authorization",
- "Basic " + encoded);
- }
+ if (null != getMonitor ())
+ getMonitor ().preConnect (http);
+ }
+ else
+ http = null;
- if (getCookieProcessingEnabled ())
- // set the cookies based on the url
- addCookies (ret);
+ try
+ {
+ connection.connect ();
+ if (null != http)
+ {
if (null != getMonitor ())
- getMonitor ().preConnect (http);
- }
- else
- http = null;
+ getMonitor ().postConnect (http);
- try
- {
- ret.connect ();
+ if (getCookieProcessingEnabled ())
+ parseCookies (connection);
- if (null != http)
- {
- if (null != getMonitor ())
- getMonitor ().postConnect (http);
-
- if (getCookieProcessingEnabled ())
- parseCookies (ret);
-
- code = http.getResponseCode ();
- if ((3 == (code / 100)) && (repeated < 20))
- if (null != (uri = getLocation (http)))
- {
- url = new URL (uri);
- repeat = true;
- repeated++;
- }
- }
- }
- catch (UnknownHostException uhe)
- {
- int message = (int)(Math.random () * FOUR_OH_FOUR.length);
- throw new ParserException (FOUR_OH_FOUR[message], uhe);
- }
- catch (IOException ioe)
- {
- throw new ParserException (ioe.getMessage (), ioe);
+ code = http.getResponseCode ();
+ if ((3 == (code / 100)) && (repeated < 20))
+ if (null != (uri = getLocation (http)))
+ {
+ url = new URL (uri);
+ connection = url.openConnection ();
+ repeat = true;
+ repeated++;
+ }
}
}
- finally
+ catch (UnknownHostException uhe)
{
- if ((null != getProxyHost ()) && (0 != getProxyPort ()))
- {
- sysprops = System.getProperties ();
- if (null != set)
- sysprops.put ("proxySet", set);
- else
- sysprops.remove ("proxySet");
- if (null != host)
- sysprops.put ("proxyHost", host);
- else
- sysprops.remove ("proxyHost");
- if (null != port)
- sysprops.put ("proxyPort", port);
- else
- sysprops.remove ("proxyPort");
- if (null != host2)
- sysprops.put ("http.proxyHost", host2);
- else
- sysprops.remove ("http.proxyHost");
- if (null != port2)
- sysprops.put ("http.proxyPort", port2);
- else
- sysprops.remove ("http.proxyPort");
- System.setProperties (sysprops);
- }
+ int message = (int)(Math.random () * FOUR_OH_FOUR.length);
+ throw new ParserException (FOUR_OH_FOUR[message], uhe);
+ }
+ catch (IOException ioe)
+ {
+ throw new ParserException (ioe.getMessage (), ioe);
}
}
catch (IOException ioe)
{
String msg = "Error in opening a connection to "
- + url.toExternalForm ();
+ + connection.getURL().toExternalForm ();
ParserException ex = new ParserException (msg, ioe);
throw ex;
}
}
while (repeat);
+ return (connection);
+ }
+
+ /**
+ * Opens a connection using the given url.
+ * @param url The url to open.
+ * @return The connection.
+ * @exception ParserException if an i/o exception occurs accessing the url.
+ */
+ public URLConnection openConnection (URL url)
+ throws
+ ParserException
+ {
+ Properties sysprops;
+ String set = null; // old proxySet value
+ String host = null; // old proxyHost value
+ String port = null; // old proxyPort value
+ String host2 = null; // old http.proxyHost value
+ String port2 = null; // old http.proxyPort value
+ URLConnection ret;
+
+ try
+ {
+ // set up for proxy
+ if ((null != getProxyHost ()) && (0 != getProxyPort ()))
+ {
+ sysprops = System.getProperties ();
+ set = (String)sysprops.put ("proxySet", "true");
+ host = (String)sysprops.put ("proxyHost", getProxyHost ());
+ port = (String)sysprops.put ("proxyPort",
+ Integer.toString (getProxyPort ()));
+ // see http://java.sun.com/j2se/1.4.2/docs/guide/net/properties.html
+ host2 = (String)sysprops.put ("http.proxyHost",
+ getProxyHost ());
+ port2 = (String)sysprops.put ("http.proxyPort",
+ Integer.toString (getProxyPort ()));
+ System.setProperties (sysprops);
+
+ }
+
+ try
+ {
+ // open the connection... but don't connect yet
+ ret = url.openConnection ();
+ ret = openConnection (ret);
+ }
+ catch (IOException ioe)
+ {
+ String msg = "Error in opening a connection to "
+ + url.toExternalForm ();
+ ParserException ex = new ParserException (msg, ioe);
+ throw ex;
+ }
+
+
+ }
+ finally
+ {
+ if ((null != getProxyHost ()) && (0 != getProxyPort ()))
+ {
+ sysprops = System.getProperties ();
+ if (null != set)
+ sysprops.put ("proxySet", set);
+ else
+ sysprops.remove ("proxySet");
+ if (null != host)
+ sysprops.put ("proxyHost", host);
+ else
+ sysprops.remove ("proxyHost");
+ if (null != port)
+ sysprops.put ("proxyPort", port);
+ else
+ sysprops.remove ("proxyPort");
+ if (null != host2)
+ sysprops.put ("http.proxyHost", host2);
+ else
+ sysprops.remove ("http.proxyHost");
+ if (null != port2)
+ sysprops.put ("http.proxyPort", port2);
+ else
+ sysprops.remove ("http.proxyPort");
+ System.setProperties (sysprops);
+ }
+ }
+
return (ret);
}
View
2 parser/src/main/java/org/htmlparser/beans/HTMLLinkBean.java
@@ -29,7 +29,6 @@
import java.awt.FontMetrics;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
-import java.io.Serializable;
import java.net.URL;
import java.net.URLConnection;
@@ -44,7 +43,6 @@
extends
JList
implements
- Serializable,
PropertyChangeListener
{
/**
View
2 parser/src/main/java/org/htmlparser/beans/HTMLTextBean.java
@@ -29,7 +29,6 @@
import java.awt.FontMetrics;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
-import java.io.Serializable;
import java.net.URLConnection;
import javax.swing.JTextArea;
@@ -43,7 +42,6 @@
extends
JTextArea
implements
- Serializable,
PropertyChangeListener
{
/**
View
30 parser/src/main/java/org/htmlparser/util/ParserUtils.java
@@ -25,7 +25,6 @@
package org.htmlparser.util;
-import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import org.htmlparser.Node;
@@ -672,7 +671,7 @@ public static String trimCharsBeginEnd (String input, String charsToBeRemoved)
* @see ParserUtils#splitTags (String input, String[] tags, boolean recursive, boolean insideTag).
*/
public static String[] splitTags (String input, String[] tags)
- throws ParserException, UnsupportedEncodingException
+ throws ParserException
{
return splitTags (input, tags, true, true);
}
@@ -695,7 +694,7 @@ public static String trimCharsBeginEnd (String input, String charsToBeRemoved)
* @return The string array containing the strings delimited by tags.
*/
public static String[] splitTags (String input, String[] tags, boolean recursive, boolean insideTag)
- throws ParserException, UnsupportedEncodingException
+ throws ParserException
{
ArrayList<String> outputArrayList = new ArrayList<String> ();
@@ -787,7 +786,7 @@ public static String trimCharsBeginEnd (String input, String charsToBeRemoved)
* @see ParserUtils#splitTags (String input, String[] tags, boolean recursive, boolean insideTag).
*/
public static String[] splitTags (String input, Class<?> nodeType)
- throws ParserException, UnsupportedEncodingException
+ throws ParserException
{
return splitTags (input, new NodeClassFilter (nodeType), true, true);
}
@@ -800,7 +799,7 @@ public static String trimCharsBeginEnd (String input, String charsToBeRemoved)
* @see ParserUtils#splitTags (String input, String[] tags, boolean recursive, boolean insideTag).
*/
public static String[] splitTags (String input, Class<?> nodeType, boolean recursive, boolean insideTag)
- throws ParserException, UnsupportedEncodingException
+ throws ParserException
{
return splitTags (input, new NodeClassFilter (nodeType), recursive, insideTag);
}
@@ -813,7 +812,7 @@ public static String trimCharsBeginEnd (String input, String charsToBeRemoved)
* @see ParserUtils#splitTags (String input, String[] tags, boolean recursive, boolean insideTag).
*/
public static String[] splitTags (String input, NodeFilter filter)
- throws ParserException, UnsupportedEncodingException
+ throws ParserException
{
return splitTags (input, filter, true, true);
}
@@ -826,7 +825,7 @@ public static String trimCharsBeginEnd (String input, String charsToBeRemoved)
* @see ParserUtils#splitTags (String input, String[] tags, boolean recursive, boolean insideTag).
*/
public static String[] splitTags (String input, NodeFilter filter, boolean recursive, boolean insideTag)
- throws ParserException, UnsupportedEncodingException
+ throws ParserException
{
ArrayList<String> outputArrayList = new ArrayList<String> ();
@@ -943,7 +942,7 @@ public static String trimAllTags (String input, boolean inside)
* @see ParserUtils#trimTags (String input, String[] tags, boolean recursive, boolean insideTag).
*/
public static String trimTags (String input, String[] tags)
- throws ParserException, UnsupportedEncodingException
+ throws ParserException
{
return trimTags (input, tags, true, true);
}
@@ -967,7 +966,7 @@ public static String trimTags (String input, String[] tags)
* @return The string without tags.
*/
public static String trimTags (String input, String[] tags, boolean recursive, boolean insideTag)
- throws ParserException, UnsupportedEncodingException
+ throws ParserException
{
StringBuffer output = new StringBuffer();
@@ -1034,7 +1033,7 @@ public static String trimTags (String input, String[] tags, boolean recursive, b
* @see ParserUtils#trimTags (String input, String[] tags, boolean recursive, boolean insideTag).
*/
public static String trimTags (String input, Class<?> nodeType)
- throws ParserException, UnsupportedEncodingException
+ throws ParserException
{
return trimTags (input, new NodeClassFilter (nodeType), true, true);
}
@@ -1048,7 +1047,7 @@ public static String trimTags (String input, Class<?> nodeType)
* @see ParserUtils#trimTags (String input, String[] tags, boolean recursive, boolean insideTag).
*/
public static String trimTags (String input, Class<?> nodeType, boolean recursive, boolean insideTag)
- throws ParserException, UnsupportedEncodingException
+ throws ParserException
{
return trimTags (input, new NodeClassFilter (nodeType), recursive, insideTag);
}
@@ -1062,7 +1061,7 @@ public static String trimTags (String input, Class<?> nodeType, boolean recursiv
* @see ParserUtils#trimTags (String input, String[] tags, boolean recursive, boolean insideTag).
*/
public static String trimTags (String input, NodeFilter filter)
- throws ParserException, UnsupportedEncodingException
+ throws ParserException
{
return trimTags (input, filter, true, true);
}
@@ -1076,7 +1075,7 @@ public static String trimTags (String input, NodeFilter filter)
* @see ParserUtils#trimTags (String input, String[] tags, boolean recursive, boolean insideTag).
*/
public static String trimTags (String input, NodeFilter filter, boolean recursive, boolean insideTag)
- throws ParserException, UnsupportedEncodingException
+ throws ParserException
{
StringBuffer output = new StringBuffer();
@@ -1133,7 +1132,6 @@ public static String trimTags (String input, NodeFilter filter, boolean recursiv
* @return The Parser Object with the string as input stream.
*/
public static Parser createParserParsingAnInputString (String input)
- throws ParserException, UnsupportedEncodingException
{
Parser parser = new Parser();
@@ -1147,7 +1145,7 @@ public static Parser createParserParsingAnInputString (String input)
}
private static NodeList getLinks (String output, String tag, boolean recursive)
- throws ParserException, UnsupportedEncodingException
+ throws ParserException
{
Parser parser = new Parser();
@@ -1188,7 +1186,7 @@ private static NodeList getLinks (String output, String tag, boolean recursive)
}
private static NodeList getLinks (String output, NodeFilter filter, boolean recursive)
- throws ParserException, UnsupportedEncodingException
+ throws ParserException
{
Parser parser = new Parser();
View
6 parser/src/test/java/org/htmlparser/tests/lexerTests/LexerTests.java
@@ -995,7 +995,8 @@ public void testDoubleAngle () throws ParserException
/**
* See bug: Creating a parser with an un-connectable HttpURLConnection - ID: 2899333
*/
- public void testUnConnectableURL_1() throws ParserException, MalformedURLException, IOException {
+ public void testUnConnectableURL_1() throws MalformedURLException, IOException
+ {
String url="http:/ifastnet.com/notify/2.php"; //notice the missing / in http://
HttpURLConnection urlCon = (HttpURLConnection) new
URL(url).openConnection();
@@ -1012,7 +1013,8 @@ public void testUnConnectableURL_1() throws ParserException, MalformedURLExcepti
/**
* See bug: Creating a parser with an un-connectable HttpURLConnection - ID: 2899333
*/
- public void testUnConnectableURL_2() throws ParserException, MalformedURLException, IOException {
+ public void testUnConnectableURL_2() throws MalformedURLException, IOException
+ {
String url="http:///ifastnet.com/notify/2.php"; //notice the extra / in http://
HttpURLConnection urlCon = (HttpURLConnection) new
URL(url).openConnection();
View
84 parser/src/test/java/org/htmlparser/tests/lexerTests/PageTests.java
@@ -164,93 +164,93 @@ public void testBadURLConnection () throws IOException
// ../../ = http://a/
// ../../g = http://a/g
- public void test1 () throws ParserException
+ public void test1 ()
{
assertEquals ("test1 failed", "https:h", mPage.getAbsoluteURL ("https:h"));
}
- public void test2 () throws ParserException
+ public void test2 ()
{
assertEquals ("test2 failed", "http://a/b/c/g", mPage.getAbsoluteURL ("g"));
}
- public void test3 () throws ParserException
+ public void test3 ()
{
assertEquals ("test3 failed", "http://a/b/c/g", mPage.getAbsoluteURL ("./g"));
}
- public void test4 () throws ParserException
+ public void test4 ()
{
assertEquals ("test4 failed", "http://a/b/c/g/", mPage.getAbsoluteURL ("g/"));
}
- public void test5 () throws ParserException
+ public void test5 ()
{
assertEquals ("test5 failed", "http://a/g", mPage.getAbsoluteURL ("/g"));
}
- public void test6 () throws ParserException
+ public void test6 ()
{
assertEquals ("test6 failed", "http://g", mPage.getAbsoluteURL ("//g"));
}
- public void test7 () throws ParserException
+ public void test7 ()
{
assertEquals ("test7 strict failed", "http://a/b/c/?y", mPage.getAbsoluteURL ("?y", true));
assertEquals ("test7 non-strict failed", "http://a/b/c/d;p?y", mPage.getAbsoluteURL ("?y"));
}
- public void test8 () throws ParserException
+ public void test8 ()
{
assertEquals ("test8 failed", "http://a/b/c/g?y", mPage.getAbsoluteURL ("g?y"));
}
- public void test9 () throws ParserException
+ public void test9 ()
{
assertEquals ("test9 failed", "https:h", mPage.getAbsoluteURL ("https:h"));
}
- public void test10 () throws ParserException
+ public void test10 ()
{
assertEquals ("test10 failed", "https:h", mPage.getAbsoluteURL ("https:h"));
}
// #s = (current document)#s
- public void test11 () throws ParserException
+ public void test11 ()
{
assertEquals ("test11 failed", "http://a/b/c/g#s", mPage.getAbsoluteURL ("g#s"));
}
- public void test12 () throws ParserException
+ public void test12 ()
{
assertEquals ("test12 failed", "http://a/b/c/g?y#s", mPage.getAbsoluteURL ("g?y#s"));
}
- public void test13 () throws ParserException
+ public void test13 ()
{
assertEquals ("test13 failed", "http://a/b/c/;x", mPage.getAbsoluteURL (";x"));
}
- public void test14 () throws ParserException
+ public void test14 ()
{
assertEquals ("test14 failed", "http://a/b/c/g;x", mPage.getAbsoluteURL ("g;x"));
}
- public void test15 () throws ParserException
+ public void test15 ()
{
assertEquals ("test15 failed", "http://a/b/c/g;x?y#s", mPage.getAbsoluteURL ("g;x?y#s"));
}
- public void test16 () throws ParserException
+ public void test16 ()
{
assertEquals ("test16 failed", "http://a/b/c/", mPage.getAbsoluteURL ("."));
}
- public void test17 () throws ParserException
+ public void test17 ()
{
assertEquals ("test17 failed", "http://a/b/c/", mPage.getAbsoluteURL ("./"));
}
- public void test18 () throws ParserException
+ public void test18 ()
{
assertEquals ("test18 failed", "http://a/b/", mPage.getAbsoluteURL (".."));
}
- public void test19 () throws ParserException
+ public void test19 ()
{
assertEquals ("test19 failed", "http://a/b/", mPage.getAbsoluteURL ("../"));
}
- public void test20 () throws ParserException
+ public void test20 ()
{
assertEquals ("test20 failed", "http://a/b/g", mPage.getAbsoluteURL ("../g"));
}
- public void test21 () throws ParserException
+ public void test21 ()
{
assertEquals ("test21 failed", "http://a/", mPage.getAbsoluteURL ("../.."));
}
- public void test22 () throws ParserException
+ public void test22 ()
{
assertEquals ("test22 failed", "http://a/g", mPage.getAbsoluteURL ("../../g"));
}
@@ -327,83 +327,83 @@ public void test22 () throws ParserException
// {
// assertEquals ("test24 failed", "http://a/../../g", mPage.getAbsoluteURL ("../../../../g"));
// }
- public void test23 () throws ParserException
+ public void test23 ()
{
assertEquals ("test23 failed", "http://a/g", mPage.getAbsoluteURL ("../../../g"));
}
- public void test24 () throws ParserException
+ public void test24 ()
{
assertEquals ("test24 failed", "http://a/g", mPage.getAbsoluteURL ("../../../../g"));
}
- public void test25 () throws ParserException
+ public void test25 ()
{
assertEquals ("test25 failed", "http://a/./g", mPage.getAbsoluteURL ("/./g"));
}
- public void test26 () throws ParserException
+ public void test26 ()
{
assertEquals ("test26 failed", "http://a/../g", mPage.getAbsoluteURL ("/../g"));
}
- public void test27 () throws ParserException
+ public void test27 ()
{
assertEquals ("test27 failed", "http://a/b/c/g.", mPage.getAbsoluteURL ("g."));
}
- public void test28 () throws ParserException
+ public void test28 ()
{
assertEquals ("test28 failed", "http://a/b/c/.g", mPage.getAbsoluteURL (".g"));
}
- public void test29 () throws ParserException
+ public void test29 ()
{
assertEquals ("test29 failed", "http://a/b/c/g..", mPage.getAbsoluteURL ("g.."));
}
- public void test30 () throws ParserException
+ public void test30 ()
{
assertEquals ("test30 failed", "http://a/b/c/..g", mPage.getAbsoluteURL ("..g"));
}
- public void test31 () throws ParserException
+ public void test31 ()
{
assertEquals ("test31 failed", "http://a/b/g", mPage.getAbsoluteURL ("./../g"));
}
- public void test32 () throws ParserException
+ public void test32 ()
{
assertEquals ("test32 failed", "http://a/b/c/g/", mPage.getAbsoluteURL ("./g/."));
}
- public void test33 () throws ParserException
+ public void test33 ()
{
assertEquals ("test33 failed", "http://a/b/c/g/h", mPage.getAbsoluteURL ("g/./h"));
}
- public void test34 () throws ParserException
+ public void test34 ()
{
assertEquals ("test34 failed", "http://a/b/c/h", mPage.getAbsoluteURL ("g/../h"));
}
- public void test35 () throws ParserException
+ public void test35 ()
{
assertEquals ("test35 failed", "http://a/b/c/g;x=1/y", mPage.getAbsoluteURL ("g;x=1/./y"));
}
- public void test36 () throws ParserException
+ public void test36 ()
{
assertEquals ("test36 failed", "http://a/b/c/y", mPage.getAbsoluteURL ("g;x=1/../y"));
}
- public void test37 () throws ParserException
+ public void test37 ()
{
assertEquals ("test37 failed", "http://a/b/c/g?y/./x", mPage.getAbsoluteURL ("g?y/./x"));
}
- public void test38 () throws ParserException
+ public void test38 ()
{
assertEquals ("test38 failed", "http://a/b/c/g?y/../x", mPage.getAbsoluteURL ("g?y/../x"));
}
- public void test39 () throws ParserException
+ public void test39 ()
{
assertEquals ("test39 failed", "http://a/b/c/g#s/./x", mPage.getAbsoluteURL ("g#s/./x"));
}
- public void test40 () throws ParserException
+ public void test40 ()
{
assertEquals ("test40 failed", "http://a/b/c/g#s/../x", mPage.getAbsoluteURL ("g#s/../x"));
}
-// public void test41 () throws HTMLParserException
+// public void test41 ()
// {
// assertEquals ("test41 failed", "http:g", mPage.getAbsoluteURL ("http:g"));
// }
- public void test41 () throws ParserException
+ public void test41 ()
{
assertEquals ("test41 failed", "http://a/b/c/g", mPage.getAbsoluteURL ("http:g"));
}
View
6 parser/src/test/java/org/htmlparser/tests/tagTests/BodyTagTest.java
@@ -62,12 +62,14 @@ protected void setUp() throws Exception {
bodyTag = (BodyTag)html.getChild(1);
}
- public void testToPlainTextString() throws ParserException {
+ public void testToPlainTextString()
+ {
// check the label node
assertEquals("Body","Yahoo!",bodyTag.toPlainTextString());
}
- public void testToHTML() throws ParserException {
+ public void testToHTML()
+ {
assertStringEquals("Raw String", html, bodyTag.toHtml());
}
View
4 parser/src/test/java/org/htmlparser/tests/tagTests/OptionTagTest.java
@@ -76,7 +76,7 @@ protected void setUp() throws Exception {
parseAndAssertNodeCount(13);
}
- public void testToHTML() throws ParserException
+ public void testToHTML()
{
for(int j=0;j<nodeCount;j++)
{
@@ -113,7 +113,7 @@ public void testToHTML() throws ParserException
assertStringEquals("HTML String", option13, OptionTag.toHtml());
}
- public void testToString() throws ParserException
+ public void testToString ()
{
for(int j=0;j<11;j++)
{
View
2 parser/src/test/java/org/htmlparser/tests/tagTests/SelectTagTest.java
@@ -83,7 +83,7 @@ protected void setUp() throws Exception{
selectTag = (SelectTag) node[0];
}
- public void testToHTML() throws ParserException
+ public void testToHTML()
{
assertStringEquals("HTML String", correctedHTML, selectTag.toHtml());
}
View
2 parser/src/test/java/org/htmlparser/tests/tagTests/TextareaTagTest.java
@@ -66,7 +66,7 @@ public void setUp() throws Exception
parseAndAssertNodeCount(5);
}
- public void testToHTML() throws ParserException
+ public void testToHTML()
{
assertTrue("Node 1 should be Textarea Tag",node[0] instanceof TextareaTag);
assertTrue("Node 2 should be Textarea Tag",node[1] instanceof TextareaTag);
View
9 parser/src/test/java/org/htmlparser/tests/tagTests/TitleTagTest.java
@@ -67,16 +67,19 @@ protected void setUp() throws Exception {
assertTrue("First child should be a title tag",head.getChild(0) instanceof TitleTag);
titleTag = (TitleTag)head.getChild(0);
}
- public void testToPlainTextString() throws ParserException {
+ public void testToPlainTextString ()
+ {
// check the title node
assertEquals("Title","Yahoo!",titleTag.toPlainTextString());
}
- public void testToHTML() throws ParserException {
+ public void testToHTML ()
+ {
assertStringEquals("Raw String",tag1,titleTag.toHtml());
}
- public void testToString() throws ParserException {
+ public void testToString ()
+ {
assertEquals("Title","TITLE: Yahoo!",titleTag.toString());
}
View
17 parser/src/test/java/org/htmlparser/tests/utilTests/BeanTest.java
@@ -131,8 +131,7 @@ protected void check (StringBean bean, String html, String text)
public void testZeroArgPageConstructor ()
throws
IOException,
- ClassNotFoundException,
- ParserException
+ ClassNotFoundException
{
Page page;
byte[] data;
@@ -145,8 +144,7 @@ public void testZeroArgPageConstructor ()
public void testZeroArgLexerConstructor ()
throws
IOException,
- ClassNotFoundException,
- ParserException
+ ClassNotFoundException
{
Lexer lexer;
byte[] data;
@@ -159,9 +157,8 @@ public void testZeroArgLexerConstructor ()
public void testZeroArgParserConstructor ()
throws
IOException,
- ClassNotFoundException,
- ParserException
- {
+ ClassNotFoundException
+{
Parser parser;
byte[] data;
@@ -229,8 +226,7 @@ public void testSerializableScanners ()
public void testSerializableStringBean ()
throws
IOException,
- ClassNotFoundException,
- ParserException
+ ClassNotFoundException
{
StringBean sb;
String text;
@@ -252,8 +248,7 @@ public void testSerializableStringBean ()
public void testSerializableLinkBean ()
throws
IOException,
- ClassNotFoundException,
- ParserException
+ ClassNotFoundException
{
LinkBean lb;
URL[] links;
View
3 parser/src/test/java/org/htmlparser/tests/utilTests/NonEnglishTest.java
@@ -27,7 +27,6 @@
import org.htmlparser.beans.StringBean;
import org.htmlparser.tests.ParserTestCase;
-import org.htmlparser.util.ParserException;
/**
* Test case for bug #1161137 Non English Character web page.
@@ -45,7 +44,7 @@ public NonEnglishTest (String name)
super(name);
}
- public void testNonEnglishCharacters() throws ParserException
+ public void testNonEnglishCharacters ()
{
StringBean sb;
View
1 pom.xml
@@ -263,7 +263,6 @@
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
- <version>2.2</version>
<inherited>false</inherited>
<configuration>
<descriptors>

0 comments on commit 6c449e7

Please sign in to comment.