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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T23:39:18+00:00 2026-05-25T23:39:18+00:00

I have modified the login in and implemented this instead. public void login() {

  • 0

I have modified the login in and implemented this instead.

 public void login() {         

        HttpConnection c = null;
        InputStream is = null;
        StringBuffer str = new StringBuffer();

        String url = "http://101.00.00.000/...../"
                + "?user=" + getUsername().getString().trim()
                + "&password=" + getPass().getString().trim();
        try {
            c = (HttpConnection) Connector.open(url);
            is = c.openInputStream();

            int len = (int)c.getLength();
            int ch;
            String getS = "";
            while((ch = is.read()) != -1){
                str.append((char)ch);
                getS = str.toString();
                String msg = "Login successful";
                System.out.println(getS.substring(0, getS.length()));
                if (getS.substring(0, 16).equals(msg)){
                System.out.println(getS);
                switchDisplayable(null, svgMenu.getSvgCanvas());
            }else{
                switchDisplayable(null, getAlert2());
//            }
            }

            System.out.println(getS);



        } 
        catch (IOException exception) {
            try {
                if (is != null)
                  is.close();
              if (c != null)
                  c.close();
                exception.printStackTrace();
            } catch (IOException ex) {
                ex.printStackTrace();
            }
        } 
    }

The response from the url on debugging gave a right answer that the login was successfull i.e in the commandline. But I noticed that the string comparison doesn’t return a correct logic
i.e

if (getS.substring(0, 16).equals(msg)){
                    System.out.println(getS);
                    switchDisplayable(null, svgMenu.getSvgCanvas());
                }

The if statement never gets to execute. What do I do.

  • 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-05-25T23:39:19+00:00Added an answer on May 25, 2026 at 11:39 pm

    You made a mistake on server side. Because you sending the string value of username and password from client side(mobile). you need to validate on server side. Before that you need to check if any white space on username and password on client side(mobile). use getUsername().getString().trim() and getPass().getString().trim() and also If need check the case sensitive.

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

Sidebar

Related Questions

I have php login script that I have modified with htm tables and css.
I already did a lot of research on this topic and have implemented a
I have modified the Nerd Dinner application to allow editing of child records by
I have modified my MOSS 2007 configuration to query a given target AD successfully.
I have modified a working Windows service that had always been starting beforehand. After
I have modified a website with a redirection to a single page: RewriteCond %{REQUEST_FILENAME}
I have a dataset that I have modified into an xml document and then
I have an XML object (loaded using XMLHTTPRequest 's responseXML ). I have modified
I have a vs.net project, and after some refactoring, have modified the name of
I'm building a custom Ubuntu kernel and have modified one of the source files.

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.