Skip to content

Commit

Permalink
PAYARA-455 fileinstall does not create directory until needed
Browse files Browse the repository at this point in the history
  • Loading branch information
Cousjava committed Nov 13, 2018
1 parent f414ec9 commit 1ff1d87
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 3 additions & 2 deletions fileinstall/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
specific language governing permissions and limitations
under the License.
-->
<!-- Portions Copyright [2018] Payara Foundation and/or affiliates -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<groupId>org.apache.felix</groupId>
Expand All @@ -29,7 +30,7 @@
<name>Apache Felix File Install</name>
<description>A utility to automatically install bundles from a directory.</description>
<url>http://felix.apache.org/site/apache-felix-file-install.html</url>
<version>3.6.5-SNAPSHOT</version>
<version>3.6.4.payara-p1</version>
<artifactId>org.apache.felix.fileinstall</artifactId>
<scm>
<connection>scm:svn:http://svn.apache.org/repos/asf/felix/trunk/fileinstall</connection>
Expand Down Expand Up @@ -60,7 +61,7 @@
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.utils</artifactId>
<version>1.10.5-SNAPSHOT</version>
<version>1.11.0</version>
</dependency>
</dependencies>
<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
* specific language governing permissions and limitations
* under the License.
*/
// Portions Copyright [2018] Payara Foundation and/or affiliates

package org.apache.felix.fileinstall.internal;

import java.io.BufferedInputStream;
Expand Down Expand Up @@ -608,14 +610,14 @@ private void prepareTempDir()
if (tmpDir == null)
{
File javaIoTmpdir = new File(System.getProperty("java.io.tmpdir"));
if (!javaIoTmpdir.exists() && !javaIoTmpdir.mkdirs()) {
if (!javaIoTmpdir.exists() && !javaIoTmpdir.mkdirs() && !javaIoTmpdir.canWrite()) {
throw new IllegalStateException("Unable to create temporary directory " + javaIoTmpdir);
}
Random random = new Random();
while (tmpDir == null)
{
File f = new File(javaIoTmpdir, "fileinstall-" + Long.toString(random.nextLong()));
if (!f.exists() && f.mkdirs())
if (!f.exists())
{
tmpDir = f;
tmpDir.deleteOnExit();
Expand Down

0 comments on commit 1ff1d87

Please sign in to comment.