Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4498413

appletviewer: "network operation" test case fails

XMLWordPrintable

    • x86
    • windows_nt

      Release: Update Release 1.2.2_007
      Systems: Windows NT
      Description:
      When testing appletviewer tool, the network operations test case
      fail in "local" option mode. Here's the testcase in Java:

          private void test5() {
              String subTest = testName + ":(test5)";
              boolean failed = false;
              URL url = getCodeBase();

              TestUtil.logStart(subTest);
              TestUtil.logMsg("getCodeBase() = " + getCodeBase());
              TestUtil.logMsg("getDocumentBase() = " + getDocumentBase());
              TestUtil.logMsg("Create socket connection to originating host " +
                      "[Should succeed]");
              try {
                  Socket s = new Socket(url.getHost(), 79); <<< *** Fail at this point ***
                  s.close();
              } catch(SecurityException e1) {
                  TestUtil.logErr("Caught Unexpected SecurityException " + e1);
                  failed = true;
                  ;
              } catch(ConnectException e2) {
                  ;
              } catch(Exception e3) {
                  TestUtil.logErr("Caught Unexpected Exception " + e3);
                  failed = true;
              }
              TestUtil.logMsg("Create socket connection to non originating host " +
                      "[Should get SecurityException]");
              try {
                  Socket s = new Socket("jse", 9);
                  TestUtil.logErr(
                      "Expected SecurityException creating socket conection");
                  failed = true;
                  s.close();
              } catch(SecurityException e1) {
                  ;
              } catch(ConnectException e2) {
                  ;
              } catch(Exception e3) {
                  TestUtil.logErr("Caught Unexpected Exception " + e3);
                  failed = true;
              }
              TestUtil.logMsg(
                  "Create and use multicast socket [Should get SecurityException]");
              try {
                  MulticastSocket s = new MulticastSocket(20000);
                  s.joinGroup(InetAddress.getByName("224.0.0.1"));
                  TestUtil.logErr(
                  "Expected SecurityException creating and using multicast socket");
                  failed = true;
                  s.close();
              } catch(SecurityException e1) {
                  ;
              } catch(Exception e2) {
                  TestUtil.logErr("Caught Unexpected Exception " + e2);
                  failed = true;
              }
              if(failed)
                  TestUtil.fail(subTest);
              else
                  TestUtil.pass(subTest);
              TestUtil.logStop(subTest);
          }


      Follow is the error output:
      -------------------------------------------------------------------------------
      Begin executing test T1:(test5) .....
      getCodeBase() = file:/D:/ws/TOOLS/appletviewer/tests/
      getDocumentBase() = file:/D:/ws/TOOLS/appletviewer/tests/T1JAR.html
      Create socket connection to originating host [Should succeed]
      ERROR: Caught Unexpected Exception java.net.SocketException: connect (code=10061)
      Create socket connection to non originating host [Should get SecurityException]
      Create and use multicast socket [Should get SecurityException]
      T1:(test5) ..... FAILED
      Done executing test T1:(test5) .....
      --------------------------------------------------------------------------------

            robm Robert Mckenna
            hungnguy Hung Nguyen (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: