Skip to content

Commit

Permalink
Removed transient redundant throws
Browse files Browse the repository at this point in the history
  • Loading branch information
klaren committed Feb 9, 2018
1 parent 885e5a6 commit b4d1390
Show file tree
Hide file tree
Showing 308 changed files with 809 additions and 1,113 deletions.
Expand Up @@ -541,7 +541,7 @@ else if ( size == UNKNOWN_SIZE )
list.add( unpack() ); list.add( unpack() );
} }
} }
return VirtualValues.list( list.toArray( new AnyValue[list.size()] ) ); return VirtualValues.list( list.toArray( new AnyValue[0] ) );
} }
else else
{ {
Expand Down
Expand Up @@ -254,9 +254,7 @@ else if ( ROLLBACK.matcher( statement ).matches() )
* In AUTO_COMMIT we must make sure to fail, close and set the current * In AUTO_COMMIT we must make sure to fail, close and set the current
* transaction to null. * transaction to null.
*/ */
private BoltResultHandle execute( MutableTransactionState ctx, SPI spi, private BoltResultHandle execute( MutableTransactionState ctx, SPI spi, String statement, MapValue params )
String statement, MapValue params )
throws QueryExecutionKernelException
{ {
return executeQuery( ctx, spi, statement, params, () -> closeTransaction( ctx, false ) ); return executeQuery( ctx, spi, statement, params, () -> closeTransaction( ctx, false ) );
} }
Expand Down Expand Up @@ -322,9 +320,7 @@ else if ( ROLLBACK.matcher( statement ).matches() )
} }
} }


