File tree Expand file tree Collapse file tree 1 file changed +13
-6
lines changed
hibernate-core/src/main/java/org/hibernate/mapping Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change 38
38
39
39
import static java .util .Collections .emptyList ;
40
40
import static java .util .Collections .unmodifiableList ;
41
+ import static org .hibernate .internal .util .StringHelper .isBlank ;
41
42
42
43
/**
43
44
* A mapping model object representing a property or field of an {@linkplain PersistentClass entity}
@@ -184,17 +185,23 @@ else if ( elementType instanceof ComponentType componentType ) {
184
185
}
185
186
186
187
private static CascadeStyle getCascadeStyle (String cascade ) {
187
- if ( cascade ==null || cascade .equals ("none" ) ) {
188
+ if ( cascade ==null || cascade .equals ("none" ) || isBlank ( cascade ) ) {
188
189
return CascadeStyles .NONE ;
189
190
}
190
191
else {
191
192
final StringTokenizer tokens = new StringTokenizer (cascade , ", " );
192
- final CascadeStyle [] styles = new CascadeStyle [ tokens .countTokens () ] ;
193
- int i =0 ;
194
- while ( tokens .hasMoreTokens () ) {
195
- styles [i ++] = CascadeStyles .getCascadeStyle ( tokens .nextToken () );
193
+ final int length = tokens .countTokens ();
194
+ if ( length == 1 ) {
195
+ return CascadeStyles .getCascadeStyle ( tokens .nextToken () );
196
+ }
197
+ else {
198
+ final CascadeStyle [] styles = new CascadeStyle [length ];
199
+ int i = 0 ;
200
+ while ( tokens .hasMoreTokens () ) {
201
+ styles [i ++] = CascadeStyles .getCascadeStyle ( tokens .nextToken () );
202
+ }
203
+ return new CascadeStyles .MultipleCascadeStyle ( styles );
196
204
}
197
- return new CascadeStyles .MultipleCascadeStyle (styles );
198
205
}
199
206
}
200
207
You can’t perform that action at this time.
0 commit comments