MacOS Cocoa error message
in
Integration and Hardware
•
3 years ago
I'm running a simple test app that is posting an error apparently from a windowing routine in MacOS's Cocoa system library.
Here's the error, followed by the application output:
2010-06-23 08:31:08.569 java[899:170f] *** Assertion failure in -[CocoaAppWindow _changeJustMain], /SourceCache/AppKit/AppKit-1038.32/AppKit.subproj/NSWindow.m:9470
2010-06-23 08:31:08.571 java[899:170f] *** CPerformer: ignoring exception 'Invalid parameter not satisfying: [self canBecomeMainWindow]' raised during perform of selector 'requestFocus:' on target 'FocusManager' with args '<AWTComponentSetFocusData: 0x1205040>'
area 1 = -6.0
area 2 = -4.0
The error doesn't seem to cause any problems, since it gets ignored. I've seen it before. Maybe there's no need to avoid it, if it's really innocuous, but I can't help but wonder why it occurs and if I can prevent it.
cheers,
--Paul
- import java.awt.*;
- int[] pts1 = { 0,0, 1,1, 2,1, 3,2, 3,1, 3,0, 2,0, 1,0, 0,0 };
- int[] pts2 = { 3,0, 3,1, 3,2, 3,3, 4,2, 4,1, 3,0 };
- Point[] arr1;
- Point[] arr2;
- void setup() {
- size(481, 481);
- background(255);
- arr1 = arrayAsPoints(pts1);
- arr2 = arrayAsPoints(pts2);
- noLoop();
- }
- void draw() {
- println("area 1 = " + area(arr1));
- println("area 2 = " + area(arr2));
- }
- /**
- * outputs 2 * area of polygon, negative if vertices are in CCW order.
- */
- float area(Point[] coords) {
- int len = coords.length;
- float result = coords[0].x * (coords[1].y - coords[len-2].y);
- for (int i = 1; i < len - 1; i++) {
- result += coords[i].x * (coords[(i+1) % len].y - coords[i-1].y);
- }
- return result;
- }
- Point[] arrayAsPoints( int[] arr ) {
- Point[] ptArray = new Point[arr.length/2];
- int index = 0;
- for ( int i = 0; i < arr.length; i += 2 ) {
- ptArray[index] = new Point( arr[i], arr[i+1] );
- index++;
- }
- return ptArray;
- }
Here's the error, followed by the application output:
2010-06-23 08:31:08.569 java[899:170f] *** Assertion failure in -[CocoaAppWindow _changeJustMain], /SourceCache/AppKit/AppKit-1038.32/AppKit.subproj/NSWindow.m:9470
2010-06-23 08:31:08.571 java[899:170f] *** CPerformer: ignoring exception 'Invalid parameter not satisfying: [self canBecomeMainWindow]' raised during perform of selector 'requestFocus:' on target 'FocusManager' with args '<AWTComponentSetFocusData: 0x1205040>'
area 1 = -6.0
area 2 = -4.0
The error doesn't seem to cause any problems, since it gets ignored. I've seen it before. Maybe there's no need to avoid it, if it's really innocuous, but I can't help but wonder why it occurs and if I can prevent it.
cheers,
--Paul