Author Topic: Cyberkilla, In Case You'll Ever Read This  (Read 5971 times)

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
Cyberkilla, In Case You'll Ever Read This
« on: August 07, 2008, 06:13:01 pm »
I found out the location where most of the NullPointerException problems are happening: the method getChild(String) addressed as   
Code: [Select]
XMLElement geometryElement = submesh.getChild("geometry");on private static OGREVertexBuffer loadGeometry(XMLElement) is returning null! Don't know how to fix it yet, but if you don't come back soon I may have to do it myself! : -(

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
Egon, This One's For You
« Reply #1 on: August 07, 2008, 07:02:58 pm »
The following is the code for getChild(String). The only scenario in which it would return null is if your XMLFactory returned an empty Vector. Anything you can tell me about it? Any problems in the past, or will I have to dig deeper and find out where that node comes from?

EDIT: I did dig further, and it all comes down to your XMLFactory.parseXML(String) method. I smell bug. :-) If you wouldn't mind, I could look at it for you.

Code: [Select]
public XMLElement getChild(String name) {
Vector nodes = XMLFactory.getInstance().getMatchingNodes(node.getName()+"/"+name,node);
if(nodes.size() == 0)
return null;

XMLNode newNode = (XMLNode)nodes.get(0);
return new XMLElement(newNode);
}
« Last Edit: August 07, 2008, 07:15:34 pm by AGP »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Cyberkilla, In Case You'll Ever Read This
« Reply #2 on: August 07, 2008, 07:17:40 pm »
getMatchingNodes() can never return null. If creates a Vector, tries to fill it and returns it. If it's unable to fill it, it still returns an empty Vector but not null. Do you have a stack trace for this exact problem?

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
Re: Cyberkilla, In Case You'll Ever Read This
« Reply #3 on: August 07, 2008, 07:19:43 pm »
I didn't say it returned null, I said it returned an empty Vector. But read my edit.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Cyberkilla, In Case You'll Ever Read This
« Reply #4 on: August 07, 2008, 07:39:41 pm »
It returns an empty Vector if no node in the given subtree matches the pattern. However, if you want to look at it: http://www.jpct.net/download/hacks.

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
Re: Cyberkilla, In Case You'll Ever Read This
« Reply #5 on: August 07, 2008, 07:58:15 pm »
Thanks a lot, pal. Will report whatever I may find.

Offline cyberkilla

  • float
  • ****
  • Posts: 413
    • View Profile
    • http://futurerp.net
Re: Cyberkilla, In Case You'll Ever Read This
« Reply #6 on: August 14, 2008, 04:39:08 pm »
Looks like a simple problem. I suspect it is because it hasn't found the xml element.

And, that might be because the model is not using triangles only - I am pretty sure I had to convert my models to triangles before exporting - this may be a part of the OgreXML format, or a limitation I imposed accidentally.

Hopefully, this is all that is wrong. Have you tried this already?
http://futurerp.net - Text Based MMORPG
http://beta.rpwar.com - 3D Isometric MMORPG