What steps will reproduce the problem?
Force an IOException to occur during marshaling. I used JUnit and Mockito e.g.
OutputStream stream = mock(OutputStream.class, new Answer<Object>() {
@Override
public Object answer(InvocationOnMock invocation) throws Throwable {
throw new IOException("an error");
}
});
kml.marshal(outputStream)
What is the expected output? What do you see instead?
I do not expect to see a stack trace printed to Standard.Err; I would prefer
the option to set an "Error Writter" that the Library can use as a target to
print the stack trace e.g. e.printStackTrace(errorWriter) or a
log.error("IOException occurred", e);
[junit] ------------- Standard Error -----------------
[junit] javax.xml.bind.MarshalException
[junit] - with linked exception:
[junit] [java.io.IOException: an error]
[junit] at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:328)
[junit] at com.sun.xml.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:251)
[junit] at javax.xml.bind.helpers.AbstractMarshallerImpl.marshal(AbstractMarshallerImpl.java:75)
[junit] at de.micromata.opengis.kml.v_2_2_0.Kml.marshal(Kml.java:683)
[junit] at com.kestrel.pitchfork.solr.gis.KmlQueryResponseWriter.write(KmlQueryResponseWriter.java:52)
[junit] at com.kestrel.pitchfork.solr.gis.KmlQueryResponseWriterTest.shouldFailIfAnIOExceptionOccursTryingToWriteKml(KmlQueryResponseWriterTest.java:197)
[junit] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[junit] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[junit] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[junit] at java.lang.reflect.Method.invoke(Method.java:597)
[junit] at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
[junit] at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
[junit] at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
[junit] at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
[junit] at org.junit.internal.runners.statements.ExpectException.evaluate(ExpectException.java:21)
[junit] at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
[junit] at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
[junit] at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
[junit] at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
[junit] at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
[junit] at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
[junit] at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
[junit] at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
[junit] at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
[junit] at junit.framework.JUnit4TestAdapter.run(JUnit4TestAdapter.java:39)
[junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:518)
[junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:1052)
[junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:879)
[junit] Caused by: java.io.IOException: an error
[junit] at com.kestrel.pitchfork.solr.gis.KmlQueryResponseWriterTest$5.answer(KmlQueryResponseWriterTest.java:182)
[junit] at org.mockito.internal.MockHandler.handle(MockHandler.java:101)
[junit] at org.mockito.internal.InvocationNotifierHandler.handle(InvocationNotifierHandler.java:36)
[junit] at org.mockito.internal.creation.MethodInterceptorFilter.intercept(MethodInterceptorFilter.java:48)
[junit] at $java.io.OutputStream$$EnhancerByMockitoWithCGLIB$$cec6ddef.write(<generated>)
[junit] at com.sun.xml.bind.v2.runtime.output.UTF8XmlOutput.flushBuffer(UTF8XmlOutput.java:418)
[junit] at com.sun.xml.bind.v2.runtime.output.UTF8XmlOutput.endDocument(UTF8XmlOutput.java:142)
[junit] at com.sun.xml.bind.v2.runtime.output.IndentingUTF8XmlOutput.endDocument(IndentingUTF8XmlOutput.java:169)
[junit] at com.sun.xml.bind.v2.runtime.XMLSerializer.endDocument(XMLSerializer.java:852)
[junit] at com.sun.xml.bind.v2.runtime.MarshallerImpl.postwrite(MarshallerImpl.java:377)
[junit] at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:324)
[junit] ... 27 more
[junit] ------------- ---------------- ---------------
What version of the product are you using? On what operating system?
* downloaded version from Jan 2010
* RHEL6
Original issue reported on code.google.com by ar...@arielvalentin.com on 15 Sep 2012 at 2:45
Original issue reported on code.google.com by
ar...@arielvalentin.com
on 15 Sep 2012 at 2:45