Permalink
Browse files

switch to generics and version 1.5 compile

  • Loading branch information...
1 parent df8a59a commit ec7de94fe5ac759bed9778ff944d564dfa420d1a derrickoswald committed Apr 25, 2011
Showing with 978 additions and 446 deletions.
  1. +9 −4 filterbuilder/src/main/java/org/htmlparser/parserapplications/filterbuilder/Filter.java
  2. +8 −3 filterbuilder/src/main/java/org/htmlparser/parserapplications/filterbuilder/FilterBuilder.java
  3. +8 −5 ...erbuilder/src/main/java/org/htmlparser/parserapplications/filterbuilder/HtmlTreeCellRenderer.java
  4. +5 −4 filterbuilder/src/main/java/org/htmlparser/parserapplications/filterbuilder/HtmlTreeModel.java
  5. +5 −0 filterbuilder/src/main/java/org/htmlparser/parserapplications/filterbuilder/SubFilterList.java
  6. +5 −0 ...lder/src/main/java/org/htmlparser/parserapplications/filterbuilder/layouts/NullLayoutManager.java
  7. +5 −0 .../src/main/java/org/htmlparser/parserapplications/filterbuilder/layouts/VerticalLayoutManager.java
  8. +5 −0 ...lder/src/main/java/org/htmlparser/parserapplications/filterbuilder/wrappers/AndFilterWrapper.java
  9. +12 −7 ...main/java/org/htmlparser/parserapplications/filterbuilder/wrappers/HasAttributeFilterWrapper.java
  10. +5 −0 ...src/main/java/org/htmlparser/parserapplications/filterbuilder/wrappers/HasChildFilterWrapper.java
  11. +5 −0 ...rc/main/java/org/htmlparser/parserapplications/filterbuilder/wrappers/HasParentFilterWrapper.java
  12. +5 −0 ...c/main/java/org/htmlparser/parserapplications/filterbuilder/wrappers/HasSiblingFilterWrapper.java
  13. +8 −3 ...rc/main/java/org/htmlparser/parserapplications/filterbuilder/wrappers/NodeClassFilterWrapper.java
  14. +5 −0 ...lder/src/main/java/org/htmlparser/parserapplications/filterbuilder/wrappers/NotFilterWrapper.java
  15. +5 −0 ...ilder/src/main/java/org/htmlparser/parserapplications/filterbuilder/wrappers/OrFilterWrapper.java
  16. +5 −0 ...er/src/main/java/org/htmlparser/parserapplications/filterbuilder/wrappers/RegexFilterWrapper.java
  17. +5 −0 ...r/src/main/java/org/htmlparser/parserapplications/filterbuilder/wrappers/StringFilterWrapper.java
  18. +9 −4 .../src/main/java/org/htmlparser/parserapplications/filterbuilder/wrappers/TagNameFilterWrapper.java
  19. +5 −0 lexer/src/main/java/org/htmlparser/Attribute.java
  20. +1 −1 lexer/src/main/java/org/htmlparser/NodeFactory.java
  21. +2 −3 lexer/src/main/java/org/htmlparser/Tag.java
  22. +32 −32 lexer/src/main/java/org/htmlparser/http/ConnectionManager.java
  23. +5 −0 lexer/src/main/java/org/htmlparser/http/Cookie.java
  24. +5 −0 lexer/src/main/java/org/htmlparser/lexer/Cursor.java
  25. +5 −0 lexer/src/main/java/org/htmlparser/lexer/InputStreamSource.java
  26. +20 −14 lexer/src/main/java/org/htmlparser/lexer/Lexer.java
  27. +8 −3 lexer/src/main/java/org/htmlparser/lexer/Page.java
  28. +5 −0 lexer/src/main/java/org/htmlparser/lexer/PageAttribute.java
  29. +5 −0 lexer/src/main/java/org/htmlparser/lexer/PageIndex.java
  30. +4 −0 lexer/src/main/java/org/htmlparser/lexer/Source.java
  31. +5 −0 lexer/src/main/java/org/htmlparser/lexer/StringSource.java
  32. +5 −0 lexer/src/main/java/org/htmlparser/nodes/AbstractNode.java
  33. +4 −0 lexer/src/main/java/org/htmlparser/nodes/RemarkNode.java
  34. +31 −27 lexer/src/main/java/org/htmlparser/nodes/TagNode.java
  35. +4 −0 lexer/src/main/java/org/htmlparser/nodes/TextNode.java
  36. +5 −0 lexer/src/main/java/org/htmlparser/scanners/TagScanner.java
  37. +9 −5 lexer/src/main/java/org/htmlparser/util/ChainedException.java
  38. +5 −0 lexer/src/main/java/org/htmlparser/util/EncodingChangeException.java
  39. +5 −5 lexer/src/main/java/org/htmlparser/util/NodeList.java
  40. +6 −1 lexer/src/main/java/org/htmlparser/util/ParserException.java
  41. +7 −7 lexer/src/main/java/org/htmlparser/util/sort/Sort.java
  42. +7 −3 parser/src/main/java/org/htmlparser/Parser.java
  43. +14 −9 parser/src/main/java/org/htmlparser/PrototypicalNodeFactory.java
  44. +9 −4 parser/src/main/java/org/htmlparser/beans/BeanyBaby.java
  45. +5 −0 parser/src/main/java/org/htmlparser/beans/FilterBean.java
  46. +4 −0 parser/src/main/java/org/htmlparser/beans/HTMLLinkBean.java
  47. +4 −0 parser/src/main/java/org/htmlparser/beans/HTMLTextBean.java
  48. +7 −2 parser/src/main/java/org/htmlparser/beans/LinkBean.java
  49. +5 −0 parser/src/main/java/org/htmlparser/beans/StringBean.java
  50. +4 −0 parser/src/main/java/org/htmlparser/filters/AndFilter.java
  51. +26 −4 parser/src/main/java/org/htmlparser/filters/CssSelectorNodeFilter.java
  52. +5 −0 parser/src/main/java/org/htmlparser/filters/HasAttributeFilter.java
  53. +5 −0 parser/src/main/java/org/htmlparser/filters/HasChildFilter.java
  54. +5 −0 parser/src/main/java/org/htmlparser/filters/HasParentFilter.java
  55. +4 −0 parser/src/main/java/org/htmlparser/filters/HasSiblingFilter.java
  56. +4 −0 parser/src/main/java/org/htmlparser/filters/IsEqualFilter.java
  57. +4 −0 parser/src/main/java/org/htmlparser/filters/LinkRegexFilter.java
  58. +5 −0 parser/src/main/java/org/htmlparser/filters/LinkStringFilter.java
  59. +8 −4 parser/src/main/java/org/htmlparser/filters/NodeClassFilter.java
  60. +4 −0 parser/src/main/java/org/htmlparser/filters/NotFilter.java
  61. +4 −0 parser/src/main/java/org/htmlparser/filters/OrFilter.java
  62. +5 −0 parser/src/main/java/org/htmlparser/filters/RegexFilter.java
  63. +5 −0 parser/src/main/java/org/htmlparser/filters/StringFilter.java
  64. +4 −0 parser/src/main/java/org/htmlparser/filters/TagNameFilter.java
  65. +5 −5 parser/src/main/java/org/htmlparser/http/HttpHeader.java
  66. +9 −9 parser/src/main/java/org/htmlparser/sax/Attributes.java
  67. +8 −5 parser/src/main/java/org/htmlparser/scanners/CompositeTagScanner.java
  68. +5 −0 parser/src/main/java/org/htmlparser/scanners/JspScanner.java
  69. +6 −8 parser/src/main/java/org/htmlparser/scanners/ScriptScanner.java
  70. +7 −6 parser/src/main/java/org/htmlparser/scanners/StyleScanner.java
  71. +22 −17 parser/src/main/java/org/htmlparser/tags/AppletTag.java
  72. +4 −0 parser/src/main/java/org/htmlparser/tags/BaseHrefTag.java
  73. +5 −0 parser/src/main/java/org/htmlparser/tags/BlockquoteTag.java
  74. +5 −0 parser/src/main/java/org/htmlparser/tags/BodyTag.java
  75. +5 −0 parser/src/main/java/org/htmlparser/tags/Bullet.java
  76. +5 −0 parser/src/main/java/org/htmlparser/tags/BulletList.java
  77. +6 −1 parser/src/main/java/org/htmlparser/tags/CompositeTag.java
  78. +5 −0 parser/src/main/java/org/htmlparser/tags/DefinitionList.java
  79. +5 −0 parser/src/main/java/org/htmlparser/tags/DefinitionListBullet.java
  80. +5 −0 parser/src/main/java/org/htmlparser/tags/Div.java
  81. +4 −0 parser/src/main/java/org/htmlparser/tags/DoctypeTag.java
  82. +5 −0 parser/src/main/java/org/htmlparser/tags/FormTag.java
  83. +5 −0 parser/src/main/java/org/htmlparser/tags/FrameSetTag.java
  84. +4 −0 parser/src/main/java/org/htmlparser/tags/FrameTag.java
  85. +5 −0 parser/src/main/java/org/htmlparser/tags/HeadTag.java
  86. +5 −0 parser/src/main/java/org/htmlparser/tags/HeadingTag.java
  87. +4 −0 parser/src/main/java/org/htmlparser/tags/Html.java
  88. +7 −2 parser/src/main/java/org/htmlparser/tags/ImageTag.java
  89. +4 −0 parser/src/main/java/org/htmlparser/tags/InputTag.java
  90. +4 −0 parser/src/main/java/org/htmlparser/tags/JspTag.java
  91. +4 −0 parser/src/main/java/org/htmlparser/tags/LabelTag.java
  92. +5 −0 parser/src/main/java/org/htmlparser/tags/LinkTag.java
  93. +4 −0 parser/src/main/java/org/htmlparser/tags/MetaTag.java
  94. +21 −16 parser/src/main/java/org/htmlparser/tags/ObjectTag.java
  95. +5 −0 parser/src/main/java/org/htmlparser/tags/OptionTag.java
  96. +5 −0 parser/src/main/java/org/htmlparser/tags/ParagraphTag.java
  97. +4 −0 parser/src/main/java/org/htmlparser/tags/ProcessingInstructionTag.java
  98. +5 −0 parser/src/main/java/org/htmlparser/tags/ScriptTag.java
  99. +5 −0 parser/src/main/java/org/htmlparser/tags/SelectTag.java
  100. +4 −0 parser/src/main/java/org/htmlparser/tags/Span.java
  101. +5 −0 parser/src/main/java/org/htmlparser/tags/StyleTag.java
  102. +5 −0 parser/src/main/java/org/htmlparser/tags/TableColumn.java
  103. +5 −0 parser/src/main/java/org/htmlparser/tags/TableHeader.java
  104. +5 −0 parser/src/main/java/org/htmlparser/tags/TableRow.java
  105. +5 −0 parser/src/main/java/org/htmlparser/tags/TableTag.java
  106. +5 −0 parser/src/main/java/org/htmlparser/tags/TextareaTag.java
  107. +5 −0 parser/src/main/java/org/htmlparser/tags/TitleTag.java
  108. +5 −0 parser/src/main/java/org/htmlparser/util/CharacterReference.java
  109. +5 −0 parser/src/main/java/org/htmlparser/util/DefaultParserFeedback.java
  110. +12 −12 parser/src/main/java/org/htmlparser/util/ParserUtils.java
  111. +7 −1 parser/src/main/java/org/htmlparser/util/Translate.java
  112. +3 −3 parser/src/main/java/org/htmlparser/visitors/ObjectFindingVisitor.java
  113. +3 −3 parser/src/test/java/org/htmlparser/tests/InstanceofPerformanceTest.java
  114. +1 −3 parser/src/test/java/org/htmlparser/tests/ParserTest.java
  115. +17 −17 parser/src/test/java/org/htmlparser/tests/ParserTestCase.java
  116. +66 −66 parser/src/test/java/org/htmlparser/tests/lexerTests/AttributeTests.java
  117. +6 −5 parser/src/test/java/org/htmlparser/tests/lexerTests/LexerTests.java
  118. +8 −8 parser/src/test/java/org/htmlparser/tests/lexerTests/StreamTests.java
  119. +0 −1 parser/src/test/java/org/htmlparser/tests/lexerTests/TagTests.java
  120. +20 −2 parser/src/test/java/org/htmlparser/tests/scannersTests/CompositeTagScannerTest.java
  121. +0 −2 parser/src/test/java/org/htmlparser/tests/scannersTests/ScriptScannerTest.java
  122. +15 −15 parser/src/test/java/org/htmlparser/tests/tagTests/AppletTagTest.java
  123. +3 −3 parser/src/test/java/org/htmlparser/tests/tagTests/BaseHrefTagTest.java
  124. +0 −1 parser/src/test/java/org/htmlparser/tests/tagTests/BodyTagTest.java
  125. +0 −4 parser/src/test/java/org/htmlparser/tests/tagTests/InputTagTest.java
  126. +0 −2 parser/src/test/java/org/htmlparser/tests/tagTests/LabelTagTest.java
  127. +3 −5 parser/src/test/java/org/htmlparser/tests/tagTests/TagTest.java
  128. +6 −6 parser/src/test/java/org/htmlparser/tests/utilTests/BeanTest.java
  129. +6 −1 parser/src/test/java/org/htmlparser/tests/utilTests/NodeListTest.java
  130. +17 −9 parser/src/test/java/org/htmlparser/tests/utilTests/SortTest.java
  131. +2 −2 parser/src/test/java/org/htmlparser/tests/visitorsTests/NodeVisitorTest.java
  132. +10 −1 pom.xml
  133. +34 −14 sitecapturer/src/main/java/org/htmlparser/parserapplications/SiteCapturer.java
  134. +5 −4 thumbelina/src/main/java/org/htmlparser/lexerapplications/thumbelina/Picture.java
  135. +8 −5 thumbelina/src/main/java/org/htmlparser/lexerapplications/thumbelina/PicturePanel.java
  136. +3 −11 thumbelina/src/main/java/org/htmlparser/lexerapplications/thumbelina/Sequencer.java
  137. +8 −15 thumbelina/src/main/java/org/htmlparser/lexerapplications/thumbelina/Thumbelina.java
  138. +5 −0 thumbelina/src/main/java/org/htmlparser/lexerapplications/thumbelina/ThumbelinaFrame.java
  139. +5 −2 thumbelina/src/main/java/org/htmlparser/lexerapplications/thumbelina/TileSet.java
