Opened 19 years ago
Last modified 18 years ago
#1128 new defect
processLegendTemplate throws error
Reported by: | Owned by: | sdlime | |
---|---|---|---|
Priority: | high | Milestone: | FUTURE |
Component: | MapScript-SWIG | Version: | 4.4 |
Severity: | normal | Keywords: | |
Cc: |
Description
On Dec 13, 2004, at 10:08 AM, Umberto Nicoletti wrote: > Sean, > the problem is in maphash.c around line 126. There you can see that > mapserver sets an error because the user tried to free an already null > hashTable and this causes Java mapscript to bail out with an > exception, while in earlier versions the error was ignored. > > This is a consequence of my patch for handling mapserver errors as > exceptions in java mapscript. In fact I have faced a similar error > while trying to produce pdf output from Java mapscript. The same map > file was working fine with shp2pdf because shp2pdf was just ignoring > the error. I believe that my patch, while trying to prevent the java > virtual machine from crashing altogether, ends up throwing exceptions > when instead it is dealing with a warning (even tough it is an error > in mapserver terms). > What we need is probably some fine tuning for situations like this... > > Apologies to Andreas if this is not helping you, but I am just trying > to generalize your problem so that we can work out a (hopefully) > better solution. > > Please let me know what you think about this, > Umberto >
Attachments (1)
Change History (8)
by , 19 years ago
Attachment: | char_typemap.i added |
---|
comment:1 by , 19 years ago
Great. I knew that you had have this! Before we can commit it we need to know who the author is. Did you write it?
comment:2 by , 19 years ago
The author is whoever commited this into SWIG, this is just cut and pasted from http://www.swig.org/Doc1.3/Java.html, section 19.9.4. But it will not work with mapserver's char** arrays since the typemap assumes the last pointer will be NULL. If it's not, and with mapserver it is not, it will overrun the char** array.
comment:3 by , 19 years ago
Status: | new → assigned |
---|
OK. Some work remains to be done. The signature of the processLegendTemplate method looks like this: char *processLegendTemplate(char **names, char **values, int numentries) what Java users need is a typemap that will convert two Java string arrays (of names and values) into char **names and char **values, each of length equal to numentries. Something like this: typemap(in) (char ***names, char **values, int numentries) { /* convert two Java string arrays */ ... } I will commit such a typemap, but I can not make the time to write it. The attachment to this bug is a good start, but it is not ready to be committed into mapscript. As an aside, I cannot understand why anyone would want to use MapServer templates with Java! Why not use standard Java templating?
comment:4 by , 19 years ago
Hi Sean, In your last comment you wrote: "As an aside, I cannot understand why anyone would want to use MapServer templates with Java! Why not use standard Java templating?" Why should I iterate through all active layers with all classes and generate the according legend symbols, put together an HTML legend based on a template if I then simply have the same as mapserver does in half of the processing time by simply calling processLegendTemplate() ? processLegendTemplate() is easy to use, produces exactly what I want, is flexible and fast. That's it ! What I can't understand: Why did the attached typemap work with mapserver 4.0 ? I can use processLegendTemplate() with SWIGMapscript 4.0 from within Java without any problem ! regards Andreas Paukner-Ruzicka Geo-IT GmbH
comment:5 by , 19 years ago
Milestone: | → 4.6 release |
---|
Jerry, you mentioned on IRC that you were working on a safe typemap. Any progress?
comment:6 by , 18 years ago
Milestone: | 4.6 release → FUTURE |
---|
Note:
See TracTickets
for help on using tickets.
Typemap for mapping C type char to Java String[]