title: How can I check if an information is present or not in Excel file using Apache POI and Java Code
body: <p>I have a question:</p>
  
  <p>I'm reading some information from my Excel file using this Java code:</p>
  
  <pre><code>HSSFWorkbook workbook = null;
  try {
      workbook = new HSSFWorkbook(file);
  }catch (IOException ex) {
     ...
  }
  
  SummaryInformation summaryInfo = workbook.getSummaryInformation();
  
  if (summaryInfo.getTitle() != null) {
      System.out.println(summaryInfo.getTitle());
  }
  if (summaryInfo.getAuthor() != null) {
      System.out.println(summaryInfo.getAuthor());
  }
  </code></pre>
  
  <p>but I get this error I don't have the "Title" information: </p>
  
  <pre><code>java.lang.NullPointerException 
  </code></pre>
  
  <p>I have this error on this line:</p>
  
  <pre><code>if (summaryInfo.getTitle() != null) {
  </code></pre>
  
  <p>Now, How can I check if the "Title" value (or other value) is present or not if this condition give me an error?</p>