Kaydet (Commit) f4a2cff1 authored tarafından Lionel Elie Mamane's avatar Lionel Elie Mamane

Don't try to pass an arbitrary Java exception through UNO

also make other exceptions more verbose

Change-Id: Id6bf88b1ec228b20b19c89ccf6ee14d0c1ffb44d
üst c7435573
......@@ -45,7 +45,7 @@ public class SOImageService implements ImageService
{
if (xCompContext == null)
{
throw new ReportExecutionException();
throw new ReportExecutionException("SOImageService constructed with null Component Context");
}
......@@ -55,7 +55,7 @@ public class SOImageService implements ImageService
if (m_xGraphicProvider == null)
{
throw new ReportExecutionException("There is no graphic-provider available.");
throw new ReportExecutionException("There is no graphic-provider available for SOImageService.");
}
}
......
......@@ -61,6 +61,10 @@ import com.sun.star.uno.XComponentContext;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.io.Writer;
import java.io.PrintWriter;
import java.io.StringWriter;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
......@@ -216,12 +220,18 @@ public class SOReportJobFactory
catch (java.lang.Exception e)
{
LOGGER.error("ReportProcessing failed", e);
throw new com.sun.star.lang.WrappedTargetException(e, e.getMessage(), this, null);
Writer result = new StringWriter();
PrintWriter printWriter = new PrintWriter(result);
e.printStackTrace(printWriter);
throw new com.sun.star.lang.WrappedTargetException(e.toString() + '\n' + result.toString(), this, null);
}
catch (java.lang.IncompatibleClassChangeError e2)
catch (java.lang.IncompatibleClassChangeError e)
{
LOGGER.error("Detected an IncompatibleClassChangeError");
throw new com.sun.star.lang.WrappedTargetException(e2, "caught a " + e2.getClass().getName(), this, new com.sun.star.uno.Exception(e2.getLocalizedMessage()));
Writer result = new StringWriter();
PrintWriter printWriter = new PrintWriter(result);
e.printStackTrace(printWriter);
throw new com.sun.star.lang.WrappedTargetException(e.toString() + '\n' + result.toString(), this, null);
}
Thread.currentThread().setContextClassLoader(cl);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment