code cleanup without functional change

* remove unecessary valueOf
* remove ;;
* remove unused imports
* remove unnecessary casts
* etc
This commit is contained in:
Mark Struberg 2021-04-04 17:09:04 +02:00
parent 9458d1720b
commit b0ba9c3e60
186 changed files with 316 additions and 353 deletions

View File

@ -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());

View File

@ -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");
}
}

View File

@ -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

View File

@ -96,7 +96,7 @@ public class TradeJPADirect {
TradeJPADirect.log = log;
TradeJPADirect.emf = emf;
_poolEm = poolEm;
if (initialized == false)
if (!initialized)
init();
}

View File

@ -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();
}

View File

@ -18,8 +18,6 @@
*/
package org.apache.openjpa.jdbc.identifier;
import java.util.Set;
import org.apache.openjpa.jdbc.identifier.DBIdentifier.DBIdentifierType;
/**

View File

@ -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();

View File

@ -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++) {

View File

@ -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;

View File

@ -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 {

View File

@ -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) {

View File

@ -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]);

View File

@ -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 ?

View File

@ -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;
}

View File

@ -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]);
}

View File

@ -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 + ")");
}

View File

@ -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;
/**

View File

@ -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;

View File

@ -3018,7 +3018,7 @@ public class SelectImpl
@Override
public String toString() {
return "PathJoinsImpl<" + hashCode() + ">: "
+ String.valueOf(path);
+ path;
}
@Override

View File

@ -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.

View File

@ -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 {

View File

@ -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;

View File

@ -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.

View File

@ -154,7 +154,7 @@ public class JESTServlet extends HttpServlet {
@Override
public void destroy() {
_emf = null;
_unit = null;;
_unit = null;
}
private void debug(HttpServletRequest r) {

View File

@ -131,7 +131,7 @@ public class JSONObjectFormatter implements ObjectFormatter<JSON> {
}
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;
}

View File

@ -66,7 +66,7 @@ public class PropertiesCommand extends AbstractCommand {
private void removeBadEntries(Map<String,Object> map) {
Iterator<String> keys = map.keySet().iterator();
for (; keys.hasNext();) {
while (keys.hasNext()) {
if (keys.next().indexOf(DOT) == -1) keys.remove();
}
}

View File

@ -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.

View File

@ -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;

View File

@ -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;
}
}

View File

@ -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);
}

View File

@ -91,7 +91,7 @@ public abstract class AbstractDataCache extends AbstractConcurrentEventManager
_name = name;
}
public void setEnableStatistics(boolean enable){
if(enable == true){
if(enable){
_stats.enable();
}
}

View File

@ -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);
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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());

View File

@ -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

View File

@ -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);

View File

@ -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

View File

@ -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();
}
}

View File

@ -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);

View File

@ -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();

View File

@ -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;
}

View File

@ -291,7 +291,7 @@ public class DetachManager
_copy = false;
}
else {
_copy = compatibility.getCopyOnDetach();;
_copy = compatibility.getCopyOnDetach();
}
}

View File

@ -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 {

View File

@ -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)

View File

@ -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";
}

View File

@ -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;

View File

@ -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();

View File

@ -1051,7 +1051,7 @@ public class ClassMetaData
}
List<FieldMetaData> 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<FieldMetaData> 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<FieldMetaData> 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) {

View File

@ -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) {

View File

@ -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"));

View File

@ -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;

View File

@ -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.*;

View File

@ -39,5 +39,5 @@ class CustomProxyDefaultScopeList<E> extends AbstractSequentialList<E> {
public static Object instance() {
return new CustomProxyDefaultScopeList<Integer>();
};
}
}

View File

@ -40,5 +40,5 @@ class CustomProxyDefaultScopeType {
public static Object instance() {
return new CustomProxyDefaultScopeType();
};
}
}

View File

@ -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()) {

View File

@ -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;
}
}

View File

@ -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

View File

@ -421,7 +421,7 @@ public abstract class AbstractDualBidiMap<K, V> implements BidiMap<K, V> {
boolean modified = false;
final Iterator<E> 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<K, V> implements BidiMap<K, V> {
@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<K, V> implements BidiMap<K, V> {
@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<K, V> implements BidiMap<K, V> {
@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<K, V> implements BidiMap<K, V> {
@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<K, V> implements BidiMap<K, V> {
@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)

View File

@ -860,10 +860,10 @@ public class AbstractHashedMap<K, V> extends AbstractMap<K, V> 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<K, V> extends AbstractMap<K, V> 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<K, V> extends AbstractMap<K, V> 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<K, V> extends AbstractMap<K, V> 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;
}
}

View File

@ -67,7 +67,7 @@ public abstract class AbstractMapEntry<K, V> extends AbstractKeyValue<K, V> 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;

View File

@ -676,7 +676,7 @@ public abstract class AbstractReferenceMap<K, V> extends AbstractHashedMap<K, V>
if (obj == this) {
return true;
}
if (obj instanceof Map.Entry == false) {
if (!(obj instanceof Map.Entry)) {
return false;
}

View File

@ -94,7 +94,7 @@ public class ComparatorChain<E> implements Comparator<E>, 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<E> implements Comparator<E>, Serializable {
checkLocked();
comparatorChain.add(comparator);
if (reverse == true) {
if (reverse) {
orderingBits.set(comparatorChain.size() - 1);
}
}
@ -183,7 +183,7 @@ public class ComparatorChain<E> implements Comparator<E>, 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<E> implements Comparator<E>, 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<E> implements Comparator<E>, 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<E> implements Comparator<E>, 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 {

View File

@ -187,7 +187,7 @@ public class IteratorChain<E> implements Iterator<E> {
* 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<E> implements Iterator<E> {
* from all Iterator interface methods.
*/
private void lockChain() {
if (isLocked == false) {
if (!isLocked) {
isLocked = true;
}
}
@ -219,7 +219,7 @@ public class IteratorChain<E> implements Iterator<E> {
lastUsedIterator = currentIterator;
}
while (currentIterator.hasNext() == false && !iteratorChain.isEmpty()) {
while (!currentIterator.hasNext() && !iteratorChain.isEmpty()) {
currentIterator = iteratorChain.remove();
}
}

View File

@ -1355,7 +1355,7 @@ public class TreeBidiMap<K extends Comparable<K>, V extends Comparable<V>>
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<K extends Comparable<K>, V extends Comparable<V>>
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<K extends Comparable<K>, V extends Comparable<V>>
@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<K extends Comparable<K>, V extends Comparable<V>>
@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<K extends Comparable<K>, V extends Comparable<V>>
@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<K extends Comparable<K>, V extends Comparable<V>>
@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;

View File

@ -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;
}

