犯了一个愚蠢的错误

/**
 * @author kc
 *
 */
public class UrlAccessFilter implements Filter {

 private InputStream path;

 public void init(FilterConfig filterConfig) throws ServletException {
 }

 public void doFilter(ServletRequest request, ServletResponse response,
   FilterChain filterChain) throws IOException, ServletException {
  System.out.println("正在访问hichujian apk");
  path = null;
  System.out.println(path);
  path = this.getClass().getClassLoader()
    .getResourceAsStream("download_count.properties");
  Properties prop = new Properties();
  FileOutputStream fos = null;
  try {

   prop.load(path);
   String download_number = prop.getProperty("number");
   System.out.println(download_number);
   path.close();
   fos = new FileOutputStream(new File(this.getClass()
     .getResource("/").getPath()
     + "download_count.properties"));
   int download = Integer.parseInt(download_number);
   download++;
   prop.setProperty("number", String.valueOf(download));
   prop.store(fos, null);
    fos.close();
   /* filterChain.doFilter(request, response); */

  } catch (Exception e) {
   e.printStackTrace();
  }
 }

 public void destroy() {
 }

}

 

你可能感兴趣的:(properties)