Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6239325

ParserDelegator reports error on correct <img ...> element.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.4.2
    • client-libs

      FULL PRODUCT VERSION :
      java version "1.4.2_06"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_06-b03)
      Java HotSpot(TM) Client VM (build 1.4.2_06-b03, mixed mode)


      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows 2000 [Version 5.00.2195]


      A DESCRIPTION OF THE PROBLEM :
      javax.swing.text.html.parser.ParserDelegator calls the handleError for the following
      (correct) HTML Statement:

      <img src="/ecrm/images_lib/ecrm/img_products/ch_tab_left_a.gif" alt="no_image" width="10" height="25">

      The reported error is at position 103 (i.e. after the closing '>'):

      req.att srcimg?



      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Write the abovementioned HTML snippet into a file, say test.html. Then
      create a class with the following main method:

      public static void main( String[] args ) {
      ParserDelegator pd=new ParserDelegator();
      try
      {
         pd.parse(new BufferedReader(
      new FileReader("test.html")),
      new ParserCallback() {
      public void handleError(String errorMsg, int pos) {
      System.out.println("Error at position "+pos
      +": \n"+errorMsg);
      }
      },
      true
         );
      }
      catch(IOException e) {}
      }

      Executing this program will show the bug.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      no output

      ACTUAL -
      Error at position 103:
      req.att srcimg?


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.io.IOException;
      import java.io.File;
      import java.io.FileInputStream;
      import java.io.FileNotFoundException;
      import java.io.BufferedReader;
      import java.io.FileReader;
      import java.io.BufferedInputStream;
      import java.io.FileOutputStream;
      import java.io.DataInputStream;
      import java.io.PrintWriter;
      import java.io.FileWriter;
      import javax.swing.text.html.HTMLEditorKit.ParserCallback;
      import javax.swing.text.html.parser.ParserDelegator;

      public class TTest1 {

      public static void main( String[] args ) {
      ParserDelegator pd=new ParserDelegator();
      try
      {
         pd.parse(new BufferedReader(
      new FileReader("test.html")),
      new ParserCallback() {
      public void handleError(String errorMsg, int pos) {
      System.out.println("Error at position "+pos
      +": \n"+errorMsg);
      }
      },
      true
         );
      }
      catch(IOException e) {}
      }

      }

      ---------- END SOURCE ----------
      ###@###.### 2005-03-11 09:02:08 GMT

            idk Igor Kushnirskiy (Inactive)
            jssunw Jitender S (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: