This is most likely a bug in the gdBuffer typemap for Java MapScript. Please file a bug in buzilla for the Java MapScript component with your example and information.

Thanks

Howard

At 10:32 AM -0300 8/9/06, José Vilson de Mello de Farias wrote:
This is a multi-part message in MIME format.
--------------080606080700010905000906
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit

Greetings,

  I've compiled MapServer from the CVS HEAD 4.9-dev (2006-07-28) and I'm
suposing the msIO_getStdoutBufferBytes is not working properly when used
in Java Mapscript. I've written a very simple example to explain how it
happens. Please take a look at it :

public void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOExcept

      {
        PrintWriter p = resp.getWriter();
        mapObj map = new mapObj("/home/maps/rs.wms.map");

        OWSRequest reqOWS = new OWSRequest();
        reqOWS.setParameter("SERVICE", "WMS");
        reqOWS.setParameter("VERSION", "1.1.0");
        reqOWS.setParameter("REQUEST", "GetCapabilities");


        mapscript.msIO_installStdoutToBuffer();
        map.OWSDispatch(reqOWS);


        String contentType = mapscript.msIO_stripStdoutBufferContentType();
        byte[] content = mapscript.msIO_getStdoutBufferBytes();
        p.print(new String(content));

      }


The "byte[] content" stores the result of
msIO_stripStdoutBufferContentType and it has some garbage data at the
end. After the > 0x3E we have an NL 0x0A and finally a EOF 0x00, BUT the
content doesn't stop at this point, there are more data after the 0x00
and the Java Mapscript can "see" it. That's a big problem, because when
this "content" is returned, the resulting XML is corrupted. Please check
this example bellow.

000018a0 20 20 20 20 20 20 20 20 20 3c 2f 4c 65 67 65 6e | </Legen| 000018b0 64 55 52 4c 3e 0a 20 20 20 20 20 20 20 20 3c 2f |dURL>. </| 000018c0 53 74 79 6c 65 3e 0a 20 20 20 20 3c 2f 4c 61 79 |Style>. </Lay| 000018d0 65 72 3e 0a 20 20 3c 2f 4c 61 79 65 72 3e 0a 3c |er>. </Layer>.<| 000018e0 2f 43 61 70 61 62 69 6c 69 74 79 3e 0a 3c 2f 57 |/Capability>.</W| 000018f0 4d 54 5f 4d 53 5f 43 61 70 61 62 69 6c 69 74 69 |MT_MS_Capabiliti| 00001900 65 73 3e 0a 00 14 00 00 00 14 00 00 00 14 00 00 |es>.............| 00001910 00 14 00 00 00 14 00 00 00 14 00 00 00 14 00 00 |................| 00001920 00 14 00 00 00 14 00 00 00 14 00 00 00 14 00 |...............|

Is it a known bug? I'm afraid this kind of garbage can produce
undesirable effects in WMS support. For this simples example I can
"manually" remove it but I'm not sure how to deal with it in other
cases. I'll be greatful if you could give me some light.


Best regards,

--
*JosÈ Vilson de Mello de Farias*
/Analista de Sistemas
//SSE - SeguranÁa P™blica/

