adrnsoh / codenameone

Automatically exported from code.google.com/p/codenameone
0 stars 0 forks source link

Util.writeObject() not working in iOS port for byte[] type of member field #96

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Try writing a byte[] object using the Util.writeObject() method
2.
3.

What is the expected output? What do you see instead?
It should have written the byte array to storage, but this code fails with a 
crash on iOS port. 

What version of the product are you using? On what operating system?
public beta version released on 12 march 2012. On Mac OS and iphone 4 (running 
os 5.1)

Please provide any additional information below.

On looking at the iOS port code and putting some debug stmts. I found out that 
xmlvm is byte[] array objects as org.xmlvm.runtime.XMLVMArray type and when 
this object is passed to the Util.instanceofObjArray() method it returns true. 
So though the actual object in java code is byte[], it is interpreted by the 
codename1 io.Util class to be of type Object Array. and then when it tries to 
write it,  the app fails with a crash on actual device. 

The solution would be to check for object array instance at the end in the 
method Util.writeObject(). Currently this check is being done before checking 
for byte[], short[] and other array types. I tested the code with this change 
and it is working. Please review the code and do the necessary changes in 
Util.java.

Original issue reported on code.google.com by nir...@nvsoft.com on 15 Mar 2012 at 4:29

GoogleCodeExporter commented 9 years ago
This is probably related to 
http://code.google.com/p/codenameone/issues/detail?id=58
Generally just writing byte[].class fails on the iOS port. The XMLVM guys fixed 
that but caused other regressions preventing us from upgrading to a current 
version.
This was a relatively recent discovery for me so the Util code might still be 
missing the workaround....

Original comment by shai.almog on 15 Mar 2012 at 6:44

GoogleCodeExporter commented 9 years ago
Fixed, uploading a new version to the server this should be resolved in 20 
minutes or so.

Original comment by shai.almog on 15 Mar 2012 at 7:54