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 subject is null #107

Closed
n-belokopytov opened this issue Mar 23, 2015 · 1 comment
Closed

NPE when subject is null #107

n-belokopytov opened this issue Mar 23, 2015 · 1 comment
Assignees
Labels
type:defect Bugs or weaknesses. The issue has to contain steps to reproduce.
Milestone

Comments

@n-belokopytov
Copy link

Crash

 Caused by: java.lang.NullPointerException
        at com.snowplowanalytics.snowplow.tracker.Tracker.addDefaultContextData(Tracker.java:180)
        at com.snowplowanalytics.snowplow.tracker.Tracker.completePayload(Tracker.java:149)
        at com.snowplowanalytics.snowplow.tracker.Tracker.trackUnstructuredEvent(Tracker.java:371)
        at com.snowplowanalytics.snowplow.tracker.Tracker.trackScreenView(Tracker.java:585)
        at com.snowplowanalytics.snowplow.tracker.Tracker.trackScreenView(Tracker.java:547)
        at com.chefsfeed.Analytics.activityStart(Analytics.java:191)

This is the code of tracker creation

        RequestCallback callback = new RequestCallback() {
            @Override
            public void onSuccess(int successCount) {
                Log.d(TAG, "Buffer length for POST/GET:" + successCount);
            }
            @Override
            public void onFailure(int successCount, int failureCount) {
                Log.d(TAG, "Failures: " + failureCount + "; Successes: " + successCount);
            }
        };

        Emitter e2 = new Emitter
                .EmitterBuilder("com.chefsfeed", context)
                .callback(callback)
                .build();

        // Create a Tracker with all options
        mTracker = new Tracker
                .TrackerBuilder(e2, context.getPackageName(), context.getApplicationInfo().name)
                .base64(true) // Optional - defines if we use base64 encoding
                .platform(DevicePlatforms.Mobile) // Optional - defines what platform the event will report to be on
                .build();

Notice the absence of an optional subject setter.

NPE is raised during trackScreenView in
String idScreen = cfActivity.getClass().getCanonicalName();
tracker.trackScreenView(cfActivity.getActivityName(), idScreen);

@alexanderdean alexanderdean added this to the Version 0.4.0 milestone Mar 23, 2015
@alexanderdean alexanderdean added the type:defect Bugs or weaknesses. The issue has to contain steps to reproduce. label Mar 23, 2015
@jbeemster
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:defect Bugs or weaknesses. The issue has to contain steps to reproduce.
Projects
None yet
Development

No branches or pull requests

3 participants