JDK-6360726 : Compile Error: beeping and strange output
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 5.0
  • Priority: P2
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2005-12-08
  • Updated: 2011-02-16
  • Resolved: 2005-12-13
Related Reports
Duplicate :  
Description
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 ----------

Comments
EVALUATION This is not really a bug. On Windows, a number of file names have special meaning. If you write to a file named "CON", the output is copied to the console. Since javac opens the file Con.class and writes the class there, the class file will end up on the console. This would be similar to writing to /dev/tty on Linux. See http://msdn.microsoft.com/library/en-us/fileio/base/naming_a_file.asp for more details on reserved names.
13-12-2005