test/tools/launcher/Arrrghs.java

Print this page


   1 /*
   2  * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   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  */


 292         // slashes separating characters
 293         checkArgumentParsing("X\\Y\\Z", "X\\Y\\Z");
 294         checkArgumentParsing("\\X\\Y\\Z", "\\X\\Y\\Z");
 295 
 296         // literals within dangling quotes, etc.
 297         checkArgumentParsing("\"a b c\" d e", "a b c", "d", "e");
 298         checkArgumentParsing("\"ab\\\"c\"  \"\\\\\"  d", "ab\"c", "\\", "d");
 299         checkArgumentParsing("a\\\\\\c d\"e f\"g h", "a\\\\\\c", "de fg", "h");
 300         checkArgumentParsing("a\\\\\\\"b c d", "a\\\"b", "c", "d");
 301         checkArgumentParsing("a\\\\\\\\\"g c\" d e", "a\\\\g c", "d", "e");
 302 
 303         // treatment of back-slashes
 304         checkArgumentParsing("*\\", "*\\");
 305         checkArgumentParsing("*/", "*/");
 306         checkArgumentParsing(".\\*", ".\\*");
 307         checkArgumentParsing("./*", "./*");
 308         checkArgumentParsing("..\\..\\*", "..\\..\\*");
 309         checkArgumentParsing("../../*", "../../*");
 310         checkArgumentParsing("..\\..\\", "..\\..\\");
 311         checkArgumentParsing("../../", "../../");

 312     }
 313 
 314     private void initEmptyDir(File emptyDir) throws IOException {
 315         if (emptyDir.exists()) {
 316             recursiveDelete(emptyDir);
 317         }
 318         emptyDir.mkdir();
 319     }
 320 
 321     private void initDirWithJavaFiles(File libDir) throws IOException {
 322 
 323         if (libDir.exists()) {
 324             recursiveDelete(libDir);
 325         }
 326         libDir.mkdirs();
 327         ArrayList<String> scratchpad = new ArrayList<>();
 328         scratchpad.add("package lib;");
 329         scratchpad.add("public class Fbo {");
 330         scratchpad.add("public static void main(String... args){Foo.f();}");
 331         scratchpad.add("public static void f(){}");


   1 /*
   2  * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   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  */


 292         // slashes separating characters
 293         checkArgumentParsing("X\\Y\\Z", "X\\Y\\Z");
 294         checkArgumentParsing("\\X\\Y\\Z", "\\X\\Y\\Z");
 295 
 296         // literals within dangling quotes, etc.
 297         checkArgumentParsing("\"a b c\" d e", "a b c", "d", "e");
 298         checkArgumentParsing("\"ab\\\"c\"  \"\\\\\"  d", "ab\"c", "\\", "d");
 299         checkArgumentParsing("a\\\\\\c d\"e f\"g h", "a\\\\\\c", "de fg", "h");
 300         checkArgumentParsing("a\\\\\\\"b c d", "a\\\"b", "c", "d");
 301         checkArgumentParsing("a\\\\\\\\\"g c\" d e", "a\\\\g c", "d", "e");
 302 
 303         // treatment of back-slashes
 304         checkArgumentParsing("*\\", "*\\");
 305         checkArgumentParsing("*/", "*/");
 306         checkArgumentParsing(".\\*", ".\\*");
 307         checkArgumentParsing("./*", "./*");
 308         checkArgumentParsing("..\\..\\*", "..\\..\\*");
 309         checkArgumentParsing("../../*", "../../*");
 310         checkArgumentParsing("..\\..\\", "..\\..\\");
 311         checkArgumentParsing("../../", "../../");
 312         checkArgumentParsing("a b\\ c", "a", "b\\", "c");
 313     }
 314 
 315     private void initEmptyDir(File emptyDir) throws IOException {
 316         if (emptyDir.exists()) {
 317             recursiveDelete(emptyDir);
 318         }
 319         emptyDir.mkdir();
 320     }
 321 
 322     private void initDirWithJavaFiles(File libDir) throws IOException {
 323 
 324         if (libDir.exists()) {
 325             recursiveDelete(libDir);
 326         }
 327         libDir.mkdirs();
 328         ArrayList<String> scratchpad = new ArrayList<>();
 329         scratchpad.add("package lib;");
 330         scratchpad.add("public class Fbo {");
 331         scratchpad.add("public static void main(String... args){Foo.f();}");
 332         scratchpad.add("public static void f(){}");