Title: Command line: argfile paths with spaces, a thread pool never shut down, a --dry-run error naming a missing flag · Issue #40 · openjavaformat/open-java-format · GitHub
Open Graph Title: Command line: argfile paths with spaces, a thread pool never shut down, a --dry-run error naming a missing flag · Issue #40 · openjavaformat/open-java-format
X Title: Command line: argfile paths with spaces, a thread pool never shut down, a --dry-run error naming a missing flag · Issue #40 · openjavaformat/open-java-format
Description: What Three small command-line problems, each also open in google-java-format: Paths with spaces in an argfile: google/google-java-format#421. CommandLineOptionsParser splits an @argfile at every whitespace character and knows no quotes, ...
Open Graph Description: What Three small command-line problems, each also open in google-java-format: Paths with spaces in an argfile: google/google-java-format#421. CommandLineOptionsParser splits an @argfile at every wh...
X Description: What Three small command-line problems, each also open in google-java-format: Paths with spaces in an argfile: google/google-java-format#421. CommandLineOptionsParser splits an @argfile at every wh...
Opengraph URL: https://github.com/openjavaformat/open-java-format/issues/40
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Command line: argfile paths with spaces, a thread pool never shut down, a --dry-run error naming a missing flag","articleBody":"### What\n\nThree small command-line problems, each also open in google-java-format:\n\n1. **Paths with spaces in an argfile**: [google/google-java-format#421](https://github.com/google/google-java-format/issues/421). `CommandLineOptionsParser` splits an `@argfile` at every whitespace character and knows no quotes, so the line `\"/tmp/dir with space/A.java\"` becomes three arguments. Each one is reported as \"Skipping non-Java file\", and the run exits 0 having formatted nothing. An argfile that names itself ends in a `StackOverflowError`.\n2. **A thread pool that is never shut down**: [google/google-java-format#384](https://github.com/google/google-java-format/issues/384). `Main.formatFiles` creates a fixed thread pool on every call and never shuts it down. The command line does not notice, because the process exits, but a tool that calls `Main` in-process keeps up to `MAX_THREADS` idle threads per call.\n3. **`--dry-run` with `--replace`**: [google/google-java-format#1094](https://github.com/google/google-java-format/issues/1094). The error says \"cannot use --dry-run and --in-place at the same time\", but there is no `--in-place`; the flag is `-i`, `-r` or `--replace`.\n\n### Fix\n\n1. Port [google/google-java-format#931](https://github.com/google/google-java-format/pull/931) by Karlheinz Friedberger (open): a single- or double-quoted string in an argfile is one argument, and an argfile that includes itself is reported as an error.\n2. Close the pool when `formatFiles` returns. On Java 21 `ExecutorService` is `AutoCloseable` and `close()` waits for the submitted tasks, so a try-with-resources is enough.\n3. Port [google/google-java-format#1451](https://github.com/google/google-java-format/pull/1451) by rootkiller6788 (open): the message names `--replace`.\n\n### Done when\n\n- `CommandLineOptionsParserTest` reads a quoted path with spaces from an argfile as one path, and a self-including argfile fails with a clear message;\n- a `MainTest` shows that no pool thread is left once `format` returns;\n- `CommandLineFlagsTest` expects `--replace` for both `--replace --dry-run` and `-i -n`;\n- the ported commits keep their upstream authors.\n","author":{"url":"https://github.com/abashev","@type":"Person","name":"abashev"},"datePublished":"2026-09-23T07:15:33Z","url":"https://github.com/openjavaformat/open-java-format/issues/40"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:063dcac7-8420-75cf-e3a6-ba77276a08fb |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A174:9AE98:E18FC:12C6CF:6AFBAEE1 |
| html-safe-nonce | 57796a86f014e7384bfd753d17e057e95040d875579b1c84ca4d2dae373f7bae |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMTc0OjlBRTk4OkUxOEZDOjEyQzZDRjo2QUZCQUVFMSIsInZpc2l0b3JfaWQiOiI3NTExMzk0OTY5MjAyNzAwMDAxIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | f41dd357f0d08017f116c3acf63483689826f81f1a684d1619bf78165c2f335e |
| hovercard-subject-tag | issue:5550086789 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/openjavaformat/open-java-format/40/issue_layout |
| twitter:image | https://opengraph.githubassets.com/9c6b006a49e62429ed5e051d793132889d08e3f8aec17e85163640f6be88d7b4/openjavaformat/open-java-format/issues/40 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/9c6b006a49e62429ed5e051d793132889d08e3f8aec17e85163640f6be88d7b4/openjavaformat/open-java-format/issues/40 |
| og:image:alt | What Three small command-line problems, each also open in google-java-format: Paths with spaces in an argfile: google/google-java-format#421. CommandLineOptionsParser splits an @argfile at every wh... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | abashev |
| hostname | github.com |
| expected-hostname | github.com |
| None | e25fbd830d3e6ad0e8935c105cf4fdc70c593dffcd27bb45b790ae4fece5ea55 |
| turbo-cache-control | no-preview |
| go-import | github.com/openjavaformat/open-java-format git https://github.com/openjavaformat/open-java-format.git |
| octolytics-dimension-user_id | 325177626 |
| octolytics-dimension-user_login | openjavaformat |
| octolytics-dimension-repository_id | 1288055459 |
| octolytics-dimension-repository_nwo | openjavaformat/open-java-format |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | true |
| octolytics-dimension-repository_parent_id | 214273098 |
| octolytics-dimension-repository_parent_nwo | palantir/palantir-java-format |
| octolytics-dimension-repository_network_root_id | 214273098 |
| octolytics-dimension-repository_network_root_nwo | palantir/palantir-java-format |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 08c8f17f9d27054a108b8b6254e405de0151f660 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width