Ivan Masár created DS-1428:
------------------------------

             Summary: improve error message preventing removal of item when 
browse indices were changed but not reinitialized
                 Key: DS-1428
                 URL: https://jira.duraspace.org/browse/DS-1428
             Project: DSpace
          Issue Type: Bug
    Affects Versions: 3.0
            Reporter: Ivan Masár


I accidentally used a default dspace.cfg without my custom browse indices when 
I was trying to remove an item (actually I was running "dspace import 
--replace"). The resulting error message doesn't give an unsuspecting user much 
useful information:

org.postgresql.util.PSQLException: ERROR: update or delete on table "item" 
violates foreign key constraint "bi_5_dmap_item_id_fkey" on table "bi_5_dmap"
  Detail: Key (item_id)=(4742) is still referenced from table "bi_5_dmap".
        at 
org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2103)
        at 
org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1836)
        at 
org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)
        at 
org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:512)
        at 
org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:388)
        at 
org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:334)
        at 
org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105)
        at 
org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105)
        at 
org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105)
        at 
org.dspace.storage.rdbms.DatabaseManager.updateQuery(DatabaseManager.java:421)
        at 
org.dspace.storage.rdbms.DatabaseManager.deleteByValue(DatabaseManager.java:572)
        at 
org.dspace.storage.rdbms.DatabaseManager.delete(DatabaseManager.java:536)
        at 
org.dspace.storage.rdbms.DatabaseManager.delete(DatabaseManager.java:760)
        at org.dspace.content.Item.delete(Item.java:2051)

This exception should be caught and if the SQL error message contains 
bi_[number]_dmap_item_id_fkey, it should explain that the item you're trying to 
remove is still referenced from the browse index table, which happens if you 
changed the browse index fields configuration in dspace.cfg, but didn't run 
index-init. The solution is either to restore the configuration matching the 
database or to update the browse indices by running index-init.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Dspace-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dspace-devel

Reply via email to