< prev index next >

test/jdk/java/awt/Desktop/OpenByUNCPathNameTest/OpenByUNCPathNameTest.java

Print this page




   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  */
  23 
  24 /* @test
  25    @bug 6550588


  26    @summary java.awt.Desktop cannot open file with Windows UNC filename
  27    @author Anton Litvinov
  28 */
  29 
  30 import java.awt.*;
  31 import java.awt.event.*;
  32 import java.io.*;
  33 
  34 public class OpenByUNCPathNameTest {
  35     private static boolean validatePlatform() {
  36         String osName = System.getProperty("os.name");
  37         if (osName == null) {
  38             throw new RuntimeException("Name of the current OS could not be retrieved.");
  39         }
  40         return osName.startsWith("Windows");
  41     }
  42 
  43     private static void openFile() throws IOException {
  44         if (!Desktop.isDesktopSupported()) {
  45             System.out.println("java.awt.Desktop is not supported on this platform.");




   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  */
  23 
  24 /* @test
  25    @bug 6550588
  26    @key headful
  27    @requires (os.family == "windows")
  28    @summary java.awt.Desktop cannot open file with Windows UNC filename
  29    @author Anton Litvinov
  30 */
  31 
  32 import java.awt.*;
  33 import java.awt.event.*;
  34 import java.io.*;
  35 
  36 public class OpenByUNCPathNameTest {
  37     private static boolean validatePlatform() {
  38         String osName = System.getProperty("os.name");
  39         if (osName == null) {
  40             throw new RuntimeException("Name of the current OS could not be retrieved.");
  41         }
  42         return osName.startsWith("Windows");
  43     }
  44 
  45     private static void openFile() throws IOException {
  46         if (!Desktop.isDesktopSupported()) {
  47             System.out.println("java.awt.Desktop is not supported on this platform.");


< prev index next >