Error when writing RTF Document

I am trying to build a component in an application that allows the user to create/modify/save RTF files.
I've been tinkering with some code for a bit trying to get it to work before I do a full scale implementation and I have run across an issue that is stumping me. (A search of google returned 9 hits for my error - none of which shed much light on my problem).
I am having no problems loading an RTF file. (As a test, I am opening Word in MS Windows, and saving a test document in RTF.) However, when I try to save the file (with or without modifications), I receive the following error:
java.io.IOException: RTF is an 8-bit formatHere is an SSCCE that reproduces the problem:
import javax.swing.*;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.io.*;
public class Main extends JFrame {
    private JMenuBar jmb;
    private JMenu fileMenu;
    private JMenuItem newItem;
    private JMenuItem openItem;
    private JMenuItem saveItem;
    private JMenuItem quitItem;
    private JEditorPane jep;
    private JScrollPane jsp;
    private JFileChooser jfc;
    public Main() {
        initComponents();
    private void initComponents() {
        jmb = new JMenuBar();
        fileMenu = new JMenu("File");
        newItem = new JMenuItem("New...");
        openItem = new JMenuItem("Open");
        saveItem = new JMenuItem("Save");
        quitItem = new JMenuItem("Quit");
        fileMenu.add(newItem);
        fileMenu.add(openItem);
        fileMenu.add(saveItem);
        fileMenu.addSeparator();
        fileMenu.add(quitItem);
        jmb.add(fileMenu);
        jep = new JEditorPane();
        jep.setEditorKit(new javax.swing.text.rtf.RTFEditorKit());
        jsp = new JScrollPane(jep);
        jfc = new JFileChooser();
        this.getContentPane().add(jsp);
        this.setJMenuBar(jmb);
        this.pack();
        this.setSize(500, 300);
        this.setTitle("Editor");
        this.setDefaultCloseOperation(EXIT_ON_CLOSE);
        this.setLocationRelativeTo(null);
        newItem.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
                jep.setText("");
        openItem.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
                openDocument();
        saveItem.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
                saveDocument();
        quitItem.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
                System.exit(0);
    private void openDocument() {
        int option = jfc.showOpenDialog(this);
        if( option == JFileChooser.APPROVE_OPTION ) {
            try {
                FileReader fr = new FileReader(jfc.getSelectedFile());
                jep.read(fr, null);
            } catch (Exception e ) { e.printStackTrace(); }
    private void saveDocument() {
        int option = jfc.showSaveDialog(this);
        if( option == JFileChooser.APPROVE_OPTION ) {
            try {
                FileWriter fw = new FileWriter(jfc.getSelectedFile());
                jep.write(fw);
            } catch (Exception e) { e.printStackTrace(); }
    public static void main(String[] args) {
        SwingUtilities.invokeLater(new Runnable( ){
            public void run() {
                new Main().setVisible(true);
}

You're not going to believe this. I just ran a debug on the RTFEditorKit class... here is the "write" method:
     * Write content from a document to the given stream
     * as plain text.
     * @param out  The stream to write to
     * @param doc The source for the write.
     * @param pos The location in the document to fetch the
     *   content.
     * @param len The amount to write out.
     * @exception IOException on any I/O error
     * @exception BadLocationException if pos represents an invalid
     *   location within the document.
    public void write(Writer out, Document doc, int pos, int len)
     throws IOException, BadLocationException {
     throw new IOException("RTF is an 8-bit format");
    }I guess we know why no matter what Charset I use ... I'm getting this error!!

Similar Messages

  • Adobe Media Encoder (Error compiling movie) Unknown error when writing to Isilon OneFS 6.5.5.18

    Adobe Media Encoder (Error compiling movie) Unknown error when writing to Isilon OneFS 6.5.5.18 while using Adobe Premiere Pro.
    Process:         Adobe Premiere Pro CC 2014
    Path: /Applications/Adobe Premiere Pro CC 2014/Adobe Premiere Pro CC 2014.app/Contents/MacOS/Adobe Premiere Pro CC 2014
    Identifier: com.adobe.AdobePremierePro
    Version:         8.1.0 (8.1.0)
    Code Type: X86-64 (Native)
    Parent Process: launchd [2538]
    Responsible:     Adobe Premiere Pro CC 2014
    Date/Time: 2015-01-06 14:04:23.500 -0700
    OS Version:      Mac OS X 10.9.2 (13C64)
    Report Version:  11
    Crashed Thread: 55  Dispatch queue: com.apple.root.default-priority
    Exception Type: EXC_BAD_ACCESS (SIGSEGV)
    Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000000
    Customer created test export with 777 permissions and set mount parameters to the following:
    mount_nfs -o vers=3,tcp,rdirplus,intr,nolocks,async,rsize=32768,wsize=32768
      -- Original mount options:
         General mount flags: 0x40 async
         NFS parameters: vers=3,tcp,nolocks,rsize=32768,wsize=32768,rdirplus
      -- Current mount parameters:
         General mount flags: 0x4000058 async,nodev,nosuid multilabel
         NFS parameters: vers=3,tcp,port=2049,nomntudp,hard,nointr,noresvport,negnamecache,callumnt,nolocks,quota, rsize=32768,wsize=32768,readahead=16,dsize=32768,rdirplus,nodumbtimr,timeo=10,maxgroups=16 ,acregmin=5,acregmax=60,acdirmin=5,acdirmax=60,nomutejukebox,nonfc,sec=sys
    The pcap shows once the movie is created a lockup call is responded from Isilon with Error: NFS3ERR_NOENT
    478         V3 CREATE Call (Reply In 479), DH: 0xea5f731c/QBRSN-0-0-1.mov Mode: UNCHECKED
    479         V3 CREATE Reply (Call In 478)
    484         V3 LOOKUP Call (Reply In 485), DH: 0xea5f731c/._QBRSN-0-0-1.mov
    485        V3 LOOKUP Reply (Call In 484) Error: NFS3ERR_NOENT
    V3 LOOKUP Reply (Call In ....) Error: NFS3ERR_NOENT  -   This is by design of OneFS, we coalesce files and then flush them out to disk which is why the commit time is accurate but the file is not immediately available. however when an async option is used within the mount options this should be avoided if writing asynchronously to the cluster.  Has anyone else seen this behavior lately? (current workaround is to store locally and transfer to the cluster via Finder)

    That error can happen for many reasons...one of the reasons that I occassionaly get it is because I try exporting a movie to an external drive that has been formated in the old FAT32 instead of the NTSF standard.  FAT32 only allows for file sizes up to 2 gigs.  And as soon as it reaches that...I would get that error.  I don't know if that is why you are getting that error...but it would be easy to check.  1) are you generating a file that is over 2 gigs?  2) is your drive that you are exporting to FAT 32 (just right click the drive in My Computer and select "properties" then just look for what it says next to "file system".

  • I am getting error when hovering on document in sharepoint online "sorry there was a problem and we can't open this document.If this happens again, try opening the document in Microsoft Word"

     I am getting error when hovering on document in sharepoint online "sorry there was a problem and we can't open this document.If this happens again, try opening the document in Microsoft Word".I am sure that document is not corrupted and
    all. something it showing the preview and sometimes it throwing this error. I hope this error is intermident. When clicking on the link also it throws this error but on refreshing it working fine. I dont know why it is happening. Please helpme  to resolve
    this issue. 

    Hi Waqas
    Thanks for your help with this. I had a look at both posts, the URL works fine from the WAC server and I am not using a System account to test docs.
    Also, this is a production site that is accessible over the Internet, so we are using https therefore the WOPIZone is external-https.
    Issue #3 in the above blog link does not reflect the same error I see on my servers.
    I also had a look at the information in this link: http://technet.microsoft.com/en-us/library/ff431687.aspx#oauth
    Problem: You receive a "Sorry, there was a problem and we can't open this document" error when you try to view an Office document in Office Web Apps.
    If you added domains to the Allow List by using the
    New-OfficeWebAppsHost cmdlet, make sure you’re accessing Office Web Apps from a host domain that’s in the Allow List. To view the host domains in the Allow List, on the Office Web Apps Server open the Windows PowerShell prompt as an administrator and run
    the Get-OfficeWebAppsHost cmdlet. To add a domain to the Allow List, use the
    New-OfficeWebAppsHost cmdlet.
    I have not added any domains to the Allow list so this did not help either. Should I add the domain?
    Any further help with this is much appreciated.
    Thanks again.
    Yoshi

  • Errors when writing metadata to files on Windows Server

    Good day!
    I have an iMac running OSX 10.9 (Maverick) and Lightroom 5.2.
    My catalog is on the local iMac drive, and the images are on SMB shared drive (handled by Windows 2012 server).
    I decided to do the final layout of my album using InDesign, and for that I needed to access to images using Bridge. So selected all the images (the rated once...) and issue a Metadata/Save command.
    The system came back with errors on many of the files (such as Photos are read only, and unknown errors).
    Retrying to save the metadata on image that was flagged with an error usually (but not always) worked.
    I tried to select save the metadata for few (6) images in a time, many times it was ok, but sometimes, one or two of them failed (and retrying again usually solved the problem).
    It looks to me like a timing related issue.
    Any ideas?
    (After spending about an hour on this, I have exported the images to my local drive...). In general I don't have similar problems with other apps.
    Any ideas?
    Yuval

    I Yuval
    I'm experiencing more or less the same behavior (see Read-only error when writing metadata to file over network (Synology DS1315+ using AFP) ). For me however, the problem is more pronounced if I use the AFP protocol and is better (I think as you described) if I use SMB (all done on a Synology DS1315+). With SMB it most often works but in very rare cases I also get the "read only" message!
    Do you have solution to this? Or are you stuck as I am?
    Cheers, Chris

  • Error when Writing Metadata to Files in Bridge (Mac) but not in Bridge (PC)

    We get an error when writing metadata to files in Bridge (Mac) but not in Bridge (PC). In the same drive and folder, the PC can successfully write a keyword to a file on the PC, where the Mac returns an error. I have researched this at the Adobe Knowledgebase, but their answer seemed to indicate it was a global issue, and we don't see that behavior on the PC.
    The client is a Mac of course, and the server volume is a Windows share volume. The Mac is bound to AD, and the domain\username and username formats have both been tried when logging in, but you receive the error in both.
    Any help would be appreciated.
    Thanks!
    Rich Oliver

    Hi, I'm having the same problem using FreeNAS (which uses Samba and Netatalk in the backend), but I tried with both AFP and SMB on Mavericks and Yosemite, I still have the same issue.  I think it might be a timing issue with how lightroom interact with a slower write delay using network shares.  I suggest you also chime into this thread:  Lightroom 5 can't write metadata to DNG files   I really hope this is resolved as this is impacting my productivity as I moved my workflow to my Macbook with a shared NAS.

  • Error when writing to interface table for HR

    We recently did a client copy from Production to our User Testing client. User was trying to enter time via transaction CAT2 but received the following message when attempting to save the timesheet:
    "Error when writing to interface table for HR"
    Does anyone have advice on how to resolve this issue?
    Thanks as always!

    Hi,
    We have the same problem.
    We tried to add many records to HR via a job but it result with en error message LR036 (Error when writing to interface table for HR)
    Did you find a solution since your problem appear ?

  • Itunes 9.2.1.5 "Error when writing file C:\program files\apple software....

    Got an error message when installing itues 9.2.1.5 "Error when writing file C:\program files\apple software update\softwareupdate.exe you do not have admin right to read/write the menu." "寫入檔案時發生錯誤 C:\program files\apple software update\softwareupdate.exe 你沒有權限存取目錄"
    There is no "apple software update" folder in my C:\program files\
    I tried to uninstalled all apple related software, restart the computer and reinstall the itunes, I still get this error message.
    It appears that the installation of quicktime was successful.

    After the last update I get "QuickTime was not found" Error I have uninstalled and re-installed itunes 9.2.1.5. several times but the problem persists

  • Error when writing the trace in ST01

    Hi Gurus,
    Good day!
    Please advise on how can I resolve this issue in ST01. I'm getting an error "Error when writing the trace No such file or directory".
    Appreciate your help.
    Cheers,
    Virgilio

    Hi,
    Check this link
    http://help.sap.com/saphelp_nw04/helpdata/EN/ae/ed0ad513d0074e944879f05ef318d5/content.htm
    Regards,
    Renu

  • Error when writing to the Internal Buffer-runtime error during querydisplay

    Hi
              I am working in BW 3.5. I am trying to run a query in BEx Analyzer but I am getting the following Error
    Error when writing in the Internal Buffer see OSS note 156957
    I tried for the note but I am not getting relevant information.
    Please let me know what to do.
    Thanks,
    Padma

    Hi,
    please apply the note 1614788. After note implementation, you need to set parameter RSR_HIER_THRESHOLD_EXPORTDB in table RSADMIN via report SAP_RSADMIN_MAINTAIN in transaction SE38.
    If you set this parameter to value 50.000 for example, all hierarchies with more than 50.000 nodes will be buffered in the database instead of using the export/import buffer.
    To find out the current size of a hierarchy, goto the hierarchy maintenance in transaction RSH1 and copy the hierarchie ID from the header data. With this key you can goto transaction SE16 and select table RSRHIEDIR_OLAP (Field HIEID is the hierarchy ID).
    It should resolved your issue.
    Thanks,
    Venkat

  • I'm getting an error message "There was an error when opening this document. Access denied" on some PDF's that I was able to open in past. Uninstalled XI and installed X but same problem. Any thoughts?

    I'm getting an error message "There was an error when opening this document. Access denied" on some PDF's that I was able to open in past. Uninstalled XI and installed X but same problem. How can I access these files?

    I have exactly the same problem. The interesting thing is that the file opens when I attach it to an email and open it out of the email. I already saw the advice you provided in  similar post from Aug last year and checked the security settings of the file and the folder. But according to that I have all rights.
    My OS is Windows 7 Enterprise.

  • Error when open fdf document from Safari

    Reproduced on
    * Adobe reader 9.1.0
    * Acrobat Pro 8.1.3
    NOT reproduced with Acrobat Pro 8.0.0( withou updates )
    have simple fdf document for example in root of disk c:
    =============
    %FDF-1.2
    1 0 obj
    <<
    /FDF
    <<
    /F (1.pdf)
    /JavaScript
    <<
    /After 2 0 R
    >>
    >>
    >>
    endobj
    2 0 obj
    <<
    >>
    stream
    endstream
    endobj
    trailer
    <<
    /Root 1 0 R
    >>
    %%EOF
    ================
    when open it with IE or FF, al works fine. but when try to open in safari  messagebox shown
    "There was an error when open this document. This file cannot be found."

    minified version of not worked fdf
    %FDF-1.2
    1 0 obj
    <<
    /FDF <</F (pdf.pdf) >>
    >>
    endobj
    trailer
    <<
    /Root 1 0 R
    >>
    %%EOF

  • I/O Error when writing access Log buffer to file. error number: 28

    Hi,
    Oracle OracleAS Web Cache 10.1.2.3.0, Build 10.1.2.3.0 080201 is writing events like this:
    [alert 13215] I/O Error when writing access Log buffer to file. error number: 28
    I've looked for this alert and i've found this description:
    WXE-13215 I/O Error when writing access Log buffer to file. error number: %d
    Severity: alert
    Cause: I/O error happened when OracleAS Web Cache tried to write to the access log file.
    Action: Check the status of access log file. For example, see if the disk is full
    Anybody knows what "error number: 28" stands for? The logs are sended to other server and it seems that the disk size is ok.
    thanks!

    I tested again...it seems LabVIEW doesn't like the way I wrote the measurement files. I attached a set of VIs (ZIP-file) to give you a clue how it was done. When I try to save and read a file containing just plain DBLs from a 1D-Array (see attached file generating VI) it works perfectly well for large file sizes.
    So there might get something messed up by the way LabVIEW saved the measured data. You'll notice, that I (accidentally) left the "prepend array string size" input of "write to binary file" function unwired which means that the size information will be written as a type of header. Maybe this is the reason that it doesn't work as expected...
    Attachments:
    VibrationMeasurement.zip ‏76 KB
    generate_test_bin_data.vi ‏12 KB

  • Error when exporting RTF to XSL-FO with the template builder for word

    I am currently trying to export an RTF file from word 2007 to the xsl-fo format. I am using the latest version of BI Publisher desktop as well since I wanted to see if that solved my problem as well. I currently get the following error when trying to convert the file and I know it is an error generated by windows but I am not sure how to fix it.
    The error I receive is: This file does not have a program associated with it for performing this action. Create an association in the Folder Options control panel.
    Any help with how to fix this error would be appreciated.

    Hi
    I dont think this is a BI Publisher issue per se. It looks like Word does not know what to spawn to get the document to open.
    You need to create the association - you do that in the Folder Options control panel. Open the Windows Explorer app (I think in Vista they protect you from yourself - you need to dbl click the Computer icon) - I think you can then set file options somewhere in there. Just google it for the specifics
    Regards
    Tim
    http://blogs.oracle.com/xmlpublisher

  • Recieving error when signing a document

    When signing a document, users are receiving >>Timestamp signature property generation error: Unsupported transport protocol
    Time Stamp Server is configued as Server URL:  IP Address of Time Server
    Any ideas on how to resolve this error?

    Hi,
    The problem is probably the URL for the timestamp server is an SSL address (i.e. https://) and the certificate that the OS needs to validate the SSL connection is not available. One thing to try is to copy the address for the timestamp server and paste it into a browser. This may give you the option of installing the SSL certificate.
    Steve

  • Error when open DMS document

    Dear DMS experts,
    After migration DMS server from one server to another an error has occurred in transaction CV03N when try open original document I got next error massage: File C:\temp\file_name cannot be created (Message no. 26172).
    This happens when I try to open the documents that have already been previously saved, the documents are saved now - open normally.
    In tr. SLG1 I see the following errors:
    1. Error
    Long Text:
    An error occurred when calling module SCMS_DOC_READ_FILES
    Message no. 1R579
    Diagnosis
    Exception number 14 occurred when function module SCMS_DOC_READ_FILES was called with document 0050569339A51ED4828753F4B06C13F3.
    Details:
    In tr. SLG1
    MANDT      200
    STOR_CAT    ZDMS_C1_ST
    PATH       C:\temp\
    FRONTEND   X
    COMP_NAMES %D0%9D%D0%B0%D0%BA%D0%B0%D0%B7 1029 26122012.tif
    COMP_NAMES File_name
    ERRMSG     Content repository DMS_C1 does not exist
    V1 SCMS_DOC_READ_FILES
    V2 14
    V3         DMS_PCD1
    V4         0050569339A51ED4828753F4B06C13F3
    %LOGNUMBER 00000000000000111877
    2. Error
    Connect Error: Connect to Host IP_HOST_DMS_SERVER Port 1090 error: NIECONN_REFUSED
    Message no. 04100
    I run Programs, and get next result:
    1. Program RSIRCCON. My location is spelled correctly but when I run program, chose my repository and run Single_Test I receive next result:
    Error when setting up connection.
    2. Program RSHTTP05
    SAPHTTP check
    Check RFC destination SAPHTTP...
    ... OK.
    Ping RFC destination SAPHTTP...
    ... OK.
    Check RFC destination SAPHTTPA...
    ... OK.
    Ping RFC destination SAPHTTPA...
    ... OK.
    3. Program RSHTTP20
    Connect Error: NiHostToAddr  error: NIEHOST_UNKNOWN
    Message no. 04100
    In SMICM->trace file -> display all.
    I see many massage like this:
    [Thr 5196] Wed Apr 08 09:11:00 2015
    [Thr 5196] *** WARNING => Connection request from (13/14/0) to host: IP_HOST, service: 1090 failed (NIECONN_REFUSED)
    [Thr 5196]  {000105f9} [icxxconn.c 2271]
    [Thr 4904] *** WARNING => Connection request from (13/14/0) to host: pwdf2625, service: 1090 failed (NIEHOST_UNKNOWN)
    [Thr 4904]  {000105fc} [icxxconn.c 2271]
    I do not know this problem relates to the existing or not yet, but I don’t know what is IP_HOST, none of my server does not have this address.
    My Storage Categories: ZDMS_C1_ST
    In SM59 SAPFTPA is working, but SAPHTTP don’t work. After change program SAPHTTP  on a SAPGUI front-end, SAPHTTP is working.
    I try ping my DMS – ok
    In tr. CSADMIN I checked connection - all good.
    Status: Running
    Try test «nipping» on both servers all fine.
    Tried to change the version of SAPGUI - did not help.
    My system parameters DMS server:
    OS: Windows Server 2012
    DB: MAXDB Database Studio
    I can not understand what the problem is because already migrate  the server and it was all good
    Thank you in advance.
    Regards,
    Vitaliy

    Hi S S B ,
    I'm sorry, I have laid out a mistake with the old Content  repository DMS_C1, my new new  Content  repository ZDMS.
    In SLG1 I have next error:
    1. Error: Problem class Other:
    Connect Error: Connect to Host My_DMS_HOST Port 1090 error: NIECONN_REFUSED
    Message no. 04100
    2. Error: Problem class Additional Information
    Long Text exists:
    An error occurred when calling module SCMS_DOC_READ_FILES
    Message no. 1R579
    Diagnosis
    Exception number 14 occurred when function module SCMS_DOC_READ_FILES was called with document 0050569339A51ED482808B4B77CD53F3.
    Detail exists:
    MANDT      200
    STOR_CAT   ZDMS_C1_ST
    PATH       C:\temp\
    FRONTEND   X
    COMP_NAMES %D0%9D%D0%B0%D0%BA%D0%B0%D0%B7 1029 26122012.tif
    COMP_NAMES Наказ 1029  26122012.tif
    ERRMSG     HTTP error: 404 (Not Found)  ""
    V1         SCMS_DOC_READ_FILES
    V2 14
    V3         DMS_PCD1
    V4         0050569339A51ED482808B4B77CD53F3
    %LOGNUMBER 00000000000000111957
    Regards,
    Vitaliy

Maybe you are looking for

  • How do I add a mailbox on my 4S?

    The manual clearly says to add a mailbox "Go the the mailboxes list, tap Edit, then tap New Mailbox".  There is no "Edit" option on my mailboxes screen

  • How do I send ATT Customer Service a Personal Note?

    Hello, ! Thanks for posting. If you need help with an account-specific issue, please click here to send us a private message with your contact information, the best time to reach you, and a brief summary of the issue. You can expect a reply within t

  • WICTMS not picking up wip_move_txn_interface records

    I am populating the wip_move_txn_interface table with a move record.  The WIP Move Transaction Manager (WICTMS) is running every 5 minutes.  But my record in the table is not getting processed.  3 days ago it was working, and the WICTMS pgm was recog

  • How to install super drive?

    Hi. I want to install a super dirve on my titanium laptop though, I heard that the titanium needs a special enclosure for the drive to fit correctly. Would do you help me out? Thank you. Powerbook G4 Titanium 667MHz Combo Drive   Mac OS X (10.3.9)  

  • Deletion of bookmarks from RSWR_DATA table based on 'Last access' date

    We want to delete the 7.X bookmarks from RSWR_DATA table based on ‘Last accessed’ date. The program RSWR_BOOKMARK_REORG does not provide the selection criteria to delete the bookmarks based on last accessed date. Is there any alternative program that