webMethods

 View Only
Expand all | Collapse all

Unable to throw exception using FileOutputStream

  • 1.  Unable to throw exception using FileOutputStream

    Posted Fri July 21, 2006 10:54 PM

    I’m tryng to write a java services which writes a file. The problem with the code is its unable to thow exception in WM6.5. The same code in eclips throws an exception. If the location or when unable to write file to the location. Can anyone help me how to solve this.
    // pipeline
    IDataHashCursor pipelineCursor = pipeline.getHashCursor();
    pipelineCursor.first( “file” );
    String file = (String) pipelineCursor.getValue();
    pipelineCursor.first( “dataWrite” );
    String dataWrite = (String) pipelineCursor.getValue();
    pipelineCursor.destroy();
    try
    {
    FileOutputStream fout = new FileOutputStream( file, true ) ;
    {
    fout.write( dataWrite.getBytes() ) ;
    fout.flush() ;
    fout.close() ;
    }
    }
    catch ( IOException e ) { System.err.println("Error in File " + e); }


    #webMethods
    #Flow-and-Java-services
    #Integration-Server-and-ESB


  • 2.  RE: Unable to throw exception using FileOutputStream

    Posted Sat July 22, 2006 12:46 AM

    Change your catch block to this:

    catch (IOException e)
    {
    //System.err.println("Error in File " + e);
    throw new ServiceException(e);
    }


    #webMethods
    #Flow-and-Java-services
    #Integration-Server-and-ESB