Open tbonfort opened 12 years ago
Author: sgillies@frii.com Date: 2004/09/24 - 19:39
Actually, I just fixed the issue with WMS functions in bug 894, and will take
the same route to address the OGR issue. We're trying to keep mapserver
config macros out of the SWIG interface files.
Python mapscript already has a comprehensive and well performing exception
mechanism -- exceptions may be raised on *every* method call, not just map
initialization. See how I'm doing it in mapscript/python/pymodule.i?
That %exception { } block in pymodule.i defines code that is attached to every
method. _raise_ms_exception() is the bridge between the mapserver error stack
and python (or java) exceptions. This function here could be adapted to use
SWIG_Exception() instead of PyErr_SetString() and then Python and Java could
share this code.
Author: unicoletti Date: 2004/09/27 - 14:36
I only wanted to make a proposal, since I noticed that the standard swig exception
code was not used anywhere.
Now that I know, I am going to work on pymodule.i and make the code shareable
between java and python at least. It should be relatively simple to port to
other languages.
Shall I open new bug/feature request or attach the patch to this one?
Author: sgillies@frii.com Date: 2004/09/28 - 21:29
I suggest copying pymodule.i -> java/javamodule.i and then putting a conditional
inclusion for it in mapscript.i. Once you have Java exceptions working and
have some tests, then we can work on merging Java and Python exceptions
for the upcoming 4.4 release.
Author: unicoletti Date: 2004/09/30 - 18:20
I am attaching a patch against latest cvs and a pymodule.i file that goes in
mapscript/java.
The latter is basically a reviewed version of pymodule.i found in mapscript/python.
It enables exception reporting for every method and it works for both python and
java, so it can be shared. Unfortunately when applied to python the tests break,
but the examples seem to work. It might be that some of them espect a different
exception or compile flag than those I used. I am posting that anyway because
you can just drop the python part and keep two separate exception handlers for now.
NOTE: the patch modifies your copy of mapscript/python/pymopule.i so that it is
the same as mapscript/java.
I am using configure flags: --with-threads --with-proj
Author: sgillies@frii.com Date: 2004/10/01 - 00:43
OK, committed to CVS HEAD (4.3). Builds and tests pass. I was also able
to trigger a Java IOException like this:
[sean@lenny java]$ java -classpath ./:examples/:./mapscript.jar
-Djava.library.path=. DrawMap ../../tests/testx.map ./map.png
Exception in thread "main" java.io.IOException: (../../tests/testx.map)
at mapscriptJNI.new_mapObj(Native Method)
at mapObj.<init>(mapObj.java:304)
at DrawMap.main(DrawMap.java:29)
Please let me know how this works for you.
Author: unicoletti Date: 2004/10/01 - 11:46
A quick run on my demo map application was successful. I was also able to
reproduce the exception.
Thanks,
Umberto
Author: sgillies@frii.com Date: 2004/10/03 - 23:24
OK. Closed, waiting for other mapscript users to speak up about their
languages.
Reporter: unicoletti Date: 2004/09/24 - 18:05