AppletTalk.com Forum Index AppletTalk.com
Java discussions newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

output parameter causing org.omg.CORBA.BAD_PARAM

 
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java and CORBA
View previous topic :: View next topic  
Author Message
Guest






PostPosted: Fri Oct 27, 2006 9:43 pm    Post subject: output parameter causing org.omg.CORBA.BAD_PARAM Reply with quote



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
Back to top
Mark Woyna
Guest





PostPosted: Fri Oct 27, 2006 10:02 pm    Post subject: Re: output parameter causing org.omg.CORBA.BAD_PARAM Reply with quote



What does the ValError class/struct look like? Are there any additional
attributes that aren't being initialized, besides valErrNo and
valErrMsg? I assume ValError is a struct?

Mark

donalmurtagh (AT) yahoo (DOT) co.uk wrote:
Quote:
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
Back to top
Guest






PostPosted: Fri Oct 27, 2006 10:53 pm    Post subject: Re: output parameter causing org.omg.CORBA.BAD_PARAM Reply with quote



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;
}
}
}
Back to top
Guest






PostPosted: Sat Oct 28, 2006 12:16 am    Post subject: Re: output parameter causing org.omg.CORBA.BAD_PARAM Reply with quote

You were right, the problem was caused by unininitialised attributes!

Much obliged!
- DM

Mark Woyna wrote:
Quote:
What does the ValError class/struct look like? Are there any additional
attributes that aren't being initialized, besides valErrNo and
valErrMsg? I assume ValError is a struct?

Mark
Back to top
Guest






PostPosted: Sat Oct 28, 2006 12:17 am    Post subject: Re: output parameter causing org.omg.CORBA.BAD_PARAM Reply with quote

You were right, the problem was caused by unininitialised attributes!

Much obliged!
- DM

Mark Woyna wrote:
Quote:
What does the ValError class/struct look like? Are there any additional
attributes that aren't being initialized, besides valErrNo and
valErrMsg? I assume ValError is a struct?

Mark
Back to top
Display posts from previous:   
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java and CORBA All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.