Uploaded image for project: 'Apache Jena'
  1. Apache Jena
  2. JENA-517

Unhandled IOException during model write to OutputStream

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • Jena 2.10.1
    • Jena 2.11.0
    • Jena
    • None

    Description

      Method "N3JenaWriterCommon.write()" silently ignores IOException from Writer.flush() while writing a model to an OutputStream.

      This might lead to debugging nightmares.

      Should at the very least throw some runtime exception wrapping the original exception

      	@Override
          public synchronized void write(Model model, OutputStream output, String base) 
      	{
      		try {
      			Writer w =  new BufferedWriter(new OutputStreamWriter(output, "UTF-8")) ;
      			write(model, w, base) ;
      			try { w.flush() ; } catch (IOException ioEx) {}
      		} catch (java.io.UnsupportedEncodingException ex)
      		{
      			System.err.println("Failed to create UTF-8 writer") ;
      		}
      	}
      

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            andy Andy Seaborne
            hovenko Knut-Olav Hoven
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment