You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by Adam Heath <do...@brainfood.com> on 2010/12/01 18:57:59 UTC

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

On 12/01/2010 02:29 AM, jleroux@apache.org wrote:
> 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)) {

Bad formatting, use ' ' around operators.


>               return datasourceInfo.schemaName + "." + this.tableName;
>           } else {
>               return this.tableName;
>
>