228
228
import static org .hibernate .internal .util .MathHelper .ceilingPowerOfTwo ;
229
229
import static org .hibernate .internal .util .StringHelper .isBlank ;
230
230
import static org .hibernate .internal .util .StringHelper .isEmpty ;
231
+ import static org .hibernate .internal .util .StringHelper .isNotEmpty ;
231
232
import static org .hibernate .internal .util .StringHelper .splitAtCommas ;
232
233
import static org .hibernate .internal .util .collections .ArrayHelper .EMPTY_STRING_ARRAY ;
233
234
import static org .hibernate .sql .ast .internal .NonLockingClauseStrategy .NON_CLAUSE_STRATEGY ;
@@ -5222,9 +5223,12 @@ public static String addUseIndexQueryHint(String query, String hints) {
5222
5223
if ( matcher .matches () && matcher .groupCount () > 1 ) {
5223
5224
final String startToken = matcher .group (1 );
5224
5225
// Null if there is no join in the query
5225
- final String joinToken = Objects . toString ( matcher .group (2 ), "" );
5226
+ final String joinToken = matcher .group (2 );
5226
5227
final String endToken = matcher .group (3 );
5227
- return startToken + " use index (" + hints + ") " + joinToken + endToken ;
5228
+ return startToken
5229
+ + " use index (" + hints + ") "
5230
+ + ( joinToken == null ? "" : joinToken )
5231
+ + endToken ;
5228
5232
}
5229
5233
else {
5230
5234
return query ;
@@ -5242,7 +5246,7 @@ protected String prependComment(String sql, String comment) {
5242
5246
* Perform necessary character escaping on the text of the comment.
5243
5247
*/
5244
5248
public static String escapeComment (String comment ) {
5245
- if ( StringHelper . isNotEmpty ( comment ) ) {
5249
+ if ( isNotEmpty ( comment ) ) {
5246
5250
final String escaped = ESCAPE_CLOSING_COMMENT_PATTERN .matcher ( comment ).replaceAll ( "*\\ \\ /" );
5247
5251
return ESCAPE_OPENING_COMMENT_PATTERN .matcher ( escaped ).replaceAll ( "/\\ \\ *" );
5248
5252
}
0 commit comments