[Dspace-tech] Problem in Group and Eperson administration

8 views
Skip to first unread message

Oliver Goldschmidt

unread,
Aug 26, 2015, 2:27:16 PM8/26/15
to dspace-tech
Hello,

I have a problem in DSpace 5.1. After upgrading from DSpace 4.2 I cannot
change publication permissions or workflow step permissions on a
collection or select users in the permission system.
I have tracked down the error and it seems to be most likely a bug, but
I'm not 100% sure...

Trying to use http://dspace-instance/tools/eperson-list?multiple=false
(after having logged in as admin) is throwing an NPE:
2015-04-27 17:19:52,812 DEBUG org.dspace.storage.rdbms.DatabaseManager @
Running query "SELECT * FROM eperson e ORDER BY ?" with parameters:
m_text_value
2015-04-27 17:19:52,817 WARN
org.dspace.app.webui.servlet.InternalErrorServlet @
:session_id=XX...XX:internal_error:-- URL Was:
https://dspace.tub.tuhh.de/tools/eperson-list?multiple=false
-- Method: GET
-- Parameters were:
-- multiple: "false"

java.lang.NullPointerException
at org.dspace.eperson.EPerson.findAll(EPerson.java:518)

The reason for this error is, that I do not have a field m_text_value in
the table eperson, so the query fails.

Is this a bug or have I missed something upgrading the database?

Best regards
Oliver


Monika C. Mevenkamp

unread,
Aug 26, 2015, 2:27:26 PM8/26/15
to Oliver Goldschmidt, dspace-tech@lists.sourceforge.net Tech
looks to me like a typo in the code 

and 

where it says s = "m_text_value”;   it should be s = “m.text_value";

Monika

________________
Monika Mevenkamp
phone: 609-258-4161
Princeton University, Princeton, NJ 08544


------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
DSpace-tech mailing list
DSpac...@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dspace-tech
List Etiquette: https://wiki.duraspace.org/display/DSPACE/Mailing+List+Etiquette

Oliver Goldschmidt

unread,
Aug 26, 2015, 2:27:27 PM8/26/15
to Monika C. Mevenkamp, dspace-tech@lists.sourceforge.net Tech
Thank you, Monika. That makes sense - I will try to try that locally.

Best regards
Oliver

Oliver Goldschmidt

unread,
Aug 26, 2015, 2:27:29 PM8/26/15
to dspac...@lists.sourceforge.net
Thanks again, but I guess that's not all. Changing m_text_value to m.text_value in the EPerson class is still throwing an NPE, because the SQL query is still not correct:
2015-04-28 17:04:36,075 DEBUG org.dspace.storage.rdbms.DatabaseManager @ Running query "SELECT * FROM eperson e ORDER BY ?"  with parameters: m.text_value

I can't sort on a field from table m, when table m is not involved in the query.

I will investigate this a little more. Perhaps the parameters s and t are switched by accident?

Best regards
Oliver

Mark H. Wood

unread,
Aug 26, 2015, 2:27:33 PM8/26/15
to dspac...@lists.sourceforge.net
On Tue, Apr 28, 2015 at 05:13:55PM +0200, Oliver Goldschmidt wrote:
> Thanks again, but I guess that's not all. Changing m_text_value to
> m.text_value in the EPerson class is still throwing an NPE, because the
> SQL query is still not correct:
> 2015-04-28 17:04:36,075 DEBUG org.dspace.storage.rdbms.DatabaseManager @
> Running query "SELECT * FROM eperson e ORDER BY ?" with parameters:
> m.text_value

Um, can one use parameters that way in SQL? I thought not. Shouldn't
this be done by composing the SELECT using string concatenation? We
don't get "m.text_value" from the user, do we?

> I can't sort on a field from table m, when table m is not involved in
> the query.

You're quite right: "m" is not defined in the statement. Guessing
from the name, I'd say this was meant to be ordering a select from
metadatavalue, since that is the only table which has a 'text_value'
column.

[digs through the code]

Something is quite wrong. The query at EPerson line 518 is:

SELECT * FROM eperson e
LEFT JOIN metadatavalue m on (m.resource_id = e.eperson_id and
m.resource_type_id = ? and m.metadata_field_id = ?)
ORDER BY ?

