错误 org.omg.CORBA.MARSHAL 序列长度太大

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

从 Corba U2000 服务器成功获取警报并读取值后,出现以下错误

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)

方法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) ;   
    }
}

还是我读取报警列表的方式不正确?谢谢

您可以在下面找到 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;
}

我设法弄清楚 filterableData.value.toString() 的值是 "org.jacorb.orb.CDROutputStream"。事实证明,根据文档,名称为 "b" 的 属性 是 TimeBase:: UtcT

为了将其转换为正确的值,即 utc 时间戳,我将条件更改为

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);
}