From b0ba9c3e60305b441956837c8b71479dc6aba825 Mon Sep 17 00:00:00 2001 From: Mark Struberg Date: Sun, 4 Apr 2021 17:09:04 +0200 Subject: [PATCH] code cleanup without functional change * remove unecessary valueOf * remove ;; * remove unused imports * remove unnecessary casts * etc --- .../daytrader/AccountDataBean.java | 2 +- .../integration/daytrader/TestDaytrader.java | 2 +- .../integration/daytrader/TradeAction.java | 2 +- .../integration/daytrader/TradeJPADirect.java | 2 +- .../integration/daytrader/TradeScenario.java | 2 +- .../identifier/ColumnDefIdentifierRule.java | 2 - .../jdbc/kernel/PreparedQueryCacheImpl.java | 4 +- .../jdbc/kernel/PreparedQueryImpl.java | 10 ++--- .../jdbc/kernel/PreparedSQLStoreQuery.java | 2 +- .../openjpa/jdbc/kernel/SQLStoreQuery.java | 2 +- .../openjpa/jdbc/kernel/TableJDBCSeq.java | 9 ++-- .../kernel/exps/JDBCExpressionFactory.java | 2 +- .../openjpa/jdbc/kernel/exps/MapEntry.java | 2 +- .../jdbc/meta/strats/EmbedFieldStrategy.java | 2 +- .../openjpa/jdbc/schema/SchemaTool.java | 4 +- .../openjpa/jdbc/sql/DB2Dictionary.java | 6 +-- .../apache/openjpa/jdbc/sql/DBDictionary.java | 3 +- .../openjpa/jdbc/sql/OracleDictionary.java | 5 --- .../apache/openjpa/jdbc/sql/SelectImpl.java | 2 +- .../openjpa/jdbc/sql/StoredProcedure.java | 2 +- .../jdbc/meta/TestMappingDefaultsImpl.java | 1 - .../jdbc/sql/TestHerdDBDictionary.java | 2 - .../openjpa/persistence/jest/JESTCommand.java | 2 +- .../openjpa/persistence/jest/JESTServlet.java | 2 +- .../persistence/jest/JSONObjectFormatter.java | 2 +- .../persistence/jest/PropertiesCommand.java | 2 +- .../persistence/jest/QueryCommand.java | 2 +- openjpa-jest/src/test/java/demo/Actor.java | 3 +- .../openjpa/conf/CacheMarshallerImpl.java | 3 +- .../openjpa/conf/SpecificationPlugin.java | 2 +- .../openjpa/datacache/AbstractDataCache.java | 2 +- .../datacache/DataCacheStoreManager.java | 2 +- .../datacache/QueryCacheStoreQuery.java | 2 +- .../openjpa/ee/WASRegistryManagedRuntime.java | 3 +- .../enhance/InstrumentationFactory.java | 42 +++++++++---------- .../enhance/ManagedClassSubclasser.java | 2 +- .../apache/openjpa/enhance/PCEnhancer.java | 8 ++-- .../openjpa/enhance/PCEnhancerAgent.java | 4 +- .../apache/openjpa/enhance/Reflection.java | 4 +- .../event/TCPRemoteCommitProvider.java | 2 +- .../openjpa/kernel/AbstractBrokerFactory.java | 2 +- .../org/apache/openjpa/kernel/BrokerImpl.java | 4 +- .../apache/openjpa/kernel/DetachManager.java | 2 +- .../openjpa/kernel/DetachManagerLite.java | 4 +- .../kernel/FetchConfigurationImpl.java | 2 +- .../org/apache/openjpa/kernel/QueryImpl.java | 2 +- .../openjpa/kernel/VersionAttachStrategy.java | 2 +- .../meta/AbstractMetaDataDefaults.java | 2 +- .../apache/openjpa/meta/ClassMetaData.java | 6 +-- .../apache/openjpa/meta/FieldMetaData.java | 8 ++-- .../openjpa/meta/MetaDataRepository.java | 14 +++---- .../openjpa/meta/MultiQueryMetaData.java | 3 +- .../conf/SpecificationAdditionalTests.java | 4 -- .../custom/CustomProxyDefaultScopeList.java | 2 +- .../custom/CustomProxyDefaultScopeType.java | 2 +- .../openjpa/lib/meta/XMLMetaDataParser.java | 7 ++-- .../apache/openjpa/lib/util/StringUtil.java | 2 +- .../openjpa/lib/util/UUIDGenerator.java | 4 +- .../util/collections/AbstractDualBidiMap.java | 12 +++--- .../util/collections/AbstractHashedMap.java | 12 +++--- .../util/collections/AbstractMapEntry.java | 2 +- .../collections/AbstractReferenceMap.java | 2 +- .../lib/util/collections/ComparatorChain.java | 12 +++--- .../lib/util/collections/IteratorChain.java | 6 +-- .../lib/util/collections/TreeBidiMap.java | 12 +++--- .../apache/openjpa/lib/util/git/GitUtils.java | 2 +- .../openjpa/lib/rop/ResultListTest.java | 4 +- .../openjpa/lib/test/AbstractTestCase.java | 2 +- .../lib/util/TestPropertiesParser.java | 12 +++--- .../lib/util/TestTemporaryClassLoader.java | 1 - .../openjpa/lib/xml/TestDocTypeReader.java | 14 +++---- .../apache/openjpa/lib/xml/TestXMLWriter.java | 2 +- .../AnnotationPersistenceMappingParser.java | 4 +- .../JDBCPersistenceProductDerivation.java | 2 - .../jdbc/XMLPersistenceMappingParser.java | 4 +- .../UnenhancedCompoundPKFieldAccess.java | 4 +- ...hancedCompoundPKFieldAccessSuperclass.java | 4 +- .../UnenhancedCompoundPKPropertyAccess.java | 4 +- .../jdbc/kernel/TestJDBCStoreOptSelect.java | 2 +- .../jdbc/meta/strats/AbstractLobTest.java | 2 - .../jdbc/sql/TestDelimitIdentifiers.java | 2 +- .../jira1794/TestAggregateFunctions.java | 1 - .../apache/openjpa/jira2780/Jira2780Enum.java | 2 +- .../openjpa/persistence/access/FieldSub3.java | 1 - .../annotations/TestEJBEmbedded.java | 2 +- .../annotations/TestSerializedLobs.java | 2 +- .../persistence/common/apps/CompUser.java | 2 +- .../common/utils/AbstractTestCase.java | 8 ++-- ...TestContainerSpecCompatibilityOptions.java | 2 +- .../compat/TestSpecCompatibilityOptions.java | 4 +- .../criteria/AbstractCriteriaTestCase.java | 2 +- .../persistence/criteria/CompUser.java | 2 +- .../persistence/criteria/Customer.java | 2 +- .../persistence/criteria/TestSubqueries.java | 2 - .../datacache/TestClearableScheduler.java | 2 +- .../TestDataCacheOptimisticLockRecovery.java | 2 - .../apache/openjpa/persistence/embed/A.java | 2 +- .../embed/EntityA_Coll_String.java | 2 +- .../embed/EntityA_Embed_Complex.java | 2 +- .../openjpa/persistence/embed/Item4.java | 2 +- .../persistence/embed/TestEmbeddableXml.java | 2 +- .../attrOverrides/TestAssocOverridesXML.java | 2 +- .../embed/lazy/TestLazyEmbeddable.java | 2 +- .../enhance/identity/BeneContactId.java | 4 +- .../enhance/identity/Employee.java | 2 +- .../TestMultipleLevelDerivedIdentity1.java | 2 +- .../event/common/apps/Duration.java | 2 +- .../TestMultipleSchemaNames.java | 1 - .../graph/TestPersistentGraph.java | 2 +- .../identity/CompoundBooleanId.java | 2 +- .../inheritance/entities/EntityMapping.java | 2 +- .../jdbc/annotations/TestEJBEmbedded.java | 2 +- .../jdbc/annotations/TestSerializedLobs.java | 2 +- .../jdbc/common/apps/ByteArrayPKPCId.java | 2 +- .../jdbc/common/apps/MappingTest2ID.java | 4 +- .../common/apps/mappingApp/CompositeId.java | 2 +- .../jdbc/kernel/TestCircularFK.java | 4 +- .../jdbc/kernel/TestEfficientAttach.java | 4 +- .../TestCompositeIdTraversalInSQLMapping.java | 2 +- .../spec_10_1_27_ex8/TestSpec10_1_27_Ex8.java | 1 - .../jdbc/meta/TestBuildSchema.java | 2 +- .../jdbc/meta/TestEagerDistinct.java | 4 +- .../jdbc/meta/TestEagerOuterToManyJoins.java | 24 +++++------ .../jdbc/meta/TestMappedByKeyMaps.java | 10 ++--- .../persistence/jdbc/meta/TestRangeQuery.java | 4 +- .../meta/vertical/TestJoinSubclasses.java | 4 +- .../meta/vertical/TestSubclassJoinExtent.java | 4 +- .../vertical/TestSubclassJoinRelations.java | 4 +- .../jdbc/query/TestNamedSQLQueries.java | 4 +- .../jdbc/query/TestSQLQueries.java | 4 +- .../schema/TestClassDBSequenceFactory.java | 12 +++--- .../TestSchemaGenerationProperties.java | 2 +- .../persistence/jdbc/sqlcache/Employee.java | 4 +- .../sqlcache/TestExternalizedParameter.java | 2 +- .../jdbc/strategy/MappedEntity.java | 2 +- .../unique/TestNamedUniqueConstraint.java | 2 +- .../jdbc/update/TestParentChild.java | 4 +- .../persistence/kernel/TestFieldState.java | 2 +- .../kernel/TestPersistentMaps.java | 2 +- .../kernel/TestPessimisticLockException.java | 2 +- .../kernel/TestPessimisticLocking.java | 4 +- .../kernel/TestSecondClassValues.java | 4 +- .../persistence/kernel/common/apps/Blobs.java | 2 +- .../persistence/meta/TestValueStrategies.java | 1 - .../proxy/entities/AnnuityHolderCategory.java | 2 +- .../proxy/entities/AnnuityType.java | 2 +- .../proxy/entities/ContactType.java | 2 +- .../persistence/proxy/entities/RiderType.java | 2 +- .../openjpa/persistence/query/Customer.java | 4 +- .../query/TestQueryEscapeCharacters.java | 2 +- .../persistence/relations/Customer.java | 2 +- .../relations/ManyOneCompoundIdOwnerId.java | 4 +- .../persistence/sequence/TestSequence.java | 2 +- .../persistence/simple/AllFieldTypes.java | 2 +- .../test/AbstractPersistenceTestCase.java | 2 +- .../persistence/test/ClassSelector.java | 2 +- .../test/CombinatorialTestHelper.java | 2 +- .../persistence/test/PersistenceTestCase.java | 2 +- .../persistence/test/SQLListenerTestCase.java | 4 +- .../xmlmapping/entities/Customer.java | 4 +- .../xmlbindings/myaddress/Address.java | 2 +- .../xmlbindings/myaddress/CANAddress.java | 2 +- .../xmlbindings/myaddress/GBRAddress.java | 2 +- .../xmlbindings/myaddress/USAAddress.java | 2 +- .../lock/extended/LockScopeTestCase.java | 4 +- .../lockmgr/SequencedActionsTest.java | 4 +- .../openjpa/persistence/AbstractQuery.java | 12 +++--- .../AnnotationPersistenceMetaDataParser.java | 2 +- .../persistence/HintValueConverter.java | 2 +- .../PersistenceMetaDataDefaults.java | 2 +- .../persistence/PersistenceProviderImpl.java | 6 +-- .../XMLPersistenceMetaDataParser.java | 2 +- .../criteria/CriteriaExpressionBuilder.java | 2 +- .../persistence/criteria/PathImpl.java | 2 +- .../persistence/criteria/SubqueryImpl.java | 1 - .../persistence/meta/CompileTimeLogger.java | 3 +- .../persistence/meta/MetamodelImpl.java | 4 +- .../meta/SourceAnnotationHandler.java | 2 +- .../query/ConditionalOperator.java | 2 +- .../query/QueryDefinitionImpl.java | 4 +- .../persistence/util/ReservedWords.java | 2 +- .../TestPersistenceProductDerivation.java | 2 +- .../java/org/apache/openjpa/slice/Slice.java | 2 +- .../openjpa/slice/PersistenceTestCase.java | 2 +- .../stats/FetchStatisticsAuxEnhancer.java | 4 +- .../xmlstore/simple/AllFieldTypes.java | 2 +- 186 files changed, 316 insertions(+), 353 deletions(-) diff --git a/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/AccountDataBean.java b/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/AccountDataBean.java index 82601f523..3bcf6f7c9 100644 --- a/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/AccountDataBean.java +++ b/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/AccountDataBean.java @@ -283,7 +283,7 @@ public class AccountDataBean implements Serializable { public void login(String password) { AccountProfileDataBean profile = getProfile(); - if ((profile == null) || (profile.getPassword().equals(password) == false)) { + if ((profile == null) || (!profile.getPassword().equals(password))) { String error = "AccountBean:Login failure for account: " + getAccountID() + ((profile == null) ? "null AccountProfile" : "\n\tIncorrect password-->" + profile.getUserID() + ":" + profile.getPassword()); diff --git a/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/TestDaytrader.java b/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/TestDaytrader.java index 71c9a539b..59aa821d9 100644 --- a/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/TestDaytrader.java +++ b/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/TestDaytrader.java @@ -95,7 +95,7 @@ public class TestDaytrader extends AbstractPersistenceTestCase { log.info("TestDaytrader.testTrade() calling TradeScenario.performUserTasks(" + TEST_USERS + ")"); for (int i = 0; i < TEST_USERS; i++) { String userID = "uid:" + i; - if (scenario.performUserTasks(userID) == false) { + if (!scenario.performUserTasks(userID)) { fail("TestDaytrader.testTrade() call to TradeScenario.performUserTask(" + userID + ") failed"); } } diff --git a/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/TradeAction.java b/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/TradeAction.java index a9f842498..62533332f 100644 --- a/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/TradeAction.java +++ b/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/TradeAction.java @@ -89,7 +89,7 @@ public class TradeAction extends TradeJPADirect { setAttribute(sb, "Page", "Account Update"); // First verify input data boolean doUpdate = true; - if (password.equals(cpassword) == false) { + if (!password.equals(cpassword)) { results = "Update profile error: passwords do not match"; doUpdate = false; } else if (password.length() <= 0 || fullName.length() <= 0 diff --git a/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/TradeJPADirect.java b/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/TradeJPADirect.java index 65a4ab0af..24a7df8df 100644 --- a/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/TradeJPADirect.java +++ b/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/TradeJPADirect.java @@ -96,7 +96,7 @@ public class TradeJPADirect { TradeJPADirect.log = log; TradeJPADirect.emf = emf; _poolEm = poolEm; - if (initialized == false) + if (!initialized) init(); } diff --git a/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/TradeScenario.java b/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/TradeScenario.java index 1666ed809..acafeb4a1 100644 --- a/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/TradeScenario.java +++ b/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/TradeScenario.java @@ -220,7 +220,7 @@ public class TradeScenario { * The 'z' action from getScenario denotes that this is a sell action that was switched from a buy * to reduce a sellDeficit */ - if (userID.startsWith(TradeConfig.newUserPrefix) == false) + if (!userID.startsWith(TradeConfig.newUserPrefix)) { TradeConfig.incrementSellDeficit(); } diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/identifier/ColumnDefIdentifierRule.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/identifier/ColumnDefIdentifierRule.java index 1e9a9e158..63cae5504 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/identifier/ColumnDefIdentifierRule.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/identifier/ColumnDefIdentifierRule.java @@ -18,8 +18,6 @@ */ package org.apache.openjpa.jdbc.identifier; -import java.util.Set; - import org.apache.openjpa.jdbc.identifier.DBIdentifier.DBIdentifierType; /** diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PreparedQueryCacheImpl.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PreparedQueryCacheImpl.java index 000b85e11..53d39dd38 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PreparedQueryCacheImpl.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PreparedQueryCacheImpl.java @@ -333,7 +333,7 @@ public class PreparedQueryCacheImpl implements PreparedQueryCache { * - If true, a read lock will be acquired. Else a write lock will be acquired. */ protected void lock(boolean readOnly) { - if (readOnly == true) { + if (readOnly) { _readLock.lock(); } else { _writeLock.lock(); @@ -345,7 +345,7 @@ public class PreparedQueryCacheImpl implements PreparedQueryCache { * - If true, the read lock will be released. Else a write lock will be released. */ protected void unlock(boolean readOnly) { - if (readOnly == true) { + if (readOnly) { _readLock.unlock(); } else { _writeLock.unlock(); diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PreparedQueryImpl.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PreparedQueryImpl.java index 41568aef6..7e06ce79c 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PreparedQueryImpl.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PreparedQueryImpl.java @@ -187,14 +187,14 @@ public class PreparedQueryImpl implements PreparedQuery { return new PreparedQueryCacheImpl.StrongExclusion(_id, _loc.get("exclude-no-select", _id).getMessage()); SQLBuffer buffer = selector.getSQL(); if (buffer == null) - return new PreparedQueryCacheImpl.StrongExclusion(_id, _loc.get("exclude-no-sql", _id).getMessage());; + return new PreparedQueryCacheImpl.StrongExclusion(_id, _loc.get("exclude-no-sql", _id).getMessage()); if (isUsingFieldStrategy()) return new PreparedQueryCacheImpl.StrongExclusion(_id, - _loc.get("exclude-user-strategy", _id).getMessage());; + _loc.get("exclude-user-strategy", _id).getMessage()); if (isPaginated()) return new PreparedQueryCacheImpl.StrongExclusion(_id, - _loc.get("exclude-pagination", _id).getMessage());; + _loc.get("exclude-pagination", _id).getMessage()); setTargetQuery(buffer.getSQL()); setParameters(buffer.getParameters()); @@ -212,14 +212,14 @@ public class PreparedQueryImpl implements PreparedQuery { * not be extracted. */ private Object[] extractSelectExecutor(Object result) { - if (result instanceof ResultList == false) + if (!(result instanceof ResultList)) return new Object[]{null, _loc.get("exclude-not-result", _id)}; Object userObject = ((ResultList)result).getUserObject(); if (userObject == null || !userObject.getClass().isArray() || ((Object[])userObject).length != 2) return new Object[]{null, _loc.get("exclude-no-user-object", _id)}; Object provider = ((Object[])userObject)[0]; Object executor = ((Object[])userObject)[1]; - if (executor instanceof StoreQuery.Executor == false) + if (!(executor instanceof StoreQuery.Executor)) return new Object[]{null, _loc.get("exclude-not-executor", _id)}; _exps = ((StoreQuery.Executor)executor).getQueryExpressions(); for (int i = 0; i < _exps.length; i++) { diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PreparedSQLStoreQuery.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PreparedSQLStoreQuery.java index e5be42a73..9c7105960 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PreparedSQLStoreQuery.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PreparedSQLStoreQuery.java @@ -63,7 +63,7 @@ public class PreparedSQLStoreQuery extends SQLStoreQuery { @Override public boolean setQuery(Object query) { - if (query instanceof PreparedQueryImpl == false) { + if (!(query instanceof PreparedQueryImpl)) { throw new InternalException(query.getClass() + " not recognized"); } _cached = (PreparedQueryImpl)query; diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/SQLStoreQuery.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/SQLStoreQuery.java index 98ad3d646..5d8ffd1c6 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/SQLStoreQuery.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/SQLStoreQuery.java @@ -281,7 +281,7 @@ public class SQLStoreQuery PreparedStatement stmnt, SQLBuffer buf) throws SQLException { int count = 0; - if (_call && stmnt.execute() == false) { + if (_call && !stmnt.execute()) { count = stmnt.getUpdateCount(); } else { diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/TableJDBCSeq.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/TableJDBCSeq.java index 8addd937a..772f6cbfa 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/TableJDBCSeq.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/TableJDBCSeq.java @@ -461,8 +461,7 @@ public class TableJDBCSeq extends AbstractJDBCSeq implements Configurable { } catch(NotSupportedException nse) { SQLException sqlEx = new SQLException( - nse.getLocalizedMessage()); - sqlEx.initCause(nse); + nse.getLocalizedMessage(), nse); throw sqlEx; } } else { @@ -953,8 +952,7 @@ public class TableJDBCSeq extends AbstractJDBCSeq implements Configurable { if (conn != null) { closeConnection(conn); } - RuntimeException re = new RuntimeException(e.getMessage()); - re.initCause(e); + RuntimeException re = new RuntimeException(e.getMessage(), e); throw re; } } @@ -991,8 +989,7 @@ public class TableJDBCSeq extends AbstractJDBCSeq implements Configurable { if (cur != -1 ) // USE the constant current = cur; } catch (SQLException sqle) { - RuntimeException re = new RuntimeException(sqle.getMessage()); - re.initCause(sqle); + RuntimeException re = new RuntimeException(sqle.getMessage(), sqle); throw re; } finally { if (conn != null) { diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/JDBCExpressionFactory.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/JDBCExpressionFactory.java index ab007875a..a7887fad9 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/JDBCExpressionFactory.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/JDBCExpressionFactory.java @@ -635,7 +635,7 @@ public class JDBCExpressionFactory } @Override - public Value coalesceExpression(Value[] vals) {; + public Value coalesceExpression(Value[] vals) { Object[] values = new Val[vals.length]; for (int i = 0; i < vals.length; i++) { values[i] = getLiteralRawString(vals[i]); diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/MapEntry.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/MapEntry.java index f6af0cabb..226be06f5 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/MapEntry.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/MapEntry.java @@ -168,7 +168,7 @@ public class MapEntry @Override public boolean equals(Object other) { - if (other instanceof Map.Entry == false) + if (!(other instanceof Map.Entry)) return false; Map.Entry that = (Map.Entry)other; return (this.key == null ? diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/EmbedFieldStrategy.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/EmbedFieldStrategy.java index ac86302cc..629d11101 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/EmbedFieldStrategy.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/EmbedFieldStrategy.java @@ -478,7 +478,7 @@ public class EmbedFieldStrategy } // A field expected to be loaded eagerly was missing from the ResultSet. - if (containsUnloadedEagerField == true) { + if (containsUnloadedEagerField) { return false; } diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/SchemaTool.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/SchemaTool.java index 32a803ce5..ac9dc0cfc 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/SchemaTool.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/SchemaTool.java @@ -40,8 +40,6 @@ import java.util.LinkedList; import java.util.List; import java.util.Set; -import java.util.stream.Collectors; -import java.util.stream.Stream; import javax.sql.DataSource; import org.apache.openjpa.conf.OpenJPAConfiguration; @@ -883,7 +881,7 @@ public class SchemaTool { for (int i = 0; i < schemas.length; i++) { tabs = schemas[i].getTables(); for (int j = 0; j < tabs.length; j++) - if (!!isDroppable(tabs[j]) + if (isDroppable(tabs[j]) && repos.findTable(tabs[j]) == null) drops.add(tabs[j]); } diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java index dfd517f07..0ee29208f 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java @@ -567,7 +567,7 @@ public class DB2Dictionary if (sel != null && sel.getExpectedResultCount() > 0) { StringBuilder buf = new StringBuilder(); buf.append(" ").append(optimizeClause).append(" ") - .append(String.valueOf(sel.getExpectedResultCount())) + .append(sel.getExpectedResultCount()) .append(" ").append(rowClause); return buf.toString(); } @@ -577,7 +577,7 @@ public class DB2Dictionary @Override public OpenJPAException newStoreException(String msg, SQLException[] causes, Object failed) { - if (appendExtendedExceptionText == true && causes != null && causes.length > 0) { + if (appendExtendedExceptionText && causes != null && causes.length > 0) { msg = appendExtendedExceptionMsg(msg, causes[0]); } return super.newStoreException(msg, causes, failed); @@ -844,7 +844,7 @@ public class DB2Dictionary if (col.getType() != Types.VARCHAR) { doCast = true; } - if (doCast == true) { + if (doCast) { if (func.indexOf("VARCHAR") == -1) { func = addCastAsString(func, "{0}", " AS VARCHAR(" + varcharCastLength + ")"); } diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java index e4ae5bf60..87b6fc29c 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java @@ -336,7 +336,8 @@ public class DBDictionary * database will become '2010-01-01 12:00:00.687' in the Date field * of the entity. */ - public enum DateMillisecondBehaviors { DROP, ROUND, RETAIN }; + public enum DateMillisecondBehaviors { DROP, ROUND, RETAIN } + private DateMillisecondBehaviors dateMillisecondBehavior; /** diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/OracleDictionary.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/OracleDictionary.java index 0b30cb32b..9555640c2 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/OracleDictionary.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/OracleDictionary.java @@ -34,11 +34,6 @@ import java.sql.SQLException; import java.sql.Statement; import java.sql.Timestamp; import java.sql.Types; -import java.time.LocalDate; -import java.time.LocalDateTime; -import java.time.LocalTime; -import java.time.OffsetDateTime; -import java.time.OffsetTime; import java.util.ArrayList; import java.util.Arrays; import java.util.Calendar; diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SelectImpl.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SelectImpl.java index 515727349..82ec97021 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SelectImpl.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SelectImpl.java @@ -3018,7 +3018,7 @@ public class SelectImpl @Override public String toString() { return "PathJoinsImpl<" + hashCode() + ">: " - + String.valueOf(path); + + path; } @Override diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/StoredProcedure.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/StoredProcedure.java index c90c07da5..2ec0262d9 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/StoredProcedure.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/StoredProcedure.java @@ -66,7 +66,7 @@ public class StoredProcedure { */ public enum PARAM {UNKNOW, IN, INOUT, RESULT, OUT, RETURN} - public enum SQL {NONE,MODIFY,READ, CONTAINS}; + public enum SQL {NONE,MODIFY,READ, CONTAINS} /** * Create a procedure of the given name. diff --git a/openjpa-jdbc/src/test/java/org/apache/openjpa/jdbc/meta/TestMappingDefaultsImpl.java b/openjpa-jdbc/src/test/java/org/apache/openjpa/jdbc/meta/TestMappingDefaultsImpl.java index 99dbf718c..5a2289cb0 100644 --- a/openjpa-jdbc/src/test/java/org/apache/openjpa/jdbc/meta/TestMappingDefaultsImpl.java +++ b/openjpa-jdbc/src/test/java/org/apache/openjpa/jdbc/meta/TestMappingDefaultsImpl.java @@ -25,7 +25,6 @@ import org.apache.openjpa.jdbc.schema.Table; import org.junit.Test; -import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotEquals; public class TestMappingDefaultsImpl { diff --git a/openjpa-jdbc/src/test/java/org/apache/openjpa/jdbc/sql/TestHerdDBDictionary.java b/openjpa-jdbc/src/test/java/org/apache/openjpa/jdbc/sql/TestHerdDBDictionary.java index be88b2645..756aa1010 100644 --- a/openjpa-jdbc/src/test/java/org/apache/openjpa/jdbc/sql/TestHerdDBDictionary.java +++ b/openjpa-jdbc/src/test/java/org/apache/openjpa/jdbc/sql/TestHerdDBDictionary.java @@ -30,8 +30,6 @@ import javax.sql.DataSource; import org.apache.openjpa.jdbc.conf.JDBCConfiguration; import org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl; import org.apache.openjpa.jdbc.identifier.DBIdentifier; -import org.apache.openjpa.jdbc.identifier.DBIdentifierUtil; -import org.apache.openjpa.jdbc.identifier.DBIdentifierUtilImpl; import org.apache.openjpa.jdbc.schema.Column; import org.apache.openjpa.jdbc.schema.ForeignKey; import org.apache.openjpa.jdbc.schema.Schema; diff --git a/openjpa-jest/src/main/java/org/apache/openjpa/persistence/jest/JESTCommand.java b/openjpa-jest/src/main/java/org/apache/openjpa/persistence/jest/JESTCommand.java index f7570f90c..204edef9b 100644 --- a/openjpa-jest/src/main/java/org/apache/openjpa/persistence/jest/JESTCommand.java +++ b/openjpa-jest/src/main/java/org/apache/openjpa/persistence/jest/JESTCommand.java @@ -60,7 +60,7 @@ public interface JESTCommand { /** * Supported format monikers. */ - public static enum Format {xml, json}; + public static enum Format {xml, json} /** * Get the execution context of this command. diff --git a/openjpa-jest/src/main/java/org/apache/openjpa/persistence/jest/JESTServlet.java b/openjpa-jest/src/main/java/org/apache/openjpa/persistence/jest/JESTServlet.java index 131cc0d59..e99adfaaf 100644 --- a/openjpa-jest/src/main/java/org/apache/openjpa/persistence/jest/JESTServlet.java +++ b/openjpa-jest/src/main/java/org/apache/openjpa/persistence/jest/JESTServlet.java @@ -154,7 +154,7 @@ public class JESTServlet extends HttpServlet { @Override public void destroy() { _emf = null; - _unit = null;; + _unit = null; } private void debug(HttpServletRequest r) { diff --git a/openjpa-jest/src/main/java/org/apache/openjpa/persistence/jest/JSONObjectFormatter.java b/openjpa-jest/src/main/java/org/apache/openjpa/persistence/jest/JSONObjectFormatter.java index a574e77d5..360b1c142 100644 --- a/openjpa-jest/src/main/java/org/apache/openjpa/persistence/jest/JSONObjectFormatter.java +++ b/openjpa-jest/src/main/java/org/apache/openjpa/persistence/jest/JSONObjectFormatter.java @@ -131,7 +131,7 @@ public class JSONObjectFormatter implements ObjectFormatter { } boolean ref = !visited.add(sm); - JSONObject root = new JSONObject(typeOf(sm), sm.getObjectId(), ref);; + JSONObject root = new JSONObject(typeOf(sm), sm.getObjectId(), ref); if (ref) { return root; } diff --git a/openjpa-jest/src/main/java/org/apache/openjpa/persistence/jest/PropertiesCommand.java b/openjpa-jest/src/main/java/org/apache/openjpa/persistence/jest/PropertiesCommand.java index 578889be5..88b84d6b0 100644 --- a/openjpa-jest/src/main/java/org/apache/openjpa/persistence/jest/PropertiesCommand.java +++ b/openjpa-jest/src/main/java/org/apache/openjpa/persistence/jest/PropertiesCommand.java @@ -66,7 +66,7 @@ public class PropertiesCommand extends AbstractCommand { private void removeBadEntries(Map map) { Iterator keys = map.keySet().iterator(); - for (; keys.hasNext();) { + while (keys.hasNext()) { if (keys.next().indexOf(DOT) == -1) keys.remove(); } } diff --git a/openjpa-jest/src/main/java/org/apache/openjpa/persistence/jest/QueryCommand.java b/openjpa-jest/src/main/java/org/apache/openjpa/persistence/jest/QueryCommand.java index 505723267..64b3ddcd9 100644 --- a/openjpa-jest/src/main/java/org/apache/openjpa/persistence/jest/QueryCommand.java +++ b/openjpa-jest/src/main/java/org/apache/openjpa/persistence/jest/QueryCommand.java @@ -32,7 +32,7 @@ import java.util.Map; import javax.persistence.Query; import org.apache.openjpa.persistence.ArgumentException; -import org.apache.openjpa.persistence.OpenJPAEntityManager;; +import org.apache.openjpa.persistence.OpenJPAEntityManager; /** * Executes query. diff --git a/openjpa-jest/src/test/java/demo/Actor.java b/openjpa-jest/src/test/java/demo/Actor.java index cbc0b4b27..df6c8f2c9 100644 --- a/openjpa-jest/src/test/java/demo/Actor.java +++ b/openjpa-jest/src/test/java/demo/Actor.java @@ -46,7 +46,8 @@ import org.apache.openjpa.persistence.FetchGroups; }) }) public class Actor { - public static enum Gender {Male, Female}; + public static enum Gender {Male, Female} + @Id private String id; private String firstName; diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/conf/CacheMarshallerImpl.java b/openjpa-kernel/src/main/java/org/apache/openjpa/conf/CacheMarshallerImpl.java index 523391c14..6f3d0b1bd 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/conf/CacheMarshallerImpl.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/conf/CacheMarshallerImpl.java @@ -253,8 +253,7 @@ public class CacheMarshallerImpl } catch (IOException ioe) { IllegalStateException ise = new IllegalStateException( _loc.get("cache-marshaller-bad-url", getId(), - _inputResourceLocation).getMessage()); - ise.initCause(ioe); + _inputResourceLocation).getMessage(), ioe); throw ise; } } diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/conf/SpecificationPlugin.java b/openjpa-kernel/src/main/java/org/apache/openjpa/conf/SpecificationPlugin.java index 12a2dbac3..3fe100fae 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/conf/SpecificationPlugin.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/conf/SpecificationPlugin.java @@ -72,7 +72,7 @@ public class SpecificationPlugin extends ObjectValue implements ValueListener { super.set(null); return; } - if (obj instanceof Specification == false) { + if (!(obj instanceof Specification)) { throw new UserException(_loc.get("spec-wrong-obj", obj, obj.getClass())).setFatal(true); } diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/AbstractDataCache.java b/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/AbstractDataCache.java index eff64cf04..e21f6992f 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/AbstractDataCache.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/AbstractDataCache.java @@ -91,7 +91,7 @@ public abstract class AbstractDataCache extends AbstractConcurrentEventManager _name = name; } public void setEnableStatistics(boolean enable){ - if(enable == true){ + if(enable){ _stats.enable(); } } diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/DataCacheStoreManager.java b/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/DataCacheStoreManager.java index 45bfbe778..df38d1bdb 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/DataCacheStoreManager.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/DataCacheStoreManager.java @@ -310,7 +310,7 @@ public class DataCacheStoreManager extends DelegatingStoreManager { for(int i = 0; i < oids.size(); i++) { Object oid = oids.get(i); // Only check the cache if we haven't found the current oid. - if (edata.get(i) == false && cache.contains(oid)) { + if (!edata.get(i) && cache.contains(oid)) { edata.set(i); } } diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/QueryCacheStoreQuery.java b/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/QueryCacheStoreQuery.java index 9e5532660..55fc3a594 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/QueryCacheStoreQuery.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/QueryCacheStoreQuery.java @@ -157,7 +157,7 @@ public class QueryCacheStoreQuery if (projs == 0) { // We're only going to return the cached results if we have ALL results cached. This could be improved // in the future to be a little more intelligent. - if (getContext().getStoreContext().isCached(res) == false) { + if (!getContext().getStoreContext().isCached(res)) { return null; } } diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/ee/WASRegistryManagedRuntime.java b/openjpa-kernel/src/main/java/org/apache/openjpa/ee/WASRegistryManagedRuntime.java index 71cffa8a0..57cc1a193 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/ee/WASRegistryManagedRuntime.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/ee/WASRegistryManagedRuntime.java @@ -64,8 +64,7 @@ public class WASRegistryManagedRuntime extends RegistryManagedRuntime { } catch(Exception e ) { - RuntimeException re = new RuntimeException(e.getMessage()); - re.initCause(e); + RuntimeException re = new RuntimeException(e.getMessage(), e); throw re; } } diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/InstrumentationFactory.java b/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/InstrumentationFactory.java index 351675049..6e94635b9 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/InstrumentationFactory.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/InstrumentationFactory.java @@ -81,7 +81,7 @@ public class InstrumentationFactory { * Exceptions are encountered. */ public static synchronized Instrumentation getInstrumentation(final Log log) { - if (log.isTraceEnabled() == true) { + if (log.isTraceEnabled()) { log.trace(_name + ".getInstrumentation() _inst:" + _inst + " _dynamicallyInstall:" + _dynamicallyInstall); } @@ -106,7 +106,7 @@ public class InstrumentationFactory { File toolsJar = null; // When running on IBM, the attach api classes are packaged in vm.jar which is a part // of the default vm classpath. - if (vendor.isIBM() == false) { + if (!vendor.isIBM()) { // If we can't find the tools.jar and we're not on IBM we can't load the agent. toolsJar = findToolsJar(log); if (toolsJar == null) { @@ -160,7 +160,7 @@ public class InstrumentationFactory { .println("Agent-Class: " + InstrumentationFactory.class.getName()); writer.println("Can-Redefine-Classes: true"); // IBM doesn't support retransform - writer.println("Can-Retransform-Classes: " + Boolean.toString(JavaVendors.getCurrentVendor().isIBM() == false)); + writer.println("Can-Retransform-Classes: " + (!JavaVendors.getCurrentVendor().isIBM())); writer.close(); @@ -179,27 +179,27 @@ public class InstrumentationFactory { File javaHomeFile = new File(javaHome); File toolsJarFile = new File(javaHomeFile, "lib" + File.separator + "tools.jar"); - if (toolsJarFile.exists() == false) { - if (log.isTraceEnabled() == true) { + if (!toolsJarFile.exists()) { + if (log.isTraceEnabled()) { log.trace(_name + ".findToolsJar() -- couldn't find default " + toolsJarFile.getAbsolutePath()); } // If we're on an IBM SDK, then remove /jre off of java.home and try again. - if (javaHomeFile.getAbsolutePath().endsWith(File.separator + "jre") == true) { + if (javaHomeFile.getAbsolutePath().endsWith(File.separator + "jre")) { javaHomeFile = javaHomeFile.getParentFile(); toolsJarFile = new File(javaHomeFile, "lib" + File.separator + "tools.jar"); - if (toolsJarFile.exists() == false) { - if (log.isTraceEnabled() == true) { + if (!toolsJarFile.exists()) { + if (log.isTraceEnabled()) { log.trace(_name + ".findToolsJar() -- for IBM SDK couldn't find " + toolsJarFile.getAbsolutePath()); } } } else if (System.getProperty("os.name").toLowerCase(Locale.ENGLISH).indexOf("mac") >= 0) { // If we're on a Mac, then change the search path to use ../Classes/classes.jar. - if (javaHomeFile.getAbsolutePath().endsWith(File.separator + "Home") == true) { + if (javaHomeFile.getAbsolutePath().endsWith(File.separator + "Home")) { javaHomeFile = javaHomeFile.getParentFile(); toolsJarFile = new File(javaHomeFile, "Classes" + File.separator + "classes.jar"); - if (toolsJarFile.exists() == false) { - if (log.isTraceEnabled() == true) { + if (!toolsJarFile.exists()) { + if (log.isTraceEnabled()) { log.trace(_name + ".findToolsJar() -- for Mac OS couldn't find " + toolsJarFile.getAbsolutePath()); } @@ -208,10 +208,10 @@ public class InstrumentationFactory { } } - if (toolsJarFile.exists() == false) { + if (!toolsJarFile.exists()) { return null; } else { - if (log.isTraceEnabled() == true) { + if (log.isTraceEnabled()) { log.trace(_name + ".findToolsJar() -- found " + toolsJarFile.getAbsolutePath()); } return toolsJarFile; @@ -245,26 +245,26 @@ public class InstrumentationFactory { // class defined as the Agent-Class. boolean createJar = false; if (cs == null || agentJarFile == null - || agentJarFile.isDirectory() == true) { + || agentJarFile.isDirectory()) { createJar = true; - }else if(validateAgentJarManifest(agentJarFile, log, _name) == false){ + }else if(!validateAgentJarManifest(agentJarFile, log, _name)){ // We have an agentJarFile, but this class isn't the Agent-Class. createJar=true; } String agentJar; - if (createJar == true) { + if (createJar) { // This can happen when running in eclipse as an OpenJPA // developer or for some reason the CodeSource is null. We // should log a warning here because this will create a jar // in your temp directory that doesn't always get cleaned up. try { agentJar = createAgentJar(); - if (log.isInfoEnabled() == true) { + if (log.isInfoEnabled()) { log.info(_loc.get("temp-file-creation", agentJar)); } } catch (IOException ioe) { - if (log.isTraceEnabled() == true) { + if (log.isTraceEnabled()) { log.trace(_name + ".getAgentJar() caught unexpected " + "exception.", ioe); } @@ -310,7 +310,7 @@ public class InstrumentationFactory { vmClass.getMethod("detach", new Class[] {}).invoke(vm, new Object[] {}); } catch (Throwable t) { - if (log.isTraceEnabled() == true) { + if (log.isTraceEnabled()) { // Log the message from the exception. Don't log the entire // stack as this is expected when running on a JDK that doesn't // support the Attach API. @@ -336,7 +336,7 @@ public class InstrumentationFactory { try { ClassLoader loader = Thread.currentThread().getContextClassLoader(); String cls = vendor.getVirtualMachineClassName(); - if (vendor.isIBM() == false) { + if (!vendor.isIBM()) { loader = new URLClassLoader(new URL[] { toolsJar.toURI().toURL() }, loader); } return loader.loadClass(cls); @@ -374,7 +374,7 @@ public class InstrumentationFactory { return true; } } catch (Exception e) { - if (log.isTraceEnabled() == true) { + if (log.isTraceEnabled()) { log.trace(_name + ".validateAgentJarManifest() caught unexpected " + "exception " + e.getMessage()); diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/ManagedClassSubclasser.java b/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/ManagedClassSubclasser.java index 0a7d3769c..8f6ef99ac 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/ManagedClassSubclasser.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/ManagedClassSubclasser.java @@ -95,7 +95,7 @@ public class ManagedClassSubclasser { if (!PersistenceCapable.class.isAssignableFrom(cls)) unenhanced.add(cls); if (unenhanced.size() > 0) { - if (PCEnhancerAgent.getLoadSuccessful() == true) { + if (PCEnhancerAgent.getLoadSuccessful()) { // This means that the enhancer has been ran but we // have some unenhanced classes. This can happen if an // entity is loaded by the JVM before the EntityManger diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCEnhancer.java b/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCEnhancer.java index 73672b731..c303a7665 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCEnhancer.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCEnhancer.java @@ -1181,7 +1181,7 @@ public class PCEnhancer { addCopyKeyFieldsToObjectIdMethod(false); addCopyKeyFieldsFromObjectIdMethod(true); addCopyKeyFieldsFromObjectIdMethod(false); - if (_meta.hasAbstractPKField() == true) { + if (_meta.hasAbstractPKField()) { addGetIDOwningClass(); } @@ -2745,7 +2745,7 @@ public class PCEnhancer { // new ObjectId (cls, oid) code.anew().setType(ObjectId.class); code.dup(); - if(_meta.isEmbeddedOnly() || _meta.hasAbstractPKField() == true) { + if(_meta.isEmbeddedOnly() || _meta.hasAbstractPKField()) { code.aload().setThis(); code.invokevirtual().setMethod(PRE + "GetIDOwningClass", Class.class, null); @@ -2760,7 +2760,7 @@ public class PCEnhancer { if (_meta.isOpenJPAIdentity() || (obj && usesClsString == Boolean.TRUE)) { if ((_meta.isEmbeddedOnly() && !(_meta.isEmbeddable() && _meta.getIdentityType() == ClassMetaData.ID_APPLICATION)) - || _meta.hasAbstractPKField() == true) { + || _meta.hasAbstractPKField()) { code.aload().setThis(); code.invokevirtual().setMethod(PRE + "GetIDOwningClass", Class.class, null); } else { @@ -3879,7 +3879,7 @@ public class PCEnhancer { loadManagedInstance(code, true, fmd); code.xload().setParam(firstParamOffset); addSetManagedValueCode(code, fmd); - if(fmd.isVersion()==true && _addVersionInitFlag){ + if(fmd.isVersion() && _addVersionInitFlag){ // if we are setting the version, flip the versionInit flag to true loadManagedInstance(code, true); code.constant().setValue(1); diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCEnhancerAgent.java b/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCEnhancerAgent.java index 83f68485a..59bd3d2b1 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCEnhancerAgent.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCEnhancerAgent.java @@ -88,7 +88,7 @@ public class PCEnhancerAgent { * @return True if the agent is loaded successfully */ public static synchronized boolean loadDynamicAgent(Log log) { - if (loadAttempted == false && disableDynamicAgent == false) { + if (!loadAttempted && !disableDynamicAgent) { Instrumentation inst = InstrumentationFactory.getInstrumentation(log); if (inst != null) { @@ -113,7 +113,7 @@ public class PCEnhancerAgent { // The agent will be disabled when running in an application // server. synchronized (PCEnhancerAgent.class) { - if (loadAttempted == true) { + if (loadAttempted) { return; } // See the comment in loadDynamicAgent as to why we set this to true diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/Reflection.java b/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/Reflection.java index 4aad92346..3cf6e88a9 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/Reflection.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/Reflection.java @@ -946,9 +946,9 @@ public class Reflection { */ static boolean canReflect(Reflectable cls, Reflectable member) { if (cls == null || cls.value()) { - return member == null || member.value() == true; + return member == null || member.value(); } else { - return member != null && member.value() == true; + return member != null && member.value(); } } diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/event/TCPRemoteCommitProvider.java b/openjpa-kernel/src/main/java/org/apache/openjpa/event/TCPRemoteCommitProvider.java index ab4793c79..8563b04be 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/event/TCPRemoteCommitProvider.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/event/TCPRemoteCommitProvider.java @@ -337,7 +337,7 @@ public class TCPRemoteCommitProvider public void broadcast(final RemoteCommitEvent event) { // build a packet notifying other JVMs of object changes. try (ByteArrayOutputStream baos = new ByteArrayOutputStream(); - ObjectOutputStream oos = new ObjectOutputStream(baos);) { + ObjectOutputStream oos = new ObjectOutputStream(baos)) { oos.writeLong(PROTOCOL_VERSION); oos.writeLong(_id); diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/AbstractBrokerFactory.java b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/AbstractBrokerFactory.java index f3d8266b9..ac35e725d 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/AbstractBrokerFactory.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/AbstractBrokerFactory.java @@ -896,7 +896,7 @@ public abstract class AbstractBrokerFactory implements BrokerFactory { // Don't get a MetaDataRepository yet if not preloading because it is possible that someone has extended the MDR // and the extension hasn't been plugged in yet. - if (MetaDataRepository.needsPreload(_conf) == true) { + if (MetaDataRepository.needsPreload(_conf)) { // Don't catch any exceptions here because we want to fail-fast if something bad happens when we're // preloading. MetaDataRepository mdr = _conf.getMetaDataRepositoryInstance(); diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/BrokerImpl.java b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/BrokerImpl.java index 664296697..e8d893dde 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/BrokerImpl.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/BrokerImpl.java @@ -2457,7 +2457,7 @@ public class BrokerImpl implements Broker, FindCallbacks, Cloneable, Serializabl } } if (opt && !failed.isEmpty()) { - if(_suppressBatchOLELogging == true){ + if(_suppressBatchOLELogging){ return new OptimisticException(_loc.get("broker-suppressing-exceptions",t.length)); }else{ return new OptimisticException(failed, t); @@ -3568,7 +3568,7 @@ public class BrokerImpl implements Broker, FindCallbacks, Cloneable, Serializabl } private void detachAllInternal(OpCallbacks call) { - if(_conf.getDetachStateInstance().getLiteAutoDetach() == true){ + if(_conf.getDetachStateInstance().getLiteAutoDetach()){ detachAllInternalLite(); return; } diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/DetachManager.java b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/DetachManager.java index e7084f724..beb1c7f1d 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/DetachManager.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/DetachManager.java @@ -291,7 +291,7 @@ public class DetachManager _copy = false; } else { - _copy = compatibility.getCopyOnDetach();; + _copy = compatibility.getCopyOnDetach(); } } diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/DetachManagerLite.java b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/DetachManagerLite.java index 7d04ca474..5d0cdcd2e 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/DetachManagerLite.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/DetachManagerLite.java @@ -51,7 +51,7 @@ public class DetachManagerLite { ClassMetaData cmd = sm.getMetaData(); if (sm.isPersistent() && cmd.isDetachable()) { PersistenceCapable pc = sm.getPersistenceCapable(); - if (pc.pcIsDetached() == false) { + if (!pc.pcIsDetached()) { // Detach proxy fields. BitSet loaded = sm.getLoaded(); for (FieldMetaData fmd : cmd.getProxyFields()) { @@ -79,7 +79,7 @@ public class DetachManagerLite { StateManagerImpl sm, TransferFieldManager fm) { int fieldIndex = fmd.getIndex(); - if (fmd.isLRS() == true) { + if (fmd.isLRS()) { // need to null out LRS fields. nullField(fieldIndex, pc, sm, fm); } else { diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/FetchConfigurationImpl.java b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/FetchConfigurationImpl.java index c77d6e904..6a36bd671 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/FetchConfigurationImpl.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/FetchConfigurationImpl.java @@ -253,7 +253,7 @@ public class FetchConfigurationImpl void copyHints(FetchConfiguration fetch) { - if (fetch instanceof FetchConfigurationImpl == false) + if (!(fetch instanceof FetchConfigurationImpl)) return; FetchConfigurationImpl from = (FetchConfigurationImpl)fetch; if (from._state == null || from._state.hints == null) diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/QueryImpl.java b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/QueryImpl.java index a316b89e7..e0a9b0832 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/QueryImpl.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/QueryImpl.java @@ -1258,7 +1258,7 @@ public class QueryImpl implements Query { s = toString(); String msg = "executing-query"; - if (params.isEmpty() == false) { + if (!params.isEmpty()) { msg = "executing-query-with-params"; } diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/VersionAttachStrategy.java b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/VersionAttachStrategy.java index 085032969..4eecec645 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/VersionAttachStrategy.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/VersionAttachStrategy.java @@ -193,7 +193,7 @@ class VersionAttachStrategy Object pcField = Reflection.get(pc, pcVersionInitField); if (pcField != null) { boolean bool = (Boolean) pcField; - if (bool == false) { + if (!bool) { // If this field if false, that means that the pcGetVersion returned a default value rather than // and actual value. version = null; diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/meta/AbstractMetaDataDefaults.java b/openjpa-kernel/src/main/java/org/apache/openjpa/meta/AbstractMetaDataDefaults.java index f45e2ea53..9a464086a 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/meta/AbstractMetaDataDefaults.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/meta/AbstractMetaDataDefaults.java @@ -288,7 +288,7 @@ public abstract class AbstractMetaDataDefaults public static String getFieldName(Member member) { if (member instanceof Field) return member.getName(); - if (member instanceof Method == false) + if (!(member instanceof Method)) return null; Method method = (Method) member; String name = method.getName(); diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/meta/ClassMetaData.java b/openjpa-kernel/src/main/java/org/apache/openjpa/meta/ClassMetaData.java index 77e79a79c..c40840e8d 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/meta/ClassMetaData.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/meta/ClassMetaData.java @@ -1051,7 +1051,7 @@ public class ClassMetaData } List res = new ArrayList<>(); for (FieldMetaData fmd : _allFields) { - if(fmd.isLRS()==true){ + if(fmd.isLRS()){ res.add(fmd); } } @@ -1127,7 +1127,6 @@ public class ClassMetaData if (_fields == null) { List fields = new ArrayList<>(_fieldMap.size()); - ; for (FieldMetaData fmd : _fieldMap.values()) { if (fmd.getManagement() != FieldMetaData.MANAGE_NONE) { fmd.setDeclaredIndex(fields.size()); @@ -1290,7 +1289,6 @@ public class ClassMetaData public FieldMetaData[] getDeclaredUnmanagedFields() { if (_unmgdFields == null) { List unmanaged = new ArrayList<>(3); - ; for (FieldMetaData field : _fieldMap.values()) { if (field.getManagement() == FieldMetaData.MANAGE_NONE) unmanaged.add(field); @@ -2714,7 +2712,7 @@ public class ClassMetaData // declares a PKField. Boolean temp = Boolean.FALSE; - if (isAbstract() == true) { + if (isAbstract()) { FieldMetaData[] declaredFields = getDeclaredFields(); if (declaredFields != null && declaredFields.length != 0) { for (FieldMetaData fmd : declaredFields) { diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/meta/FieldMetaData.java b/openjpa-kernel/src/main/java/org/apache/openjpa/meta/FieldMetaData.java index 4d5fa2620..3ea4388f9 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/meta/FieldMetaData.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/meta/FieldMetaData.java @@ -2362,13 +2362,11 @@ public class FieldMetaData cls, memberName, parameterTypes)); } } catch (SecurityException e) { - IOException ioe = new IOException(e.getMessage()); - ioe.initCause(e); + IOException ioe = new IOException(e.getMessage(), e); throw ioe; } catch (PrivilegedActionException pae) { IOException ioe = new IOException( - pae.getException().getMessage()); - ioe.initCause(pae); + pae.getException().getMessage(), pae); throw ioe; } } @@ -2465,7 +2463,7 @@ public class FieldMetaData } return _relationType; } - private class Unknown{}; + private class Unknown{} public boolean isDelayCapable() { if (_delayCapable != null) { diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/meta/MetaDataRepository.java b/openjpa-kernel/src/main/java/org/apache/openjpa/meta/MetaDataRepository.java index 94c1fb602..f30512522 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/meta/MetaDataRepository.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/meta/MetaDataRepository.java @@ -314,11 +314,11 @@ public class MetaDataRepository implements PCRegistry.RegisterClassListener, Con * MetaData for all persistent classes and will remove locking from this class. */ public synchronized void preload() { - if (_preload == false) { + if (!_preload) { return; } // If pooling EMFs, this method may be invoked more than once. Only perform this work once. - if (_preloadComplete == true) { + if (_preloadComplete) { return; } @@ -341,7 +341,7 @@ public class MetaDataRepository implements PCRegistry.RegisterClassListener, Con if (classes == null || classes.size() == 0) { throw new MetaDataException(_loc.get("repos-initializeEager-none")); } - if (_log.isTraceEnabled() == true) { + if (_log.isTraceEnabled()) { _log.trace(_loc.get("repos-initializeEager-found", classes)); } @@ -1960,7 +1960,7 @@ public class MetaDataRepository implements PCRegistry.RegisterClassListener, Con initializeMetaDataFactory(); if (_implGen == null) _implGen = new InterfaceImplGenerator(this); - if (_preload == true) { + if (_preload) { _oids = new HashMap<>(); _impls = new HashMap<>(); _ifaces = new HashMap<>(); @@ -2533,7 +2533,7 @@ public class MetaDataRepository implements PCRegistry.RegisterClassListener, Con if (conf == null) return false; Options o = Configurations.parseProperties(Configurations.getProperties(conf.getMetaDataRepository())); - if (o.getBooleanProperty(PRELOAD_STR) == true || o.getBooleanProperty(PRELOAD_STR.toLowerCase()) == true) { + if (o.getBooleanProperty(PRELOAD_STR) || o.getBooleanProperty(PRELOAD_STR.toLowerCase())) { return true; } return false; @@ -2544,12 +2544,12 @@ public class MetaDataRepository implements PCRegistry.RegisterClassListener, Con * is older than the current version. */ private void checkEnhancementLevel(Class cls) { - if (_logEnhancementLevel == false) { + if (!_logEnhancementLevel) { return; } Log log = _conf.getLog(OpenJPAConfiguration.LOG_RUNTIME); boolean res = PCEnhancer.checkEnhancementLevel(cls, _conf.getLog(OpenJPAConfiguration.LOG_RUNTIME)); - if (log.isTraceEnabled() == false && res == true) { + if (!log.isTraceEnabled() && res) { // Since trace isn't enabled flip the flag so we only log this once. _logEnhancementLevel = false; log.info(_loc.get("down-level-entity")); diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/meta/MultiQueryMetaData.java b/openjpa-kernel/src/main/java/org/apache/openjpa/meta/MultiQueryMetaData.java index f8793e3d2..8624337b6 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/meta/MultiQueryMetaData.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/meta/MultiQueryMetaData.java @@ -147,7 +147,8 @@ public class MultiQueryMetaData extends QueryMetaData { * */ public static class Parameter { - public enum Mode {IN,OUT,INOUT,CURSOR}; + public enum Mode {IN,OUT,INOUT,CURSOR} + private final String name; private final Class type; private final Mode mode; diff --git a/openjpa-kernel/src/test/java/org/apache/openjpa/conf/SpecificationAdditionalTests.java b/openjpa-kernel/src/test/java/org/apache/openjpa/conf/SpecificationAdditionalTests.java index e908fbf17..a258e9aea 100644 --- a/openjpa-kernel/src/test/java/org/apache/openjpa/conf/SpecificationAdditionalTests.java +++ b/openjpa-kernel/src/test/java/org/apache/openjpa/conf/SpecificationAdditionalTests.java @@ -20,10 +20,6 @@ package org.apache.openjpa.conf; import org.junit.Test; -import org.junit.runner.RunWith; -import static org.junit.Assert.*; -import org.apache.openjpa.lib.meta.ClassMetaDataIterator; -import org.apache.openjpa.meta.ClassMetaData; import org.junit.Assert; import org.apache.openjpa.conf.*; diff --git a/openjpa-kernel/src/test/java/org/apache/openjpa/util/custom/CustomProxyDefaultScopeList.java b/openjpa-kernel/src/test/java/org/apache/openjpa/util/custom/CustomProxyDefaultScopeList.java index 625fe94dd..fbb8e2eda 100644 --- a/openjpa-kernel/src/test/java/org/apache/openjpa/util/custom/CustomProxyDefaultScopeList.java +++ b/openjpa-kernel/src/test/java/org/apache/openjpa/util/custom/CustomProxyDefaultScopeList.java @@ -39,5 +39,5 @@ class CustomProxyDefaultScopeList extends AbstractSequentialList { public static Object instance() { return new CustomProxyDefaultScopeList(); - }; + } } diff --git a/openjpa-kernel/src/test/java/org/apache/openjpa/util/custom/CustomProxyDefaultScopeType.java b/openjpa-kernel/src/test/java/org/apache/openjpa/util/custom/CustomProxyDefaultScopeType.java index 807bdf629..8ca4a15fa 100644 --- a/openjpa-kernel/src/test/java/org/apache/openjpa/util/custom/CustomProxyDefaultScopeType.java +++ b/openjpa-kernel/src/test/java/org/apache/openjpa/util/custom/CustomProxyDefaultScopeType.java @@ -40,5 +40,5 @@ class CustomProxyDefaultScopeType { public static Object instance() { return new CustomProxyDefaultScopeType(); - }; + } } diff --git a/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/XMLMetaDataParser.java b/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/XMLMetaDataParser.java index 470bdf553..7f3a1d1ef 100644 --- a/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/XMLMetaDataParser.java +++ b/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/XMLMetaDataParser.java @@ -394,7 +394,7 @@ public abstract class XMLMetaDataParser extends DefaultHandler ClassLoader newLoader = null; try { - if (overrideCL == true) { + if (overrideCL) { oldLoader = (ClassLoader) AccessController.doPrivileged(J2DoPrivHelper.getContextClassLoaderAction()); newLoader = XMLMetaDataParser.class.getClassLoader(); @@ -432,11 +432,10 @@ public abstract class XMLMetaDataParser extends DefaultHandler parser.parse(is, this); finish(); } catch (SAXException se) { - IOException ioe = new IOException(se.toString()); - ioe.initCause(se); + IOException ioe = new IOException(se.toString(), se); throw ioe; } finally { - if (overrideCL == true) { + if (overrideCL) { // Restore the old ContextClassloader try { if (_log != null && _log.isTraceEnabled()) { diff --git a/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/StringUtil.java b/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/StringUtil.java index b06afb88d..2a46898cd 100644 --- a/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/StringUtil.java +++ b/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/StringUtil.java @@ -70,7 +70,7 @@ public final class StringUtil { return true; } for (int i = 0; i < strLen; i++) { - if (Character.isWhitespace(cs.charAt(i)) == false) { + if (!Character.isWhitespace(cs.charAt(i))) { return false; } } diff --git a/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/UUIDGenerator.java b/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/UUIDGenerator.java index 700b76ee3..d454c9f2d 100644 --- a/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/UUIDGenerator.java +++ b/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/UUIDGenerator.java @@ -99,7 +99,7 @@ public class UUIDGenerator { * the node portion of the UUID using the IP address. */ private static synchronized void initializeForType1() { - if (type1Initialized == true) { + if (type1Initialized) { return; } // note that secure random is very slow the first time @@ -140,7 +140,7 @@ public class UUIDGenerator { * Creates a type 1 UUID */ public static byte[] createType1() { - if (type1Initialized == false) { + if (!type1Initialized) { initializeForType1(); } // set ip addr diff --git a/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/collections/AbstractDualBidiMap.java b/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/collections/AbstractDualBidiMap.java index 89fba49f2..39defd27e 100644 --- a/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/collections/AbstractDualBidiMap.java +++ b/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/collections/AbstractDualBidiMap.java @@ -421,7 +421,7 @@ public abstract class AbstractDualBidiMap implements BidiMap { boolean modified = false; final Iterator it = iterator(); while (it.hasNext()) { - if (coll.contains(it.next()) == false) { + if (!coll.contains(it.next())) { it.remove(); modified = true; } @@ -508,7 +508,7 @@ public abstract class AbstractDualBidiMap implements BidiMap { @Override public void remove() { - if (canRemove == false) { + if (!canRemove) { throw new IllegalStateException("Iterator remove() can only be called once after next()"); } final Object value = parent.normalMap.get(lastKey); @@ -593,7 +593,7 @@ public abstract class AbstractDualBidiMap implements BidiMap { @Override public void remove() { - if (canRemove == false) { + if (!canRemove) { throw new IllegalStateException("Iterator remove() can only be called once after next()"); } super.remove(); // removes from maps[0] @@ -628,7 +628,7 @@ public abstract class AbstractDualBidiMap implements BidiMap { @Override public boolean remove(final Object obj) { - if (obj instanceof Map.Entry == false) { + if (!(obj instanceof Map.Entry)) { return false; } final Entry entry = (Entry) obj; @@ -678,7 +678,7 @@ public abstract class AbstractDualBidiMap implements BidiMap { @Override public void remove() { - if (canRemove == false) { + if (!canRemove) { throw new IllegalStateException("Iterator remove() can only be called once after next()"); } // store value as remove may change the entry in the decorator (eg.TreeMap) @@ -762,7 +762,7 @@ public abstract class AbstractDualBidiMap implements BidiMap { @Override public void remove() { - if (canRemove == false) { + if (!canRemove) { throw new IllegalStateException("Iterator remove() can only be called once after next()"); } // store value as remove may change the entry in the decorator (eg.TreeMap) diff --git a/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/collections/AbstractHashedMap.java b/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/collections/AbstractHashedMap.java index b00dcc01d..7101889a7 100644 --- a/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/collections/AbstractHashedMap.java +++ b/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/collections/AbstractHashedMap.java @@ -860,10 +860,10 @@ public class AbstractHashedMap extends AbstractMap implements Iterab @Override public boolean remove(final Object obj) { - if (obj instanceof Map.Entry == false) { + if (!(obj instanceof Map.Entry)) { return false; } - if (contains(obj) == false) { + if (!contains(obj)) { return false; } final Entry entry = (Entry) obj; @@ -1110,7 +1110,7 @@ public class AbstractHashedMap extends AbstractMap implements Iterab if (obj == this) { return true; } - if (obj instanceof Map.Entry == false) { + if (!(obj instanceof Map.Entry)) { return false; } final Entry other = (Entry) obj; @@ -1316,7 +1316,7 @@ public class AbstractHashedMap extends AbstractMap implements Iterab if (obj == this) { return true; } - if (obj instanceof Map == false) { + if (!(obj instanceof Map)) { return false; } final Map map = (Map) obj; @@ -1329,11 +1329,11 @@ public class AbstractHashedMap extends AbstractMap implements Iterab final Object key = it.next(); final Object value = it.getValue(); if (value == null) { - if (map.get(key) != null || map.containsKey(key) == false) { + if (map.get(key) != null || !map.containsKey(key)) { return false; } } else { - if (value.equals(map.get(key)) == false) { + if (!value.equals(map.get(key))) { return false; } } diff --git a/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/collections/AbstractMapEntry.java b/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/collections/AbstractMapEntry.java index 6d4597ce9..530016ebe 100644 --- a/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/collections/AbstractMapEntry.java +++ b/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/collections/AbstractMapEntry.java @@ -67,7 +67,7 @@ public abstract class AbstractMapEntry extends AbstractKeyValue impl if (obj == this) { return true; } - if (obj instanceof Map.Entry == false) { + if (!(obj instanceof Map.Entry)) { return false; } final Map.Entry other = (Map.Entry) obj; diff --git a/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/collections/AbstractReferenceMap.java b/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/collections/AbstractReferenceMap.java index 78fc97dab..da46be875 100644 --- a/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/collections/AbstractReferenceMap.java +++ b/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/collections/AbstractReferenceMap.java @@ -676,7 +676,7 @@ public abstract class AbstractReferenceMap extends AbstractHashedMap if (obj == this) { return true; } - if (obj instanceof Map.Entry == false) { + if (!(obj instanceof Map.Entry)) { return false; } diff --git a/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/collections/ComparatorChain.java b/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/collections/ComparatorChain.java index f05aec5de..0a8eae04e 100644 --- a/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/collections/ComparatorChain.java +++ b/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/collections/ComparatorChain.java @@ -94,7 +94,7 @@ public class ComparatorChain implements Comparator, Serializable { comparatorChain = new ArrayList<>(1); comparatorChain.add(comparator); orderingBits = new BitSet(1); - if (reverse == true) { + if (reverse) { orderingBits.set(0); } } @@ -153,7 +153,7 @@ public class ComparatorChain implements Comparator, Serializable { checkLocked(); comparatorChain.add(comparator); - if (reverse == true) { + if (reverse) { orderingBits.set(comparatorChain.size() - 1); } } @@ -183,7 +183,7 @@ public class ComparatorChain implements Comparator, Serializable { checkLocked(); comparatorChain.set(index,comparator); - if (reverse == true) { + if (reverse) { orderingBits.set(index); } else { orderingBits.clear(index); @@ -239,7 +239,7 @@ public class ComparatorChain implements Comparator, Serializable { * @throws UnsupportedOperationException if the {@link ComparatorChain} is locked */ private void checkLocked() { - if (isLocked == true) { + if (isLocked) { throw new UnsupportedOperationException( "Comparator ordering cannot be changed after the first comparison is performed"); } @@ -268,7 +268,7 @@ public class ComparatorChain implements Comparator, Serializable { */ @Override public int compare(final E o1, final E o2) throws UnsupportedOperationException { - if (isLocked == false) { + if (!isLocked) { checkChainIntegrity(); isLocked = true; } @@ -281,7 +281,7 @@ public class ComparatorChain implements Comparator, Serializable { int retval = comparator.compare(o1,o2); if (retval != 0) { // invert the order if it is a reverse sort - if (orderingBits.get(comparatorIndex) == true) { + if (orderingBits.get(comparatorIndex)) { if (retval > 0) { retval = -1; } else { diff --git a/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/collections/IteratorChain.java b/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/collections/IteratorChain.java index 734dd4825..78ebf2b53 100644 --- a/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/collections/IteratorChain.java +++ b/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/collections/IteratorChain.java @@ -187,7 +187,7 @@ public class IteratorChain implements Iterator { * Checks whether the iterator chain is now locked and in use. */ private void checkLocked() { - if (isLocked == true) { + if (isLocked) { throw new UnsupportedOperationException( "IteratorChain cannot be changed after the first use of a method from the Iterator interface"); } @@ -198,7 +198,7 @@ public class IteratorChain implements Iterator { * from all Iterator interface methods. */ private void lockChain() { - if (isLocked == false) { + if (!isLocked) { isLocked = true; } } @@ -219,7 +219,7 @@ public class IteratorChain implements Iterator { lastUsedIterator = currentIterator; } - while (currentIterator.hasNext() == false && !iteratorChain.isEmpty()) { + while (!currentIterator.hasNext() && !iteratorChain.isEmpty()) { currentIterator = iteratorChain.remove(); } } diff --git a/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/collections/TreeBidiMap.java b/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/collections/TreeBidiMap.java index 97008e929..b665c4466 100644 --- a/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/collections/TreeBidiMap.java +++ b/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/collections/TreeBidiMap.java @@ -1355,7 +1355,7 @@ public class TreeBidiMap, V extends Comparable> if (obj == this) { return true; } - if (obj instanceof Map == false) { + if (!(obj instanceof Map)) { return false; } final Map other = (Map) obj; @@ -1368,7 +1368,7 @@ public class TreeBidiMap, V extends Comparable> for (final MapIterator it = getMapIterator(dataElement); it.hasNext(); ) { final Object key = it.next(); final Object value = it.getValue(); - if (value.equals(other.get(key)) == false) { + if (!value.equals(other.get(key))) { return false; } } @@ -1571,7 +1571,7 @@ public class TreeBidiMap, V extends Comparable> @Override public boolean contains(final Object obj) { - if (obj instanceof Map.Entry == false) { + if (!(obj instanceof Map.Entry)) { return false; } final Entry entry = (Entry) obj; @@ -1582,7 +1582,7 @@ public class TreeBidiMap, V extends Comparable> @Override public boolean remove(final Object obj) { - if (obj instanceof Map.Entry == false) { + if (!(obj instanceof Map.Entry)) { return false; } final Entry entry = (Entry) obj; @@ -1612,7 +1612,7 @@ public class TreeBidiMap, V extends Comparable> @Override public boolean contains(final Object obj) { - if (obj instanceof Map.Entry == false) { + if (!(obj instanceof Map.Entry)) { return false; } final Entry entry = (Entry) obj; @@ -1623,7 +1623,7 @@ public class TreeBidiMap, V extends Comparable> @Override public boolean remove(final Object obj) { - if (obj instanceof Map.Entry == false) { + if (!(obj instanceof Map.Entry)) { return false; } final Entry entry = (Entry) obj; diff --git a/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/git/GitUtils.java b/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/git/GitUtils.java index 6b6288d14..cad374173 100644 --- a/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/git/GitUtils.java +++ b/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/git/GitUtils.java @@ -36,7 +36,7 @@ public class GitUtils { * @return The formatted int version, or -1 if gitinfo is null or unparsable. */ public static int convertGitInfoToPCEnhancerVersion(String gitinfo) { - if (gitinfo == null || fullRevisionPattern.matcher(gitinfo).matches() == false) { + if (gitinfo == null || !fullRevisionPattern.matcher(gitinfo).matches()) { return -1; } diff --git a/openjpa-lib/src/test/java/org/apache/openjpa/lib/rop/ResultListTest.java b/openjpa-lib/src/test/java/org/apache/openjpa/lib/rop/ResultListTest.java index 3fd7fe3cf..ed113f400 100644 --- a/openjpa-lib/src/test/java/org/apache/openjpa/lib/rop/ResultListTest.java +++ b/openjpa-lib/src/test/java/org/apache/openjpa/lib/rop/ResultListTest.java @@ -306,10 +306,10 @@ public abstract class ResultListTest extends AbstractTestCase { ResultList list = getResultList(rops[i]); try { List subList = list.subList(0, 0); - if (subListSupported == false) + if (!subListSupported) fail("Should not support subList."); } catch (UnsupportedOperationException e) { - if (subListSupported == true) + if (subListSupported) fail("Should support subList."); } } diff --git a/openjpa-lib/src/test/java/org/apache/openjpa/lib/test/AbstractTestCase.java b/openjpa-lib/src/test/java/org/apache/openjpa/lib/test/AbstractTestCase.java index 18a3ff49e..7c5a44599 100644 --- a/openjpa-lib/src/test/java/org/apache/openjpa/lib/test/AbstractTestCase.java +++ b/openjpa-lib/src/test/java/org/apache/openjpa/lib/test/AbstractTestCase.java @@ -133,7 +133,7 @@ public abstract class AbstractTestCase { * Support method to get a random String for testing. */ public static String randomString(int len) { - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); for (int i = 0; i < (int) (Math.random() * len) + 1; i++) buf.append(randomChar()); return buf.toString(); diff --git a/openjpa-lib/src/test/java/org/apache/openjpa/lib/util/TestPropertiesParser.java b/openjpa-lib/src/test/java/org/apache/openjpa/lib/util/TestPropertiesParser.java index 372d1b2b2..8dc734d8e 100644 --- a/openjpa-lib/src/test/java/org/apache/openjpa/lib/util/TestPropertiesParser.java +++ b/openjpa-lib/src/test/java/org/apache/openjpa/lib/util/TestPropertiesParser.java @@ -53,7 +53,7 @@ public class TestPropertiesParser { @Test public void testSimpleProperties() throws IOException { - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); buf.append("key: value" + LS); buf.append("key2: value2"); // no EOL -- this is intentional Properties p = toProperties(buf.toString()); @@ -63,7 +63,7 @@ public class TestPropertiesParser { @Test public void testComments() throws IOException { - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); buf.append("# this is a comment" + LS); buf.append(" # another one, with leading whitespace " + LS); buf.append(" # and more with interesting whitespace " + LS); @@ -76,7 +76,7 @@ public class TestPropertiesParser { @Test public void testMixedContent() throws IOException { - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); buf.append("# this is a comment" + LS); buf.append(" # another one, with leading whitespace " + LS); buf.append("foo: bar#baz" + LS); @@ -137,7 +137,7 @@ public class TestPropertiesParser { @Test public void testLineTypes() throws IOException { - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); buf.append(" !comment" + LS + " \t " + LS + "name = no" + LS + " " + "#morec\tomm\\" + LS + "ents" + LS + LS + " dog=no\\cat " + LS + "burps :" + LS + "test=" + LS + "date today" + LS + LS + LS @@ -252,7 +252,7 @@ public class TestPropertiesParser { } static String randomString(int len) { - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); for (int i = 0; i < (int) (Math.random() * len) + 1; i++) buf.append(randomChar()); return buf.toString(); @@ -307,7 +307,7 @@ public class TestPropertiesParser { static String stripComments(byte[] bytes) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader (new ByteArrayInputStream(bytes))); - StringBuffer sbuf = new StringBuffer(); + StringBuilder sbuf = new StringBuilder(); String line; while ((line = reader.readLine()) != null) { // skip comments diff --git a/openjpa-lib/src/test/java/org/apache/openjpa/lib/util/TestTemporaryClassLoader.java b/openjpa-lib/src/test/java/org/apache/openjpa/lib/util/TestTemporaryClassLoader.java index b2229ed18..80f38dc42 100644 --- a/openjpa-lib/src/test/java/org/apache/openjpa/lib/util/TestTemporaryClassLoader.java +++ b/openjpa-lib/src/test/java/org/apache/openjpa/lib/util/TestTemporaryClassLoader.java @@ -21,7 +21,6 @@ package org.apache.openjpa.lib.util; import java.util.HashSet; import java.util.Set; -import junit.framework.TestCase; import org.junit.Test; import static org.junit.Assert.assertEquals; diff --git a/openjpa-lib/src/test/java/org/apache/openjpa/lib/xml/TestDocTypeReader.java b/openjpa-lib/src/test/java/org/apache/openjpa/lib/xml/TestDocTypeReader.java index 36c06b89d..019501253 100644 --- a/openjpa-lib/src/test/java/org/apache/openjpa/lib/xml/TestDocTypeReader.java +++ b/openjpa-lib/src/test/java/org/apache/openjpa/lib/xml/TestDocTypeReader.java @@ -55,7 +55,7 @@ public class TestDocTypeReader { @Before public void setUp() { - StringBuffer docType = new StringBuffer(); + StringBuilder docType = new StringBuilder(); docType.append("\n"); docType.append("\t\n"); @@ -64,19 +64,19 @@ public class TestDocTypeReader { docType.append("]>\n"); _docType = docType.toString(); - StringBuffer expectedXML = new StringBuffer(); + StringBuilder expectedXML = new StringBuilder(); String header = "\n"; String comment = "\n"; expectedXML.append(header); expectedXML.append(comment); expectedXML.append(docType.toString()); - StringBuffer xmlWithDocType = new StringBuffer(); + StringBuilder xmlWithDocType = new StringBuilder(); xmlWithDocType.append(header); xmlWithDocType.append(comment); xmlWithDocType.append(docType.toString()); - StringBuffer validXML = new StringBuffer(); + StringBuilder validXML = new StringBuilder(); validXML.append("\n"); validXML.append("\t\n"); validXML.append(""); @@ -86,18 +86,18 @@ public class TestDocTypeReader { _expectedXML = expectedXML.toString(); _xmlWithDocType = xmlWithDocType.toString(); - StringBuffer invalidXML = new StringBuffer(); + StringBuilder invalidXML = new StringBuilder(); invalidXML.append("\n"); invalidXML.append("\n"); invalidXML.append("\t\n"); invalidXML.append(""); _invalidXML = invalidXML.toString(); - StringBuffer expectedHTML = new StringBuffer(); + StringBuilder expectedHTML = new StringBuilder(); header = " \n "; expectedHTML.append(header); expectedHTML.append(docType.toString()); - StringBuffer validHTML = new StringBuffer(); + StringBuilder validHTML = new StringBuilder(); validHTML.append("some junk "); expectedHTML.append(validHTML.toString()); _validHTML = header + validHTML.toString(); diff --git a/openjpa-lib/src/test/java/org/apache/openjpa/lib/xml/TestXMLWriter.java b/openjpa-lib/src/test/java/org/apache/openjpa/lib/xml/TestXMLWriter.java index af6d1020a..b921d5462 100644 --- a/openjpa-lib/src/test/java/org/apache/openjpa/lib/xml/TestXMLWriter.java +++ b/openjpa-lib/src/test/java/org/apache/openjpa/lib/xml/TestXMLWriter.java @@ -58,7 +58,7 @@ public class TestXMLWriter { trans.transform(source, result); // read the correct output into a buffer - StringBuffer correct = new StringBuffer(); + StringBuilder correct = new StringBuilder(); InputStreamReader reader = new InputStreamReader (getClass().getResourceAsStream("formatted-result.xml")); for (int c; (c = reader.read()) != -1; correct.append((char) c)) ; diff --git a/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/AnnotationPersistenceMappingParser.java b/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/AnnotationPersistenceMappingParser.java index cd0c95450..26e6274c8 100644 --- a/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/AnnotationPersistenceMappingParser.java +++ b/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/AnnotationPersistenceMappingParser.java @@ -1589,7 +1589,7 @@ public class AnnotationPersistenceMappingParser */ private void parseEnumerated(FieldMapping fm, Enumerated anno) { String strat = EnumValueHandler.class.getName() + "(StoreOrdinal=" - + String.valueOf(anno.value() == EnumType.ORDINAL) + ")"; + + (anno.value() == EnumType.ORDINAL) + ")"; if (fm.isElementCollection()) fm.getElementMapping().getValueInfo().setStrategy(strat); else @@ -1601,7 +1601,7 @@ public class AnnotationPersistenceMappingParser */ private void parseMapKeyEnumerated(FieldMapping fm, MapKeyEnumerated anno) { String strat = EnumValueHandler.class.getName() + "(StoreOrdinal=" - + String.valueOf(anno.value() == EnumType.ORDINAL) + ")"; + + (anno.value() == EnumType.ORDINAL) + ")"; fm.getKeyMapping().getValueInfo().setStrategy(strat); } diff --git a/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/JDBCPersistenceProductDerivation.java b/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/JDBCPersistenceProductDerivation.java index 25704887e..c754edef4 100644 --- a/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/JDBCPersistenceProductDerivation.java +++ b/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/JDBCPersistenceProductDerivation.java @@ -18,8 +18,6 @@ */ package org.apache.openjpa.persistence.jdbc; -import static java.util.Collections.singleton; - import java.security.AccessController; import java.util.Collections; import java.util.HashSet; diff --git a/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/XMLPersistenceMappingParser.java b/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/XMLPersistenceMappingParser.java index cc0f4640c..7cd2f22b8 100644 --- a/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/XMLPersistenceMappingParser.java +++ b/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/XMLPersistenceMappingParser.java @@ -665,7 +665,7 @@ public class XMLPersistenceMappingParser FieldMapping fm = (FieldMapping) currentElement(); String strat = EnumValueHandler.class.getName() + "(StoreOrdinal=" - + String.valueOf(type == EnumType.ORDINAL) + ")"; + + (type == EnumType.ORDINAL) + ")"; if (fm.isElementCollection()) fm.getElementMapping().getValueInfo().setStrategy(strat); else @@ -683,7 +683,7 @@ public class XMLPersistenceMappingParser FieldMapping fm = (FieldMapping) currentElement(); String strat = EnumValueHandler.class.getName() + "(StoreOrdinal=" - + String.valueOf(type == EnumType.ORDINAL) + ")"; + + (type == EnumType.ORDINAL) + ")"; fm.getKeyMapping().getValueInfo().setStrategy(strat); } diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/enhance/UnenhancedCompoundPKFieldAccess.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/enhance/UnenhancedCompoundPKFieldAccess.java index 106b057ff..889967089 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/enhance/UnenhancedCompoundPKFieldAccess.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/enhance/UnenhancedCompoundPKFieldAccess.java @@ -63,8 +63,8 @@ public class UnenhancedCompoundPKFieldAccess { @Override public String toString() { - return String.valueOf(id0) - + "::" + String.valueOf(id1); + return id0 + + "::" + id1; } @Override diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/enhance/UnenhancedCompoundPKFieldAccessSuperclass.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/enhance/UnenhancedCompoundPKFieldAccessSuperclass.java index cdaf3f1f5..ee7f0cfda 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/enhance/UnenhancedCompoundPKFieldAccessSuperclass.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/enhance/UnenhancedCompoundPKFieldAccessSuperclass.java @@ -63,8 +63,8 @@ public class UnenhancedCompoundPKFieldAccessSuperclass { @Override public String toString() { - return String.valueOf(id0) - + "::" + String.valueOf(id1); + return id0 + + "::" + id1; } @Override diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/enhance/UnenhancedCompoundPKPropertyAccess.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/enhance/UnenhancedCompoundPKPropertyAccess.java index 8db7d8a8a..280ba7a43 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/enhance/UnenhancedCompoundPKPropertyAccess.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/enhance/UnenhancedCompoundPKPropertyAccess.java @@ -98,8 +98,8 @@ public class UnenhancedCompoundPKPropertyAccess { @Override public String toString() { - return String.valueOf(id0) - + "::" + String.valueOf(id1); + return id0 + + "::" + id1; } @Override diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jdbc/kernel/TestJDBCStoreOptSelect.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jdbc/kernel/TestJDBCStoreOptSelect.java index 9e36ed89b..20d570f90 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jdbc/kernel/TestJDBCStoreOptSelect.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jdbc/kernel/TestJDBCStoreOptSelect.java @@ -49,7 +49,7 @@ public class TestJDBCStoreOptSelect extends SQLListenerTestCase { try { sql.clear(); - if (store instanceof JDBCStoreManager == false) { + if (!(store instanceof JDBCStoreManager)) { fail("StoreManager is not an instanceof JDBCStoreManager"); } // Set this JDBCFetchPlan property so that we will select FKs for fields that are in the DFG, but not diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jdbc/meta/strats/AbstractLobTest.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jdbc/meta/strats/AbstractLobTest.java index 95ef6d6b3..26491f16d 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jdbc/meta/strats/AbstractLobTest.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jdbc/meta/strats/AbstractLobTest.java @@ -31,8 +31,6 @@ import org.apache.openjpa.conf.OpenJPAConfiguration; import org.apache.openjpa.datacache.DataCachePCData; import org.apache.openjpa.jdbc.sql.DB2Dictionary; import org.apache.openjpa.jdbc.sql.MySQLDictionary; -import org.apache.openjpa.jdbc.sql.OracleDictionary; -import org.apache.openjpa.jdbc.sql.SQLServerDictionary; import org.apache.openjpa.meta.ClassMetaData; import org.apache.openjpa.persistence.JPAFacadeHelper; import org.apache.openjpa.persistence.OpenJPAEntityManager; diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jdbc/sql/TestDelimitIdentifiers.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jdbc/sql/TestDelimitIdentifiers.java index e91b998b2..1ae5ec28c 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jdbc/sql/TestDelimitIdentifiers.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jdbc/sql/TestDelimitIdentifiers.java @@ -171,7 +171,7 @@ public class TestDelimitIdentifiers { public enum EnumType { Value1, Value2 - }; + } // @Basic types private short shortField; diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jira1794/TestAggregateFunctions.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jira1794/TestAggregateFunctions.java index aa7cc4e37..13a6b0d48 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jira1794/TestAggregateFunctions.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jira1794/TestAggregateFunctions.java @@ -202,7 +202,6 @@ public class TestAggregateFunctions extends SingleEMFTestCase { + "(SELECT " + func + "(" + attr.replaceFirst("^ae.", "ae2.") + ") FROM AggEntity ae2)"; - ; Query q = em.createQuery(sql); verifyQueryResult(q, expectNull, isString); } diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jira2780/Jira2780Enum.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jira2780/Jira2780Enum.java index 14b2e3aaa..b1b297dc0 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jira2780/Jira2780Enum.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jira2780/Jira2780Enum.java @@ -22,5 +22,5 @@ package org.apache.openjpa.jira2780; public enum Jira2780Enum { - A, B, C; + A, B, C } diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/access/FieldSub3.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/access/FieldSub3.java index 5b8b65629..8bf91c833 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/access/FieldSub3.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/access/FieldSub3.java @@ -22,7 +22,6 @@ import java.util.Date; import javax.persistence.Access; import javax.persistence.AccessType; -import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.NamedQueries; import javax.persistence.NamedQuery; diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/TestEJBEmbedded.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/TestEJBEmbedded.java index 4670a75be..55a4e4e27 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/TestEJBEmbedded.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/TestEJBEmbedded.java @@ -42,7 +42,7 @@ public class TestEJBEmbedded extends AnnotationTestCase private static final String CLOB; static { - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); for (int i = 0; i < 1000; i++) buf.append('a'); CLOB = buf.toString(); diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/TestSerializedLobs.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/TestSerializedLobs.java index 6b793846d..c8f502c73 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/TestSerializedLobs.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/TestSerializedLobs.java @@ -121,7 +121,7 @@ public class TestSerializedLobs extends AnnotationTestCase startTx(em); AnnoTest1 pc = new AnnoTest1(1); - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); for (int i = 0; i < 1000; i++) buf.append((char) ('a' + (i % 24))); pc.setClob(buf.toString()); diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/common/apps/CompUser.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/common/apps/CompUser.java index 502a5b8df..9b0a1be1e 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/common/apps/CompUser.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/common/apps/CompUser.java @@ -132,7 +132,7 @@ public class CompUser { public enum CreditRating { POOR, GOOD, EXCELLENT - }; + } public String[] getNicknames() { return nicknames; diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/common/utils/AbstractTestCase.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/common/utils/AbstractTestCase.java index c62d60339..d56ab2f45 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/common/utils/AbstractTestCase.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/common/utils/AbstractTestCase.java @@ -444,7 +444,7 @@ public abstract class AbstractTestCase extends AbstractCachedEMFTestCase { * Support method to get a random String for testing. */ public static String randomString(int len) { - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); for (int i = 0; i < (int) (Math.random() * len) + 1; i++) buf.append(randomChar()); return buf.toString(); @@ -454,7 +454,7 @@ public abstract class AbstractTestCase extends AbstractCachedEMFTestCase { * Support method to get a random clob for testing. */ public static String randomClob() { - StringBuffer sbuf = new StringBuffer(); + StringBuilder sbuf = new StringBuilder(); while (sbuf.length() < (5 * 1024)) // at least 5K { sbuf.append(randomString(1024)); @@ -832,7 +832,7 @@ public abstract class AbstractTestCase extends AbstractCachedEMFTestCase { // get to everyone starting at the same time, the // better chance we have for identifying MT problems. while (System.currentTimeMillis() < startMillis) - yield(); + Thread.yield(); int thisIteration = 1; try { @@ -980,7 +980,7 @@ public abstract class AbstractTestCase extends AbstractCachedEMFTestCase { // skip our own methods! if (shortMethodName.equals("callingMethod")) continue; - if (exclude != null && shortMethodName.equals(exclude)) + if (shortMethodName.equals(exclude)) continue; return shortMethodName; diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/compat/TestContainerSpecCompatibilityOptions.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/compat/TestContainerSpecCompatibilityOptions.java index 83d033a1e..4a3e1cc97 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/compat/TestContainerSpecCompatibilityOptions.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/compat/TestContainerSpecCompatibilityOptions.java @@ -888,7 +888,7 @@ public class TestContainerSpecCompatibilityOptions } public String toString(List list) { - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); for (String s : list) buf.append(s).append("\r\n"); return buf.toString(); diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/compat/TestSpecCompatibilityOptions.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/compat/TestSpecCompatibilityOptions.java index 64bb85376..1ded5605b 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/compat/TestSpecCompatibilityOptions.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/compat/TestSpecCompatibilityOptions.java @@ -855,7 +855,7 @@ extends AbstractCachedEMFTestCase { "buildSchema(ForeignKeys=true,SchemaAction='drop,add')"); map.put("openjpa.Compatibility", "StrictIdentityValues=true"); - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); for (Class c : types) { if (buf.length() > 0) { buf.append(";"); @@ -880,7 +880,7 @@ extends AbstractCachedEMFTestCase { } public String toString(List list) { - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); for (String s : list) buf.append(s).append("\r\n"); return buf.toString(); diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/AbstractCriteriaTestCase.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/AbstractCriteriaTestCase.java index fa2a4d08b..3f405b184 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/AbstractCriteriaTestCase.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/AbstractCriteriaTestCase.java @@ -88,7 +88,7 @@ public abstract class AbstractCriteriaTestCase extends TestCase { map.put("openjpa.Compatibility", "QuotedNumbersInQueries=true"); map.put("openjpa.jdbc.JDBCListeners", new JDBCListener[] { getAuditor() }); - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); for (Class c : types) { if (buf.length() > 0) buf.append(";"); diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/CompUser.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/CompUser.java index bac5ab913..1d816f9cf 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/CompUser.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/CompUser.java @@ -118,5 +118,5 @@ public class CompUser this.creditRating = rating; } - public enum CreditRating { POOR, GOOD, EXCELLENT }; + public enum CreditRating { POOR, GOOD, EXCELLENT } } diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Customer.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Customer.java index 30f86c39c..f21dd3a59 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Customer.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Customer.java @@ -155,5 +155,5 @@ public class Customer { this.creditRating = rating; } - public enum CreditRating { POOR, GOOD, EXCELLENT }; + public enum CreditRating { POOR, GOOD, EXCELLENT } } diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/TestSubqueries.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/TestSubqueries.java index 2dce0cf80..fc73d9f35 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/TestSubqueries.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/TestSubqueries.java @@ -19,9 +19,7 @@ package org.apache.openjpa.persistence.criteria; import java.sql.Timestamp; -import java.util.List; -import javax.persistence.Parameter; import javax.persistence.Tuple; import javax.persistence.TypedQuery; import javax.persistence.criteria.*; diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/TestClearableScheduler.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/TestClearableScheduler.java index dbbd2ced3..4c79982c8 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/TestClearableScheduler.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/TestClearableScheduler.java @@ -30,7 +30,7 @@ import org.apache.openjpa.persistence.test.SingleEMFTestCase; public class TestClearableScheduler extends SingleEMFTestCase { private static String getMinutesString() { - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); for (int i = 0; i < 60; i++) { if (i % 2 == 0) buf.append(i).append(','); diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/TestDataCacheOptimisticLockRecovery.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/TestDataCacheOptimisticLockRecovery.java index 54504c061..b43a00143 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/TestDataCacheOptimisticLockRecovery.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/TestDataCacheOptimisticLockRecovery.java @@ -25,12 +25,10 @@ import java.sql.SQLException; import javax.persistence.EntityManager; import javax.persistence.LockModeType; import javax.persistence.RollbackException; -import javax.sql.DataSource; import org.apache.openjpa.event.RemoteCommitEvent; import org.apache.openjpa.event.RemoteCommitListener; import org.apache.openjpa.persistence.JPAFacadeHelper; -import org.apache.openjpa.persistence.OpenJPAEntityManagerFactorySPI; import org.apache.openjpa.persistence.OpenJPAPersistence; import org.apache.openjpa.persistence.test.SingleEMFTestCase; diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/embed/A.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/embed/A.java index a24c30a61..114bade72 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/embed/A.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/embed/A.java @@ -50,7 +50,7 @@ public class A implements java.io.Serializable { int value; @ElementCollection - protected Set embeds = new HashSet(); + protected Set embeds = new HashSet<>(); @CollectionTable(name = "collectionTemporalOrderColumnTable", joinColumns = @JoinColumn(name = "parent_id")) diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/embed/EntityA_Coll_String.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/embed/EntityA_Coll_String.java index 4208c303f..d54add6b1 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/embed/EntityA_Coll_String.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/embed/EntityA_Coll_String.java @@ -127,6 +127,6 @@ public class EntityA_Coll_String implements Serializable { lobs.add(lob); } - public enum CreditRating { POOR, GOOD, EXCELLENT }; + public enum CreditRating { POOR, GOOD, EXCELLENT } } diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/embed/EntityA_Embed_Complex.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/embed/EntityA_Embed_Complex.java index 514d21b97..9bfcae912 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/embed/EntityA_Embed_Complex.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/embed/EntityA_Embed_Complex.java @@ -153,7 +153,7 @@ public class EntityA_Embed_Complex implements Serializable { lobs.add(lob); } - public enum CreditRating { POOR, GOOD, EXCELLENT }; + public enum CreditRating { POOR, GOOD, EXCELLENT } public Embed_Embed getEmbed() { return embed; diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/embed/Item4.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/embed/Item4.java index 7e8f7adb0..2d971f59b 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/embed/Item4.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/embed/Item4.java @@ -60,6 +60,6 @@ public class Item4 { return images.get(cat); } - public enum Catagory { A1, A2, A3, A4 }; + public enum Catagory { A1, A2, A3, A4 } } diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/embed/TestEmbeddableXml.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/embed/TestEmbeddableXml.java index f66b8123e..c4284d6b1 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/embed/TestEmbeddableXml.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/embed/TestEmbeddableXml.java @@ -79,7 +79,7 @@ public class TestEmbeddableXml extends SingleEMFTestCase { Query q = em.createQuery(jpql); List fList = (List) q.getResultList(); for (FeatureXml f : fList) { - List aList = f.getAttributes();; + List aList = f.getAttributes(); assertEquals(1, aList.size()); } em.close(); diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/embed/attrOverrides/TestAssocOverridesXML.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/embed/attrOverrides/TestAssocOverridesXML.java index 439500621..da1d90e34 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/embed/attrOverrides/TestAssocOverridesXML.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/embed/attrOverrides/TestAssocOverridesXML.java @@ -106,7 +106,7 @@ public class TestAssocOverridesXML extends AbstractPersistenceTestCase{ } private static String toString(List list) { - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); for (String s : list) buf.append(s).append("\r\n"); return buf.toString(); diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/embed/lazy/TestLazyEmbeddable.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/embed/lazy/TestLazyEmbeddable.java index 82b8fc713..51fdbb9c7 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/embed/lazy/TestLazyEmbeddable.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/embed/lazy/TestLazyEmbeddable.java @@ -156,7 +156,7 @@ public class TestLazyEmbeddable extends AbstractPersistenceTestCase { private static String toString(List list) { - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); for (String s : list) buf.append(s).append("\r\n"); return buf.toString(); diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/identity/BeneContactId.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/identity/BeneContactId.java index a2aa82844..24ba9f475 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/identity/BeneContactId.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/identity/BeneContactId.java @@ -45,7 +45,7 @@ public class BeneContactId implements Serializable { @Override public int hashCode() { - String hash = beneficiaryPK + Integer.toString(type.ordinal()); + String hash = beneficiaryPK + type.ordinal(); return hash.hashCode(); } @@ -73,5 +73,5 @@ public class BeneContactId implements Serializable { this.type = type; } - public enum ContactType {HOME, BUSINESS, OTHER;} + public enum ContactType {HOME, BUSINESS, OTHER} } diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/identity/Employee.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/identity/Employee.java index ebb661c1f..154a2bd4f 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/identity/Employee.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/identity/Employee.java @@ -74,7 +74,7 @@ public class Employee { return true; } - public enum EmpType { A1, A2, A3, A4 }; + public enum EmpType { A1, A2, A3, A4 } } diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/identity/TestMultipleLevelDerivedIdentity1.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/identity/TestMultipleLevelDerivedIdentity1.java index 19e1227dd..04d2f8500 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/identity/TestMultipleLevelDerivedIdentity1.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/identity/TestMultipleLevelDerivedIdentity1.java @@ -283,7 +283,7 @@ public class TestMultipleLevelDerivedIdentity1 extends SQLListenerTestCase { @Override public String toString(List list) { - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); for (String s : list) buf.append(s).append("\r\n"); return buf.toString(); diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/event/common/apps/Duration.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/event/common/apps/Duration.java index c477abe3d..8c586c5f6 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/event/common/apps/Duration.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/event/common/apps/Duration.java @@ -182,7 +182,7 @@ public class Duration double time = 0.0; - StringBuffer buf = new StringBuffer(256); + StringBuilder buf = new StringBuilder(256); if (wasStarted()) { diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/generationtype/TestMultipleSchemaNames.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/generationtype/TestMultipleSchemaNames.java index 20605863d..ac640e309 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/generationtype/TestMultipleSchemaNames.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/generationtype/TestMultipleSchemaNames.java @@ -19,7 +19,6 @@ package org.apache.openjpa.persistence.generationtype; import java.util.List; -import java.util.concurrent.atomic.AtomicBoolean; import javax.persistence.EntityManager; import javax.persistence.PersistenceException; diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/graph/TestPersistentGraph.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/graph/TestPersistentGraph.java index 2258f00d3..30a9736de 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/graph/TestPersistentGraph.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/graph/TestPersistentGraph.java @@ -49,7 +49,7 @@ import org.apache.openjpa.persistence.test.SingleEMFTestCase; public class TestPersistentGraph extends SingleEMFTestCase { private static enum Emotion { LOVES, HATES, KNOWS - }; + } // Identity of People is their SSN private static final long[] SSN = { 123456781, 123456782, 123456783, 123456784, 123456785 }; diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/identity/CompoundBooleanId.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/identity/CompoundBooleanId.java index 84a54dd53..dd7695009 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/identity/CompoundBooleanId.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/identity/CompoundBooleanId.java @@ -32,7 +32,7 @@ public class CompoundBooleanId { public int hashCode() { int result = 1; result = result + ((stringId == null) ? 0 : stringId.hashCode()); - result = result + ((booleanId == false) ? 0 : 1); + result = result + ((!booleanId) ? 0 : 1); return result; } diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/inheritance/entities/EntityMapping.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/inheritance/entities/EntityMapping.java index ab66a57ee..a3de171b5 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/inheritance/entities/EntityMapping.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/inheritance/entities/EntityMapping.java @@ -495,7 +495,7 @@ public class EntityMapping { public String getEntityName() { return getEntityClass().getSimpleName(); } - }; + } public final static InheritanceEntityMapping[] PIdJTIDMSC = { InheritanceEntityMapping.PIdJTIDMSCRootEntity, diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/annotations/TestEJBEmbedded.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/annotations/TestEJBEmbedded.java index c1c9a0e9a..80f1e107e 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/annotations/TestEJBEmbedded.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/annotations/TestEJBEmbedded.java @@ -47,7 +47,7 @@ public class TestEJBEmbedded extends SingleEMFTestCase { private static final String CLOB; static { - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); for (int i = 0; i < 1000; i++) buf.append('a'); CLOB = buf.toString(); diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/annotations/TestSerializedLobs.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/annotations/TestSerializedLobs.java index d61365d03..a0309182c 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/annotations/TestSerializedLobs.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/annotations/TestSerializedLobs.java @@ -120,7 +120,7 @@ public class TestSerializedLobs extends SingleEMFTestCase { em.getTransaction().begin(); AnnoTest1 pc = new AnnoTest1(1); - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); for (int i = 0; i < 1000; i++) buf.append((char) ('a' + (i % 24))); pc.setClob(buf.toString()); diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/common/apps/ByteArrayPKPCId.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/common/apps/ByteArrayPKPCId.java index 4741ba64a..e14e58092 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/common/apps/ByteArrayPKPCId.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/common/apps/ByteArrayPKPCId.java @@ -94,7 +94,7 @@ public class ByteArrayPKPCId implements Serializable { if (b == null) return "null"; - StringBuffer r = new StringBuffer(b.length * 2); + StringBuilder r = new StringBuilder(b.length * 2); for (int i = 0; i < b.length; i++) for (int j = 1; j >= 0; j--) r.append(HEX[(b[i] >> (j * 4)) & 0xF]); diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/common/apps/MappingTest2ID.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/common/apps/MappingTest2ID.java index 31fe78109..ec0f30d5f 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/common/apps/MappingTest2ID.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/common/apps/MappingTest2ID.java @@ -94,7 +94,7 @@ public class MappingTest2ID implements Serializable @Override public String toString () { - return String.valueOf (this.pk1) - + "::" + String.valueOf (this.pk2); + return this.pk1 + + "::" + this.pk2; } } diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/common/apps/mappingApp/CompositeId.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/common/apps/mappingApp/CompositeId.java index 9997a9f1e..8b2b25e73 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/common/apps/mappingApp/CompositeId.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/common/apps/mappingApp/CompositeId.java @@ -77,7 +77,7 @@ public class CompositeId implements Serializable { @Override public boolean equals (Object other) { - if (other instanceof CompositeId==false) + if (!(other instanceof CompositeId)) return false; CompositeId that = (CompositeId) other; diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/kernel/TestCircularFK.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/kernel/TestCircularFK.java index b2dd13248..edd00387c 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/kernel/TestCircularFK.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/kernel/TestCircularFK.java @@ -108,13 +108,13 @@ public class TestCircularFK extends BaseJDBCTest{ CircularFKPC pc1 = (CircularFKPC) pm.find(CircularFKPC.class,_oid1); CircularFKPC2 pc2 = (CircularFKPC2) pm.find(CircularFKPC2.class,_oid2); - startTx(pm);; + startTx(pm); CircularFKPC2 pc3 = new CircularFKPC2(); pc3.setStringField("pc3"); pc3.setFKField(pc1); pc1.setFKField(pc3); pc2.setFKField(null); - endTx(pm);; + endTx(pm); pm.close(); pm = getPM(); diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/kernel/TestEfficientAttach.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/kernel/TestEfficientAttach.java index e739a3dad..dfcd303d4 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/kernel/TestEfficientAttach.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/kernel/TestEfficientAttach.java @@ -91,11 +91,11 @@ public class TestEfficientAttach extends TestSQLListenerTestCase { private void attachTest() { OpenJPAEntityManager pm =(OpenJPAEntityManager) currentEntityManager(); - startTx(pm);; + startTx(pm); AttachE e = new AttachE(); e.setB(new AttachB()); pm.persist(e); - endTx(pm);; + endTx(pm); //FIXME jthomas - could not find equivalent for detachCopy() //attachCopy() etc /* diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/mapping/TestCompositeIdTraversalInSQLMapping.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/mapping/TestCompositeIdTraversalInSQLMapping.java index 954523e05..e4af19a95 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/mapping/TestCompositeIdTraversalInSQLMapping.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/mapping/TestCompositeIdTraversalInSQLMapping.java @@ -241,7 +241,7 @@ public class TestCompositeIdTraversalInSQLMapping extends AbstractTestCase { String createSelfJoinSQL(String table, int depth, int id) { - StringBuffer sql = new StringBuffer("SELECT "); + StringBuilder sql = new StringBuilder("SELECT "); for (int i=0; i properties = new HashMap<>(); - properties.put("javax.persistence.schema-generation.database.action", "drop");; + properties.put("javax.persistence.schema-generation.database.action", "drop"); properties.put("javax.persistence.schema-generation.drop-script-source", "org/apache/openjpa/persistence/jdbc/schema/drop.sql"); diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/sqlcache/Employee.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/sqlcache/Employee.java index 13e648994..2706e1032 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/sqlcache/Employee.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/sqlcache/Employee.java @@ -33,9 +33,9 @@ import javax.persistence.Table; @Table(name="EMPLOYEE_PQC") public class Employee { - public enum Category {PERMANENT, CONTRACTOR, TEMP}; + public enum Category {PERMANENT, CONTRACTOR, TEMP} - @Id + @Id @GeneratedValue private long id; diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/sqlcache/TestExternalizedParameter.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/sqlcache/TestExternalizedParameter.java index 03a64af53..732f7056e 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/sqlcache/TestExternalizedParameter.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/sqlcache/TestExternalizedParameter.java @@ -95,7 +95,7 @@ public class TestExternalizedParameter extends TestCase { if (userObject == null || !userObject.getClass().isArray() || ((Object[])userObject).length != 2) return null; Object executor = ((Object[])userObject)[1]; - if (executor instanceof StoreQuery.Executor == false) + if (!(executor instanceof StoreQuery.Executor)) return null; return ((StoreQuery.Executor)executor).getQueryExpressions(); } diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/strategy/MappedEntity.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/strategy/MappedEntity.java index 60df9bec9..1f05849a5 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/strategy/MappedEntity.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/strategy/MappedEntity.java @@ -28,7 +28,7 @@ public class MappedEntity { public enum Key { A, B, C - }; + } @Id @GeneratedValue(strategy = GenerationType.IDENTITY) diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/unique/TestNamedUniqueConstraint.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/unique/TestNamedUniqueConstraint.java index cc354e246..17dcf0753 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/unique/TestNamedUniqueConstraint.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/unique/TestNamedUniqueConstraint.java @@ -102,7 +102,7 @@ public class TestNamedUniqueConstraint extends SQLListenerTestCase { for (int i = 2; i < tokens.size(); i++) { tokens1.add(tokens.get(i)); } - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); for (String token : tokens1) { buf.append(token).append(" "); } diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/update/TestParentChild.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/update/TestParentChild.java index 2618280e6..3f43b462b 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/update/TestParentChild.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/update/TestParentChild.java @@ -85,10 +85,10 @@ public class TestParentChild extends CombinatorialPersistenceTestCase { IMPLICIT_CASCADE, CHILD_THEN_PARENT, PARENT_THEN_CHILD - }; + } - // The options are added in a static block, so that we can count on + // The options are added in a static block, so that we can count on // total number of combinations before the test is set up. static { getHelper().addOption(Key_MappingDefaults, Option_MappingDefaults); diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestFieldState.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestFieldState.java index 7fb8c531d..2b12304c0 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestFieldState.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestFieldState.java @@ -75,7 +75,7 @@ public class TestFieldState extends BaseKernelTest { a.setStringField(a.getStringField()); OpenJPAStateManager sm = getStateManager(a, pm); FieldMetaData fmd = sm.getMetaData().getField("stringField"); - assertTrue(sm.getDirty().get(fmd.getIndex()) == false); + assertTrue(!sm.getDirty().get(fmd.getIndex())); endTx(pm); endEm(pm); diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestPersistentMaps.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestPersistentMaps.java index 3ad4d6743..8e090237e 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestPersistentMaps.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestPersistentMaps.java @@ -332,7 +332,7 @@ public class TestPersistentMaps extends BaseKernelTest { // now try to execute queries against multiple other // map instances, so we can make sure the joins are robust for (int j = 0; j < mapNames.length; j++) { - StringBuffer query = new StringBuffer(selectWhere); + StringBuilder query = new StringBuilder(selectWhere); for (int k = 0; k < j; k++) { query.append(mapNames[k] + ".isEmpty() && "); diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestPessimisticLockException.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestPessimisticLockException.java index f7a2863c8..a1b1433fb 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestPessimisticLockException.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestPessimisticLockException.java @@ -76,7 +76,7 @@ public class TestPessimisticLockException extends SQLListenerTestCase { if (t1.gotPLEx && t2.gotPLEx) { fail("Both threads got a PersistenceLockException! " + "Only one thread should have received a PersistenceLockException"); - } else if (t1.gotPLEx == false && t2.gotPLEx == false) { + } else if (!t1.gotPLEx && !t2.gotPLEx) { fail("Neither thread got a PersistenceLockException! " + "One thread should have received a PersistenceLockException"); } else if (t1.count < 2 && t2.count < 2) { diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestPessimisticLocking.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestPessimisticLocking.java index e779ef3fd..d027f0789 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestPessimisticLocking.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestPessimisticLocking.java @@ -240,7 +240,7 @@ public class TestPessimisticLocking extends BaseKernelTest { getLog().trace( Thread.currentThread().getName() + ": obtained and locked: " + a); - yield(); + Thread.yield(); super.wait(50); getLog().trace( Thread.currentThread().getName() @@ -261,7 +261,7 @@ public class TestPessimisticLocking extends BaseKernelTest { + Thread.currentThread().getName() + ")", ex); } - yield(); + Thread.yield(); } finally { if (_lock != null) diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestSecondClassValues.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestSecondClassValues.java index 2c83093ff..86aa7958e 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestSecondClassValues.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestSecondClassValues.java @@ -616,7 +616,7 @@ public class TestSecondClassValues extends BaseKernelTest { } - StringBuffer buf = new StringBuffer().append("[") + StringBuilder buf = new StringBuilder().append("[") .append("(size=").append(list.size()).append(")"); Iterator it = list.iterator(); @@ -630,7 +630,7 @@ public class TestSecondClassValues extends BaseKernelTest { } private String dumpDates(Collection coll) { - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); for (Iterator i = coll.iterator(); i.hasNext();) buf.append(((Date) i.next()).getTime()).append( i.hasNext() ? "," : ""); diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/Blobs.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/Blobs.java index 2d07dec5d..8e79a9206 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/Blobs.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/Blobs.java @@ -38,7 +38,7 @@ public class Blobs implements Serializable { @Lob @Column(name = "lobNotNullable", nullable = false) - protected byte[] lobNotNullable;; + protected byte[] lobNotNullable; @Id public int id; diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/TestValueStrategies.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/TestValueStrategies.java index 8e42057cc..6975d0bf8 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/TestValueStrategies.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/TestValueStrategies.java @@ -354,7 +354,6 @@ public class TestValueStrategies } if (isActiveTx(pm)) rollbackTx(pm); - ; endEm(pm); } diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/proxy/entities/AnnuityHolderCategory.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/proxy/entities/AnnuityHolderCategory.java index dd499d32b..75147aa48 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/proxy/entities/AnnuityHolderCategory.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/proxy/entities/AnnuityHolderCategory.java @@ -19,5 +19,5 @@ package org.apache.openjpa.persistence.proxy.entities; public enum AnnuityHolderCategory { - METAL, BRONZE, SILVER, GOLD; + METAL, BRONZE, SILVER, GOLD } diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/proxy/entities/AnnuityType.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/proxy/entities/AnnuityType.java index 432f9c17c..46c88e313 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/proxy/entities/AnnuityType.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/proxy/entities/AnnuityType.java @@ -19,5 +19,5 @@ package org.apache.openjpa.persistence.proxy.entities; public enum AnnuityType { - BASIC, EQUITY, FIXED; + BASIC, EQUITY, FIXED } diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/proxy/entities/ContactType.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/proxy/entities/ContactType.java index 6ffa7f92d..5cfcc5bcb 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/proxy/entities/ContactType.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/proxy/entities/ContactType.java @@ -19,5 +19,5 @@ package org.apache.openjpa.persistence.proxy.entities; public enum ContactType { - HOME, BUSINESS, OTHER; + HOME, BUSINESS, OTHER } diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/proxy/entities/RiderType.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/proxy/entities/RiderType.java index 0376d2c08..f2f3772d0 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/proxy/entities/RiderType.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/proxy/entities/RiderType.java @@ -19,5 +19,5 @@ package org.apache.openjpa.persistence.proxy.entities; public enum RiderType { - REPLACE, OVERRIDE; + REPLACE, OVERRIDE } diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/Customer.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/Customer.java index b25538be4..2b2bcdf71 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/Customer.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/Customer.java @@ -74,9 +74,9 @@ public class Customer { } } - public enum CreditRating { POOR, GOOD, EXCELLENT }; + public enum CreditRating { POOR, GOOD, EXCELLENT } - @EmbeddedId + @EmbeddedId CustomerKey cid; @Column(length=30) @Basic diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestQueryEscapeCharacters.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestQueryEscapeCharacters.java index 74747f932..ed56e6f6e 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestQueryEscapeCharacters.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestQueryEscapeCharacters.java @@ -97,7 +97,7 @@ public class TestQueryEscapeCharacters JDBCConfiguration conf = (JDBCConfiguration)ojpaEmf.getConfiguration(); if (conf.getDBDictionaryInstance(). - requiresSearchStringEscapeForLike == true) { + requiresSearchStringEscapeForLike) { return; } diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/relations/Customer.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/relations/Customer.java index a6bde33e3..f9d9ef586 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/relations/Customer.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/relations/Customer.java @@ -70,7 +70,7 @@ public class Customer { } } - public enum CreditRating { POOR, GOOD, EXCELLENT }; + public enum CreditRating { POOR, GOOD, EXCELLENT } @EmbeddedId CustomerKey cid; diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/relations/ManyOneCompoundIdOwnerId.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/relations/ManyOneCompoundIdOwnerId.java index 1981a693d..b5a9e288f 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/relations/ManyOneCompoundIdOwnerId.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/relations/ManyOneCompoundIdOwnerId.java @@ -51,8 +51,8 @@ public class ManyOneCompoundIdOwnerId implements Serializable { @Override public String toString() { - return String.valueOf(entityId) - + "::" + String.valueOf(longId); + return entityId + + "::" + longId; } @Override diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/sequence/TestSequence.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/sequence/TestSequence.java index 538057c63..10cc7ded0 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/sequence/TestSequence.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/sequence/TestSequence.java @@ -387,7 +387,7 @@ public class TestSequence extends SingleEMFTestCase { // get to everyone starting at the same time, the // better chance we have for identifying MT problems. while (System.currentTimeMillis() < startMillis) - yield(); + Thread.yield(); int thisIteration = 1; try { diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/simple/AllFieldTypes.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/simple/AllFieldTypes.java index 18d537392..a97aa466f 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/simple/AllFieldTypes.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/simple/AllFieldTypes.java @@ -42,7 +42,7 @@ import org.apache.openjpa.persistence.PersistentCollection; @Entity public class AllFieldTypes { - public enum EnumType {Value1, Value2}; + public enum EnumType {Value1, Value2} // @Basic types private short shortField; diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/test/AbstractPersistenceTestCase.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/test/AbstractPersistenceTestCase.java index f7ef20ec8..89aeb8e94 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/test/AbstractPersistenceTestCase.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/test/AbstractPersistenceTestCase.java @@ -184,7 +184,7 @@ public abstract class AbstractPersistenceTestCase extends TestCase { } if (!types.isEmpty()) { - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); for (Class c : types) { if (buf.length() > 0) { buf.append(";"); diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/test/ClassSelector.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/test/ClassSelector.java index 51b343e96..e5c755196 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/test/ClassSelector.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/test/ClassSelector.java @@ -220,7 +220,7 @@ public class ClassSelector { * Gets a printable description of the currently set selection criteria. */ public String getSpecification() { - StringBuffer tmp = new StringBuffer(); + StringBuilder tmp = new StringBuilder(); String and = ""; if (!_supers.isEmpty()) { tmp.append("\textends "); diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/test/CombinatorialTestHelper.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/test/CombinatorialTestHelper.java index ff030e596..396bc1613 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/test/CombinatorialTestHelper.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/test/CombinatorialTestHelper.java @@ -170,7 +170,7 @@ public class CombinatorialTestHelper { * Gets the key and values of the current options as printable string. */ public String getOptionsAsString() { - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); for (int i = 0; i c : types) { if (buf.length() > 0) buf.append(";"); diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/test/SQLListenerTestCase.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/test/SQLListenerTestCase.java index 335195cae..778d50daf 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/test/SQLListenerTestCase.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/test/SQLListenerTestCase.java @@ -211,7 +211,7 @@ public abstract class SQLListenerTestCase } public String toString(List list) { - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); for (String s : list) buf.append(s).append("\r\n"); return buf.toString(); @@ -230,7 +230,7 @@ public abstract class SQLListenerTestCase public enum SQLAssertType { SQL, NotSQL, ContainsSQL, AllSQLInOrder, AllExactSQLInOrder, AllSQLAnyOrder, NoneSQLAnyOrder, AnySQLAnyOrder - }; + } public class SQLAssertions { SQLAssertType type; diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/xmlmapping/entities/Customer.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/xmlmapping/entities/Customer.java index e7d8f93cd..7cbab9856 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/xmlmapping/entities/Customer.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/xmlmapping/entities/Customer.java @@ -72,9 +72,9 @@ public class Customer { } } - public enum CreditRating { POOR, GOOD, EXCELLENT }; + public enum CreditRating { POOR, GOOD, EXCELLENT } - @EmbeddedId + @EmbeddedId CustomerKey cid; @Column(length=30) String name; diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/xmlmapping/xmlbindings/myaddress/Address.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/xmlmapping/xmlbindings/myaddress/Address.java index aba0fddd1..58b0ed620 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/xmlmapping/xmlbindings/myaddress/Address.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/xmlmapping/xmlbindings/myaddress/Address.java @@ -148,7 +148,7 @@ public class Address { @Override public String toString() { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); sb.append(this.name); for (int i=0; i< this.getStreet().size(); i++) sb.append("\n "+this.getStreet().get(i)); diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/xmlmapping/xmlbindings/myaddress/CANAddress.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/xmlmapping/xmlbindings/myaddress/CANAddress.java index 3c6e13d3c..2b6060fe5 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/xmlmapping/xmlbindings/myaddress/CANAddress.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/xmlmapping/xmlbindings/myaddress/CANAddress.java @@ -103,7 +103,7 @@ public class CANAddress @Override public String toString() { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); sb.append(super.toString()) .append("\n ") .append(this.province) diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/xmlmapping/xmlbindings/myaddress/GBRAddress.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/xmlmapping/xmlbindings/myaddress/GBRAddress.java index 10befa57e..99cbc3567 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/xmlmapping/xmlbindings/myaddress/GBRAddress.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/xmlmapping/xmlbindings/myaddress/GBRAddress.java @@ -103,7 +103,7 @@ public class GBRAddress @Override public String toString() { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); sb.append(super.toString()) .append("\n ") .append(this.county) diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/xmlmapping/xmlbindings/myaddress/USAAddress.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/xmlmapping/xmlbindings/myaddress/USAAddress.java index 4c0791b66..51266e7ce 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/xmlmapping/xmlbindings/myaddress/USAAddress.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/xmlmapping/xmlbindings/myaddress/USAAddress.java @@ -95,7 +95,7 @@ public class USAAddress @Override public String toString() { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); sb.append(super.toString()) .append("\n ") .append(this.state) diff --git a/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lock/extended/LockScopeTestCase.java b/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lock/extended/LockScopeTestCase.java index 97c597560..cb1755930 100644 --- a/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lock/extended/LockScopeTestCase.java +++ b/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lock/extended/LockScopeTestCase.java @@ -81,7 +81,7 @@ public abstract class LockScopeTestCase extends SQLListenerTestCase { protected final String DB2Lock = DB2LockClause + "{1}"; protected final String NoDB2Lock = DB2LockClause + "{0}"; - protected List empTableName = new ArrayList<>();; + protected List empTableName = new ArrayList<>(); protected Map normalProps; protected Map extendedProps; @@ -123,7 +123,7 @@ public abstract class LockScopeTestCase extends SQLListenerTestCase { protected enum DBType { access, db2, derby, empress, foxpro, h2, hsql, informix, ingres, jdatastore, mariadb, mysql, oracle, pointbase, postgres, sqlserver, sybase - }; + } protected DBType getDBType(EntityManager em) { JDBCConfigurationImpl conf = (JDBCConfigurationImpl) getConfiguration(em); diff --git a/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/SequencedActionsTest.java b/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/SequencedActionsTest.java index 7dd7818a3..4422abc41 100644 --- a/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/SequencedActionsTest.java +++ b/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/SequencedActionsTest.java @@ -255,7 +255,7 @@ public abstract class SequencedActionsTest extends SQLListenerTestCase { TestLockMode, // (int id, LockModeType lockMode) Test, // Open-ended testing actions - }; + } public void launchActionSequence(String testName, Object parameters, Object[][]... actions) { @@ -1045,7 +1045,7 @@ public abstract class SequencedActionsTest extends SQLListenerTestCase { protected enum DBType { access, db2, derby, empress, foxpro, h2, hsql, informix, ingres, jdatastore, mariadb, mysql, oracle, pointbase, postgres, sqlserver, sybase - }; + } protected DBType getDBType(EntityManager em) { JDBCConfigurationImpl conf = (JDBCConfigurationImpl) getConfiguration(em); diff --git a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AbstractQuery.java b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AbstractQuery.java index 3a1b0fcb9..eef70eef3 100644 --- a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AbstractQuery.java +++ b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AbstractQuery.java @@ -125,8 +125,8 @@ public abstract class AbstractQuery implements OpenJPAQuerySPI { */ @Override public OpenJPAQuery setParameter(int pos, Object value) { - if (_convertPositionalParams == true) { - return setParameter("_" + String.valueOf(pos), value); + if (_convertPositionalParams) { + return setParameter("_" + pos, value); } assertOpen(); @@ -322,8 +322,8 @@ public abstract class AbstractQuery implements OpenJPAQuerySPI { */ @Override public Parameter getParameter(int pos, Class type) { - if (_convertPositionalParams == true) { - return getParameter("_" + String.valueOf(pos), type); + if (_convertPositionalParams) { + return getParameter("_" + pos, type); } Parameter param = getParameter(pos); if (param.getParameterType().isAssignableFrom(type)) @@ -419,8 +419,8 @@ public abstract class AbstractQuery implements OpenJPAQuerySPI { */ @Override public Parameter getParameter(int pos) { - if (_convertPositionalParams == true) { - return getParameter("_" + String.valueOf(pos)); + if (_convertPositionalParams) { + return getParameter("_" + pos); } Parameter param = getDeclaredParameters().get(pos); if (param == null) diff --git a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceMetaDataParser.java b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceMetaDataParser.java index 7fb17c142..68e492cf2 100644 --- a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceMetaDataParser.java +++ b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceMetaDataParser.java @@ -1927,7 +1927,7 @@ public class AnnotationPersistenceMetaDataParser lm = lm.toLowerCase(); if (lm.contains("pessimistic")) { if (lmt == LockModeType.NONE && !optimistic) { - if (_log.isWarnEnabled() == true) { + if (_log.isWarnEnabled()) { _log.warn(_loc.get("override-named-query-lock-mode", new String[] { "annotation", query.name(), _cls.getName() })); } diff --git a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/HintValueConverter.java b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/HintValueConverter.java index 6355295f0..e34ceda4b 100644 --- a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/HintValueConverter.java +++ b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/HintValueConverter.java @@ -154,7 +154,7 @@ public interface HintValueConverter { @Override public Object convert(Object s) { - if (s instanceof String == false) + if (!(s instanceof String)) return s; String str = s.toString(); if (strings == null) { diff --git a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataDefaults.java b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataDefaults.java index 6953db7f5..ce5701a1e 100644 --- a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataDefaults.java +++ b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataDefaults.java @@ -701,7 +701,7 @@ public class PersistenceMetaDataDefaults public Member getMemberByProperty(ClassMetaData meta, String property, int access, boolean applyDefaultRule) { Class cls = meta.getDescribedType(); - Field field = Reflection.findField(cls, property, false);; + Field field = Reflection.findField(cls, property, false); Method getter = Reflection.findGetter(cls, property, false); Method setter = Reflection.findSetter(cls, property, false); int accessCode = AccessCode.isUnknown(access) ? meta.getAccessType() : diff --git a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProviderImpl.java b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProviderImpl.java index 9cfd5207e..181796486 100644 --- a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProviderImpl.java +++ b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProviderImpl.java @@ -361,9 +361,9 @@ public class PersistenceProviderImpl OpenJPAConfiguration conf = factory.getConfiguration(); Log log = conf.getLog(OpenJPAConfiguration.LOG_RUNTIME); - if (conf.getDynamicEnhancementAgent() == true) { + if (conf.getDynamicEnhancementAgent()) { boolean res = PCEnhancerAgent.loadDynamicAgent(log); - if (log.isInfoEnabled() && res == true ){ + if (log.isInfoEnabled() && res){ log.info(_loc.get("dynamic-agent")); } } @@ -379,7 +379,7 @@ public class PersistenceProviderImpl OpenJPAConfiguration conf = factory.getConfiguration(); Log log = conf.getLog(OpenJPAConfiguration.LOG_RUNTIME); - if ((ValidationUtils.setupValidation(conf) == true) && + if ((ValidationUtils.setupValidation(conf)) && log.isInfoEnabled()) { log.info(_loc.get("vlem-creation-info")); } diff --git a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/XMLPersistenceMetaDataParser.java b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/XMLPersistenceMetaDataParser.java index fc5e3db6f..72440e640 100644 --- a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/XMLPersistenceMetaDataParser.java +++ b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/XMLPersistenceMetaDataParser.java @@ -1955,7 +1955,7 @@ public class XMLPersistenceMetaDataParser lm = lm.toLowerCase(); if (lm.contains("pessimistic")) { if (lmt == LockModeType.NONE && !optimistic) { - if (log != null && log.isWarnEnabled() == true) { + if (log != null && log.isWarnEnabled()) { log.warn(_loc.get("override-named-query-lock-mode", new String[] { "xml", queryName, _cls.getName() })); } diff --git a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/CriteriaExpressionBuilder.java b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/CriteriaExpressionBuilder.java index 33e7b29db..c7f163d57 100644 --- a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/CriteriaExpressionBuilder.java +++ b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/CriteriaExpressionBuilder.java @@ -160,7 +160,7 @@ class CriteriaExpressionBuilder { exps.grouping = new Value[groupByCount]; for (int i = 0; i < groupByCount; i++) { Expression groupBy = groups.get(i); - exps.grouping[i] = Expressions.toValue((ExpressionImpl)groupBy, factory, q);; + exps.grouping[i] = Expressions.toValue((ExpressionImpl)groupBy, factory, q); } exps.having = having == null ? null : having.toKernelExpression(factory, q); diff --git a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/PathImpl.java b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/PathImpl.java index 6ab55c92c..b6861ae14 100644 --- a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/PathImpl.java +++ b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/PathImpl.java @@ -91,7 +91,7 @@ class PathImpl extends ExpressionImpl implements Path { */ @Override public Bindable getModel() { - if (_member instanceof Bindable == false) { + if (!(_member instanceof Bindable)) { throw new IllegalArgumentException(this + " represents a basic path and not a bindable"); } return (Bindable)_member; diff --git a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/SubqueryImpl.java b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/SubqueryImpl.java index 9e9fb5b9f..0b6c9e4bc 100644 --- a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/SubqueryImpl.java +++ b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/SubqueryImpl.java @@ -32,7 +32,6 @@ import javax.persistence.criteria.Expression; import javax.persistence.criteria.Join; import javax.persistence.criteria.ListJoin; import javax.persistence.criteria.MapJoin; -import javax.persistence.criteria.ParameterExpression; import javax.persistence.criteria.Predicate; import javax.persistence.criteria.Root; import javax.persistence.criteria.SetJoin; diff --git a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/meta/CompileTimeLogger.java b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/meta/CompileTimeLogger.java index 44311a0fd..4fbd7b59f 100644 --- a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/meta/CompileTimeLogger.java +++ b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/meta/CompileTimeLogger.java @@ -33,7 +33,8 @@ import org.apache.openjpa.lib.util.Localizer; * */ public class CompileTimeLogger { - private static enum Level {TRACE, INFO, WARN, ERROR}; + private static enum Level {TRACE, INFO, WARN, ERROR} + private static Localizer _loc = Localizer.forPackage(CompileTimeLogger.class); private static Level DEFAULT_LEVEL = Level.WARN; private int logLevel; diff --git a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/meta/MetamodelImpl.java b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/meta/MetamodelImpl.java index 593eb71e3..5586d2a8f 100644 --- a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/meta/MetamodelImpl.java +++ b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/meta/MetamodelImpl.java @@ -368,7 +368,7 @@ public class MetamodelImpl implements Metamodel, Resolver { */ ParameterizedType getParameterizedType(Field mf) { java.lang.reflect.Type t = mf.getGenericType(); - if (t instanceof ParameterizedType == false) { + if (!(t instanceof ParameterizedType)) { repos.getLog().warn(_loc.get("meta-field-not-param", mf.getDeclaringClass(), mf.getName(), toTypeName(t)).getMessage()); return null; @@ -391,7 +391,7 @@ public class MetamodelImpl implements Metamodel, Resolver { return toTypeName(((GenericArrayType)type). getGenericComponentType())+"[]"; } - if (type instanceof ParameterizedType == false) { + if (!(type instanceof ParameterizedType)) { Class cls = (Class)type; return cls.getName(); } diff --git a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/meta/SourceAnnotationHandler.java b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/meta/SourceAnnotationHandler.java index 504066397..cc800faea 100644 --- a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/meta/SourceAnnotationHandler.java +++ b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/meta/SourceAnnotationHandler.java @@ -551,7 +551,7 @@ public class SourceAnnotationHandler return (TypeMirror)target; } - }; + } return null; } diff --git a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/ConditionalOperator.java b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/ConditionalOperator.java index 561888228..05bc05a0f 100644 --- a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/ConditionalOperator.java +++ b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/ConditionalOperator.java @@ -27,5 +27,5 @@ package org.apache.openjpa.persistence.query; */ public enum ConditionalOperator { AND, - OR; + OR } diff --git a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/QueryDefinitionImpl.java b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/QueryDefinitionImpl.java index b643eff14..64581ff53 100644 --- a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/QueryDefinitionImpl.java +++ b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/QueryDefinitionImpl.java @@ -50,9 +50,9 @@ public class QueryDefinitionImpl extends ExpressionImpl private Predicate _where; private Predicate _having; - private static enum Visit {PROJECTION, EXPRESSION, JOINABLE}; + private static enum Visit {PROJECTION, EXPRESSION, JOINABLE} - protected static Localizer _loc = + protected static Localizer _loc = Localizer.forPackage(QueryDefinitionImpl.class); /** diff --git a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/util/ReservedWords.java b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/util/ReservedWords.java index 4f6e1c1a1..ef3946966 100644 --- a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/util/ReservedWords.java +++ b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/util/ReservedWords.java @@ -57,7 +57,7 @@ public class ReservedWords { "UNKNOWN[50]", "UPDATE", "UPPER", "VALUE", "WHEN", "WHERE")); - }; + } /** * Affirms if the given string matches any of the JPA reserved words in a case-insensitive manner. diff --git a/openjpa-persistence/src/test/java/org/apache/openjpa/persistence/TestPersistenceProductDerivation.java b/openjpa-persistence/src/test/java/org/apache/openjpa/persistence/TestPersistenceProductDerivation.java index 5734d3e88..3000c2615 100644 --- a/openjpa-persistence/src/test/java/org/apache/openjpa/persistence/TestPersistenceProductDerivation.java +++ b/openjpa-persistence/src/test/java/org/apache/openjpa/persistence/TestPersistenceProductDerivation.java @@ -96,7 +96,7 @@ public class TestPersistenceProductDerivation { // really matter since we generate a new file every time. boolean deleted = AccessController.doPrivileged(J2DoPrivHelper .deleteAction(targetFile)); - if(deleted==false){ + if(!deleted){ System.out.println("The file " + targetFile + " wasn't deleted."); } } diff --git a/openjpa-slice/src/main/java/org/apache/openjpa/slice/Slice.java b/openjpa-slice/src/main/java/org/apache/openjpa/slice/Slice.java index ac2712c53..040276ca7 100644 --- a/openjpa-slice/src/main/java/org/apache/openjpa/slice/Slice.java +++ b/openjpa-slice/src/main/java/org/apache/openjpa/slice/Slice.java @@ -37,7 +37,7 @@ public class Slice implements Comparable,Serializable { ACTIVE, INACTIVE, // configured but not available EXCLUDED // configured but not used - }; + } private final String name; private transient final OpenJPAConfiguration conf; diff --git a/openjpa-slice/src/test/java/org/apache/openjpa/slice/PersistenceTestCase.java b/openjpa-slice/src/test/java/org/apache/openjpa/slice/PersistenceTestCase.java index 838523a68..33c0e8a0d 100644 --- a/openjpa-slice/src/test/java/org/apache/openjpa/slice/PersistenceTestCase.java +++ b/openjpa-slice/src/test/java/org/apache/openjpa/slice/PersistenceTestCase.java @@ -104,7 +104,7 @@ public abstract class PersistenceTestCase } if (!types.isEmpty()) { - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); for (Class c : types) { if (buf.length() > 0) buf.append(";"); diff --git a/openjpa-tools/openjpa-fetch-statistics/src/main/java/org/apache/openjpa/enhance/stats/FetchStatisticsAuxEnhancer.java b/openjpa-tools/openjpa-fetch-statistics/src/main/java/org/apache/openjpa/enhance/stats/FetchStatisticsAuxEnhancer.java index a73df0bb4..7ec6af585 100644 --- a/openjpa-tools/openjpa-fetch-statistics/src/main/java/org/apache/openjpa/enhance/stats/FetchStatisticsAuxEnhancer.java +++ b/openjpa-tools/openjpa-fetch-statistics/src/main/java/org/apache/openjpa/enhance/stats/FetchStatisticsAuxEnhancer.java @@ -44,12 +44,12 @@ public class FetchStatisticsAuxEnhancer implements AuxiliaryEnhancer { @Override public void run(BCClass bcc, ClassMetaData cmd) { addEnhancement(bcc, cmd); - }; + } @Override public boolean skipEnhance(BCMethod arg0) { return false; - }; + } private void addEnhancement(BCClass bcc, ClassMetaData cmd) { Log log = cmd.getRepository().getConfiguration().getLog(OpenJPAConfiguration.LOG_RUNTIME); diff --git a/openjpa-xmlstore/src/test/java/org/apache/openjpa/xmlstore/simple/AllFieldTypes.java b/openjpa-xmlstore/src/test/java/org/apache/openjpa/xmlstore/simple/AllFieldTypes.java index 4ef6e68b2..ed3b919fe 100644 --- a/openjpa-xmlstore/src/test/java/org/apache/openjpa/xmlstore/simple/AllFieldTypes.java +++ b/openjpa-xmlstore/src/test/java/org/apache/openjpa/xmlstore/simple/AllFieldTypes.java @@ -39,7 +39,7 @@ public class AllFieldTypes implements Serializable { private static final long serialVersionUID = 1L; - public static enum EnumType {Value1, Value2}; + public static enum EnumType {Value1, Value2} // @Basic types private short shortField;