From af60f2b190bc8f7e6c59d8193531faea117d3abb Mon Sep 17 00:00:00 2001 From: kohsuke Date: Tue, 10 Jul 2007 00:42:41 +0000 Subject: [PATCH] improved error diagnosis. the logic that looks into the chained exceptions were wrong. git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@3629 71c3de6d-444a-0410-be80-ed276b4c234a --- core/src/main/java/hudson/Util.java | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/core/src/main/java/hudson/Util.java b/core/src/main/java/hudson/Util.java index fc724b1365..0a7b745450 100644 --- a/core/src/main/java/hudson/Util.java +++ b/core/src/main/java/hudson/Util.java @@ -213,22 +213,21 @@ public class Util { */ public static String getWin32ErrorMessage(Throwable e) { String msg = e.getMessage(); - if(msg==null) { - if(e.getCause()!=null) - return getWin32ErrorMessage(e.getCause()); - return null; // no message + if(msg!=null) { + Matcher m = errorCodeParser.matcher(msg); + if(m.matches()) { + try { + ResourceBundle rb = ResourceBundle.getBundle("/hudson/win32errors"); + return rb.getString("error"+m.group(1)); + } catch (Exception _) { + // silently recover from resource related failures + } + } } - Matcher m = errorCodeParser.matcher(msg); - if(!m.matches()) - return null; // failed to parse - try { - ResourceBundle rb = ResourceBundle.getBundle("/hudson/win32errors"); - return rb.getString("error"+m.group(1)); - } catch (Exception _) { - // silently recover from resource related failures - return null; - } + if(e.getCause()!=null) + return getWin32ErrorMessage(e.getCause()); + return null; // no message } /**