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

Error writing to RTF-file

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: 1.1.5
    • Fix Version/s: None
    • Component/s: client-libs
    • Labels:

      Description



      Name: rk38400 Date: 04/15/98


      Hi,

      when i try to write an RTF-file from the JEditorPane i get the following messages plus error.
      This happens with various rtf-files that i read in
      There is no difference when i first display the frame.

      -------------------
      reading charset ansi
      Unknown keyword: ansicpg (param 1252)
      Unknown keyword: deff (param 0)
      Unknown keyword: deftab (param 720)
      Unknown keyword: fcharset (param 2)
      Done reading font table.
      Number 2: Courier New
      Number 1: Symbol
      Number 0: MS Sans Serif

      Done reading color table, 1 entries.
      Unknown keyword: deflang (param 1033)
      Unknown keyword: horzdoc
      Unknown keyword: fchars
      Unknown keyword: lchars
      RTF filter done.
      -------------------
      java.lang.InternalError: Invalid location
              at com.sun.java.swing.text.rtf.RTFGenerator.writeTextElement(RTFGenerator.java:800)
              at com.sun.java.swing.text.rtf.RTFGenerator.writeParagraphElement(RTFGenerator.java:658)
              at com.sun.java.swing.text.rtf.RTFGenerator.writeDocument(RTFGenerator.java:132)
              at com.sun.java.swing.text.rtf.RTFEditorKit.write(RTFEditorKit.java:108)
              at TestRTF.main(TestRTF.java:26)
      --------------------------------------------------

      Code-example:
      --------------------------------------------------

      import java.awt.*;
      import java.io.*;
      import com.sun.java.swing.*;
      import com.sun.java.swing.text.*;

      public class TestRTF
      {
      static public void main(String args[])
      {
      JFrame f=new JFrame("Test");
      JEditorPane pane1;
      try
      {
      //read file
      pane1=new JEditorPane("file:/Text.rtf");
      f.getContentPane().add(pane1, BorderLayout.CENTER);

      //write to new file
      File fil=new File("TextNew.rtf");
      FileOutputStream fout= new FileOutputStream(fil);

      //set up writer
      Document doc=pane1.getDocument();
      EditorKit kit = pane1.getEditorKit();

      //do it
      kit.write(fout, doc, 0, 0);
      }
      catch (Exception e)
      {
      e.printStackTrace(System.out);
      }
      }//main
      }//class
      --------------------------------------------------

      I used JDK 1.1.5, JFC 1.0.1 on WinNT 4.0 ServicePack-3, IBM PC365 P200.

      Thanks for your help.
      (Review ID: 27626)
      ======================================================================

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              tprinzinsunw Timothy Prinzing (Inactive)
              Reporter:
              rkarsunw Ralph Kar (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: