Skip to content

Commit

Permalink
Fix NPE
Browse files Browse the repository at this point in the history
  • Loading branch information
stuartwdouglas committed Jun 8, 2015
1 parent d40709c commit 9cf5182
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
Expand Up @@ -585,10 +585,13 @@ public DeploymentInfo setAsyncExecutor(final Executor asyncExecutor) {
} }


public File getTempDir() { public File getTempDir() {
if(tempDir == null) {
return null;
}
return tempDir.toFile(); return tempDir.toFile();
} }


public Path getTempDirPath() { public Path getTempPath() {
return tempDir; return tempDir;
} }


Expand Down
Expand Up @@ -89,14 +89,14 @@ public void setupMultipart(ServletContextImpl servletContext) {
} }
final Path tempDir; final Path tempDir;
if(config.getLocation() == null || config.getLocation().isEmpty()) { if(config.getLocation() == null || config.getLocation().isEmpty()) {
tempDir = servletContext.getDeployment().getDeploymentInfo().getTempDirPath(); tempDir = servletContext.getDeployment().getDeploymentInfo().getTempPath();
} else { } else {
String location = config.getLocation(); String location = config.getLocation();
Path locFile = Paths.get(location); Path locFile = Paths.get(location);
if(locFile.isAbsolute()) { if(locFile.isAbsolute()) {
tempDir = locFile; tempDir = locFile;
} else { } else {
tempDir = servletContext.getDeployment().getDeploymentInfo().getTempDirPath().resolve(location); tempDir = servletContext.getDeployment().getDeploymentInfo().getTempPath().resolve(location);
} }
} }


Expand Down
Expand Up @@ -98,7 +98,7 @@ public void write(final String fileName) throws IOException {
Path target = Paths.get(fileName); Path target = Paths.get(fileName);
if(!target.isAbsolute()) { if(!target.isAbsolute()) {
if(config.getLocation().isEmpty()) { if(config.getLocation().isEmpty()) {
target = servletContext.getDeployment().getDeploymentInfo().getTempDirPath().resolve(fileName); target = servletContext.getDeployment().getDeploymentInfo().getTempPath().resolve(fileName);
} else { } else {
target = Paths.get(config.getLocation(), fileName); target = Paths.get(config.getLocation(), fileName);
} }
Expand Down

0 comments on commit 9cf5182

Please sign in to comment.