diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/descriptors/DescriptorQueryManager.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/descriptors/DescriptorQueryManager.java index d984eb661d9..109a652b165 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/descriptors/DescriptorQueryManager.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/descriptors/DescriptorQueryManager.java @@ -140,7 +140,7 @@ public class DescriptorQueryManager implements Cloneable, Serializable { * Initialize the state of the descriptor query manager */ public DescriptorQueryManager() { - this.queries = new LinkedHashMap(5); + this.queries = new LinkedHashMap<>(5); setDoesExistQuery(new DoesExistQuery());// Always has a does exist. this.setQueryTimeout(DefaultTimeout); this.setQueryTimeoutUnit(DefaultTimeoutUnit); @@ -199,7 +199,7 @@ public synchronized void addQuery(DatabaseQuery query) { // Add query has been synchronized for bug 3355199. // Additionally code has been added to ensure that the same query is not added twice. - Vector queriesByName = (Vector)getQueries().get(query.getName()); + List queriesByName = getQueries().get(query.getName()); if (queriesByName == null) { // lazily create Vector in Hashtable. queriesByName = org.eclipse.persistence.internal.helper.NonSynchronizedVector.newInstance(); @@ -209,14 +209,14 @@ public synchronized void addQuery(DatabaseQuery query) { if (query.getArguments() != null) { argumentTypesSize = query.getArguments().size(); } - List argumentTypes = new ArrayList(argumentTypesSize); + List argumentTypes = new ArrayList<>(argumentTypesSize); for (int i = 0; i < argumentTypesSize; i++) { argumentTypes.add(query.getArgumentTypeNames().get(i)); } // Search for a query with the same parameters and replace it if one is found for (int i = 0; i < queriesByName.size(); i++) { - DatabaseQuery currentQuery = (DatabaseQuery)queriesByName.get(i); + DatabaseQuery currentQuery = queriesByName.get(i); // Here we are checking equality instead of assignability. If you look at getQuery() // it is the other way around. @@ -281,12 +281,12 @@ public Object clone() { } // Bug 3037701 - clone the queries - manager.setQueries(new LinkedHashMap(getQueries().size()));//bug5677655 + manager.setQueries(new LinkedHashMap<>(getQueries().size()));//bug5677655 Iterator> iterator = queries.values().iterator(); while (iterator.hasNext()) { - Iterator queriesForKey = ((Vector)iterator.next()).iterator(); + Iterator queriesForKey = iterator.next().iterator(); while (queriesForKey.hasNext()) { - DatabaseQuery initialQuery = (DatabaseQuery)queriesForKey.next(); + DatabaseQuery initialQuery = queriesForKey.next(); DatabaseQuery clonedQuery = (DatabaseQuery)initialQuery.clone(); clonedQuery.setDescriptor(manager.getDescriptor()); manager.addQuery(clonedQuery); @@ -329,9 +329,9 @@ public boolean containsQuery(String queryName) { public void convertClassNamesToClasses(ClassLoader classLoader){ Iterator> queryVectors = getQueries().values().iterator(); while (queryVectors.hasNext()){ - Iterator queries = ((Vector)queryVectors.next()).iterator(); + Iterator queries = queryVectors.next().iterator(); while (queries.hasNext()){ - ((DatabaseQuery)queries.next()).convertClassNamesToClasses(classLoader); + queries.next().convertClassNamesToClasses(classLoader); } } if (getReadObjectQuery() != null) { @@ -497,7 +497,7 @@ public Map> getQueries() { * @see #getQueries() */ public Vector getAllQueries() { - Vector allQueries = new Vector(); + Vector allQueries = new Vector<>(); for (Iterator> vectors = getQueries().values().iterator(); vectors.hasNext();) { allQueries.addAll(vectors.next()); } @@ -575,7 +575,7 @@ public DatabaseQuery getQuery(String name, Vector arguments) { * @see #getQuery(String) */ public DatabaseQuery getLocalQuery(String name, Vector arguments) { - Vector queries = (Vector)getQueries().get(name); + List queries = getQueries().get(name); if (queries == null) { return null; @@ -583,7 +583,7 @@ public DatabaseQuery getLocalQuery(String name, Vector arguments) { // Short circuit the simple, most common case of only one query. if (queries.size() == 1) { - return (DatabaseQuery)queries.firstElement(); + return queries.get(0); } // CR#3754; Predrag; mar 19/2002; @@ -1156,14 +1156,12 @@ public void removeQuery(String queryName) { * @see #removeQuery(String) */ public void removeQuery(String queryName, Vector argumentTypes) { - Vector queries = (Vector)getQueries().get(queryName); - if (queries == null) { - return; - } else { + List queries = getQueries().get(queryName); + if (queries != null) { DatabaseQuery query = null; - for (Enumeration enumtr = queries.elements(); enumtr.hasMoreElements();) { - query = (DatabaseQuery)enumtr.nextElement(); - if (Helper.areTypesAssignable(argumentTypes, query.getArgumentTypes())) { + for (DatabaseQuery q : queries) { + if (Helper.areTypesAssignable(argumentTypes, q.getArgumentTypes())) { + query = q; break; } } diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/descriptors/WrapperPolicy.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/descriptors/WrapperPolicy.java index 4ecad374718..9c8cfc0a570 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/descriptors/WrapperPolicy.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/descriptors/WrapperPolicy.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2021 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0 which is available at @@ -70,7 +70,7 @@ public interface WrapperPolicy extends Serializable { * PUBLIC: * Required: Wrap the object to return the implementation that the application requires. * The object may already be wrapped in which case the object should be returned. - * @param original, the object to be wrapped + * @param original the object to be wrapped * @param session the session to wrap the object against. * @return java.lang.Object the wrapped object */ diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/dynamic/DynamicEntity.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/dynamic/DynamicEntity.java index 37ce71a973e..dcd9dc8ce58 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/dynamic/DynamicEntity.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/dynamic/DynamicEntity.java @@ -55,8 +55,8 @@ public interface DynamicEntity { * @param * generic type of the property (if not provided, assume Object). * If the property cannot be cast to the specific type, a {@link DynamicException}will be thrown. - * @param - * propertyName the name of a mapped property + * @param propertyName + * the name of a mapped property * If the property cannot be found, a {@link DynamicException} will be thrown. * @return * persistent value or relationship container of the specified type @@ -66,11 +66,11 @@ public interface DynamicEntity { /** * Set the persistence value for the given property to the specified value * - * @param - * propertyName the name of a mapped property + * @param propertyName + * the name of a mapped property * If the property cannot be found, a {@link DynamicException} will be thrown. - * @param - * value the specified object + * @param value + * the specified object * @return * the same DynamicEntity instance */ @@ -79,8 +79,8 @@ public interface DynamicEntity { /** * Discover if a property has a persistent value * - * @param - * propertyName the name of a mapped property + * @param propertyName + * the name of a mapped property * If the property cannot be found, a {@link DynamicException} will be thrown. * @return * true if the property has been set diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/databaseaccess/DatabasePlatform.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/databaseaccess/DatabasePlatform.java index 3232def60a3..04b0cffd043 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/databaseaccess/DatabasePlatform.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/databaseaccess/DatabasePlatform.java @@ -533,8 +533,6 @@ public int appendParameterInternal(Call call, Writer writer, Object parameter) { java.time.OffsetTime ot = (java.time.OffsetTime) dbValue; java.sql.Timestamp ts = java.sql.Timestamp.valueOf(java.time.LocalDateTime.of(java.time.LocalDate.ofEpochDay(0), ot.toLocalTime())); appendTimestamp(ts, writer); - } else if (dbValue instanceof java.time.LocalDate){ - appendDate(java.sql.Date.valueOf((java.time.LocalDate) dbValue), writer); } else if (dbValue instanceof java.sql.Date) { appendDate((java.sql.Date)dbValue, writer); } else if (dbValue == null) { diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/expressions/RelationExpression.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/expressions/RelationExpression.java index 265f7752d5e..e09dd6bc2a7 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/expressions/RelationExpression.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/expressions/RelationExpression.java @@ -646,7 +646,7 @@ public Expression normalize(ExpressionNormalizer normalizer) { for (DatabaseField field : sourceFields) { fieldExpressions.add(left.getField(field)); } - newLeft = getBuilder().value(sourceFields); + newLeft = getBuilder().value(fieldExpressions); } else { newLeft = left.getField(sourceField); } diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/localization/i18n/DMSLocalizationResource.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/localization/i18n/DMSLocalizationResource.java index ca8392af87c..f6a2822623d 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/localization/i18n/DMSLocalizationResource.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/localization/i18n/DMSLocalizationResource.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2021 Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1998, 2018 IBM Corporation and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the @@ -46,7 +46,8 @@ public class DMSLocalizationResource extends ListResourceBundle { { "disconnect_call", "Total number of disconnect calls made" }, { "cache_hits", "The number of times that the object was found in the cache"}, { "cache_misses", "The number of times that the object was not found in the cache" }, - { "sql_prepare", "Time spent in JDBC preparing the Statement." + "Also includes the time spent in EIS creating an Interaction associated with a connection, and creating input and output Record objects" }, + { "sql_prepare", "Time spent in JDBC preparing the Statement. " + + "Also includes the time spent in EIS creating an Interaction associated with a connection, and creating input and output Record objects" }, { "query_prepareation", "Time to prepare the query" }, { "sql_generation", "Time spent generating SQL. In the case of TopLink expressions, time spent converting Expression to SQL" }, { "database_execute", "Time spent in calls to the JDBC Statement, includes time spent in calls to: close, executeUpdate, and executeQuery" }, diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/localization/i18n/LoggingLocalizationResource.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/localization/i18n/LoggingLocalizationResource.java index 81ff310bd0d..1b9f57f3eb9 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/localization/i18n/LoggingLocalizationResource.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/localization/i18n/LoggingLocalizationResource.java @@ -139,7 +139,8 @@ public class LoggingLocalizationResource extends ListResourceBundle { { "extra_finder", "There is a finder defined on the [{0}] " + "home interface(s) but the corresponding finder [{1}{2}] " + "entry is not declared in the ejb-jar.xml." }, { "cmp_and_cmr_field", "The ejb-jar.xml entry for [{0}] contains both a and entry for the attribute [{1}]. The entry will be ignored." }, - { "toplink_cmp_bean_name_xml_deprecated", "Support for toplink-cmp-bean_name.xml is deprecated." + "Please refer to the documentation for the use of toplink-ejb-jar.xml" }, + { "toplink_cmp_bean_name_xml_deprecated", "Support for toplink-cmp-bean_name.xml is deprecated. " + + "Please refer to the documentation for the use of toplink-ejb-jar.xml" }, { "drop_connection_on_error", "Warning: Dropping remote command connection to {0} on error {1}" }, { "received_corrupt_announcement", "Warning: Discovery manager could not process service announcement due to {0} - ignoring announcement" }, diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/XMLMarshaller.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/XMLMarshaller.java index 8d65256ce7a..d4c02c20c4d 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/XMLMarshaller.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/XMLMarshaller.java @@ -1201,7 +1201,7 @@ private void marshalStreamOrWriter(Object object, MarshalRecord marshalRecord, A * (such as FileWriters and OutputStreamWriters). */ private Writer wrapWriter(Writer writer) { - if (writer instanceof OutputStreamWriter || writer instanceof FileWriter) { + if (writer instanceof OutputStreamWriter) { return new BufferedWriter(writer); } return writer; diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/XMLSequencedDescriptor.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/XMLSequencedDescriptor.java index 7072d4bc794..5f1582160ab 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/XMLSequencedDescriptor.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/XMLSequencedDescriptor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2021 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0 which is available at @@ -58,7 +58,7 @@ public String getGetSettingsMethodName() { * INTERNAL: * Set the name of the method to be invoked to obtain an ordered list of TopLinkSetting * objects at runtime. Only used with Sequenced objects. - * @param methodName: The name of the method. + * @param methodName The name of the method. */ public void setGetSettingsMethodName(String methodName) { this.getSettingsMethodName = methodName; diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/sessions/AbstractSession.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/sessions/AbstractSession.java index e05fa010f8d..e5ba4242cfb 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/sessions/AbstractSession.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/sessions/AbstractSession.java @@ -3858,7 +3858,7 @@ public void removeQuery(String queryName, Vector argumentTypes) { } else { DatabaseQuery query = null; for (DatabaseQuery q: queries) { - if (Helper.areTypesAssignable(argumentTypes, query.getArgumentTypes())) { + if (Helper.areTypesAssignable(argumentTypes, q.getArgumentTypes())) { query = q; break; } diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/sessions/CommitOrderCalculator.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/sessions/CommitOrderCalculator.java index 06515ae5844..da9b6bfc6e8 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/sessions/CommitOrderCalculator.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/sessions/CommitOrderCalculator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2021 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0 which is available at @@ -34,14 +34,14 @@ */ public class CommitOrderCalculator { protected int currentTime; - protected Vector nodes; + protected Vector nodes; protected Vector orderedDescriptors; protected AbstractSession session; public CommitOrderCalculator(AbstractSession session) { super(); this.currentTime = 0; - this.nodes = new Vector(1); + this.nodes = new Vector<>(1); this.session = session; } @@ -61,8 +61,8 @@ public void addNodes(Vector descriptors) { * Add to each node the dependent nodes */ public void calculateMappingDependencies() { - for (Enumeration e = nodes.elements(); e.hasMoreElements();) { - CommitOrderDependencyNode node = (CommitOrderDependencyNode)e.nextElement(); + for (Enumeration e = nodes.elements(); e.hasMoreElements();) { + CommitOrderDependencyNode node = e.nextElement(); node.recordMappingDependencies(); } } @@ -71,8 +71,8 @@ public void calculateMappingDependencies() { * Add to each node the dependent nodes */ public void calculateSpecifiedDependencies() { - for (Enumeration e = nodes.elements(); e.hasMoreElements();) { - CommitOrderDependencyNode node = (CommitOrderDependencyNode)e.nextElement(); + for (Enumeration e = nodes.elements(); e.hasMoreElements();) { + CommitOrderDependencyNode node = e.nextElement(); node.recordSpecifiedDependencies(); } } @@ -88,16 +88,16 @@ public void depthFirstSearch() { */ //Setup - for (Enumeration e = getNodes().elements(); e.hasMoreElements();) { - CommitOrderDependencyNode node = (CommitOrderDependencyNode)e.nextElement(); + for (Enumeration e = getNodes().elements(); e.hasMoreElements();) { + CommitOrderDependencyNode node = e.nextElement(); node.markNotVisited(); node.setPredecessor(null); } currentTime = 0; //Execution - for (Enumeration e = getNodes().elements(); e.hasMoreElements();) { - CommitOrderDependencyNode node = (CommitOrderDependencyNode)e.nextElement(); + for (Enumeration e = getNodes().elements(); e.hasMoreElements();) { + CommitOrderDependencyNode node = e.nextElement(); if (node.hasNotBeenVisited()) { node.visit(); } @@ -135,7 +135,7 @@ public int getNextTime() { return result; } - public Vector getNodes() { + public Vector getNodes() { return nodes; } @@ -160,8 +160,8 @@ public Vector getOrderedDescriptors() { } public CommitOrderDependencyNode nodeFor(Class c) { - for (Enumeration e = nodes.elements(); e.hasMoreElements();) { - CommitOrderDependencyNode n = (CommitOrderDependencyNode)e.nextElement(); + for (Enumeration e = nodes.elements(); e.hasMoreElements();) { + CommitOrderDependencyNode n = e.nextElement(); if (n.getDescriptor().getJavaClass() == c) { return n; } @@ -170,8 +170,8 @@ public CommitOrderDependencyNode nodeFor(Class c) { } public CommitOrderDependencyNode nodeFor(ClassDescriptor d) { - for (Enumeration e = nodes.elements(); e.hasMoreElements();) { - CommitOrderDependencyNode n = (CommitOrderDependencyNode)e.nextElement(); + for (Enumeration e = nodes.elements(); e.hasMoreElements();) { + CommitOrderDependencyNode n = e.nextElement(); if (n.getDescriptor() == d) { return n; } @@ -189,13 +189,13 @@ public CommitOrderDependencyNode nodeFor(ClassDescriptor d) { public void orderCommits() { depthFirstSearch(); - Object[] nodeArray = new Object[nodes.size()]; + CommitOrderDependencyNode[] nodeArray = new CommitOrderDependencyNode[nodes.size()]; nodes.copyInto(nodeArray); quicksort(nodeArray); Vector result = new Vector(nodes.size()); for (int i = 0; i < nodes.size(); i++) { - CommitOrderDependencyNode node = (CommitOrderDependencyNode)nodeArray[i]; + CommitOrderDependencyNode node = nodeArray[i]; result.addElement(node.getDescriptor()); } this.orderedDescriptors = result; @@ -211,7 +211,7 @@ private static void quicksort(Object[] arr) { /** * quicksort the array of objects. * - * @param arr[] - an array of objects + * @param arr - an array of objects * @param left - the start index - from where to begin sorting * @param right - the last index. */ diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/sessions/factories/SessionsFactory.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/sessions/factories/SessionsFactory.java index c0151129f49..68ffb186a9d 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/sessions/factories/SessionsFactory.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/sessions/factories/SessionsFactory.java @@ -928,11 +928,11 @@ protected void buildRemoteCommandManagerConfig(RemoteCommandManagerConfig rcmCon * INTERNAL: */ protected void buildTransportManager(TransportManagerConfig tmConfig, RemoteCommandManager rcm) { - if (tmConfig instanceof RMITransportManagerConfig) { - buildRMITransportManagerConfig((RMITransportManagerConfig)tmConfig, rcm); - } else if (tmConfig instanceof RMIIIOPTransportManagerConfig) { + if (tmConfig instanceof RMIIIOPTransportManagerConfig) { buildRMIIIOPTransportManagerConfig((RMIIIOPTransportManagerConfig)tmConfig, rcm); - } else if (tmConfig instanceof JMSTopicTransportManagerConfig) { + } else if (tmConfig instanceof RMITransportManagerConfig) { + buildRMITransportManagerConfig((RMITransportManagerConfig)tmConfig, rcm); + } else if (tmConfig instanceof JMSTopicTransportManagerConfig) { buildJMSTopicTransportManagerConfig((JMSTopicTransportManagerConfig)tmConfig, rcm); } else if (tmConfig instanceof JMSPublishingTransportManagerConfig) { buildJMSPublishingTransportManagerConfig((JMSPublishingTransportManagerConfig)tmConfig, rcm); diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/mappings/OneToOneMapping.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/mappings/OneToOneMapping.java index daef9519a91..c6f0c8473bc 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/mappings/OneToOneMapping.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/mappings/OneToOneMapping.java @@ -1457,7 +1457,7 @@ public void buildShallowOriginalFromRow(AbstractRecord databaseRow, Object origi } Object targetObject = descriptor.getObjectBuilder().buildNewInstance(); - descriptor.getObjectBuilder().buildAttributesIntoShallowObject(targetObject, databaseRow, query); + descriptor.getObjectBuilder().buildAttributesIntoShallowObject(targetObject, targetRow, query); targetObject = getIndirectionPolicy().valueFromRow(targetObject); setAttributeValueInObject(original, targetObject); diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/oxm/mappings/XMLAnyAttributeMapping.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/oxm/mappings/XMLAnyAttributeMapping.java index 8a541c33805..fcde74c2c5a 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/oxm/mappings/XMLAnyAttributeMapping.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/oxm/mappings/XMLAnyAttributeMapping.java @@ -404,13 +404,6 @@ public void writeSingleValue(Object attributeValue, Object parent, XMLRecord row recordToModify.removeExtraNamespacesFromNamespaceResolver(extraNamespaces, session); } - /** - * INTERNAL: - * Indicates the Map class to be used. - * - * @param concreteMapClass - */ - /** * INTERNAL: * Indicates the name of the Map class to be used. diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/server/ServerPlatform.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/server/ServerPlatform.java index 04209046a82..9f9d1d06730 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/server/ServerPlatform.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/server/ServerPlatform.java @@ -216,7 +216,7 @@ public interface ServerPlatform { * * Default behavior is to use Thread(runnable).start() * - * @param runnable: the instance of runnable to be "started" + * @param runnable the instance of runnable to be "started" */ void launchContainerRunnable(Runnable runnable); diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/server/ServerPlatformBase.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/server/ServerPlatformBase.java index df0f68c22f3..9b0f576b3b7 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/server/ServerPlatformBase.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/server/ServerPlatformBase.java @@ -469,7 +469,7 @@ public java.sql.Connection unwrapConnection(java.sql.Connection connection){ * * Default behavior is to use Thread(runnable).start() * - * @param runnable: the instance of runnable to be "started" + * @param runnable the instance of runnable to be "started" */ @Override public void launchContainerRunnable(Runnable runnable) { diff --git a/foundation/org.eclipse.persistence.nosql/src/main/java/org/eclipse/persistence/internal/eis/cobol/helper/Helper.java b/foundation/org.eclipse.persistence.nosql/src/main/java/org/eclipse/persistence/internal/eis/cobol/helper/Helper.java index d231d64a90c..679081f4718 100644 --- a/foundation/org.eclipse.persistence.nosql/src/main/java/org/eclipse/persistence/internal/eis/cobol/helper/Helper.java +++ b/foundation/org.eclipse.persistence.nosql/src/main/java/org/eclipse/persistence/internal/eis/cobol/helper/Helper.java @@ -23,13 +23,11 @@ public class Helper { /** takes a string as an argument and returns the Integer value */ public static Integer integerFromString(String string) { - Integer intValue; try { - intValue = Integer.valueOf(string); + return Integer.valueOf(string); } catch (NumberFormatException exception) { return null; } - return intValue; } /** takes a hex string representation and returns the Integer value */ @@ -59,8 +57,7 @@ public static Integer integerFromByte(byte byteValue) { /** takes a byte value and returns int value */ public static int intFromByte(byte byteValue) { - Byte bigByte = byteValue; - return bigByte.intValue(); + return byteValue; } /** takes a int an returns a byte */ diff --git a/jpa/org.eclipse.persistence.jpa.jpql/src/main/java/org/eclipse/persistence/jpa/jpql/ExpressionTools.java b/jpa/org.eclipse.persistence.jpa.jpql/src/main/java/org/eclipse/persistence/jpa/jpql/ExpressionTools.java index 69adc971550..49fb04c6da2 100644 --- a/jpa/org.eclipse.persistence.jpa.jpql/src/main/java/org/eclipse/persistence/jpa/jpql/ExpressionTools.java +++ b/jpa/org.eclipse.persistence.jpa.jpql/src/main/java/org/eclipse/persistence/jpa/jpql/ExpressionTools.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2021 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0 which is available at @@ -94,22 +94,68 @@ public static String escape(CharSequence value, int[] position) { char character = value.charAt(index); switch (character) { - case '\b': sb.append("\\b"); if (index < originalPosition) position[0]++; break; - case '\t': sb.append("\\t"); if (index < originalPosition) position[0]++; break; - case '\n': sb.append("\\n"); if (index < originalPosition) position[0]++; break; - case '\f': sb.append("\\f"); if (index < originalPosition) position[0]++; break; - case '\r': sb.append("\\r"); if (index < originalPosition) position[0]++; break; - case '\"': sb.append("\\\""); if (index < originalPosition) position[0]++; break; - case '\\': sb.append("\\\\"); if (index < originalPosition) position[0]++; break; - case '\0': sb.append("\\0"); if (index < originalPosition) position[0]++; break; - case '\1': sb.append("\\1"); if (index < originalPosition) position[0]++; break; - case '\2': sb.append("\\2"); if (index < originalPosition) position[0]++; break; - case '\3': sb.append("\\3"); if (index < originalPosition) position[0]++; break; - case '\4': sb.append("\\4"); if (index < originalPosition) position[0]++; break; - case '\5': sb.append("\\5"); if (index < originalPosition) position[0]++; break; - case '\6': sb.append("\\6"); if (index < originalPosition) position[0]++; break; - case '\7': sb.append("\\7"); if (index < originalPosition) position[0]++; break; - default: sb.append(character); + case '\b': + sb.append("\\b"); + if (index < originalPosition) position[0]++; + break; + case '\t': + sb.append("\\t"); + if (index < originalPosition) position[0]++; + break; + case '\n': + sb.append("\\n"); + if (index < originalPosition) position[0]++; + break; + case '\f': + sb.append("\\f"); + if (index < originalPosition) position[0]++; + break; + case '\r': + sb.append("\\r"); + if (index < originalPosition) position[0]++; + break; + case '\"': + sb.append("\\\""); + if (index < originalPosition) position[0]++; + break; + case '\\': + sb.append("\\\\"); + if (index < originalPosition) position[0]++; + break; + case '\0': + sb.append("\\0"); + if (index < originalPosition) position[0]++; + break; + case '\1': + sb.append("\\1"); + if (index < originalPosition) position[0]++; + break; + case '\2': + sb.append("\\2"); + if (index < originalPosition) position[0]++; + break; + case '\3': + sb.append("\\3"); + if (index < originalPosition) position[0]++; + break; + case '\4': + sb.append("\\4"); + if (index < originalPosition) position[0]++; + break; + case '\5': + sb.append("\\5"); + if (index < originalPosition) position[0]++; + break; + case '\6': + sb.append("\\6"); + if (index < originalPosition) position[0]++; + break; + case '\7': + sb.append("\\7"); + if (index < originalPosition) position[0]++; + break; + default: + sb.append(character); } } diff --git a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/deployment/DirectoryArchive.java b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/deployment/DirectoryArchive.java index aebbfedbd95..0d3269b890b 100644 --- a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/deployment/DirectoryArchive.java +++ b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/deployment/DirectoryArchive.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2021 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0 which is available at @@ -69,7 +69,7 @@ public DirectoryArchive(File directory, String descriptorLocation, Logger logger if (!directory.isDirectory()) { // should never reach here, hence the msg is not internationalized. throw new IllegalArgumentException(directory + - " is not a directory." + // NOI18N + " is not a directory. " + // NOI18N "If it is a jar file, then use JarFileArchive."); // NOI18N } this.directory = directory; diff --git a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/compiler/AnnotationsProcessor.java b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/compiler/AnnotationsProcessor.java index 26cba23a816..5c627f9f8d6 100644 --- a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/compiler/AnnotationsProcessor.java +++ b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/compiler/AnnotationsProcessor.java @@ -3187,9 +3187,9 @@ public ArrayList getPublicMemberPropertiesForClass(JavaClass cls, TypeInfo info) // Not sure who should win if a property exists for both or the correct // order - if (publicFieldProperties.size() >= 0 && publicMethodProperties.size() == 0) { + if (!publicFieldProperties.isEmpty() && publicMethodProperties.size() == 0) { return publicFieldProperties; - } else if (publicMethodProperties.size() > 0 && publicFieldProperties.size() == 0) { + } else if (!publicMethodProperties.isEmpty() && publicFieldProperties.size() == 0) { return publicMethodProperties; } else { // add any non-duplicate method properties to the collection. diff --git a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/javamodel/xjc/XJCJavaClassImpl.java b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/javamodel/xjc/XJCJavaClassImpl.java index 373e80c5cf7..802626c0d26 100644 --- a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/javamodel/xjc/XJCJavaClassImpl.java +++ b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/javamodel/xjc/XJCJavaClassImpl.java @@ -213,7 +213,6 @@ public JavaConstructor getConstructor(JavaClass[] parameterTypes) { * @return A Collection containing this JavaClass' JavaConstructors. */ @Override - @SuppressWarnings("unchecked") public Collection getConstructors() { ArrayList constructors = new ArrayList<>(); Iterator it = xjcClass.constructors(); @@ -518,7 +517,8 @@ public JavaClass getSuperclass() { if (javaModel != null) { return this.javaModel.getClass(superClass.fullName()); } - return new XJCJavaClassImpl((JDefinedClass) superClass, jCodeModel, dynamicClassLoader); + JDefinedClass c = jCodeModel._getClass(superClass.fullName()); + return new XJCJavaClassImpl(c, jCodeModel, dynamicClassLoader); } } catch (Exception e) { diff --git a/sdo/org.eclipse.persistence.sdo/src/main/java/org/eclipse/persistence/sdo/helper/SDOTypesGenerator.java b/sdo/org.eclipse.persistence.sdo/src/main/java/org/eclipse/persistence/sdo/helper/SDOTypesGenerator.java index 1e5d85c3376..ac7b093c16a 100644 --- a/sdo/org.eclipse.persistence.sdo/src/main/java/org/eclipse/persistence/sdo/helper/SDOTypesGenerator.java +++ b/sdo/org.eclipse.persistence.sdo/src/main/java/org/eclipse/persistence/sdo/helper/SDOTypesGenerator.java @@ -1058,9 +1058,6 @@ private void processBaseType(SDOType baseType, String targetNamespace, String de return; } - java.util.List baseTypes = new ArrayList(); - baseTypes.add(baseType); - if (owningType != null) { if (owningType.isDataType()) { owningType.setInstanceClassName(baseType.getInstanceClassName());