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

Compile Error: beeping and strange output

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P2 P2
    • None
    • 5.0
    • tools
    • x86
    • windows_xp

      FULL PRODUCT VERSION :
      java version "1.5.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
      Java HotSpot(TM) Client VM (build 1.5.0-b64, mixed mode, sharing)


      ADDITIONAL OS VERSION INFORMATION :
      WindowsXP SP2

      A DESCRIPTION OF THE PROBLEM :
      When I execute javac with my 'plain' code.
      It prints some unreadable texts and beep loudly.

      I can't copy the console out....
      It seems like this....
      --------------------------- << not included

      with some characters in a few line.....
      and types source code somewhat incorectly..
      ------------------------------------------ << not included

      So I put my code to my linux and tried again. (Redhat9 + JDK1.5)
      and then it works

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Here is my full source code......


      import java.util.concurrent.*;

      public class Test {
          public static void main(String[] args) {
              ConcurrentHashMap<Integer, String> map =
              new ConcurrentHashMap<Integer, String>();
              Thread s = new Sup(map);
              s.start();
              Thread c = new Con(map);
              c.start();

              try {
                  Thread.sleep(10000);
              } catch (InterruptedException ie) {
              }
              s.interrupt();
              c.interrupt();
      /*
              for (int i = 0;i < 100000; i++) {
                  map.put(i, Integer.toString(i));
              }
      */
          }
      }

      class Sup extends Thread {

          public Sup(ConcurrentHashMap<Integer, String> map) {
              super();
              this.map = map;
          }

          public void run() {
              while (!super.interrupted()) {
                  for(int i = 0; i < 100; i++) {
                      this.map.put((int)(Math.random() * 10000), Integer.toString(i));
                  }
                  try {
                      Thread.sleep(100L);
                  } catch (InterruptedException ie) {
                      break;
                  }
              }
          }

          private ConcurrentHashMap<Integer, String> map;
      }


      class Con extends Thread {
          public Con(ConcurrentHashMap<Integer, String> map) {
              super();
              this.map = map;
          }
          public void run() {
              while (!super.interrupted()) {
                  for (Integer i : this.map.keySet()) {
                      System.out.print(i + " ");
                  }
                  System.out.println();
                  try {
                      Thread.sleep(100);
                  } catch (InterruptedException ie) {
                      break;
                  }
              }
          }
          private ConcurrentHashMap<Integer, String> map;
      }


      try to compile it on windowsXPSP2 + JDK1.5

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Nothing (Compile)
      ACTUAL -
      I can't copy the console output but it seems like this.


      ?? 1 X
      with some characters in a few line.....
      and types source code somewhat incorectly..


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.util.concurrent.*;

      public class Test {
          public static void main(String[] args) {
              ConcurrentHashMap<Integer, String> map =
              new ConcurrentHashMap<Integer, String>();
              Thread s = new Sup(map);
              s.start();
              Thread c = new Con(map);
              c.start();

              try {
                  Thread.sleep(10000);
              } catch (InterruptedException ie) {
              }
              s.interrupt();
              c.interrupt();
      /*
              for (int i = 0;i < 100000; i++) {
                  map.put(i, Integer.toString(i));
              }
      */
          }
      }

      class Sup extends Thread {

          public Sup(ConcurrentHashMap<Integer, String> map) {
              super();
              this.map = map;
          }

          public void run() {
              while (!super.interrupted()) {
                  for(int i = 0; i < 100; i++) {
                      this.map.put((int)(Math.random() * 10000), Integer.toString(i));
                  }
                  try {
                      Thread.sleep(100L);
                  } catch (InterruptedException ie) {
                      break;
                  }
              }
          }

          private ConcurrentHashMap<Integer, String> map;
      }


      class Con extends Thread {
          public Con(ConcurrentHashMap<Integer, String> map) {
              super();
              this.map = map;
          }
          public void run() {
              while (!super.interrupted()) {
                  for (Integer i : this.map.keySet()) {
                      System.out.print(i + " ");
                  }
                  System.out.println();
                  try {
                      Thread.sleep(100);
                  } catch (InterruptedException ie) {
                      break;
                  }
              }
          }
          private ConcurrentHashMap<Integer, String> map;
      }
      ---------- END SOURCE ----------

            ahe Peter Ahe
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: