Re: nodeFactory.getNoNamespace() returns null

Per Nyfelt <[email protected]>
Newsgroups gmane.comp.java.ozone.user
Organization Resourcing Networks
Message-ID <[email protected]>
Hi Evert,

The DOM4J implementation is in a state of flux. I'm struggling between trying 
to be a s close to the DOM4J API as possible and changing things to better 
fit Ozone (Namespace and QName for example). I've also on a contract 
assignment that takes up most of my time so I will not get back to look at 
this until later in the spring. The error you are seeing is because I have 
not made up my mind on whether Namespace should be a serializable object or a 
full OzoneObject. If you have ideas about this (which way to go) please let 
me know. If you are just looking for a persistant XMl implementation use the 
DOM implementation instead for now - it is more stable and feature complete.

Regards,
Per

tisdagen den 9 mars 2004 12.07 skrev Evert Hoff:
> Hi,
>
> I am trying to run the DocumentHelperTest example, but am getting a
> NullPointerException. It has to do with creating attributes. I have
> tried to track down the problem, but don't know what can be done to fix
> it...
>
> Here is the client output:
> ========================================
> D:\Eclipse\eclipse\workspace\ozone\modules\xml\dom4j\build\classes>java
> -classpa
> th
> .;..\..\..\..\..\server\build\lib\junit.jar;..\..\..\..\..\server\build\lib
>\o zoneServer-1.2-post_alpha.jar;..\dist\jaxen-core.jar
> test.ozoneDB.xml.dom4j.Docu
> mentHelperTest
> looking for OzoneDocumentFactory instance (DocumentFactory) for database
> RemoteD
> atabase: localhost, 3333
> returning factory class
> org.ozoneDB.xml.dom4j.o3impl.OzoneDocumentFactoryImpl_Pr
> oxy remoteID:104
> [DocumentHelperTest] - Refetching
> [DocumentHelperTest] - doc is class
> org.ozoneDB.xml.dom4j.o3impl.OzoneDocumentIm
> pl_Proxy remoteID:108
> [DocumentHelperTest] - Here's the content:
> <?xml version="1.0" encoding="UTF-8"?>
>
> [DocumentHelperTest] - Created test element class
> org.ozoneDB.xml.dom4j.o3impl.O
> zoneElementImpl_Proxy remoteID:30114
> [DocumentHelperTest] - adding content to element
> [DocumentHelperTest] - testElem.getName() test
> [DocumentHelperTest] - testElem test associated with document!
> [DocumentHelperTest] - getNamespace =
> org.dom4j.tree.AbstractNamespace@babe [Abs
> tractNamespace: prefix  mapped to URI ""]
> [DocumentHelperTest] - Here's the content:
> <?xml version="1.0" encoding="UTF-8"?>
> <test>some text</test>
> Comment added to testElem
> [DocumentHelperTest] - Here's the content:
> <?xml version="1.0" encoding="UTF-8"?>
> <test>some text<!--Comment text...--></test>
> Comment added to Document
> ========================================
>
> It hangs after "Comment added to Document", so the problem occurs during
> this line in DocumentHelperTest:
>             QName name = O3DocumentHelper.createQName("name");
>             System.out.println("Created qname");
>
> Here is the server output:
> ========================================
> (Ctrl-C or 'q' to shutdown without admin tool)
> class org.ozoneDB.xml.dom4j.o3impl.O3QNameCache O3QNameCache constructor
> invoked
>
> class org.ozoneDB.xml.dom4j.o3impl.O3QNameCache O3QNameCache constructor
> invoked
>
> [OzoneElementImpl] Creating new object
> class org.ozoneDB.xml.dom4j.o3impl.O3QNameCache O3QNameCache constructor
> invoked
>
> class org.ozoneDB.xml.dom4j.o3impl.O3QNameCache O3QNameCache constructor
> invoked
>
> createQName(name)
> looking for OzoneDocumentFactory instance (DocumentFactory) for database
> org.ozo
> neDB.Database@170888e
> returning factory class
> org.ozoneDB.xml.dom4j.o3impl.OzoneDocumentFactoryImpl_Pr
> oxy remoteID:104
> In cache: org.ozoneDB.xml.dom4j.o3impl.O3QName@337a8b [name: name
> namespace: "nu
> ll"]
> WARN   [Thread-4] InvokeServer - handleClientEvent():
> java.lang.NullPointerExcep
> tion
> java.lang.NullPointerException
>         at
> org.ozoneDB.xml.dom4j.o3impl.DefaultQName.writeObject(DefaultQName.ja
> va:198)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>         at java.lang.reflect.Method.invoke(Unknown Source)
>         at java.io.ObjectStreamClass.invokeWriteObject(Unknown Source)
>         at java.io.ObjectOutputStream.writeSerialData(Unknown Source)
>         at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)
>         at java.io.ObjectOutputStream.writeObject0(Unknown Source)
>         at java.io.ObjectOutputStream.writeObject(Unknown Source)
>         at org.ozoneDB.DxLib.net.DxClient.send(Unknown Source)
>         at org.ozoneDB.core.InvokeServer.handleClientEvent(Unknown Source)
>         at org.ozoneDB.DxLib.net.DxMultiServerClient.run(Unknown Source)
>         at java.lang.Thread.run(Unknown Source)
> ========================================
>
> The reason is the namespace is null in
> DefaultQName.writeObject(ObjectOutputStream out).
>
> That is null because nodeFactory.getNoNamespace() returns null.
>
> That is null because NamespaceCacheImpl.createNamespace(String prefix,
> String uri) has not yet been implemented:
>
>     /** A factory method to create {@link AbstractNamespace} instance
>      * @return a newly created {@link Namespace} instance.
>      */
>     protected Namespace createNamespace(String prefix, String uri) {
>         throw new RuntimeException("FIXME - should NamespaceCacheImpl
> become a real OzoneObject or whould db be passed?");
>         //return O3Namespace.create(db, prefix, uri);
>     }
>
> What can I do to fix this?
>
> Thanks in advance,
> Evert
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by: IBM Linux Tutorials
> Free Linux tutorial presented by Daniel Robbins, President and CEO of
> GenToo technologies. Learn everything from fundamentals to system
> administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
> _______________________________________________
> Ozone-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/ozone-users



-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.