SWIGMapscript: processLegendTemplate throws error

Sean Gillies sgillies at FRII.COM
Mon Dec 13 09:16:39 PST 2004


Can you not try and catch, and pass in the case of an exception?
This is essentially what happens with shp2pdf.

I still have a hard time believing that the templating can work.
The mapscript function expects char** and Andreas is passing a
Java array of strings.  Does Swig-java translate these
automatically?

The templating functions certainly do not work for Perl and Python.

Sean

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
>
>
>
> On Mon, 2004-12-13 at 07:23 -0700, Sean Gillies wrote:
>> On Dec 13, 2004, at 6:14 AM, GeoIT wrote:
>>
>>> Dear experts,
>>> I used mapObj.processLegendTemplate successfully with mapserver 4.0.
>>> =
>>> Now I
>>> try to upgrade to version 440 and get the following error using this
>>> =
>>> method:
>>>
>>> Java.lang.UnknownError: Can't free NULL table
>>>
>>> Any ideas ?
>>>
>>> The code is:
>>>         public String getProcessedLegendTemplate(mapObj mapObject) {
>>>                 String[] names =3D {"img", "legend", "scalebar", =
>>> "ref"};
>>>                 String[] values =3D {"", "", "", ""};
>>>                 int numItems =3D 4;
>>>                 return mapObject.processLegendTemplate(names,
>>> values,numItems);
>>>         }
>>>
>>>
>>> regards
>>> Andreas Paukner-Ruzicka
>>>
>>
>> Andreas,
>>
>> I am very surprised that you could call processLegendTemplate
>> with MapServer 4.0.  It was my understanding that Java mapscript
>> was broken at that time.
>>
>> Please enter a report into the MapServer Bugzilla under the
>> SWIG mapscript component and I will investigate and try to fix
>> it before the next release.
>>
>> cheers,
>> Sean
>>
>> --
>> Sean Gillies
>> sgillies at frii dot com
>> http://users.frii.com/sgillies
> --
> Umberto Nicoletti <unicoletti at prometeo.it>
> Prometeo SRL
>



More information about the MapServer-users mailing list