oscarrivera44 / gcm

Automatically exported from code.google.com/p/gcm
Apache License 2.0
0 stars 0 forks source link

java.lang.IllegalArgumentException: argument cannot be null in Sender.java when handling HTTP errors on multi-cast messages #7

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1. From the application server using the supplied gcm-server.jar helper 
classes, attempt to send a multicast message to the GCM server using API 
parameters that would result in the GCM replying with a non-200 HTTP status 
(Eg. 401 for error authenticating the sender account) 

What is the expected output? What do you see instead?

The expected result is for the Sender to throw a InvalidRequestException 
similar to how it does for non-multi cast messages. This would allow the user 
of the class to handle the  problem accordingly.

Instead, using the attached test case, the send request fails with:

Exception in thread "main" java.lang.IllegalArgumentException: argument cannot 
be null
    at com.google.android.gcm.server.Sender.nonNull(Sender.java:553)
    at com.google.android.gcm.server.Sender.getString(Sender.java:534)
    at com.google.android.gcm.server.Sender.sendNoRetry(Sender.java:365)
    at com.google.android.gcm.server.Sender.send(Sender.java:261)

What version of the product are you using? On what operating system?

The gcm-server.jar MANIFEST.MF file indicates:

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.8.2
Created-By: 1.6.0-google-v4-61258-31622288 (Sun Microsystems Inc.)
Implementation-Vendor: Google
Implementation-Title: Google Cloud Messaging - server support
Implementation-Version: 1.0.2

This has been tested under Linux on two machines (same result): Ubuntu 10.04 
LTS with java 1.6.0_26 and CentOS release 5.8 with 1.6.0_20.

Please provide any additional information below.

The original stackoverflow entry can be found here: 
http://stackoverflow.com/questions/11878428/exception-on-web-server-while-implem
enting-google-cloud-messaging/11944282#11944282

gcm group entry:
https://groups.google.com/forum/#!topic/android-gcm/VZhq7-QdLkA%5B1-25%5D

Attached is a test class which reproduces the problem.

Original issue reported on code.google.com by loconet on 14 Aug 2012 at 6:55

Attachments:

GoogleCodeExporter commented 9 years ago
Fixed by http://code.google.com/p/gcm/source/detail?r=e8fda106f8c6 ; will be 
available on next release.

Original comment by felip...@android.com on 22 Aug 2012 at 8:49

GoogleCodeExporter commented 9 years ago
Hi, I am getting this error because conn.getErrorStream() is returning null. 
The changes you made to Sender do not address this error, as getString() is 
still called the same way in getAndClose(). See 
http://stackoverflow.com/a/17491468/1596587

Thanks!

Original comment by josh.all...@gmail.com on 5 Jul 2013 at 2:56

GoogleCodeExporter commented 9 years ago
I can reproduce this problem when using wrong GCM key.

Original comment by ngo...@mobilus.co.jp on 29 Oct 2014 at 11:41