Skip to content

Commit

Permalink
Merge pull request #94 from TAMULib/2.x-jar-safe-wro
Browse files Browse the repository at this point in the history
2.x jar safe wro
  • Loading branch information
wwelling committed Sep 4, 2018
2 parents e31db18 + fb3dccc commit 3d16823
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 29 deletions.
22 changes: 0 additions & 22 deletions cli/pom.xml

This file was deleted.

1 change: 0 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

<module>email</module>
<module>reporting</module>
<module>cli</module>
<module>wro</module>

</modules>
Expand Down
19 changes: 18 additions & 1 deletion wro/pom.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<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">

<modelVersion>4.0.0</modelVersion>
Expand Down Expand Up @@ -34,6 +35,22 @@
<groupId>ro.isdc.wro4j</groupId>
<artifactId>wro4j-extensions</artifactId>
<version>1.8.0</version>
<exclusions>
<exclusion>
<groupId>org.codehaus.gmaven.runtime</groupId>
<artifactId>gmaven-runtime-1.7</artifactId>
</exclusion>
<exclusion>
<groupId>org.webjars</groupId>
<artifactId>webjars-locator-core</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.webjars</groupId>
<artifactId>webjars-locator-core</artifactId>
<version>0.35</version>
</dependency>

</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ public ThemeManager setThemeManagerServiceBean() {
e.printStackTrace();
logger.error("Could not create ThemeManagerService Bean with class: "+themeManagerServiceClassName, e);
}
} catch (ClassNotFoundException e1) {
logger.error("Could not find ThemeManagerService implementation class: "+themeManagerServiceClassName, e1);
}
} catch (ClassNotFoundException e) {
logger.warn("Could not find ThemeManagerService implementation class: " + themeManagerServiceClassName + "! Application must create theme manager bean!");
}
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Optional;

import org.apache.commons.io.FilenameUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.Validate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand All @@ -32,7 +34,7 @@ public class SassClassPathUriLocator implements UriLocator {
*/
public static final String ALIAS = "sassClassPathUri";

private ResourcePatternResolver resourcePatternResolver;
private ResourcePatternResolver resourcePatternResolver;

public SassClassPathUriLocator(ResourcePatternResolver resourcePatternResolver) {
this.resourcePatternResolver = resourcePatternResolver;
Expand Down Expand Up @@ -89,7 +91,14 @@ private Optional<File> getScssFile(String url) throws IOException {
}

if (resource.exists() && resource.isReadable()) {
file = Optional.of(resource.getFile());
if (resource.getURI().getScheme().equals("jar")) {
File tempFile = File.createTempFile("wro", ".tmp");
tempFile.deleteOnExit();
IOUtils.copy(resource.getInputStream(), new FileOutputStream(tempFile));
file = Optional.of(tempFile);
} else {
file = Optional.of(resource.getFile());
}
}

return file;
Expand Down

0 comments on commit 3d16823

Please sign in to comment.