This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I am very frustrated, trying to accomplish something I thought would be relatively easy. I have a bean that is used to execute a sql statement and get a small resultset. I had code in this bean that would turn the resultset into a vector, for use by a JSP. I pulled out the 'vectorizing' code into a separate class, in the same package, so I could reuse it from other beans. My problem seems to be that my original bean cannot get at the vectorizing class/bean, and I don't understand why, as what I'm doing corresponds with the various examples I have at hand. Can someone help me figure out what I am missing, as the Java errors (or lack thereof) that I am getting do NOT tell me anything... SelectBuilder.java -- gets specified column info from a specified table, for use in building a dropdown select box. See 'Vectorizer vizer = new Vectorizer();' and below in the setColVals() method:
Vectorizer.java -- turns a resultset into a vector. I've tried using an empty constructor in this class, also no constructor, and a constructor witha debug statement in it, but apparently nothing gets even as far as running the class.
pardon me, but you've obviously mistaken me for someone who gives a damn...
Kristy: If you are able to compile the SelectBuilder class, my guess is that your createStatement is throwing some exceptions, you catch them and return. Unless your debug is true (i verified you set it to false and you write to your log file.
The other possibility is your package stmt has a typo. I know it is not in your posted code, but in real code. Assuming that for posting your code in a public forum you might have changed your package stmt, I for one would do it... Let us know what happens. - satya
Just had to add $0.02... Don't return from inside a catch block! Don't return inside a try or finally either, use a flag to decide what to do then test the flag outside that code. If you have the code as it stands then decide later on to add a finally, you'll end up getting code that executes after the return is called since the finally block is guarenteed to execute. I can't paste it at the moment, but if you have a look at the various possibilities you can get some strange code, like exceptions that get thrown but just disappear... Dave.