Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ public class Constants {
public static final String MHT_FILE_EXTENSION = ".mht";
public static final String ERROR_FILE_EXTENSION = ".txt";
public static final String ANY_CONSTANT = "any";
public static final String LEGACY_IDS_FILE_NAME = "legacyIds";

public static final String SERVICE_ARG = "//LogonAndExecute";
public static final String SERVICE_ARG_DOMAIN = "//lDomain:";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;

import static com.smartbear.jenkins.plugins.testcomplete.Constants.LEGACY_IDS_FILE_NAME;
import static com.smartbear.jenkins.plugins.testcomplete.Constants.REPORTS_DIRECTORY_NAME;

/**
* @author Igor Filin
*/
Expand Down Expand Up @@ -99,7 +96,7 @@ public void doDynamic(StaplerRequest req, StaplerResponse rsp) throws IOExceptio
if (basePathCache != null) {
basePath = basePathCache;
} else {
basePath = recalculateBasePath(baseReportsPath);
basePath = baseReportsPath;
basePathCache = basePath;
}

Expand Down Expand Up @@ -171,43 +168,4 @@ private ZipEntry searchEntry(ZipFile archive, String entryName) {
}
return targetEntry;
}

// https://wiki.jenkins.io/display/JENKINS/JENKINS-24380+Migration
private String recalculateBasePath(String basePath) {
File path = new File(basePath);

if (!path.exists()) {
path = path.getParentFile();

String oldDirectoryName = path.getName();

try {
try (BufferedReader br = new BufferedReader(
new InputStreamReader(
new FileInputStream(
new File(path.getParentFile(), LEGACY_IDS_FILE_NAME)
), "UTF-8"
)
)
) {
String line;
while ((line = br.readLine()) != null) {
String parts[] = line.split("( )");
if ((parts.length == 2) && (parts[0].equals(oldDirectoryName))) {
File newPath = new File(path.getParentFile(), parts[1] + File.separatorChar + REPORTS_DIRECTORY_NAME);
if (newPath.exists()) {
return newPath.getAbsolutePath();
}
break;
}
}
}
} catch (IOException e) {
// Do nothing
}
}

return basePath;
}

}