Skip to content

Commit

Permalink
fix writing for google cloud
Browse files Browse the repository at this point in the history
  • Loading branch information
StephanPreibisch committed Oct 24, 2024
1 parent 87069c1 commit c85a53f
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/main/java/util/URITools.java
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,13 @@ else if ( URITools.isS3( xmlURI ) || URITools.isGC( xmlURI ) )
// fist make a copy of the XML and save it to not loose it
try
{
final String xmlFile = pb.protocol + pb.bucket + "/" + pb.rootDir + "/" + pb.file;
final String xmlFile;

if ( URITools.isS3( xmlURI ) )
xmlFile = pb.protocol + pb.bucket + "/" + pb.rootDir + "/" + pb.file;
else
xmlFile = pb.rootDir + "/" + pb.file;

if ( kva.exists( xmlFile ) )
{
int maxExistingBackup = 0;
Expand Down Expand Up @@ -169,7 +175,13 @@ else if ( URITools.isS3( xmlURI ) || URITools.isGC( xmlURI ) )
final XMLOutputter xout = new XMLOutputter( Format.getPrettyFormat() );
final String xmlString = xout.outputString( doc );

final PrintWriter pw = openFileWriteCloud( kva, pb.protocol + pb.bucket + "/" + pb.rootDir + "/" + pb.file );
String xmlPath;
if ( URITools.isS3( xmlURI ) )
xmlPath = pb.protocol + pb.bucket + "/" + pb.rootDir + "/" + pb.file;
else
xmlPath = pb.rootDir + "/" + pb.file;

final PrintWriter pw = openFileWriteCloud( kva, xmlPath );
pw.println( xmlString );
pw.close();
}
Expand Down

0 comments on commit c85a53f

Please sign in to comment.