[gme-users] getAttribute in Java

hernandf at cis.uab.edu hernandf at cis.uab.edu
Wed May 5 01:11:07 CDT 2004


I was trying to access attributes from an atom using the Java interface,
but the function getAttribute kept returning false. The code that i used is

JBuilderAtom gmeCredential = (JBuilderAtom)e.nextElement();
String[] temp = {""};
Vector t = gmeCredential.getStrAttributeNames();
if(gmeCredential.getAttribute((String)t.elementAt(1),temp))
	JOptionPane.showMessageDialog(null,"success",
		    	 	      Support.APPLICATION,
				      JOptionPane.INFORMATION_MESSAGE);
else
	JOptionPane.showMessageDialog(null,"failure",
		  	  	      Support.APPLICATION,
				      JOptionPane.INFORMATION_MESSAGE);

i hard coded the name of the attribute, but to avoid mispellings i
used a name returned from getStrAttributeNames. That function correctly
returned three attributes, but whenever i tried to get their values the
else part of the previous code was always executed.

When i traced the function calls, it returned the error: MemberNotFound 
(0x8002003), but that shouldn't happen since i'm using the same names
of the attributes that are stored in the atoms. I tried to use the Mga
versions but i kept getting the same error.

The values are there, but it seems that there's a problem for accessing them
by name, for example this following code retrieves the values:

try{
	String attribute =
gmeCredential.getIAtom().getAttributes().getItem(0).getStringValue();
	JOptionPane.showMessageDialog(null,attribute,
				      Support.APPLICATION,
			  	      JOptionPane.INFORMATION_MESSAGE);
} catch (Exception err){
	Support.reportError(err);
}

am i doing something wrong?

Francisco

--------------------------------------------------------------------
mail2web - Check your email from the web at
http://mail2web.com/ .




More information about the gme-users mailing list