title: org.apache.poi.EmptyFileException: The supplied file was empty (zero bytes long)
body: <p>I am trying to read a xlsx file using Apache POI, but its giving me below error:
  org.apache.poi.EmptyFileException: The supplied file was empty (zero bytes long)</p>
  
  <p>My Controller is:</p>
  
  <pre><code>@PostMapping("/upload")
      @Consumes(MediaType.MULTIPART_FORM_DATA)
      public ResponseEntity&lt;SalesforceLoadUser&gt; uploadFile(@FormDataParam("file") InputStream uploadedInputStream,
             @NotNull @NotEmpty @RequestParam @DefaultValue(value = "false") final boolean testUser) throws IOException {
  
          final SalesforceLoadUser sfData = salesforecEventService.uploadUserFile(uploadedInputStream, testUser);
  
          final ResponseEntity&lt;SalesforceLoadUser&gt; finalResponse = new ResponseEntity&lt;SalesforceLoadUser&gt;(sfData, HttpStatus.OK);
          log.debug("Data load started for test user",testUser, finalResponse.getStatusCode());
  
          return finalResponse;
  
          //return uploadSFUserFile(uploadedInputStream,testUser);
      }
  </code></pre>
  
  <p>And my file reader is:  </p>
  
  <pre><code>@Override
  public SalesforceLoadUser uploadUserFile(InputStream openInputStream , boolean testUsers) throws IOException {
  
      final SalesforceLoadUser sfUserData = new SalesforceLoadUser();
      try {
          // Finds the workbook instance for XLSX file
          Workbook myWorkBook = WorkbookFactory.create(openInputStream);
  
  
          // Return first sheet from the XLSX workbook
          Sheet mySheet = myWorkBook.getSheetAt(0);
  
       // Get iterator to all the rows in current sheet
        //  Iterator&lt;Row&gt; rowIterator = mySheet.iterator();
  
       // Traversing over each row of XLSX file
          int rowsCount = mySheet.getLastRowNum();
          System.out.println("Total Number of Rows: " + (rowsCount + 1));
          for (int i = 1; i &lt;= rowsCount; i++) {
              Row row = mySheet.getRow(i);
              int colCounts = row.getLastCellNum();
              System.out.println("Total Number of Cols: " + colCounts);
              for (int j = 0; j &lt; colCounts; j++) {
  
              //final Optional&lt;CommsPhysician&gt; checkUserRecord = repo.findPhysicianByNPI(row.getCell(0).getStringCellValue());
  
                  sfUserData.setNPI(row.getCell(0).getStringCellValue());
  
                  sfUserData.setFirstName(row.getCell(2).getStringCellValue());
                  sfUserData.setLastName(row.getCell(3).getStringCellValue());
                  sfUserData.setGender(row.getCell(14).getStringCellValue());
                  sfUserData.setGradYear((int) row.getCell(16).getNumericCellValue());
                  sfUserData.setClassification(row.getCell(4).getStringCellValue());
                  sfUserData.setEmail(row.getCell(15).getStringCellValue());
                  sfUserData.setStatus(row.getCell(1).getStringCellValue());
                  sfUserData.setSpecialty(row.getCell(17).getStringCellValue());
  
                  // Populate Roles
                  if (row.getCell(6).getBooleanCellValue()) {
                      sfUserData.setJvp(row.getCell(6).getBooleanCellValue());
                  }
                  if (row.getCell(5).getBooleanCellValue()) {
                      sfUserData.setMd(row.getCell(5).getBooleanCellValue());
  
                  }
                  if (row.getCell(7).getBooleanCellValue()) {
  
                      sfUserData.setCredentialed(row.getCell(7).getBooleanCellValue());
                  }
  
                  // Populate Address
                  sfUserData.setStreet(row.getCell(8).getStringCellValue());
                  sfUserData.setCity(row.getCell(9).getStringCellValue());
                  sfUserData.setState(row.getCell(10).getStringCellValue());
  
                  // Populate Palmer and Division
                  sfUserData.setPalmer(row.getCell(12).getStringCellValue());
                  sfUserData.setDivision(row.getCell(13).getStringCellValue());
  
                  // Set boolean for test user from request
                  sfUserData.setTestUser(testUsers);
  
                  salesforceBrokerService.publishToBroker(sfUserData);
  
  
              }
          }
  
         //Close the workbook
          myWorkBook.close();
  
      } catch (IOException | EncryptedDocumentException | InvalidFormatException e) {
  
          e.printStackTrace();
      } finally {
          if (openInputStream != null){
              //Close the excel input file (inputstream)  
              IOUtils.closeQuietly(openInputStream);
          }
      }
  
      return sfUserData;
  }
  </code></pre>
  
  <p>its throwing error when Workbook is trying to create inputStream.</p>
  
  <p>Can anyone suggest what is wrong here. My xlsx file is neither corrupt nor empty.</p>