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

Handle IllegalStateException in file:directory-list#2 #5092

Merged
merged 4 commits into from
Oct 19, 2023

Conversation

line-o
Copy link
Member

@line-o line-o commented Oct 16, 2023

Closes #5028

The Java code of DirectoryList can throw an IllegalStateException when a non-existent directory is supplied as its first argument. This exception class is now handled in file:list#2.

This is a forward port of #5061
Thanks to @nverwer for bringing this up and also finding the fix.

@line-o line-o requested a review from a team October 16, 2023 18:35
@line-o
Copy link
Member Author

line-o commented Oct 16, 2023

We should consider adding a test for this.

file:directory-list('/non/existent', ())

@line-o line-o changed the title [fix] handle IllegalStateException in file:list#2 [fix] handle IllegalStateException in file:directory-list#2 Oct 16, 2023
Copy link
Contributor

@adamretter adamretter left a comment

Choose a reason for hiding this comment

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

As @line-o suggested, let's add a test...

@line-o
Copy link
Member Author

line-o commented Oct 16, 2023

Test added

@line-o line-o force-pushed the fix/5028 branch 2 times, most recently from 63ff6e5 to c3fd24b Compare October 16, 2023 20:33
fixes eXist-db#5028

The Java code of DirectoryList can throw an IllegalStateException
when a non-existent directory is supplied as its first argument.
This exception class is now handled in file:list#2.

Additionally, the raised error now has a proper code `file:DIRECTORY_NOT_FOUND`.

This will allow us in the future to add proper error codes to more
errors raised by this module.
@line-o
Copy link
Member Author

line-o commented Oct 16, 2023

6.x.x backport is #5093

Copy link
Contributor

@adamretter adamretter left a comment

Choose a reason for hiding this comment

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

1 comment otherwise this LGTM.

@reinhapa reinhapa requested a review from adamretter October 17, 2023 12:59
@adamretter adamretter changed the title [fix] handle IllegalStateException in file:directory-list#2 Handle IllegalStateException in file:directory-list#2 Oct 17, 2023
@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

48.6% 48.6% Coverage
0.0% 0.0% Duplication

idea Catch issues before they fail your Quality Gate with our IDE extension sonarlint SonarLint

Copy link
Contributor

@adamretter adamretter left a comment

Choose a reason for hiding this comment

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

Thanks for addressing the code review, now LGTM.

@adamretter adamretter merged commit a071efe into eXist-db:develop Oct 19, 2023
10 of 11 checks passed
@PieterLamers
Copy link

Thanks everybody!

@line-o line-o deleted the fix/5028 branch October 20, 2023 09:14
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.

[BUG] file:directory-list#2 does not properly report an error on a non-existent directory
5 participants