Skip to content

Commit

Permalink
ONGDB-302 - Upgrade com.puppycrawl.tools:checkstyle to 8.29 to fix me…
Browse files Browse the repository at this point in the history
…dium security vulnerability #20
  • Loading branch information
amandabouman authored and bradnussbaum committed Jun 23, 2022
1 parent 39a96d2 commit 430474f
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 28 deletions.
9 changes: 5 additions & 4 deletions build-resources/src/main/resources/checkstyle/checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@
<property name="message" value="Two or more consecutive empty lines"/>
</module>

<module name="LineLength">
<property name="max" value="160"/>
<property name="ignorePattern" value="a href|href|http://|https://"/>
</module>

<module name="TreeWalker">

<module name="PackageDeclaration"/>
Expand Down Expand Up @@ -88,10 +93,6 @@
<module name="AvoidStarImport"/>
<module name="GenericWhitespace"/>
<module name="ExplicitInitialization"/>
<module name="LineLength">
<property name="max" value="160"/>
<property name="ignorePattern" value="a href|href|http://|https://"/>
</module>

<module name="IllegalImport">
<property name="illegalPkgs" value="junit.framework"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,19 @@ public void testCachingIterator()
fail( "Should throw exception" );
}
catch ( NoSuchElementException e )
{ /* Good */ }
{
/* Good */
}

try
{
caching.current();
fail( "Should throw exception" );
}
catch ( NoSuchElementException e )
{ /* Good */ }
{
/* Good */
}

// Next and previous
assertEquals( 0, caching.position() );
Expand Down Expand Up @@ -130,7 +134,9 @@ public void testCachingIterator()
fail( "Shouldn't be able to set a lower value than 0" );
}
catch ( IllegalArgumentException e )
{ /* Good */ }
{
/* Good */
}
assertEquals( (Integer) 0, caching.current() );
assertEquals( 0, caching.position( 3 ) );
try
Expand All @@ -139,7 +145,9 @@ public void testCachingIterator()
fail( "Shouldn't be able to call current() after a call to position(int)" );
}
catch ( NoSuchElementException e )
{ /* Good */ }
{
/* Good */
}
assertTrue( caching.hasNext() );
assertEquals( (Integer) 3, caching.next() );
assertEquals( (Integer) 3, caching.current() );
Expand All @@ -158,7 +166,9 @@ public void testCachingIterator()
fail( "Shouldn't be able to set a position which is too big" );
}
catch ( NoSuchElementException e )
{ /* Good */ }
{
/* Good */
}
assertEquals( 3, caching.position( 8 ) );
assertTrue( caching.hasPrevious() );
assertFalse( caching.hasNext() );
Expand All @@ -168,7 +178,9 @@ public void testCachingIterator()
fail( "Shouldn't be able to go beyond last item" );
}
catch ( NoSuchElementException e )
{ /* Good */ }
{
/* Good */
}
assertEquals( 8, caching.position() );
assertEquals( (Integer) 7, caching.previous() );
assertEquals( (Integer) 6, caching.previous() );
Expand Down Expand Up @@ -228,7 +240,9 @@ public void testFirstElement()
fail( "Should fail" );
}
catch ( NoSuchElementException e )
{ /* Good */ }
{
/* Good */
}

// first Iterator
assertEquals( object, Iterators.first( Arrays.asList( object, object2 ).iterator() ) );
Expand All @@ -239,7 +253,9 @@ public void testFirstElement()
fail( "Should fail" );
}
catch ( NoSuchElementException e )
{ /* Good */ }
{
/* Good */
}

// firstOrNull Iterable
assertEquals( object, Iterables.firstOrNull( Arrays.asList( object, object2 ) ) );
Expand Down Expand Up @@ -267,7 +283,9 @@ public void testLastElement()
fail( "Should fail" );
}
catch ( NoSuchElementException e )
{ /* Good */ }
{
/* Good */
}

// last Iterator
assertEquals( object2, Iterators.last( Arrays.asList( object, object2 ).iterator() ) );
Expand All @@ -278,7 +296,9 @@ public void testLastElement()
fail( "Should fail" );
}
catch ( NoSuchElementException e )
{ /* Good */ }
{
/* Good */
}

