Enum member null in Adwords library The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) The Ask Question Wizard is Live! Data science time! April 2019 and salary with experienceAvoiding != null statementsHow to get an enum value from a string value in Java?A 'for' loop to iterate over an enum in JavaComparing Java enum members: == or equals()?Is null check needed before calling instanceof?Failed to load the JNI shared Library (JDK)Thumbnail upload YouTube API v3 failingOauth Account Manager return error credentialsOrigin 'null' is therefore not allowed accessSpring Cloud Upgrade from Edgware(Spring boot 1.x) to Greenwich(Spring boot 2.x) failure

Sort list of array linked objects by keys and values

should truth entail possible truth

Can the Right Ascension and Argument of Perigee of a spacecraft's orbit keep varying by themselves with time?

Match Roman Numerals

Visa regaring travelling European country

One-dimensional Japanese puzzle

Did the UK government pay "millions and millions of dollars" to try to snag Julian Assange?

Student Loan from years ago pops up and is taking my salary

How did passengers keep warm on sail ships?

What is the role of 'For' here?

Homework question about an engine pulling a train

The following signatures were invalid: EXPKEYSIG 1397BC53640DB551

What to do when moving next to a bird sanctuary with a loosely-domesticated cat?

Does Parliament hold absolute power in the UK?

What's the point in a preamp?

Sub-subscripts in strings cause different spacings than subscripts

Identify 80s or 90s comics with ripped creatures (not dwarves)

Deal with toxic manager when you can't quit

Why doesn't a hydraulic lever violate conservation of energy?

how can a perfect fourth interval be considered either consonant or dissonant?

Can the DM override racial traits?

Circular reasoning in L'Hopital's rule

Simulating Exploding Dice

Is it ethical to upload a automatically generated paper to a non peer-reviewed site as part of a larger research?



Enum member null in Adwords library



The 2019 Stack Overflow Developer Survey Results Are In
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
The Ask Question Wizard is Live!
Data science time! April 2019 and salary with experienceAvoiding != null statementsHow to get an enum value from a string value in Java?A 'for' loop to iterate over an enum in JavaComparing Java enum members: == or equals()?Is null check needed before calling instanceof?Failed to load the JNI shared Library (JDK)Thumbnail upload YouTube API v3 failingOauth Account Manager return error credentialsOrigin 'null' is therefore not allowed accessSpring Cloud Upgrade from Edgware(Spring boot 1.x) to Greenwich(Spring boot 2.x) failure



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








1















I'm using the Google Adwords library. To create crendentials there is builder pattern provided:



new OfflineCredentials.Builder()
.forApi(OfflineCredentials.Api.ADWORDS)
.fromFile("D:...ads.properties")
.build()