View File

@ -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.");
}
}

View File

@ -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();

View File

@ -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

View File

@ -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;

View File

@ -55,7 +55,7 @@ public class TestDocTypeReader {
@Before
public void setUp() {
StringBuffer docType = new StringBuffer();
StringBuilder docType = new StringBuilder();
docType.append("<!DOCTYPE foo [\n");
docType.append("\t<!ELEMENT foo (bar)>\n");
docType.append("\t<!ELEMENT bar EMPTY>\n");
@ -64,19 +64,19 @@ public class TestDocTypeReader {
docType.append("]>\n");
_docType = docType.toString();
StringBuffer expectedXML = new StringBuffer();
StringBuilder expectedXML = new StringBuilder();
String header = "<?xml version=\"1.0\"?>\n";
String comment = "<!-- some < ... > <! funky -> - 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("<foo>\n");
validXML.append("\t<bar attr=\"newValue\"/>\n");
validXML.append("</foo>");
@ -86,18 +86,18 @@ public class TestDocTypeReader {
_expectedXML = expectedXML.toString();
_xmlWithDocType = xmlWithDocType.toString();
StringBuffer invalidXML = new StringBuffer();
StringBuilder invalidXML = new StringBuilder();
invalidXML.append("<?xml version=\"1.0\"?>\n");
invalidXML.append("<foo>\n");
invalidXML.append("\t<xxx />\n");
invalidXML.append("</foo>");
_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 <html><body></body></html> ");
expectedHTML.append(validHTML.toString());
_validHTML = header + validHTML.toString();

View File

@ -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)) ;

View File

@ -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);
}

View File

@ -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;

View File

@ -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);
}

View File

@ -63,8 +63,8 @@ public class UnenhancedCompoundPKFieldAccess {
@Override
public String toString() {
return String.valueOf(id0)
+ "::" + String.valueOf(id1);
return id0
+ "::" + id1;
}
@Override

View File

@ -63,8 +63,8 @@ public class UnenhancedCompoundPKFieldAccessSuperclass {
@Override
public String toString() {
return String.valueOf(id0)
+ "::" + String.valueOf(id1);
return id0
+ "::" + id1;
}
@Override

View File

@ -98,8 +98,8 @@ public class UnenhancedCompoundPKPropertyAccess {
@Override
public String toString() {
return String.valueOf(id0)
+ "::" + String.valueOf(id1);
return id0
+ "::" + id1;
}
@Override

View File

@ -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

View File

@ -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;

View File

@ -171,7 +171,7 @@ public class TestDelimitIdentifiers {
public enum EnumType {
Value1, Value2
};
}
// @Basic types
private short shortField;

View File

@ -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);
}

View File

@ -22,5 +22,5 @@
package org.apache.openjpa.jira2780;
public enum Jira2780Enum {
A, B, C;
A, B, C
}

View File

@ -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;

View File

@ -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();

View File

@ -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());

View File

@ -132,7 +132,7 @@ public class CompUser {
public enum CreditRating {
POOR, GOOD, EXCELLENT
};
}
public String[] getNicknames() {
return nicknames;

View File

@ -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;

View File

@ -888,7 +888,7 @@ public class TestContainerSpecCompatibilityOptions
}
public String toString(List<String> list) {
StringBuffer buf = new StringBuffer();
StringBuilder buf = new StringBuilder();
for (String s : list)
buf.append(s).append("\r\n");
return buf.toString();

View File

@ -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<String> list) {
StringBuffer buf = new StringBuffer();
StringBuilder buf = new StringBuilder();
for (String s : list)
buf.append(s).append("\r\n");
return buf.toString();

View File

@ -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(";");

View File

@ -118,5 +118,5 @@ public class CompUser
this.creditRating = rating;
}
public enum CreditRating { POOR, GOOD, EXCELLENT };
public enum CreditRating { POOR, GOOD, EXCELLENT }
}

View File

@ -155,5 +155,5 @@ public class Customer {
this.creditRating = rating;
}
public enum CreditRating { POOR, GOOD, EXCELLENT };
public enum CreditRating { POOR, GOOD, EXCELLENT }
}

View File

@ -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.*;

View File

@ -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(',');

View File

@ -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;

View File

@ -50,7 +50,7 @@ public class A implements java.io.Serializable {
int value;
@ElementCollection
protected Set<Embed> embeds = new HashSet();
protected Set<Embed> embeds = new HashSet<>();
@CollectionTable(name = "collectionTemporalOrderColumnTable",
joinColumns = @JoinColumn(name = "parent_id"))

View File

@ -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 }
}

View File

@ -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;

View File

@ -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 }
}

Some files were not shown because too many files have changed in this diff Show More