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