Skip to content

Commit

Permalink
Clean up the close and safeclose methods in the printers.
Browse files Browse the repository at this point in the history
Keeps FileNames public.
  • Loading branch information
Max Sumrall committed Jun 2, 2016
1 parent 585308a commit 26f9f6d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 16 deletions.
Expand Up @@ -137,7 +137,7 @@ public PrintStream getFor( String file ) throws FileNotFoundException
File dir = absoluteFile.isDirectory() ? absoluteFile : absoluteFile.getParentFile();
if ( !dir.equals( directory ) )
{
safeClose();
close();
File dumpFile = new File( dir, "dump-logical-log.txt" );
System.out.println( "Redirecting the output to " + dumpFile.getPath() );
out = new PrintStream( dumpFile );
Expand All @@ -146,18 +146,13 @@ public PrintStream getFor( String file ) throws FileNotFoundException
return out;
}

private void safeClose()
@Override
public void close()
{
if ( out != null )
{
out.close();
}
}

@Override
public void close()
{
safeClose();
}
}
}
11 changes: 3 additions & 8 deletions tools/src/main/java/org/neo4j/tools/dump/DumpLogicalLog.java
Expand Up @@ -212,7 +212,7 @@ public PrintStream getFor( String file ) throws FileNotFoundException
File dir = absoluteFile.isDirectory() ? absoluteFile : absoluteFile.getParentFile();
if ( !dir.equals( directory ) )
{
safeClose();
close();
File dumpFile = new File( dir, "dump-logical-log.txt" );
System.out.println( "Redirecting the output to " + dumpFile.getPath() );
out = new PrintStream( dumpFile );
Expand All @@ -221,19 +221,14 @@ public PrintStream getFor( String file ) throws FileNotFoundException
return out;
}

private void safeClose()
@Override
public void close()
{
if ( out != null )
{
out.close();
}
}

@Override
public void close()
{
safeClose();
}
}

public static TimeZone parseTimeZoneConfig( Args arguments )
Expand Down

0 comments on commit 26f9f6d

Please sign in to comment.