private BoltResultHandle execute( MutableTransactionState ctx, SPI spi, private BoltResultHandle execute( MutableTransactionState ctx, SPI spi, String statement, MapValue params )
String statement, MapValue params )
throws QueryExecutionKernelException
{ {
return executeQuery( ctx, spi, statement, params, return executeQuery( ctx, spi, statement, params,
() -> () ->
Expand Down Expand Up @@ -405,7 +401,6 @@ void closeTransaction( MutableTransactionState ctx, boolean success ) throws Tra


private static BoltResultHandle executeQuery( MutableTransactionState ctx, SPI spi, String statement, private static BoltResultHandle executeQuery( MutableTransactionState ctx, SPI spi, String statement,
MapValue params, ThrowingAction<KernelException> onFail ) MapValue params, ThrowingAction<KernelException> onFail )
throws QueryExecutionKernelException
{ {
return spi.executeQuery( ctx.querySource, ctx.loginContext, statement, params, onFail ); return spi.executeQuery( ctx.querySource, ctx.loginContext, statement, params, onFail );
} }
Expand Down
Expand Up @@ -30,7 +30,7 @@ public class RecordingByteChannelTest
{ {


@Test @Test
public void shouldBeAbleToWriteToThenReadFromChannel() throws Throwable public void shouldBeAbleToWriteToThenReadFromChannel()
{ {
// Given // Given
RecordingByteChannel channel = new RecordingByteChannel(); RecordingByteChannel channel = new RecordingByteChannel();
Expand Down
Expand Up @@ -64,7 +64,7 @@ public void newMachineThrowsWhenNotStarted()
} }


@Test @Test
public void newMachineThrowsWhenStopped() throws Throwable public void newMachineThrowsWhenStopped()
{ {
BoltFactoryImpl boltFactory = newBoltFactory(); BoltFactoryImpl boltFactory = newBoltFactory();


Expand All @@ -88,7 +88,7 @@ public void newMachineThrowsWhenStopped() throws Throwable
} }


@Test @Test
public void txIdStoreRefreshedAfterRestart() throws Throwable public void txIdStoreRefreshedAfterRestart()
{ {
GraphDatabaseAPI db = newDbMock(); GraphDatabaseAPI db = newDbMock();
DependencyResolver dependencyResolver = db.getDependencyResolver(); DependencyResolver dependencyResolver = db.getDependencyResolver();
Expand Down
Expand Up @@ -26,7 +26,6 @@
import org.junit.Test; import org.junit.Test;
import org.mockito.stubbing.Answer; import org.mockito.stubbing.Answer;


import java.io.IOException;
import java.util.Objects; import java.util.Objects;


import org.neo4j.bolt.BoltChannel; import org.neo4j.bolt.BoltChannel;
Expand Down Expand Up @@ -54,7 +53,7 @@
public class BoltMessagingProtocolV1HandlerTest public class BoltMessagingProtocolV1HandlerTest
{ {
@Test @Test
public void shouldNotTalkToChannelDirectlyOnFatalError() throws Throwable public void shouldNotTalkToChannelDirectlyOnFatalError()
{ {
// Given // Given
Channel outputChannel = newChannelMock(); Channel outputChannel = newChannelMock();
Expand Down Expand Up @@ -106,7 +105,7 @@ public void closesInputAndOutput()
} }


@Test @Test
public void messageProcessingErrorIsLogged() throws IOException public void messageProcessingErrorIsLogged()
{ {
RuntimeException error = new RuntimeException( "Unexpected error!" ); RuntimeException error = new RuntimeException( "Unexpected error!" );
ByteBuf data = newThrowingByteBuf( error ); ByteBuf data = newThrowingByteBuf( error );
Expand Down
Expand Up @@ -24,7 +24,6 @@
import org.junit.runners.model.Statement; import org.junit.runners.model.Statement;


import java.io.File; import java.io.File;
import java.io.IOException;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.function.Consumer; import java.util.function.Consumer;
Expand Down Expand Up @@ -147,7 +146,7 @@ public void shutdownDatabase()
} }
} }


public void ensureDatabase( Consumer<Map<String,String>> overrideSettingsFunction ) throws IOException public void ensureDatabase( Consumer<Map<String,String>> overrideSettingsFunction )
{ {
if ( gdb != null ) if ( gdb != null )
{ {
Expand Down
Expand Up @@ -74,7 +74,7 @@ public void shouldCloseProtocolOnChannelInactive() throws Throwable
} }


@Test @Test
public void shouldCloseContextWhenProtocolNotInitializedOnChannelInactive() throws Throwable public void shouldCloseContextWhenProtocolNotInitializedOnChannelInactive()
{ {
// Given // Given
ChannelHandlerContext context = mock( ChannelHandlerContext.class ); ChannelHandlerContext context = mock( ChannelHandlerContext.class );
Expand Down Expand Up @@ -107,7 +107,7 @@ public void shouldCloseProtocolOnHandlerRemoved() throws Throwable
} }


@Test @Test
public void shouldCloseContextWhenProtocolNotInitializedOnHandlerRemoved() throws Throwable public void shouldCloseContextWhenProtocolNotInitializedOnHandlerRemoved()
{ {
// Given // Given
ChannelHandlerContext context = mock( ChannelHandlerContext.class ); ChannelHandlerContext context = mock( ChannelHandlerContext.class );
Expand Down Expand Up @@ -145,7 +145,7 @@ public void logsAndClosesProtocolOnUnexpectedExceptions() throws Throwable
} }


@Test @Test
public void logsAndClosesContextWhenProtocolNotInitializedOnUnexpectedExceptions() throws Throwable public void logsAndClosesContextWhenProtocolNotInitializedOnUnexpectedExceptions()
{ {
// Given // Given
ChannelHandlerContext context = mock( ChannelHandlerContext.class ); ChannelHandlerContext context = mock( ChannelHandlerContext.class );
Expand Down
Expand Up @@ -25,8 +25,8 @@
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;


import org.neo4j.consistency.checking.full.ConsistencyFlags;
import org.neo4j.consistency.checking.full.ConsistencyCheckIncompleteException; import org.neo4j.consistency.checking.full.ConsistencyCheckIncompleteException;
import org.neo4j.consistency.checking.full.ConsistencyFlags;
import org.neo4j.consistency.checking.full.FullCheck; import org.neo4j.consistency.checking.full.FullCheck;
import org.neo4j.consistency.report.ConsistencySummaryStatistics; import org.neo4j.consistency.report.ConsistencySummaryStatistics;
import org.neo4j.consistency.statistics.AccessStatistics; import org.neo4j.consistency.statistics.AccessStatistics;
Expand Down Expand Up @@ -87,15 +87,15 @@ public ConsistencyCheckService( Date timestamp )
@Deprecated @Deprecated
public Result runFullConsistencyCheck( File storeDir, Config tuningConfiguration, public Result runFullConsistencyCheck( File storeDir, Config tuningConfiguration,
ProgressMonitorFactory progressFactory, LogProvider logProvider, boolean verbose ) ProgressMonitorFactory progressFactory, LogProvider logProvider, boolean verbose )
throws ConsistencyCheckIncompleteException, IOException throws ConsistencyCheckIncompleteException
{ {
return runFullConsistencyCheck( storeDir, tuningConfiguration, progressFactory, logProvider, verbose, return runFullConsistencyCheck( storeDir, tuningConfiguration, progressFactory, logProvider, verbose,
new ConsistencyFlags( tuningConfiguration ) ); new ConsistencyFlags( tuningConfiguration ) );
} }


public Result runFullConsistencyCheck( File storeDir, Config config, ProgressMonitorFactory progressFactory, public Result runFullConsistencyCheck( File storeDir, Config config, ProgressMonitorFactory progressFactory,
LogProvider logProvider, boolean verbose, ConsistencyFlags consistencyFlags ) LogProvider logProvider, boolean verbose, ConsistencyFlags consistencyFlags )
throws ConsistencyCheckIncompleteException, IOException throws ConsistencyCheckIncompleteException
{ {
FileSystemAbstraction fileSystem = new DefaultFileSystemAbstraction(); FileSystemAbstraction fileSystem = new DefaultFileSystemAbstraction();
try try
Expand All @@ -120,15 +120,15 @@ public Result runFullConsistencyCheck( File storeDir, Config config, ProgressMon
@Deprecated @Deprecated
public Result runFullConsistencyCheck( File storeDir, Config tuningConfiguration, public Result runFullConsistencyCheck( File storeDir, Config tuningConfiguration,
ProgressMonitorFactory progressFactory, LogProvider logProvider, FileSystemAbstraction fileSystem, ProgressMonitorFactory progressFactory, LogProvider logProvider, FileSystemAbstraction fileSystem,
boolean verbose ) throws ConsistencyCheckIncompleteException, IOException boolean verbose ) throws ConsistencyCheckIncompleteException
{ {
return runFullConsistencyCheck( storeDir, tuningConfiguration, progressFactory, logProvider, fileSystem, return runFullConsistencyCheck( storeDir, tuningConfiguration, progressFactory, logProvider, fileSystem,
verbose, new ConsistencyFlags( tuningConfiguration ) ); verbose, new ConsistencyFlags( tuningConfiguration ) );
} }


public Result runFullConsistencyCheck( File storeDir, Config config, ProgressMonitorFactory progressFactory, public Result runFullConsistencyCheck( File storeDir, Config config, ProgressMonitorFactory progressFactory,
LogProvider logProvider, FileSystemAbstraction fileSystem, boolean verbose, LogProvider logProvider, FileSystemAbstraction fileSystem, boolean verbose,
ConsistencyFlags consistencyFlags ) throws ConsistencyCheckIncompleteException, IOException ConsistencyFlags consistencyFlags ) throws ConsistencyCheckIncompleteException
{ {
return runFullConsistencyCheck( storeDir, config, progressFactory, logProvider, fileSystem, return runFullConsistencyCheck( storeDir, config, progressFactory, logProvider, fileSystem,
verbose, defaultReportDir( config, storeDir ), consistencyFlags ); verbose, defaultReportDir( config, storeDir ), consistencyFlags );
Expand All @@ -137,7 +137,7 @@ public Result runFullConsistencyCheck( File storeDir, Config config, ProgressMon
@Deprecated @Deprecated
public Result runFullConsistencyCheck( File storeDir, Config tuningConfiguration, public Result runFullConsistencyCheck( File storeDir, Config tuningConfiguration,
ProgressMonitorFactory progressFactory, LogProvider logProvider, FileSystemAbstraction fileSystem, ProgressMonitorFactory progressFactory, LogProvider logProvider, FileSystemAbstraction fileSystem,
boolean verbose, File reportDir ) throws ConsistencyCheckIncompleteException, IOException boolean verbose, File reportDir ) throws ConsistencyCheckIncompleteException
{ {
return runFullConsistencyCheck( storeDir, tuningConfiguration, progressFactory, logProvider, fileSystem, return runFullConsistencyCheck( storeDir, tuningConfiguration, progressFactory, logProvider, fileSystem,
verbose, reportDir, new ConsistencyFlags( tuningConfiguration ) ); verbose, reportDir, new ConsistencyFlags( tuningConfiguration ) );
Expand Down
Expand Up @@ -52,7 +52,7 @@ public class ConsistencyCheckTool
private static final String CONFIG = "config"; private static final String CONFIG = "config";
private static final String VERBOSE = "v"; private static final String VERBOSE = "v";


public static void main( String[] args ) throws IOException public static void main( String[] args )
{ {
try try
{ {
Expand All @@ -68,7 +68,7 @@ public static void main( String[] args ) throws IOException


public static ConsistencyCheckService.Result runConsistencyCheckTool( String[] args, PrintStream outStream, public static ConsistencyCheckService.Result runConsistencyCheckTool( String[] args, PrintStream outStream,
PrintStream errStream ) PrintStream errStream )
throws ToolFailureException, IOException throws ToolFailureException
{ {
FileSystemAbstraction fileSystem = new DefaultFileSystemAbstraction(); FileSystemAbstraction fileSystem = new DefaultFileSystemAbstraction();
try try
Expand Down Expand Up @@ -104,7 +104,7 @@ public static ConsistencyCheckService.Result runConsistencyCheckTool( String[] a
this.systemError = systemError; this.systemError = systemError;
} }


ConsistencyCheckService.Result run( String... args ) throws ToolFailureException, IOException ConsistencyCheckService.Result run( String... args ) throws ToolFailureException
{ {
Args arguments = Args.withFlags( VERBOSE ).parse( args ); Args arguments = Args.withFlags( VERBOSE ).parse( args );


Expand Down
Expand Up @@ -25,7 +25,6 @@
import org.junit.rules.RuleChain; import org.junit.rules.RuleChain;


import java.io.File; import java.io.File;
import java.io.IOException;
import java.nio.file.Files; import java.nio.file.Files;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
Expand Down Expand Up @@ -187,7 +186,7 @@ public void shouldNotReportDuplicateForHugeLongValues() throws Exception
} }


@Test @Test
public void shouldAllowGraphCheckDisabled() throws IOException, ConsistencyCheckIncompleteException public void shouldAllowGraphCheckDisabled() throws ConsistencyCheckIncompleteException
{ {
GraphDatabaseService gds = getGraphDatabaseService(); GraphDatabaseService gds = getGraphDatabaseService();


Expand Down Expand Up @@ -374,13 +373,13 @@ protected void transactionData( GraphStoreFixture.TransactionDataBuilder tx,
} }


private Result runFullConsistencyCheck( ConsistencyCheckService service, Config configuration ) private Result runFullConsistencyCheck( ConsistencyCheckService service, Config configuration )
throws ConsistencyCheckIncompleteException, IOException throws ConsistencyCheckIncompleteException
{ {
return runFullConsistencyCheck( service, configuration, fixture.directory() ); return runFullConsistencyCheck( service, configuration, fixture.directory() );
} }


private Result runFullConsistencyCheck( ConsistencyCheckService service, Config configuration, File storeDir ) private Result runFullConsistencyCheck( ConsistencyCheckService service, Config configuration, File storeDir )
throws ConsistencyCheckIncompleteException, IOException throws ConsistencyCheckIncompleteException
{ {
return service.runFullConsistencyCheck( storeDir, return service.runFullConsistencyCheck( storeDir,
configuration, ProgressMonitorFactory.NONE, NullLogProvider.getInstance(), false ); configuration, ProgressMonitorFactory.NONE, NullLogProvider.getInstance(), false );
Expand Down
Expand Up @@ -283,7 +283,7 @@ private void createGraphDbAndKillIt( Config config ) throws Exception
} }


private void runConsistencyCheckToolWith( FileSystemAbstraction fileSystem, String... args ) private void runConsistencyCheckToolWith( FileSystemAbstraction fileSystem, String... args )
throws IOException, ToolFailureException throws ToolFailureException
{ {
new ConsistencyCheckTool( mock( ConsistencyCheckService.class ), fileSystem, mock( PrintStream.class), new ConsistencyCheckTool( mock( ConsistencyCheckService.class ), fileSystem, mock( PrintStream.class),
mock( PrintStream.class ) ).run( args ); mock( PrintStream.class ) ).run( args );
Expand Down
Expand Up @@ -20,7 +20,6 @@
package org.neo4j.consistency.store; package org.neo4j.consistency.store;


import java.io.File; import java.io.File;
import java.io.IOException;


import org.neo4j.consistency.ConsistencyCheckService; import org.neo4j.consistency.ConsistencyCheckService;
import org.neo4j.consistency.checking.full.ConsistencyCheckIncompleteException; import org.neo4j.consistency.checking.full.ConsistencyCheckIncompleteException;
Expand All @@ -38,7 +37,7 @@ private StoreAssertions()
{ {
} }


public static void assertConsistentStore( File storeDir ) throws ConsistencyCheckIncompleteException, IOException public static void assertConsistentStore( File storeDir ) throws ConsistencyCheckIncompleteException
{ {
Config configuration = Config.defaults( GraphDatabaseSettings.pagecache_memory, "8m" ); Config configuration = Config.defaults( GraphDatabaseSettings.pagecache_memory, "8m" );
AssertableLogProvider logger = new AssertableLogProvider(); AssertableLogProvider logger = new AssertableLogProvider();
Expand Down
Expand Up @@ -1237,7 +1237,7 @@ public void shouldTrimStringsIfConfiguredTo() throws Exception
} }


@Test @Test
public void shouldPrintReferenceLinkOnDataImportErrors() throws Exception public void shouldPrintReferenceLinkOnDataImportErrors()
{ {
String[] versionParts = Version.getNeo4jVersion().split("-"); String[] versionParts = Version.getNeo4jVersion().split("-");
versionParts[0] = versionParts[0].substring(0, 3); versionParts[0] = versionParts[0].substring(0, 3);
Expand Down
Expand Up @@ -241,7 +241,7 @@ public void acquiredFreelistPageId( long freelistPageId )
assertTrue( expected.isEmpty() ); assertTrue( expected.isEmpty() );
} }


private void fillPageWithRandomBytes( long releasedId ) throws IOException private void fillPageWithRandomBytes( long releasedId )
{ {
cursor.next( releasedId ); cursor.next( releasedId );
byte[] crapData = new byte[PAGE_SIZE]; byte[] crapData = new byte[PAGE_SIZE];
Expand Down
Expand Up @@ -32,7 +32,7 @@
public class GenerationSafePointerPairAdditionalTest public class GenerationSafePointerPairAdditionalTest
{ {
@Test @Test
public void shouldFailFastOnTooLargeGenerationOffset() throws Exception public void shouldFailFastOnTooLargeGenerationOffset()
{ {
// GIVEN // GIVEN
int pageSize = PageCache.PAGE_SIZE; int pageSize = PageCache.PAGE_SIZE;
Expand Down
Expand Up @@ -37,7 +37,7 @@ public class GroupingRecoveryCleanupWorkCollectorTest
new GroupingRecoveryCleanupWorkCollector( jobScheduler ); new GroupingRecoveryCleanupWorkCollector( jobScheduler );


@Test @Test
public void mustNotScheduleAnyJobsBeforeStart() throws Throwable public void mustNotScheduleAnyJobsBeforeStart()
{ {
// given // given
List<CleanupJob> allRuns = new ArrayList<>(); List<CleanupJob> allRuns = new ArrayList<>();
Expand All @@ -52,7 +52,7 @@ public void mustNotScheduleAnyJobsBeforeStart() throws Throwable
} }


@Test @Test
public void mustScheduleAllJobs() throws Throwable public void mustScheduleAllJobs()
{ {
// given // given
List<CleanupJob> allRuns = new ArrayList<>(); List<CleanupJob> allRuns = new ArrayList<>();
Expand All @@ -68,7 +68,7 @@ public void mustScheduleAllJobs() throws Throwable
} }


@Test @Test
public void mustNotScheduleOldJobsAfterRestart() throws Throwable public void mustNotScheduleOldJobsAfterRestart()
{ {
// given // given
List<CleanupJob> allRuns = new ArrayList<>(); List<CleanupJob> allRuns = new ArrayList<>();
Expand All @@ -85,7 +85,7 @@ public void mustNotScheduleOldJobsAfterRestart() throws Throwable
} }


@Test @Test
public void mustNotScheduleOldJobsOnMultipleStart() throws Throwable public void mustNotScheduleOldJobsOnMultipleStart()
{ {
// given // given
List<CleanupJob> allRuns = new ArrayList<>(); List<CleanupJob> allRuns = new ArrayList<>();
Expand All @@ -102,7 +102,7 @@ public void mustNotScheduleOldJobsOnMultipleStart() throws Throwable
} }


@Test @Test
public void mustNotScheduleOldJobsOnStartStopStart() throws Throwable public void mustNotScheduleOldJobsOnStartStopStart()
{ {
// given // given
List<CleanupJob> allRuns = new ArrayList<>(); List<CleanupJob> allRuns = new ArrayList<>();
Expand Down
Expand Up @@ -33,6 +33,7 @@


import org.neo4j.io.pagecache.PageCursor; import org.neo4j.io.pagecache.PageCursor;
import org.neo4j.test.rule.RandomRule; import org.neo4j.test.rule.RandomRule;

import static org.hamcrest.CoreMatchers.containsString; import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.CoreMatchers.not;
Expand Down Expand Up @@ -1701,7 +1702,7 @@ private void assertSiblingOrderAndPointers( long... children ) throws IOExceptio
goTo( readCursor, currentPageId ); goTo( readCursor, currentPageId );
} }


private KEY keyAt( long nodeId, int pos, TreeNode.Type type ) throws IOException private KEY keyAt( long nodeId, int pos, TreeNode.Type type )
{ {
KEY readKey = layout.newKey(); KEY readKey = layout.newKey();
long prevId = readCursor.getCurrentPageId(); long prevId = readCursor.getCurrentPageId();
Expand Down
Expand Up @@ -22,8 +22,6 @@
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;


import java.io.IOException;

import org.neo4j.io.pagecache.PageCursor; import org.neo4j.io.pagecache.PageCursor;


import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
Expand All @@ -37,7 +35,7 @@ public class TreeStateTest
private PageAwareByteArrayCursor cursor; private PageAwareByteArrayCursor cursor;


@Before @Before
public void initiateCursor() throws IOException public void initiateCursor()
{ {
cursor = new PageAwareByteArrayCursor( pageSize ); cursor = new PageAwareByteArrayCursor( pageSize );
cursor.next(); cursor.next();
Expand Down
Expand Up @@ -589,7 +589,7 @@ private void flushAllPages( IOLimiter limiter ) throws IOException
} }
} }


void syncDevice() throws IOException void syncDevice()
{ {
swapperFactory.syncDevice(); swapperFactory.syncDevice();
} }
Expand Down

0 comments on commit b4d1390

Please sign in to comment.