Skip to content

Commit

Permalink
JBDS-3929 apply the same artifacts.xml transformations in artifacts.j…
Browse files Browse the repository at this point in the history
…ar as in artifacts.xml.xz
  • Loading branch information
nickboldt committed Jun 7, 2016
1 parent 5d98d44 commit e4635a6
Showing 1 changed file with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,30 @@ private void addP2Stats(File p2repository) throws FileNotFoundException, IOExcep
contentStream.close();
outContentStream.closeEntry();
outContentStream.close();

// JBDS-3929 overwrite the artifacts.xml.xz file too
// see also https://bugs.eclipse.org/bugs/show_bug.cgi?id=464614
//getLog().debug("delete old artifacts.xml.xz");
FileUtils.forceDelete(new File(p2repository,"artifacts.xml.xz"));
//getLog().debug("create artifacts.xml from transformed XML");
File artifactsXML = new File(p2repository, "artifacts.xml");
FileOutputStream outartifactsStreamXML = new FileOutputStream(artifactsXML);
StreamResult resultXML = new StreamResult(outartifactsStreamXML);
transformer.transform(source, resultXML);
outartifactsStreamXML.close();
//getLog().debug("stream artifacts.xml to artifacts.xml.xz");
BufferedInputStream in = new BufferedInputStream(new FileInputStream(artifactsXML));
XZCompressorOutputStream out = new XZCompressorOutputStream(new FileOutputStream(new File(p2repository,"artifacts.xml.xz")));
final byte[] buffer = new byte[1024];
int n = 0;
while (-1 != (n = in.read(buffer))) {
out.write(buffer, 0, n);
}
out.close();
in.close();
//getLog().debug("new artifacts.xml.xz written; remove artifacts.xml");
FileUtils.forceDelete(new File(p2repository,"artifacts.xml"));

}

private void alterIndexFile(File outputSite) throws FileNotFoundException, IOException {
Expand Down

0 comments on commit e4635a6

Please sign in to comment.