Skip to content

Conversation

hsuk04
Copy link

@hsuk04 hsuk04 commented May 3, 2025

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:

  • Temporary directories are created atomically within the specified baseDir
  • Improved safety and maintainability by leveraging the java nio files package

References

Referenced from a very similar commit here melloware/guava@6b6a070

@itsankit-google itsankit-google added the build Triggers github actions build label May 23, 2025
Copy link
Member

@itsankit-google itsankit-google left a comment

Choose a reason for hiding this comment

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

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build Triggers github actions build

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants