Browse Source

getParentFile may return null.

Reported by: Bayyapu, Pavan <pavan.bayyapu@sap.com>


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@273286 13f79535-47bb-0310-9956-ffa450edef68
master
Magesh Umasankar 23 years ago
parent
commit
80377e9c76
1 changed files with 6 additions and 4 deletions
  1. +6
    -4
      src/main/org/apache/tools/ant/taskdefs/Expand.java

+ 6
- 4
src/main/org/apache/tools/ant/taskdefs/Expand.java View File

@@ -146,7 +146,7 @@ public class Expand extends Task {
* This method is to be overridden by extending unarchival tasks. * This method is to be overridden by extending unarchival tasks.
*/ */
protected void expandFile(FileUtils fileUtils, File srcF, File dir) { protected void expandFile(FileUtils fileUtils, File srcF, File dir) {
log("Expanding: " + srcF + " into " + dir, Project.MSG_INFO);
log("Expanding: " + srcF + " into " + dir, Project.MSG_INFO);
ZipInputStream zis = null; ZipInputStream zis = null;
try { try {
// code from WarExpand // code from WarExpand
@@ -186,7 +186,7 @@ public class Expand extends Task {
String[] incls = p.getIncludePatterns(getProject()); String[] incls = p.getIncludePatterns(getProject());
if (incls != null) { if (incls != null) {
for (int w = 0; w < incls.length; w++) { for (int w = 0; w < incls.length; w++) {
boolean isIncl =
boolean isIncl =
DirectoryScanner.match(incls[w], name); DirectoryScanner.match(incls[w], name);
if (isIncl) { if (isIncl) {
included = true; included = true;
@@ -197,7 +197,7 @@ public class Expand extends Task {
String[] excls = p.getExcludePatterns(getProject()); String[] excls = p.getExcludePatterns(getProject());
if (excls != null) { if (excls != null) {
for (int w = 0; w < excls.length; w++) { for (int w = 0; w < excls.length; w++) {
boolean isExcl =
boolean isExcl =
DirectoryScanner.match(excls[w], name); DirectoryScanner.match(excls[w], name);
if (isExcl) { if (isExcl) {
included = false; included = false;
@@ -225,7 +225,9 @@ public class Expand extends Task {
Project.MSG_VERBOSE); Project.MSG_VERBOSE);
// create intermediary directories - sometimes zip don't add them // create intermediary directories - sometimes zip don't add them
File dirF = fileUtils.getParentFile(f); File dirF = fileUtils.getParentFile(f);
dirF.mkdirs();
if ( dirF != null ) {
dirF.mkdirs();
}


if (isDirectory) { if (isDirectory) {
f.mkdirs(); f.mkdirs();


Loading…
Cancel
Save