Opened 15 years ago

Last modified 15 years ago

#1441 closed defect

Null pointer exception when checking dependent items on deleted user — at Version 1

Reported by: base Owned by: everyone
Priority: minor Milestone: BASE 2.14.2
Component: core Version:
Keywords: NullPointerException delete user Cc:

Description (last modified by Nicklas Nordborg)

Hi,

After I deleted a user and want to see items 'using User item', I get this NPE:

java.lang.NullPointerException on page /views/trashcan/view_item.jsp

Version 	BASE 2.13.1 (build #5134; schema #75)
Web server 	Apache Tomcat/6.0.20
Database Server 	PostgreSQL 8.3.8
Database Dialect 	org.hibernate.dialect.PostgreSQLDialect
JDBC Driver 	org.postgresql.Driver (version 8.4)
Java runtime 	Java(TM) SE Runtime Environment (1.6.0_03-b05), Sun Microsystems Inc.
Operating system 	Linux amd64 2.6.9-78.0.22.ELsmp
Memory 	Total: 486.3 MB
Free: 262.1 MB
Max: 910.3 MB
Browser 	Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.15) Gecko/2009102918 CentOS/3.0.15-3.el5.centos Firefox/3.0.15
Error message 	
Stack trace 	

java.lang.NullPointerException
...at ItemProxy.compareTo(ItemProxy.java:49)
...at ItemProxy.compareTo(ItemProxy.java:30)
...at java.util.TreeMap.put(TreeMap.java:545)
...at java.util.TreeSet.add(TreeSet.java:238)
...at BasicItem.addUsingItems(BasicItem.java:298)
...at User.getUsingItems(User.java:377)
...at org.apache.jsp.views.trashcan.view_005fitem_jsp._jspService(view_005fitem_jsp.java:200)
...at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)

...at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
...at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
...at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
...at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
...at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
...at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
...at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
...at net.sf.basedb.clients.web.servlet.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:70)
...at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
...at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
...at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
...at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
...at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
...at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
...at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
...at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
...at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
...at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
...at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
...at java.lang.Thread.run(Thread.java:619)

Change History (1)

comment:1 by Nicklas Nordborg, 15 years ago

Description: modified (diff)
Milestone: BASE 2.4.2

I get this also, and I think the same error can happen for other items as well.

It seems like root cause is found in the BasicItem.addUsingItems() method. The call to item.getClass() can return a dynamic Hibernate-generated proxy class. This class is not known by BASE and the Item.fromDataClass() returns null. The problems should be easy to fix by calling Item.fromDataObject(item) instead.

Note: See TracTickets for help on using tickets.