summaryrefslogtreecommitdiff
path: root/reportbuilder
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-11-27 17:42:16 +0000
committerCaolán McNamara <caolanm@redhat.com>2018-11-28 13:11:20 +0100
commit57bfb56972dc101200466054f0f9446301c214cb (patch)
treeece75caa8761b8ce61083bf009170c5c8a2b1973 /reportbuilder
parente8e3b00bafefffa1b8a35c5721988fb3bf1f817c (diff)
Resolves: tdf#94446 if this is a SQLException in disguise, throw that instead
instead of the wrapper exception, so that dbaccess can apply its special handling for SQLException::ErrorCode of dbtools::ParameterInteractionCancelled in OLinkedDocumentsAccess::open if ParameterInteractionCancelled was the root cause Change-Id: I777893cf7355d8c4a9c48237284903176d81402d Reviewed-on: https://gerrit.libreoffice.org/64123 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'reportbuilder')
-rw-r--r--reportbuilder/java/org/libreoffice/report/pentaho/SOReportJobFactory.java27
1 files changed, 27 insertions, 0 deletions
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/SOReportJobFactory.java b/reportbuilder/java/org/libreoffice/report/pentaho/SOReportJobFactory.java
index 6c70a3425d90..4c799cd27326 100644
--- a/reportbuilder/java/org/libreoffice/report/pentaho/SOReportJobFactory.java
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/SOReportJobFactory.java
@@ -38,6 +38,9 @@ import com.sun.star.registry.InvalidRegistryException;
import com.sun.star.registry.InvalidValueException;
import com.sun.star.registry.XRegistryKey;
import com.sun.star.registry.XSimpleRegistry;
+import com.sun.star.sdbc.SQLException;
+import org.jfree.report.ReportDataFactoryException;
+import org.libreoffice.report.DataSourceException;
import org.libreoffice.report.DataSourceFactory;
import org.libreoffice.report.JobProperties;
import org.libreoffice.report.ReportEngineParameterNames;
@@ -194,6 +197,26 @@ public class SOReportJobFactory
return currentLocale;
}
+ // tdf#94446 if this is a SQLException in disguise, throw that
+ // original exception instead of the wrapper exception, so that
+ // dbaccess can apply its special handling for
+ // SQLException::ErrorCode of dbtools::ParameterInteractionCancelled
+ // in OLinkedDocumentsAccess::open if ParameterInteractionCancelled
+ // was the root cause
+ public void rethrow_sql_exception(Throwable exception)
+ throws com.sun.star.sdbc.SQLException
+ {
+ if (exception instanceof ReportDataFactoryException == false)
+ return;
+ exception = ((ReportDataFactoryException)exception).getParent();
+ if (exception instanceof DataSourceException == false)
+ return;
+ exception = ((DataSourceException)exception).getCause();
+ if (exception instanceof SQLException == false)
+ return;
+ throw (SQLException)exception;
+ }
+
public Object execute(final NamedValue[] namedValue)
throws com.sun.star.lang.IllegalArgumentException, com.sun.star.uno.Exception
{
@@ -223,6 +246,10 @@ public class SOReportJobFactory
Writer result = new StringWriter();
PrintWriter printWriter = new PrintWriter(result);
e.printStackTrace(printWriter);
+
+ // if this is a wrapped SQLException, rethrow that instead
+ rethrow_sql_exception(e.getCause());
+
throw new com.sun.star.lang.WrappedTargetException(e, e.toString() + '\n' + result.toString(), this, null);
}
catch (java.lang.IncompatibleClassChangeError e)