> I will investigate this a little more. Perhaps the parameters s and t
> are switched by accident?
>
> Best regards
> Oliver
>
> Am 28.04.2015 um 16:34 schrieb Oliver Goldschmidt:
> > Thank you, Monika. That makes sense - I will try to try that locally.
> >
> > Best regards
> > Oliver
> >
> > Am 28.04.2015 um 16:10 schrieb Monika C. Mevenkamp:
> >> looks to me like a typo in the code
> >>
> >> https://github.com/DSpace/DSpace/blob/master/dspace-api/src/main/java/org/dspace/eperson/EPerson.java#L502
> >> and
> >> https://github.com/DSpace/DSpace/blob/master/dspace-api/src/main/java/org/dspace/eperson/EPerson.java#L510
> >>
> >> where it says s = "m_text_value”; it should be s = “m.text_value";
> >>
> >> Monika
> >>
> >> ________________
> >> Monika Mevenkamp
> >> phone: 609-258-4161
> >> Princeton University, Princeton, NJ 08544
> >>
> >>
> >>> On Apr 27, 2015, at 11:26 AM, Oliver Goldschmidt
Mark H. Wood
Lead Technology Analyst

University Library
Indiana University - Purdue University Indianapolis
755 W. Michigan Street
Indianapolis, IN 46202
317-274-0749
www.ulib.iupui.edu
signature.asc

Oliver Goldschmidt

unread,
Aug 26, 2015, 2:27:41 PM8/26/15
to dspac...@lists.sourceforge.net
Hi Mark and Monika,

Mark, the syntax of the SQL statement is ok, this notation is valid for statements (I don't recall the name of this technique, but it has one).

Monika has sent me a suggestion offlist, which helps, but still does not solve the problem. EPerson is still throwing an NPE, in line 517, which is the line, where the SQL statement is executed. The strange thing is: I do not see a line in my log, where the statement is executed... Here a small excerpt from my log:

------------------

2015-04-29 09:55:38,354 DEBUG org.dspace.app.webui.servlet.DSpaceServlet @ tub...@tuhh.de:session_id=XX...XX:ip_addr=xxx:http_request:-- URL Was\colon; https\colon;//dspace.tub.tuhh.de/tools/eperson-list?multiple=false
-- Method\colon; GET
-- Parameters were\colon;
-- multiple\colon; "false"

2015-04-29 09:55:38,358 WARN  org.dspace.app.webui.servlet.InternalErrorServlet @ :session_id=XX...XX:internal_error:-- URL Was: https://dspace.tub.tuhh.de/tools/eperson-list?multiple=false

-- Method: GET
-- Parameters were:
-- multiple: "false"

java.lang.NullPointerException
        at org.dspace.eperson.EPerson.findAll(EPerson.java:517)
        at org.dspace.app.webui.servlet.admin.EPersonListServlet.doDSGet(EPersonListServlet.java:91)
        at org.dspace.app.webui.servlet.DSpaceServlet.processRequest(DSpaceServlet.java:119)
        at org.dspace.app.webui.servlet.DSpaceServlet.doGet(DSpaceServlet.java:67)
(...)
        at java.lang.Thread.run(Thread.java:745)
2015-04-29 09:55:38,375 DEBUG org.dspace.storage.rdbms.DatabaseManager @ Running query "SELECT * FROM MetadataValue WHERE resource_id= ? and resource_type_id = ? ORDER BY metadata_field_id, place"  with parameters: 1,7

----------------------

The statement in the last log line should work, I have checked it manually. Although there is another NPE after it:

----------------------
java.lang.NullPointerException
        at org.dspace.storage.rdbms.DatabaseManager.queryTable(DatabaseManager.java:230)
        at org.dspace.content.DSpaceObject$MetadataCache.retrieveMetadata(DSpaceObject.java:1330)
        at org.dspace.content.DSpaceObject$MetadataCache.get(DSpaceObject.java:1265)
        at org.dspace.content.DSpaceObject.getMetadata(DSpaceObject.java:676)
        at org.dspace.content.DSpaceObject.getMetadata(DSpaceObject.java:585)
---------------------

You can find my code here:
https://github.com/olli-gold/DSpace/blob/epersonbug/dspace/modules/additions/src/main/java/org/dspace/eperson/EPerson.java

Any ideas? This seems to be a nasty little bug...

Thanks for your attention and suggestions!
Oliver

Oliver Goldschmidt

unread,
Aug 26, 2015, 2:27:41 PM8/26/15
to dspac...@lists.sourceforge.net
Since I believe this is a serious bug, I have created a bug report in Jira for this: https://jira.duraspace.org/browse/DS-2558.

So we can continue discussing this issue there.

Thanks
Oliver
Reply all
Reply to author
Forward
0 new messages