Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8525191
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T07:54:17+00:00 2026-06-11T07:54:17+00:00

We happened to use IBM appscan http://www-01.ibm.com/software/awdtools/appscan/ against our java codebase, and it returned

  • 0

We happened to use IBM appscan http://www-01.ibm.com/software/awdtools/appscan/

against our java codebase, and it returned around 3000 high severity vulnerabilities.

Most of them happen to be System Information Leak, which it thinks is happening when we print stack traces in the catch blocks, but we only print the filename and line number it is happening, enabling us to debug the code better.

And some are about SQL injection, input validation etc.

But, my question was about Resource exhaustion (file descriptor, disk space, sockets, …), and it lists all instances of java.io.BufferedReader.readLine as places for possible external attacks.

       InputStream ins=conn.getInputStream();

      String inputLine;

      if (!preserveLinefeeds) {
         BufferedReader in = new BufferedReader(new InputStreamReader(ins));
         while ((inputLine = in.readLine()) != null)
            pr.readThreadResponse+=inputLine;
         in.close();
         ins.close();
      } 

conn is a HttpURLConnection object.

How do I add safegaurds in the code to prevent this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T07:54:19+00:00Added an answer on June 11, 2026 at 7:54 am

    Any time you open a stream, ensure that a finally block closes the stream when finished.

    If an IOException is thrown while reading from the stream in your code the stream will not be closed, hence the warning

    Java 7 makes this easy with the try with resources construct. In java 6 or earlier you need to replicate with lots of boilerplate, eg

    InputStream ins = null;
    try {
      ins = conn.getInputStream();
      ...
    } finally {
      IOUtils.closeQuietly(ins);
    }
    

    Using the IOUtils class from Apache Commons

    You can write your own closeQuietly if you don’t want to add the dependency

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I happened to use the below CSS hack for WebKit-based browsers, according to http://www.webmonkey.com/2010/02/browser-specific_css_hacks/
I have a general programming question, that I have happened to use Java to
I'm a Git user trying to use Mercurial. Here's what happened: I did a
What happened if I use fseek fseek(fileptr,10000L,SEEK_CUR); and it returns a nonzero value, as
I use software called DotNetPanel (DNP) and I'm modifying PHProxy to automatically log into
What is the use of profile attributes in the HTML <head> tag? I happened
What happened to SP when we use of JPA? Does JPA kill stored-procedures?
I use library which download torrents. But today some error happened (log): Could not
Not sure what has happened on my dev machine but I can barely use
The problem happened in my proxy program, Considering G10K I use gevent in my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.