Repository navigation
NullPointerException during login #918
Copy link
Copy link
Open
Labels
Description
Description:
I am receiving a NullPointerException when attempting to login. Any help would be appreciated.
Steps to reproduce:
This exception occurs when invoking login on an instance of PokemonGo. I had this very same issue a couple of weeks ago, but it appeared transient at the time.
I am using the GoogleAutoCredentialProvider.
@Bean("cred")
public CredentialProvider makeCredentialProvider(@Value("${google.username}") String u, @Value("${google.password}") String p)
throws InvalidCredentialsException, LoginFailedException {
return new GoogleAutoCredentialProvider(new OkHttpClient(), u, p);
}
@Bean("hash")
public HashProvider makeHashProvider(@Value("${hashkey}") String k) {
return new PokeHashProvider(PokeHashKey.from(k), false);
}
@Autowired
@Bean("client")
public PokemonGo makePokemonGoClient(CredentialProvider cred, HashProvider hash) throws RequestFailedException {
PokemonGo client = new PokemonGo(new OkHttpClient());
client.login(cred, hash);
return client;
}Expected behavior:
No exception.
Actual behavior:
NullPointerException
Stacktrace (If it's a crash):
Caused by: java.lang.NullPointerException: null
at com.pokegoapi.api.pokemon.Evolution.<init>(Evolution.java:46) ~[PokeGOAPI-library-all-0.4.1.jar:na]
at com.pokegoapi.api.pokemon.Evolutions.addEvolution(Evolutions.java:58) ~[PokeGOAPI-library-all-0.4.1.jar:na]
at com.pokegoapi.api.pokemon.Evolutions.addEvolution(Evolutions.java:61) ~[PokeGOAPI-library-all-0.4.1.jar:na]
at com.pokegoapi.api.pokemon.Evolutions.addEvolution(Evolutions.java:61) ~[PokeGOAPI-library-all-0.4.1.jar:na]
at com.pokegoapi.api.pokemon.Evolutions.<init>(Evolutions.java:45) ~[PokeGOAPI-library-all-0.4.1.jar:na]
at com.pokegoapi.api.settings.templates.ItemTemplates.reloadTemplates(ItemTemplates.java:166) ~[PokeGOAPI-library-all-0.4.1.jar:na]
at com.pokegoapi.api.settings.templates.ItemTemplates.<init>(ItemTemplates.java:75) ~[PokeGOAPI-library-all-0.4.1.jar:na]
at com.pokegoapi.api.PokemonGo.login(PokemonGo.java:218) ~[PokeGOAPI-library-all-0.4.1.jar:na]
at com.davidgwking.PgathenaApplication.makePokemonGoClient(PgathenaApplication.java:40) [main/:na]
at com.davidgwking.PgathenaApplication$$EnhancerBySpringCGLIB$$a15d3327.CGLIB$makePokemonGoClient$2(<generated>) ~[main/:na]
at com.davidgwking.PgathenaApplication$$EnhancerBySpringCGLIB$$a15d3327$$FastClassBySpringCGLIB$$d9506fc7.invoke(<generated>) ~[main/:na]
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228) ~[spring-core-4.3.8.RELEASE.jar:4.3.8.RELEASE]
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:358) ~[spring-context-4.3.8.RELEASE.jar:4.3.8.RELEASE]
at com.davidgwking.PgathenaApplication$$EnhancerBySpringCGLIB$$a15d3327.makePokemonGoClient(<generated>) ~[main/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_91]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_91]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_91]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_91]
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162) ~[spring-beans-4.3.8.RELEASE.jar:4.3.8.RELEASE]
Version:
Development branch HEAD
Reactions are currently unavailable
Activity
Gegy commentedon May 24, 2017
Somehow the
PokemonSettingsfor a pokemon don't exist when populating the evolution branches. Try reset theitem_templatesfile in your temp directory.davidgwking commentedon May 24, 2017
Thank you; cleaning up those temp dirs temporarily fixes this issue.
Gegy commentedon May 24, 2017
Seems this problem is related to the update of the item templates
just-Addict commentedon May 25, 2017
This exact same issue occurs for some users of BPGM on first start of the program and so far in every case where a user experienced this, the
item_templatesfile appeared to be an incorrect (?) size. After deleting this file and having it redownloaded, the correct size appears to be 220Kb (224.900 bytes) at which point the error no longer occurred.If the filesize is something that can be predicted or if there is another way to verify the file is valid then the solution would be to implement some form of validity check and retry if that fails.