This call throws a null pointer exception in my app, specifically the argument for the .forApi() method is null. That object is an enum member defined thus:



 public static enum Api implements OAuthConfig {
ADWORDS("api.adwords.", "https://www.googleapis.com/auth/adwords"),
AD_MANAGER("api.admanager.", "https://www.googleapis.com/auth/dfp");

private final String propKeyPrefix;
private final String scope;

private Api(String propKeyPrefix, String scope)
this.propKeyPrefix =
Preconditions.checkNotNull(propKeyPrefix, "Null property key prefix for: %s", this);
this.scope = Preconditions.checkNotNull(scope, "Null scope for: %s", this);



Now, how can an enum member be null? And what do I do about it?



Is this a problem with class loading? If that helps, it is a Spring Boot application.










share|improve this question
























  • Just to be clear: you're saying Api.ADWORDS is null? So you get the NPE in ForApiBuilder.defaultOptionals when it tries to call oAuthConfig.getInternals() ? There error isn't that getInternals() is returning null and the next call failing? (though I'm not sure how that would happen either)

    – Rup
    Mar 8 at 12:18












  • Yes. Evaluating Api.ADWORDS in the debugger results in null. Calling .forApi(Api.ADWORDS) throws NPE. The call to .getInternals() is indeed the first attempt to access members of ADWORDS.

    – Stefan Fischer
    Mar 8 at 12:25

















1















I'm using the Google Adwords library. To create crendentials there is builder pattern provided:



new OfflineCredentials.Builder()
.forApi(OfflineCredentials.Api.ADWORDS)
.fromFile("D:...ads.properties")
.build()


This call throws a null pointer exception in my app, specifically the argument for the .forApi() method is null. That object is an enum member defined thus:



 public static enum Api implements OAuthConfig {
ADWORDS("api.adwords.", "https://www.googleapis.com/auth/adwords"),
AD_MANAGER("api.admanager.", "https://www.googleapis.com/auth/dfp");

private final String propKeyPrefix;
private final String scope;

private Api(String propKeyPrefix, String scope)
this.propKeyPrefix =
Preconditions.checkNotNull(propKeyPrefix, "Null property key prefix for: %s", this);
this.scope = Preconditions.checkNotNull(scope, "Null scope for: %s", this);



Now, how can an enum member be null? And what do I do about it?



Is this a problem with class loading? If that helps, it is a Spring Boot application.










share|improve this question
























  • Just to be clear: you're saying Api.ADWORDS is null? So you get the NPE in ForApiBuilder.defaultOptionals when it tries to call oAuthConfig.getInternals() ? There error isn't that getInternals() is returning null and the next call failing? (though I'm not sure how that would happen either)

    – Rup
    Mar 8 at 12:18












  • Yes. Evaluating Api.ADWORDS in the debugger results in null. Calling .forApi(Api.ADWORDS) throws NPE. The call to .getInternals() is indeed the first attempt to access members of ADWORDS.

    – Stefan Fischer
    Mar 8 at 12:25













1












1








1


1






I'm using the Google Adwords library. To create crendentials there is builder pattern provided:



new OfflineCredentials.Builder()
.forApi(OfflineCredentials.Api.ADWORDS)
.fromFile("D:...ads.properties")
.build()


This call throws a null pointer exception in my app, specifically the argument for the .forApi() method is null. That object is an enum member defined thus:



 public static enum Api implements OAuthConfig {
ADWORDS("api.adwords.", "https://www.googleapis.com/auth/adwords"),
AD_MANAGER("api.admanager.", "https://www.googleapis.com/auth/dfp");

private final String propKeyPrefix;
private final String scope;

private Api(String propKeyPrefix, String scope)
this.propKeyPrefix =
Preconditions.checkNotNull(propKeyPrefix, "Null property key prefix for: %s", this);
this.scope = Preconditions.checkNotNull(scope, "Null scope for: %s", this);



Now, how can an enum member be null? And what do I do about it?



Is this a problem with class loading? If that helps, it is a Spring Boot application.










share|improve this question
















I'm using the Google Adwords library. To create crendentials there is builder pattern provided:



new OfflineCredentials.Builder()
.forApi(OfflineCredentials.Api.ADWORDS)
.fromFile("D:...ads.properties")
.build()


This call throws a null pointer exception in my app, specifically the argument for the .forApi() method is null. That object is an enum member defined thus:



 public static enum Api implements OAuthConfig {
ADWORDS("api.adwords.", "https://www.googleapis.com/auth/adwords"),
AD_MANAGER("api.admanager.", "https://www.googleapis.com/auth/dfp");

private final String propKeyPrefix;
private final String scope;

private Api(String propKeyPrefix, String scope)
this.propKeyPrefix =
Preconditions.checkNotNull(propKeyPrefix, "Null property key prefix for: %s", this);
this.scope = Preconditions.checkNotNull(scope, "Null scope for: %s", this);



Now, how can an enum member be null? And what do I do about it?



Is this a problem with class loading? If that helps, it is a Spring Boot application.







java spring-boot google-adwords






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 8 at 12:33









Yassin Hajaj

14.5k72961




14.5k72961










asked Mar 8 at 12:10









Stefan FischerStefan Fischer

162211




162211












  • Just to be clear: you're saying Api.ADWORDS is null? So you get the NPE in ForApiBuilder.defaultOptionals when it tries to call oAuthConfig.getInternals() ? There error isn't that getInternals() is returning null and the next call failing? (though I'm not sure how that would happen either)

    – Rup
    Mar 8 at 12:18












  • Yes. Evaluating Api.ADWORDS in the debugger results in null. Calling .forApi(Api.ADWORDS) throws NPE. The call to .getInternals() is indeed the first attempt to access members of ADWORDS.

    – Stefan Fischer
    Mar 8 at 12:25

















  • Just to be clear: you're saying Api.ADWORDS is null? So you get the NPE in ForApiBuilder.defaultOptionals when it tries to call oAuthConfig.getInternals() ? There error isn't that getInternals() is returning null and the next call failing? (though I'm not sure how that would happen either)

    – Rup
    Mar 8 at 12:18












  • Yes. Evaluating Api.ADWORDS in the debugger results in null. Calling .forApi(Api.ADWORDS) throws NPE. The call to .getInternals() is indeed the first attempt to access members of ADWORDS.

    – Stefan Fischer
    Mar 8 at 12:25
















Just to be clear: you're saying Api.ADWORDS is null? So you get the NPE in ForApiBuilder.defaultOptionals when it tries to call oAuthConfig.getInternals() ? There error isn't that getInternals() is returning null and the next call failing? (though I'm not sure how that would happen either)

– Rup
Mar 8 at 12:18






Just to be clear: you're saying Api.ADWORDS is null? So you get the NPE in ForApiBuilder.defaultOptionals when it tries to call oAuthConfig.getInternals() ? There error isn't that getInternals() is returning null and the next call failing? (though I'm not sure how that would happen either)

– Rup
Mar 8 at 12:18














Yes. Evaluating Api.ADWORDS in the debugger results in null. Calling .forApi(Api.ADWORDS) throws NPE. The call to .getInternals() is indeed the first attempt to access members of ADWORDS.

– Stefan Fischer
Mar 8 at 12:25





Yes. Evaluating Api.ADWORDS in the debugger results in null. Calling .forApi(Api.ADWORDS) throws NPE. The call to .getInternals() is indeed the first attempt to access members of ADWORDS.

– Stefan Fischer
Mar 8 at 12:25












1 Answer
1






active

oldest

votes


















0














Found it. The Preconditions.checkNotNull threw a NoSuchMethodError, due to conflicting versions. This prevented the enum member from being properly initialized, thus staying null and causing an NPE in turn.



TIL: When an enum member is null, there properly was an error in its constructor.






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55062971%2fenum-member-null-in-adwords-library%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Found it. The Preconditions.checkNotNull threw a NoSuchMethodError, due to conflicting versions. This prevented the enum member from being properly initialized, thus staying null and causing an NPE in turn.



    TIL: When an enum member is null, there properly was an error in its constructor.






    share|improve this answer



























      0














      Found it. The Preconditions.checkNotNull threw a NoSuchMethodError, due to conflicting versions. This prevented the enum member from being properly initialized, thus staying null and causing an NPE in turn.



      TIL: When an enum member is null, there properly was an error in its constructor.






      share|improve this answer

























        0












        0








        0







        Found it. The Preconditions.checkNotNull threw a NoSuchMethodError, due to conflicting versions. This prevented the enum member from being properly initialized, thus staying null and causing an NPE in turn.



        TIL: When an enum member is null, there properly was an error in its constructor.






        share|improve this answer













        Found it. The Preconditions.checkNotNull threw a NoSuchMethodError, due to conflicting versions. This prevented the enum member from being properly initialized, thus staying null and causing an NPE in turn.



        TIL: When an enum member is null, there properly was an error in its constructor.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 11 at 17:14









        Stefan FischerStefan Fischer

        162211




        162211





























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55062971%2fenum-member-null-in-adwords-library%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            1928 у кіно

            Захаров Федір Захарович

            Ель Греко