sv2000 commented on a change in pull request #2598: [GOBBLIN-731] Make 
deserialization of FlowSpec more robust
URL: https://github.com/apache/incubator-gobblin/pull/2598#discussion_r275123920
 
 

 ##########
 File path: 
gobblin-runtime/src/main/java/org/apache/gobblin/runtime/spec_store/FSSpecStore.java
 ##########
 @@ -238,13 +238,25 @@ public Spec getSpec(URI specUri, String version) throws 
IOException, SpecNotFoun
     return specs;
   }
 
+  /**
+   * For multiple {@link FlowSpec}s to be loaded, catch IOexception when one 
of them failed to be loaded and
+   * continue with the rest.
+   *
+   * The {@link IOException} thrown from standard FileSystem call will be 
propagated.
+   * @param directory The directory that contains specs to be deserialized
+   * @param specs Container of specs.
+   */
   private void getSpecs(Path directory, Collection<Spec> specs) throws 
IOException {
     FileStatus[] fileStatuses = fs.listStatus(directory);
     for (FileStatus fileStatus : fileStatuses) {
       if (fileStatus.isDirectory()) {
         getSpecs(fileStatus.getPath(), specs);
       } else {
-        specs.add(readSpecFromFile(fileStatus.getPath()));
+        try {
+          specs.add(readSpecFromFile(fileStatus.getPath()));
+        } catch (IOException ioe) {
 
 Review comment:
   Catching IOException may not be enough. SerializationUtils.deserialize() 
throws a SerializationException which extends RuntimeException. 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to