bodewig 2004/02/06 01:10:45 Modified: . Tag: ANT_16_BRANCH WHATSNEW src/main/org/apache/tools/ant/taskdefs/optional/splash Tag: ANT_16_BRANCH SplashTask.java Log: merge with HEAD Revision Changes Path No revision No revision 1.503.2.38 +3 -0 ant/WHATSNEW Index: WHATSNEW =================================================================== RCS file: /home/cvs/ant/WHATSNEW,v retrieving revision 1.503.2.37 retrieving revision 1.503.2.38 diff -u -r1.503.2.37 -r1.503.2.38 --- WHATSNEW 6 Feb 2004 00:42:09 -0000 1.503.2.37 +++ WHATSNEW 6 Feb 2004 09:10:44 -0000 1.503.2.38 @@ -32,6 +32,9 @@ * junitreport was failing for long string litterals Bugzilla Report 19301. +* <splash> used to break the build on non-GUI environments. Bugzilla + report 11482. + Other changes: -------------- No revision No revision 1.9.2.4 +29 -13 ant/src/main/org/apache/tools/ant/taskdefs/optional/splash/SplashTask.java Index: SplashTask.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/splash/SplashTask.java,v retrieving revision 1.9.2.3 retrieving revision 1.9.2.4 diff -u -r1.9.2.3 -r1.9.2.4 --- SplashTask.java 4 Feb 2004 21:59:06 -0000 1.9.2.3 +++ SplashTask.java 6 Feb 2004 09:10:44 -0000 1.9.2.4 @@ -1,5 +1,5 @@ /* - * Copyright 2003-2004 Apache Software Foundation + * Copyright 2002-2004 Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -89,7 +89,7 @@ /** * Proxy password; required if <tt>user</tt> is set. */ - public void setPassword(String password) { + public void setPassword(String password) { this.password = password; } @@ -170,9 +170,9 @@ } } + boolean success = false; if (in != null) { DataInputStream din = new DataInputStream(in); - boolean success = false; try { ByteArrayOutputStream bout = new ByteArrayOutputStream(); int data; @@ -181,10 +181,14 @@ } log("Got ByteArray, creating splash", Project.MSG_DEBUG); - ImageIcon img = new ImageIcon(bout.toByteArray()); - splash = new SplashScreen(img); - success = true; + try { + ImageIcon img = new ImageIcon(bout.toByteArray()); + splash = new SplashScreen(img); + success = true; + } catch (Throwable e) { + logHeadless(e); + } } catch (Exception e) { throw new BuildException(e); } finally { @@ -199,16 +203,28 @@ } } } else { - splash = new SplashScreen("Image Unavailable."); + try { + splash = new SplashScreen("Image Unavailable."); + success = true; + } catch (Throwable e) { + logHeadless(e); + } } - splash.setVisible(true); - splash.toFront(); - getProject().addBuildListener(splash); - try { - Thread.sleep(showDuration); - } catch (InterruptedException e) { + if (success) { + splash.setVisible(true); + splash.toFront(); + getProject().addBuildListener(splash); + try { + Thread.sleep(showDuration); + } catch (InterruptedException e) { + } } + } + private void logHeadless(Throwable e) { + log("failed to display SplashScreen, caught " + + e.getClass().getName() + " with message: " + e.getMessage(), + Project.MSG_WARN); } }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]