make core type registration raise informative exception message to help the
developers pinpoint configuration problems more quickly
-----------------------------------------------------------------------------------------------------------------------------------
Key: NXP-1833
URL: http://jira.nuxeo.org/browse/NXP-1833
Project: Nuxeo Enterprise Platform 5
Issue Type: Improvement
Affects Versions: 5.1.2
Reporter: Olivier Grisel
Assignee: Bogdan Stefanescu
Fix For: 5.1.3, 5.2 M1
For instance when registering a type that depends on a non registered schema
(e.g. because of a typo in the schema name), the following exception is raised:
org.nuxeo.ecm.core.api.ClientException: Failed to initialize repository
at
org.nuxeo.ecm.core.api.ejb.EJBExceptionHandler.wrapException(EJBExceptionHandler.java:70)
at
org.nuxeo.ecm.core.api.ejb.DocumentManagerBean.getSession(DocumentManagerBean.java:191)
at
org.nuxeo.ecm.core.api.AbstractSession.connect(AbstractSession.java:171)
at
org.nuxeo.ecm.core.api.ejb.DocumentManagerBean.connect(DocumentManagerBean.java:168)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[snipped 100KB of useless stacktrace]
Caused by: org.nuxeo.ecm.core.api.WrappedException: Exception:
org.nuxeo.ecm.core.api.DocumentException. message: Failed to initialize
repository
at
org.nuxeo.ecm.core.repository.jcr.JCRRepository.initialize(JCRRepository.java:161)
at
org.nuxeo.ecm.core.repository.jcr.JCRRepository.getSession(JCRRepository.java:98)
at
org.nuxeo.ecm.core.jca.JCAConnectionFactory.getSession(JCAConnectionFactory.java:81)
at
org.nuxeo.ecm.core.api.ejb.DocumentManagerBean.createSession(DocumentManagerBean.java:201)
at
org.nuxeo.ecm.core.api.ejb.DocumentManagerBean.getSession(DocumentManagerBean.java:188)
... 392 more
Caused by: org.nuxeo.ecm.core.api.WrappedException: Exception:
java.lang.NullPointerException. message: null
at
org.nuxeo.ecm.core.repository.jcr.TypeAdapter.getSchemaName(TypeAdapter.java:87)
at
org.nuxeo.ecm.core.repository.jcr.TypeImporter.createDocTypeDefinition(TypeImporter.java:481)
at
org.nuxeo.ecm.core.repository.jcr.TypeImporter.collectDocTypes(TypeImporter.java:432)
at
org.nuxeo.ecm.core.repository.jcr.TypeImporter.registerTypes(TypeImporter.java:117)
at
org.nuxeo.ecm.core.repository.jcr.BuiltinTypes.registerUserTypes(BuiltinTypes.java:155)
at
org.nuxeo.ecm.core.repository.jcr.BuiltinTypes.registerTypes(BuiltinTypes.java:131)
at
org.nuxeo.ecm.core.repository.jcr.JCRRepository.initialize(JCRRepository.java:157)
at
org.nuxeo.ecm.core.repository.jcr.JCRRepository.getSession(JCRRepository.java:98)
at
org.nuxeo.ecm.core.jca.JCAConnectionFactory.getSession(JCAConnectionFactory.java:81)
TypeAdapter should have raised a meaningful message such as :
throw new InvalidConfigurationException(String.format("type '%s' could not be
registered because schema '%s' was not found", typeName, schemaName));
and then JCRRepository.initialize should catch that exception a rewrapped it as
something like:
throw new ClientException("Failed to initialize repository: " +
e.getMessage(), e);
so that the developers sees directly the top level error message:
Failed to initialize repository: type 'MyType' could not be registered
because schema 'my_schema_with_a_typo' was not found
and then not have to parse hundreds of logs to know at which line of which
class to put an eclipse breakpoint and restart jboss just to get the offending
schema name.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.nuxeo.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
_______________________________________________
ECM-tickets mailing list
[email protected]
http://lists.nuxeo.com/mailman/listinfo/ecm-tickets