From: <ker...@us...> - 2014-08-30 14:56:19
|
Revision: 23673 http://sourceforge.net/p/jedit/svn/23673 Author: kerik-sf Date: 2014-08-30 14:56:16 +0000 (Sat, 30 Aug 2014) Log Message: ----------- less drastic error reporting (less stacktraces) Modified Paths: -------------- plugins/XSLT/trunk/xslt/XSLTPlugin.java plugins/XSLT/trunk/xslt/XSLTProcessor.java plugins/XSLT/trunk/xslt/XsltActions.java Modified: plugins/XSLT/trunk/xslt/XSLTPlugin.java =================================================================== --- plugins/XSLT/trunk/xslt/XSLTPlugin.java 2014-08-30 14:56:00 UTC (rev 23672) +++ plugins/XSLT/trunk/xslt/XSLTPlugin.java 2014-08-30 14:56:16 UTC (rev 23673) @@ -30,6 +30,7 @@ import org.gjt.sp.jedit.MiscUtilities; import org.gjt.sp.jedit.Buffer; import org.gjt.sp.util.Log; +import org.gjt.sp.util.ThreadUtilities; import org.gjt.sp.jedit.msg.BufferUpdate; import org.gjt.sp.jedit.msg.PropertiesChanged; @@ -117,16 +118,24 @@ /** * Displays a user-friendly error message to go with the supplied exception. */ - static void processException(Exception e, String message, Component component) { - Log.log(Log.ERROR, XSLTPlugin.class, "complete exception:"+e.toString()); - while(e.getCause() != null && e.getCause() instanceof TransformerException){ - System.out.println("exception : "+e); - e = (Exception) e.getCause(); + static void processException(Exception e, String message, final Component component) { + Log.log(Log.WARNING, XSLTPlugin.class, "XSLT exception:"+e.toString()); + Exception root = e; + while(root.getCause() != null && root.getCause() instanceof TransformerException){ + root = (Exception) root.getCause(); } - Log.log(Log.ERROR, XSLTPlugin.class, e); - String msg = MessageFormat.format(jEdit.getProperty("xslt.message.error"), + if(root != e){ + Log.log(Log.WARNING, XSLTPlugin.class, "XSLT exception root cause:"+root.toString()); + e = root; + } + //stack trace is not helping Log.log(Log.ERROR, XSLTPlugin.class, e); + final String msg = MessageFormat.format(jEdit.getProperty("xslt.message.error"), new Object[]{message, e.getMessage()}); - JOptionPane.showMessageDialog(component, msg.toString()); + ThreadUtilities.runInDispatchThread(new Runnable(){ + public void run(){ + JOptionPane.showMessageDialog(component, msg.toString()); + } + }); } Modified: plugins/XSLT/trunk/xslt/XSLTProcessor.java =================================================================== --- plugins/XSLT/trunk/xslt/XSLTProcessor.java 2014-08-30 14:56:00 UTC (rev 23672) +++ plugins/XSLT/trunk/xslt/XSLTProcessor.java 2014-08-30 14:56:16 UTC (rev 23673) @@ -467,6 +467,7 @@ final Buffer fOutputBuffer = outputBuffer; + final Map xsltParameters = getStylesheetParameters(); Task t = new Task() { @Override @@ -477,7 +478,7 @@ InputSource inputSource = xml.Resolver.instance().resolveEntity(/*publicId*/null,path); - XSLTUtilities.transform(inputSource, stylesheets , getStylesheetParameters(), result, listener); + XSLTUtilities.transform(inputSource, stylesheets , xsltParameters, result, listener); } catch(SAXParseException spe){ listener.sendSAXError(spe); Modified: plugins/XSLT/trunk/xslt/XsltActions.java =================================================================== --- plugins/XSLT/trunk/xslt/XsltActions.java 2014-08-30 14:56:00 UTC (rev 23672) +++ plugins/XSLT/trunk/xslt/XsltActions.java 2014-08-30 14:56:16 UTC (rev 23673) @@ -28,15 +28,13 @@ import org.gjt.sp.util.Task; import org.gjt.sp.util.ThreadUtilities; import org.gjt.sp.jedit.gui.DockableWindowManager; -import org.gjt.sp.jedit.MiscUtilities; import javax.swing.JOptionPane; import javax.swing.SwingUtilities; +import javax.xml.transform.TransformerException; -import java.util.Hashtable; +import org.xml.sax.SAXException; -import org.xml.sax.SAXParseException; - import xml.PathUtilities; import java.net.URL; @@ -126,6 +124,12 @@ XSLTUtilities.compileStylesheet(path, listener); + } catch(TransformerException e){ + Log.log(Log.WARNING,XsltActions.class,e.toString()); + } catch(SAXException e){ + Log.log(Log.WARNING,XsltActions.class,e.toString()); + } catch(IOException e){ + Log.log(Log.WARNING,XsltActions.class,e.toString()); } catch (Exception e) { Log.log(Log.ERROR,XsltActions.class,e); } @@ -181,7 +185,6 @@ } } } - String dir = MiscUtilities.getParentOfPath(view.getBuffer().getPath()); // set up 3 untitled buffers view.unsplit(); view.splitHorizontally(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |