Github user arunmahadevan commented on a diff in the pull request:

    https://github.com/apache/storm/pull/1942#discussion_r101696141
  
    --- Diff: 
external/storm-hdfs/src/main/java/org/apache/storm/hdfs/spout/HDFSSpout.java ---
    @@ -722,19 +703,10 @@ private FileReader createFileReader(Path file)
        */
       private FileReader createFileReader(Path file, String offset)
               throws IOException {
    -    if ( readerType.equalsIgnoreCase(Configs.SEQ) ) {
    -      return new SequenceFileReader(this.hdfs, file, conf, offset);
    -    }
    -    if ( readerType.equalsIgnoreCase(Configs.TEXT) ) {
    -      return new TextFileReader(this.hdfs, file, conf, offset);
    -    }
    -
         try {
    -      Class<?> clsType = Class.forName(readerType);
    -      Constructor<?> constructor = 
clsType.getConstructor(FileSystem.class, Path.class, Map.class, String.class);
    +      Constructor<?> constructor = 
readerType.getConstructor(FileSystem.class, Path.class, Map.class, 
String.class);
    --- End diff --
    
    This assumes a ctor with expected number and type of params is available 
and tries to invoke it via reflection. Adding an init/open with required params 
in the `FileReader` is much cleaner IMO and avoids having to check and throw 
exceptions at runtime.  


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to