Opened 5 years ago

Closed 5 years ago

#2187 closed defect (fixed)

ClassCastException when trying to create a new item

Reported by: Nicklas Nordborg Owned by: everyone
Priority: minor Milestone: BASE 3.15.1
Component: web Version:
Keywords: Cc:

Description (last modified by Nicklas Nordborg)

UPDATE It seems that the same error can happen in many other places as well if a filter is present in a column that is listing a linked item. For example, in the "Samples" list if there is a filter in the "Protocol" or "Kit" column.


If there is a filter on the "Plugin definition" column in the "Plugin configurations" list when the "New" button is clicked in order to create a new configuration a popup window is opened with an error message:

class java.lang.String cannot be cast to class net.sf.basedb.core.Type ...
java.lang.ClassCastException
...at net.sf.basedb.clients.web.Base.getFirstMatching(Base.java:1760)
...at org.apache.jsp.admin.pluginconfigurations.edit_005fconfiguration_jsp._jspService(edit_005fconfiguration_jsp.java:252)
...at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
...

The error goes away if the filter in the "Plugin definition" column is removed.

Change History (2)

comment:1 by Nicklas Nordborg, 5 years ago

Description: modified (diff)
Summary: ClassCastException when trying to create a new plug-in configurationClassCastException when trying to create a new item

comment:2 by Nicklas Nordborg, 5 years ago

Resolution: fixed
Status: newclosed

In 7733:

Fixes #2187: ClassCastException when trying to create a new item

It seems like the issue was caused by a side-effect to the changes made in [7605] #2151. The introduction of implicit casting to the PropertyFilter.getValueAsObject() caused the compiler to select the Expressions.parameter(String, Type) method instead of the Expressions.parameter(String, Object) method. Solved by using Expressions.parameter(String, Object, Type) instead.

Note: See TracTickets for help on using tickets.