Use java nio package for createTempDir#15951
Open
hsuk04 wants to merge 1 commit intocdapio:developfrom
Open
Conversation
itsankit-google
requested changes
May 23, 2025
Member
itsankit-google
left a comment
There was a problem hiding this comment.
please fix unit test failures:
Error: Failures:
Error: DefaultAccessEnforcerTest.testAuthEnforceWithBadEncryptedCredential
Expected: (an instance of java.lang.Exception and exception with message a string containing "Failed to decrypt credential in principle:")
but: exception with message a string containing "Failed to decrypt credential in principle:" message was "Base directory must exist and be a directory: /tmp/cdap/cdap/cdap-security/target/junit8730670310602903299/junit8904945282114374823/tmp"
Stacktrace was: java.lang.IllegalArgumentException: Base directory must exist and be a directory: /tmp/cdap/cdap/cdap-security/target/junit8730670310602903299/junit8904945282114374823/tmp
at io.cdap.cdap.common.utils.DirUtils.createTempDir(DirUtils.java:108)
at io.cdap.cdap.security.authorization.AccessControllerInstantiator.createAccessControllerClassLoader(AccessControllerInstantiator.java:238)
at io.cdap.cdap.security.authorization.AccessControllerInstantiator.get(AccessControllerInstantiator.java:154)
at io.cdap.cdap.security.authorization.DefaultAccessEnforcerTest.createControllerWrapper(DefaultAccessEnforcerTest.java:129)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR changes the createTempDir method in the DirUtils class to use the modern java.nio.file.Files.createTempDirectory API. The updated implementation ensures:
References
Referenced from a very similar commit here melloware/guava@6b6a070