Bugfix: An empty catch clause in the StatefulTransportLayerClient.java caused a weired EXI Codec error message ("ERROR: 'EXI No valid EXI document according distinguishing bits'") when a message timeout occurred (e.g. with the small timeout value of 250ms for CurrentDemandRes). This was confusing since there was no obvious reason for the EXI Codec error message. Now there is some meaningful error catch clause which makes clear that the header of the received message could not be read, which then terminates the communication session.

This commit is contained in:
Marc Mültin 2016-07-28 19:13:00 +02:00
parent e0f2d36bbc
commit 258af9b5ac
3 changed files with 12 additions and 3 deletions

View File

@ -68,7 +68,7 @@ RequestedPaymentOption =
# - DC_extended
# - DC_combo_core
# - DC_unique
RequestedEnergyTransferMode =
RequestedEnergyTransferMode = DC_core
# XML representation of messages

View File

@ -54,7 +54,16 @@ public abstract class StatefulTransportLayerClient extends Observable implement
try {
setBytesReadFromInputStream(getInStream().read(getV2gTPHeader()));
} catch (IOException e) {
/*
* If there are no bytes buffered on the socket, or all buffered bytes have been consumed by read,
* then all subsequent calls to read will throw an IOException.
*/
stopAndNotify("IOExeption occurred while trying to read the header of the incoming message. "
+ "Maybe timeout occurred?", e);
return false;
} catch (NullPointerException e2) {
stopAndNotify("NullPointerException occurred while trying to read the header of the incoming message", e2);
return false;
}
if (getBytesReadFromInputStream() < 0) {

View File

@ -117,7 +117,7 @@ public class MessageHandler {
byte[] encodedEXI = getExiCodec().encodeEXI(jaxbObject, false);
// For test purposes you can log the byte array
// getLogger().debug("Encoded EXI byte array: " + ByteUtils.toStringFromByteArray(encodedEXI));
// getLogger().debug("Encoded EXI byte array: " + ByteUtils.toHexString(encodedEXI));
return encodedEXI;
}