Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Counter): Resolve IndexOutOfBoundsException (see #14) #15

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hypery2k
Copy link
Contributor

@hypery2k hypery2k commented Mar 26, 2020

see #14

Copy link
Member

@tobilarscheid tobilarscheid left a comment

Choose a reason for hiding this comment

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

See my code comment, happy to discuss!

count++;
Files.write(counterFile.toPath(), count.toString().getBytes(Charset.forName("UTF-8")));
List<String> lines = Files.readAllLines(counterFile.toPath());
if (lines != null && lines.size() > 0){
Copy link
Member

Choose a reason for hiding this comment

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

Hi Martin, in theory, this condition should never be false - increaseCounter is never called before the file was created (see callsite) So the error situation you are seeing seems to be some kind of illegal state and I have no clue how this can even occur.

I know that the change you propose will fix the errors you see, but also the plugin will just silently fail to write the metric - making the whole metric collection inherently unreliable, with a margin of error we couldn't even quantify. Only thing I can imagine (if we find no proper way to fix the actual faulty condition) would be a config flag "ignore errors" or something like this.

What do you think? Happy to here your proposals!

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.

2 participants