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 {
166166 */
167167 public static Object load (Reader reader ) throws IOException {
168168 Map <String , Object > data = getSnakeYaml ().load (reader );
169- return ModelMapper (data );
169+ return modelMapper (data );
170170 }
171171
172172 /**
@@ -251,7 +251,11 @@ public static List<Object> loadAll(Reader reader) throws IOException {
251251 List <Object > list = new ArrayList <Object >();
252252 for (Object object : iterable ) {
253253 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+ }
255259 }
256260 }
257261
@@ -287,7 +291,7 @@ public static org.yaml.snakeyaml.Yaml getSnakeYaml() {
287291 * @return An instantiation of the object.
288292 * @throws IOException
289293 */
290- private static Object ModelMapper (Map <String , Object > data ) throws IOException {
294+ private static Object modelMapper (Map <String , Object > data ) throws IOException {
291295 String kind = (String ) data .get ("kind" );
292296 if (kind == null ) {
293297 throw new IOException ("Missing kind in YAML file!" );
You can’t perform that action at this time.
0 commit comments