ERROR org.omg.CORBA.MARSHAL Sequence length too large

匆匆过客 提交于 2019-12-25 09:00:34

问题


After successfully fetching alarms from Corba U2000 server and now reading the values, I am getting the error below

ERROR: org.omg.CORBA.MARSHAL: Sequence length too large. Only 12 available and trying to assign 31926513  vmcid: 0x0  minor code: 0  completed: No
org.omg.CORBA.MARSHAL: Sequence length too large. Only 12 available and trying to assign 31926513  vmcid: 0x0  minor code: 0  completed: No
at org.omg.CosNotification.EventBatchHelper.read(EventBatchHelper.java:57)
at AlarmIRPConstDefs.AlarmInformationSeqHelper.read(AlarmInformationSeqHelper.java:51)
at AlarmIRPConstDefs.AlarmInformationSeqHelper.extract(AlarmInformationSeqHelper.java:26)
at com.be.u2k.Main.getAlarmsList(Main.java:144)
at com.be.u2k.Main.main(Main.java:109)

for method AlarmInformationSeqHelper.extract

// Get all active alarms list
private static void getAlarmsList(ORB orb, AlarmIRP alarmIRP) {
    try {
        ManagedGenericIRPConstDefs.StringTypeOpt filter = new ManagedGenericIRPConstDefs.StringTypeOpt();
        filter.value("($type_name == 'x1')"); // Query new alarms and acknowledge or unacknowledge alarms
        AlarmIRPConstDefs.DNTypeOpt base_object = new AlarmIRPConstDefs.DNTypeOpt();
        BooleanHolder flag = new BooleanHolder();
        AlarmIRPSystem.AlarmInformationIteratorHolder iter = new AlarmIRPSystem.AlarmInformationIteratorHolder();
        StructuredEvent[] alarmList = alarmIRP.get_alarm_list(filter, base_object, flag, iter);
        System.out.println("AlarmIRP get_alarm_list success, flag: " + flag.value + " fetched total: " + (alarmList == null? -1: alarmList.length));

        for (StructuredEvent alarm: alarmList) {
            if (alarm.header != null) {
                System.out.println("fixed_header.event_type.name: " + alarm.header.fixed_header.event_type.type_name
                        + " fixed_header.event_type.domain_name: " + alarm.header.fixed_header.event_type.domain_name);
                if (alarm.header.variable_header != null) {
                    for (Property variableHeader: alarm.header.variable_header) {
                        System.out.println("variable_header.name: " + variableHeader.name + " alarm.header.variable_header.value: " +  variableHeader.value);
                    }
                }
            }

            if (alarm.filterable_data != null) {
                for (Property filterableData: alarm.filterable_data) {
                    System.out.println("data.name: " + filterableData.name);
                    if (filterableData.value != null && filterableData.value.toString().contains("org.jacorb.orb.CDROutputStream")) {
                        StructuredEvent[] filterableDataValues = AlarmInformationSeqHelper.extract(filterableData.value);
                    } else {
                        System.out.println("data.value: " + filterableData.value);
                    }
                }
            }
        }

    } catch (ManagedGenericIRPSystem.InvalidParameter e) {
        System.out.println("ERROR get_alarm_list InvalidParameter (Indicates that the parameter is invalid): " + e) ;   
    } catch (ManagedGenericIRPSystem.ParameterNotSupported e) {
        System.out.println("ERROR get_alarm_list ParameterNotSupported (Indicates that the operation is not supported): " + e) ;    
    } catch (AlarmIRPSystem.GetAlarmList e) {
        System.out.println("ERROR get_alarm_list ParameterNotSupported (Indicates exceptions caused by unknown reasons): " + e) ;   
    }
}

Or is my way of reading the alarms list incorrect? Thanks.


回答1:


You can find the example method below for getAlarmList

//Connect to AlarmIRP
AlarmIRP alarmIRP = AlarmIRPHelper.narrow(orb.string_to_object(alarmIrpIOR.value));
StringTypeOpt alarmFilter = new StringTypeOpt();
alarmFilter.value("");
DNTypeOpt base_object = new DNTypeOpt();
base_object.value("");
BooleanHolder flag = new BooleanHolder(false);  // false for iteration
AlarmInformationIteratorHolder iter = new AlarmInformationIteratorHolder();

List<String> alarmIds = get_alarm_list(alarmIRP, alarmFilter, base_object, flag, iter);

private List<String> get_alarm_list(org._3gppsa5_2.AlarmIRPSystem.AlarmIRP alarmIRP, org._3gppsa5_2.ManagedGenericIRPConstDefs.StringTypeOpt alarmFilter, org._3gppsa5_2.AlarmIRPConstDefs.DNTypeOpt base_object, BooleanHolder flag, org._3gppsa5_2.AlarmIRPSystem.AlarmInformationIteratorHolder iter) throws org._3gppsa5_2.AlarmIRPSystem.GetAlarmList, org._3gppsa5_2.ManagedGenericIRPSystem.ParameterNotSupported, org._3gppsa5_2.AlarmIRPSystem.NextAlarmInformations, org._3gppsa5_2.ManagedGenericIRPSystem.InvalidParameter, BAD_OPERATION {
    logger.info("[get-alarm-list][start]");
    alarmIRP.get_alarm_list(alarmFilter, base_object, flag, iter);

    List<StructuredEvent> alarms = new ArrayList();
    EventBatchHolder alarmInformation = new EventBatchHolder();
    short alarmSize = 100;
    List<String> alarmIds = new ArrayList();
    while (iter.value.next_alarmInformations(alarmSize, alarmInformation)) {
        alarms.addAll(Arrays.asList(alarmInformation.value));
        logger.info("Current alarm size:" + alarms.size());
    }

    for (StructuredEvent event : alarms) {
        try {
        //printAlarm(event);
        } catch (Exception ex) {
        }
        List<Property> rem = new ArrayList<Property>();
        rem.addAll(Arrays.asList(PropertySeqHelper.extract(event.remainder_of_body)));
        for (Property property : rem) {
        if (!property.name.equals(org._3gppsa5_2.AlarmIRPNotifications.NotifyNewAlarm.ALARM_ID)) {
            continue;
        }

        alarmIds.add(property.value.extract_string());
        }
    }
    logger.info("[get-alarm-list][completed] size :" + alarms.size());

    return alarmIds;
}



回答2:


I managed to figure out what is that filterableData.value.toString() value that is "org.jacorb.orb.CDROutputStream". It turns out that the property with name "b" is a TimeBase:: UtcT according to the docs.

To convert it to correct value which is a utc timestamp, I changed the condition to

if (filterableData.name.equals("b") && filterableData.value != null && filterableData.value.toString().contains("org.jacorb.orb.CDROutputStream")) {
    long occuranceTime = TimeTHelper.read(filterableData.value.create_input_stream());
    System.out.println("data.value: " + occuranceTime);
}


来源:https://stackoverflow.com/questions/45475682/error-org-omg-corba-marshal-sequence-length-too-large

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!