@@ -220,7 +220,7 @@ Map<String, String> getConnectConfig()
220
220
private static int detectPort () throws IOException
221
221
{
222
222
try (ServerSocket socket = new ServerSocket (0 )) {
223
- while (!socket .isBound ()) {
223
+ while (!socket .isBound ()) {
224
224
Thread .sleep (50 );
225
225
}
226
226
return socket .getLocalPort ();
@@ -803,23 +803,19 @@ private static File prepareBinaries(PgBinaryResolver pgBinaryResolver, File over
803
803
mkdirs (pgDir );
804
804
workingDirectory .setWritable (true , false );
805
805
806
- final File unpackLockFile = new File (pgDir , LOCK_FILE_NAME );
807
806
final File pgDirExists = new File (pgDir , ".exists" );
808
807
809
808
if (!isPgBinReady (pgDirExists )) {
809
+ File unpackLockFile = new File (pgDir , LOCK_FILE_NAME );
810
810
try (FileOutputStream lockStream = new FileOutputStream (unpackLockFile );
811
811
FileLock unpackLock = lockStream .getChannel ().tryLock ()) {
812
812
if (unpackLock != null ) {
813
- try {
814
- LOG .info ("Extracting Postgres..." );
815
- try (ByteArrayInputStream bais = new ByteArrayInputStream (baos .toByteArray ())) {
816
- extractTxz (bais , pgDir );
817
- }
818
- if (!pgDirExists .createNewFile ()) {
819
- pgDirExists .setLastModified (System .currentTimeMillis ());
820
- }
821
- } catch (Exception e ) {
822
- LOG .error ("while unpacking Postgres" , e );
813
+ LOG .info ("Extracting Postgres..." );
814
+ try (ByteArrayInputStream bais = new ByteArrayInputStream (baos .toByteArray ())) {
815
+ extractTxz (bais , pgDir );
816
+ }
817
+ if (!pgDirExists .createNewFile ()) {
818
+ pgDirExists .setLastModified (System .currentTimeMillis ());
823
819
}
824
820
} else {
825
821
// the other guy is unpacking for us.
@@ -838,6 +834,7 @@ private static File prepareBinaries(PgBinaryResolver pgBinaryResolver, File over
838
834
}
839
835
}
840
836
} catch (final IOException | NoSuchAlgorithmException e ) {
837
+ LOG .error ("Got error while unpacking Postgres" , e );
841
838
throw new ExceptionInInitializerError (e );
842
839
} catch (final InterruptedException ie ) {
843
840
Thread .currentThread ().interrupt ();
0 commit comments