Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NPE when using generated java files for finagle #33

Closed
cchabanois opened this issue Jan 4, 2013 · 3 comments
Closed

NPE when using generated java files for finagle #33

cchabanois opened this issue Jan 4, 2013 · 3 comments

Comments

@cchabanois
Copy link

When I try to create the service client :

 contentServiceClient = new ContentProvider.FinagledClient(
            service, new TBinaryProtocol.Factory(), "contentService",
            new InMemoryStatsReceiver());

I get the following exception :

java.lang.NullPointerException
at net.entropysoft.remoteconnectors2.thrift.generated.ContentProvider$FinagledClient$__Stats.<init>(ContentProvider.java:18698)
at net.entropysoft.remoteconnectors2.thrift.generated.ContentProvider$FinagledClient.<init>(ContentProvider.java:18708)

For each service method the following line is generated in FinagledClient

  private __Stats __stats_addContentChunk = new __Stats("addContentChunk");

__Stats is an inner class in FinagledClient

class __Stats {
  Counter requestsCounter, successCounter, failuresCounter;
  StatsReceiver failuresScope;

  public __Stats(String name) {
    StatsReceiver scope = FinagledClient.this.scopedStats.scope(name);
    this.requestsCounter = scope.counter0("requests");
    this.successCounter = scope.counter0("success");
    this.failuresCounter = scope.counter0("failures");
    this.failuresScope = scope.scope("failures");
  }
}

It accesses scopedStats in FinagledClient but scopedStats is null before the FinagledClient constructor has been called ...

@cchabanois
Copy link
Author

I still have the exact same (critical) issue with scrooge-generator-3.0.3.

@dispalt
Copy link
Contributor

dispalt commented Jan 11, 2013

I tried to fix it here #38 it seems to work for me.

@nshkrob
Copy link
Contributor

nshkrob commented Sep 22, 2014

#38 has been merged. Closing this issue.

@nshkrob nshkrob closed this as completed Sep 22, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants