fbpatel / google-feedserver

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

UserInfo null in Request, userInfo.getEmail() fails #5

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Get latest
2. Follow the instructions here
http://code.google.com/p/google-feedserver/wiki/SettingUpADevelopmentEnvironment
3. run the server with derby and hit http://localhost:8080/example.com/.contact

http://code.google.com/p/google-feedserver/wiki/SettingUpADevelopmentEnvironment

What is the expected output? What do you see instead?
Feed with contacts

Exception
http://code.google.com/p/google-feedserver/wiki/SettingUpADevelopmentEnvironment

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

Please provide any additional information below.

File:com.google.feedserver.samples.adapters.IBatisCollectionAdapter
Method: getRequestParams(context)

This happens because the userInfo param in request context is null and
there is an access on UserInfo without null check.

UserInfo userInfo = getUserInfoForRequest(request);
params.put("opensocial_viewer_email", userInfo.getEmail()):

A simple null check resolves the issue and i can the see the feeds.
params.put("opensocial_viewer_email", 
        (userInfo != null ) ? userInfo.getEmail() : "user@example.com");

I am not completely aware of the use-case and if defaulting the email is
OK? Submitting a patch anyway (Attached)

Original issue reported on code.google.com by anirudhd...@gmail.com on 2 Jul 2009 at 6:54

Attachments:

GoogleCodeExporter commented 9 years ago
This is the exception/:
java.lang.NullPointerException
        at
com.google.feedserver.samples.adapters.IBatisCollectionAdapter.getRequestParams(
IBatisCollectionAdapter.java:183)
        at
com.google.feedserver.samples.adapters.IBatisCollectionAdapter.retrieveFeed(IBat
isCollectionAdapter.java:80)
        at
com.google.feedserver.wrappers.ManagedCollectionAdapterWrapper.retrieveFeed(Mana
gedCollectionAdapterWrapper.java:99)
        at
com.google.feedserver.samples.wrappers.IBatisAdapterWrapper.retrieveFeed(IBatisA
dapterWrapper.java:100)
        at
com.google.feedserver.wrappers.ManagedCollectionAdapterWrapper.retrieveFeed(Mana
gedCollectionAdapterWrapper.java:99)
        at
com.google.feedserver.manager.AbstractWrapperManager.retrieveFeed(AbstractWrappe
rManager.java:194)
        at
com.google.feedserver.adapters.AbstractManagedCollectionAdapter.getFeed(Abstract
ManagedCollectionAdapter.java:110)
        at
org.apache.abdera.protocol.server.processors.CollectionRequestProcessor.processC
ollection(CollectionRequestProcessor.java:45)
        at
org.apache.abdera.protocol.server.processors.CollectionRequestProcessor.process(
CollectionRequestProcessor.java:38)
        at
org.apache.abdera.protocol.server.impl.AbstractProvider.process(AbstractProvider
.java:136)
        at org.apache.abdera.protocol.server.FilterChain.next(FilterChain.java:42)
        at
org.apache.abdera.protocol.server.servlet.AbderaServlet.service(AbderaServlet.ja
va:90)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
        at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
        at
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.jav
a:1098)
        at
com.google.feedserver.server.servlet.MethodOverrideServletFilter.doFilter(Method
OverrideServletFi

Original comment by anirudhd...@gmail.com on 2 Jul 2009 at 6:59