Author: doogie
Date: Sun May 30 22:07:16 2010 New Revision: 949610 URL: http://svn.apache.org/viewvc?rev=949610&view=rev Log: Remove double assignment to addParens(slight optimization/code refactor). Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java?rev=949610&r1=949609&r2=949610&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java Sun May 30 22:07:16 2010 @@ -787,8 +787,7 @@ public class GenericDAO { StringBuilder whereString = new StringBuilder(); if (entityCondWhereString.length() > 0) { - boolean addParens = false; - if (entityCondWhereString.charAt(0) != '(') addParens = true; + boolean addParens = entityCondWhereString.charAt(0) != '('; if (addParens) whereString.append("("); whereString.append(entityCondWhereString); if (addParens) whereString.append(")"); @@ -796,8 +795,7 @@ public class GenericDAO { if (UtilValidate.isNotEmpty(viewEntityCondWhereString)) { if (whereString.length() > 0) whereString.append(" AND "); - boolean addParens = false; - if (viewEntityCondWhereString.charAt(0) != '(') addParens = true; + boolean addParens = viewEntityCondWhereString.charAt(0) != '('; if (addParens) whereString.append("("); whereString.append(viewEntityCondWhereString); if (addParens) whereString.append(")"); @@ -805,8 +803,7 @@ public class GenericDAO { if (viewClause.length() > 0) { if (whereString.length() > 0) whereString.append(" AND "); - boolean addParens = false; - if (viewClause.charAt(0) != '(') addParens = true; + boolean addParens = viewClause.charAt(0) != '('; if (addParens) whereString.append("("); whereString.append(viewClause); if (addParens) whereString.append(")"); @@ -836,16 +833,14 @@ public class GenericDAO { StringBuilder havingString = new StringBuilder(); if (UtilValidate.isNotEmpty(entityCondHavingString)) { - boolean addParens = false; - if (entityCondHavingString.charAt(0) != '(') addParens = true; + boolean addParens = entityCondHavingString.charAt(0) != '('; if (addParens) havingString.append("("); havingString.append(entityCondHavingString); if (addParens) havingString.append(")"); } if (UtilValidate.isNotEmpty(viewEntityCondHavingString)) { if (havingString.length() > 0) havingString.append(" AND "); - boolean addParens = false; - if (viewEntityCondHavingString.charAt(0) != '(') addParens = true; + boolean addParens = viewEntityCondHavingString.charAt(0) != '('; if (addParens) havingString.append("("); havingString.append(viewEntityCondHavingString); if (addParens) havingString.append(")"); |
Free forum by Nabble | Edit this page |