Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2120673 | 1.4.2_07 | Devananda Jayaraman | P2 | Resolved | Fixed | b02 |
Name: gm110360 Date: 07/08/2003
FULL PRODUCT VERSION :
java version "1.4.2-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-beta-b19)
Java HotSpot(TM) Client VM (build 1.4.2-beta-b19, mixed mode)
FULL OS VERSION :
Microsoft Windows 2000 [Version 5.00.2195]
EXTRA RELEVANT SYSTEM CONFIGURATION :
.NET Framework SP2
A DESCRIPTION OF THE PROBLEM :
Re-packaging an existing bean for the Java Plugin 1.4.2 (from 1.3.1_07) I found that I could not pass a byte[] between VB (6 or .NET) and the JVM.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Create a JavaBean that acts on a byte[] (I modified the ArrayBean example that
Devananda Jayaraman had provided), package it, register it.
Create a VB project (6 or .NET)
Add code to create it and call a method that accepts a byte[] (in my example, pickByte)
EXPECTED VERSUS ACTUAL BEHAVIOR :
I should have received a byte back.
Runtime error '-2147352567 (80020009)':
java.lang.NullPointerException
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Runtime error '-2147352567 (80020009)':
java.lang.NullPointerException
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
Java Bean (ArrayBean2.java)
---------------------------
public class ArrayBean2 implements java.io.Serializable
{
private int propI;
private byte propB;
public ArrayBean2()
{
}
public int getPropI ()
{
return propI;
}
public void setPropI (int i)
{
propI = i;
}
public byte getPropB ()
{
return propB;
}
public void setPropB (byte s)
{
propB = s;
}
public byte pickByte (byte[] array, int index)
{
return (array[index]);
}
}
VB (array.frm)
--------------
VERSION 5.00
Begin VB.Form Form1
Caption = "Array Tester"
ClientHeight = 3165
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3165
ScaleWidth = 4680
StartUpPosition = 3 'Windows Default
Begin VB.ComboBox Combo1
Height = 315
Left = 2640
TabIndex = 4
Text = "0"
Top = 360
Width = 1455
End
Begin VB.CommandButton Command1
Caption = "Select Byte"
Height = 495
Left = 1200
TabIndex = 1
Top = 2400
Width = 2295
End
Begin VB.TextBox Text1
Height = 495
Left = 2640
TabIndex = 0
Text = "0"
Top = 1200
Width = 1455
End
Begin VB.Label Label1
Alignment = 1 'Right Justify
Caption = "Byte at selected index"
Height = 495
Left = 480
TabIndex = 3
Top = 1200
Width = 1815
End
Begin VB.Label Se
Alignment = 1 'Right Justify
Caption = "Select Index"
Height = 375
Left = 360
TabIndex = 2
Top = 360
Width = 1935
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim oArray As Object
Dim arr(5) As Byte
Private Sub Command1_Click()
Dim x As Integer
x = Val(Combo1.Text)
Text1 = oArray.pickByte(arr, x)
End Sub
Private Sub Form_Load()
Set oArray = CreateObject("ArrayBean2.Bean")
Combo1.AddItem "0"
Combo1.AddItem "1"
Combo1.AddItem "2"
Combo1.AddItem "3"
Combo1.AddItem "4"
arr(0) = 0
arr(1) = 1
arr(2) = 2
arr(3) = 3
arr(4) = 4
End Sub
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
If you can, use higher level abstraction classes (i.e. String)
(Review ID: 184159)
======================================================================
SAP has seen this problem in their development. After trying Tiger, they
still saw this issue:
-------------------------------------------------------------------
I've installed now the Tiger Version J2SE 5.0.
The following is working:
1. to pass a single byte and a byte array from outer world to Java via
the Axbridge
2. to get a single byte back from Java to outer world via Axbridge
But there is still the following problem:
1. to get a byte array back from Java to outer world via Axbridge
Error:
either 'type mismatch' if you define the result as byte array
like in VB: 'Dim result() as Byte'
or if you define 'Dim result as Variant' you will get an
'unsupported variant type'. A cast will result in 'type mismatch'
or 'automation error'.
-------------------------------------------------------------------
So there are two problems:
1. With Tiger, there still seems to be one case where it does not
work.
2. SAP really needs this for 1.4.2, so the fix would need to be backported
to that release.
###@###.### 2004-08-11
- backported by
-
JDK-2120673 NullPointerException when trying to pass byte[] between JVM and ActiveX
-
- Resolved
-
- duplicates
-
JDK-4948598 Unusable array parameter and return types for Active-X bridge
-
- Closed
-