Hello, I'm working at a J2ME implementation of the google API for
calendar information. I decided to use the clientlogin protocol to
retrieve an authorization key.
At a very irregular basis I get an error in the following code. Can
you help me with figuring out what causes this error? (because the
error is irregular, I suppose it has to do something with the Google
service).
ERROR:
CalendarAdapter.clientLogin():
javax.microedition.pki.CertificateException: Certificate was issued by
an unrecognized entity wrong response: 401
Uncaught exception java/lang/NullPointerException.
<code>
private void clientLogin() {
//For connection
HttpConnection connection = null;
//Parameters for client login
String url =
"https://www.google.com/accounts/ClientLogin";
String email = "[email protected]";
String passwd = "Passwd=******";
String source = "source=******";
String service = "service=cl";
byte [] data =
(email+"&"+passwd+"&"+source+"&"+service).getBytes
();
authKey = "";
try {
connection = (HttpConnection)Connector.open(url);
connection.setRequestMethod(HttpConnection.POST);
connection.setRequestProperty("Content-Type",
"application/x-www-
form-urlencoded");
OutputStream outputstream =
connection.openOutputStream ();
outputstream.write(data);
outputstream.close ();
String contents;
contents = this.getData(connection);
authKey =
contents.substring(contents.indexOf("Auth=")+5).trim();
}
catch(IOException e) {
System.out.println("GoogleCalendarClient.clientLogin():
"+e.toString
());
return;
}
}
</code>
--
You received this message because you are subscribed to the Google Groups
"Google Calendar Data API" group.
To post to this group, send email to
[email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-calendar-help-dataapi?hl=en.