Summary: | running tomcat tests cause terminal to repeatedly grab focus (on os x) | ||
---|---|---|---|
Product: | Tomcat 7 | Reporter: | Casey Lucas <clucas> |
Component: | Packaging | Assignee: | Tomcat Developers Mailing List <dev> |
Status: | RESOLVED FIXED | ||
Severity: | minor | ||
Priority: | P2 | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Hardware: | Macintosh | ||
OS: | Mac OS X 10.4 | ||
Attachments: |
patch to add java.awt.headless=true for junit tests
against head? set apple.awt.UIElement=true |
Try again with 7.0.x HEAD please Created attachment 30494 [details]
against head?
is this what you wanted? if not, please provide a tip or link.
No, that isn't what I meant. Please re-test with the latest source code for 7.0.x/trunk from subversion. I don;t see the described behaviour on OSX. This sounds like the AWT issue that has already been fixed in trunk. (change log entry: Update the JreMemoryLeakPreventionListener to take account of changes in the behaviour of java.beans.Introspector.flushCaches() and sun.awt.AppContext.getAppContext() in Java 7.) I ran the tests (again) after updating trunk. Same results (lots of window focus change). Are you trying the osx built-in Terminal app? Maybe that has something to do with it. I'm running tests under jdk6. I'll try some more variations. OK, I do see it with Java 6. It would have helped if you mentioned that in your original report. Sorry for not mentioning the jdk version originally. More digging revealed what I believe to be a better fix for the problem: https://developer.apple.com/library/mac/#documentation/Java/Reference/Java_PropertiesRef/Articles/JavaSystemProperties.html (See apple.awt.UIElement property.) Setting it to true allows awt calls but does not steal focus. I'll add a new patch. Created attachment 30497 [details]
set apple.awt.UIElement=true
I haven't dug into this far enough to idenitfy the trigger for this but it looks like whatever change triggered the probem in Java 7 has been back-ported to Java 6 but the change that allowed us to change the default for appContextProtection hasn't been back-ported. I can't tell if this is an Apple specific issue or one that will affect anyone using the Oracle (commerical) supported Java 6 binaries. An additional factor to take into consideration is the general reluctance of the Tomcat dev community to add work-arounds for bugs in third-party products (yes the JreMemoryLeakPreventionListener is a pretty big exception to that rule). Given that OSX seems to be a fairly popular platform amongst Java developers then I think your second patch is the way to go for now. If this emerges as a wider Java 6 issue we can look at using java.awt.headless=true instead. The patch has been applied to 7.0.x and will be included in 7.0.42 onwards. |
Created attachment 30493 [details] patch to add java.awt.headless=true for junit tests On osx, when running tomcat tests via "ant test", "ant test-nio" or similar, the terminal window running the tests grabs window focus each time a new jvm is launched for the junit tests. This makes it difficult/annoying to do other things in other windows while the tests are running. I am seeing the problem on a mac - it is likely not a problem on other platforms. Setting java.awt.headless=true fixes the issue. I can't think of any reason this shouldn't be set for tomcat tests - maybe there is a reason I don't know. Anyway, the attached patch adds the property (for junit tests).