question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TemporaryFolder default name generation inconsistent

See original GitHub issue

TemporaryFolder relies on java.io.File$TempDirectory.

The generateFile method uses SecureRandom to generate a long to ascribe to the file name.

This can cause varying lengths of temporary folder name.

filePath: /tmp/junit2375994787548427572/test.txt --> long is 19 chars filePath: /tmp/junit3617134405501405307/test.txt --> long is 19 chars again filePath: /tmp/junit343221902873074958/test.txt --> long is 18 chars

This was discovered during serialisation of path names and byte length checks in tests causing intermittent issues.

A switch to using a UUID.randomUuid() and actually implementing temp folder creation in junit might be a way to fix this (I don’t see an api on java.io.File which allows passing the random part of the filename).

junit: 4.12 os: ubuntu 20.04

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
marcphilippcommented, Aug 13, 2021

I also don’t see this as a compelling reason to revisit that decision.

1reaction
kcooneycommented, Aug 13, 2021

TemporaryFolder used to have its own implementation for creating the directory. We intentionally moved away from that in the recent release of JUnit. I’m not sure this is a compelling reason to revisit that decision.

Read more comments on GitHub >

github_iconTop Results From Across the Web

sys_get_temp_dir - Manual - PHP
Returns the path of the directory PHP stores temporary files in by default. Parameters ¶. This function has no parameters. Return Values ¶....
Read more >
TemporaryFolder (JUnit API)
The TemporaryFolder Rule allows creation of files and folders that should be deleted when the test method finishes (whether it passes or fails)....
Read more >
Troubleshooting the Embedded Workbench IDE - IAR Systems
Inconsistent or corrupt project files can produce symptoms as follows. The IAR Embedded Workbench no longer starts after an abnormal termination ...
Read more >
Attachment Secure Temporary Folder - ADMX Help
This policy setting allows you to specify a folder path for the Secure Temporary Files folder rather than using the one that is...
Read more >
Source database considerations for the Oracle and AWS DMS ...
When you do so, use the 'ORCL' default name to create your RDS Oracle instance. Otherwise, the procedures following don't run successfully.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found