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 error on writing cache file in the Java client #10642

Closed
wants to merge 3 commits into from
Closed

Fix error on writing cache file in the Java client #10642

wants to merge 3 commits into from

Conversation

zambrovski
Copy link
Contributor

@zambrovski zambrovski commented Oct 7, 2022

Description

Fixed directory creation if the cache file is missing. Added tests for it.

Related issues

closes #10641

Definition of Done

Not all items need to be done depending on the issue and the pull request.

Code changes:

  • The changes are backwards compatibility with previous versions
  • If it fixes a bug then PRs are created to backport the fix to the last two minor versions. You can trigger a backport by assigning labels (e.g. backport stable/1.3) to the PR, in case that fails you need to create backports manually.

Testing:

  • There are unit/integration tests that verify all acceptance criterias of the issue
  • New tests are written to ensure backwards compatibility with further versions
  • The behavior is tested manually
  • The change has been verified by a QA run
  • The impact of the changes is verified by a benchmark

Documentation:

  • The documentation is updated (e.g. BPMN reference, configuration, examples, get-started guides, etc.)
  • New content is added to the release announcement
  • If the PR changes how BPMN processes are validated (e.g. support new BPMN element) then the Camunda modeling team should be informed to adjust the BPMN linting.

Please refer to our review guidelines.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 7, 2022

Test Results

   942 files  ±    0     942 suites  ±0   1h 48m 16s ⏱️ + 7m 22s
7 732 tests +236  7 725 ✔️ +236  7 💤 ±0  0 ±0 
7 929 runs  +242  7 920 ✔️ +242  9 💤 ±0  0 ±0 

Results for commit c2a068d. ± Comparison against base commit cd87f11.

♻️ This comment has been updated with latest results.

@korthout
Copy link
Member

korthout commented Oct 8, 2022

Hi @zambrovski 👋 Thanks for reporting and immediately fixing it as well! I'll have a good look at the PR after the weekend. I quickly wanted to highlight our error message guidelines.

🔧 Please align the exception message (x must be a directory) with these guidelines

@zambrovski
Copy link
Contributor Author

Will fix the exception text today

Copy link
Member

@korthout korthout left a comment

Choose a reason for hiding this comment

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

👍 Thanks @zambrovski and sorry that this is taking so long.

💭 Please note that I apply the emoji-code in my reviews.

❌ Please have a look at my change requests below.

❓ I've also manually tested your changes, and I wondered whether the new behavior is what you want.

Previously, having a file or symlink named .camunda in your home folder ~ caused an exception:

Caused by: java.nio.file.FileAlreadyExistsException: /Users/korthout/.camunda

Now, that same scenario leads to an exception:

Caused by: java.io.IOException: Expected /Users/korthout/.camunda to be a directory, but it was a regular file.

👍 IMO, the difference is that the error message is clearer and has a stracktrace that better describes what is happening. Additionally, the code has become more expressive about its assumptions.

❓ That's enough for me, but I would like to verify this behavior with you before we merge it.

❌ If this works for you, please rebase (e.g. squash) your commits into one or multiple commits with meaningful commit messages adhering to our commit message guidelines.

.idea/codeStyles/Project.xml Outdated Show resolved Hide resolved
@zambrovski
Copy link
Contributor Author

You are probably right. It should be even better and just re-use the directory if it is one.. Let me improve this and apply your modifications.

@zambrovski
Copy link
Contributor Author

zambrovski commented Oct 10, 2022

I hope, I finally got all guidelines fulfilled (Checkstyle, exception texts, git style, commit message style).
I added more test cases and more elaborate handling of what can happen, if the parent doesn't exist(easy) and if it exists and is a file, is a directory, is a symlink-broken, is a symlink-to-file or is symlink-to-dir.

@zambrovski
Copy link
Contributor Author

By the way, is already hacktoberfest?

@saig0
Copy link
Member

saig0 commented Oct 11, 2022

