提交 a96a36f3 编写于 作者: K kaxelson

HUDSON-3532: [FIXED HUDSON-3532]

Changed getAbsolutePath to getCanonicalPath so it would handle symlinks.  Also added necessary exception handling since getCanonicalPath throws IOException.

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@17384 71c3de6d-444a-0410-be80-ed276b4c234a
上级 a37cd7d5
......@@ -11,6 +11,9 @@
*/
package hudson.scm;
import org.tmatesoft.svn.core.SVNErrorCode;
import org.tmatesoft.svn.core.SVNErrorMessage;
import org.tmatesoft.svn.core.SVNException;
import org.tmatesoft.svn.core.internal.util.SVNPathUtil;
import org.tmatesoft.svn.core.internal.wc.SVNFileUtil;
import org.tmatesoft.svn.core.wc.SVNEvent;
......@@ -20,6 +23,7 @@ import org.tmatesoft.svn.core.wc.SVNStatusType;
import org.tmatesoft.svn.core.wc.ISVNEventHandler;
import java.io.File;
import java.io.IOException;
import java.io.PrintStream;
/**
......@@ -37,11 +41,15 @@ public class SubversionEventHandlerImpl extends SVNEventAdapter {
this.baseDir = baseDir;
}
public void handleEvent(SVNEvent event, double progress) {
public void handleEvent(SVNEvent event, double progress) throws SVNException {
File file = event.getFile();
String path = null;
if (file != null) {
path = getRelativePath(file);
try {
path = getRelativePath(file);
} catch (IOException e) {
throw new SVNException(SVNErrorMessage.create(SVNErrorCode.FS_GENERAL), e);
}
path = getLocalPath(path);
}
......@@ -157,9 +165,9 @@ public class SubversionEventHandlerImpl extends SVNEventAdapter {
+ path);
}
public String getRelativePath(File file) {
String inPath = file.getAbsolutePath().replace(File.separatorChar, '/');
String basePath = baseDir.getAbsolutePath().replace(File.separatorChar, '/');
public String getRelativePath(File file) throws IOException {
String inPath = file.getCanonicalPath().replace(File.separatorChar, '/');
String basePath = baseDir.getCanonicalPath().replace(File.separatorChar, '/');
String commonRoot = getCommonAncestor(inPath, basePath);
if (commonRoot != null) {
if (equals(inPath , commonRoot)) {
......
......@@ -25,6 +25,9 @@ package hudson.scm;
import hudson.remoting.Which;
import org.tmatesoft.svn.core.SVNCancelException;
import org.tmatesoft.svn.core.SVNErrorCode;
import org.tmatesoft.svn.core.SVNErrorMessage;
import org.tmatesoft.svn.core.SVNException;
import org.tmatesoft.svn.core.internal.wc.SVNExternal;
import org.tmatesoft.svn.core.wc.SVNEvent;
import org.tmatesoft.svn.core.wc.SVNEventAction;
......@@ -59,11 +62,15 @@ final class SubversionUpdateEventHandler extends SubversionEventHandlerImpl {
this.modulePath = modulePath;
}
public void handleEvent(SVNEvent event, double progress) {
public void handleEvent(SVNEvent event, double progress) throws SVNException {
File file = event.getFile();
String path = null;
if (file != null) {
path = getRelativePath(file);
try {
path = getRelativePath(file);
} catch (IOException e) {
throw new SVNException(SVNErrorMessage.create(SVNErrorCode.FS_GENERAL), e);
}
path = getLocalPath(path);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册