in teamcity-symbol-agent/src/main/java/jetbrains/buildServer/symbols/SourceLinkStreamBuilder.java [26:52]
public int dumpStreamToFile(File targetFile, Collection<File> sourceFiles) throws IOException {
int processedFilesCount = 0;
final FileWriter fileWriter = new FileWriter(targetFile.getPath(), true);
final String baseUrl = myUrlProvider.getBasePath() + "/" + myUrlProvider.getBuildPath() + "/";
try {
final Map<String, String> sourceMap = new HashMap<String, String>();
for(File sourceFile : sourceFiles){
String url = null;
try{
url = baseUrl + myUrlProvider.getFileUrl(sourceFile);
} catch (Exception ex){
myProgressLogger.warning("Failed to calculate url for source file " + sourceFile);
myProgressLogger.exception(ex);
}
if(url == null) continue;
processedFilesCount++;
sourceMap.put(sourceFile.getPath(), url);
}
fileWriter.write(gson.toJson(new SourcesDescriptor(sourceMap)));
}
finally {
fileWriter.close();
}
return processedFilesCount;
}