[Libreoffice-commits] core.git: Branch 'distro/cib/libreoffice-6-1' - 2 commits - scripting/java

Samuel Mehrbrodt (via logerrit) logerrit at kemper.freedesktop.org
Sun Dec 15 20:07:33 UTC 2019


 scripting/java/com/sun/star/script/framework/provider/beanshell/ScriptEditorForBeanShell.java |   18 ++++++++--
 1 file changed, 15 insertions(+), 3 deletions(-)

New commits:
commit bd785e8091c90df6ed5fbe51bba96929664356f6
Author:     Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
AuthorDate: Wed Mar 27 09:54:39 2019 +0100
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Sun Dec 15 21:06:57 2019 +0100

    Beanshell: Display full exception message
    
    Useful to see where exactly the error occured
    
    Change-Id: I716f54c4b1286d705b52f19a58f36f28a801e1d0
    Reviewed-on: https://gerrit.libreoffice.org/69799
    Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
    Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
    (cherry picked from commit 3d54a104ae97a3218bf58eb38f28c03e26ba7e43)
    Reviewed-on: https://gerrit.libreoffice.org/85034
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
    Tested-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/scripting/java/com/sun/star/script/framework/provider/beanshell/ScriptEditorForBeanShell.java b/scripting/java/com/sun/star/script/framework/provider/beanshell/ScriptEditorForBeanShell.java
index 804cb9fbfb8e..c6f93015424f 100644
--- a/scripting/java/com/sun/star/script/framework/provider/beanshell/ScriptEditorForBeanShell.java
+++ b/scripting/java/com/sun/star/script/framework/provider/beanshell/ScriptEditorForBeanShell.java
@@ -383,7 +383,7 @@ public class ScriptEditorForBeanShell implements ScriptEditor, ActionListener {
             try {
                 execute();
             } catch (Exception invokeException) {
-                showErrorMessage(invokeException.getMessage());
+                showErrorMessage(invokeException.toString());
             }
         } else if (actionCommand.equals("Close")) {
             doClose();
commit 1afffe8d5d8b63289de331f8c7ed01933377d551
Author:     Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
AuthorDate: Wed Mar 27 09:54:17 2019 +0100
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Sun Dec 15 21:06:46 2019 +0100

    Beanshell: Wrap long error messages
    
    Change-Id: I5e607f4b94733700810d37c289f6cc29492da5f2
    Reviewed-on: https://gerrit.libreoffice.org/69798
    Tested-by: Jenkins
    Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
    (cherry picked from commit 3c72945de874aceb12a405c03f5b0c8b3937f5cf)
    Reviewed-on: https://gerrit.libreoffice.org/85033
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
    Tested-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/scripting/java/com/sun/star/script/framework/provider/beanshell/ScriptEditorForBeanShell.java b/scripting/java/com/sun/star/script/framework/provider/beanshell/ScriptEditorForBeanShell.java
index 32fa751351d0..804cb9fbfb8e 100644
--- a/scripting/java/com/sun/star/script/framework/provider/beanshell/ScriptEditorForBeanShell.java
+++ b/scripting/java/com/sun/star/script/framework/provider/beanshell/ScriptEditorForBeanShell.java
@@ -41,6 +41,7 @@ import java.util.Map;
 
 import javax.swing.JButton;
 import javax.swing.JComponent;
+import javax.swing.JDialog;
 import javax.swing.JFrame;
 import javax.swing.JOptionPane;
 import javax.swing.JPanel;
@@ -254,9 +255,20 @@ public class ScriptEditorForBeanShell implements ScriptEditor, ActionListener {
         frame.setVisible(true);
     }
 
+    // Wraps long error messages
+    class NarrowOptionPane extends JOptionPane {
+        private static final long serialVersionUID = 1L;
+        public int getMaxCharactersPerLineCount() {
+            return 100;
+        }
+    }
+
     private void showErrorMessage(String message) {
-        JOptionPane.showMessageDialog(frame, message,
-                                      "Error", JOptionPane.ERROR_MESSAGE);
+        JOptionPane optionPane = new NarrowOptionPane();
+        optionPane.setMessage(message);
+        optionPane.setMessageType(JOptionPane.ERROR_MESSAGE);
+        JDialog dialog = optionPane.createDialog(null, "Error");
+        dialog.setVisible(true);
     }
 
     private void initUI() {


More information about the Libreoffice-commits mailing list