Search in sources :

Example 21 with ErrorType

use of edu.mit.csail.sdg.alloy4.ErrorType in project openflowplugin by opendaylight.

the class ErrorMessageFactory method deserialize.

@Override
// FB doesn't recognize Objects.requireNonNull
@SuppressFBWarnings("UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR")
public ErrorMessage deserialize(ByteBuf rawMessage) {
    Objects.requireNonNull(registry);
    int startIndex = rawMessage.readerIndex();
    ErrorMessageBuilder builder = new ErrorMessageBuilder();
    builder.setVersion((short) EncodeConstants.OF13_VERSION_ID);
    builder.setXid(rawMessage.readUnsignedInt());
    int type = rawMessage.readUnsignedShort();
    ErrorType errorType = ErrorType.forValue(type);
    if (ErrorType.EXPERIMENTER.equals(errorType)) {
        OFDeserializer<ErrorMessage> deserializer = registry.getDeserializer(ExperimenterDeserializerKeyFactory.createExperimenterErrorDeserializerKey(EncodeConstants.OF13_VERSION_ID, rawMessage.getUnsignedInt(rawMessage.readerIndex() + EncodeConstants.SIZE_OF_SHORT_IN_BYTES)));
        rawMessage.readerIndex(startIndex);
        return deserializer.deserialize(rawMessage);
    }
    decodeType(builder, errorType, type);
    decodeCode(rawMessage, builder, errorType);
    int remainingBytes = rawMessage.readableBytes();
    if (remainingBytes > 0) {
        byte[] data = new byte[remainingBytes];
        rawMessage.readBytes(data);
        builder.setData(data);
    }
    return builder.build();
}
Also used : ErrorMessageBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessageBuilder) ErrorType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ErrorType) ErrorMessage(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessage) SuppressFBWarnings(edu.umd.cs.findbugs.annotations.SuppressFBWarnings)

Aggregations

ErrorType (edu.mit.csail.sdg.alloy4.ErrorType)18 Err (edu.mit.csail.sdg.alloy4.Err)6 ErrorSyntax (edu.mit.csail.sdg.alloy4.ErrorSyntax)6 Pos (edu.mit.csail.sdg.alloy4.Pos)5 ArrayList (java.util.ArrayList)5 TempList (edu.mit.csail.sdg.alloy4.ConstList.TempList)4 CapacityExceededException (kodkod.engine.CapacityExceededException)4 HigherOrderDeclException (kodkod.engine.fol2sat.HigherOrderDeclException)4 ErrorFatal (edu.mit.csail.sdg.alloy4.ErrorFatal)3 Expr (edu.mit.csail.sdg.ast.Expr)3 Sig (edu.mit.csail.sdg.ast.Sig)3 A4Reporter (edu.mit.csail.sdg.alloy4.A4Reporter)2 Env (edu.mit.csail.sdg.alloy4.Env)2 ErrorAPI (edu.mit.csail.sdg.alloy4.ErrorAPI)2 Command (edu.mit.csail.sdg.ast.Command)2 ExprVar (edu.mit.csail.sdg.ast.ExprVar)2 Func (edu.mit.csail.sdg.ast.Func)2 PrimSig (edu.mit.csail.sdg.ast.Sig.PrimSig)2 SubsetSig (edu.mit.csail.sdg.ast.Sig.SubsetSig)2 LinkedHashMap (java.util.LinkedHashMap)2