By the way, is already hacktoberfest?

@zambrovski yes, it is. 🥳

This pull request will count toward the Hacktoberfest challenge. If you contributed four pull requests then you can complete your Camunda Hacktoberfest challenge here.

Copy link
Member

@korthout korthout left a comment

Choose a reason for hiding this comment

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

Wow thanks @zambrovski That's much more thorough.

👍 I like that the file can now be created if the parent directory already exists or when it's a symlink to a directory. That's much more resilient and easy to use. Cool stuff!

I have one last question before I can accept it. Please have a look.

Copy link
Member

@korthout korthout left a comment

Choose a reason for hiding this comment

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

Thanks again @zambrovski

LGTM 🏆

bors merge

@saig0 saig0 added the hacktoberfest-accepted Marks an issue as having been accepted as a Hacktoberfest contribution label Oct 12, 2022
@korthout
Copy link
Member

We seem to be having some issues with our merging bot (bors). I don't see a need to get this merged immediately, so let's await the fix.

@korthout
Copy link
Member

We were able to pinpoint the issue as something related to permissions. A solution is available by rebasing the affected PRs onto main.

@zambrovski Please rebase this PR onto the latest main

@saig0 saig0 changed the title Bugfix/10641 error writing cache file Fix error on writing cache file in the Java client Oct 14, 2022
@zambrovski
Copy link
Contributor Author

Rebased...

@korthout
Copy link
Member

korthout commented Oct 19, 2022

@zambrovski c2a068d merges main into this branch. The backport-action is not able to cherry-pick merge commits. Please remove this commit and rebase on top of main instead.

EDIT: Sorry for all this back and forth. If you'd prefer that I take over the last bit to get this merged, then please let me know.

zeebe-bors-camunda bot added a commit that referenced this pull request Oct 27, 2022
10825: Fix restore app startup and shutdown behavior r=oleschoenburg a=oleschoenburg

- fixes injection of backup store
- fixes missing shutdown of restore app
- fixes a confusing and noisy exception when restore fails within a docker container

closes #10824 

10831: Fix error on writing cache file in the Java client r=saig0 a=korthout

## Description

<!-- Please explain the changes you made here. -->

This is a recreation of #10642, as I had to rebase the branch.

## Related issues

<!-- Which issues are closed by this PR or are related -->

closes #10641



Co-authored-by: Ole Schönburg <ole.schoenburg@gmail.com>
Co-authored-by: Simon Zambrovski <simon.zambrovski@holisticon.de>
zeebe-bors-camunda bot added a commit that referenced this pull request Oct 27, 2022
10831: Fix error on writing cache file in the Java client r=saig0 a=korthout

## Description

<!-- Please explain the changes you made here. -->

This is a recreation of #10642, as I had to rebase the branch.

## Related issues

<!-- Which issues are closed by this PR or are related -->

closes #10641



10833: ci: run go client tests on github hosted runner r=korthout a=oleschoenburg

Go client tests should be able to run ob github hosted runners which are more reliable than the `n1-standard-8-netssd-preempt` runners used before.

Co-authored-by: Simon Zambrovski <simon.zambrovski@holisticon.de>
Co-authored-by: Ole Schönburg <ole.schoenburg@gmail.com>
@zambrovski
Copy link
Contributor Author

Hi,

sorry for not responding. Since the last one is not functional anymore, feel free to take over and perform the last steps to comply to git rules that you described. I would be happy if you do this, before I do something in a wrong way and have to redo it again.

Cheers,

Simon

@korthout
Copy link
Member

Thanks @zambrovski. I've opened #10831 for this, and it's being backported to 8.1 and 8.0. Now that it's merged, I'll close this PR. Thanks again for your contribution 🚀

@korthout korthout closed this Oct 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hacktoberfest-accepted Marks an issue as having been accepted as a Hacktoberfest contribution
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error handling .camunda symbolic link
3 participants