From f4f44b8a64e93b35851c9ce3b43bea010a58aa6f Mon Sep 17 00:00:00 2001 From: Craig Taverner Date: Thu, 19 Oct 2017 16:59:10 +0200 Subject: [PATCH] Fixed geometry block count calculation to never throw exceptions This is required for the page cache retry logic to work correctly. --- .../org/neo4j/kernel/impl/store/GeometryType.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/community/kernel/src/main/java/org/neo4j/kernel/impl/store/GeometryType.java b/community/kernel/src/main/java/org/neo4j/kernel/impl/store/GeometryType.java index 084d79ce9430c..ae8e373594f19 100644 --- a/community/kernel/src/main/java/org/neo4j/kernel/impl/store/GeometryType.java +++ b/community/kernel/src/main/java/org/neo4j/kernel/impl/store/GeometryType.java @@ -46,7 +46,7 @@ public int calculateNumberOfBlocksUsedForGeometry( long firstBlock ) int dimension = getDimension( firstBlock ); if ( dimension > 3 ) { - throw new UnsupportedOperationException( "Points with more than 3 dimensions are not supported in the PropertyStore" ); + return PropertyType.BLOCKS_USED_FOR_BAD_TYPE_OR_ENCODING; } return 1 + dimension; } @@ -93,8 +93,15 @@ private static boolean isFloatPrecision( long firstBlock ) public static int calculateNumberOfBlocksUsed( long firstBlock ) { - int gtype = getGeometryType( firstBlock ); - return find( gtype ).calculateNumberOfBlocksUsedForGeometry( firstBlock ); + GeometryType geometryType = find( getGeometryType( firstBlock ) ); + if ( geometryType == null ) + { + return PropertyType.BLOCKS_USED_FOR_BAD_TYPE_OR_ENCODING; + } + else + { + return geometryType.calculateNumberOfBlocksUsedForGeometry( firstBlock ); + } } private static GeometryType find( int gtype ) @@ -106,7 +113,7 @@ private static GeometryType find( int gtype ) return type; } } - throw new IllegalArgumentException( "No such GeometryType: " + gtype ); + return null; } public static Value decode( PropertyBlock block )