Re: Does this seem odd to you?

2018-02-19 Thread Christofer Dutz
Ok ... fixed that __

Thanks again for finding (

Chris

Am 17.02.18, 09:43 schrieb "Christofer Dutz" :

If it's code I have written, it was a mistake ... I would agree to use the 
exception and not the assertion, because they can be turned off.

Chris

Outlook for Android herunterladen


From: Justin Mclean 
Sent: Saturday, February 17, 2018 8:14:24 AM
To: dev@plc4x.apache.org
Subject: Does this seem odd to you?

Hi,

It's a very minor thing I know but I just came access this:

public static TpduSize valueForGivenSize(int pduSize) {
if(pduSize < 0) {
throw new IllegalArgumentException("PduSize has to be greater 
than 0");
}
assert pduSize > 0;

And have a few questions:
- Should we be using asserts in code like that?
- Wouldn't it be easier to just change the first condition to match the 
message i.e. <= rather than < and drop the assert?

Just asking cos there may be a something I missing here. It’s in 
java/isotp/netty/model/types/TpduSize.java BTW.

Thanks,
Justin








Re: Does this seem odd to you?

2018-02-17 Thread Christofer Dutz
If it's code I have written, it was a mistake ... I would agree to use the 
exception and not the assertion, because they can be turned off.

Chris

Outlook for Android herunterladen


From: Justin Mclean 
Sent: Saturday, February 17, 2018 8:14:24 AM
To: dev@plc4x.apache.org
Subject: Does this seem odd to you?

Hi,

It's a very minor thing I know but I just came access this:

public static TpduSize valueForGivenSize(int pduSize) {
if(pduSize < 0) {
throw new IllegalArgumentException("PduSize has to be greater than 
0");
}
assert pduSize > 0;

And have a few questions:
- Should we be using asserts in code like that?
- Wouldn't it be easier to just change the first condition to match the message 
i.e. <= rather than < and drop the assert?

Just asking cos there may be a something I missing here. It’s in 
java/isotp/netty/model/types/TpduSize.java BTW.

Thanks,
Justin