today I had a very embarrassing experience.
I just called Push.payload() method like this.
Push.payload(payload, keystore, password, production, token);
(In fact, this code snippet is part of javaPNS)
And Push.payload() is just
public static PushedNotifications payload(Payload payload, Object keystore, String password, boolean production, Object devices) throws CommunicationException, KeystoreException {
return sendPayload(payload, keystore, password, production, devices);
}
production value was true when I called Push.payload(), and there is no assignment except its declaration.
private static final boolean production = true;
Of course I checked that its value is true before step in Push.payload() in debug mode. HOWEVER, in Push.payload() method, the production value turns into false!!
I don’t know what happened. Please explain why the production value changed to false.
Thanks in advance.
the “production” variable that you see in Debug Module is the parameter of method “Push.payload()” in fact.
if the name of the static variable is same as the name of parameter in the method. jvm regard it as a parameter of the method in priority.
so, I recommand you user Upper case like ‘PRODUCTION’. and you’d better use
Xxxxx.PRODUCTIONthis style is better for reading.