Issue (View Online)

Key: NXP-667
Issue Type: Bug Bug
Status: Closed Closed
Priority: Minor Minor
Resolution: Fixed
Assignee: Bogdan Stefanescu
Reporter: Ruslan Spivak

Operations

View all
View comments
View history
Remote test of getting adapter for document leads to NPE 
Updated: 23/04/07 13:01   Created: 27/02/07 14:22  

The following issue has been closed.

Project: Nuxeo Enterprise Platform 5
Components: Runtime

 Description   
Sample remote test in placefulservice:

public void testDBAnnotation() throws Exception {
        DocumentModel root = _getRootDocument();
        DocumentModel file = new DocumentModelImpl(root.getPathAsString(),
                "file", "File");

        file = _createChildDocument(file);

        DBAnnotatableDocument adoc = file.getAdapter(DBAnnotatableDocument.class);
        SubscriptionConfig config = new SubscriptionConfig();
        config.setId("xxx");
        config.setEvent("publish");
        adoc.setAnnotation("SubscriptionConfig", "val1");
}

leads to:
java.lang.NullPointerException
at org.nuxeo.ecm.core.api.impl.DocumentModelImpl.findAdapter(DocumentModelImpl.java:454)
at org.nuxeo.ecm.core.api.impl.DocumentModelImpl.getAdapter(DocumentModelImpl.java:429)
        ...

which happens in:
private <T> T findAdapter(Class<T> itf) {
        DocumentAdapterService svc = (DocumentAdapterService) NXRuntime
                .getRuntime().getComponent(DocumentAdapterService.NAME);

of DocumentModelImpl.java in org.nuxeo.ecm.core.api.impl

server.log:
2007-02-27 14:51:19,443 INFO [org.nuxeo.ecm.core.api.adapter.DocumentAdapterService] Registered document adapter factorynull: interface org.nuxeo.ecm.platform.ec.placeful.DBAnnotatableDocument

The same NPE happens in standard remote tests in TestAPI.java in
// TODO: fix and reenable.
    public void testDocumentAdapter() throws Exception {
        DocumentModel root = _getRootDocument();
        DocumentModel file = new DocumentModelImpl(root.getPathAsString(),
                "file", "File");

        file = _createChildDocument(file);

        AnnotatedDocument adoc = file.getAdapter(AnnotatedDocument.class);
        assertNotNull(adoc);
        adoc.putAnnotation("key1", "val1");
        adoc.putAnnotation("key2", "val2");
        assertEquals("val1", adoc.getAnnotation("key1"));
        assertEquals("val2", adoc.getAnnotation("key2"));

        adoc = file.getAdapter(AnnotatedDocument.class);
        assertEquals("val1", adoc.getAnnotation("key1"));
        assertEquals("val2", adoc.getAnnotation("key2"));
    }

which is btw disabled at the moment.

This message was automatically generated by Atlassian JIRA Enterprise Edition, Version: 3.7.2-186 - Bug/feature request.
If you think it was sent incorrectly, contact one of this server's administrators.

_______________________________________________
ECM-tickets mailing list
[email protected]
http://lists.nuxeo.com/mailman/listinfo/ecm-tickets

Reply via email to