NPE when deleting object returned by EPerson.findAll()
------------------------------------------------------

                 Key: DS-633
                 URL: http://jira.dspace.org/jira/browse/DS-633
             Project: DSpace 1.x
          Issue Type: Bug
          Components: DSpace API
    Affects Versions: 1.6.2, 1.7
            Reporter: Mark Wood
            Assignee: Mark Wood
            Priority: Critical
             Fix For: 1.7
         Attachments: DatabaseManager.patch, EPerson.patch

While building a test tool to purge all users from the database, I ran into 
persistent NPEs on EPerson.delete().  This seems to result from 
EPerson.findAll() using DatabaseManager.query(), which does not set the table 
type into the returned TableRowIterator.  DatabaseManager.delete() needs to 
know the table type in order to look up the table's primary key.  Kaboom.

It appears that query() is meant for use with queries whose result is not a 
base table type (JOINs and the like).  For a simple SELECT * FROM table... it 
seems that queryTable() should be used.  The attachment EPerson.patch makes 
this change everywhere in EPerson that it seems to be appropriate and is 
observed to eliminate the NPEs in this specific case.  (The patch also tidies 
some comments.)

The attachment DatabaseManager.patch is to defend against deletion of untyped 
rows and throw a more descriptive exception.  The class might benefit from more 
extensive antibugging work.  This patch is not essential but might be helpful 
in similar circumstances.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.dspace.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share 
of $1 Million in cash or HP Products. Visit us here for more details:
http://ad.doubleclick.net/clk;226879339;13503038;l?
http://clk.atdmt.com/CRS/go/247765532/direct/01/
_______________________________________________
Dspace-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dspace-devel

Reply via email to