You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by lu...@apache.org on 2010/05/05 17:35:52 UTC
svn commit: r941352 - in /struts/struts2/trunk/xwork-core: pom.xml
src/main/java/com/opensymphony/xwork2/util/FileManager.java
Author: lukaszlenart
Date: Wed May 5 15:35:52 2010
New Revision: 941352
URL: http://svn.apache.org/viewvc?rev=941352&view=rev
Log:
Solved WW-3309 - used FileUtils to decode URLs and XW-378 - upgraded OGNL to version 3.0
Modified:
struts/struts2/trunk/xwork-core/pom.xml
struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/util/FileManager.java
Modified: struts/struts2/trunk/xwork-core/pom.xml
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/xwork-core/pom.xml?rev=941352&r1=941351&r2=941352&view=diff
==============================================================================
--- struts/struts2/trunk/xwork-core/pom.xml (original)
+++ struts/struts2/trunk/xwork-core/pom.xml Wed May 5 15:35:52 2010
@@ -25,7 +25,7 @@
<currentVersion>${pom.version}</currentVersion>
<struts2.springPlatformVersion>2.5.6</struts2.springPlatformVersion>
<asm.version>3.1</asm.version>
- <ognl.version>2.7.3</ognl.version>
+ <ognl.version>3.0</ognl.version>
</properties>
<profiles>
@@ -199,6 +199,10 @@
<include>org/apache/commons/lang/UnhandledException.class</include>
<include>org/apache/commons/lang/IntHashMap*class</include>
</includes>
+ <artifact>commons-io:commons-io</artifact>
+ <includes>
+ <include>org/apache/commons/io/FileUtils.class</include>
+ </includes>
</filter>
</filters>
<relocations>
@@ -210,6 +214,10 @@
<pattern>org.apache.commons.lang</pattern>
<shadedPattern>org.apache.commons.lang.xwork</shadedPattern>
</relocation>
+ <relocation>
+ <pattern>org.apache.commons.lang</pattern>
+ <shadedPattern>org.apache.commons.io.xwork</shadedPattern>
+ </relocation>
</relocations>
<transformers>
<transformer
@@ -219,6 +227,7 @@
</execution>
</executions>
</plugin>
+
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
@@ -255,6 +264,12 @@
<optional>true</optional>
</dependency>
<dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>1.4</version>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
<groupId>ognl</groupId>
<artifactId>ognl</artifactId>
<version>${ognl.version}</version>
@@ -317,6 +332,7 @@
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${struts2.springPlatformVersion}</version>
+ <scope>test</scope>
</dependency>
<dependency>
@@ -352,6 +368,14 @@
<version>2.4</version>
<scope>test</scope>
</dependency>
+
+ <dependency>
+ <groupId>javassist</groupId>
+ <artifactId>javassist</artifactId>
+ <version>3.10.0.GA</version>
+ <scope>test</scope>
+ </dependency>
+
</dependencies>
</project>
Modified: struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/util/FileManager.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/util/FileManager.java?rev=941352&r1=941351&r2=941352&view=diff
==============================================================================
--- struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/util/FileManager.java (original)
+++ struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/util/FileManager.java Wed May 5 15:35:52 2010
@@ -17,6 +17,7 @@ package com.opensymphony.xwork2.util;
import com.opensymphony.xwork2.util.logging.Logger;
import com.opensymphony.xwork2.util.logging.LoggerFactory;
+import org.apache.commons.io.FileUtils;
import java.io.File;
import java.io.IOException;
@@ -279,16 +280,13 @@ public class FileManager {
entry = null;
}
- if (entry != null) {
- return (this.lastModified < entry.getTime());
- } else {
- return false;
- }
+ return entry != null && (lastModified < entry.getTime());
}
public static Revision build(URL fileUrl) {
// File within a Jar
// Find separator index of jar filename and filename within jar
+ String jarFileName = "";
try {
String fileName = fileUrl.toString();
int separatorIndex = fileName.indexOf(JAR_FILE_NAME_SEPARATOR);
@@ -300,19 +298,20 @@ public class FileManager {
return null;
}
// Split file name
- String jarFileName = fileName.substring(0, separatorIndex);
- String fileNameInJar = fileName.substring(separatorIndex + JAR_FILE_NAME_SEPARATOR.length()).replaceAll("%20", " ");
+ jarFileName = fileName.substring(0, separatorIndex);
+ int index = separatorIndex + JAR_FILE_NAME_SEPARATOR.length();
+ String fileNameInJar = fileName.substring(index).replaceAll("%20", " ");
URL url = URLUtil.normalizeToFileProtocol(fileUrl);
if (url != null) {
- JarFile jarFile = new JarFile(new File(url.getPath().replaceAll("%20", " ")));
+ JarFile jarFile = new JarFile(FileUtils.toFile(url));
ZipEntry entry = jarFile.getEntry(fileNameInJar);
return new JarEntryRevision(jarFileName.toString(), fileNameInJar, entry.getTime());
} else {
return null;
}
} catch (Throwable e) {
- LOG.warn("Could not create JarEntryRevision!", e);
+ LOG.warn("Could not create JarEntryRevision for [" + jarFileName + "]!", e);
return null;
}
}