Skip to content

Commit

Permalink
Sonarcloud recommendations.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian Baumhekel authored and Sebastian Baumhekel committed Aug 12, 2024
1 parent 3cb0c9d commit 2b2ed9c
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 38 deletions.
11 changes: 11 additions & 0 deletions .project
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,15 @@
<nature>edu.umd.cs.findbugs.plugin.eclipse.findbugsNature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
</natures>
<filteredResources>
<filter>
<id>1714375844981</id>
<name></name>
<type>30</type>
<matcher>
<id>org.eclipse.core.resources.regexFilterMatcher</id>
<arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
</matcher>
</filter>
</filteredResources>
</projectDescription>
6 changes: 3 additions & 3 deletions .settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=enabled
org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
org.eclipse.jdt.core.compiler.annotation.nonnull=javax.annotation.Nonnull
org.eclipse.jdt.core.compiler.annotation.nonnull.secondary=org.eclipse.jdt.annotation.NonNull
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=javax.annotation.ParametersAreNonnullByDefault
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary=
org.eclipse.jdt.core.compiler.annotation.notowning=org.eclipse.jdt.annotation.NotOwning
org.eclipse.jdt.core.compiler.annotation.nullable=javax.annotation.Nullable
Expand Down Expand Up @@ -78,7 +78,7 @@ org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning
org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=warning
org.eclipse.jdt.core.compiler.problem.nullReference=error
org.eclipse.jdt.core.compiler.problem.nullReference=warning
org.eclipse.jdt.core.compiler.problem.nullSpecViolation=warning
org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=ignore
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
Expand Down Expand Up @@ -134,7 +134,7 @@ org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=warning
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.compiler.processAnnotations=disabled
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=21
org.eclipse.jdt.core.formatter.align_arrows_in_switch_on_columns=false
org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns=false
Expand Down
46 changes: 23 additions & 23 deletions src/test/java/io/github/sebasbaumh/postgis/DatatypesTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,21 @@
public class DatatypesTest extends DatabaseTestBase
{

private static final String cr_str = "CIRCULARSTRING(-9 2,-8 3,-7 2)";
private static final String CR_STR = "CIRCULARSTRING(-9 2,-8 3,-7 2)";

private static final String cr_str2 = "CIRCULARSTRING(0 -1,-1 0,0 1,1 0,0 -1)";
private static final String CR_STR2 = "CIRCULARSTRING(0 -1,-1 0,0 1,1 0,0 -1)";

private static final String lng_str = "LINESTRING (10 10 20,20 20 20, 50 50 50, 34 34 34)";
private static final String LNG_STR = "LINESTRING (10 10 20,20 20 20, 50 50 50, 34 34 34)";

private static final Logger logger = LoggerFactory.getLogger(DatatypesTest.class);

private static final String mlng_str = "MULTILINESTRING ((10 10 0,20 10 0,20 20 0,20 10 0,10 10 0),(5 5 0,5 6 0,6 6 0,6 5 0,5 5 0))";
private static final String MLNG_STR = "MULTILINESTRING ((10 10 0,20 10 0,20 20 0,20 10 0,10 10 0),(5 5 0,5 6 0,6 6 0,6 5 0,5 5 0))";

private static final String mplg_str = "MULTIPOLYGON (((10 10 0,20 10 0,20 20 0,20 10 0,10 10 0),(5 5 0,5 6 0,6 6 0,6 5 0,5 5 0)),((10 10 0,20 10 0,20 20 0,20 10 0,10 10 0),(5 5 0,5 6 0,6 6 0,6 5 0,5 5 0)))";
private static final String MPLG_STR = "MULTIPOLYGON (((10 10 0,20 10 0,20 20 0,20 10 0,10 10 0),(5 5 0,5 6 0,6 6 0,6 5 0,5 5 0)),((10 10 0,20 10 0,20 20 0,20 10 0,10 10 0),(5 5 0,5 6 0,6 6 0,6 5 0,5 5 0)))";

private static final String plg_str = "POLYGON ((10 10 0,20 10 0,20 20 0,20 10 0,10 10 0),(5 5 0,5 6 0,6 6 0,6 5 0,5 5 0))";
private static final String PLG_STR = "POLYGON ((10 10 0,20 10 0,20 20 0,20 10 0,10 10 0),(5 5 0,5 6 0,6 6 0,6 5 0,5 5 0))";

private static final String ptg_str = "POINT(10 10 20)";
private static final String PTG_STR = "POINT(10 10 20)";

@SuppressWarnings("unchecked")
private <T extends Geometry> T assertGeometry(Class<T> clazz, String wkt) throws SQLException
Expand All @@ -68,8 +68,8 @@ public void testCircularString() throws SQLException
return;
}
logger.trace("void testCircularString()");
logger.debug(cr_str);
CircularString lng = assertGeometry(CircularString.class, cr_str);
logger.debug(CR_STR);
CircularString lng = assertGeometry(CircularString.class, CR_STR);
logger.debug(lng.toString());
}

Expand All @@ -81,8 +81,8 @@ public void testCircularString2() throws SQLException
return;
}
logger.trace("void testCircularString2()");
logger.debug(cr_str2);
CircularString lng = assertGeometry(CircularString.class, cr_str2);
logger.debug(CR_STR2);
CircularString lng = assertGeometry(CircularString.class, CR_STR2);
logger.debug(lng.toString());
}

Expand All @@ -94,8 +94,8 @@ public void testLineString() throws SQLException
return;
}
logger.trace("void testLineString()");
logger.debug(lng_str);
LineString lng = assertGeometry(LineString.class, lng_str);
logger.debug(LNG_STR);
LineString lng = assertGeometry(LineString.class, LNG_STR);
logger.debug(lng.toString());
}

Expand All @@ -107,8 +107,8 @@ public void testMultiLineString() throws SQLException
return;
}
logger.trace("void testMultiLineString()");
logger.debug(mlng_str);
MultiLineString mlng = assertGeometry(MultiLineString.class, mlng_str);
logger.debug(MLNG_STR);
MultiLineString mlng = assertGeometry(MultiLineString.class, MLNG_STR);
logger.debug(mlng.toString());
}

Expand All @@ -120,8 +120,8 @@ public void testMultiPolygon() throws SQLException
return;
}
logger.trace("void testMultiPolygon()");
logger.debug(mplg_str);
MultiPolygon mplg = assertGeometry(MultiPolygon.class, mplg_str);
logger.debug(MPLG_STR);
MultiPolygon mplg = assertGeometry(MultiPolygon.class, MPLG_STR);
logger.debug(mplg.toString());
}

Expand All @@ -133,8 +133,8 @@ public void testPGgeometry() throws SQLException
return;
}
logger.trace("void testPGgeometry()");
logger.debug(mlng_str);
PGgeometry pgf = new PGgeometry(getWKBFromWKT(mlng_str));
logger.debug(MLNG_STR);
PGgeometry pgf = new PGgeometry(getWKBFromWKT(MLNG_STR));
logger.debug(pgf.toString());
}

Expand All @@ -146,8 +146,8 @@ public void testPoint() throws SQLException
return;
}
logger.trace("void testPoint()");
logger.debug(ptg_str);
Point ptg = assertGeometry(Point.class, ptg_str);
logger.debug(PTG_STR);
Point ptg = assertGeometry(Point.class, PTG_STR);
logger.debug(ptg.toString());
}

Expand All @@ -159,8 +159,8 @@ public void testPolygon() throws SQLException
return;
}
logger.trace("void testPolygon()");
logger.debug(plg_str);
Polygon plg = assertGeometry(Polygon.class, plg_str);
logger.debug(PLG_STR);
Polygon plg = assertGeometry(Polygon.class, PLG_STR);
logger.debug(plg.toString());
}

Expand Down
22 changes: 11 additions & 11 deletions src/test/java/io/github/sebasbaumh/postgis/GeographyTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@
@SuppressWarnings("javadoc")
public class GeographyTest extends PostgisDatabaseTest
{
private static final String lng_str = "LINESTRING (10 10 20,20 20 20, 50 50 50, 34 34 34)";
private static final String LNG_STR = "LINESTRING (10 10 20,20 20 20, 50 50 50, 34 34 34)";

private static final String mlng_str = "MULTILINESTRING ((10 10 0,20 10 0,20 20 0,20 10 0,10 10 0),(5 5 0,5 6 0,6 6 0,6 5 0,5 5 0))";
private static final String MLNG_STR = "MULTILINESTRING ((10 10 0,20 10 0,20 20 0,20 10 0,10 10 0),(5 5 0,5 6 0,6 6 0,6 5 0,5 5 0))";

private static final String mplg_str = "MULTIPOLYGON (((10 10 0,20 10 0,20 20 0,20 10 0,10 10 0),(5 5 0,5 6 0,6 6 0,6 5 0,5 5 0)),((10 10 0,20 10 0,20 20 0,20 10 0,10 10 0),(5 5 0,5 6 0,6 6 0,6 5 0,5 5 0)))";
private static final String MPLG_STR = "MULTIPOLYGON (((10 10 0,20 10 0,20 20 0,20 10 0,10 10 0),(5 5 0,5 6 0,6 6 0,6 5 0,5 5 0)),((10 10 0,20 10 0,20 20 0,20 10 0,10 10 0),(5 5 0,5 6 0,6 6 0,6 5 0,5 5 0)))";

private static final String plg_str = "POLYGON ((10 10 0,20 10 0,20 20 0,20 10 0,10 10 0),(5 5 0,5 6 0,6 6 0,6 5 0,5 5 0))";
private static final String PLG_STR = "POLYGON ((10 10 0,20 10 0,20 20 0,20 10 0,10 10 0),(5 5 0,5 6 0,6 6 0,6 5 0,5 5 0))";

private static final String ptg_str = "POINT(10 10 20)";
private static final String PTG_STR = "POINT(10 10 20)";

@SuppressWarnings("unchecked")
private <T extends Geometry> T assertGeometry(Class<T> clazz, String wkt) throws SQLException
Expand All @@ -62,7 +62,7 @@ public void testLineString() throws SQLException
{
return;
}
assertGeometry(LineString.class, lng_str);
assertGeometry(LineString.class, LNG_STR);
}

@Test
Expand All @@ -72,7 +72,7 @@ public void testMultiLineString() throws SQLException
{
return;
}
assertGeometry(MultiLineString.class, mlng_str);
assertGeometry(MultiLineString.class, MLNG_STR);
}

@Test
Expand All @@ -82,7 +82,7 @@ public void testMultiPolygon() throws SQLException
{
return;
}
assertGeometry(MultiPolygon.class, mplg_str);
assertGeometry(MultiPolygon.class, MPLG_STR);
}

@SuppressWarnings("unused")
Expand All @@ -94,7 +94,7 @@ public void testPGgeometry() throws SQLException
{
return;
}
new PGgeometry(getWKBFromWKT(mlng_str));
new PGgeometry(getWKBFromWKT(MLNG_STR));
}

@Test
Expand All @@ -104,7 +104,7 @@ public void testPoint() throws SQLException
{
return;
}
assertGeometry(Point.class, ptg_str);
assertGeometry(Point.class, PTG_STR);
}

@Test
Expand All @@ -114,7 +114,7 @@ public void testPolygon() throws SQLException
{
return;
}
assertGeometry(Polygon.class, plg_str);
assertGeometry(Polygon.class, PLG_STR);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class VersionPrinterTest extends DatabaseTestBase

private static final Logger logger = LoggerFactory.getLogger(VersionPrinterTest.class);

private static String[] POSTGIS_FUNCTIONS = { "postgis_version", "postgis_proj_version",
private static final String[] POSTGIS_FUNCTIONS = { "postgis_version", "postgis_proj_version",
"postgis_scripts_installed", "postgis_lib_version", "postgis_scripts_released", "postgis_uses_stats",
"postgis_geos_version", "postgis_scripts_build_date", "postgis_lib_build_date", "postgis_full_version",
"postgis_gdal_version", "postgis_libjson_version", "postgis_libxml_version", "postgis_raster_lib_version",
Expand Down

0 comments on commit 2b2ed9c

Please sign in to comment.