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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:41:47+00:00 2026-05-23T08:41:47+00:00

I have this function here that assembles an API call to eBay. It used

  • 0

I have this function here that assembles an API call to eBay. It used to only work with one EbayKeys.appid now there arose a need to include a second one.

The parameter String appidGet is passed from another function that uses request.getParameter(“token”); I’ve output the value into catalina.out and the value gets passed, however the if/else statement does not get executed and it does not append the values onto the string.

I have tried it with several different values and none of them work. I’m completely new to Java and have no idea what I’m doing wrong here.

public String getSearchUrl(String qurl, List<String> excludes, String appidGet) throws UnsupportedEncodingException {
    String query = buildQuery(qurl, excludes);
    String safequery;
    try {
        safequery = URLEncoder.encode(getQuery(),charset);
        StringBuffer apicall = new StringBuffer();
        apicall.append(EbayKeys.endpoint).append("?").append("OPERATION-NAME=findItemsByKeywords")
        .append("&SERVICE-VERSION=").append(EbayKeys.version);

        //Does not execute
        if (appidGet == "one" ) {
            apicall.append("&SECURITY-APPNAME=").append(EbayKeys.appid1);
        }           
        else if (appidGet == "two" ) {
            apicall.append("&SECURITY-APPNAME=").append(EbayKeys.appid2);
        }

        System.out.println(getClass().getName() + " "
                + Utils.getTime()
                + " APP ID = " + appidGet);
        apicall.append("&GLOBAL-ID=").append(EbayKeys.globalid)
        .append("&keywords=").append(safequery)
        .append("&sortOrder=StartTimeNewest&paginationInput.entriesPerPage=2")
        .append(query);
        return apicall.toString();
    } catch (UnsupportedEncodingException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return "";
}

Thanks for any help 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-05-23T08:41:47+00:00Added an answer on May 23, 2026 at 8:41 am

    Classic mistake. When comparing Strings, use .equals():

        if (appidGet.equals("one") ) {
            apicall.append("&SECURITY-APPNAME=").append(EbayKeys.appid1);
        }           
        else if (appidGet.equals("two") ) {
            apicall.append("&SECURITY-APPNAME=").append(EbayKeys.appid2);
        }
    

    For non-primitives, == tests if the two objects are the same object (same memory address), whereas .equals() tests if they “seem the same” (class-specific implementation)

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

Sidebar

Related Questions

I have this function: RegisterGlobalHotKey(Keys.F6, MOD_SHIFT | MOD_CONTROL); which call an API to register
I have this function in my Javascript Code that updates html fields with their
I have this Array i wrote a function MostFreq that takes an array of
Note that this function does not have a { and } body. Just a
We have a moderate size (40-odd function) C API that needs to be called
I have this SphereInFrustrum function here: 0.49% int FrustumG::sphereInFrustum(Vec3 &p, float radius) { int
I have this function in my head: <head> window.onload = function(){ var x =
I have this function from a plugin (from a previous post) // This method
I have this function... private string dateConvert(string datDate) { System.Globalization.CultureInfo cultEnGb = new System.Globalization.CultureInfo(en-GB);
I have this function to read in all ints from the file. The problem

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.