Skip to content

Improved Sysfs robustness - #652

Closed
JakubVanek wants to merge 2 commits into
masterfrom
sysfsRobustness
Closed

JakubVanek wants to merge 2 commits into
masterfrom
sysfsRobustness

Conversation

@JakubVanek

Copy link
Copy Markdown
Contributor

This PR builds on top of #650 and adds some small refactorings to Sysfs:

  • Removing check for writable file #650 is integrated. Together with this, the writeString() now manually encodes the string to bytes and writes it using FileOutputStream. This should ensure the best performance.
  • readString() is a bit tweaked to use exceptions in a better way.
  • getElements() is checking for null value of a result.
  • write* method do not return a boolean anymore. This is because I think exceptions already convey that an error occured. The only usage of this boolean was to throw an exception.
  • Slf4j formatting functions are used, so it is not necessary to check if tracing is enabled. Slf4j already checks if the level is enabled before the format is processed.

To keep this clean, a separate PR will follow to resolve #651.

viniciusccarvalho and others added 2 commits February 23, 2019 21:47
Seems that file.isWritable() is unreliable depending on the OS/JDK version.
The catch clause of the block would capture if the file is really not writable anyways.
This commit makes some refactorings in Sysfs:

 - #650 is
   integrated. Together with this, the writeString() now
   manually encodes the string to bytes and writes it using
   FileOutputStream. This should ensure the best performance.

 - readString() is a bit tweaked to use exceptions in a better way.

 - getElements() is checking for null value of a result.

 - write* method do not return a boolean anymore. This is
   because I think exceptions already convey that an error occured.
   The only usage of this boolean was to throw an exception.

 - Slf4j formatting functions are used, so it is not necessary to
   check if tracing is enabled. Slf4j already checks if the level is
   enabled before the format is processed.
@JakubVanek JakubVanek self-assigned this Mar 14, 2019
@JakubVanek
JakubVanek requested a review from jabrena March 14, 2019 16:17
@JakubVanek

Copy link
Copy Markdown
Contributor Author

@jabrena

jabrena commented Mar 14, 2019 •

Copy link
Copy Markdown
Member

Hi Jakub,

it is not a refactoring, you are changing the signature of the methods.
This is not the way to operate.

This class affect the whole project, I am going to close this Merge request.
Any big change in this part, require a full regression of the project.

If you have some ideas, open an issue, share the ideas and discuss, not open a PR.

Juan Antonio

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.

Permission denied during BaseRegulatedMotor construction

3 participants