[MAGNOLIA-834] createVersion failed because MgnlContext.getUser() is null Created: 04/May/06 Updated: 23/Jan/13 Resolved: 04/May/06 |
|
| Status: | Closed |
| Project: | Magnolia |
| Component/s: | core |
| Affects Version/s: | 3.0 Beta 1 |
| Fix Version/s: | 3.0 Final |
| Type: | Bug | Priority: | Blocker |
| Reporter: | Ralf Hirning | Assignee: | Unassigned |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
M3.0 |
||
| Template: |
|
| Acceptance criteria: |
Empty
|
| Task DoD: |
[ ]*
Doc/release notes changes? Comment present?
[ ]*
Downstream builds green?
[ ]*
Solution information and context easily available?
[ ]*
Tests
[ ]*
FixVersion filled and not yet released
[ ] 
Architecture Decision Record (ADR)
|
| Bug DoR: |
[ ]*
Steps to reproduce, expected, and actual results filled
[ ]*
Affected version filled
|
| Date of First Response: |
| Description |
|
If I want to create a version using Content.addVersion I get an java.lang.NullPointerException because in |
| Comments |
| Comment by Ralf Hirning [ 04/May/06 ] |
|
Maybe this is important: I use addVersion within a servlet. |
| Comment by Sameer Charles [ 04/May/06 ] |
|
MgnlContext has to be set because all other magnolia 3.x API is dependent on it. In any case I can check that in versionManager. how do you retrieve Content object? because for that also you need either MgnlContext |
| Comment by Sameer Charles [ 04/May/06 ] |
|
I will do a quick fix so that you can continue using version api, for final release we need to implement default user "anonymous" |
| Comment by Sameer Charles [ 04/May/06 ] |
|
temporary fix on SVN, please test it I will open a new issue to implement Anonymous. |
| Comment by Ralf Hirning [ 04/May/06 ] |
|
now addVersion works Thanks a lot |
| Comment by Philipp Bracher [ 04/May/06 ] |
|
Attention. This exception implies that the Context is NOT set properly. If a request does not pass the EntryServlet (direct jsp calls for example) the servlet must set the context itself --> see ContextSensitiveServlet For convenience I will make a MgnlContext.initAsWebContext(request) method. |
| Comment by Sameer Charles [ 04/May/06 ] |
|
Even if MgnlContext is set, getUser will return null if you are not logged in. I will introduce Anonymous user which will be present in users workspace so you could always adopt its permissions,
|