Skip to content
Permalink
Browse files
Merge branch 'npe_in_meta' into 'ibm-trunk'
Npe in meta

See merge request !55
  • Loading branch information
ngmr committed Jul 14, 2015
2 parents 3ebe014 + cd1f145 commit 32255b0bc18e1f704f4376e99a92ffbf12c8fb73
Showing 3 changed files with 74 additions and 7 deletions.
@@ -0,0 +1,18 @@
package org.apache.yoko;

import org.junit.Before;
import org.junit.Test;

public class MetaTest extends AbstractOrbTestBase {

@Before
public void setUp() throws Exception {
super.setUp();
setWaitForFile("Test.ref");
}

@Test
public void testMeta() throws Exception {
client.invokeMain("test.meta.TestMeta");
}
}
@@ -0,0 +1,31 @@
package test.meta;

import java.io.Serializable;

import javax.rmi.CORBA.Util;
import javax.rmi.CORBA.ValueHandler;

import org.junit.Assert;
import org.omg.CORBA.ValueDefPackage.FullValueDescription;
import org.omg.SendingContext.CodeBase;

public class TestMeta {

public static void main(String[] args) throws Exception {
testMeta();
}

public static void testMeta() throws Exception {
ValueHandler vh = Util.createValueHandler();
CodeBase codebase = (CodeBase)vh.getRunTimeCodeBase();
String dataClassRepid = vh.getRMIRepositoryID(Data.class);
FullValueDescription fvd = codebase.meta(dataClassRepid);
Assert.assertNotNull(fvd);
}

public static class Data implements Serializable {
private static final long serialVersionUID = 1L;
public Data d;
}

}
@@ -61,7 +61,6 @@
import org.omg.CORBA.VM_NONE;
import org.omg.CORBA.ValueMember;
import org.omg.CORBA.ValueDefPackage.FullValueDescription;
import org.omg.CORBA.portable.IndirectionException;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
import org.omg.CORBA.portable.UnknownException;
@@ -846,7 +845,9 @@ long getHashCode() {

protected ValueMember[] _value_members = null;

ValueMember[] getValueMembers() {
private ValueMember[] getValueMembers() {
getTypeCode(); // ensure recursion through typecode for non-array types

if (_value_members == null) {
_value_members = new ValueMember[_fields.length];
for (int i = 0; i < _fields.length; i++) {
@@ -879,12 +880,29 @@ TypeCode getTypeCode() {
return _type_code;
}

private static final OperationDescription[] ZERO_OPERATIONS = {};
private static final AttributeDescription[] ZERO_ATTRIBUTES = {};
private static final Initializer[] ZERO_INITIALIZERS = {};
private static final String[] ZERO_STRINGS = {};

FullValueDescription getFullValueDescription() {
return new FullValueDescription(getJavaClass().getName(), getRepositoryID(),
false, // is_abstract
isCustomMarshalled(), "", "1.0", new OperationDescription[0], new AttributeDescription[0], getValueMembers(), new Initializer[0],
new String[0], new String[0], false, // is_truncatable
((_super_descriptor == null) ? "" : _super_descriptor.getRepositoryID()), getTypeCode());
FullValueDescription fvd = new FullValueDescription();
fvd.name = getJavaClass().getName();
fvd.id = getRepositoryID();
fvd.is_abstract = false;
fvd.is_custom = isCustomMarshalled();
fvd.defined_in = "";
fvd.version = "1.0";
fvd.operations = ZERO_OPERATIONS;
fvd.attributes = ZERO_ATTRIBUTES;
fvd.members = getValueMembers();
fvd.initializers = ZERO_INITIALIZERS;
fvd.supported_interfaces = ZERO_STRINGS;
fvd.abstract_base_values = ZERO_STRINGS;
fvd.is_truncatable = false;
fvd.base_value = ((_super_descriptor == null) ? "" : _super_descriptor.getRepositoryID());
fvd.type = getTypeCode();
return fvd;
}

class ObjectDeserializer {

0 comments on commit 32255b0

Please sign in to comment.