title: Sonarqube says: A "NullPointerException" could be thrown; "getFolderPath()" can return null
body: <p>I get a following bug from sonarqube </p>
  
  <blockquote>
    <p>A "NullPointerException" could be thrown; "getFolderPath()" can return
    null.</p>
  </blockquote>
  
  <p>for the following line:</p>
  
  <pre><code>if (upstreamContent.getFolderPath() != null &amp;&amp; !upstreamContent.getFolderPath().isEmpty()) {
     ...
  }
  </code></pre>
  
  <p>Where upstreamContent may not be null.</p>
  
  <p>How can I fix it in sonarqube without turning off the rule?</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>Someone asked me to show the source of UpstreamContent</p>
  
  <pre><code>public class UpstreamContent {
  
      @Nullable
      private String folderPath;
  
      ...
  
      @CheckForNull
      @Nullable
      public String getFolderPath() {
          return folderPath;
      }
  
      public void setFolderPath(String folderPath) {
          this.folderPath = folderPath;
      }
  }
  </code></pre>