View
13 filterbuilder/src/main/java/org/htmlparser/parserapplications/filterbuilder/Filter.java
@@ -52,6 +52,11 @@
NodeFilter
{
/**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
* Create a new filter from the class name.
* @param class_name The class to instatiate.
* @return The constructed filter object.
@@ -63,7 +68,7 @@ public static Filter instantiate (String class_name)
ret = null;
try
{
- Class cls = Class.forName (class_name);
+ Class<?> cls = Class.forName (class_name);
ret = (Filter)cls.newInstance ();
mWrappers.put (ret.getNodeFilter ().getClass ().getName (), class_name);
}
@@ -91,7 +96,7 @@ public static Filter instantiate (String class_name)
* Map from cilter class to wrapper.
* Populated as part of each wrapper being loaded.
*/
- protected static Hashtable mWrappers = new Hashtable ();
+ protected static Hashtable<String,String> mWrappers = new Hashtable<String,String> ();
/**
* Line separator string.
@@ -342,13 +347,13 @@ public static String deconstitute (Filter[] filters) throws IOException
public static Filter[] reconstitute (String string, Parser context)
{
Filter[] ret;
- Vector vector;
+ Vector<Filter> vector;
int index;
String code;
Object object;
Filter filter;
- vector = new Vector ();
+ vector = new Vector<Filter> ();
try
{
while (string.startsWith ("["))
View
11 ...rbuilder/src/main/java/org/htmlparser/parserapplications/filterbuilder/FilterBuilder.java
@@ -136,7 +136,12 @@
DropTargetListener,
ClipboardOwner
{
- static final String TITLE = "HTML Parser FilterBuilder";
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ static final String TITLE = "HTML Parser FilterBuilder";
static final URL mDocumentBase;
@@ -197,7 +202,7 @@
/**
* Selected commands.
*/
- protected Vector mSelection;
+ protected Vector<Filter> mSelection;
/**
* If true selection moved.
@@ -430,7 +435,7 @@ public FilterBuilder ()
addMouseMotionListener (this);
// clipboard buffer
- mSelection = new Vector ();
+ mSelection = new Vector<Filter> ();
}
/**
View
13 ...r/src/main/java/org/htmlparser/parserapplications/filterbuilder/HtmlTreeCellRenderer.java
@@ -34,10 +34,8 @@
import org.htmlparser.Attribute;
import org.htmlparser.Node;
-import org.htmlparser.lexer.Cursor;
import org.htmlparser.nodes.TagNode;
import org.htmlparser.nodes.TextNode;
-import org.htmlparser.util.ParserException;
import org.htmlparser.util.Translate;
/**
@@ -50,6 +48,11 @@
TreeCellRenderer
{
/**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
* Create a new tree cell renderer for Nodes.
*/
public HtmlTreeCellRenderer ()
@@ -72,7 +75,7 @@ public String toHtml (TagNode tag)
{
int length;
int size;
- Vector attributes;
+ Vector<Attribute> attributes;
Attribute attribute;
String s;
boolean children;
@@ -83,14 +86,14 @@ public String toHtml (TagNode tag)
size = attributes.size ();
for (int i = 0; i < size; i++)
{
- attribute = (Attribute)attributes.elementAt (i);
+ attribute = attributes.elementAt (i);
length += attribute.getLength ();
}
ret = new StringBuffer (length);
ret.append ("<");
for (int i = 0; i < size; i++)
{
- attribute = (Attribute)attributes.elementAt (i);
+ attribute = attributes.elementAt (i);
attribute.toString (ret);
}
ret.append (">");
View
9 ...rbuilder/src/main/java/org/htmlparser/parserapplications/filterbuilder/HtmlTreeModel.java
@@ -42,7 +42,7 @@
/**
* The list of tree listeners.
*/
- protected Vector mTreeListeners;
+ protected Vector<TreeModelListener> mTreeListeners;
/**
* The root {@link Node}.
@@ -59,7 +59,7 @@
*/
public HtmlTreeModel (NodeList root)
{
- mTreeListeners = new Vector ();
+ mTreeListeners = new Vector<TreeModelListener> ();
// for simplicity we encapsulate the nodelist in a Html tag
mRoot = new Html ();
mRoot.setChildren (root);
@@ -207,15 +207,16 @@ public boolean isLeaf (Object node)
* @param path {@inheritDoc}
* @param newValue {@inheritDoc}
*/
+ @SuppressWarnings("unchecked")
public void valueForPathChanged (TreePath path, Object newValue)
{
TreeModelEvent event;
- Vector v;
+ Vector<TreeModelListener> v;
event = new TreeModelEvent (this, path);
synchronized (mTreeListeners)
{
- v = (Vector)mTreeListeners.clone ();
+ v = (Vector<TreeModelListener>)(mTreeListeners.clone ());
}
for (int i = 0; i < v.size (); i++)
View
5 ...rbuilder/src/main/java/org/htmlparser/parserapplications/filterbuilder/SubFilterList.java
@@ -41,6 +41,11 @@
JPanel
{
/**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
* Padding for the drop target.
*/
protected int mExtra = 25; // for now
View
5 .../main/java/org/htmlparser/parserapplications/filterbuilder/layouts/NullLayoutManager.java
@@ -39,6 +39,11 @@
Serializable
{
/**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
* Constructs a NullLayoutManager object.
*/
public NullLayoutManager ()
View
5 ...n/java/org/htmlparser/parserapplications/filterbuilder/layouts/VerticalLayoutManager.java
@@ -40,6 +40,11 @@
Serializable
{
/**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
* Constructs a VerticalLayoutManager object.
*/
public VerticalLayoutManager ()
View
5 .../main/java/org/htmlparser/parserapplications/filterbuilder/wrappers/AndFilterWrapper.java
@@ -40,6 +40,11 @@
Filter
{
/**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
* The drop target container.
*/
protected SubFilterList mContainer;
View
19 ...a/org/htmlparser/parserapplications/filterbuilder/wrappers/HasAttributeFilterWrapper.java
@@ -64,6 +64,11 @@
DocumentListener
{
/**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
* The underlying filter.
*/
protected HasAttributeFilter mFilter;
@@ -126,9 +131,9 @@ public HasAttributeFilterWrapper ()
* @param set The set to add to.
* @param node The node with attributes to add.
*/
- protected void addAttributes (Set set, Node node)
+ protected void addAttributes (Set<String> set, Node node)
{
- Vector attributes;
+ Vector<Attribute> attributes;
Attribute attribute;
String name;
NodeList children;
@@ -158,9 +163,9 @@ protected void addAttributes (Set set, Node node)
* @param set The set to add to.
* @param node The node with attributes to add.
*/
- protected void addAttributeValues (Set set, Node node)
+ protected void addAttributeValues (Set<String> set, Node node)
{
- Vector attributes;
+ Vector<Attribute> attributes;
Attribute attribute;
String value;
NodeList children;
@@ -235,12 +240,12 @@ public NodeFilter getNodeFilter ()
*/
public void setNodeFilter (NodeFilter filter, Parser context)
{
- Set set;
+ Set<String> set;
String name;
String value;
mFilter = (HasAttributeFilter)filter;
- set = new HashSet ();
+ set = new HashSet<String> ();
context.reset ();
try
{
@@ -251,7 +256,7 @@ public void setNodeFilter (NodeFilter filter, Parser context)
{
// oh well, we tried
}
- for (Iterator iterator = set.iterator (); iterator.hasNext (); )
+ for (Iterator<String> iterator = set.iterator (); iterator.hasNext (); )
mAttributeName.addItem (iterator.next ());
name = mFilter.getAttributeName ();
if (!name.equals (""))
View
5 .../java/org/htmlparser/parserapplications/filterbuilder/wrappers/HasChildFilterWrapper.java
@@ -47,6 +47,11 @@
ActionListener
{
/**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
* The underlying filter.
*/
protected HasChildFilter mFilter;
View
5 ...java/org/htmlparser/parserapplications/filterbuilder/wrappers/HasParentFilterWrapper.java
@@ -47,6 +47,11 @@
ActionListener
{
/**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
* The underlying filter.
*/
protected HasParentFilter mFilter;
View
5 ...ava/org/htmlparser/parserapplications/filterbuilder/wrappers/HasSiblingFilterWrapper.java
@@ -45,6 +45,11 @@
ActionListener
{
/**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
* The underlying filter.
*/
protected HasSiblingFilter mFilter;
View
11 ...java/org/htmlparser/parserapplications/filterbuilder/wrappers/NodeClassFilterWrapper.java
@@ -57,6 +57,11 @@
// DocumentListener
{
/**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
* The underlying filter.
*/
protected NodeClassFilter mFilter;
@@ -128,7 +133,7 @@ public void setNodeFilter (NodeFilter filter, Parser context)
{
NodeFactory factory;
PrototypicalNodeFactory proto;
- Set names;
+ Set<String> names;
String name;
Tag tag;
@@ -140,9 +145,9 @@ public void setNodeFilter (NodeFilter filter, Parser context)
proto = (PrototypicalNodeFactory)factory;
// iterate over the classes
names = proto.getTagNames ();
- for (Iterator iterator = names.iterator (); iterator.hasNext (); )
+ for (Iterator<String> iterator = names.iterator (); iterator.hasNext (); )
{
- name = (String)iterator.next ();
+ name = iterator.next ();
tag = proto.get (name);
mClass.addItem (tag.getClass ().getName ());
}
View
5 .../main/java/org/htmlparser/parserapplications/filterbuilder/wrappers/NotFilterWrapper.java
@@ -40,6 +40,11 @@
Filter
{
/**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
* The drop target container.
*/
protected SubFilterList mContainer;
View
5 ...c/main/java/org/htmlparser/parserapplications/filterbuilder/wrappers/OrFilterWrapper.java
@@ -40,6 +40,11 @@
Filter
{
/**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
* The drop target container.
*/
protected SubFilterList mContainer;
View
5 ...ain/java/org/htmlparser/parserapplications/filterbuilder/wrappers/RegexFilterWrapper.java
@@ -53,6 +53,11 @@
DocumentListener
{
/**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
* Mapping for RegexFilter constants to strings.
*/
public static Object[][] mMap;
View
5 ...in/java/org/htmlparser/parserapplications/filterbuilder/wrappers/StringFilterWrapper.java
@@ -56,6 +56,11 @@
Runnable
{
/**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
* The underlying filter.
*/
protected StringFilter mFilter;
View
13 ...n/java/org/htmlparser/parserapplications/filterbuilder/wrappers/TagNameFilterWrapper.java
@@ -54,6 +54,11 @@
ActionListener
{
/**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
* The underlying filter.
*/
protected TagNameFilter mFilter;
@@ -124,10 +129,10 @@ public NodeFilter getNodeFilter ()
*/
public void setNodeFilter (NodeFilter filter, Parser context)
{
- Set set;
+ Set<String> set;
mFilter = (TagNameFilter)filter;
- set = new HashSet ();
+ set = new HashSet<String> ();
context.reset ();
try
{
@@ -138,7 +143,7 @@ public void setNodeFilter (NodeFilter filter, Parser context)
{
// oh well, we tried
}
- for (Iterator iterator = set.iterator (); iterator.hasNext (); )
+ for (Iterator<String> iterator = set.iterator (); iterator.hasNext (); )
mName.addItem (iterator.next ());
mName.setSelectedItem (mFilter.getName ());
}
@@ -196,7 +201,7 @@ public String toJavaCode (StringBuffer out, int[] context)
* @param set The set to add to.
* @param node The node to get the names from.
*/
- protected void addName (Set set, Node node)
+ protected void addName (Set<String> set, Node node)
{
NodeList children;
View
5 lexer/src/main/java/org/htmlparser/Attribute.java
@@ -212,6 +212,11 @@
Serializable
{
/**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
* The name of this attribute.
* The part before the equals sign, or the stand-alone attribute.
* This will be <code>null</code> if the attribute is whitespace.
View
2 lexer/src/main/java/org/htmlparser/NodeFactory.java
@@ -87,7 +87,7 @@ Remark createRemarkNode (Page page, int start, int end)
* when creating the node.
* @return A tag node comprising the indicated characters from the page.
*/
- Tag createTagNode (Page page, int start, int end, Vector attributes)
+ Tag createTagNode (Page page, int start, int end, Vector<Attribute> attributes)
throws
ParserException;
}
View
5 lexer/src/main/java/org/htmlparser/Tag.java
@@ -25,7 +25,6 @@
package org.htmlparser;
-import java.util.Hashtable;
import java.util.Vector;
import org.htmlparser.scanners.Scanner;
@@ -94,7 +93,7 @@
* @return Returns the list of {@link Attribute Attributes} in the tag.
* @see #setAttributesEx
*/
- Vector getAttributesEx ();
+ Vector<Attribute> getAttributesEx ();
/**
* Sets the attributes.
@@ -104,7 +103,7 @@
* @param attribs The attribute collection to set.
* @see #getAttributesEx
*/
- void setAttributesEx (Vector attribs);
+ void setAttributesEx (Vector<Attribute> attribs);
/**
* Return the name of this tag.
View
64 lexer/src/main/java/org/htmlparser/http/ConnectionManager.java
@@ -53,7 +53,7 @@
* Default Request header fields.
* So far this is just "User-Agent" and "Accept-Encoding".
*/
- protected static Hashtable mDefaultRequestProperties = new Hashtable ();
+ protected static Hashtable<String,String> mDefaultRequestProperties = new Hashtable<String,String> ();
static
{
mDefaultRequestProperties.put ("User-Agent", "HTMLParser/"
@@ -106,7 +106,7 @@
/**
* Request header fields.
*/
- protected Hashtable mRequestProperties;
+ protected Hashtable<String,String> mRequestProperties;
/**
* The proxy server name.
@@ -142,7 +142,7 @@
* Cookie storage, a hashtable (by site or host) of vectors of Cookies.
* This will be null if cookie processing is disabled (default).
*/
- protected Hashtable mCookieJar;
+ protected Hashtable<String,Vector<Cookie>> mCookieJar;
/**
* The object to be notified prior to and after each connection.
@@ -172,7 +172,7 @@ public ConnectionManager ()
* Create a connection manager with the given connection properties.
* @param properties Name/value pairs to be added to the HTTP request.
*/
- public ConnectionManager (Hashtable properties)
+ public ConnectionManager (Hashtable<String,String> properties)
{
mRequestProperties = properties;
mProxyHost = null;
@@ -199,7 +199,7 @@ public ConnectionManager (Hashtable properties)
* @see #mDefaultRequestProperties
* @see #setRequestProperties
*/
- public static Hashtable getDefaultRequestProperties ()
+ public static Hashtable<String,String> getDefaultRequestProperties ()
{
return (mDefaultRequestProperties);
}
@@ -259,7 +259,7 @@ public static Hashtable getDefaultRequestProperties ()
* @see #mDefaultRequestProperties
* @see #setRequestProperties
*/
- public static void setDefaultRequestProperties (Hashtable properties)
+ public static void setDefaultRequestProperties (Hashtable<String,String> properties)
{
mDefaultRequestProperties = properties;
}
@@ -270,7 +270,7 @@ public static void setDefaultRequestProperties (Hashtable properties)
* excluding proxy items, cookies and URL authorization.
* @return The request header properties for this connection manager.
*/
- public Hashtable getRequestProperties ()
+ public Hashtable<String,String> getRequestProperties ()
{
return (mRequestProperties);
}
@@ -286,7 +286,7 @@ public Hashtable getRequestProperties ()
* Cookie property which is constructed from the current cookie jar.
* @param properties The new fixed properties.
*/
- public void setRequestProperties (Hashtable properties)
+ public void setRequestProperties (Hashtable<String,String> properties)
{
mRequestProperties = properties;
}
@@ -423,7 +423,7 @@ public boolean getCookieProcessingEnabled ()
public void setCookieProcessingEnabled (boolean enable)
{
if (enable)
- mCookieJar = (null == mCookieJar) ? new Hashtable () : mCookieJar;
+ mCookieJar = (null == mCookieJar) ? new Hashtable<String,Vector<Cookie>> () : mCookieJar;
else
mCookieJar = null;
}
@@ -436,22 +436,22 @@ public void setCookieProcessingEnabled (boolean enable)
public void setCookie (Cookie cookie, String domain)
{
String path;
- Vector cookies;
+ Vector<Cookie> cookies;
Cookie probe;
boolean found; // flag if a cookie with current name is already there
if (null != cookie.getDomain ())
domain = cookie.getDomain ();
path = cookie.getPath ();
if (null == mCookieJar)
- mCookieJar = new Hashtable (); // turn on cookie processing
- cookies = (Vector)mCookieJar.get (domain);
+ mCookieJar = new Hashtable<String,Vector<Cookie>> (); // turn on cookie processing
+ cookies = mCookieJar.get (domain);
if (null != cookies)
{
found = false;
for (int j = 0; j < cookies.size (); j++)
{
- probe = (Cookie)cookies.elementAt (j);
+ probe = cookies.elementAt (j);
if (probe.getName ().equalsIgnoreCase (cookie.getName ()))
{
// we keep paths sorted most specific to least
@@ -476,7 +476,7 @@ else if (path.startsWith (probe.getPath ()))
}
else
{ // new cookie list needed
- cookies = new Vector ();
+ cookies = new Vector<Cookie> ();
cookies.addElement (cookie);
mCookieJar.put (domain, cookies);
}
@@ -557,8 +557,8 @@ public URLConnection openConnection (URL url)
boolean repeat;
int repeated;
Properties sysprops;
- Hashtable properties;
- Enumeration enumeration;
+ Hashtable<String,String> properties;
+ Enumeration<String> enumeration;
String key;
String value;
String set = null; // old proxySet value
@@ -613,8 +613,8 @@ public URLConnection openConnection (URL url)
for (enumeration = properties.keys ();
enumeration.hasMoreElements ();)
{
- key = (String)enumeration.nextElement ();
- value = (String)properties.get (key);
+ key = enumeration.nextElement ();
+ value = properties.get (key);
ret.setRequestProperty (key, value);
}
@@ -901,7 +901,7 @@ public URLConnection openConnection (String string)
*/
public void addCookies (URLConnection connection)
{
- Vector list;
+ Vector<Cookie> list;
URL url;
String host;
String path;
@@ -918,14 +918,14 @@ public void addCookies (URLConnection connection)
path = "/";
if (null != host)
{ // http://www.objectsdevelopment.com/portal/modules/freecontent/content/javawebserver.html
- list = addCookies ((Vector)mCookieJar.get (host), path, list);
+ list = addCookies (mCookieJar.get (host), path, list);
domain = getDomain (host);
if (null != domain)
- list = addCookies ((Vector)mCookieJar.get (domain),
+ list = addCookies (mCookieJar.get (domain),
path, list);
else
// maybe it is the domain we're accessing
- list = addCookies ((Vector)mCookieJar.get ("." + host),
+ list = addCookies (mCookieJar.get ("." + host),
path, list);
}
if (null != list)
@@ -941,7 +941,7 @@ public void addCookies (URLConnection connection)
* @param list The list of qualified cookies.
* @return The list of qualified cookies.
*/
- protected Vector addCookies (Vector cookies, String path, Vector list)
+ protected Vector<Cookie> addCookies (Vector<Cookie> cookies, String path, Vector<Cookie> list)
{
Cookie cookie;
Date expires;
@@ -952,7 +952,7 @@ protected Vector addCookies (Vector cookies, String path, Vector list)
now = new Date ();
for (int i = 0; i < cookies.size (); i++)
{
- cookie = (Cookie)cookies.elementAt (i);
+ cookie = cookies.elementAt (i);
expires = cookie.getExpiryDate ();
if ((null != expires) && expires.before (now))
{
@@ -963,7 +963,7 @@ protected Vector addCookies (Vector cookies, String path, Vector list)
if (path.startsWith (cookie.getPath ()))
{
if (null == list)
- list = new Vector ();
+ list = new Vector<Cookie> ();
list.addElement (cookie);
}
}
@@ -1023,7 +1023,7 @@ protected String getDomain (String host)
* @return A string suitable for inclusion as the value of
* the "Cookie:" request property.
*/
- protected String generateCookieProperty (Vector cookies)
+ protected String generateCookieProperty (Vector<Cookie> cookies)
{
int version;
Cookie cookie;
@@ -1036,7 +1036,7 @@ protected String generateCookieProperty (Vector cookies)
version = 0;
for (int i = 0; i < cookies.size (); i++)
version = Math.max (version,
- ((Cookie)cookies.elementAt (i)).getVersion ());
+ (cookies.elementAt (i)).getVersion ());
if (0 != version)
{
buffer.append ("$Version=\"");
@@ -1045,7 +1045,7 @@ protected String generateCookieProperty (Vector cookies)
}
for (int i = 0; i < cookies.size (); i++)
{
- cookie = (Cookie)cookies.elementAt (i);
+ cookie = cookies.elementAt (i);
if (0 != buffer.length ())
buffer.append ("; ");
buffer.append (cookie.getName ());
@@ -1086,7 +1086,7 @@ protected String generateCookieProperty (Vector cookies)
public void parseCookies (URLConnection connection)
{
String string;
- Vector cookies;
+ Vector<Cookie> cookies;
StringTokenizer tokenizer;
String token;
int index;
@@ -1109,7 +1109,7 @@ public void parseCookies (URLConnection connection)
// | "Path" "=" value
// | "Secure"
// | "Version" "=" 1*DIGIT
- cookies = new Vector ();
+ cookies = new Vector<Cookie> ();
tokenizer = new StringTokenizer (string, ";,", true);
cookie = null;
while (tokenizer.hasMoreTokens ())
@@ -1231,14 +1231,14 @@ else if (token.equals (","))
* @param list The list of cookies extracted from the response header.
* @param connection The connection (used when a cookie has no domain).
*/
- protected void saveCookies (Vector list, URLConnection connection)
+ protected void saveCookies (Vector<Cookie> list, URLConnection connection)
{
Cookie cookie;
String domain;
for (int i = 0; i < list.size (); i++)
{
- cookie = (Cookie)list.elementAt (i);
+ cookie = list.elementAt (i);
domain = cookie.getDomain ();
if (null == domain)
domain = connection.getURL ().getHost ();
View
5 lexer/src/main/java/org/htmlparser/http/Cookie.java
@@ -65,6 +65,11 @@
Serializable
{
/**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
* Special characters to watch out for.
* From RFC 2068, token special case characters.
*/
View
5 lexer/src/main/java/org/htmlparser/lexer/Cursor.java
@@ -39,6 +39,11 @@
Cloneable
{
/**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
* This cursor's position.
*/
protected int mPosition;
View
5 lexer/src/main/java/org/htmlparser/lexer/InputStreamSource.java
@@ -44,6 +44,11 @@
Source
{
/**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
* An initial buffer size.
* Has a default value of {16384}.
*/
View
34 lexer/src/main/java/org/htmlparser/lexer/Lexer.java
@@ -30,6 +30,7 @@
import java.net.URLConnection;
import java.util.Vector;
+import org.htmlparser.Attribute;
import org.htmlparser.Node;
import org.htmlparser.NodeFactory;
import org.htmlparser.Remark;
@@ -61,6 +62,11 @@
// This is done so as to facilitate ant script processing.
/**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
* The floating point version number ({@value}).
*/
public static final double
@@ -658,7 +664,7 @@ public Remark createRemarkNode (Page page, int start, int end)
* @param attributes The attributes contained in this tag.
* @return The created Tag node.
*/
- public Tag createTagNode (Page page, int start, int end, Vector attributes)
+ public Tag createTagNode (Page page, int start, int end, Vector<Attribute> attributes)
{
return (new TagNode (page, start, end, attributes));
}
@@ -905,7 +911,7 @@ protected Node makeString (int start, int end)
* @param attributes The list so far.
* @param bookmarks The array of positions.
*/
- private void whitespace (Vector attributes, int[] bookmarks)
+ private void whitespace (Vector<Attribute> attributes, int[] bookmarks)
{
if (bookmarks[1] > bookmarks[0])
attributes.addElement (new PageAttribute (
@@ -917,7 +923,7 @@ private void whitespace (Vector attributes, int[] bookmarks)
* @param attributes The list so far.
* @param bookmarks The array of positions.
*/
- private void standalone (Vector attributes, int[] bookmarks)
+ private void standalone (Vector<Attribute> attributes, int[] bookmarks)
{
attributes.addElement (new PageAttribute (
mPage, bookmarks[1], bookmarks[2], -1, -1, (char)0));
@@ -928,7 +934,7 @@ private void standalone (Vector attributes, int[] bookmarks)
* @param attributes The list so far.
* @param bookmarks The array of positions.
*/
- private void empty (Vector attributes, int[] bookmarks)
+ private void empty (Vector<Attribute> attributes, int[] bookmarks)
{
attributes.addElement (new PageAttribute (
mPage, bookmarks[1], bookmarks[2], bookmarks[2] + 1, -1, (char)0));
@@ -939,7 +945,7 @@ private void empty (Vector attributes, int[] bookmarks)
* @param attributes The list so far.
* @param bookmarks The array of positions.
*/
- private void naked (Vector attributes, int[] bookmarks)
+ private void naked (Vector<Attribute> attributes, int[] bookmarks)
{
attributes.addElement (new PageAttribute (
mPage, bookmarks[1], bookmarks[2], bookmarks[3],
@@ -951,7 +957,7 @@ private void naked (Vector attributes, int[] bookmarks)
* @param attributes The list so far.
* @param bookmarks The array of positions.
*/
- private void single_quote (Vector attributes, int[] bookmarks)
+ private void single_quote (Vector<Attribute> attributes, int[] bookmarks)
{
attributes.addElement (new PageAttribute (
mPage, bookmarks[1], bookmarks[2], bookmarks[4] + 1,
@@ -963,7 +969,7 @@ private void single_quote (Vector attributes, int[] bookmarks)
* @param attributes The list so far.
* @param bookmarks The array of positions.
*/
- private void double_quote (Vector attributes, int[] bookmarks)
+ private void double_quote (Vector<Attribute> attributes, int[] bookmarks)
{
attributes.addElement (new PageAttribute (
mPage, bookmarks[1], bookmarks[2], bookmarks[5] + 1,
@@ -1043,10 +1049,10 @@ protected Node parseTag (int start)
char ch;
int state;
int[] bookmarks;
- Vector attributes;
+ Vector<Attribute> attributes;
done = false;
- attributes = new Vector ();
+ attributes = new Vector<Attribute> ();
state = 0;
bookmarks = new int[8];
bookmarks[0] = mCursor.getPosition ();
@@ -1212,7 +1218,7 @@ else if ('=' == ch) // yepp. the white spaces belonged to the equal.
* @exception ParserException If the nodefactory creation of the tag node fails.
* @return The new Tag node.
*/
- protected Node makeTag (int start, int end, Vector attributes)
+ protected Node makeTag (int start, int end, Vector<Attribute> attributes)
throws
ParserException
{
@@ -1399,13 +1405,13 @@ protected Node parseJsp (int start)
boolean done;
char ch;
int state;
- Vector attributes;
+ Vector<Attribute> attributes;
int code;
done = false;
state = 0;
code = 0;
- attributes = new Vector ();
+ attributes = new Vector<Attribute> ();
// <%xyz%>
// 012223d
// <%=xyz%>
@@ -1580,13 +1586,13 @@ protected Node parsePI (int start)
boolean done;
char ch;
int state;
- Vector attributes;
+ Vector<Attribute> attributes;
int code;
done = false;
state = 0;
code = 0;
- attributes = new Vector ();
+ attributes = new Vector<Attribute> ();
// <?xyz?>
// 011112d
while (!done)
View
11 lexer/src/main/java/org/htmlparser/lexer/Page.java
@@ -54,6 +54,11 @@
Serializable
{
/**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+/**
* The default charset.
* This should be <code>{@value}</code>,
* see RFC 2616 (http://www.ietf.org/rfc/rfc2616.txt?number=2616)
@@ -323,14 +328,14 @@ public static String findCharset (String name, String fallback)
try
{
- Class cls;
+ Class<?> cls;
Method method;
Object object;
cls = Class.forName ("java.nio.charset.Charset");
- method = cls.getMethod ("forName", new Class[] { String.class });
+ method = cls.getMethod ("forName", new Class<?>[] { String.class });
object = method.invoke (null, new Object[] { name });
- method = cls.getMethod ("name", new Class[] { });
+ method = cls.getMethod ("name", new Class<?>[] { });
object = method.invoke (object, new Object[] { });
ret = (String)object;
}
View
5 lexer/src/main/java/org/htmlparser/lexer/PageAttribute.java
@@ -45,6 +45,11 @@
Attribute
{
/**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
* The page this attribute is extracted from.
*/
protected Page mPage;
View
5 lexer/src/main/java/org/htmlparser/lexer/PageIndex.java
@@ -43,6 +43,11 @@
Sortable
{
/**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
* Starting increment for allocations.
*/
protected static final int mStartIncrement = 100;
View
4 lexer/src/main/java/org/htmlparser/lexer/Source.java
@@ -52,6 +52,10 @@
Serializable
{
/**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+ /**
* Return value when the source is exhausted.
* Has a value of {@value}.
*/
View
5 lexer/src/main/java/org/htmlparser/lexer/StringSource.java
@@ -36,6 +36,11 @@
Source
{
/**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
* The source of characters.
*/
protected String mString;
View
5 lexer/src/main/java/org/htmlparser/nodes/AbstractNode.java
@@ -44,6 +44,11 @@
public abstract class AbstractNode implements Node, Serializable
{
/**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
* The page this node came from.
*/
protected Page mPage;
View
4 lexer/src/main/java/org/htmlparser/nodes/RemarkNode.java
@@ -41,6 +41,10 @@
Remark
{
/**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+ /**
* The contents of the remark node, or override text.
*/
protected String mText;
View
58 lexer/src/main/java/org/htmlparser/nodes/TagNode.java
@@ -25,7 +25,6 @@
package org.htmlparser.nodes;
-import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Locale;
import java.util.Vector;
@@ -52,6 +51,11 @@
Tag
{
/**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
* An empty set of tag names.
*/
private final static String[] NONE = new String[0];
@@ -72,15 +76,15 @@
* The first element is the tag name, subsequent elements being either
* whitespace or real attributes.
*/
- protected Vector mAttributes;
+ protected Vector<Attribute> mAttributes;
/**
* Set of tags that breaks the flow.
*/
- protected static final Hashtable breakTags;
+ protected static final Hashtable<String,Boolean> breakTags;
static
{
- breakTags = new Hashtable (30);
+ breakTags = new Hashtable<String,Boolean> (30);
breakTags.put ("BLOCKQUOTE", Boolean.TRUE);
breakTags.put ("BODY", Boolean.TRUE);
breakTags.put ("BR", Boolean.TRUE);
@@ -118,7 +122,7 @@
*/
public TagNode ()
{
- this (null, -1, -1, new Vector ());
+ this (null, -1, -1, new Vector<Attribute> ());
}
/**
@@ -129,7 +133,7 @@ public TagNode ()
* @param attributes The list of attributes that were parsed in this tag.
* @see Attribute
*/
- public TagNode (Page page, int start, int end, Vector attributes)
+ public TagNode (Page page, int start, int end, Vector<Attribute> attributes)
{
super (page, start, end);
@@ -284,7 +288,7 @@ public void setAttribute (String key, String value, char quote)
*/
public Attribute getAttributeEx (String name)
{
- Vector attributes;
+ Vector<Attribute> attributes;
int size;
Attribute attribute;
String string;
@@ -298,7 +302,7 @@ public Attribute getAttributeEx (String name)
size = attributes.size ();
for (int i = 0; i < size; i++)
{
- attribute = (Attribute)attributes.elementAt (i);
+ attribute = attributes.elementAt (i);
string = attribute.getName ();
if ((null != string) && name.equalsIgnoreCase (string))
{
@@ -331,7 +335,7 @@ public void setAttribute (Attribute attribute)
{
boolean replaced;
boolean empty_xml;
- Vector attributes;
+ Vector<Attribute> attributes;
int length;
String name;
Attribute test;
@@ -347,7 +351,7 @@ public void setAttribute (Attribute attribute)
name = attribute.getName ();
for (int i = 1; i < attributes.size (); i++)
{
- test = (Attribute)attributes.elementAt (i);
+ test = attributes.elementAt (i);
test_name = test.getName ();
if (null != test_name)
if (test_name.equalsIgnoreCase (name))
@@ -359,7 +363,7 @@ public void setAttribute (Attribute attribute)
// see bug #1761484 tag.setAttribute() not compatible with <tag/>
if (!replaced)
{
- test = (Attribute)attributes.elementAt (length - 1);
+ test = attributes.elementAt (length - 1);
test_name = test.getName ();
if (null != test_name)
{
@@ -376,7 +380,7 @@ public void setAttribute (Attribute attribute)
attributes.addElement (new Attribute ("/", null));
length += 2;
}
- else if ((1 != length) && !((Attribute)attributes.elementAt (length - 2)).isWhitespace ())
+ else if ((1 != length) && !(attributes.elementAt (length - 2)).isWhitespace ())
{
attributes.insertElementAt (new Attribute (" "), length - 1);
length ++;
@@ -395,7 +399,7 @@ else if ((1 != length) && !((Attribute)attributes.elementAt (length - 2)).isWhit
if (!replaced)
{
// add whitespace between attributes
- if ((0 != length) && !((Attribute)attributes.elementAt (length - 1)).isWhitespace ())
+ if ((0 != length) && !(attributes.elementAt (length - 1)).isWhitespace ())
attributes.addElement (new Attribute (" "));
attributes.addElement (attribute);
}
@@ -407,7 +411,7 @@ else if ((1 != length) && !((Attribute)attributes.elementAt (length - 2)).isWhit
* The first element is the tag name, subsequent elements being either
* whitespace or real attributes.
*/
- public Vector getAttributesEx ()
+ public Vector<Attribute> getAttributesEx ()
{
return (mAttributes);
}
@@ -449,14 +453,14 @@ public String getTagName ()
*/
public String getRawTagName ()
{
- Vector attributes;
+ Vector<Attribute> attributes;
String ret;
ret = null;
attributes = getAttributesEx ();
if (0 != attributes.size ())
- ret = ((Attribute)attributes.elementAt (0)).getName ();
+ ret = (attributes.elementAt (0)).getName ();
return (ret);
}
@@ -470,22 +474,22 @@ public String getRawTagName ()
public void setTagName (String name)
{
Attribute attribute;
- Vector attributes;
+ Vector<Attribute> attributes;
Attribute zeroth;
attribute = new Attribute (name, null, (char)0);
attributes = getAttributesEx ();
if (null == attributes)
{
- attributes = new Vector ();
+ attributes = new Vector<Attribute> ();
setAttributesEx (attributes);
}
if (0 == attributes.size ())
// nothing added yet
attributes.addElement (attribute);
else
{
- zeroth = (Attribute)attributes.elementAt (0);
+ zeroth = attributes.elementAt (0);
// check for attribute that looks like a name
if ((null == zeroth.getValue ()) && (0 == zeroth.getQuote ()))
attributes.setElementAt (attribute, 0);
@@ -515,7 +519,7 @@ public String getText ()
* and the second element being the value.
* @param attribs The attribute collection to set.
*/
- public void setAttributesEx (Vector attribs)
+ public void setAttributesEx (Vector<Attribute> attribs)
{
mAttributes = attribs;
}
@@ -614,7 +618,7 @@ public String toTagHtml ()
{
int length;
int size;
- Vector attributes;
+ Vector<Attribute> attributes;
Attribute attribute;
StringBuffer ret;
@@ -623,14 +627,14 @@ public String toTagHtml ()
size = attributes.size ();
for (int i = 0; i < size; i++)
{
- attribute = (Attribute)attributes.elementAt (i);
+ attribute = attributes.elementAt (i);
length += attribute.getLength ();
}
ret = new StringBuffer (length);
ret.append ("<");
for (int i = 0; i < size; i++)
{
- attribute = (Attribute)attributes.elementAt (i);
+ attribute = attributes.elementAt (i);
attribute.toString (ret);
}
ret.append (">");
@@ -706,7 +710,7 @@ public void accept (NodeVisitor visitor)
*/
public boolean isEmptyXmlTag ()
{
- Vector attributes;
+ Vector<Attribute> attributes;
int size;
Attribute attribute;
String name;
@@ -719,7 +723,7 @@ public boolean isEmptyXmlTag ()
size = attributes.size ();
if (0 < size)
{
- attribute = (Attribute)attributes.elementAt (size - 1);
+ attribute = attributes.elementAt (size - 1);
name = attribute.getName ();
if (null != name)
{
@@ -739,7 +743,7 @@ public boolean isEmptyXmlTag ()
*/
public void setEmptyXmlTag (boolean emptyXmlTag)
{
- Vector attributes;
+ Vector<Attribute> attributes;
int size;
Attribute attribute;
String name;
@@ -750,7 +754,7 @@ public void setEmptyXmlTag (boolean emptyXmlTag)
size = attributes.size ();
if (0 < size)
{
- attribute = (Attribute)attributes.elementAt (size - 1);
+ attribute = attributes.elementAt (size - 1);
name = attribute.getName ();
if (null != name)
{
View
4 lexer/src/main/java/org/htmlparser/nodes/TextNode.java
@@ -41,6 +41,10 @@
Text
{
/**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+ /**
* The contents of the string node, or override text.
*/
protected String mText;
View
5 lexer/src/main/java/org/htmlparser/scanners/TagScanner.java
@@ -47,6 +47,11 @@
Serializable
{
/**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
* Create a (non-composite) tag scanner.
*/
public TagScanner ()
View
14 lexer/src/main/java/org/htmlparser/util/ChainedException.java
@@ -62,7 +62,11 @@
public class ChainedException
extends Exception
{
- protected Throwable throwable;
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+protected Throwable throwable;
public ChainedException() {}
@@ -84,22 +88,22 @@ public ChainedException(String message, Throwable throwable)
public String[] getMessageChain()
{
- Vector list = getMessageList();
+ Vector<String> list = getMessageList();
String[] chain = new String[list.size()];
list.copyInto (chain);
return chain;
}
- public Vector getMessageList()
+ public Vector<String> getMessageList()
{
- Vector list = new Vector();
+ Vector<String> list = new Vector<String> ();
list.addElement(getMessage());
if (throwable != null)
{
if (throwable instanceof ChainedException)
{
ChainedException chain = (ChainedException)throwable;
- Vector sublist = chain.getMessageList ();
+ Vector<String> sublist = chain.getMessageList ();
for (int i = 0; i < sublist.size (); i++)
list.addElement (sublist.elementAt (i));
}
View
5 lexer/src/main/java/org/htmlparser/util/EncodingChangeException.java
@@ -46,6 +46,11 @@
ParserException
{
/**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
* The old encoding.
*/
private String mOldEncoding;
View
10 lexer/src/main/java/org/htmlparser/util/NodeList.java
@@ -34,7 +34,11 @@
public class NodeList implements Serializable
{
- private static final int INITIAL_CAPACITY=10;
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+ private static final int INITIAL_CAPACITY=10;
//private static final int CAPACITY_INCREMENT=20;
private Node nodeData[];
private int size;
@@ -361,11 +365,7 @@ public void keepAllNodesThatMatch (NodeFilter filter, boolean recursive)
* </pre>
*/
public void visitAllNodesWith (NodeVisitor visitor)
- throws
- ParserException
{
- Node node;
-
visitor.beginParsing ();
for (int i = 0; i < size; i++)
nodeData[i].accept (visitor);
View
7 lexer/src/main/java/org/htmlparser/util/ParserException.java
@@ -33,7 +33,12 @@
public class ParserException
extends ChainedException
{
- public ParserException() {}
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+public ParserException() {}
public ParserException(String message)
{
View
14 lexer/src/main/java/org/htmlparser/util/sort/Sort.java
@@ -60,7 +60,7 @@ private Sort ()
* @exception ClassCastException If the vector contains objects that
* are not <code>Ordered</code>.
*/
- public static void QuickSort (Vector v) throws ClassCastException
+ public static void QuickSort (Vector<Object> v) throws ClassCastException
{
QuickSort (v, 0, v.size () - 1);
}
@@ -80,7 +80,7 @@ public static void QuickSort (Vector v) throws ClassCastException
* @exception ClassCastException If the vector contains objects that
* are not <code>Ordered</code>.
*/
- public static void QuickSort (Vector v, int lo0, int hi0) throws ClassCastException
+ public static void QuickSort (Vector<Object> v, int lo0, int hi0) throws ClassCastException
{
int lo = lo0;
int hi = hi0;
@@ -120,7 +120,7 @@ public static void QuickSort (Vector v, int lo0, int hi0) throws ClassCastExcept
}
}
- private static void swap (Vector v, int i, int j)
+ private static void swap (Vector<Object> v, int i, int j)
{
Object o;
@@ -357,9 +357,9 @@ public static void QuickSort (Sortable sortable)
* @exception ClassCastException If the keys of the hashtable
* are not <code>Ordered</code>.
*/
- public static Object[] QuickSort (Hashtable h) throws ClassCastException
+ public static Object[] QuickSort (Hashtable<Object,Object> h) throws ClassCastException
{
- Enumeration e;
+ Enumeration<Object> e;
boolean are_strings;
Object[] ret;
@@ -447,7 +447,7 @@ public static int bsearch (Sortable set, Ordered ref)
* @param hi The upper index within which to look.
* @return The index at which reference was found or is to be inserted.
*/
- public static int bsearch (Vector vector, Ordered ref, int lo, int hi)
+ public static int bsearch (Vector<Object> vector, Ordered ref, int lo, int hi)
{ int num;
int mid;
int half;
@@ -487,7 +487,7 @@ else if (0 > result)
* @param ref The name to search for.
* @return The index at which reference was found or is to be inserted.
*/
- public static int bsearch (Vector vector, Ordered ref)
+ public static int bsearch (Vector<Object> vector, Ordered ref)
{
return (bsearch (vector, ref, 0, vector.size () - 1));
}
View
10 parser/src/main/java/org/htmlparser/Parser.java
@@ -30,7 +30,6 @@
import java.net.URLConnection;
import org.htmlparser.filters.TagNameFilter;
-import org.htmlparser.filters.NodeClassFilter;
import org.htmlparser.http.ConnectionManager;
import org.htmlparser.http.ConnectionMonitor;
import org.htmlparser.http.HttpHeader;
@@ -112,10 +111,15 @@
Serializable,
ConnectionMonitor
{
+