From 56697de4ab98c370c7a162cdef9a04c1e67b2818 Mon Sep 17 00:00:00 2001 From: kohsuke Date: Thu, 21 Oct 2010 16:00:14 +0000 Subject: [PATCH] [HUDSON-6992] a failure to locate the error resources shouldn't cause a fatal problem. git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@36130 71c3de6d-444a-0410-be80-ed276b4c234a --- core/src/main/java/hudson/Util.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/hudson/Util.java b/core/src/main/java/hudson/Util.java index 820d6df597..dbd8b9107b 100644 --- a/core/src/main/java/hudson/Util.java +++ b/core/src/main/java/hudson/Util.java @@ -80,6 +80,7 @@ import java.util.Collection; import java.util.List; import java.util.Locale; import java.util.Map; +import java.util.MissingResourceException; import java.util.ResourceBundle; import java.util.SimpleTimeZone; import java.util.StringTokenizer; @@ -396,8 +397,13 @@ public class Util { * null if no such message is available. */ public static String getWin32ErrorMessage(int n) { - ResourceBundle rb = ResourceBundle.getBundle("/hudson/win32errors"); - return rb.getString("error"+n); + try { + ResourceBundle rb = ResourceBundle.getBundle("/hudson/win32errors"); + return rb.getString("error"+n); + } catch (MissingResourceException e) { + LOGGER.log(Level.WARNING,"Failed to find resource bundle",e); + return null; + } } /** -- GitLab