OK, that's all done. The bonus is that now when we get a reader error,
Jmol reports the line number of the line causing the error and also
displays the line itself.
All the readers work the same way, catching errors like our clone atom
error and passing that on to their primary reader method using a
standard routine setError(Exception e). The reader doesn't throw a new
error or write to Logger.error; instead, it just sets
atomSetCollection.errorMessage to a standard message, including the line
number and offending line, then exiting. The resolver method that calls
the reader then handles the error in a standard way and passes the error
message back to Viewer. Viewer recognizes that it got a String instead
of an atom collection and handles it appropriately.
The only problem I had was with the XML readers, because they have some
default reader routines that can't throw errors, but I think this will
work OK. Ah, I just remembered to go back and fix Atom.cloneAtom(). It
now looks like this:
Atom cloneAtom() throws Exception {
try {
return (Atom)super.clone();
} catch (Exception cnse) {
throw new Exception("cloneAtom error: " + cnse);
}
}
In this way, whatever exception comes its way, we handle it at the next
level up. For most of the readers, this is just the way all errors are
handled, and it will be picked up by setError(e) and logged and
displayed on the screen by a zap(errorMsg) from Viewer.
Sound OK?
Bob
On Feb 10, 2007, at 12:14 PM, Bob Hanson wrote:
>> Here's the basic scheme now:
>>
>> AtomSetCollection readAtomSetCollection(BufferedReader reader) {
>> this.reader = reader;
>> atomSetCollection = new AtomSetCollection("hin");
>> try {
>> readAtoms();
>> } catch (Exception e) {
>> return setError(e);
>> }
>> return atomSetCollection;
>> }
>>
>> where:
>>
>> AtomSetCollection setError(Exception e) {
>> atomSetCollection.errorMessage = "Error reading file at line: " +
>> line + "\n" + e;
>> return atomSetCollection;
>> }
>>
>
>
is this checked in somewhere so I can test it? I don't understand
most of this thread, but if I recall correctly this started from a
compile-time error on OS X that I reported. so, I want to make sure
this will work on OS X.
thanks,
tim
-- Timothy Driscoll em: [EMAIL PROTECTED] Virginia Bioinformatics
Institute ph: 540-231-3007 Bioinformatics I: M-1 im: molvisions
Washington St., Blacksburg, VA 24061
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services,
security? Get stuff done quickly with pre-integrated technology to make
your job easier. Download IBM WebSphere Application Server v.1.0.1 based
on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________ Jmol-developers mailing
list [email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-developers
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Jmol-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-developers