Sagewire Logo

output parameter causing org.omg.CORBA.BAD_PARAM

5 Message(s) by 2 Author(s) originally posted in java corba


From: donalmurtagh Date:   Friday, October 27, 2006
Hi,

I'm having a problem with the valErrors out parameter in the following
IDL operation:

boolean submit(in SMSProvExt::WorkOrderData wo,
in boolean isNew,
out string woName,
out SMSProvExt::ValErrorList valErrors)
raises(ApplError);

On the client side, I pass in the following value:

ValErrorListHolder valErrors = new ValErrorListHolder();If the server implementation returns an empty list then everything
works fine:

public boolean submit(WorkOrderData wo, boolean isNew, StringHolder
woName, ValErrorListHolder valErrors) throws ApplError {

woName.value = "";

ValError[] errors = new ValError[0];
valErrors.value = errors;
return true;
}However if the server implementation return a non-empty list, for
example:

public boolean submit(WorkOrderData wo, boolean isNew, StringHolder
woName, ValErrorListHolder valErrors) throws ApplError {

woName.value = "";

ValError[] errors = new ValError[1];

errors[0] = new ValError();
errors[0].valErrNo = 23;
errors[0].valErrMsg = "Some error";

valErrors.value = errors;
return true;
}

Then when the client calls submit(), the following exception is thrown:org.omg.CORBA.BAD_PARAM: vmcid: 0x0 minor code: 0 completed: No
at
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.JAVA:39)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.JAVA:27)
at
JAVA.lang.reflect.Constructor.newInstance(Constructor.JAVA:494)
at JAVA.lang.Class.newInstance0(Class.JAVA:350)
at JAVA.lang.Class.newInstance(Class.JAVA:303)
at com.inprise.vbroker.orb.SE.read(Unknown Source)
at com.inprise.vbroker.orb.DelegateImpl.handleReply(Unknown
Source)
at com.inprise.vbroker.orb.DelegateImpl.invoke(Unknown Source)
at
org.omg.CORBA.portable.ObjectImpl._invoke(ObjectImpl.JAVA:457)

I'm using Visibroker, and both the client and server are implemented in
JAVA 5.
Thanks in advance for any suggestions!

- DM


From: Mark Woyna Date:   Friday, October 27, 2006
What does the ValError class /struct look like? Are there any additional
attributes that are not being initialized, besides valErrNo and
valErrMsg? I assume ValError is a struct?

Mark

wrote in message:
Hi,
I'm having a problem with the valErrors out parameter in the following
IDL operation:
boolean submit(in SMSProvExt::WorkOrderData wo,
in boolean isNew,
out string woName,
out SMSProvExt::ValErrorList valErrors)
raises(ApplError);
On the client side, I pass in the following value:
ValErrorListHolder valErrors = new ValErrorListHolder();
If the server implementation returns an empty list then everything
works fine:
public boolean submit(WorkOrderData wo, boolean isNew, StringHolder
woName, ValErrorListHolder valErrors) throws ApplError {
woName.value = "";
ValError[] errors = new ValError[0];
valErrors.value = errors;
return true;
}
However if the server implementation return a non-empty list, for
example:
public boolean submit(WorkOrderData wo, boolean isNew, StringHolder
woName, ValErrorListHolder valErrors) throws ApplError {
woName.value = "";
ValError[] errors = new ValError[1];
errors[0] = new ValError();
errors[0].valErrNo = 23;
errors[0].valErrMsg = "Some error";
valErrors.value = errors;
return true;
}
Then when the client calls submit(), the following exception is thrown:
org.omg.CORBA.BAD_PARAM: vmcid: 0x0 minor code: 0 completed: No
at
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.JAVA:39)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.JAVA:27)
at
JAVA.lang.reflect.Constructor.newInstance(Constructor.JAVA:494)
at JAVA.lang.Class.newInstance0(Class.JAVA:350)
at JAVA.lang.Class.newInstance(Class.JAVA:303)
at com.inprise.vbroker.orb.SE.read(Unknown Source)
at com.inprise.vbroker.orb.DelegateImpl.handleReply(Unknown
Source)
at com.inprise.vbroker.orb.DelegateImpl.invoke(Unknown Source)
at
org.omg.CORBA.portable.ObjectImpl._invoke(ObjectImpl.JAVA:457)
I'm using Visibroker, and both the client and server are implemented in
JAVA 5.
Thanks in advance for any suggestions!
- DM






