228228import static org .hibernate .internal .util .MathHelper .ceilingPowerOfTwo ;
229229import static org .hibernate .internal .util .StringHelper .isBlank ;
230230import static org .hibernate .internal .util .StringHelper .isEmpty ;
231+ import static org .hibernate .internal .util .StringHelper .isNotEmpty ;
231232import static org .hibernate .internal .util .StringHelper .splitAtCommas ;
232233import static org .hibernate .internal .util .collections .ArrayHelper .EMPTY_STRING_ARRAY ;
233234import static org .hibernate .sql .ast .internal .NonLockingClauseStrategy .NON_CLAUSE_STRATEGY ;
@@ -5222,9 +5223,12 @@ public static String addUseIndexQueryHint(String query, String hints) {
52225223 if ( matcher .matches () && matcher .groupCount () > 1 ) {
52235224 final String startToken = matcher .group (1 );
52245225 // 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 );
52265227 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 ;
52285232 }
52295233 else {
52305234 return query ;
@@ -5242,7 +5246,7 @@ protected String prependComment(String sql, String comment) {
52425246 * Perform necessary character escaping on the text of the comment.
52435247 */
52445248 public static String escapeComment (String comment ) {
5245- if ( StringHelper . isNotEmpty ( comment ) ) {
5249+ if ( isNotEmpty ( comment ) ) {
52465250 final String escaped = ESCAPE_CLOSING_COMMENT_PATTERN .matcher ( comment ).replaceAll ( "*\\ \\ /" );
52475251 return ESCAPE_OPENING_COMMENT_PATTERN .matcher ( escaped ).replaceAll ( "/\\ \\ *" );
52485252 }
0 commit comments