Correct way to fail on load of document?
Correct way to fail on load of document?
- Subject: Correct way to fail on load of document?
- From: "Stephan R. Cleaves" <email@hidden>
- Date: Tue, 29 Jan 2002 20:20:09 -0500
Hi,
I'm trying to gracefully handle the attempted load of an invalid
file format in my NSDocument subclass. I implement
loadDataRepresentation and I can easily determine when I receive an
incorrectly formatted file, so I return false when I do. However, this
results in the following...
ObjCJava WARNING:
jobjc_jvm_newObject(): constructor with signature
(Ljava/lang/String;Ljava/lang/String;)V on class MyDocument failed
(should morph the java exception)
2002-01-29 19:21:48.495 MyApp[1103] (null)
With the debugger I've tracked down that my loadDataRepresentation
is in fact being called, by
com.apple.cocoa.application.NSDocument.initWithContentsOfFile and that
when I return false it is throwing a NullPointerException. The
documentation certainly seems to indicate that this is the way to handle
failure to load, but its far from graceful. What is the appropriate way
to deal with an invalid file format?
thanks,
stephan