*DÕGITRO TECNOLOGIA*
*E-mail:* [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>
*Messenger: [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>
***Site:* www.digitro.com.br <http://www.digitro.com.br%20>
<http://www.digitro.com.br%20>

--------------080606080700010905000906
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
<font size="-1"><font face="Verdana">Greetings,<br>
<br>
&nbsp; I've compiled MapServer from the CVS HEAD 4.9-dev (2006-07-28) and
I'm suposing the msIO_getStdoutBufferBytes is not working properly when
used in Java Mapscript. I've written a very simple example to explain
how it happens. Please take a look at it : <br>
<br>
</font></font>
<blockquote>
<pre><font face="Lucida Console" size="-1">&nbsp; public void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOExcept</font></pre>
  <pre><font face="Lucida Console" size="-1">&nbsp; {
&nbsp;&nbsp;&nbsp; PrintWriter p = resp.getWriter();
&nbsp;&nbsp;&nbsp; mapObj map = new mapObj("/home/maps/rs.wms.map");</font></pre> <pre><font face="Lucida Console" size="-1">&nbsp;&nbsp;&nbsp; OWSRequest reqOWS = new OWSRequest();
&nbsp;&nbsp;&nbsp; reqOWS.setParameter("SERVICE", "WMS");
&nbsp;&nbsp;&nbsp; reqOWS.setParameter("VERSION", "1.1.0");
&nbsp;&nbsp;&nbsp; reqOWS.setParameter("REQUEST", "GetCapabilities");&nbsp;
 </font></pre>
<pre><font face="Lucida Console" size="-1">&nbsp;&nbsp;&nbsp; mapscript.msIO_installStdoutToBuffer();
&nbsp;&nbsp;&nbsp; map.OWSDispatch(reqOWS);&nbsp;
 </font></pre>
<pre><font face="Lucida Console" size="-1">&nbsp;&nbsp;&nbsp; String contentType = mapscript.msIO_stripStdoutBufferContentType();
&nbsp;&nbsp;&nbsp; byte[] content = mapscript.msIO_getStdoutBufferBytes();
&nbsp;&nbsp;&nbsp; p.print(new String(content));</font></pre>
  <pre><font face="Lucida Console" size="-1">&nbsp; } </font></pre>
</blockquote>
<font face="Verdana" size="-1"><br>
The "byte[] content" stores the result of
msIO_stripStdoutBufferContentType and it has some garbage data at the
end. After the &gt; 0x3E we have an NL 0x0A and finally a EOF 0x00, BUT
the content doesn't stop at this point, there are more data after the
0x00 and the Java Mapscript can "see" it. That's a big problem, because
when this "content" is returned, the resulting XML is corrupted. Please
check this example bellow.</font><font size="-1"><font face="Verdana"><br>
</font></font><font size="-1"><font face="Verdana"><small><font
 face="Lucida Console"><br>
</font></small></font></font>
<blockquote>
<pre>000018a0&nbsp; 20 20 20 20 20 20 20 20&nbsp; 20 3c 2f 4c 65 67 65 6e&nbsp; |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/Legen| 000018b0&nbsp; 64 55 52 4c 3e 0a 20 20&nbsp; 20 20 20 20 20 20 3c 2f&nbsp; |dURL&gt;.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/| 000018c0&nbsp; 53 74 79 6c 65 3e 0a 20&nbsp; 20 20 20 3c 2f 4c 61 79&nbsp; |Style&gt;.&nbsp;&nbsp;&nbsp; &lt;/Lay| 000018d0&nbsp; 65 72 3e 0a 20 20 3c 2f&nbsp; 4c 61 79 65 72 3e 0a 3c&nbsp; |er&gt;.&nbsp; &lt;/Layer&gt;.&lt;| 000018e0&nbsp; 2f 43 61 70 61 62 69 6c&nbsp; 69 74 79 3e 0a 3c 2f 57&nbsp; |/Capability&gt;.&lt;/W| 000018f0&nbsp; 4d 54 5f 4d 53 5f 43 61&nbsp; 70 61 62 69 6c 69 74 69&nbsp; |MT_MS_Capabiliti| 00001900&nbsp; 65 73 3e 0a 00 14 00 00&nbsp; 00 14 00 00 00 14 00 00&nbsp; |es&gt;.............| 00001910&nbsp; 00 14 00 00 00 14 00 00&nbsp; 00 14 00 00 00 14 00 00&nbsp; |................| 00001920&nbsp; 00 14 00 00 00 14 00 00&nbsp; 00 14 00 00 00 14 00&nbsp;&nbsp;&nbsp;&nbsp; |...............|</pre>
</blockquote>
<small><font face="Verdana">Is it a known bug? I'm afraid this kind of
garbage can produce undesirable effects in WMS support. For this
simples example I can "manually" remove it but I'm not sure how to deal
with it in other cases. I'll be greatful if you could give me some
light.</font></small><br>
<br>
<br>
<font size="-1"><font face="Verdana">Best regards,</font></font><br>
<div class="moz-signature"><br>
-- <br>
<meta content="text/html; charset=ISO-8859-1" http-equiv="content-type">
<title></title>
<font color="#000000" face="Verdana, Helvetica, Arial" size="1"><font
color="#000000" size="2"><b>Jos&eacute; Vilson de Mello de Farias</b> </font><br>
<font color="#606060"><i><big>Analista de Sistemas<br>
</big></i></font></font><i style="color: rgb(96, 96, 96);"><font
 size="-2">SSE - Seguran&ccedil;a P&uacute;blica</font></i><br>
<font color="#000000" face="Verdana, Helvetica, Arial" size="1"><br>
<font color="#000080"><b>D&Iacute;GITRO TECNOLOGIA</b></font><br>
<font color="#000000"><b>E-mail:</b> </font><a

href="mailto:[EMAIL PROTECTED]"><font color="#606060">[EMAIL PROTECTED]</font></a><br>
</font><font color="#000000" face="Verdana, Helvetica, Arial" size="1"><font
 color="#000000"><b>Messenger: </b></font></font><font color="#000000"
 face="Verdana, Helvetica, Arial" size="1"><a

href="mailto:[EMAIL PROTECTED]"><font color="#606060">[EMAIL PROTECTED]</font></a></font><br> <font color="#000000" face="Verdana, Helvetica, Arial" size="1"><!--<font color = #000000> <b>ICQ:</b></font>
<font color = #000000> 11866179</font><br>
!--><font
 color="#000000"><b></b></font><font color="#000000"><b>Site:</b></font>
<a href="http://www.digitro.com.br%20";><font color="#000000">www.digitro.com.br</font></a><a
 href="http://www.digitro.com.br%20";> </a></font>
</div>
</body>
</html>

--------------080606080700010905000906--

Reply via email to