File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
util/src/main/java/io/kubernetes/client/util Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -166,7 +166,7 @@ public static Object load(File f) throws IOException {
166
166
*/
167
167
public static Object load (Reader reader ) throws IOException {
168
168
Map <String , Object > data = getSnakeYaml ().load (reader );
169
- return ModelMapper (data );
169
+ return modelMapper (data );
170
170
}
171
171
172
172
/**
@@ -251,7 +251,11 @@ public static List<Object> loadAll(Reader reader) throws IOException {
251
251
List <Object > list = new ArrayList <Object >();
252
252
for (Object object : iterable ) {
253
253
if (object != null ) {
254
- list .add (ModelMapper ((Map <String , Object >) object ));
254
+ try {
255
+ list .add (modelMapper ((Map <String , Object >) object ));
256
+ } catch (ClassCastException ex ) {
257
+ logger .error ("Unexpected exception while casting: " + ex );
258
+ }
255
259
}
256
260
}
257
261
@@ -287,7 +291,7 @@ public static org.yaml.snakeyaml.Yaml getSnakeYaml() {
287
291
* @return An instantiation of the object.
288
292
* @throws IOException
289
293
*/
290
- private static Object ModelMapper (Map <String , Object > data ) throws IOException {
294
+ private static Object modelMapper (Map <String , Object > data ) throws IOException {
291
295
String kind = (String ) data .get ("kind" );
292
296
if (kind == null ) {
293
297
throw new IOException ("Missing kind in YAML file!" );
You can’t perform that action at this time.
0 commit comments