|
1 | 1 | /*
|
2 |
| - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. |
| 2 | + * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. |
3 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
4 | 4 | *
|
5 | 5 | * This code is free software; you can redistribute it and/or modify it
|
|
23 | 23 |
|
24 | 24 | /**
|
25 | 25 | * @test
|
26 |
| - * @bug 8027634 8210810 |
| 26 | + * @bug 8027634 8210810 8240629 |
27 | 27 | * @summary Verify syntax of argument file
|
28 | 28 | * @build TestHelper
|
29 | 29 | * @run main ArgFileSyntax
|
|
36 | 36 | import java.util.HashMap;
|
37 | 37 | import java.util.List;
|
38 | 38 | import java.util.Map;
|
39 |
| -import java.util.regex.Matcher; |
40 | 39 | import java.util.regex.Pattern;
|
41 | 40 |
|
42 | 41 | public class ArgFileSyntax extends TestHelper {
|
@@ -213,10 +212,28 @@ public List<List<List<String>>> loadCases() {
|
213 | 212 | scratch.add(bag + "'" + filling + "\\\\aaa\\\\'");
|
214 | 213 | scratch.add(ver);
|
215 | 214 | rv.add(List.of(scratch, List.of(bag + filling + "\\aaa\\", ver)));
|
216 |
| - |
217 | 215 | return rv;
|
218 | 216 | }
|
219 | 217 |
|
| 218 | + // 8240629: end or start comment at boundary |
| 219 | + @Test |
| 220 | + public void test8240629() throws IOException { |
| 221 | + char[] data = new char[ARG_FILE_PARSER_BUF_SIZE]; |
| 222 | + data[0] = '#'; |
| 223 | + Arrays.fill(data, 1, data.length, '0'); |
| 224 | + |
| 225 | + int need = ARG_FILE_PARSER_BUF_SIZE - System.lineSeparator().length(); |
| 226 | + // Comment end before, at, after boundary |
| 227 | + for (int count = need - 1; count <= need + 1 ; count++) { |
| 228 | + String commentAtBoundary = String.valueOf(data, 0, count); |
| 229 | + List<String> content = new ArrayList<>(); |
| 230 | + content.add(commentAtBoundary); |
| 231 | + content.add("# start a new comment at boundary"); |
| 232 | + content.add("-Dfoo=bar"); |
| 233 | + verifyParsing(content, List.of("-Dfoo=bar")); |
| 234 | + } |
| 235 | + } |
| 236 | + |
220 | 237 | // ensure the arguments in the file are read in correctly
|
221 | 238 | private void verifyParsing(List<String> lines, List<String> args) throws IOException {
|
222 | 239 | File argFile = createArgFile(lines);
|
|
0 commit comments