--- old/src/macosx/native/sun/osxapp/NSApplicationAWT.m 2012-05-23 17:07:47.000000000 +0400 +++ new/src/macosx/native/sun/osxapp/NSApplicationAWT.m 2012-05-23 17:07:47.000000000 +0400 @@ -31,6 +31,7 @@ #import "PropertiesUtilities.h" #import "ThreadUtilities.h" #import "QueuingApplicationDelegate.h" +#import "AWTIconData.h" static BOOL sUsingDefaultNIB = YES; @@ -263,25 +264,25 @@ theIconPath = [PropertiesUtilities javaSystemPropertyForKey:@"apple.awt.application.icon" withEnv:env]; } - // If the icon file wasn't specified as an argument and we need to get an icon - // we'll use the generic java app icon. - NSString *defaultIconPath = [NSString stringWithFormat:@"%@%@", SHARED_FRAMEWORK_BUNDLE, @"/Resources/GenericApp.icns"]; - if (fUseDefaultIcon && (theIconPath == nil)) { - theIconPath = defaultIconPath; - } + NSImage *iconImage = nil; - // Set up the dock icon if we have an icon name. + // Got the icon path, try to get the icon image from it if (theIconPath != nil) { - NSImage *iconImage = [[NSImage alloc] initWithContentsOfFile:theIconPath]; + iconImage = [[NSImage alloc] initWithContentsOfFile:theIconPath]; + } - // If we failed for some reason fall back to the default icon. - if (iconImage == nil) { - iconImage = [[NSImage alloc] initWithContentsOfFile:defaultIconPath]; - } + // No icon path was specified or we failed to get the icon image on previous step, + // in either case, use the default Java icon + if (iconImage == nil) { + NSData* iconData; - [NSApp setApplicationIconImage:iconImage]; - [iconImage release]; + iconData = [[NSData alloc] initWithBytesNoCopy: sAWTIconData length: sizeof(sAWTIconData) freeWhenDone: NO]; + iconImage = [[NSImage alloc] initWithData: iconData]; + [iconData release]; } + + [NSApp setApplicationIconImage:iconImage]; + [iconImage release]; } + (void) runAWTLoopWithApp:(NSApplication*)app {