svn commit: r1040890 - /ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1040890 - /ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java

jleroux@apache.org
Author: jleroux
Date: Wed Dec  1 08:29:21 2010
New Revision: 1040890

URL: http://svn.apache.org/viewvc?rev=1040890&view=rev
Log:
A patch from Felice Romano "NPE when calling org.ofbiz.entity.model.ModelEntity.getTableName(null)" (https://issues.apache.org/jira/browse/OFBIZ-4040) - OFBIZ-4040

When "table name" is required to a "model entity" object, it throws a NPE if "datasource info" object is null.

JLR: I'm not quite sure in which occasions this fix is needed OOTB, but anyway it's safer indeed.

Modified:
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java?rev=1040890&r1=1040889&r2=1040890&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java Wed Dec  1 08:29:21 2010
@@ -368,7 +368,7 @@ public class ModelEntity extends ModelIn
 
     /** The table-name of the Entity including a Schema name if specified in the datasource config */
     public String getTableName(DatasourceInfo datasourceInfo) {
-        if (UtilValidate.isNotEmpty(datasourceInfo.schemaName)) {
+        if (datasourceInfo!=null && UtilValidate.isNotEmpty(datasourceInfo.schemaName)) {
             return datasourceInfo.schemaName + "." + this.tableName;
         } else {
             return this.tableName;