mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-17 14:02:22 +00:00
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
This commit is contained in:
1 parent
a37cd7d502
commit
a96a36f3c0
2 files changed
+22
-7
No files matched your search
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user