title: Fixing Path Manipulation error
body: <p>Fortify is giving Path Manipulation error on line where new File(path) comparison is made. I'm using Struts 2.</p>
  
  <p>Can any one tell me how to fix this issue so that fortify won't give this error?</p>
  
  <pre><code>private boolean filePresent(String fileName) {
      if (fileName != null) {
          String path = getDirPath();
          if (path != null) {
              path = path.endsWith("/") ? path : path + "/";
              path = path + fileName;
              if (new File(path).exists()) {
                  setFileName(fileName);
                  return true;
              }
          }
      }
      return false;
  }
  </code></pre>
  
  <p>I need to see whether the file is present or not in our web server &amp; hence I'm passing file name as an argument, getting the entire directory path from web.xml, appending it to file name &amp; then composing the path &amp; checking it against File object to see if it is present or not.</p>