Skip to content

Commit cd4d4db

Browse files
committed
optimize string usage
1 parent 4e6038e commit cd4d4db

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/main/java/ortus/boxlang/modules/orm/HQLQuery.java

+7-2
Original file line numberDiff line numberDiff line change
@@ -358,8 +358,13 @@ public Object execute() {
358358
* @return
359359
*/
360360
private String sanitizeHQL( String hql ) {
361-
return hql.replaceAll( "= true", "= cast( true as boolean )" )
362-
.replaceAll( "= false", "= cast( true as boolean )" );
361+
final String EQUALS_FALSE = "= false";
362+
final String EQUALS_TRUE = "= true";
363+
final String CAST_TRUE = "= cast( %s as boolean )";
364+
final String TRUE = String.format( CAST_TRUE, "true" );
365+
final String FALSE = String.format( CAST_TRUE, "false" );
366+
return hql.replaceAll( EQUALS_TRUE, TRUE )
367+
.replaceAll( EQUALS_FALSE, FALSE );
363368

364369
}
365370
}

0 commit comments

Comments
 (0)