Problem Opening Files converted from Javamail Attachments (io problems)

Hello,
I am streaming a Word doc attachment from a JavaMail Message object, to a file using the code below. The file shows up in the file system as the proper size, but when I attempt to open it, it says "The document or path is invalid". It seems to happen the moment I write even a single line of the stream from the BufferedReader to the DataOutputStream, let alone the entire input stream (simply creating the empty file before streaming between objects, and I can open the file without problems). I would be grateful for any insights. Thank you.
public void capture(TRIMAttachment ta, Part part){
   String filename = path + ta.getDocumentName();
   String attContent = "";
   attachmentFile = new File(filename);
   try {
      FileOutputStream fos = new FileOutputStream(attachmentFile);
      DataOutputStream dos = new DataOutputStream(fos);
      InputStreamReader isr = new InputStreamReader(part.getInputStream());
      BufferedReader br = new BufferedReader(isr);
      String s="";
      while ((s = br.readLine()) != null) {
         attContent=attContent+s;
      dos.writeBytes(attContent);
      br.close();
      isr.close();
      dos.close();
      fos.close();
      }catch(IOException ioe){
         ioe.printStackTrace();
      }catch(MessagingException me){
         me.printStackTrace();
      }

A Word document is not a text file (surprise!). You shouldn't be using
a Reader to read the content. Copy the data to the file using the
InputStream and a FileOutputStream. See the msgshow.java demo
program.

Similar Messages

  • Why will CS4 not open DNG files converted from Olympus E-M1 raw files?

    For several years I have been able to use the DNG Converter to convert .ORF raw files from my Olympus E-M1 and then open them for processing in CS4. Suddenly CS4 quit recognizing these DNG files saying "Photoshop could not complete your request because Photoshop does not recognize this type of file"
    I have not changed any preferences. I'm using E-M1 v3.0, DNG Converter v8.3.0.141 on a Mac. I have deleted DNG converter several times, even reinstalled an earlier version but nothing changes.
    However, CS4 will open DNG files converted from Pentax raw .PEF files from my K-5. Weird. It's the Olympus raw DNG conversions that won't open.
    I can view the DNG converted files in question in Mac's Preview just fine but not CS4. Any ideas will be appreciated.

    Be sure the DNG Converter's compatibility is set to provide support for your version of ACR:
    Benjamin

  • Error. your computer must be running a supported version of Microsoft Visio and a browser that supports opening files directly from Visio Web Access.

    I have the following inside my SharePoint server 2013 :-
    EnterPrise Wiki site collection.
    i have both "Excel services Application "& "Visio Graphics Service" running correctly.
    The problem i am facing is as follow:-
    when a user click on an Excel sheet or Visio document , it will be shown inside the browser without any problem.
    but if the user click on "Open in Visio" OR "Open in Excel" links inside the browser, they will get the following errors:-
    Sorry, but to open this workbook, your computer must be running a supported version of Microsoft Excel and a browser that supports opening files directly from Office Web Apps.
    To open this document, your computer must be running a supported version of Microsoft Visio and a browser that supports opening files directly from Visio Web Access.
    I have the following settings inside my PC:-
    Office 2010 for Excel, word, power point,etc.
    Visio 2013.
    i have disabled SharePoint foundation support for office 2013
    Can anyone advice on this please?

    Hi,
    Please try to reset the Internet Explorer settings or open Internet Explorer in In-Private browsing and then check if this issue occurs.
    If the issue persists, please try to access SharePoint in another computer with Office 2013 and then check if this issue occurs. Or repair Office and restart your server.
    Here is a blog about the same issue for you to take a look at:
    http://sharepointexit.blogspot.com/2013/12/sorry-but-to-open-this-workbook.html
    Best Regards
    Dennis Guo
    TechNet Community Support

  • Can't open files directly from file server (MAVERICKS)

    since updating to Mavericks earlier today i have had the below problem
    I use a file server at work to access all my work files. i have no problem accessing the servers but when i try and when I double click to open a file (excel, word, pdf, etc) it says "the application cant be found"
    when Ihave the application open and i open the same file from within the application (file > open) it works fine. I just cannot open files directly from the file server by double clicking.
    in previous versions there have been no problems with this,
    any help would be great,

    Same issue here; I hadn't related it to upgrading to the latest OS 10.9.2. I've shutdown and restared multiple times. I've also rebuilt permissions on my hard drive as I thought it was the Finder but files on my local HD open file. Off the server, I cannot double-click or even drag to the dock. Files open fine if I open the app first then browse to find the file.

  • I was informed i need to purchase standard 11 or standard 12 (?) in order to make word files converted from pdf editable. how do i do this?

    i was informed i need to purchase standard 11 or standard 12 from adobe in order to make files converted from pdf to word using the recently bought and installed adobe pdf exporter file. how/where do i do this?

    Currently the Acrobat version is "XI" (no "12").
    With Acrobat XI installed:
    "File - Save As Other"  --- from here you pick the supported file format for the export.
    If a PDF has content that is the output of a scanner then that output (as is the case for All scanners' output) is a picture of text and not real text.
    During an export all that can be processed is the picture. As a picture of text is not text it is understandable why Word (or other word processors) cannot edit the content.
    So, for such, prior to export run Acrobat's OCR and save.
    The export will be of the OCR content.
    Do expect to do clean of the text, spelling, punctuation, layout etc.
    This may be minor. This may be major. But, there will be some.
    Adobe as some online subscription services that can take a "proper" PDF (NOT all are eh) and export to supported file formats.
    Two are "ExportPDF" and "PDF Pack".
    Be well...

  • Illustrator CC 2014 can't open files sent from Draw.

    Illustrator CC 2014 v18.0.0 (just installed today, 11/6/2014): I can't open files sent from Adobe Draw. The files send from Draw OK, but in Illustrator—which finally opens as advertised—I get an error message, i.e. The file "Dog - Drawing 1.draw" is in an unknown format and cannot be opened. This goes for all of my work, whether created in Ideas then opened recently in Draw, or files created in Draw from scratch.

    Illustrator files (.ai or .pdf)  that I save using CC 2014 vs 8.1.0 on my Windows (8.1) machine on our network server. I try to open them on Mac.
    'The File "x.pdf" is an unknown format and cannot be opened'
    This may in some way be related to accessing the file over the server since when I transfer the file to my lcal drive I don't get the same error.  I still can't open the file but I get an error near the end of the opening process :
    "Could not read the file because the plug-in made an invalid request of the Photoshop adaptor"
    Again, I can open this file using CC 2014 vs 8.1.0 on my Windows (8.1) machine.

  • Photoshop does not open files sent from LR

    Photoshop CS6 Extended does not open files sent from Lightroom. 4.4 on Win 7. What is wrong? PS starts but instead in LR the error "Could not open Photoshop appears.

    BOILERPLATE TEXT:
    Note that this is boilerplate text.
    If you give complete and detailed information about your setup and the issue at hand,
    such as your platform (Mac or Win),
    exact versions of your OS, of Photoshop (not just "CS6", but something like CS6v.13.0.6) and of Bridge,
    your settings in Photoshop > Preference > Performance
    the type of file you were working on,
    machine specs, such as total installed RAM, scratch file HDs, total available HD space, video card specs, including total VRAM installed,
    what troubleshooting steps you have taken so far,
    what error message(s) you receive,
    if having issues opening raw files also the exact camera make and model that generated them,
    if you're having printing issues, indicate the exact make and model of your printer, paper size, image dimensions in pixels (so many pixels wide by so many pixels high). if going through a RIP, specify that too.
    A screen shot of your settings or of the image could be very helpful too,
    etc.,
    someone may be able to help you (not necessarily this poster, who is not a Windows user).
    Please read this FAQ for advice on how to ask your questions correctly for quicker and better answers:
    http://forums.adobe.com/thread/419981?tstart=0
    Thanks!

  • Photoshop does not open file sent from LR

    Photoshop CS6 Extended does not open files sent from Lightroom. 4.4 on Win 7. What is wrong? PS starts but instead in LR the error "Could not open Photoshop' appears.

    BTW, I tried moving the Editor app from the support file into the app folder per fixes on this issue in the past.

  • Finding open file handles from core file using mdb/dbx

    Is it possible to find open file handles from a core file? The env is Solaris 5.10 SPARC.
    regards
    becks

    Interesting question, but it's more about Solaris OS/libraries than about Sun Studio C++ compiler. While there's a chance of getting it answered here, I also recommend to post the same question on one of the OpenSolaris forums:
    http://www.opensolaris.org/jive/index.jspa?categoryID=1
    For example, mdb forum:
    http://www.opensolaris.org/jive/forum.jspa?forumID=4

  • Files converted from m4a to mp3 are not displaying correctly in feed

    hi; i recently produced my first show in garageband (after using a bunch of other audio apps in the past), exported to an m4a file, and converted to mp3 in itunes, but it is not showing up as an audio file in my feed.
    the feed is http://feeds.feedburner.com/wellroundedradio and my blog posting on it is http://wellroundedmedia.blogspot.com
    is there something you need to do when converting from m4a to mp3 in itunes to make sure the settings are all correct so it will be enclosed as an audio file? i have tested other mp3 files in the feed and they are working fine.
    thx, charlie
    ==
    charles mcenerney
    host + producer
    well-rounded radio
    http://www.wellroundedradio.net
    iBook G4   Mac OS X (10.4.8)  

    greg-
    thanks. yes, i think that's what has been so tricky about this. i add a link to an mp3 in blogger, but feedburner doesn't add this particular show as an enclosure, so it's not updating in the feed. can't seem to find where the origin of the problem, though...is it blogger, feedburner, or the mp3 file or...?
    charlie

  • Can't open files saved from Safari

    In SL, I have a new problem with files that are saved from Safari.
    I first noticed it with an Automator service I made, which took selected text and made a text file out of it. But I eventually discovered the problem seemed to be with Safari. Any time Safari saves a file -- if for example, I click a link and it downloads a .zip file, then there is something wrong with that file that prevents me from opening it in another app.
    When I try to open the saved file, either by double-clicking in the Downloads window or from the Finder, the target app just starts bouncing in the dock and never opens. I have to force-quit it. If the target app is already open, it switches to it but never opens the document.
    This is only for files that were saved by Safari. Other PDF's and zip's open just fine.
    And, if I manually launch the target app, and then go to Open... and navigate to the saved document, I can open it fine.
    Files saved from Safari seem to have something wrong with them. If I quit Safari, logout, or even reboot, they still refuse to open by double-clicking.
    What could be causing this?

    Reset safari
    Safari/Reset Safari
    Go to Your HD/Library/Internet Plug-ins/ and remove to trash the "AdobePDFViewer.plugin".
    Open Safari and a .pdf and it should now open with Preview in a Safari/Browser window.
    If not then re download
    http://get.adobe.com/uk/reader/

  • Apple ProRes HQ files (converted from HDV) will not play in Premiere Pro

    I was working on a project in premier pro and finished a draft on 12/24 with no issues.  I took these file directy from their coverted state as .mov files into the PP project and edited on the timeline with no issues.  Shut down on 12/24.  Opened project today, none of the files from the HDV converted format will play correctly OR export correctly.  They are all Black video and still contain the right audio. 
    As a side note here, this is the same for trying to play the file in Quicktime AND in Apple's Final Cut Pro 7. 
    The only files affected are those that were uploaded and coverted to Apple ProRes HQ from the HDV format. 
    Again, this was working and functioning fine un Tuesday, now they appear black in the timeline and viewers. 
    Only change made to ANYTHING on my iMac is: Updated iTunes on Tuesday after I had closed the project from Premiere Pro.
    Please help!!!
    Thankyou,
    Clede

    Only change made to ANYTHING on my iMac is: Updated iTunes on Tuesday after I had closed the project from Premiere Pro.
    Sounds like a clue.
    Apple / Mac  updates have a history of creating issues and plenty of evidence supports that statement.
    My guess its a QT version issue.

  • Finding hard and soft open file limits from within jvm in linux

    Hi All,
    I have a problem where I need to find out the hard and soft open file limits for the process in linux from within a java program. When I execute ulimit from the terminal it gives separate values for hard and soft open file limits.
    From shell if I run the command then the output is given below:
    $ ulimit -n
    1024
    $ ulimit -Hn
    4096
    The java program is given below:
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.InputStreamReader;
    import java.io.Reader;
    import java.io.StringWriter;
    import java.io.Writer;
    public class LinuxInteractor {
    public static int executeCommand(String command, boolean waitForResponse, OutputHandler handler) {
    int shellExitStatus = -1;
    ProcessBuilder pb = new ProcessBuilder("bash", "-c", command);
    pb.redirectErrorStream(true);
    try {
    Process shell = pb.start();
    if (waitForResponse) {
    // To capture output from the shell
    InputStream shellIn = shell.getInputStream();
    // Wait for the shell to finish and get the return code
    shellExitStatus = shell.waitFor();
    convertStreamToStr(shellIn, handler);
    shellIn.close();
    catch (IOException e) {
    System.out
    .println("Error occured while executing Linux command. Error Description: "
    + e.getMessage());
    catch (InterruptedException e) {
    System.out
    .println("Error occured while executing Linux command. Error Description: "
    + e.getMessage());
    return shellExitStatus;
    public static String convertStreamToStr(InputStream is, OutputHandler handler) throws IOException {
    if (is != null) {
    Writer writer = new StringWriter();
    char[] buffer = new char[1024];
    try {
    Reader reader = new BufferedReader(new InputStreamReader(is,
    "UTF-8"));
    int n;
    while ((n = reader.read(buffer)) != -1) {
    String output = new String(buffer, 0, n);
    writer.write(buffer, 0, n);
    if(handler != null)
    handler.execute(output);
    } finally {
    is.close();
    return writer.toString();
    } else {
    return "";
    public abstract static class OutputHandler {
    public abstract void execute(String str);
    public static void main(String[] args) {
    OutputHandler handler = new OutputHandler() {
    @Override
    public void execute(String str) {
    System.out.println(str);
    System.out.print("ulimit -n : ");
    LinuxInteractor.executeCommand("ulimit -n", true, handler);
    System.out.print("ulimit -Hn : ");
    LinuxInteractor.executeCommand("ulimit -Hn", true, handler);
    If I run this program the output is given below:
    $ java LinuxInteractor
    ulimit -n : 4096
    ulimit -Hn : 4096
    I have used ubuntu 12.04, Groovy Version: 1.8.4 JVM: 1.6.0_29 for this execution.
    Please help me in understanding this behavior and how do I get a correct result from withing the java program.

    Moderator Action:
    As mentioned in one of the earlier responses:
    @OP this is not a Java question. I suggest you take it elsewhere, i.e. to a Unix or Linux forum.You posted this to a Java programming forum.
    It is not a Java programming inquiry.
    This off-topic thread is locked.
    Additionally, you have answered your own question.
    Don't bother posting it to one of the OS forums. It will get deleted as a duplicate cross-post.

  • Need a file converted from InD CS5 to InD CS4...

    Had someone do some work for me and their source file came as a CS5 InDesign version 7 file (I think)... which I cannot open in CS4 InD version 6.  Is there such as thing as file converter of some kind or do I need to have them or someone else open it in CS5 and save it in some compatible format?

    Yes (well, to the 2nd part of your question).
    Ask someone who has a CS5 to save it as IDML, or (always an option!) download the fully functional trial of CS5, and you have about 30 days to do it yourself.

  • I cannot open files directly from Lightroom 4 into Photoshop CS5.

    I recently changed to new Macbook Pro and uploaded my Lightroom 4 and Photoshop CS5.
    Now when I go to 'Photo - Edit in - Photoshop' in Lightroom 4. Photoshop opens. But no image appears.
    I've updated the Camera Raw reader but this hasn't helped.
    Anyone got a suggestion that might help?
    I have been making attempts to download updates for my Photoshop PS5 but after 4 attempts I get the same failed window asking me to try later.
    Anyone any suggestions?
    Thanks in advance.

    It is important to understand how Lr works.
    Lr displays photos only when they are imported into Lr. A (seeming) exception is for a Raw image that is edited in Photoshop and <Saved> to the default settings that you selected in external editing of Preferences in Lr. So if the default setting is for PSD and you just hit <Save> in Photoshop, a PSD will be created and automatically imported back into Lr so that it will be displayed there. So, this is not really an exception from the rule that an image has to be imported into Lr - it is an automatic import. This automatic import works only for the <Save> to the default settings;it does not work when you do a <Save As> and select a different file format than the default setting. In your case you did a <Save as> to create a JPG. This JPG will not be automatically imported into Lr, you have to import it manually - either through the Import Dialog or by <Synchronize Folder>.
    Apart from that, and as JimHess said, why do you create a JPG in Photoshop from the same file? If you need a JPG, in Lr just export your PSD as a JPG when you need it.
    I often need JPGs from my file, but I create them only when needed by exporting them to a folder of my choice. Usually I delete them after a while. I don't see a reason why I should have JPGs sitting around on my hard drive(s). They can be created again (from the Raw files or from PSD's/Tiffs) if the need arises.

Maybe you are looking for

  • Can't get iCal alarm to work

    I've tried everything that I've read ... but I can't get the alarm to work - Does anyone else have this problem OR solution? Thx in advance!

  • Dell connection to a Mac network....NOT WORKING!

    OK, here is the situation. I am a Mac user and was given a old Dell with Windowz XP Pro. I already have a Mac network with two macs and a printer. They both can connect to my DSL perfectly. When I was given the Dell, I figured I wanted to connect it

  • How to cancel/reverse a reversal document

    Hi A user has by mistake entered the reversal reason as "05 - Accrual) which has resulted in the reversal entry being posted to the next period. This document need to be reversed in the original period. However the system (FBRA/FB08) does not allow t

  • Online manual for the HP envy 7640

    I cannot find a URL to use with my Safari browser to get an online manual for my envy 7640. The one I get form the hp support page brings up a grayed out url and empty page

  • Export Mailbox from Exchange 2010 and Import to Exchange 2007

    Hello, I exported mailbox (1GB in size) from Exchange 2010 to *.pst file; I need to import it into Exchange 2007 mailbox. Is it supported ? The operation completed successfully (no errors) but no items were imported; is it due to unsupported backward