[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: opp bug?
Falko,
Is this a case where HashTable.values() returns an inner class as happens
with java.util.HashMap? In my application I wasn't able to return the
results of values() or keys() when using a HashMap. I got around this by
putting the map in a variable and using
public Collection values(){
return new ArrayList(map.values());
}
cheers,
don
>From: Falko Braeutigam <falko@smb-tec.com>
>Reply-To: ozone-users@ozone-db.org
>To: a@blackbox.net, Andreas Monitzer <am@yline.com>, ozone-dev@ozone-db.org
>CC: ozone-users@ozone-db.org
>Subject: Re: opp bug?
>Date: Sat, 9 Dec 2000 21:03:18 +0100
>
>On Sat, 09 Dec 2000, Andreas Monitzer wrote:
> > Hi!
> >
> > I'm trying to create a rather big project (a newsreader) using ozone.
>Wow, great! Do you have a link for us where we may read more about your
>project?
>
>Also, Andy, ozone doesn't force you to use the DxLib collection classes.
>They
>should work fine (ozone is build using them) but java2 collections are more
>future proof. I will maintain DxLib just as long as I need it for the ozone
>core.
>
> > But I've encountered something I think classifies as a (serious) bug.
> > I'm using the following code in a database object implementation
>(m_ngGroups.getGroups() returns a org.ozoneDB.DxLib.DxHashMap):
> >
> > public Collection getGroups() throws Exception {
> > return m_ngGroups.getGroups().internalHashtable().values();
> > }
> >
> > The proxy that is generated looks like this:
> >
> > public java.util.Collection getGroups () throws java.lang.Exception {
> > try {
> > Object target = link.fetch (this, Lock.LEVEL_WRITE);
> > if (target != null) {
> > return
>(java.util.Collection)ResultConverter.substituteOzoneCompatibles
>(((bbnet.communication.NewsServerImpl)target).getGroups());
> > }
> > else {
> > Object[] args = {};
> > Object result = link.invoke (this, 7, args,
>Lock.LEVEL_WRITE);
> > return (java.util.Collection)result;
> > }
> > }
> > catch (java.lang.Exception e) {
> > e.fillInStackTrace();
> > throw e;
> > }
> > }
> >
> > But the first "return"-line is wrong. '.internalHashtable().values()' is
>missing, so the return type isn't java.util.Collection and a
>ClassCastException is raised.
> > It's easy to work around this problem by by using a local variable, but
>I've encountered the same problem at another piece of code and can't find
>the part that opp doesn't like.
>
>The generated code is okay. What is the actual type that is returned and
>that
>is causing the exception?
>
> >
> > Either way, I'm very impressed about this database, keep up the good
>work!
>:)
>
>
>Falko
>--
>______________________________________________________________________
>Falko Braeutigam mailto:falko@smb-tec.com
>SMB GmbH http://www.smb-tec.com
>
_____________________________________________________________________________________
Get more from the Web. FREE MSN Explorer download : http://explorer.msn.com