History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: SAK-11469
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Critical Critical
Assignee: Unassigned
Reporter: Damian Sobieralski
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Sakai

Compare function on citation removal from results screen causes an exception to be thrown

Created: 11-Sep-2007 10:30   Updated: 23-Oct-2008 07:47
Component/s: Citations Helper
Affects Version/s: trunk [DO NOT USE], 2.5.0
Fix Version/s: 2.5.0

Time Tracking:
Not Specified

File Attachments: None
Image Attachments:

1. RemoveBug.png
(73 kb)

2.4.x Status: None
2.5.x Status: None
2.6.x Status: None


 Description  « Hide
Exception is being throwing when compare() is called with only one valid argument. This exception happens when a citation is attempted to be removed from the Search screen (via the remove button). Compare seems to be called when m_order tries to remove a citation from m_order (line 2763 as of this ticket).

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Damian Sobieralski - 11-Sep-2007 10:34
I'm not sure how this is happening. I submitted a band-aid in the code to limp through but the proper cause needs to be found.

Damian Sobieralski - 11-Sep-2007 10:50
Here's the page/screen where the remove button causes that exception

Jim Eng - 11-Sep-2007 10:54
Is there a stack trace for the exception?

Jim Eng - 11-Sep-2007 10:55
Does the comparator have any cases to deal with null values?

Damian Sobieralski - 11-Sep-2007 11:29
WARN: Exception calling method doMessageFrame java.lang.reflect.InvocationTargetException (Caused by java.lang.ClassCastException) (2007-09-11 14:13:03,815 http-8080-Processor24_org.sakaiproject.cheftool.VelocityPortletPaneledAction)

 What happens is that if I do a search (say chicago bears). Then add a citation via the add button. Then go back to "revise citations". Then go "back to search results". Try to hit the "remove" button I get the above problem. Where it happens is:

CitationHelperAction:

2237: public void doMessageFrame(RunData data)

2306: else if(operation.equalsIgnoreCase("remove"))
2307: {
2308: logger.debug("removing citation " + citationId + " from " + collectionId);
2309: collection.remove( citation );

BaseCitationService:

2761: public boolean remove(Citation item)
2762:{
2763: checkForUpdates();
2764: boolean success = true;
2765: this.m_order.remove(item.getId());

 2765 throws the ClassCastException. I followed it via Eclipse and calling remove is on m_oder is calling compare

2011: public int compare(Object arg0, Object arg1)
2012: {
2013: int rv = 0;
2014: if (!(arg0 instanceof String) || !(arg1 instanceof String))
2015: {
2016: throw new ClassCastException();
2017: }
2018:
2019: Object obj0 = m_citations.get(arg0);
2020: Object obj1 = m_citations.get(arg1);
2021:
2022: // Stopgap fix
2023: /*
2024: if ((obj0 == null && obj1 != null) ||
2025: (obj0 != null && obj1 == null))
2026: return 0;
2027: */
2028:
2029: if (!(obj0 instanceof Citation) || !(obj1 instanceof Citation))
2030: {
2031: throw new ClassCastException();
2032: }


 My band-aid is 2022 -2027 so you'l have to comment it out to see the exception.

  In Eclipse I set a breakpoint and stepped through the code while inspecting variables. arg0 and arg1 do have values at 2013. So we get past 2017 okay. Then 2019 and 2020 are the problems. arg0 lookup on 2019 always return null. Yet 2020 returns a citation. So obviously the 2029 check throws that ClassCastException.

Jim Eng - 23-Sep-2007 12:33
Is this still an issue? It seems like the addition of the multiple-key comparator or Damian's "stopgap fix" takes care of this.

Jim Eng - 23-Sep-2007 12:33
Is this fixed?

Damian Sobieralski - 24-Sep-2007 06:12
No, although the stopgap fix will get us through. We need to eventually look through that DB process I was asking about (emailing) last week as I think the exception is being thrown related to bogus citation IDs in the list. This was the ticket I was looking at when I was asking those questions about those copied orphaned DB entries.

  I'll add a JIRA ticket for it and relate it to this ticket.

  Anyways, for 2.5 I think we're okay w/ the stogap solution. But it is not FIXED...more like mitigated.

Megan May - 03-Oct-2007 13:51
Updating fix version to 2.5.0.003 as tag was just cut and this ticket was included.

Jon Dunn - 15-Nov-2007 14:39
Jim, is this one you can verify and close?

Jim Eng - 20-Nov-2007 09:06
This was fixed and verified in September. I is already merged to 2.5.x.