poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 60102] Improve error message when writing a document that has been closed
Date Sat, 10 Sep 2016 23:30:31 GMT
https://bz.apache.org/bugzilla/show_bug.cgi?id=60102

--- Comment #4 from Javen O'Neal <onealj@apache.org> ---
Created attachment 34231
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=34231&action=edit
Replace OpenXML4J return boolean with throws OpenXML4JException

(In reply to Javen O'Neal from comment #3)
> I have not yet implemented throwing an exception when writing an open
> document to a closed output stream.
> OutputStream out;
> out.close();
> doc.write(out);

To get this one closed, we're going to have to make quite a few changes to 
methods in org.apache.poi.openxml4j.opc.internal.
These methods currently catch exceptions, occasionally log the error to the
POILogger, and then return a boolean success value.
These will need to be replaced with void-returning functions that raise an
exception. This will eliminate the need to check a return code, enable the POI
logger, and check the logs.

A quick glance at the source code history reveals that the OpenXML4j classes
have returned boolean success rather than throwing exceptions. Perhaps this is
because this library originated from a C project rewritten in Java without
replacing the C idioms with Java idioms.
https://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/marshallers/DefaultMarshaller.java?revision=738842&view=markup#l41

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


Mime
View raw message