Skip to content

Commit

Permalink
Merge pull request #14 from jdvorak001/HEAD
Browse files Browse the repository at this point in the history
Use hostname in serialization
  • Loading branch information
jdvorak001 authored Dec 11, 2023
2 parents 8c32485 + a83f4ce commit da94878
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,6 @@ public void error( final SAXParseException exception ) throws SAXException {
fail( "While validating element " + elString + ": " + e );
}
}

}

/**
Expand All @@ -801,6 +800,7 @@ public FileLoggingConnectionStreamFactory( final String logDir ) {
@Override
public InputStream makeInputStream( final URLConnection conn ) throws IOException {
InputStream inputStream = conn.getInputStream();
String baseURLhostname = conn.getURL().getHost();
if ( logDir != null ) {
final Path logDirPath = Paths.get( logDir );
Files.createDirectories( logDirPath );
Expand All @@ -816,10 +816,9 @@ public InputStream makeInputStream( final URLConnection conn ) throws IOExceptio
sb.append( m2.group( 1 ) );
}
final DateTimeFormatter dtf = DateTimeFormatter.ofPattern( "yyyyMMdd'T'HHmmss.SSS" );
final String logFilename = "oai-pmh--" + dtf.format( LocalDateTime.now() ) + "--" + sb.toString() + ".xml";
final String logFilename = baseURLhostname + "_oai-pmh--" + dtf.format( LocalDateTime.now() ) + "--" + sb.toString() + ".xml";
inputStream = new FileSavingInputStream( inputStream, logDirPath.resolve( logFilename ) );
}
return inputStream;
}

}

0 comments on commit da94878

Please sign in to comment.