Skip to content

Commit dd425d2

Browse files
refactor: Remove trailing dots from exception messages.
For prior art see: spring-projects/spring-data-commons#2603 Closes #548
1 parent 53f6c61 commit dd425d2

10 files changed

+56
-54
lines changed

neo4j-jdbc/src/main/java/org/neo4j/jdbc/CallableStatementImpl.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -924,7 +924,7 @@ private void assertParameterType(ParameterType parameterType) throws SQLExceptio
924924
}
925925
else {
926926
if (this.parameterType != parameterType) {
927-
throw new SQLException(String.format("%s parameter can not be mixed with %s parameter(s).",
927+
throw new SQLException(String.format("%s parameter can not be mixed with %s parameter(s)",
928928
parameterType, this.parameterType));
929929
}
930930
}

neo4j-jdbc/src/main/java/org/neo4j/jdbc/ConnectionImpl.java

+11-11
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ public void setAutoCommit(boolean autoCommit) throws SQLException {
177177

178178
if (this.transaction != null) {
179179
if (Neo4jTransaction.State.OPEN_FAILED == this.transaction.getState()) {
180-
throw new SQLException("The existing transaction must be rolled back explicitly.");
180+
throw new SQLException("The existing transaction must be rolled back explicitly");
181181
}
182182
if (this.transaction.isRunnable()) {
183183
this.transaction.commit();
@@ -197,10 +197,10 @@ public boolean getAutoCommit() throws SQLException {
197197
public void commit() throws SQLException {
198198
assertIsOpen();
199199
if (this.transaction == null) {
200-
throw new SQLException("There is no transaction to commit.");
200+
throw new SQLException("There is no transaction to commit");
201201
}
202202
if (this.transaction.isAutoCommit()) {
203-
throw new SQLException("Auto commit transaction may not be managed explicitly.");
203+
throw new SQLException("Auto commit transaction may not be managed explicitly");
204204
}
205205
this.transaction.commit();
206206
}
@@ -209,10 +209,10 @@ public void commit() throws SQLException {
209209
public void rollback() throws SQLException {
210210
assertIsOpen();
211211
if (this.transaction == null) {
212-
throw new SQLException("There is no transaction to rollback.");
212+
throw new SQLException("There is no transaction to rollback");
213213
}
214214
if (this.transaction.isAutoCommit()) {
215-
throw new SQLException("Auto commit transaction may not be managed explicitly.");
215+
throw new SQLException("Auto commit transaction may not be managed explicitly");
216216
}
217217
this.transaction.rollback();
218218
}
@@ -262,7 +262,7 @@ public DatabaseMetaData getMetaData() throws SQLException {
262262
public void setReadOnly(boolean readOnly) throws SQLException {
263263
assertIsOpen();
264264
if (this.transaction != null && this.transaction.isOpen()) {
265-
throw new SQLException("Updating read only setting during an unfinished transaction is not permitted.");
265+
throw new SQLException("Updating read only setting during an unfinished transaction is not permitted");
266266
}
267267
this.readOnly = readOnly;
268268
}
@@ -287,7 +287,7 @@ public String getCatalog() throws SQLException {
287287

288288
@Override
289289
public void setTransactionIsolation(int level) throws SQLException {
290-
throw new SQLException("Setting transaction isolation level is not supported.");
290+
throw new SQLException("Setting transaction isolation level is not supported");
291291
}
292292

293293
@Override
@@ -461,7 +461,7 @@ public SQLXML createSQLXML() throws SQLException {
461461
@Override
462462
public boolean isValid(int timeout) throws SQLException {
463463
if (timeout < 0) {
464-
throw new SQLException("Negative timeout is not supported.");
464+
throw new SQLException("Negative timeout is not supported");
465465
}
466466
if (this.closed) {
467467
return false;
@@ -606,7 +606,7 @@ public <T> T unwrap(Class<T> iface) throws SQLException {
606606
return iface.cast(this);
607607
}
608608
else {
609-
throw new SQLException("This object does not implement the given interface.");
609+
throw new SQLException("This object does not implement the given interface");
610610
}
611611
}
612612

@@ -617,7 +617,7 @@ public boolean isWrapperFor(Class<?> iface) throws SQLException {
617617

618618
private void assertIsOpen() throws SQLException {
619619
if (this.closed) {
620-
throw new SQLException("The connection is closed.");
620+
throw new SQLException("The connection is closed");
621621
}
622622
}
623623

@@ -632,7 +632,7 @@ Neo4jTransaction getTransaction(boolean autoCommitCheck) throws SQLException {
632632
}
633633
if (this.transaction != null && this.transaction.isOpen()) {
634634
if (autoCommitCheck && this.transaction.isAutoCommit()) {
635-
throw new SQLException("Only a single autocommit transaction is supported.");
635+
throw new SQLException("Only a single autocommit transaction is supported");
636636
}
637637
}
638638
else {

neo4j-jdbc/src/main/java/org/neo4j/jdbc/DatabaseMetadataImpl.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -1418,7 +1418,7 @@ public <T> T unwrap(Class<T> iface) throws SQLException {
14181418
return iface.cast(this);
14191419
}
14201420
else {
1421-
throw new SQLException("This object does not implement the given interface.");
1421+
throw new SQLException("This object does not implement the given interface");
14221422
}
14231423
}
14241424

@@ -1462,13 +1462,13 @@ public boolean hasMore() {
14621462

14631463
private static void assertSchemaIsPublicOrNull(String schemaPattern) throws SQLException {
14641464
if (schemaPattern != null && !"public".equals(schemaPattern)) {
1465-
throw new SQLException("Schema must be public or null.");
1465+
throw new SQLException("Schema must be public or null");
14661466
}
14671467
}
14681468

14691469
private static void assertCatalogIsNullOrEmpty(String catalog) throws SQLException {
14701470
if (catalog != null && !catalog.isEmpty()) {
1471-
throw new SQLException("Catalog is not applicable to Neo4j please leave null.");
1471+
throw new SQLException("Catalog is not applicable to Neo4j please leave null");
14721472
}
14731473
}
14741474

neo4j-jdbc/src/main/java/org/neo4j/jdbc/Neo4jDataSource.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ public <T> T unwrap(Class<T> iface) throws SQLException {
213213
return iface.cast(this);
214214
}
215215
else {
216-
throw new SQLException("This object does not implement the given interface.");
216+
throw new SQLException("This object does not implement the given interface");
217217
}
218218
}
219219

neo4j-jdbc/src/main/java/org/neo4j/jdbc/Neo4jDriver.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ static Map<String, String> mergeConfig(String[] urlParams, Properties jdbcProper
311311
@Override
312312
public boolean acceptsURL(String url) throws SQLException {
313313
if (url == null) {
314-
throw new SQLException("url cannot be null.");
314+
throw new SQLException("url cannot be null");
315315
}
316316

317317
return URL_PATTERN.matcher(url).matches();
@@ -417,13 +417,13 @@ public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) throws
417417

418418
private static DriverConfig parseConfig(String url, Properties info) throws SQLException {
419419
if (url == null || info == null) {
420-
throw new SQLException("url and info cannot be null.");
420+
throw new SQLException("url and info cannot be null");
421421
}
422422

423423
var matcher = URL_PATTERN.matcher(url);
424424

425425
if (!matcher.matches()) {
426-
throw new SQLException("Invalid url.");
426+
throw new SQLException("Invalid url");
427427
}
428428

429429
var urlParams = splitUrlParams(matcher.group("urlParams"));

neo4j-jdbc/src/main/java/org/neo4j/jdbc/ParameterMetaDataImpl.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public <T> T unwrap(Class<T> iface) throws SQLException {
7575
return iface.cast(this);
7676
}
7777
else {
78-
throw new SQLException("This object does not implement the given interface.");
78+
throw new SQLException("This object does not implement the given interface");
7979
}
8080
}
8181

neo4j-jdbc/src/main/java/org/neo4j/jdbc/ResultSetImpl.java

+24-23
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ public boolean next() throws SQLException {
147147

148148
private boolean next0() throws SQLException {
149149
if (this.closed) {
150-
throw new SQLException("This result set is closed.");
150+
throw new SQLException("This result set is closed");
151151
}
152152
if (this.remainingRowAllowance == 0) {
153153
return false;
@@ -184,7 +184,7 @@ public void close() throws SQLException {
184184
public boolean wasNull() throws SQLException {
185185
assertIsOpen();
186186
if (this.value == null) {
187-
throw new SQLException("No column has been read prior to this call.");
187+
throw new SQLException("No column has been read prior to this call");
188188
}
189189
return Type.NULL.isTypeOf(this.value);
190190
}
@@ -389,7 +389,7 @@ public int findColumn(String columnLabel) throws SQLException {
389389
assertIsOpen();
390390
var index = this.keys.indexOf(columnLabel);
391391
if (index == -1) {
392-
throw new SQLException("No such column is present.");
392+
throw new SQLException("No such column is present");
393393
}
394394
return ++index;
395395
}
@@ -1152,7 +1152,7 @@ public <T> T unwrap(Class<T> iface) throws SQLException {
11521152
return iface.cast(this);
11531153
}
11541154
else {
1155-
throw new SQLException("This object does not implement the given interface.");
1155+
throw new SQLException("This object does not implement the given interface");
11561156
}
11571157
}
11581158

@@ -1219,7 +1219,7 @@ private static String mapToString(Value value, int maxFieldSize) throws SQLExcep
12191219
if (Type.NULL.isTypeOf(value)) {
12201220
return null;
12211221
}
1222-
throw new SQLException(String.format("%s value can not be mapped to String.", value.type()));
1222+
throw new SQLException(String.format("%s value can not be mapped to String", value.type()));
12231223
}
12241224

12251225
private static boolean mapToBoolean(Value value) throws SQLException {
@@ -1238,7 +1238,7 @@ else if (number == 1) {
12381238
return true;
12391239
}
12401240
else {
1241-
throw new SQLException("Number values can not be mapped to boolean aside from 0 and 1 values.");
1241+
throw new SQLException("Number values can not be mapped to boolean aside from 0 and 1 values");
12421242
}
12431243
}
12441244
if (Type.STRING.isTypeOf(value)) {
@@ -1250,10 +1250,10 @@ else if ("1".equals(string)) {
12501250
return true;
12511251
}
12521252
else {
1253-
throw new SQLException("String values can not be mapped to boolean aside from '0' and '1' values.");
1253+
throw new SQLException("String values can not be mapped to boolean aside from '0' and '1' values");
12541254
}
12551255
}
1256-
throw new SQLException(String.format("%s value can not be mapped to boolean.", value.type()));
1256+
throw new SQLException(String.format("%s value can not be mapped to boolean", value.type()));
12571257
}
12581258

12591259
private static Byte mapToByte(Value value) throws SQLException {
@@ -1262,12 +1262,12 @@ private static Byte mapToByte(Value value) throws SQLException {
12621262
if (longValue >= Byte.MIN_VALUE && longValue <= Byte.MAX_VALUE) {
12631263
return (byte) longValue;
12641264
}
1265-
throw new SQLException("The number is out of byte range.");
1265+
throw new SQLException("The number is out of byte range");
12661266
}
12671267
if (Type.NULL.isTypeOf(value)) {
12681268
return (byte) 0;
12691269
}
1270-
throw new SQLException(String.format("%s value can not be mapped to byte.", value.type()));
1270+
throw new SQLException(String.format("%s value can not be mapped to byte", value.type()));
12711271
}
12721272

12731273
private static Short mapToShort(Value value) throws SQLException {
@@ -1276,12 +1276,12 @@ private static Short mapToShort(Value value) throws SQLException {
12761276
if (longValue >= Short.MIN_VALUE && longValue <= Short.MAX_VALUE) {
12771277
return (short) longValue;
12781278
}
1279-
throw new SQLException("The number is out of short range.");
1279+
throw new SQLException("The number is out of short range");
12801280
}
12811281
if (Type.NULL.isTypeOf(value)) {
12821282
return (short) 0;
12831283
}
1284-
throw new SQLException(String.format("%s value can not be mapped to short.", value.type()));
1284+
throw new SQLException(String.format("%s value can not be mapped to short", value.type()));
12851285
}
12861286

12871287
private static int mapToInteger(Value value) throws SQLException {
@@ -1290,12 +1290,12 @@ private static int mapToInteger(Value value) throws SQLException {
12901290
if (longValue >= Integer.MIN_VALUE && longValue <= Integer.MAX_VALUE) {
12911291
return (int) longValue;
12921292
}
1293-
throw new SQLException("The number is out of int range.");
1293+
throw new SQLException("The number is out of int range");
12941294
}
12951295
if (Type.NULL.isTypeOf(value)) {
12961296
return 0;
12971297
}
1298-
throw new SQLException(String.format("%s value can not be mapped to int.", value.type()));
1298+
throw new SQLException(String.format("%s value can not be mapped to int", value.type()));
12991299
}
13001300

13011301
private static long mapToLong(Value value) throws SQLException {
@@ -1305,7 +1305,7 @@ private static long mapToLong(Value value) throws SQLException {
13051305
if (Type.NULL.isTypeOf(value)) {
13061306
return 0L;
13071307
}
1308-
throw new SQLException(String.format("%s value can not be mapped to long.", value.type()));
1308+
throw new SQLException(String.format("%s value can not be mapped to long", value.type()));
13091309
}
13101310

13111311
private static float mapToFloat(Value value) throws SQLException {
@@ -1315,12 +1315,12 @@ private static float mapToFloat(Value value) throws SQLException {
13151315
if (Double.compare(doubleValue, floatValue) == 0) {
13161316
return floatValue;
13171317
}
1318-
throw new SQLException("The number is out of float range.");
1318+
throw new SQLException("The number is out of float range");
13191319
}
13201320
if (Type.NULL.isTypeOf(value)) {
13211321
return 0.0f;
13221322
}
1323-
throw new SQLException(String.format("%s value can not be mapped to float.", value.type()));
1323+
throw new SQLException(String.format("%s value can not be mapped to float", value.type()));
13241324
}
13251325

13261326
private static double mapToDouble(Value value) throws SQLException {
@@ -1330,7 +1330,7 @@ private static double mapToDouble(Value value) throws SQLException {
13301330
if (Type.NULL.isTypeOf(value)) {
13311331
return 0.0;
13321332
}
1333-
throw new SQLException(String.format("%s value can not be mapped to double.", value.type()));
1333+
throw new SQLException(String.format("%s value can not be mapped to double", value.type()));
13341334
}
13351335

13361336
private static byte[] mapToBytes(Value value, int maxFieldSize) throws SQLException {
@@ -1340,7 +1340,7 @@ private static byte[] mapToBytes(Value value, int maxFieldSize) throws SQLExcept
13401340
if (Type.BYTES.isTypeOf(value)) {
13411341
return truncate(value.asByteArray(), maxFieldSize);
13421342
}
1343-
throw new SQLException(String.format("%s value can not be mapped to byte array.", value.type()));
1343+
throw new SQLException(String.format("%s value can not be mapped to byte array", value.type()));
13441344
}
13451345

13461346
private static Reader mapToReader(Value value, int maxFieldSize) throws SQLException {
@@ -1350,7 +1350,7 @@ private static Reader mapToReader(Value value, int maxFieldSize) throws SQLExcep
13501350
if (Type.NULL.isTypeOf(value)) {
13511351
return null;
13521352
}
1353-
throw new SQLException(String.format("%s value can not be mapped to Reader.", value.type()));
1353+
throw new SQLException(String.format("%s value can not be mapped to Reader", value.type()));
13541354
}
13551355

13561356
@SuppressWarnings("BigDecimalMethodWithoutRoundingCalled")
@@ -1361,7 +1361,8 @@ private static BigDecimal mapToBigDecimal(Value value, Integer scale) throws SQL
13611361
case INTEGER -> BigDecimal.valueOf(value.asLong());
13621362
case FLOAT -> BigDecimal.valueOf(value.asDouble());
13631363
case NULL -> null;
1364-
default -> throw new SQLException(String.format("%s value can not be mapped to BigDecimal.", value.type()));
1364+
default -> throw new SQLException(
1365+
String.format("%s value can not be mapped to java.math.BigDecimal", value.type()));
13651366
};
13661367

13671368
if (result != null && scale != null) {
@@ -1383,7 +1384,7 @@ private static InputStream mapToAsciiStream(Value value, int maxFieldSize) throw
13831384
if (Type.NULL.isTypeOf(value)) {
13841385
return null;
13851386
}
1386-
throw new SQLException(String.format("%s value can not be mapped to InputStream.", value.type()));
1387+
throw new SQLException(String.format("%s value can not be mapped to java.io.InputStream", value.type()));
13871388
}
13881389

13891390
private static InputStream mapToBinaryStream(Value value, int maxFieldSize) throws SQLException {
@@ -1393,7 +1394,7 @@ private static InputStream mapToBinaryStream(Value value, int maxFieldSize) thro
13931394
if (Type.NULL.isTypeOf(value)) {
13941395
return null;
13951396
}
1396-
throw new SQLException(String.format("%s value can not be mapped to InputStream.", value.type()));
1397+
throw new SQLException(String.format("%s value can not be mapped to java.io.InputStream", value.type()));
13971398
}
13981399

13991400
private static Object mapToObject(Value value, int maxFieldSize) {

neo4j-jdbc/src/main/java/org/neo4j/jdbc/ResultSetMetaDataImpl.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ public <T> T unwrap(Class<T> iface) throws SQLException {
251251
return iface.cast(this);
252252
}
253253
else {
254-
throw new SQLException("This object does not implement the given interface.");
254+
throw new SQLException("This object does not implement the given interface");
255255
}
256256
}
257257

0 commit comments

Comments
 (0)