Return-Path: Delivered-To: apmail-incubator-sling-commits-archive@minotaur.apache.org Received: (qmail 38448 invoked from network); 30 Apr 2009 13:51:37 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 30 Apr 2009 13:51:37 -0000 Received: (qmail 94061 invoked by uid 500); 30 Apr 2009 13:51:37 -0000 Delivered-To: apmail-incubator-sling-commits-archive@incubator.apache.org Received: (qmail 94007 invoked by uid 500); 30 Apr 2009 13:51:36 -0000 Mailing-List: contact sling-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: sling-dev@incubator.apache.org Delivered-To: mailing list sling-commits@incubator.apache.org Received: (qmail 93998 invoked by uid 99); 30 Apr 2009 13:51:36 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 30 Apr 2009 13:51:36 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 30 Apr 2009 13:51:35 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id C1883238896D; Thu, 30 Apr 2009 13:51:15 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r770225 - /incubator/sling/trunk/contrib/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/jcrinstall/util/BundleCloner.java Date: Thu, 30 Apr 2009 13:51:15 -0000 To: sling-commits@incubator.apache.org From: bdelacretaz@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090430135115.C1883238896D@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: bdelacretaz Date: Thu Apr 30 13:51:15 2009 New Revision: 770225 URL: http://svn.apache.org/viewvc?rev=770225&view=rev Log: SLING-946 - more defensive BundleCloner to try and isolate the problem Modified: incubator/sling/trunk/contrib/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/jcrinstall/util/BundleCloner.java Modified: incubator/sling/trunk/contrib/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/jcrinstall/util/BundleCloner.java URL: http://svn.apache.org/viewvc/incubator/sling/trunk/contrib/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/jcrinstall/util/BundleCloner.java?rev=770225&r1=770224&r2=770225&view=diff ============================================================================== --- incubator/sling/trunk/contrib/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/jcrinstall/util/BundleCloner.java (original) +++ incubator/sling/trunk/contrib/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/jcrinstall/util/BundleCloner.java Thu Apr 30 13:51:15 2009 @@ -18,6 +18,7 @@ import java.io.File; import java.io.FileOutputStream; +import java.io.IOException; import java.io.OutputStream; import java.util.Properties; @@ -33,16 +34,33 @@ public void cloneBundle(File bundle, File output, String name, String symbolicName) throws Exception { int options = 0; + if(!bundle.exists()) { + throw new IOException("Bundle to clone not found: " + bundle.getAbsolutePath()); + } + + final File parent = output.getParentFile(); + parent.mkdirs(); + if(!parent.isDirectory()) { + throw new IOException("Unable to create output directory " + parent.getAbsolutePath()); + } + Properties props = new Properties(); props.put("Bundle-Name", name); props.put("Bundle-SymbolicName", symbolicName); File properties = File.createTempFile(getClass().getSimpleName(), "properties"); - final OutputStream out = new FileOutputStream(properties); + OutputStream out = new FileOutputStream(properties); File classpath[] = null; try { props.store(out, getClass().getSimpleName()); + out.close(); + out = null; bnd.doWrap(properties, bundle, output, classpath, options, null); + if(!output.exists()) { + throw new IOException( + "Output file not found after calling bnd.doWrap (" + + output.getAbsolutePath() + ")"); + } } finally { if(out != null) { out.close();