Skip to content

Conversation

@hongweiyi
Copy link
Contributor

closes #519
Signed-off-by: hongwei yi hongweiyi@hotmail.com


This change is Reviewable

Signed-off-by: hongwei yi <hongweiyi@hotmail.com>
Signed-off-by: hongwei yi <hongweiyi@hotmail.com>
Signed-off-by: hongwei yi <hongweiyi@hotmail.com>
this.dockerTlsVerify = BooleanUtils.toBoolean(dockerTlsVerify.trim())
|| BooleanUtils.toBoolean(dockerTlsVerify.trim(), "1", "0");
String trimmed = dockerTlsVerify.trim();
this.dockerTlsVerify = "true".equals(trimmed) || "1".equals(trimmed);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks not very good for eyes, have you looked at org.apache.commons.lang.BooleanUtils#toBooleanObject(java.lang.String) ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe org.apache.commons.lang.BooleanUtils#toBooleanObject(java.lang.String) is too complicated in this case, "true".equals(trimmed) || "1".equals(trimmed) is simple, fast and straight forward.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, all Utils are available to simplify the code readability and i think one of them should work. Can't get idea what is wrong 🏧 and why utils can't be used... toBoolean() calls toBooleanObject()

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and imho TRUE should also work as true, so better to use existed utils, they are already verified and covers different corner cases.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LOL, there always two ways. 1. make maximum use of Utils; 2. make code as simple as possible.

But I'm the latter one, I perfect has third libraries as little as possible.

As the former one, if BooleanUtils has a method to pass default value, it will looks very good for eyes, just like:

toBoolean(str, trueStr, falseStr, defaultValue);

Or if docker-java does not want user to set invalid value to DOCKER_TLS_VERIFY, it should throw exception directly.

Sorry about that.
Signed-off-by: hongwei yi <hongweiyi@hotmail.com>
@codecov-io
Copy link

Current coverage is 22.82%

Merging #520 into master will increase coverage by +0.03% as of 6375c7d

@@            master    #520   diff @@
======================================
  Files          294     294       
  Stmts         6077    6078     +1
  Branches       526     526       
  Methods          0       0       
======================================
+ Hit           1385    1387     +2
+ Partial         83      82     -1
  Missed        4609    4609       

Review entire Coverage Diff as of 6375c7d

Powered by Codecov. Updated on successful CI builds.

@hongweiyi
Copy link
Contributor Author

Some problems with 3rd party libraries in nodejs : ) .

http://www.haneycodes.net/npm-left-pad-have-we-forgotten-how-to-program/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DOCKER_TLS_VERIFY cannot be 'false' or empty

3 participants