Program: 46120
Project: 46120
Buggy source:
@Override public void commitEvent(Event event){
  MouseEvent3D mouseEvent=(MouseEvent3D)event;
  MouseEvent awtMouseEvent=(MouseEvent)mouseEvent.getAwtEvent();
  if (event instanceof MouseButtonEvent3D) {
    MouseButtonEvent3D buttonEvent=(MouseButtonEvent3D)event;
    if (buttonEvent.isPressed() && buttonEvent.getButton() == MouseButtonEvent3D.ButtonId.BUTTON1) {
      MouseEvent awtButtonEvent=(MouseEvent)buttonEvent.getAwtEvent();
      dragStartScreen=new Point(awtButtonEvent.getX(),awtButtonEvent.getY());
      dragStartWorld=buttonEvent.getIntersectionPointWorld();
      Entity entity=event.getEntity();
      RenderComponent rc=(RenderComponent)entity.getComponent(RenderComponent.class);
      centerWorld=rc.getSceneRoot().getWorldTranslation();
      dragStartVectorWorld=dragStartWorld.subtract(centerWorld);
      setLabelPosition(awtMouseEvent);
      labelFrame.toFront();
      labelFrame.setVisible(true);
      labelFrame.repaint();
      fireRotationStarted();
    }
 else     if (buttonEvent.isReleased() == true) {
      labelFrame.setVisible(false);
    }
    return;
  }
  if (!(event instanceof MouseDraggedEvent3D)) {
    return;
  }
  MouseDraggedEvent3D dragEvent=(MouseDraggedEvent3D)event;
  Vector3f dragWorld=dragEvent.getDragVectorWorld(dragStartWorld,dragStartScreen,new Vector3f());
  Vector3f dragEndVectorWorld=dragStartVectorWorld.add(dragWorld);
  Vector3f v1=dragStartVectorWorld.normalize();
  Vector3f v2=dragEndVectorWorld.normalize();
  Vector3f normal=null, axis=null;
switch (direction) {
case X_AXIS:
    normal=new Vector3f(1,0,0);
  axis=new Vector3f(1,0,0);
break;
case Y_AXIS:
normal=new Vector3f(0,1,0);
axis=new Vector3f(0,1,0);
break;
case Z_AXIS:
normal=new Vector3f(0,0,1);
axis=new Vector3f(0,0,1);
break;
default :
return;
}
Quaternion rotation=rootNode.getLocalRotation();
float angles[]=new float[3];
rotation.toAngles(angles);
normal=rotation.mult(normal);
float dotProduct=v1.dot(v2);
Vector3f crossProduct=v1.cross(v2);
double angle=Math.atan2(normal.dot(crossProduct),dotProduct);
StringBuilder rotateString=new StringBuilder();
Formatter formatter=new Formatter(rotateString);
formatter.format("String_Node_Str",Math.toDegrees(angle));
rotationLabel.setText(rotateString.toString());
labelFrame.pack();
setLabelPosition(awtMouseEvent);
Quaternion q=new Quaternion().fromAngleAxis((float)angle,axis);
fireRotationChanged(q);
}

Fixed version (ground truth):
@Override public void commitEvent(Event event){
  MouseEvent3D mouseEvent=(MouseEvent3D)event;
  MouseEvent awtMouseEvent=(MouseEvent)mouseEvent.getAwtEvent();
  if (event instanceof MouseButtonEvent3D) {
    MouseButtonEvent3D buttonEvent=(MouseButtonEvent3D)event;
    if (buttonEvent.isPressed() && buttonEvent.getButton() == ButtonId.BUTTON1) {
      MouseEvent awtButtonEvent=(MouseEvent)buttonEvent.getAwtEvent();
      dragStartScreen=new Point(awtButtonEvent.getX(),awtButtonEvent.getY());
      dragStartWorld=buttonEvent.getIntersectionPointWorld();
      Entity entity=event.getEntity();
      RenderComponent rc=(RenderComponent)entity.getComponent(RenderComponent.class);
      centerWorld=rc.getSceneRoot().getWorldTranslation();
      dragStartVectorWorld=dragStartWorld.subtract(centerWorld);
      showRotationLabel(awtMouseEvent);
      fireRotationStarted();
    }
 else     if (buttonEvent.isReleased() == true) {
      hideRotationLabel();
    }
    return;
  }
  if (!(event instanceof MouseDraggedEvent3D)) {
    return;
  }
  MouseDraggedEvent3D dragEvent=(MouseDraggedEvent3D)event;
  Vector3f dragWorld=dragEvent.getDragVectorWorld(dragStartWorld,dragStartScreen,new Vector3f());
  Vector3f dragEndVectorWorld=dragStartVectorWorld.add(dragWorld);
  Vector3f v1=dragStartVectorWorld.normalize();
  Vector3f v2=dragEndVectorWorld.normalize();
  Vector3f normal=null, axis=null;
switch (direction) {
case X_AXIS:
    normal=new Vector3f(1,0,0);
  axis=new Vector3f(1,0,0);
break;
case Y_AXIS:
normal=new Vector3f(0,1,0);
axis=new Vector3f(0,1,0);
break;
case Z_AXIS:
normal=new Vector3f(0,0,1);
axis=new Vector3f(0,0,1);
break;
default :
return;
}
Quaternion rotation=rootNode.getLocalRotation();
float angles[]=new float[3];
rotation.toAngles(angles);
normal=rotation.mult(normal);
float dotProduct=v1.dot(v2);
Vector3f crossProduct=v1.cross(v2);
double angle=Math.atan2(normal.dot(crossProduct),dotProduct);
updateRotationLabel(angle,awtMouseEvent);
Quaternion q=new Quaternion().fromAngleAxis((float)angle,axis);
fireRotationChanged(q);
}