db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bpendle...@apache.org
Subject svn commit: r1730254 - /db/derby/code/trunk/java/tools/org/apache/derby/iapi/tools/i18n/LocalizedResource.java
Date Sat, 13 Feb 2016 17:15:22 GMT
Author: bpendleton
Date: Sat Feb 13 17:15:22 2016
New Revision: 1730254

URL: http://svn.apache.org/viewvc?rev=1730254&view=rev
DERBY-6828: Network Server fails to start in Czech locale.

LocalizedResource.getTextMessage has special exception-handling behavior
for situations where the chosen ResourceBundle does not contain the
message key that we are trying to format.

The exception handler simply displays the message key, together with
any arguments to the message.

But some messages have no arguments, for example the message
DRDA_SecurityInstalled.I has no arguments, and so NetworkServerControl
passes a null set of arguments when displaying that message.

Therefore, LocalizedResource.getTextMessage needs to include a null
guard, so that its exception handler doesn't trip over the non-existent
arguments and crash with a NullPointerException.


Modified: db/derby/code/trunk/java/tools/org/apache/derby/iapi/tools/i18n/LocalizedResource.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/tools/org/apache/derby/iapi/tools/i18n/LocalizedResource.java?rev=1730254&r1=1730253&r2=1730254&view=diff
--- db/derby/code/trunk/java/tools/org/apache/derby/iapi/tools/i18n/LocalizedResource.java
+++ db/derby/code/trunk/java/tools/org/apache/derby/iapi/tools/i18n/LocalizedResource.java
Sat Feb 13 17:15:22 2016
@@ -290,7 +290,7 @@ public final class LocalizedResource  im
 				return MessageFormat.format(res.getString(key), objectArr);
 			} catch (Exception e) {
 					String tmpFormat = key;
-					for (int i=0; i<objectArr.length; i++)
+					for (int i=0; objectArr != null && i<objectArr.length; i++)
 						tmpFormat = tmpFormat + ", <{" + (i) + "}>";
 					return MessageFormat.format(tmpFormat, objectArr);

View raw message