Commit bce23619 authored by garciay's avatar garciay
Browse files

Add a workaround on incorrect decodeHypothesis returned value ("per-basic-unaligned:1997")

parent c4df8f4c
......@@ -87,7 +87,13 @@ public class Its_CodecProvider implements TciCDProvided, ChannelEventHandler, IT
} catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) {
e.printStackTrace();
}
} // End of 'foreach' loop
} // End of 'for' loop
try {
_cf.setExternalCodec("per-basic-unaligned:1997", (TciCDProvided) Class.forName("org.etsi.its.tool.elvior.LibIts_asn1").newInstance());
} catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) {
e.printStackTrace();
}
}
public void run() {
......
......@@ -59,7 +59,26 @@ public class LibIts_asn1 implements TciCDProvided {
msg.setEncodedMessage(message.getEncodedMessage());
if (_logger.isLoggable(Level.ALL)) ByteHelper.dump("LibIts_asn1.decode: ", msg.getEncodedMessage());
String type = String.format("%s.%s", _encodingName, decodingHypothesis.getName());
String type = "";
if (decodingHypothesis.getTypeEncoding().equals("per-basic-unaligned:1997")) {
if (decodingHypothesis.getName().equals("CAM")) {
type = String.format("%s.%s", "CAM_PDU_Descriptions", decodingHypothesis.getName());
} else if (decodingHypothesis.getName().equals("DENM")) {
type = String.format("%s.%s", "DENM_PDU_Descriptions", decodingHypothesis.getName());
} else if (decodingHypothesis.getName().equals("MAPEM")) {
type = String.format("%s.%s", "MAPEM_PDU_Descriptions", decodingHypothesis.getName());
} else if (decodingHypothesis.getName().equals("SPATEM")) {
type = String.format("%s.%s", "SPATEM_PDU_Descriptions", decodingHypothesis.getName());
} else if (decodingHypothesis.getName().equals("IVIM")) {
type = String.format("%s.%s", "IVIM_PDU_Descriptions", decodingHypothesis.getName());
} else if (decodingHypothesis.getName().equals("SREM")) {
type = String.format("%s.%s", "SREM_PDU_Descriptions", decodingHypothesis.getName());
} else if (decodingHypothesis.getName().equals("SSEM")) {
type = String.format("%s.%s", "SSEM_PDU_Descriptions", decodingHypothesis.getName());
}
} else {
type = String.format("%s.%s", _encodingName, decodingHypothesis.getName());
}
_logger.info("Type: " + type);
Type asnOriginalType = getTypeForName(type);
// Check which type class the decoding hypothesis is of
......
......@@ -104,7 +104,7 @@ public class TciCDWrapper implements ITciCDWrapper {
String variantTypeName = decodingHypothesis.getDefiningModule().getModuleName() + "." + decodingHypothesis.getName() + "." + variantName;
// TERFactory.getInstance().logDebug("variantTypeName is " + variantTypeName);
Type variantType = _tciFactory.getTypeForName(variantTypeName);
Type variantType = getTypeForName(variantTypeName);
if(variantType != null) {
Value testVal = variantType.newInstance();
if(testVal != null) {
......@@ -120,10 +120,26 @@ public class TciCDWrapper implements ITciCDWrapper {
@Override
public Type getTypeForName(final String type) {
// return TciProvider.getInstance().getTciCDRequired().getTypeForName(type);
// TERFactory.getInstance().logDebug("TciCDWrapper.getTypeForName" + type);
Type originalType = TciProvider.getInstance().getTciCDRequired().getTypeForName(type);
// TERFactory.getInstance().logDebug("TciCDWrapper.getTypeForName" + originalType.getName());
// TERFactory.getInstance().logDebug("TciCDWrapper.getTypeForName: " + type);
Type originalType;
if (type.indexOf("DecodedBtpPayload") != -1) {
if (type.endsWith("camPacket")) {
originalType = _tciFactory.getTypeForName("CAM_PDU_Descriptions.CAM");
} else if (type.endsWith("denmPacket")) {
originalType = _tciFactory.getTypeForName("DENM_PDU_Descriptions.DENM");
} else if (type.endsWith("mapemPacket")) {
originalType = _tciFactory.getTypeForName("MAPEM_PDU_Descriptions.MAPEM");
} else if (type.endsWith("spatemPacket")) {
originalType = _tciFactory.getTypeForName("MAPEM_PDU_Descriptions.SPATEM");
} else if (type.endsWith("ivimPacket")) {
originalType = _tciFactory.getTypeForName("IVIM_PDU_Descriptions.IVIM");
} else {
originalType = _tciFactory.getTypeForName(type);
}
} else {
originalType = _tciFactory.getTypeForName(type);
}
// TERFactory.getInstance().logDebug("TciCDWrapper.getTypeForName: " + originalType.getName());
return originalType;
} // End of method getTypeForName
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment