Ticket #1128 (new defect)

Opened 4 years ago

Last modified 2 years ago

processLegendTemplate throws error

Reported by: info@geo-it.com Assigned to: 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

char_typemap.i (2.1 kB) - added by info@geo-it.com on 12/17/04 10:34:33.
Typemap for mapping C type char** to Java String[]

Change History

12/17/04 10:34:33 changed by info@geo-it.com

  • attachment char_typemap.i added.

Typemap for mapping C type char** to Java String[]

12/17/04 10:55:50 changed by sgillies@frii.com

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?

01/23/05 14:35:47 changed by jerry.pisk@gmail.com

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.

01/30/05 12:08:35 changed by sgillies@frii.com

  • status changed from new to 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?

02/09/05 08:56:52 changed by info@geo-it.com

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

03/29/05 10:08:50 changed by sgillies@frii.com

  • milestone set to 4.6 release.
Jerry, you mentioned on IRC that you were working on a safe typemap.  Any
progress?

11/22/05 17:26:42 changed by sgillies@frii.com

  • milestone changed from 4.6 release to FUTURE.

06/01/06 22:19:26 changed by sgillies@frii.com

  • status changed from assigned to new.
  • owner changed from sgillies@frii.com to sdlime.
reassigning.