9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 /*
25 * @test
26 * @author Valerie Peng
27 * @bug 4716213
28 * @bug 4797850
29 * @summary Verify that expand(String, boolean) does not encode if
30 * the value is a valid URI with a scheme (it is already encoded),
31 * i.e. avoid double encoding.
32 */
33 import java.io.File;
34 import sun.security.util.*;
35
36 public class ExpandAndEncode {
37
38 private static String tests[] = {
39 "${env.test1}/test.jar",
40 "file:${env.test2}/test.jar",
41 "file:/foo/${env.test3}",
42 "file:/foo/${env.test4}"
43 };
44
45 private static String answers[] = {
46 "http://my%20home/test.jar",
47 "file:/my%20home/test.jar",
48 "file:/foo/bar%23foobar",
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 /*
25 * @test
26 * @author Valerie Peng
27 * @bug 4716213
28 * @bug 4797850
29 * @modules java.base/sun.security.util
30 * @summary Verify that expand(String, boolean) does not encode if
31 * the value is a valid URI with a scheme (it is already encoded),
32 * i.e. avoid double encoding.
33 */
34 import java.io.File;
35 import sun.security.util.*;
36
37 public class ExpandAndEncode {
38
39 private static String tests[] = {
40 "${env.test1}/test.jar",
41 "file:${env.test2}/test.jar",
42 "file:/foo/${env.test3}",
43 "file:/foo/${env.test4}"
44 };
45
46 private static String answers[] = {
47 "http://my%20home/test.jar",
48 "file:/my%20home/test.jar",
49 "file:/foo/bar%23foobar",
|