You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by bp...@apache.org on 2016/02/13 18:15:22 UTC

svn commit: r1730254 - /db/derby/code/trunk/java/tools/org/apache/derby/iapi/tools/i18n/LocalizedResource.java

Author: bpendleton
Date: Sat Feb 13 17:15:22 2016
New Revision: 1730254

URL: http://svn.apache.org/viewvc?rev=1730254&view=rev
Log:
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

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 (original)
+++ 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);
 			}