-
Bug
-
Resolution: Not an Issue
-
P4
-
None
-
1.4.2
-
x86
-
linux
FULL PRODUCT VERSION :
java version "1.4.2_08"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_08-b03)
Java HotSpot(TM) Client VM (build 1.4.2_08-b03, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
linux 2.6.10, mostly redhat distribution
A DESCRIPTION OF THE PROBLEM :
There appears to be a race condition on when the setState() takes effect. On linux, the mouse selection, or the user's setState randomly wins.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
run program. Click on a box. That row should all be enabled. Including the box that was clicked/checked.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
every box in the row should be checked.
this appears to work on a Win 2000 system. I was in reality trying to replicate a different anomaly between linux & windows, but found this so far.
ACTUAL -
for all the boxe in that row that was not checked that are enabled ( which is what i expect ). The box in the row that was selected sometimes (most-times ) does not show selected.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
/*
* WhatsInAChoiceBox.java
*
* Created on July 9, 2005, 7:23 AM
*/
/**
*
* @author gat
*/
import java.awt.*;
import java.awt.event.*;
public class WhatsInAChoiceBox extends java.awt.Frame {
/** Creates new form WhatsInAChoiceBox */
java.awt.event.MouseAdapter mouseClickListener =
new java.awt.event.MouseAdapter() {
public void mouseClicked(MouseEvent evt) {
cbClicked(evt);
}
};
public WhatsInAChoiceBox() {
initComponents();
setupCBarray();
int i ;
for ( i = 0; i < cb.length; i++ )
cb[i].addMouseListener( mouseClickListener );
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
private void initComponents() {//GEN-BEGIN:initComponents
panel1 = new java.awt.Panel();
checkbox1 = new java.awt.Checkbox();
checkbox2 = new java.awt.Checkbox();
checkbox3 = new java.awt.Checkbox();
checkbox4 = new java.awt.Checkbox();
checkbox5 = new java.awt.Checkbox();
checkbox6 = new java.awt.Checkbox();
checkbox7 = new java.awt.Checkbox();
checkbox8 = new java.awt.Checkbox();
checkbox9 = new java.awt.Checkbox();
checkbox10 = new java.awt.Checkbox();
checkbox11 = new java.awt.Checkbox();
checkbox12 = new java.awt.Checkbox();
checkbox13 = new java.awt.Checkbox();
checkbox14 = new java.awt.Checkbox();
checkbox15 = new java.awt.Checkbox();
checkbox16 = new java.awt.Checkbox();
setLayout(new java.awt.FlowLayout());
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(java.awt.event.WindowEvent evt) {
exitForm(evt);
}
});
panel1.setLayout(new java.awt.GridLayout(4, 4, 5, 5));
panel1.setBackground(new java.awt.Color(255, 255, 51));
panel1.setName("cbPanel");
checkbox1.setLabel("checkbox1");
panel1.add(checkbox1);
checkbox2.setLabel("checkbox2");
panel1.add(checkbox2);
checkbox3.setLabel("checkbox3");
panel1.add(checkbox3);
checkbox4.setLabel("checkbox4");
panel1.add(checkbox4);
checkbox5.setLabel("checkbox5");
panel1.add(checkbox5);
checkbox6.setLabel("checkbox6");
panel1.add(checkbox6);
checkbox7.setLabel("checkbox7");
panel1.add(checkbox7);
checkbox8.setLabel("checkbox8");
panel1.add(checkbox8);
checkbox9.setLabel("checkbox9");
panel1.add(checkbox9);
checkbox10.setLabel("checkbox10");
panel1.add(checkbox10);
checkbox11.setLabel("checkbox11");
panel1.add(checkbox11);
checkbox12.setLabel("checkbox12");
panel1.add(checkbox12);
checkbox13.setLabel("checkbox13");
panel1.add(checkbox13);
checkbox14.setLabel("checkbox14");
panel1.add(checkbox14);
checkbox15.setLabel("checkbox15");
panel1.add(checkbox15);
checkbox16.setLabel("checkbox16");
panel1.add(checkbox16);
add(panel1);
pack();
}//GEN-END:initComponents
/** Exit the Application */
private void exitForm(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_exitForm
System.exit(0);
}//GEN-LAST:event_exitForm
public void
cbClicked( MouseEvent evt ) {
Checkbox selected = (Checkbox) evt.getSource();
int i;
for ( i = 0; i < cb.length; i++ ) {
if ( cb[i] == selected )
break;
}
if ( i >= cb.length ) {
System.out.println( "Confused: checkbox does not belong to me!");
return;
}
for ( int k = 0; k < cb.length; k++)
cb[k].setState( false ); // everybody off
int start = (i/4) * 4;
for ( int k = start; k < start+4; k++ ) {
//if ( k != i)
{ // Race condition
System.out.println("Setting "+cb[k].getLabel() + " to true");
cb[k].setState( true );
}
}
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
new WhatsInAChoiceBox().show();
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private java.awt.Checkbox checkbox1;
private java.awt.Checkbox checkbox10;
private java.awt.Checkbox checkbox11;
private java.awt.Checkbox checkbox12;
private java.awt.Checkbox checkbox13;
private java.awt.Checkbox checkbox14;
private java.awt.Checkbox checkbox15;
private java.awt.Checkbox checkbox16;
private java.awt.Checkbox checkbox2;
private java.awt.Checkbox checkbox3;
private java.awt.Checkbox checkbox4;
private java.awt.Checkbox checkbox5;
private java.awt.Checkbox checkbox6;
private java.awt.Checkbox checkbox7;
private java.awt.Checkbox checkbox8;
private java.awt.Checkbox checkbox9;
private java.awt.Panel panel1;
// End of variables declaration//GEN-END:variables
Checkbox[] cb = {
checkbox1, checkbox2, checkbox3, checkbox4, checkbox5, checkbox6, checkbox7, checkbox8,
checkbox9, checkbox10, checkbox11, checkbox12, checkbox13, checkbox14, checkbox15, checkbox16
};
void setupCBarray() {
cb[ 0] = checkbox1; cb[ 1] = checkbox2; cb[ 2] = checkbox3; cb[ 3] = checkbox4;
cb[ 4] = checkbox5; cb[ 5] = checkbox6; cb[ 6] = checkbox7; cb[ 7] = checkbox8;
cb[ 8] = checkbox9; cb[ 9] = checkbox10; cb[10] = checkbox11; cb[11] = checkbox12;
cb[12] = checkbox13; cb[13] = checkbox14; cb[14] = checkbox15; cb[15] = checkbox16;
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
if you dont setState the box ( "//if ( k != i)" )that caused the checkbox event, on linux, then this appears to work most of the time.
On windows, this workaround does not work.
###@###.### 2005-07-21 06:32:48 GMT
java version "1.4.2_08"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_08-b03)
Java HotSpot(TM) Client VM (build 1.4.2_08-b03, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
linux 2.6.10, mostly redhat distribution
A DESCRIPTION OF THE PROBLEM :
There appears to be a race condition on when the setState() takes effect. On linux, the mouse selection, or the user's setState randomly wins.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
run program. Click on a box. That row should all be enabled. Including the box that was clicked/checked.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
every box in the row should be checked.
this appears to work on a Win 2000 system. I was in reality trying to replicate a different anomaly between linux & windows, but found this so far.
ACTUAL -
for all the boxe in that row that was not checked that are enabled ( which is what i expect ). The box in the row that was selected sometimes (most-times ) does not show selected.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
/*
* WhatsInAChoiceBox.java
*
* Created on July 9, 2005, 7:23 AM
*/
/**
*
* @author gat
*/
import java.awt.*;
import java.awt.event.*;
public class WhatsInAChoiceBox extends java.awt.Frame {
/** Creates new form WhatsInAChoiceBox */
java.awt.event.MouseAdapter mouseClickListener =
new java.awt.event.MouseAdapter() {
public void mouseClicked(MouseEvent evt) {
cbClicked(evt);
}
};
public WhatsInAChoiceBox() {
initComponents();
setupCBarray();
int i ;
for ( i = 0; i < cb.length; i++ )
cb[i].addMouseListener( mouseClickListener );
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
private void initComponents() {//GEN-BEGIN:initComponents
panel1 = new java.awt.Panel();
checkbox1 = new java.awt.Checkbox();
checkbox2 = new java.awt.Checkbox();
checkbox3 = new java.awt.Checkbox();
checkbox4 = new java.awt.Checkbox();
checkbox5 = new java.awt.Checkbox();
checkbox6 = new java.awt.Checkbox();
checkbox7 = new java.awt.Checkbox();
checkbox8 = new java.awt.Checkbox();
checkbox9 = new java.awt.Checkbox();
checkbox10 = new java.awt.Checkbox();
checkbox11 = new java.awt.Checkbox();
checkbox12 = new java.awt.Checkbox();
checkbox13 = new java.awt.Checkbox();
checkbox14 = new java.awt.Checkbox();
checkbox15 = new java.awt.Checkbox();
checkbox16 = new java.awt.Checkbox();
setLayout(new java.awt.FlowLayout());
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(java.awt.event.WindowEvent evt) {
exitForm(evt);
}
});
panel1.setLayout(new java.awt.GridLayout(4, 4, 5, 5));
panel1.setBackground(new java.awt.Color(255, 255, 51));
panel1.setName("cbPanel");
checkbox1.setLabel("checkbox1");
panel1.add(checkbox1);
checkbox2.setLabel("checkbox2");
panel1.add(checkbox2);
checkbox3.setLabel("checkbox3");
panel1.add(checkbox3);
checkbox4.setLabel("checkbox4");
panel1.add(checkbox4);
checkbox5.setLabel("checkbox5");
panel1.add(checkbox5);
checkbox6.setLabel("checkbox6");
panel1.add(checkbox6);
checkbox7.setLabel("checkbox7");
panel1.add(checkbox7);
checkbox8.setLabel("checkbox8");
panel1.add(checkbox8);
checkbox9.setLabel("checkbox9");
panel1.add(checkbox9);
checkbox10.setLabel("checkbox10");
panel1.add(checkbox10);
checkbox11.setLabel("checkbox11");
panel1.add(checkbox11);
checkbox12.setLabel("checkbox12");
panel1.add(checkbox12);
checkbox13.setLabel("checkbox13");
panel1.add(checkbox13);
checkbox14.setLabel("checkbox14");
panel1.add(checkbox14);
checkbox15.setLabel("checkbox15");
panel1.add(checkbox15);
checkbox16.setLabel("checkbox16");
panel1.add(checkbox16);
add(panel1);
pack();
}//GEN-END:initComponents
/** Exit the Application */
private void exitForm(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_exitForm
System.exit(0);
}//GEN-LAST:event_exitForm
public void
cbClicked( MouseEvent evt ) {
Checkbox selected = (Checkbox) evt.getSource();
int i;
for ( i = 0; i < cb.length; i++ ) {
if ( cb[i] == selected )
break;
}
if ( i >= cb.length ) {
System.out.println( "Confused: checkbox does not belong to me!");
return;
}
for ( int k = 0; k < cb.length; k++)
cb[k].setState( false ); // everybody off
int start = (i/4) * 4;
for ( int k = start; k < start+4; k++ ) {
//if ( k != i)
{ // Race condition
System.out.println("Setting "+cb[k].getLabel() + " to true");
cb[k].setState( true );
}
}
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
new WhatsInAChoiceBox().show();
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private java.awt.Checkbox checkbox1;
private java.awt.Checkbox checkbox10;
private java.awt.Checkbox checkbox11;
private java.awt.Checkbox checkbox12;
private java.awt.Checkbox checkbox13;
private java.awt.Checkbox checkbox14;
private java.awt.Checkbox checkbox15;
private java.awt.Checkbox checkbox16;
private java.awt.Checkbox checkbox2;
private java.awt.Checkbox checkbox3;
private java.awt.Checkbox checkbox4;
private java.awt.Checkbox checkbox5;
private java.awt.Checkbox checkbox6;
private java.awt.Checkbox checkbox7;
private java.awt.Checkbox checkbox8;
private java.awt.Checkbox checkbox9;
private java.awt.Panel panel1;
// End of variables declaration//GEN-END:variables
Checkbox[] cb = {
checkbox1, checkbox2, checkbox3, checkbox4, checkbox5, checkbox6, checkbox7, checkbox8,
checkbox9, checkbox10, checkbox11, checkbox12, checkbox13, checkbox14, checkbox15, checkbox16
};
void setupCBarray() {
cb[ 0] = checkbox1; cb[ 1] = checkbox2; cb[ 2] = checkbox3; cb[ 3] = checkbox4;
cb[ 4] = checkbox5; cb[ 5] = checkbox6; cb[ 6] = checkbox7; cb[ 7] = checkbox8;
cb[ 8] = checkbox9; cb[ 9] = checkbox10; cb[10] = checkbox11; cb[11] = checkbox12;
cb[12] = checkbox13; cb[13] = checkbox14; cb[14] = checkbox15; cb[15] = checkbox16;
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
if you dont setState the box ( "//if ( k != i)" )that caused the checkbox event, on linux, then this appears to work most of the time.
On windows, this workaround does not work.
###@###.### 2005-07-21 06:32:48 GMT