From: donalmurtagh Date:   Friday, October 27, 2006
Thanks for your reply. Yes, in the IDL file ValError is a struct that
looks like this:

struct ValError {
short valErrNo;
string valErrMsg;
long sorId;
string vdtName;
SDRTypeEnum sdrType;
long sdrIndex;
long sdrSubIndex;
string vatName;
string attrValue;
NVList valErrorNVs;
};The .JAVA file generated from this looks like this:

package surePay.idl2JAVA.SMSProvExt;

/**
* <ul>
* <li> <b>IDL Source</b>
"C:/workspace/patrol/sure-pay/src/idl/SMSProvExt.idl"
* <li> <b>IDL Name</b> ::SMSProvExt::ValError
* <li> <b>Repository Id</b> IDL:SMSProvExt/ValError:1.0
* </ul>
* <b>IDL definition:</b>
* <pre>
* struct ValError {
...
};
* </pre>
*/
public final class ValError implements org.omg.CORBA.portable.IDLEntity
{

public short valErrNo;

public JAVA.lang.String valErrMsg;

public int sorId;

public JAVA.lang.String vdtName;

public surePay.idl2JAVA.SMSProvExt.SDRTypeEnum sdrType;

public int sdrIndex;

public int sdrSubIndex;

public JAVA.lang.String vatName;

public JAVA.lang.String attrValue;

public surePay.idl2JAVA.SMSProvExt.NameValue[] valErrorNVs;

public ValError () {
valErrMsg = "";
vdtName = "";
vatName = "";
attrValue = "";
}

public ValError (final short valErrNo,
final JAVA.lang.String valErrMsg,
final int sorId,
final JAVA.lang.String vdtName,
final surePay.idl2JAVA.SMSProvExt.SDRTypeEnum
sdrType,
final int sdrIndex,
final int sdrSubIndex,
final JAVA.lang.String vatName,
final JAVA.lang.String attrValue,
final surePay.idl2JAVA.SMSProvExt.NameValue[]
valErrorNVs) {
this.valErrNo = valErrNo;
this.valErrMsg = valErrMsg;
this.sorId = sorId;
this.vdtName = vdtName;
this.sdrType = sdrType;
this.sdrIndex = sdrIndex;
this.sdrSubIndex = sdrSubIndex;
this.vatName = vatName;
this.attrValue = attrValue;
this.valErrorNVs = valErrorNVs;
}

private transient JAVA.util.Hashtable _printMap = null;
public JAVA.lang.String toString() {
final JAVA.lang.StringBuffer _ret = new
JAVA.lang.StringBuffer("struct surePay.idl2JAVA.SMSProvExt.ValError
{");
final JAVA.lang.Thread _currentThread =
JAVA.lang.Thread.currentThread();
boolean justCreated = false;
if (_printMap == null) {
synchronized (this) {
if (_printMap == null) {
justCreated = true;
_printMap = new JAVA.util.Hashtable();
}
}
}
if (!justCreated) {
if (_printMap.get(_currentThread) != null) {
_ret.append("...}");
return _ret.toString();
}
}
_printMap.put(_currentThread, this);
_ret.append("\n");
_ret.append("short valErrNo=");
_ret.append(valErrNo);
_ret.append(",\n");
_ret.append("JAVA.lang.String valErrMsg=");
_ret.append(valErrMsg != null?'\"' + valErrMsg + '\"':null);
_ret.append(",\n");
_ret.append("int sorId=");
_ret.append(sorId);
_ret.append(",\n");
_ret.append("JAVA.lang.String vdtName=");
_ret.append(vdtName != null?'\"' + vdtName + '\"':null);
_ret.append(",\n");
_ret.append("surePay.idl2JAVA.SMSProvExt.SDRTypeEnum sdrType=");
_ret.append(sdrType);
_ret.append(",\n");
_ret.append("int sdrIndex=");
_ret.append(sdrIndex);
_ret.append(",\n");
_ret.append("int sdrSubIndex=");
_ret.append(sdrSubIndex);
_ret.append(",\n");
_ret.append("JAVA.lang.String vatName=");
_ret.append(vatName != null?'\"' + vatName + '\"':null);
_ret.append(",\n");
_ret.append("JAVA.lang.String attrValue=");
_ret.append(attrValue != null?'\"' + attrValue + '\"':null);
_ret.append(",\n");
_ret.append("surePay.idl2JAVA.SMSProvExt.NameValue[]
valErrorNVs=");
_ret.append("{");
if (valErrorNVs == null) {
_ret.append(valErrorNVs);
} else {
for (int $counter112 = 0; $counter112 < valErrorNVs.length;
$counter112++) {
_ret.append(valErrorNVs[$counter112]);
if ($counter112 < valErrorNVs.length - 1) {
_ret.append(",");
}
}
}
_ret.append("}");
_ret.append("\n");
_printMap.remove(_currentThread);
_ret.append("}");
return _ret.toString();
}

private transient JAVA.util.Hashtable _cmpMap = null;
public boolean equals (JAVA.lang.Object o) {
if (this == o) return true;
if (o == null) return false;

final JAVA.lang.Thread _currentThread =
JAVA.lang.Thread.currentThread();
boolean justCreated = false;
if (_cmpMap == null) {
synchronized (this) {
if (_cmpMap == null) {
justCreated = true;
_cmpMap = new JAVA.util.Hashtable();
}
}
}
if (!justCreated) {
final JAVA.lang.Object _cmpObj;
_cmpObj= _cmpMap.get(_currentThread);
if (_cmpObj != null) return o == _cmpObj;
}
if (o instanceof surePay.idl2JAVA.SMSProvExt.ValError) {
_cmpMap.put(_currentThread, o);
final surePay.idl2JAVA.SMSProvExt.ValError obj =
(surePay.idl2JAVA.SMSProvExt.ValError)o;
boolean res = true;
do {
res = this.valErrNo == obj.valErrNo;
if (!res) break;
res = this.valErrMsg == obj.valErrMsg ||
(this.valErrMsg != null && obj.valErrMsg != null &&
this.valErrMsg.equals(obj.valErrMsg));
if (!res) break;
res = this.sorId == obj.sorId;
if (!res) break;
res = this.vdtName == obj.vdtName ||
(this.vdtName != null && obj.vdtName != null &&
this.vdtName.equals(obj.vdtName));
if (!res) break;
res = this.sdrType == obj.sdrType ||
(this.sdrType != null && obj.sdrType != null &&
this.sdrType.equals(obj.sdrType));
if (!res) break;
res = this.sdrIndex == obj.sdrIndex;
if (!res) break;
res = this.sdrSubIndex == obj.sdrSubIndex;
if (!res) break;
res = this.vatName == obj.vatName ||
(this.vatName != null && obj.vatName != null &&
this.vatName.equals(obj.vatName));
if (!res) break;
res = this.attrValue == obj.attrValue ||
(this.attrValue != null && obj.attrValue != null &&
this.attrValue.equals(obj.attrValue));
if (!res) break;
if (res = (this.valErrorNVs.length ==
obj.valErrorNVs.length)) {
for (int $counter113 = 0; res && $counter113 <
this.valErrorNVs.length; $counter113++) {
res = this.valErrorNVs[$counter113] ==
obj.valErrorNVs[$counter113] ||
(this.valErrorNVs[$counter113] != null &&
obj.valErrorNVs[$counter113] != null &&
this.valErrorNVs[$counter113].equals(obj.valErrorNVs[$counter113]));
}
}
} while (false);
_cmpMap.remove(_currentThread);
return res;
}
else {
return false;
}
}
}


From: donalmurtagh Date:   Friday, October 27, 2006
You were right, the problem was caused by unininitialised attributes!

Much obliged!
- DM

wrote in message:
What does the ValError class/struct look like? Are there any additional
attributes that are not being initialized, besides valErrNo and
valErrMsg? I assume ValError is a struct?
Mark






From: donalmurtagh Date:   Friday, October 27, 2006
You were right, the problem was caused by unininitialised attributes!

Much obliged!
- DM

wrote in message:
What does the ValError class/struct look like? Are there any additional
attributes that are not being initialized, besides valErrNo and
valErrMsg? I assume ValError is a struct?
Mark







Next Message: CORBA Exception after network adapter deactivation



Programming | Sports | Autos

copyright 2006
Valid XHTML 1.0 Transitional