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

  • Home
  • SEARCH
  • 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 8189759
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T03:23:25+00:00 2026-06-07T03:23:25+00:00

I have omitted irrelevant parts of the code: […] try { URL url =

  • 0

I have omitted irrelevant parts of the code:

[...]
    try {
        URL url = new URL(updateUrl);
        BufferedReader input = new BufferedReader(new InputStreamReader(url.openStream()));
[...]
    } catch (MalformedURLException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (IOException e) {
    } finally {
        input.close();
    }
[...]

The problem is that on the finally “input.close()” Eclipse says that “input cannot be resolved”.

I think it may be an scope problem, but I have seen code from other guys and it has usually this same form, so I do not know why it is not working here.

Any hints?

Thanks a lot in advance,

  • 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-07T03:23:27+00:00Added an answer on June 7, 2026 at 3:23 am

    It is indeed a scope error.
    Your input is declared inside the try block, so it can’t be seen inside the finally block. Declare it outside, so that it is visible to both, and you should be fine:

    [...]
        BufferedReader input = null;
        try {
            URL url = new URL(updateUrl);
            input = new BufferedReader(new InputStreamReader(url.openStream()));
    [...]
        } catch (MalformedURLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IOException e) {
        } finally {
            if (input != null)
            {
                try {
                  input.close();
                }
                catch (IOException exc)
                {
                  exc.printStackTrace();
                }
            }
        }
    [...]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have 2 tables set up like this (irrelevant rows omitted): > product -
I Have XML similar to this(omitted parts for brevity): <uformrecord> <state>Submitted</state> <created>2012-06-19T11:31:54</created> <updated>2012-06-19T11:32:13</updated> <id>53225sas3c1-d727-42cd-93a6-97cd778e5ee9</id>
If I have code like this (irrelevant things like initialising the connection and handle
I have a database table structured like this (irrelevant fields omitted for brevity): rankings
Can I configure Redis slave to stop saving dumps? I have omitted all save
I have the following XSL template (I omitted the template for Organization, let me
I currently have a table structure that looks something like this(some details omitted): ColumnName
I have two singletons, the first one's header looks like this (I've omitted everything
This is difficult for me to put right but let me try. I have
I have the following classes in my JPA model (getters, setters, and irrelevant fields

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.