Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-11867

Fix empty path check in StreamExEnv#readTextFile

    XMLWordPrintableJSON

Details

    Description

      In class StreamExecutionEnvironment

       

      // code placeholder
      public DataStreamSource<String> readTextFile(String filePath, String charsetName) {
      Preconditions.checkNotNull(filePath, "The file path must not be null.");
      Preconditions.checkNotNull(filePath.isEmpty(), "The file path must not be empty.");
      
      TextInputFormat format = new TextInputFormat(new Path(filePath));
      format.setFilesFilter(FilePathFilter.createDefaultFilter());
      TypeInformation<String> typeInfo = BasicTypeInfo.STRING_TYPE_INFO;
      format.setCharsetName(charsetName);
      
      return readFile(format, filePath, FileProcessingMode.PROCESS_ONCE, -1, typeInfo);
      }
      

       

      the Preconditions.checkNotNull(filePath.isEmpty(), "The file path must not be empty."); this will not work

      Attachments

        Issue Links

          Activity

            People

              Tom Goong Tom Goong
              Tom Goong Tom Goong
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m