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 8332397
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T02:42:40+00:00 2026-06-09T02:42:40+00:00

I’ve added a return statement to my AsncTask and yet I still get an

  • 0

I’ve added a return statement to my AsncTask and yet I still get an error telling me to add one. The only snippet of code that stops this Syntax error is adding a return statement after the catch statement, but that’s counter productive and doesn’t address the needs of the program and I can’t access the Strings I need to ( I need to check if the return OuputStream is equal to true.

Code:

@Override
    protected Boolean doInBackground(String... userandpass)  { //I still get an error telling me to add a return statement
        // TODO Auto-generated method stub
        URL url;
        try {
            url = new URL("http://127.0.0.1:1337");
            HttpURLConnection URLconnection = (HttpURLConnection) url.openConnection();
            URLconnection.setDoOutput(true);
            URLconnection.setChunkedStreamingMode(0);

            //output stream
            OutputStream out = new BufferedOutputStream(URLconnection.getOutputStream());
            writestream(out, userandpass);

            //buffered server response
            InputStream in = new BufferedInputStream(URLconnection.getInputStream());
            String result = readstream(in);
            Log.e(result, result);

            // check we haven't been redirected (Hotel Wifi, for example).
            checkrediect(URLconnection, url);

            Boolean result_true = checkresult(result);

            if(result_true) {
                return true;  
            } else {
                return false;
            }



        } catch (MalformedURLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
            return false;
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

    }
  • 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-09T02:42:41+00:00Added an answer on June 9, 2026 at 2:42 am

    but that’s counter productive and doesn’t address the needs of the program

    Well what are the “needs of the program”? What do you want the result to be if an IOException is thrown? It must be true, false, or an exception – at the moment, it’s none of those.

    I’d recommend that most of the time, you just let exceptions bubble up… can you actually proceed as if nothing had gone wrong in the case of an IOException?

    As a side-note, this is ugly:

    if(result_true) {
        return true;  
    } else {
        return false;
    }
    

    Just use:

    return checkresult(result);
    

    (And ideally rename various methods and variables to follow Java naming conventions.)

    I’d also suggest changing it to return boolean rather than Booelean.

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

Sidebar

Related Questions

I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I have this code to decode numeric html entities to the UTF8 equivalent character.
I want use html5's new tag to play a wav file (currently only supported
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I'm trying to create an if statement in PHP that prevents a single post
I'm making a simple page using Google Maps API 3. My first. One marker

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.