From 8aae7754e1025ef4b0065c2aaa573a9bc3be0561 Mon Sep 17 00:00:00 2001 From: kohsuke Date: Fri, 22 Jun 2007 00:31:13 +0000 Subject: [PATCH] find win32 error message even if it's nested. git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@3497 71c3de6d-444a-0410-be80-ed276b4c234a --- core/src/main/java/hudson/Util.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/hudson/Util.java b/core/src/main/java/hudson/Util.java index 101f9544c6..8b41532e1a 100644 --- a/core/src/main/java/hudson/Util.java +++ b/core/src/main/java/hudson/Util.java @@ -201,16 +201,23 @@ public class Util { listener.getLogger().println(msg); } + public static String getWin32ErrorMessage(IOException e) { + return getWin32ErrorMessage((Throwable)e); + } + /** - * Extracts the Win32 error message from {@link IOException} if possible. + * Extracts the Win32 error message from {@link Throwable} if possible. * * @return * null if there seems to be no error code or if the platform is not Win32. */ - public static String getWin32ErrorMessage(IOException e) { + public static String getWin32ErrorMessage(Throwable e) { String msg = e.getMessage(); - if(msg==null) + if(msg==null) { + if(e.getCause()!=null) + return getWin32ErrorMessage(e.getCause()); return null; // no message + } Matcher m = errorCodeParser.matcher(msg); if(!m.matches()) return null; // failed to parse