You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@clerezza.apache.org by "Manuel Innerhofer (JIRA)" <ji...@apache.org> on 2010/03/11 18:35:27 UTC

[jira] Commented: (CLEREZZA-153) DiscoBitsHandler - NullPointerException while put operation ( at org.apache.clerezza.platform.security.UserUtil.getUserName(UserUtil.java:70))

    [ https://issues.apache.org/jira/browse/CLEREZZA-153?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12844145#action_12844145 ] 

Manuel Innerhofer commented on CLEREZZA-153:
--------------------------------------------

The bug is fixed in trunk. The problem was that the Timer-thread has no javax.security.auth.Subject associated to it. Therefore trying to get the name from the subject caused the NullpointerException. The fix is if the subject is null, then no triple is added which would point from the putted file to its creator. If you want to associate your file with a creator you have to execute your code as the desired subject. To create a subject you can use the org.apache.clerezza.platform.security.UserUtil:

Subject subject = UserUtil.createSubject("admin");
subject.doAs(...


> DiscoBitsHandler  - NullPointerException while  put operation (   at org.apache.clerezza.platform.security.UserUtil.getUserName(UserUtil.java:70))
> --------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CLEREZZA-153
>                 URL: https://issues.apache.org/jira/browse/CLEREZZA-153
>             Project: Clerezza
>          Issue Type: Bug
>            Reporter: Oliver Strässer
>            Priority: Critical
>
> i use a timer to shedule events. in this scheduled functions i check for new pdf files and i found new files, i  save the pdf in the contentgraph (via the DiscoBitsHandler function put())
> my source to save the online pdf file: 
>             URL u = new URL(url);
>             URLConnection urlc = u.openConnection();
>             InputStream is = urlc.getInputStream();
>             ByteArrayOutputStream bos = new ByteArrayOutputStream();
>             bos.write(is.read());
>             byte[] ba = bos.toByteArray();
>             discobitsHandler.put(new UriRef("http://localhost/testURL"), MediaType.valueOf("application/pdf"), ba);
> the following error occurs: 
> java.lang.NullPointerException
>         at org.apache.clerezza.platform.security.UserUtil.getUserName(UserUtil.java:70)
>         at org.apache.clerezza.platform.security.UserUtil.getCurrentUserName(UserUtil.java:43)
>         at org.apache.clerezza.platform.content.hierarchy.HierarchyService.getCreator(HierarchyService.java:426)
>         at org.apache.clerezza.platform.content.hierarchy.HierarchyService.addCreationProperties(HierarchyService.java:404)
>         at org.apache.clerezza.platform.content.hierarchy.HierarchyService.createCollectionNode(HierarchyService.java:305)
>         at org.apache.clerezza.platform.content.hierarchy.HierarchyService.createCollectionNode(HierarchyService.java:377)
>         at org.apache.clerezza.platform.content.hierarchy.HierarchyService.addToParent(HierarchyService.java:255)
>         at org.apache.clerezza.platform.content.hierarchy.HierarchyService.createCollectionNode(HierarchyService.java:304)
>         at org.apache.clerezza.platform.content.hierarchy.HierarchyService.createCollectionNode(HierarchyService.java:377)
>         at org.apache.clerezza.platform.content.hierarchy.HierarchyService.addToParent(HierarchyService.java:255)
>         at org.apache.clerezza.platform.content.hierarchy.HierarchyService.createCollectionNode(HierarchyService.java:304)
>         at org.apache.clerezza.platform.content.hierarchy.HierarchyService.createCollectionNode(HierarchyService.java:377)
>         at org.apache.clerezza.platform.content.hierarchy.HierarchyService.addToParent(HierarchyService.java:255)
>         at org.apache.clerezza.platform.content.hierarchy.HierarchyService.createNonCollectionNode(HierarchyService.java:156)
>         at org.apache.clerezza.platform.content.hierarchy.HierarchyService.createNonCollectionNode(HierarchyService.java:277)
>         at org.apache.clerezza.platform.content.AbstractDiscobitsHandler.put(AbstractDiscobitsHandler.java:82)
>         at net.getunik.app.google.alerts.core.GoogleAlertsProvider.downloadFile(GoogleAlertsProvider.java:246)
>         at net.getunik.app.google.alerts.core.GoogleAlertsProvider.getPDF(GoogleAlertsProvider.java:196)
>         at net.getunik.app.google.alerts.core.GoogleAlertsProvider.saveNode(GoogleAlertsProvider.java:543)
>         at net.getunik.app.google.alerts.core.GoogleAlertsProvider.updateFeed(GoogleAlertsProvider.java:283)
>         at net.getunik.app.google.alerts.core.GoogleAlertsProvider.refreshFeeds(GoogleAlertsProvider.java:272)
>         at net.getunik.app.google.alerts.core.GoogleAlertsProvider$1.run(GoogleAlertsProvider.java:145)
>         at java.util.TimerThread.mainLoop(Unknown Source)
>         at java.util.TimerThread.run(Unknown Source)
> the problem is, that no usercontext is available (because i use the timer - and i need the timer)
> can you fix this problem anyway - so that i can put the pdf file?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.