After running thru the OAuth process, I got back a bunch of parms. I
then used them in my application but got a taceback. Here is the code
and the trace back, any idea what I am doing wrong.
BTW ... I am not sure if any of these tokens need to be protected, so
I just replaced the actual info with "blah...."
try {
PicasawebService myService = new PicasawebService
("myPgm");
OAuthParameters oauthParms = new OAuthParameters();
oauthParms.setOAuthToken("blah.......");
oauthParms.setOAuthTokenSecret("blah.....");
oauthParms.setOAuthConsumerKey("anonymous");
oauthParms.setOAuthConsumerSecret("anonymous");
try {
myService.setOAuthCredentials(oauthParms, null);
} catch (OAuthException ex) {
Logger.getLogger(blah.class.getName()).log
(Level.SEVERE, null, ex);
}
// } catch (AuthenticationException ex) {
// Logger.getLogger(blah.class.getName()).log
(Level.SEVERE, null, ex);
// }
URL feedUrl = null;
try {
feedUrl = new URL("
http://picasaweb.google.com/data/
feed/api/user/myId?kind=album");
} catch (MalformedURLException ex) {
Logger.getLogger(blah.class.getName()).log
(Level.SEVERE, null, ex);
}
UserFeed myUserFeed = null;
try {
myUserFeed = myService.getFeed(feedUrl,
UserFeed.class); // <- this is the line the generates the traceback
} catch (IOException ex) {
Logger.getLogger(blah.class.getName()).log
(Level.SEVERE, null, ex);
} catch (ServiceException ex) {
Logger.getLogger(blah.class.getName()).log
(Level.SEVERE, null, ex);
}
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at
com.google.gdata.client.authn.oauth.OAuthHelper.addCommonRequestParameters
(OAuthHelper.java:636)
at
com.google.gdata.client.authn.oauth.OAuthHelper.getAuthorizationHeader
(OAuthHelper.java:552)
at com.google.gdata.client.GoogleAuthTokenFactory
$OAuthToken.getAuthorizationHeader(GoogleAuthTokenFactory.java:199)
at com.google.gdata.client.http.HttpGDataRequest.<init>
(HttpGDataRequest.java:316)
at com.google.gdata.client.http.GoogleGDataRequest.<init>
(GoogleGDataRequest.java:436)
at com.google.gdata.client.http.GoogleGDataRequest
$Factory.createRequest(GoogleGDataRequest.java:73)
at com.google.gdata.client.http.HttpGDataRequest
$Factory.getRequest(HttpGDataRequest.java:161)
at com.google.gdata.client.Service.createRequest(Service.java:
678)
at com.google.gdata.client.GoogleService.createRequest
(GoogleService.java:525)
at com.google.gdata.client.Service.createFeedRequest
(Service.java:1055)
at com.google.gdata.client.Service.getFeed(Service.java:896)
at com.google.gdata.client.GoogleService.getFeed
(GoogleService.java:631)
at com.google.gdata.client.Service.getFeed(Service.java:916)