harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jimmy, Jing Lv" <firep...@gmail.com>
Subject Re: Exceptions found while running servlet...
Date Thu, 10 Aug 2006 09:42:18 GMT
<snip>
>>
>> I've looked into this, I feel puzzled, the stack trace shows that:
>> org.apache.harmony.luni.net.SocketOutputStream.write(SocketOutputStream.java:89)

>>
>> but there are checks for overflow:
>> if (0 <= offset && offset <= buffer.length && 0 <= count
>>             && count <= buffer.length - offset){
>> ...
>> }
> 
> Oops, this is certainly wrong: "offset <= buffer.length","count <= 
> buffer.length - offset", the equal mark should be omitted.
> 

I do some further study and test then, and find the problem was not so easy.

Alex and I are correct that "offset <= buffer.length" here is wrong, but 
the next "count <= buffer.length - offset" seems has proved its 
correctness.

I have a test[1], try to write(new byte[count],count, 0) to a 
SocketOutputStream, the test passes quietly. I do this test on WinXp 
Sp2, the latest Harmony workspace, with J9 VM5.

I believe the ArrayIndexOutOfBoundsException is throw out when it try to 
get byte array in the native (GetByteArrayRegion), which is a JNI 
method. I guess there may be some difference between VMs.

Martin, are you using DRLVM? Can someone using DRLVM (or other VMs) run 
the test below on DRLVM for me? Thanks!

[1]
public void test_socketOutputStream() throws Exception {
         ServerSocket ss = new ServerSocket(0);
         Socket sock = new Socket();
         sock.connect(new InetSocketAddress
                (InetAddress.getLocalHost(),ss.getLocalPort()));
         ss.accept();
         OutputStream os = sock.getOutputStream();
         os.write(new byte[0], 0, 0); // passes here
         os.write(new byte[512], 512, 0); // passes here
     }

> I'll raise a JIRA for this.
> 
> I'm not sure if this is the cause of the problem. So would you please 
> try again if I correct it? :)
> 
>> So can you give more information? e.g, what are PrintWriter try to 
>> write that time? :)
>>
>>> 2.- Trying to generate charts using JFreeCharts (server-side):
>>>
>>> java.lang.NoClassDefFoundError: org/apache/harmony/awt/gl/ImageSurface
>>>     at 
>>> java.awt.image.BufferedImage.createImageSurface(BufferedImage.java:659)
>>>     at java.awt.image.BufferedImage.<init>(BufferedImage.java:352)
>>>     at 
>>> org.jfree.chart.JFreeChart.createBufferedImage(JFreeChart.java:1211)
>>>     at 
>>> org.jfree.chart.JFreeChart.createBufferedImage(JFreeChart.java:1193)
>>>     at 
>>> org.jfree.chart.JFreeChart.createBufferedImage(JFreeChart.java:1178)...
>>>
>>> The JDBC related code is running fine, performance also looks very good.
>>>
>>> I will contact Winstone developer to see if he can help in some way to
>>> identify the problem. He already helped me a few months ago to help
>>> identify a bug in GNU Classpath server socket API.
>>>
>>> Regards,
>>> Martin
>>
>>
> 
> 


-- 

Best Regards!

Jimmy, Jing Lv
China Software Development Lab, IBM

---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org


Mime
View raw message