Revision: 429
          http://svn.sourceforge.net/stripes/?rev=429&view=rev
Author:   tfenne
Date:     2006-10-05 19:12:39 -0700 (Thu, 05 Oct 2006)

Log Message:
-----------
Fix for STS-277: NPE on package-less classes in options-collection tag.

Modified Paths:
--------------
    trunk/stripes/src/net/sourceforge/stripes/tag/InputOptionsCollectionTag.java
    
trunk/stripes/src/net/sourceforge/stripes/tag/InputOptionsEnumerationTag.java

Modified: 
trunk/stripes/src/net/sourceforge/stripes/tag/InputOptionsCollectionTag.java
===================================================================
--- 
trunk/stripes/src/net/sourceforge/stripes/tag/InputOptionsCollectionTag.java    
    2006-10-06 02:03:22 UTC (rev 428)
+++ 
trunk/stripes/src/net/sourceforge/stripes/tag/InputOptionsCollectionTag.java    
    2006-10-06 02:12:39 UTC (rev 429)
@@ -189,14 +189,15 @@
                 Object value = (valueProperty == null) ? item : 
BeanUtil.getPropertyValue(valueProperty, item);
 
                 // Try to localize the label
+                String packageName = clazz.getPackage() == null ? "" : 
clazz.getPackage().getName();
                 String localizedLabel = null;
                 if (label != null) {
                     localizedLabel = LocalizationUtility.getLocalizedFieldName
-                        (clazz.getSimpleName() + "."  + label, 
clazz.getPackage().getName(), locale);
+                        (clazz.getSimpleName() + "."  + label, packageName, 
locale);
                 }
                 if (localizedLabel == null && value != null) {
                     localizedLabel = LocalizationUtility.getLocalizedFieldName
-                        (clazz.getSimpleName() + "."  + value, 
clazz.getPackage().getName(), locale);
+                        (clazz.getSimpleName() + "."  + value, packageName, 
locale);
                 }
                 if (localizedLabel != null) label = localizedLabel;
 

Modified: 
trunk/stripes/src/net/sourceforge/stripes/tag/InputOptionsEnumerationTag.java
===================================================================
--- 
trunk/stripes/src/net/sourceforge/stripes/tag/InputOptionsEnumerationTag.java   
    2006-10-06 02:03:22 UTC (rev 428)
+++ 
trunk/stripes/src/net/sourceforge/stripes/tag/InputOptionsEnumerationTag.java   
    2006-10-06 02:12:39 UTC (rev 429)
@@ -116,10 +116,11 @@
             for (Enum item : enums) {
                 Object value = item.name();
                 Object label = null;
+                String packageName = clazz.getPackage() == null ? "" : 
clazz.getPackage().getName();
 
                 // Check for a localized label using class.ENUM_VALUE and 
package.class.ENUM_VALUE
                 label = 
LocalizationUtility.getLocalizedFieldName(clazz.getSimpleName() + "." + 
item.name(),
-                                                                  
clazz.getPackage().getName(),
+                                                                  packageName,
                                                                   locale);
                 if (label == null) {
                     if (getLabel() != null) {


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development

Reply via email to