Delete of content type with id 1003, causes custom content type handler resolution to fail

Hi, I just discovered that if content type with id 1003 is not present in the database then:
String handlerClass = admin.getContentHandlerClassForContentType( page - 999 );
Will give a NPE as it tries to find a content type 2002-999=1003 to result in a custom content type handler…

com.enonic.vertical.adminweb.AdminPage:368

To reproduce the problem delete content type with id 1003 and try content -> publishing -> “Preview selected version”

By the way would be nice if there was a copy of the old forum to check if such problems has been reported.

Hi @ksawery!

How were you able to delete the content type with ID 1003? If it is in use, foreign key restrictions should make it impossible to delete the content type from the database.

Hi @jsi
No idea, I’m a hired consultant, trying to figure out the situation on site.
Just noticed that there are some problems with the previews so I debugged the application code and found that it crashes on missing content with ID 1003. I recommended to just insert the record into the database manually to patch the problem.

Well, that may be a quick fix, and possibly all you need, but it sounds like there is some bad config in your database. Maybe some missing foreign keys or other database constrictions, that could cause more problems in the future.

If you are working for a customer with a support contract with us and more problems follow, please send us a support ticket, so we can take a closer look at your installation to find out what is really going on.