sebb        2004/01/07 10:08:27

  Modified:    src/protocol/http/org/apache/jmeter/protocol/http/parser
                        HTMLParser.java
  Log:
  Use HTMLParseError instead of Error to alllow use under JDK1.3
  TODO - finish JDK1.3 compatibility
  
  Revision  Changes    Path
  1.14      +18 -10    
jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/parser/HTMLParser.java
  
  Index: HTMLParser.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/parser/HTMLParser.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- HTMLParser.java   15 Dec 2003 17:42:06 -0000      1.13
  +++ HTMLParser.java   7 Jan 2004 18:08:27 -0000       1.14
  @@ -66,7 +66,6 @@
   import java.util.Collection;
   import java.util.Hashtable;
   import java.util.Iterator;
  -import java.util.LinkedHashSet;
   import java.util.List;
   import java.util.Properties;
   import java.util.Vector;
  @@ -121,20 +120,20 @@
                if (clazz instanceof HTMLParser){
                                pars = (HTMLParser) clazz;
                } else {
  -                     throw new Error(new ClassCastException(htmlParserClassName));
  +                     throw new HTMLParseError(new 
ClassCastException(htmlParserClassName));
                }
           }
           catch (InstantiationException e)
           {
  -                     throw new Error(e);
  +                     throw new HTMLParseError(e);
           }
           catch (IllegalAccessException e)
           {
  -                     throw new Error(e);
  +                     throw new HTMLParseError(e);
           }
           catch (ClassNotFoundException e)
           {
  -                     throw new Error(e);
  +                     throw new HTMLParseError(e);
           }
                log.info("Created "+htmlParserClassName);
                if (pars.isReusable()){
  @@ -168,7 +167,10 @@
                        // them roughly in order, which should be a better model of 
browser
                        // behaviour.
                        // N.B. LinkedHashSet is Java 1.4
  -             return getEmbeddedResourceURLs(html, baseUrl,new LinkedHashSet());
  +             //JDK1.4:
  +             return getEmbeddedResourceURLs(html, baseUrl,new 
java.util.LinkedHashSet());
  +             //TODO better fix for JDK1.3:
  +                     //return getEmbeddedResourceURLs(html, baseUrl,new 
java.util.HashSet());
           }
   
        /**
  @@ -338,7 +340,7 @@
                        try{
                            getParser("no.such.parser");
                        }
  -                     catch (Error e)
  +                     catch (HTMLParseError e)
                        {
                                if (e.getCause() instanceof ClassNotFoundException)
                                {
  @@ -355,7 +357,7 @@
                        try{
                   getParser("java.lang.String");
                        }
  -                     catch (Error e)
  +                     catch (HTMLParseError e)
                        {
                                if (e.getCause() instanceof ClassCastException) return;
                                throw e;
  @@ -367,7 +369,7 @@
                        {
                                getParser(TestClass.class.getName());
                        }
  -                     catch (Error e)
  +                     catch (HTMLParseError e)
                        {
                                if (e.getCause() instanceof InstantiationException) 
return;
                                throw e;
  @@ -404,6 +406,12 @@
                        } else {
                            result = p.getEmbeddedResourceURLs(buffer,new URL(url),c);
                        }
  +                     /* 
  +                      * TODO:
  +                      * Exact ordering is only required for some tests;
  +                      * change the comparison to do a set compare where
  +                      * necessary.
  +                      */
                        Iterator expected= getFile(resultFile).iterator();
                        while (expected.hasNext()) {
                                assertTrue(result.hasNext());
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to