< prev index next >

test/jdk/com/sun/security/auth/login/ConfigFile/InconsistentError.java

Print this page
rev 59107 : imported patch security


  46                 System.out.println("test 1 succeeded");
  47             } else {
  48                 System.out.println("test 1 failed");
  49                 throw se;
  50             }
  51         }
  52 
  53         try {
  54             System.setProperty("java.security.auth.login.config",
  55                                 "=file:/nofile");
  56             ConfigFile config = new ConfigFile();
  57             throw new SecurityException("test 2 failed");
  58         } catch (SecurityException se) {
  59             if (se.getMessage().indexOf("No such file or directory") > 0) {
  60                 System.out.println("test 2 succeeded");
  61             } else {
  62                 // if the OS is Solaris then this is an error; on windows
  63                 // this is not an error since the  error message on windows
  64                 // is "The system cannot find the file specified "
  65                 // See bug 4450257
  66 
  67                 if (System.getProperty("os.name").equals("SunOS")) {
  68                         System.out.println("test 2 failed");
  69                         throw se;
  70                 }
  71             }
  72         }
  73 
  74         System.setProperty("java.security.auth.login.config",
  75                                 "=file:${test.src}/InconsistentError.config");
  76         ConfigFile config = new ConfigFile();
  77 
  78         System.out.println("test succeeded");
  79 
  80     }
  81 }


  46                 System.out.println("test 1 succeeded");
  47             } else {
  48                 System.out.println("test 1 failed");
  49                 throw se;
  50             }
  51         }
  52 
  53         try {
  54             System.setProperty("java.security.auth.login.config",
  55                                 "=file:/nofile");
  56             ConfigFile config = new ConfigFile();
  57             throw new SecurityException("test 2 failed");
  58         } catch (SecurityException se) {
  59             if (se.getMessage().indexOf("No such file or directory") > 0) {
  60                 System.out.println("test 2 succeeded");
  61             } else {
  62                 // if the OS is Solaris then this is an error; on windows
  63                 // this is not an error since the  error message on windows
  64                 // is "The system cannot find the file specified "
  65                 // See bug 4450257





  66             }
  67         }
  68 
  69         System.setProperty("java.security.auth.login.config",
  70                                 "=file:${test.src}/InconsistentError.config");
  71         ConfigFile config = new ConfigFile();
  72 
  73         System.out.println("test succeeded");
  74 
  75     }
  76 }
< prev index next >