Afternoon,

I've been having a problem with beta 23 of the plugin and the GWT
tests on the Mac (Leopard). The Mac VM will log a couple of lines to
stderr when hosted mode is invoked, and these unfortunately trigger a
failure in the test ScriptUtil (where non-null err throws an
exception).

As such, I've knocked up a local version with a workaround, which
checks to see if the stderr matches the offending messages and doesn't
throw the exception, in the hope it may be of use to others.

If anyone knows of a cleaner solution however I'd be very grateful to
learn of it!

Also, many thanks for all your hard work on this plug-in - it is
greatly appreciated.

Cheers,
James


Index: src/main/java/com/totsp/mavenplugin/gwt/scripting/
ScriptUtil.java
===================================================================
--- src/main/java/com/totsp/mavenplugin/gwt/scripting/ScriptUtil.java
(revision 848)
+++ src/main/java/com/totsp/mavenplugin/gwt/scripting/ScriptUtil.java
(working copy)
@@ -50,8 +50,29 @@
          pw.waitFor();

          // if err has anything it's an exception
-         if (err.length() > 0) {
-            throw new MojoExecutionException("error attempting to run
test - " + exec.getName() + " - " + err.toString());
+         if (err.length() > 0) {
+               boolean validError = true;
+
+               // the Mac VM will log CocoaComponent messages to stderr,
falsely triggering the exception
+               if (AbstractGWTMojo.OS_NAME.startsWith(AbstractGWTMojo.MAC))
{
+                        validError = false;
+
+                         final String[] errLines =
err.toString().split("\n");
+                         for (int i = 0; i < errLines.length; ++i) {
+                               final String currentErrLine = 
errLines[i].trim();
+
+                               if (!currentErrLine.endsWith("[Java
CocoaComponent compatibility mode]: Enabled")
+                                      && !currentErrLine.endsWith("[Java
CocoaComponent compatibility mode]: Setting timeout for SWT to
0.100000")
+                                      && currentErrLine.length() != 0) {
+                                  validError = true;
+                                  break;
+                               }
+                       }
+               }
+
+               if (validError) {
+                  throw new MojoExecutionException("error attempting
to run test - " + exec.getName() + " - " + err.toString());
+              }
          }

          // otherwise populate and return the TestResult


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"gwt-maven" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/gwt-maven?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to