[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: problem with java.util.Map
Hi Don,
On Son, 06 Aug 2000, Don Berendsen wrote:
> I've run into some problems using TreeMaps with ozone 0.5.3, Java 1.3,
> Win98.
>
> Trying to return any entrySet (or keySet) results in a
> java.lang.NullPointerException. Is this a programming error? See example
> below.
I really tried to figure out this problem - I can reproduce this with ozone
0.5.4 and JDK 1.2.2. But I had no luck to solve it. I'm not the database core
developer, so the only thing we can do is waiting until Falko is present again.
>
> Thanks very much,
>
> don
>
> -------------------- Local.java
>
> import java.util.*;
> import org.ozoneDB.*;
>
>
> public class Local extends Object {
>
> public static void main ()throws Exception {
>
> LocalDatabase db = new LocalDatabase();
> try {
> db.open ("/tmp/db");
> }
> catch (Exception e) {
> System.out.println ("No DB found, creating...");
> db.create ("/tmp/db");
> db.open ("/tmp/db");
> }
>
> db.reloadClasses();
> System.out.println ("connected...");
>
> MapTester mapTester = (MapTester)db.createObject
> (MapTesterImpl.class.getName(), OzoneInterface.Public, "maptester");
> mapTester.put("key1", "value1");
> mapTester.put("key2", "value2");
> Set entries = mapTester.entrySet();
> db.close();
> System.out.println ("deconnected...");
> }
>
> }
>
> ------------------------- MapTester.java
>
> import org.ozoneDB.*;
> import java.util.*;
>
>
> public interface MapTester extends OzoneRemote {
>
> public void put (Object key, Object value) ; /*update*/
>
> public Set entrySet();
>
> }
>
> ------------------------ MapTesterImpl.java
>
> import org.ozoneDB.*;
> import java.util.*;
>
>
> public class MapTesterImpl extends OzoneObject implements MapTester {
>
>
> public MapTesterImpl() {
> map = new TreeMap();
> }
>
> public void put (Object key, Object value) {
> map.put(key, value);
> }
>
> public Set entrySet() {
> // the exception occurs here
> return map.entrySet();
> }
>
> private Map map;
> }
> ________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
Regards,
Lars
--
___________________________________________________________________
Lars Martin mailto:lars@smb-tec.com
SMB GmbH http://www.smb-tec.com