digitaldan/jomnilink

uploadNames and uploadLogEventData always throw an exception?

Opened this issue · 3 comments

@digitaldan
I haven't run into an issue in practice and maybe I am just missing something here. But I think the logic is off on uploadNames and uploadLogEventData methods.
The code is here

public Message uploadEventLogData(int number, int direction) throws IOException, OmniNotConnectedException,
			OmniInvalidResponseException, OmniUnknownMessageTypeException {
		Message msg = sendAndReceive(new UploadEventRecord(number, direction));
		if (msg.getMessageType() != Message.MESG_TYPE_EVENT_LOG_DATA
				&& msg.getMessageType() != Message.MESG_TYPE_END_OF_DATA) {
			throw new OmniInvalidResponseException(msg);
		}
		return msg;
	}

Doesn't that check on message type need to be a logical or rather than a logical and? The returned method type is never going to be both types, so it would always throw an exception, right?

I'll take a look , but i don't doubt what you say, I never actually used those calls or even tested them, my guess is I had planned to but forgot then never had a reason to in apps that used the library

Ok. A sanity check in my logic would be appreciated. No rush.

ecdye commented

This should not be an issue now, as it was an issue with boolean logic and is correct, as was discussed in #32.