// lastOrNull Iterable
assertEquals( object2, Iterables.lastOrNull( Arrays.asList( object, object2 ) ) );
Expand All @@ -305,14 +325,18 @@ public void testSingleElement()
fail( "Should fail" );
}
catch ( Exception e )
{ /* Good */ }
{
/* Good */
}
try
{
Iterables.single( Arrays.asList( object, object2 ) );
fail( "Should fail" );
}
catch ( Exception e )
{ /* Good */ }
{
/* Good */
}

// single Iterator
assertEquals( object, Iterators.single( Arrays.asList( object ).iterator() ) );
Expand All @@ -322,14 +346,18 @@ public void testSingleElement()
fail( "Should fail" );
}
catch ( Exception e )
{ /* Good */ }
{
/* Good */
}
try
{
Iterators.single( Arrays.asList( object, object2 ).iterator() );
fail( "Should fail" );
}
catch ( Exception e )
{ /* Good */ }
{
/* Good */
}

// singleOrNull Iterable
assertEquals( object, Iterables.singleOrNull( Arrays.asList( object ) ) );
Expand All @@ -340,7 +368,9 @@ public void testSingleElement()
fail( "Should fail" );
}
catch ( Exception e )
{ /* Good */ }
{
/* Good */
}

// singleOrNull Iterator
assertEquals( object, Iterators.singleOrNull( Arrays.asList( object ).iterator() ) );
Expand All @@ -351,7 +381,9 @@ public void testSingleElement()
fail( "Should fail" );
}
catch ( Exception e )
{ /* Good */ }
{
/* Good */
}
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1262,14 +1262,18 @@ public void makeSureConfigurationCanBeModified()
fail( "Shouldn't be able to modify provider" );
}
catch ( IllegalArgumentException e )
{ /* Good*/ }
{
/* Good*/
}
try
{
graphDb.index().removeConfiguration( index, IndexManager.PROVIDER );
fail( "Shouldn't be able to modify provider" );
}
catch ( IllegalArgumentException e )
{ /* Good*/ }
{
/* Good*/
}

String key = "my-key";
String value = "my-value";
Expand All @@ -1295,7 +1299,9 @@ public void makeSureSlightDifferencesInIndexConfigCanBeSupplied()
fail( "Shouldn't be able to get index with these kinds of differences in config" );
}
catch ( IllegalArgumentException e )
{ /* */ }
{
/* */
}
nodeIndex( name, MapUtil.stringMap( new HashMap<>( config ), "whatever", "something" ) );
}

Expand Down
16 changes: 12 additions & 4 deletions enterprise/com/src/test/java/org/neo4j/com/CommunicationIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,9 @@ public void applicationProtocolVersionsMustMatch()
fail( "Shouldn't be able to communicate with different application protocol versions" );
}
catch ( IllegalProtocolVersionException e )
{ /* Good */ }
{
/* Good */
}
}

@Test
Expand All @@ -243,7 +245,9 @@ public void applicationProtocolVersionsMustMatchMultiJvm()
fail( "Shouldn't be able to communicate with different application protocol versions" );
}
catch ( IllegalProtocolVersionException e )
{ /* Good */ }
{
/* Good */
}

server.shutdown();
}
Expand All @@ -261,7 +265,9 @@ public void internalProtocolVersionsMustMatch()
fail( "Shouldn't be able to communicate with different application protocol versions" );
}
catch ( IllegalProtocolVersionException e )
{ /* Good */ }
{
/* Good */
}
}

@Test
Expand All @@ -279,7 +285,9 @@ public void internalProtocolVersionsMustMatchMultiJvm()
fail( "Shouldn't be able to communicate with different application protocol versions" );
}
catch ( IllegalProtocolVersionException e )
{ /* Good */ }
{
/* Good */
}

server.shutdown();
}
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,7 @@
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>8.8</version>
<version>8.29</version>
</dependency>
</dependencies>
<executions>
Expand Down

0 comments on commit 430474f

Please sign in to comment.