mirror of https://github.com/apache/openjpa.git
code cleanup without functional change
* remove unecessary valueOf * remove ;; * remove unused imports * remove unnecessary casts * etc
This commit is contained in:
parent
9458d1720b
commit
b0ba9c3e60
|
@ -283,7 +283,7 @@ public class AccountDataBean implements Serializable {
|
||||||
|
|
||||||
public void login(String password) {
|
public void login(String password) {
|
||||||
AccountProfileDataBean profile = getProfile();
|
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() +
|
String error = "AccountBean:Login failure for account: " + getAccountID() +
|
||||||
((profile == null) ? "null AccountProfile" :
|
((profile == null) ? "null AccountProfile" :
|
||||||
"\n\tIncorrect password-->" + profile.getUserID() + ":" + profile.getPassword());
|
"\n\tIncorrect password-->" + profile.getUserID() + ":" + profile.getPassword());
|
||||||
|
|
|
@ -95,7 +95,7 @@ public class TestDaytrader extends AbstractPersistenceTestCase {
|
||||||
log.info("TestDaytrader.testTrade() calling TradeScenario.performUserTasks(" + TEST_USERS + ")");
|
log.info("TestDaytrader.testTrade() calling TradeScenario.performUserTasks(" + TEST_USERS + ")");
|
||||||
for (int i = 0; i < TEST_USERS; i++) {
|
for (int i = 0; i < TEST_USERS; i++) {
|
||||||
String userID = "uid:" + i;
|
String userID = "uid:" + i;
|
||||||
if (scenario.performUserTasks(userID) == false) {
|
if (!scenario.performUserTasks(userID)) {
|
||||||
fail("TestDaytrader.testTrade() call to TradeScenario.performUserTask(" + userID + ") failed");
|
fail("TestDaytrader.testTrade() call to TradeScenario.performUserTask(" + userID + ") failed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,7 +89,7 @@ public class TradeAction extends TradeJPADirect {
|
||||||
setAttribute(sb, "Page", "Account Update");
|
setAttribute(sb, "Page", "Account Update");
|
||||||
// First verify input data
|
// First verify input data
|
||||||
boolean doUpdate = true;
|
boolean doUpdate = true;
|
||||||
if (password.equals(cpassword) == false) {
|
if (!password.equals(cpassword)) {
|
||||||
results = "Update profile error: passwords do not match";
|
results = "Update profile error: passwords do not match";
|
||||||
doUpdate = false;
|
doUpdate = false;
|
||||||
} else if (password.length() <= 0 || fullName.length() <= 0
|
} else if (password.length() <= 0 || fullName.length() <= 0
|
||||||
|
|
|
@ -96,7 +96,7 @@ public class TradeJPADirect {
|
||||||
TradeJPADirect.log = log;
|
TradeJPADirect.log = log;
|
||||||
TradeJPADirect.emf = emf;
|
TradeJPADirect.emf = emf;
|
||||||
_poolEm = poolEm;
|
_poolEm = poolEm;
|
||||||
if (initialized == false)
|
if (!initialized)
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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
|
* The 'z' action from getScenario denotes that this is a sell action that was switched from a buy
|
||||||
* to reduce a sellDeficit
|
* to reduce a sellDeficit
|
||||||
*/
|
*/
|
||||||
if (userID.startsWith(TradeConfig.newUserPrefix) == false)
|
if (!userID.startsWith(TradeConfig.newUserPrefix))
|
||||||
{
|
{
|
||||||
TradeConfig.incrementSellDeficit();
|
TradeConfig.incrementSellDeficit();
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,8 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.openjpa.jdbc.identifier;
|
package org.apache.openjpa.jdbc.identifier;
|
||||||
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import org.apache.openjpa.jdbc.identifier.DBIdentifier.DBIdentifierType;
|
import org.apache.openjpa.jdbc.identifier.DBIdentifier.DBIdentifierType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -333,7 +333,7 @@ public class PreparedQueryCacheImpl implements PreparedQueryCache {
|
||||||
* - If true, a read lock will be acquired. Else a write lock will be acquired.
|
* - If true, a read lock will be acquired. Else a write lock will be acquired.
|
||||||
*/
|
*/
|
||||||
protected void lock(boolean readOnly) {
|
protected void lock(boolean readOnly) {
|
||||||
if (readOnly == true) {
|
if (readOnly) {
|
||||||
_readLock.lock();
|
_readLock.lock();
|
||||||
} else {
|
} else {
|
||||||
_writeLock.lock();
|
_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.
|
* - If true, the read lock will be released. Else a write lock will be released.
|
||||||
*/
|
*/
|
||||||
protected void unlock(boolean readOnly) {
|
protected void unlock(boolean readOnly) {
|
||||||
if (readOnly == true) {
|
if (readOnly) {
|
||||||
_readLock.unlock();
|
_readLock.unlock();
|
||||||
} else {
|
} else {
|
||||||
_writeLock.unlock();
|
_writeLock.unlock();
|
||||||
|
|
|
@ -187,14 +187,14 @@ public class PreparedQueryImpl implements PreparedQuery {
|
||||||
return new PreparedQueryCacheImpl.StrongExclusion(_id, _loc.get("exclude-no-select", _id).getMessage());
|
return new PreparedQueryCacheImpl.StrongExclusion(_id, _loc.get("exclude-no-select", _id).getMessage());
|
||||||
SQLBuffer buffer = selector.getSQL();
|
SQLBuffer buffer = selector.getSQL();
|
||||||
if (buffer == null)
|
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())
|
if (isUsingFieldStrategy())
|
||||||
return new PreparedQueryCacheImpl.StrongExclusion(_id,
|
return new PreparedQueryCacheImpl.StrongExclusion(_id,
|
||||||
_loc.get("exclude-user-strategy", _id).getMessage());;
|
_loc.get("exclude-user-strategy", _id).getMessage());
|
||||||
|
|
||||||
if (isPaginated())
|
if (isPaginated())
|
||||||
return new PreparedQueryCacheImpl.StrongExclusion(_id,
|
return new PreparedQueryCacheImpl.StrongExclusion(_id,
|
||||||
_loc.get("exclude-pagination", _id).getMessage());;
|
_loc.get("exclude-pagination", _id).getMessage());
|
||||||
|
|
||||||
setTargetQuery(buffer.getSQL());
|
setTargetQuery(buffer.getSQL());
|
||||||
setParameters(buffer.getParameters());
|
setParameters(buffer.getParameters());
|
||||||
|
@ -212,14 +212,14 @@ public class PreparedQueryImpl implements PreparedQuery {
|
||||||
* not be extracted.
|
* not be extracted.
|
||||||
*/
|
*/
|
||||||
private Object[] extractSelectExecutor(Object result) {
|
private Object[] extractSelectExecutor(Object result) {
|
||||||
if (result instanceof ResultList == false)
|
if (!(result instanceof ResultList))
|
||||||
return new Object[]{null, _loc.get("exclude-not-result", _id)};
|
return new Object[]{null, _loc.get("exclude-not-result", _id)};
|
||||||
Object userObject = ((ResultList<?>)result).getUserObject();
|
Object userObject = ((ResultList<?>)result).getUserObject();
|
||||||
if (userObject == null || !userObject.getClass().isArray() || ((Object[])userObject).length != 2)
|
if (userObject == null || !userObject.getClass().isArray() || ((Object[])userObject).length != 2)
|
||||||
return new Object[]{null, _loc.get("exclude-no-user-object", _id)};
|
return new Object[]{null, _loc.get("exclude-no-user-object", _id)};
|
||||||
Object provider = ((Object[])userObject)[0];
|
Object provider = ((Object[])userObject)[0];
|
||||||
Object executor = ((Object[])userObject)[1];
|
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)};
|
return new Object[]{null, _loc.get("exclude-not-executor", _id)};
|
||||||
_exps = ((StoreQuery.Executor)executor).getQueryExpressions();
|
_exps = ((StoreQuery.Executor)executor).getQueryExpressions();
|
||||||
for (int i = 0; i < _exps.length; i++) {
|
for (int i = 0; i < _exps.length; i++) {
|
||||||
|
|
|
@ -63,7 +63,7 @@ public class PreparedSQLStoreQuery extends SQLStoreQuery {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean setQuery(Object query) {
|
public boolean setQuery(Object query) {
|
||||||
if (query instanceof PreparedQueryImpl == false) {
|
if (!(query instanceof PreparedQueryImpl)) {
|
||||||
throw new InternalException(query.getClass() + " not recognized");
|
throw new InternalException(query.getClass() + " not recognized");
|
||||||
}
|
}
|
||||||
_cached = (PreparedQueryImpl)query;
|
_cached = (PreparedQueryImpl)query;
|
||||||
|
|
|
@ -281,7 +281,7 @@ public class SQLStoreQuery
|
||||||
PreparedStatement stmnt, SQLBuffer buf)
|
PreparedStatement stmnt, SQLBuffer buf)
|
||||||
throws SQLException {
|
throws SQLException {
|
||||||
int count = 0;
|
int count = 0;
|
||||||
if (_call && stmnt.execute() == false) {
|
if (_call && !stmnt.execute()) {
|
||||||
count = stmnt.getUpdateCount();
|
count = stmnt.getUpdateCount();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -461,8 +461,7 @@ public class TableJDBCSeq extends AbstractJDBCSeq implements Configurable {
|
||||||
}
|
}
|
||||||
catch(NotSupportedException nse) {
|
catch(NotSupportedException nse) {
|
||||||
SQLException sqlEx = new SQLException(
|
SQLException sqlEx = new SQLException(
|
||||||
nse.getLocalizedMessage());
|
nse.getLocalizedMessage(), nse);
|
||||||
sqlEx.initCause(nse);
|
|
||||||
throw sqlEx;
|
throw sqlEx;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -953,8 +952,7 @@ public class TableJDBCSeq extends AbstractJDBCSeq implements Configurable {
|
||||||
if (conn != null) {
|
if (conn != null) {
|
||||||
closeConnection(conn);
|
closeConnection(conn);
|
||||||
}
|
}
|
||||||
RuntimeException re = new RuntimeException(e.getMessage());
|
RuntimeException re = new RuntimeException(e.getMessage(), e);
|
||||||
re.initCause(e);
|
|
||||||
throw re;
|
throw re;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -991,8 +989,7 @@ public class TableJDBCSeq extends AbstractJDBCSeq implements Configurable {
|
||||||
if (cur != -1 ) // USE the constant
|
if (cur != -1 ) // USE the constant
|
||||||
current = cur;
|
current = cur;
|
||||||
} catch (SQLException sqle) {
|
} catch (SQLException sqle) {
|
||||||
RuntimeException re = new RuntimeException(sqle.getMessage());
|
RuntimeException re = new RuntimeException(sqle.getMessage(), sqle);
|
||||||
re.initCause(sqle);
|
|
||||||
throw re;
|
throw re;
|
||||||
} finally {
|
} finally {
|
||||||
if (conn != null) {
|
if (conn != null) {
|
||||||
|
|
|
@ -635,7 +635,7 @@ public class JDBCExpressionFactory
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Value coalesceExpression(Value[] vals) {;
|
public Value coalesceExpression(Value[] vals) {
|
||||||
Object[] values = new Val[vals.length];
|
Object[] values = new Val[vals.length];
|
||||||
for (int i = 0; i < vals.length; i++) {
|
for (int i = 0; i < vals.length; i++) {
|
||||||
values[i] = getLiteralRawString(vals[i]);
|
values[i] = getLiteralRawString(vals[i]);
|
||||||
|
|
|
@ -168,7 +168,7 @@ public class MapEntry
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object other) {
|
public boolean equals(Object other) {
|
||||||
if (other instanceof Map.Entry == false)
|
if (!(other instanceof Map.Entry))
|
||||||
return false;
|
return false;
|
||||||
Map.Entry that = (Map.Entry)other;
|
Map.Entry that = (Map.Entry)other;
|
||||||
return (this.key == null ?
|
return (this.key == null ?
|
||||||
|
|
|
@ -478,7 +478,7 @@ public class EmbedFieldStrategy
|
||||||
}
|
}
|
||||||
|
|
||||||
// A field expected to be loaded eagerly was missing from the ResultSet.
|
// A field expected to be loaded eagerly was missing from the ResultSet.
|
||||||
if (containsUnloadedEagerField == true) {
|
if (containsUnloadedEagerField) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,8 +40,6 @@ import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import java.util.stream.Stream;
|
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
|
|
||||||
import org.apache.openjpa.conf.OpenJPAConfiguration;
|
import org.apache.openjpa.conf.OpenJPAConfiguration;
|
||||||
|
@ -883,7 +881,7 @@ public class SchemaTool {
|
||||||
for (int i = 0; i < schemas.length; i++) {
|
for (int i = 0; i < schemas.length; i++) {
|
||||||
tabs = schemas[i].getTables();
|
tabs = schemas[i].getTables();
|
||||||
for (int j = 0; j < tabs.length; j++)
|
for (int j = 0; j < tabs.length; j++)
|
||||||
if (!!isDroppable(tabs[j])
|
if (isDroppable(tabs[j])
|
||||||
&& repos.findTable(tabs[j]) == null)
|
&& repos.findTable(tabs[j]) == null)
|
||||||
drops.add(tabs[j]);
|
drops.add(tabs[j]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -567,7 +567,7 @@ public class DB2Dictionary
|
||||||
if (sel != null && sel.getExpectedResultCount() > 0) {
|
if (sel != null && sel.getExpectedResultCount() > 0) {
|
||||||
StringBuilder buf = new StringBuilder();
|
StringBuilder buf = new StringBuilder();
|
||||||
buf.append(" ").append(optimizeClause).append(" ")
|
buf.append(" ").append(optimizeClause).append(" ")
|
||||||
.append(String.valueOf(sel.getExpectedResultCount()))
|
.append(sel.getExpectedResultCount())
|
||||||
.append(" ").append(rowClause);
|
.append(" ").append(rowClause);
|
||||||
return buf.toString();
|
return buf.toString();
|
||||||
}
|
}
|
||||||
|
@ -577,7 +577,7 @@ public class DB2Dictionary
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public OpenJPAException newStoreException(String msg, SQLException[] causes, Object failed) {
|
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]);
|
msg = appendExtendedExceptionMsg(msg, causes[0]);
|
||||||
}
|
}
|
||||||
return super.newStoreException(msg, causes, failed);
|
return super.newStoreException(msg, causes, failed);
|
||||||
|
@ -844,7 +844,7 @@ public class DB2Dictionary
|
||||||
if (col.getType() != Types.VARCHAR) {
|
if (col.getType() != Types.VARCHAR) {
|
||||||
doCast = true;
|
doCast = true;
|
||||||
}
|
}
|
||||||
if (doCast == true) {
|
if (doCast) {
|
||||||
if (func.indexOf("VARCHAR") == -1) {
|
if (func.indexOf("VARCHAR") == -1) {
|
||||||
func = addCastAsString(func, "{0}", " AS VARCHAR(" + varcharCastLength + ")");
|
func = addCastAsString(func, "{0}", " AS VARCHAR(" + varcharCastLength + ")");
|
||||||
}
|
}
|
||||||
|
|
|
@ -336,7 +336,8 @@ public class DBDictionary
|
||||||
* database will become '2010-01-01 12:00:00.687' in the Date field
|
* database will become '2010-01-01 12:00:00.687' in the Date field
|
||||||
* of the entity.
|
* of the entity.
|
||||||
*/
|
*/
|
||||||
public enum DateMillisecondBehaviors { DROP, ROUND, RETAIN };
|
public enum DateMillisecondBehaviors { DROP, ROUND, RETAIN }
|
||||||
|
|
||||||
private DateMillisecondBehaviors dateMillisecondBehavior;
|
private DateMillisecondBehaviors dateMillisecondBehavior;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -34,11 +34,6 @@ import java.sql.SQLException;
|
||||||
import java.sql.Statement;
|
import java.sql.Statement;
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
import java.sql.Types;
|
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.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
|
|
@ -3018,7 +3018,7 @@ public class SelectImpl
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "PathJoinsImpl<" + hashCode() + ">: "
|
return "PathJoinsImpl<" + hashCode() + ">: "
|
||||||
+ String.valueOf(path);
|
+ path;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -66,7 +66,7 @@ public class StoredProcedure {
|
||||||
*/
|
*/
|
||||||
public enum PARAM {UNKNOW, IN, INOUT, RESULT, OUT, RETURN}
|
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.
|
* Create a procedure of the given name.
|
||||||
|
|
|
@ -25,7 +25,6 @@ import org.apache.openjpa.jdbc.schema.Table;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import static org.junit.Assert.assertFalse;
|
|
||||||
import static org.junit.Assert.assertNotEquals;
|
import static org.junit.Assert.assertNotEquals;
|
||||||
|
|
||||||
public class TestMappingDefaultsImpl {
|
public class TestMappingDefaultsImpl {
|
||||||
|
|
|
@ -30,8 +30,6 @@ import javax.sql.DataSource;
|
||||||
import org.apache.openjpa.jdbc.conf.JDBCConfiguration;
|
import org.apache.openjpa.jdbc.conf.JDBCConfiguration;
|
||||||
import org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl;
|
import org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl;
|
||||||
import org.apache.openjpa.jdbc.identifier.DBIdentifier;
|
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.Column;
|
||||||
import org.apache.openjpa.jdbc.schema.ForeignKey;
|
import org.apache.openjpa.jdbc.schema.ForeignKey;
|
||||||
import org.apache.openjpa.jdbc.schema.Schema;
|
import org.apache.openjpa.jdbc.schema.Schema;
|
||||||
|
|
|
@ -60,7 +60,7 @@ public interface JESTCommand {
|
||||||
/**
|
/**
|
||||||
* Supported format monikers.
|
* Supported format monikers.
|
||||||
*/
|
*/
|
||||||
public static enum Format {xml, json};
|
public static enum Format {xml, json}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the execution context of this command.
|
* Get the execution context of this command.
|
||||||
|
|
|
@ -154,7 +154,7 @@ public class JESTServlet extends HttpServlet {
|
||||||
@Override
|
@Override
|
||||||
public void destroy() {
|
public void destroy() {
|
||||||
_emf = null;
|
_emf = null;
|
||||||
_unit = null;;
|
_unit = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void debug(HttpServletRequest r) {
|
private void debug(HttpServletRequest r) {
|
||||||
|
|
|
@ -131,7 +131,7 @@ public class JSONObjectFormatter implements ObjectFormatter<JSON> {
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean ref = !visited.add(sm);
|
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) {
|
if (ref) {
|
||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,7 +66,7 @@ public class PropertiesCommand extends AbstractCommand {
|
||||||
|
|
||||||
private void removeBadEntries(Map<String,Object> map) {
|
private void removeBadEntries(Map<String,Object> map) {
|
||||||
Iterator<String> keys = map.keySet().iterator();
|
Iterator<String> keys = map.keySet().iterator();
|
||||||
for (; keys.hasNext();) {
|
while (keys.hasNext()) {
|
||||||
if (keys.next().indexOf(DOT) == -1) keys.remove();
|
if (keys.next().indexOf(DOT) == -1) keys.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ import java.util.Map;
|
||||||
import javax.persistence.Query;
|
import javax.persistence.Query;
|
||||||
|
|
||||||
import org.apache.openjpa.persistence.ArgumentException;
|
import org.apache.openjpa.persistence.ArgumentException;
|
||||||
import org.apache.openjpa.persistence.OpenJPAEntityManager;;
|
import org.apache.openjpa.persistence.OpenJPAEntityManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Executes query.
|
* Executes query.
|
||||||
|
|
|
@ -46,7 +46,8 @@ import org.apache.openjpa.persistence.FetchGroups;
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
public class Actor {
|
public class Actor {
|
||||||
public static enum Gender {Male, Female};
|
public static enum Gender {Male, Female}
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
private String id;
|
private String id;
|
||||||
private String firstName;
|
private String firstName;
|
||||||
|
|
|
@ -253,8 +253,7 @@ public class CacheMarshallerImpl
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
IllegalStateException ise = new IllegalStateException(
|
IllegalStateException ise = new IllegalStateException(
|
||||||
_loc.get("cache-marshaller-bad-url", getId(),
|
_loc.get("cache-marshaller-bad-url", getId(),
|
||||||
_inputResourceLocation).getMessage());
|
_inputResourceLocation).getMessage(), ioe);
|
||||||
ise.initCause(ioe);
|
|
||||||
throw ise;
|
throw ise;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,7 +72,7 @@ public class SpecificationPlugin extends ObjectValue implements ValueListener {
|
||||||
super.set(null);
|
super.set(null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (obj instanceof Specification == false) {
|
if (!(obj instanceof Specification)) {
|
||||||
throw new UserException(_loc.get("spec-wrong-obj", obj,
|
throw new UserException(_loc.get("spec-wrong-obj", obj,
|
||||||
obj.getClass())).setFatal(true);
|
obj.getClass())).setFatal(true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,7 +91,7 @@ public abstract class AbstractDataCache extends AbstractConcurrentEventManager
|
||||||
_name = name;
|
_name = name;
|
||||||
}
|
}
|
||||||
public void setEnableStatistics(boolean enable){
|
public void setEnableStatistics(boolean enable){
|
||||||
if(enable == true){
|
if(enable){
|
||||||
_stats.enable();
|
_stats.enable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -310,7 +310,7 @@ public class DataCacheStoreManager extends DelegatingStoreManager {
|
||||||
for(int i = 0; i < oids.size(); i++) {
|
for(int i = 0; i < oids.size(); i++) {
|
||||||
Object oid = oids.get(i);
|
Object oid = oids.get(i);
|
||||||
// Only check the cache if we haven't found the current oid.
|
// 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);
|
edata.set(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -157,7 +157,7 @@ public class QueryCacheStoreQuery
|
||||||
if (projs == 0) {
|
if (projs == 0) {
|
||||||
// We're only going to return the cached results if we have ALL results cached. This could be improved
|
// 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.
|
// in the future to be a little more intelligent.
|
||||||
if (getContext().getStoreContext().isCached(res) == false) {
|
if (!getContext().getStoreContext().isCached(res)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,8 +64,7 @@ public class WASRegistryManagedRuntime extends RegistryManagedRuntime {
|
||||||
|
|
||||||
}
|
}
|
||||||
catch(Exception e ) {
|
catch(Exception e ) {
|
||||||
RuntimeException re = new RuntimeException(e.getMessage());
|
RuntimeException re = new RuntimeException(e.getMessage(), e);
|
||||||
re.initCause(e);
|
|
||||||
throw re;
|
throw re;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,7 +81,7 @@ public class InstrumentationFactory {
|
||||||
* Exceptions are encountered.
|
* Exceptions are encountered.
|
||||||
*/
|
*/
|
||||||
public static synchronized Instrumentation getInstrumentation(final Log log) {
|
public static synchronized Instrumentation getInstrumentation(final Log log) {
|
||||||
if (log.isTraceEnabled() == true) {
|
if (log.isTraceEnabled()) {
|
||||||
log.trace(_name + ".getInstrumentation() _inst:" + _inst
|
log.trace(_name + ".getInstrumentation() _inst:" + _inst
|
||||||
+ " _dynamicallyInstall:" + _dynamicallyInstall);
|
+ " _dynamicallyInstall:" + _dynamicallyInstall);
|
||||||
}
|
}
|
||||||
|
@ -106,7 +106,7 @@ public class InstrumentationFactory {
|
||||||
File toolsJar = null;
|
File toolsJar = null;
|
||||||
// When running on IBM, the attach api classes are packaged in vm.jar which is a part
|
// When running on IBM, the attach api classes are packaged in vm.jar which is a part
|
||||||
// of the default vm classpath.
|
// 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.
|
// If we can't find the tools.jar and we're not on IBM we can't load the agent.
|
||||||
toolsJar = findToolsJar(log);
|
toolsJar = findToolsJar(log);
|
||||||
if (toolsJar == null) {
|
if (toolsJar == null) {
|
||||||
|
@ -160,7 +160,7 @@ public class InstrumentationFactory {
|
||||||
.println("Agent-Class: " + InstrumentationFactory.class.getName());
|
.println("Agent-Class: " + InstrumentationFactory.class.getName());
|
||||||
writer.println("Can-Redefine-Classes: true");
|
writer.println("Can-Redefine-Classes: true");
|
||||||
// IBM doesn't support retransform
|
// 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();
|
writer.close();
|
||||||
|
|
||||||
|
@ -179,27 +179,27 @@ public class InstrumentationFactory {
|
||||||
File javaHomeFile = new File(javaHome);
|
File javaHomeFile = new File(javaHome);
|
||||||
|
|
||||||
File toolsJarFile = new File(javaHomeFile, "lib" + File.separator + "tools.jar");
|
File toolsJarFile = new File(javaHomeFile, "lib" + File.separator + "tools.jar");
|
||||||
if (toolsJarFile.exists() == false) {
|
if (!toolsJarFile.exists()) {
|
||||||
if (log.isTraceEnabled() == true) {
|
if (log.isTraceEnabled()) {
|
||||||
log.trace(_name + ".findToolsJar() -- couldn't find default " + toolsJarFile.getAbsolutePath());
|
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 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();
|
javaHomeFile = javaHomeFile.getParentFile();
|
||||||
toolsJarFile = new File(javaHomeFile, "lib" + File.separator + "tools.jar");
|
toolsJarFile = new File(javaHomeFile, "lib" + File.separator + "tools.jar");
|
||||||
if (toolsJarFile.exists() == false) {
|
if (!toolsJarFile.exists()) {
|
||||||
if (log.isTraceEnabled() == true) {
|
if (log.isTraceEnabled()) {
|
||||||
log.trace(_name + ".findToolsJar() -- for IBM SDK couldn't find " +
|
log.trace(_name + ".findToolsJar() -- for IBM SDK couldn't find " +
|
||||||
toolsJarFile.getAbsolutePath());
|
toolsJarFile.getAbsolutePath());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (System.getProperty("os.name").toLowerCase(Locale.ENGLISH).indexOf("mac") >= 0) {
|
} 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 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();
|
javaHomeFile = javaHomeFile.getParentFile();
|
||||||
toolsJarFile = new File(javaHomeFile, "Classes" + File.separator + "classes.jar");
|
toolsJarFile = new File(javaHomeFile, "Classes" + File.separator + "classes.jar");
|
||||||
if (toolsJarFile.exists() == false) {
|
if (!toolsJarFile.exists()) {
|
||||||
if (log.isTraceEnabled() == true) {
|
if (log.isTraceEnabled()) {
|
||||||
log.trace(_name + ".findToolsJar() -- for Mac OS couldn't find " +
|
log.trace(_name + ".findToolsJar() -- for Mac OS couldn't find " +
|
||||||
toolsJarFile.getAbsolutePath());
|
toolsJarFile.getAbsolutePath());
|
||||||
}
|
}
|
||||||
|
@ -208,10 +208,10 @@ public class InstrumentationFactory {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (toolsJarFile.exists() == false) {
|
if (!toolsJarFile.exists()) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
if (log.isTraceEnabled() == true) {
|
if (log.isTraceEnabled()) {
|
||||||
log.trace(_name + ".findToolsJar() -- found " + toolsJarFile.getAbsolutePath());
|
log.trace(_name + ".findToolsJar() -- found " + toolsJarFile.getAbsolutePath());
|
||||||
}
|
}
|
||||||
return toolsJarFile;
|
return toolsJarFile;
|
||||||
|
@ -245,26 +245,26 @@ public class InstrumentationFactory {
|
||||||
// class defined as the Agent-Class.
|
// class defined as the Agent-Class.
|
||||||
boolean createJar = false;
|
boolean createJar = false;
|
||||||
if (cs == null || agentJarFile == null
|
if (cs == null || agentJarFile == null
|
||||||
|| agentJarFile.isDirectory() == true) {
|
|| agentJarFile.isDirectory()) {
|
||||||
createJar = true;
|
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.
|
// We have an agentJarFile, but this class isn't the Agent-Class.
|
||||||
createJar=true;
|
createJar=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
String agentJar;
|
String agentJar;
|
||||||
if (createJar == true) {
|
if (createJar) {
|
||||||
// This can happen when running in eclipse as an OpenJPA
|
// This can happen when running in eclipse as an OpenJPA
|
||||||
// developer or for some reason the CodeSource is null. We
|
// developer or for some reason the CodeSource is null. We
|
||||||
// should log a warning here because this will create a jar
|
// should log a warning here because this will create a jar
|
||||||
// in your temp directory that doesn't always get cleaned up.
|
// in your temp directory that doesn't always get cleaned up.
|
||||||
try {
|
try {
|
||||||
agentJar = createAgentJar();
|
agentJar = createAgentJar();
|
||||||
if (log.isInfoEnabled() == true) {
|
if (log.isInfoEnabled()) {
|
||||||
log.info(_loc.get("temp-file-creation", agentJar));
|
log.info(_loc.get("temp-file-creation", agentJar));
|
||||||
}
|
}
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
if (log.isTraceEnabled() == true) {
|
if (log.isTraceEnabled()) {
|
||||||
log.trace(_name + ".getAgentJar() caught unexpected "
|
log.trace(_name + ".getAgentJar() caught unexpected "
|
||||||
+ "exception.", ioe);
|
+ "exception.", ioe);
|
||||||
}
|
}
|
||||||
|
@ -310,7 +310,7 @@ public class InstrumentationFactory {
|
||||||
vmClass.getMethod("detach", new Class[] {}).invoke(vm,
|
vmClass.getMethod("detach", new Class[] {}).invoke(vm,
|
||||||
new Object[] {});
|
new Object[] {});
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
if (log.isTraceEnabled() == true) {
|
if (log.isTraceEnabled()) {
|
||||||
// Log the message from the exception. Don't log the entire
|
// Log the message from the exception. Don't log the entire
|
||||||
// stack as this is expected when running on a JDK that doesn't
|
// stack as this is expected when running on a JDK that doesn't
|
||||||
// support the Attach API.
|
// support the Attach API.
|
||||||
|
@ -336,7 +336,7 @@ public class InstrumentationFactory {
|
||||||
try {
|
try {
|
||||||
ClassLoader loader = Thread.currentThread().getContextClassLoader();
|
ClassLoader loader = Thread.currentThread().getContextClassLoader();
|
||||||
String cls = vendor.getVirtualMachineClassName();
|
String cls = vendor.getVirtualMachineClassName();
|
||||||
if (vendor.isIBM() == false) {
|
if (!vendor.isIBM()) {
|
||||||
loader = new URLClassLoader(new URL[] { toolsJar.toURI().toURL() }, loader);
|
loader = new URLClassLoader(new URL[] { toolsJar.toURI().toURL() }, loader);
|
||||||
}
|
}
|
||||||
return loader.loadClass(cls);
|
return loader.loadClass(cls);
|
||||||
|
@ -374,7 +374,7 @@ public class InstrumentationFactory {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
if (log.isTraceEnabled() == true) {
|
if (log.isTraceEnabled()) {
|
||||||
log.trace(_name
|
log.trace(_name
|
||||||
+ ".validateAgentJarManifest() caught unexpected "
|
+ ".validateAgentJarManifest() caught unexpected "
|
||||||
+ "exception " + e.getMessage());
|
+ "exception " + e.getMessage());
|
||||||
|
|
|
@ -95,7 +95,7 @@ public class ManagedClassSubclasser {
|
||||||
if (!PersistenceCapable.class.isAssignableFrom(cls))
|
if (!PersistenceCapable.class.isAssignableFrom(cls))
|
||||||
unenhanced.add(cls);
|
unenhanced.add(cls);
|
||||||
if (unenhanced.size() > 0) {
|
if (unenhanced.size() > 0) {
|
||||||
if (PCEnhancerAgent.getLoadSuccessful() == true) {
|
if (PCEnhancerAgent.getLoadSuccessful()) {
|
||||||
// This means that the enhancer has been ran but we
|
// This means that the enhancer has been ran but we
|
||||||
// have some unenhanced classes. This can happen if an
|
// have some unenhanced classes. This can happen if an
|
||||||
// entity is loaded by the JVM before the EntityManger
|
// entity is loaded by the JVM before the EntityManger
|
||||||
|
|
|
@ -1181,7 +1181,7 @@ public class PCEnhancer {
|
||||||
addCopyKeyFieldsToObjectIdMethod(false);
|
addCopyKeyFieldsToObjectIdMethod(false);
|
||||||
addCopyKeyFieldsFromObjectIdMethod(true);
|
addCopyKeyFieldsFromObjectIdMethod(true);
|
||||||
addCopyKeyFieldsFromObjectIdMethod(false);
|
addCopyKeyFieldsFromObjectIdMethod(false);
|
||||||
if (_meta.hasAbstractPKField() == true) {
|
if (_meta.hasAbstractPKField()) {
|
||||||
addGetIDOwningClass();
|
addGetIDOwningClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2745,7 +2745,7 @@ public class PCEnhancer {
|
||||||
// new ObjectId (cls, oid)
|
// new ObjectId (cls, oid)
|
||||||
code.anew().setType(ObjectId.class);
|
code.anew().setType(ObjectId.class);
|
||||||
code.dup();
|
code.dup();
|
||||||
if(_meta.isEmbeddedOnly() || _meta.hasAbstractPKField() == true) {
|
if(_meta.isEmbeddedOnly() || _meta.hasAbstractPKField()) {
|
||||||
code.aload().setThis();
|
code.aload().setThis();
|
||||||
code.invokevirtual().setMethod(PRE + "GetIDOwningClass",
|
code.invokevirtual().setMethod(PRE + "GetIDOwningClass",
|
||||||
Class.class, null);
|
Class.class, null);
|
||||||
|
@ -2760,7 +2760,7 @@ public class PCEnhancer {
|
||||||
if (_meta.isOpenJPAIdentity() || (obj && usesClsString == Boolean.TRUE)) {
|
if (_meta.isOpenJPAIdentity() || (obj && usesClsString == Boolean.TRUE)) {
|
||||||
if ((_meta.isEmbeddedOnly()
|
if ((_meta.isEmbeddedOnly()
|
||||||
&& !(_meta.isEmbeddable() && _meta.getIdentityType() == ClassMetaData.ID_APPLICATION))
|
&& !(_meta.isEmbeddable() && _meta.getIdentityType() == ClassMetaData.ID_APPLICATION))
|
||||||
|| _meta.hasAbstractPKField() == true) {
|
|| _meta.hasAbstractPKField()) {
|
||||||
code.aload().setThis();
|
code.aload().setThis();
|
||||||
code.invokevirtual().setMethod(PRE + "GetIDOwningClass", Class.class, null);
|
code.invokevirtual().setMethod(PRE + "GetIDOwningClass", Class.class, null);
|
||||||
} else {
|
} else {
|
||||||
|
@ -3879,7 +3879,7 @@ public class PCEnhancer {
|
||||||
loadManagedInstance(code, true, fmd);
|
loadManagedInstance(code, true, fmd);
|
||||||
code.xload().setParam(firstParamOffset);
|
code.xload().setParam(firstParamOffset);
|
||||||
addSetManagedValueCode(code, fmd);
|
addSetManagedValueCode(code, fmd);
|
||||||
if(fmd.isVersion()==true && _addVersionInitFlag){
|
if(fmd.isVersion() && _addVersionInitFlag){
|
||||||
// if we are setting the version, flip the versionInit flag to true
|
// if we are setting the version, flip the versionInit flag to true
|
||||||
loadManagedInstance(code, true);
|
loadManagedInstance(code, true);
|
||||||
code.constant().setValue(1);
|
code.constant().setValue(1);
|
||||||
|
|
|
@ -88,7 +88,7 @@ public class PCEnhancerAgent {
|
||||||
* @return True if the agent is loaded successfully
|
* @return True if the agent is loaded successfully
|
||||||
*/
|
*/
|
||||||
public static synchronized boolean loadDynamicAgent(Log log) {
|
public static synchronized boolean loadDynamicAgent(Log log) {
|
||||||
if (loadAttempted == false && disableDynamicAgent == false) {
|
if (!loadAttempted && !disableDynamicAgent) {
|
||||||
Instrumentation inst =
|
Instrumentation inst =
|
||||||
InstrumentationFactory.getInstrumentation(log);
|
InstrumentationFactory.getInstrumentation(log);
|
||||||
if (inst != null) {
|
if (inst != null) {
|
||||||
|
@ -113,7 +113,7 @@ public class PCEnhancerAgent {
|
||||||
// The agent will be disabled when running in an application
|
// The agent will be disabled when running in an application
|
||||||
// server.
|
// server.
|
||||||
synchronized (PCEnhancerAgent.class) {
|
synchronized (PCEnhancerAgent.class) {
|
||||||
if (loadAttempted == true) {
|
if (loadAttempted) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// See the comment in loadDynamicAgent as to why we set this to true
|
// See the comment in loadDynamicAgent as to why we set this to true
|
||||||
|
|
|
@ -946,9 +946,9 @@ public class Reflection {
|
||||||
*/
|
*/
|
||||||
static boolean canReflect(Reflectable cls, Reflectable member) {
|
static boolean canReflect(Reflectable cls, Reflectable member) {
|
||||||
if (cls == null || cls.value()) {
|
if (cls == null || cls.value()) {
|
||||||
return member == null || member.value() == true;
|
return member == null || member.value();
|
||||||
} else {
|
} else {
|
||||||
return member != null && member.value() == true;
|
return member != null && member.value();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -337,7 +337,7 @@ public class TCPRemoteCommitProvider
|
||||||
public void broadcast(final RemoteCommitEvent event) {
|
public void broadcast(final RemoteCommitEvent event) {
|
||||||
// build a packet notifying other JVMs of object changes.
|
// build a packet notifying other JVMs of object changes.
|
||||||
try (ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
try (ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||||
ObjectOutputStream oos = new ObjectOutputStream(baos);) {
|
ObjectOutputStream oos = new ObjectOutputStream(baos)) {
|
||||||
|
|
||||||
oos.writeLong(PROTOCOL_VERSION);
|
oos.writeLong(PROTOCOL_VERSION);
|
||||||
oos.writeLong(_id);
|
oos.writeLong(_id);
|
||||||
|
|
|
@ -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
|
// 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.
|
// 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
|
// Don't catch any exceptions here because we want to fail-fast if something bad happens when we're
|
||||||
// preloading.
|
// preloading.
|
||||||
MetaDataRepository mdr = _conf.getMetaDataRepositoryInstance();
|
MetaDataRepository mdr = _conf.getMetaDataRepositoryInstance();
|
||||||
|
|
|
@ -2457,7 +2457,7 @@ public class BrokerImpl implements Broker, FindCallbacks, Cloneable, Serializabl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (opt && !failed.isEmpty()) {
|
if (opt && !failed.isEmpty()) {
|
||||||
if(_suppressBatchOLELogging == true){
|
if(_suppressBatchOLELogging){
|
||||||
return new OptimisticException(_loc.get("broker-suppressing-exceptions",t.length));
|
return new OptimisticException(_loc.get("broker-suppressing-exceptions",t.length));
|
||||||
}else{
|
}else{
|
||||||
return new OptimisticException(failed, t);
|
return new OptimisticException(failed, t);
|
||||||
|
@ -3568,7 +3568,7 @@ public class BrokerImpl implements Broker, FindCallbacks, Cloneable, Serializabl
|
||||||
}
|
}
|
||||||
|
|
||||||
private void detachAllInternal(OpCallbacks call) {
|
private void detachAllInternal(OpCallbacks call) {
|
||||||
if(_conf.getDetachStateInstance().getLiteAutoDetach() == true){
|
if(_conf.getDetachStateInstance().getLiteAutoDetach()){
|
||||||
detachAllInternalLite();
|
detachAllInternalLite();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -291,7 +291,7 @@ public class DetachManager
|
||||||
_copy = false;
|
_copy = false;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
_copy = compatibility.getCopyOnDetach();;
|
_copy = compatibility.getCopyOnDetach();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ public class DetachManagerLite {
|
||||||
ClassMetaData cmd = sm.getMetaData();
|
ClassMetaData cmd = sm.getMetaData();
|
||||||
if (sm.isPersistent() && cmd.isDetachable()) {
|
if (sm.isPersistent() && cmd.isDetachable()) {
|
||||||
PersistenceCapable pc = sm.getPersistenceCapable();
|
PersistenceCapable pc = sm.getPersistenceCapable();
|
||||||
if (pc.pcIsDetached() == false) {
|
if (!pc.pcIsDetached()) {
|
||||||
// Detach proxy fields.
|
// Detach proxy fields.
|
||||||
BitSet loaded = sm.getLoaded();
|
BitSet loaded = sm.getLoaded();
|
||||||
for (FieldMetaData fmd : cmd.getProxyFields()) {
|
for (FieldMetaData fmd : cmd.getProxyFields()) {
|
||||||
|
@ -79,7 +79,7 @@ public class DetachManagerLite {
|
||||||
StateManagerImpl sm, TransferFieldManager fm) {
|
StateManagerImpl sm, TransferFieldManager fm) {
|
||||||
|
|
||||||
int fieldIndex = fmd.getIndex();
|
int fieldIndex = fmd.getIndex();
|
||||||
if (fmd.isLRS() == true) {
|
if (fmd.isLRS()) {
|
||||||
// need to null out LRS fields.
|
// need to null out LRS fields.
|
||||||
nullField(fieldIndex, pc, sm, fm);
|
nullField(fieldIndex, pc, sm, fm);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -253,7 +253,7 @@ public class FetchConfigurationImpl
|
||||||
|
|
||||||
|
|
||||||
void copyHints(FetchConfiguration fetch) {
|
void copyHints(FetchConfiguration fetch) {
|
||||||
if (fetch instanceof FetchConfigurationImpl == false)
|
if (!(fetch instanceof FetchConfigurationImpl))
|
||||||
return;
|
return;
|
||||||
FetchConfigurationImpl from = (FetchConfigurationImpl)fetch;
|
FetchConfigurationImpl from = (FetchConfigurationImpl)fetch;
|
||||||
if (from._state == null || from._state.hints == null)
|
if (from._state == null || from._state.hints == null)
|
||||||
|
|
|
@ -1258,7 +1258,7 @@ public class QueryImpl implements Query {
|
||||||
s = toString();
|
s = toString();
|
||||||
|
|
||||||
String msg = "executing-query";
|
String msg = "executing-query";
|
||||||
if (params.isEmpty() == false) {
|
if (!params.isEmpty()) {
|
||||||
msg = "executing-query-with-params";
|
msg = "executing-query-with-params";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -193,7 +193,7 @@ class VersionAttachStrategy
|
||||||
Object pcField = Reflection.get(pc, pcVersionInitField);
|
Object pcField = Reflection.get(pc, pcVersionInitField);
|
||||||
if (pcField != null) {
|
if (pcField != null) {
|
||||||
boolean bool = (Boolean) pcField;
|
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
|
// If this field if false, that means that the pcGetVersion returned a default value rather than
|
||||||
// and actual value.
|
// and actual value.
|
||||||
version = null;
|
version = null;
|
||||||
|
|
|
@ -288,7 +288,7 @@ public abstract class AbstractMetaDataDefaults
|
||||||
public static String getFieldName(Member member) {
|
public static String getFieldName(Member member) {
|
||||||
if (member instanceof Field)
|
if (member instanceof Field)
|
||||||
return member.getName();
|
return member.getName();
|
||||||
if (member instanceof Method == false)
|
if (!(member instanceof Method))
|
||||||
return null;
|
return null;
|
||||||
Method method = (Method) member;
|
Method method = (Method) member;
|
||||||
String name = method.getName();
|
String name = method.getName();
|
||||||
|
|
|
@ -1051,7 +1051,7 @@ public class ClassMetaData
|
||||||
}
|
}
|
||||||
List<FieldMetaData> res = new ArrayList<>();
|
List<FieldMetaData> res = new ArrayList<>();
|
||||||
for (FieldMetaData fmd : _allFields) {
|
for (FieldMetaData fmd : _allFields) {
|
||||||
if(fmd.isLRS()==true){
|
if(fmd.isLRS()){
|
||||||
res.add(fmd);
|
res.add(fmd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1127,7 +1127,6 @@ public class ClassMetaData
|
||||||
if (_fields == null) {
|
if (_fields == null) {
|
||||||
List<FieldMetaData> fields =
|
List<FieldMetaData> fields =
|
||||||
new ArrayList<>(_fieldMap.size());
|
new ArrayList<>(_fieldMap.size());
|
||||||
;
|
|
||||||
for (FieldMetaData fmd : _fieldMap.values()) {
|
for (FieldMetaData fmd : _fieldMap.values()) {
|
||||||
if (fmd.getManagement() != FieldMetaData.MANAGE_NONE) {
|
if (fmd.getManagement() != FieldMetaData.MANAGE_NONE) {
|
||||||
fmd.setDeclaredIndex(fields.size());
|
fmd.setDeclaredIndex(fields.size());
|
||||||
|
@ -1290,7 +1289,6 @@ public class ClassMetaData
|
||||||
public FieldMetaData[] getDeclaredUnmanagedFields() {
|
public FieldMetaData[] getDeclaredUnmanagedFields() {
|
||||||
if (_unmgdFields == null) {
|
if (_unmgdFields == null) {
|
||||||
List<FieldMetaData> unmanaged = new ArrayList<>(3);
|
List<FieldMetaData> unmanaged = new ArrayList<>(3);
|
||||||
;
|
|
||||||
for (FieldMetaData field : _fieldMap.values()) {
|
for (FieldMetaData field : _fieldMap.values()) {
|
||||||
if (field.getManagement() == FieldMetaData.MANAGE_NONE)
|
if (field.getManagement() == FieldMetaData.MANAGE_NONE)
|
||||||
unmanaged.add(field);
|
unmanaged.add(field);
|
||||||
|
@ -2714,7 +2712,7 @@ public class ClassMetaData
|
||||||
// declares a PKField.
|
// declares a PKField.
|
||||||
Boolean temp = Boolean.FALSE;
|
Boolean temp = Boolean.FALSE;
|
||||||
|
|
||||||
if (isAbstract() == true) {
|
if (isAbstract()) {
|
||||||
FieldMetaData[] declaredFields = getDeclaredFields();
|
FieldMetaData[] declaredFields = getDeclaredFields();
|
||||||
if (declaredFields != null && declaredFields.length != 0) {
|
if (declaredFields != null && declaredFields.length != 0) {
|
||||||
for (FieldMetaData fmd : declaredFields) {
|
for (FieldMetaData fmd : declaredFields) {
|
||||||
|
|
|
@ -2362,13 +2362,11 @@ public class FieldMetaData
|
||||||
cls, memberName, parameterTypes));
|
cls, memberName, parameterTypes));
|
||||||
}
|
}
|
||||||
} catch (SecurityException e) {
|
} catch (SecurityException e) {
|
||||||
IOException ioe = new IOException(e.getMessage());
|
IOException ioe = new IOException(e.getMessage(), e);
|
||||||
ioe.initCause(e);
|
|
||||||
throw ioe;
|
throw ioe;
|
||||||
} catch (PrivilegedActionException pae) {
|
} catch (PrivilegedActionException pae) {
|
||||||
IOException ioe = new IOException(
|
IOException ioe = new IOException(
|
||||||
pae.getException().getMessage());
|
pae.getException().getMessage(), pae);
|
||||||
ioe.initCause(pae);
|
|
||||||
throw ioe;
|
throw ioe;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2465,7 +2463,7 @@ public class FieldMetaData
|
||||||
}
|
}
|
||||||
return _relationType;
|
return _relationType;
|
||||||
}
|
}
|
||||||
private class Unknown{};
|
private class Unknown{}
|
||||||
|
|
||||||
public boolean isDelayCapable() {
|
public boolean isDelayCapable() {
|
||||||
if (_delayCapable != null) {
|
if (_delayCapable != null) {
|
||||||
|
|
|
@ -314,11 +314,11 @@ public class MetaDataRepository implements PCRegistry.RegisterClassListener, Con
|
||||||
* MetaData for all persistent classes and will remove locking from this class.
|
* MetaData for all persistent classes and will remove locking from this class.
|
||||||
*/
|
*/
|
||||||
public synchronized void preload() {
|
public synchronized void preload() {
|
||||||
if (_preload == false) {
|
if (!_preload) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// If pooling EMFs, this method may be invoked more than once. Only perform this work once.
|
// If pooling EMFs, this method may be invoked more than once. Only perform this work once.
|
||||||
if (_preloadComplete == true) {
|
if (_preloadComplete) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -341,7 +341,7 @@ public class MetaDataRepository implements PCRegistry.RegisterClassListener, Con
|
||||||
if (classes == null || classes.size() == 0) {
|
if (classes == null || classes.size() == 0) {
|
||||||
throw new MetaDataException(_loc.get("repos-initializeEager-none"));
|
throw new MetaDataException(_loc.get("repos-initializeEager-none"));
|
||||||
}
|
}
|
||||||
if (_log.isTraceEnabled() == true) {
|
if (_log.isTraceEnabled()) {
|
||||||
_log.trace(_loc.get("repos-initializeEager-found", classes));
|
_log.trace(_loc.get("repos-initializeEager-found", classes));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1960,7 +1960,7 @@ public class MetaDataRepository implements PCRegistry.RegisterClassListener, Con
|
||||||
initializeMetaDataFactory();
|
initializeMetaDataFactory();
|
||||||
if (_implGen == null)
|
if (_implGen == null)
|
||||||
_implGen = new InterfaceImplGenerator(this);
|
_implGen = new InterfaceImplGenerator(this);
|
||||||
if (_preload == true) {
|
if (_preload) {
|
||||||
_oids = new HashMap<>();
|
_oids = new HashMap<>();
|
||||||
_impls = new HashMap<>();
|
_impls = new HashMap<>();
|
||||||
_ifaces = new HashMap<>();
|
_ifaces = new HashMap<>();
|
||||||
|
@ -2533,7 +2533,7 @@ public class MetaDataRepository implements PCRegistry.RegisterClassListener, Con
|
||||||
if (conf == null)
|
if (conf == null)
|
||||||
return false;
|
return false;
|
||||||
Options o = Configurations.parseProperties(Configurations.getProperties(conf.getMetaDataRepository()));
|
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 true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -2544,12 +2544,12 @@ public class MetaDataRepository implements PCRegistry.RegisterClassListener, Con
|
||||||
* is older than the current version.
|
* is older than the current version.
|
||||||
*/
|
*/
|
||||||
private void checkEnhancementLevel(Class<?> cls) {
|
private void checkEnhancementLevel(Class<?> cls) {
|
||||||
if (_logEnhancementLevel == false) {
|
if (!_logEnhancementLevel) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Log log = _conf.getLog(OpenJPAConfiguration.LOG_RUNTIME);
|
Log log = _conf.getLog(OpenJPAConfiguration.LOG_RUNTIME);
|
||||||
boolean res = PCEnhancer.checkEnhancementLevel(cls, _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.
|
// Since trace isn't enabled flip the flag so we only log this once.
|
||||||
_logEnhancementLevel = false;
|
_logEnhancementLevel = false;
|
||||||
log.info(_loc.get("down-level-entity"));
|
log.info(_loc.get("down-level-entity"));
|
||||||
|
|
|
@ -147,7 +147,8 @@ public class MultiQueryMetaData extends QueryMetaData {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public static class Parameter {
|
public static class Parameter {
|
||||||
public enum Mode {IN,OUT,INOUT,CURSOR};
|
public enum Mode {IN,OUT,INOUT,CURSOR}
|
||||||
|
|
||||||
private final String name;
|
private final String name;
|
||||||
private final Class<?> type;
|
private final Class<?> type;
|
||||||
private final Mode mode;
|
private final Mode mode;
|
||||||
|
|
|
@ -20,10 +20,6 @@ package org.apache.openjpa.conf;
|
||||||
|
|
||||||
|
|
||||||
import org.junit.Test;
|
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.junit.Assert;
|
||||||
import org.apache.openjpa.conf.*;
|
import org.apache.openjpa.conf.*;
|
||||||
|
|
||||||
|
|
|
@ -39,5 +39,5 @@ class CustomProxyDefaultScopeList<E> extends AbstractSequentialList<E> {
|
||||||
|
|
||||||
public static Object instance() {
|
public static Object instance() {
|
||||||
return new CustomProxyDefaultScopeList<Integer>();
|
return new CustomProxyDefaultScopeList<Integer>();
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,5 +40,5 @@ class CustomProxyDefaultScopeType {
|
||||||
|
|
||||||
public static Object instance() {
|
public static Object instance() {
|
||||||
return new CustomProxyDefaultScopeType();
|
return new CustomProxyDefaultScopeType();
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -394,7 +394,7 @@ public abstract class XMLMetaDataParser extends DefaultHandler
|
||||||
ClassLoader newLoader = null;
|
ClassLoader newLoader = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (overrideCL == true) {
|
if (overrideCL) {
|
||||||
oldLoader =
|
oldLoader =
|
||||||
(ClassLoader) AccessController.doPrivileged(J2DoPrivHelper.getContextClassLoaderAction());
|
(ClassLoader) AccessController.doPrivileged(J2DoPrivHelper.getContextClassLoaderAction());
|
||||||
newLoader = XMLMetaDataParser.class.getClassLoader();
|
newLoader = XMLMetaDataParser.class.getClassLoader();
|
||||||
|
@ -432,11 +432,10 @@ public abstract class XMLMetaDataParser extends DefaultHandler
|
||||||
parser.parse(is, this);
|
parser.parse(is, this);
|
||||||
finish();
|
finish();
|
||||||
} catch (SAXException se) {
|
} catch (SAXException se) {
|
||||||
IOException ioe = new IOException(se.toString());
|
IOException ioe = new IOException(se.toString(), se);
|
||||||
ioe.initCause(se);
|
|
||||||
throw ioe;
|
throw ioe;
|
||||||
} finally {
|
} finally {
|
||||||
if (overrideCL == true) {
|
if (overrideCL) {
|
||||||
// Restore the old ContextClassloader
|
// Restore the old ContextClassloader
|
||||||
try {
|
try {
|
||||||
if (_log != null && _log.isTraceEnabled()) {
|
if (_log != null && _log.isTraceEnabled()) {
|
||||||
|
|
|
@ -70,7 +70,7 @@ public final class StringUtil {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < strLen; i++) {
|
for (int i = 0; i < strLen; i++) {
|
||||||
if (Character.isWhitespace(cs.charAt(i)) == false) {
|
if (!Character.isWhitespace(cs.charAt(i))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,7 +99,7 @@ public class UUIDGenerator {
|
||||||
* the node portion of the UUID using the IP address.
|
* the node portion of the UUID using the IP address.
|
||||||
*/
|
*/
|
||||||
private static synchronized void initializeForType1() {
|
private static synchronized void initializeForType1() {
|
||||||
if (type1Initialized == true) {
|
if (type1Initialized) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// note that secure random is very slow the first time
|
// note that secure random is very slow the first time
|
||||||
|
@ -140,7 +140,7 @@ public class UUIDGenerator {
|
||||||
* Creates a type 1 UUID
|
* Creates a type 1 UUID
|
||||||
*/
|
*/
|
||||||
public static byte[] createType1() {
|
public static byte[] createType1() {
|
||||||
if (type1Initialized == false) {
|
if (!type1Initialized) {
|
||||||
initializeForType1();
|
initializeForType1();
|
||||||
}
|
}
|
||||||
// set ip addr
|
// set ip addr
|
||||||
|
|
|
@ -421,7 +421,7 @@ public abstract class AbstractDualBidiMap<K, V> implements BidiMap<K, V> {
|
||||||
boolean modified = false;
|
boolean modified = false;
|
||||||
final Iterator<E> it = iterator();
|
final Iterator<E> it = iterator();
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
if (coll.contains(it.next()) == false) {
|
if (!coll.contains(it.next())) {
|
||||||
it.remove();
|
it.remove();
|
||||||
modified = true;
|
modified = true;
|
||||||
}
|
}
|
||||||
|
@ -508,7 +508,7 @@ public abstract class AbstractDualBidiMap<K, V> implements BidiMap<K, V> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void remove() {
|
public void remove() {
|
||||||
if (canRemove == false) {
|
if (!canRemove) {
|
||||||
throw new IllegalStateException("Iterator remove() can only be called once after next()");
|
throw new IllegalStateException("Iterator remove() can only be called once after next()");
|
||||||
}
|
}
|
||||||
final Object value = parent.normalMap.get(lastKey);
|
final Object value = parent.normalMap.get(lastKey);
|
||||||
|
@ -593,7 +593,7 @@ public abstract class AbstractDualBidiMap<K, V> implements BidiMap<K, V> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void remove() {
|
public void remove() {
|
||||||
if (canRemove == false) {
|
if (!canRemove) {
|
||||||
throw new IllegalStateException("Iterator remove() can only be called once after next()");
|
throw new IllegalStateException("Iterator remove() can only be called once after next()");
|
||||||
}
|
}
|
||||||
super.remove(); // removes from maps[0]
|
super.remove(); // removes from maps[0]
|
||||||
|
@ -628,7 +628,7 @@ public abstract class AbstractDualBidiMap<K, V> implements BidiMap<K, V> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean remove(final Object obj) {
|
public boolean remove(final Object obj) {
|
||||||
if (obj instanceof Map.Entry == false) {
|
if (!(obj instanceof Map.Entry)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final Entry<?, ?> entry = (Entry<?, ?>) obj;
|
final Entry<?, ?> entry = (Entry<?, ?>) obj;
|
||||||
|
@ -678,7 +678,7 @@ public abstract class AbstractDualBidiMap<K, V> implements BidiMap<K, V> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void remove() {
|
public void remove() {
|
||||||
if (canRemove == false) {
|
if (!canRemove) {
|
||||||
throw new IllegalStateException("Iterator remove() can only be called once after next()");
|
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)
|
// 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
|
@Override
|
||||||
public void remove() {
|
public void remove() {
|
||||||
if (canRemove == false) {
|
if (!canRemove) {
|
||||||
throw new IllegalStateException("Iterator remove() can only be called once after next()");
|
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)
|
// store value as remove may change the entry in the decorator (eg.TreeMap)
|
||||||
|
|
|
@ -860,10 +860,10 @@ public class AbstractHashedMap<K, V> extends AbstractMap<K, V> implements Iterab
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean remove(final Object obj) {
|
public boolean remove(final Object obj) {
|
||||||
if (obj instanceof Map.Entry == false) {
|
if (!(obj instanceof Map.Entry)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (contains(obj) == false) {
|
if (!contains(obj)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final Entry<?, ?> entry = (Entry<?, ?>) obj;
|
final Entry<?, ?> entry = (Entry<?, ?>) obj;
|
||||||
|
@ -1110,7 +1110,7 @@ public class AbstractHashedMap<K, V> extends AbstractMap<K, V> implements Iterab
|
||||||
if (obj == this) {
|
if (obj == this) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (obj instanceof Map.Entry == false) {
|
if (!(obj instanceof Map.Entry)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final Entry<?, ?> other = (Entry<?, ?>) obj;
|
final Entry<?, ?> other = (Entry<?, ?>) obj;
|
||||||
|
@ -1316,7 +1316,7 @@ public class AbstractHashedMap<K, V> extends AbstractMap<K, V> implements Iterab
|
||||||
if (obj == this) {
|
if (obj == this) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (obj instanceof Map == false) {
|
if (!(obj instanceof Map)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final Map<?,?> map = (Map<?,?>) obj;
|
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 key = it.next();
|
||||||
final Object value = it.getValue();
|
final Object value = it.getValue();
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
if (map.get(key) != null || map.containsKey(key) == false) {
|
if (map.get(key) != null || !map.containsKey(key)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (value.equals(map.get(key)) == false) {
|
if (!value.equals(map.get(key))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,7 +67,7 @@ public abstract class AbstractMapEntry<K, V> extends AbstractKeyValue<K, V> impl
|
||||||
if (obj == this) {
|
if (obj == this) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (obj instanceof Map.Entry == false) {
|
if (!(obj instanceof Map.Entry)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final Map.Entry<?, ?> other = (Map.Entry<?, ?>) obj;
|
final Map.Entry<?, ?> other = (Map.Entry<?, ?>) obj;
|
||||||
|
|
|
@ -676,7 +676,7 @@ public abstract class AbstractReferenceMap<K, V> extends AbstractHashedMap<K, V>
|
||||||
if (obj == this) {
|
if (obj == this) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (obj instanceof Map.Entry == false) {
|
if (!(obj instanceof Map.Entry)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -94,7 +94,7 @@ public class ComparatorChain<E> implements Comparator<E>, Serializable {
|
||||||
comparatorChain = new ArrayList<>(1);
|
comparatorChain = new ArrayList<>(1);
|
||||||
comparatorChain.add(comparator);
|
comparatorChain.add(comparator);
|
||||||
orderingBits = new BitSet(1);
|
orderingBits = new BitSet(1);
|
||||||
if (reverse == true) {
|
if (reverse) {
|
||||||
orderingBits.set(0);
|
orderingBits.set(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -153,7 +153,7 @@ public class ComparatorChain<E> implements Comparator<E>, Serializable {
|
||||||
checkLocked();
|
checkLocked();
|
||||||
|
|
||||||
comparatorChain.add(comparator);
|
comparatorChain.add(comparator);
|
||||||
if (reverse == true) {
|
if (reverse) {
|
||||||
orderingBits.set(comparatorChain.size() - 1);
|
orderingBits.set(comparatorChain.size() - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -183,7 +183,7 @@ public class ComparatorChain<E> implements Comparator<E>, Serializable {
|
||||||
checkLocked();
|
checkLocked();
|
||||||
|
|
||||||
comparatorChain.set(index,comparator);
|
comparatorChain.set(index,comparator);
|
||||||
if (reverse == true) {
|
if (reverse) {
|
||||||
orderingBits.set(index);
|
orderingBits.set(index);
|
||||||
} else {
|
} else {
|
||||||
orderingBits.clear(index);
|
orderingBits.clear(index);
|
||||||
|
@ -239,7 +239,7 @@ public class ComparatorChain<E> implements Comparator<E>, Serializable {
|
||||||
* @throws UnsupportedOperationException if the {@link ComparatorChain} is locked
|
* @throws UnsupportedOperationException if the {@link ComparatorChain} is locked
|
||||||
*/
|
*/
|
||||||
private void checkLocked() {
|
private void checkLocked() {
|
||||||
if (isLocked == true) {
|
if (isLocked) {
|
||||||
throw new UnsupportedOperationException(
|
throw new UnsupportedOperationException(
|
||||||
"Comparator ordering cannot be changed after the first comparison is performed");
|
"Comparator ordering cannot be changed after the first comparison is performed");
|
||||||
}
|
}
|
||||||
|
@ -268,7 +268,7 @@ public class ComparatorChain<E> implements Comparator<E>, Serializable {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int compare(final E o1, final E o2) throws UnsupportedOperationException {
|
public int compare(final E o1, final E o2) throws UnsupportedOperationException {
|
||||||
if (isLocked == false) {
|
if (!isLocked) {
|
||||||
checkChainIntegrity();
|
checkChainIntegrity();
|
||||||
isLocked = true;
|
isLocked = true;
|
||||||
}
|
}
|
||||||
|
@ -281,7 +281,7 @@ public class ComparatorChain<E> implements Comparator<E>, Serializable {
|
||||||
int retval = comparator.compare(o1,o2);
|
int retval = comparator.compare(o1,o2);
|
||||||
if (retval != 0) {
|
if (retval != 0) {
|
||||||
// invert the order if it is a reverse sort
|
// invert the order if it is a reverse sort
|
||||||
if (orderingBits.get(comparatorIndex) == true) {
|
if (orderingBits.get(comparatorIndex)) {
|
||||||
if (retval > 0) {
|
if (retval > 0) {
|
||||||
retval = -1;
|
retval = -1;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -187,7 +187,7 @@ public class IteratorChain<E> implements Iterator<E> {
|
||||||
* Checks whether the iterator chain is now locked and in use.
|
* Checks whether the iterator chain is now locked and in use.
|
||||||
*/
|
*/
|
||||||
private void checkLocked() {
|
private void checkLocked() {
|
||||||
if (isLocked == true) {
|
if (isLocked) {
|
||||||
throw new UnsupportedOperationException(
|
throw new UnsupportedOperationException(
|
||||||
"IteratorChain cannot be changed after the first use of a method from the Iterator interface");
|
"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.
|
* from all Iterator interface methods.
|
||||||
*/
|
*/
|
||||||
private void lockChain() {
|
private void lockChain() {
|
||||||
if (isLocked == false) {
|
if (!isLocked) {
|
||||||
isLocked = true;
|
isLocked = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -219,7 +219,7 @@ public class IteratorChain<E> implements Iterator<E> {
|
||||||
lastUsedIterator = currentIterator;
|
lastUsedIterator = currentIterator;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (currentIterator.hasNext() == false && !iteratorChain.isEmpty()) {
|
while (!currentIterator.hasNext() && !iteratorChain.isEmpty()) {
|
||||||
currentIterator = iteratorChain.remove();
|
currentIterator = iteratorChain.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1355,7 +1355,7 @@ public class TreeBidiMap<K extends Comparable<K>, V extends Comparable<V>>
|
||||||
if (obj == this) {
|
if (obj == this) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (obj instanceof Map == false) {
|
if (!(obj instanceof Map)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final Map<?, ?> other = (Map<?, ?>) obj;
|
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(); ) {
|
for (final MapIterator<?, ?> it = getMapIterator(dataElement); it.hasNext(); ) {
|
||||||
final Object key = it.next();
|
final Object key = it.next();
|
||||||
final Object value = it.getValue();
|
final Object value = it.getValue();
|
||||||
if (value.equals(other.get(key)) == false) {
|
if (!value.equals(other.get(key))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1571,7 +1571,7 @@ public class TreeBidiMap<K extends Comparable<K>, V extends Comparable<V>>
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean contains(final Object obj) {
|
public boolean contains(final Object obj) {
|
||||||
if (obj instanceof Map.Entry == false) {
|
if (!(obj instanceof Map.Entry)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final Entry<?, ?> entry = (Entry<?, ?>) obj;
|
final Entry<?, ?> entry = (Entry<?, ?>) obj;
|
||||||
|
@ -1582,7 +1582,7 @@ public class TreeBidiMap<K extends Comparable<K>, V extends Comparable<V>>
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean remove(final Object obj) {
|
public boolean remove(final Object obj) {
|
||||||
if (obj instanceof Map.Entry == false) {
|
if (!(obj instanceof Map.Entry)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final Entry<?, ?> entry = (Entry<?, ?>) obj;
|
final Entry<?, ?> entry = (Entry<?, ?>) obj;
|
||||||
|
@ -1612,7 +1612,7 @@ public class TreeBidiMap<K extends Comparable<K>, V extends Comparable<V>>
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean contains(final Object obj) {
|
public boolean contains(final Object obj) {
|
||||||
if (obj instanceof Map.Entry == false) {
|
if (!(obj instanceof Map.Entry)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final Entry<?, ?> entry = (Entry<?, ?>) obj;
|
final Entry<?, ?> entry = (Entry<?, ?>) obj;
|
||||||
|
@ -1623,7 +1623,7 @@ public class TreeBidiMap<K extends Comparable<K>, V extends Comparable<V>>
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean remove(final Object obj) {
|
public boolean remove(final Object obj) {
|
||||||
if (obj instanceof Map.Entry == false) {
|
if (!(obj instanceof Map.Entry)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final Entry<?, ?> entry = (Entry<?, ?>) obj;
|
final Entry<?, ?> entry = (Entry<?, ?>) obj;
|
||||||
|
|
|
@ -36,7 +36,7 @@ public class GitUtils {
|
||||||
* @return The formatted int version, or -1 if gitinfo is null or unparsable.
|
* @return The formatted int version, or -1 if gitinfo is null or unparsable.
|
||||||
*/
|
*/
|
||||||
public static int convertGitInfoToPCEnhancerVersion(String gitinfo) {
|
public static int convertGitInfoToPCEnhancerVersion(String gitinfo) {
|
||||||
if (gitinfo == null || fullRevisionPattern.matcher(gitinfo).matches() == false) {
|
if (gitinfo == null || !fullRevisionPattern.matcher(gitinfo).matches()) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -306,10 +306,10 @@ public abstract class ResultListTest extends AbstractTestCase {
|
||||||
ResultList list = getResultList(rops[i]);
|
ResultList list = getResultList(rops[i]);
|
||||||
try {
|
try {
|
||||||
List subList = list.subList(0, 0);
|
List subList = list.subList(0, 0);
|
||||||
if (subListSupported == false)
|
if (!subListSupported)
|
||||||
fail("Should not support subList.");
|
fail("Should not support subList.");
|
||||||
} catch (UnsupportedOperationException e) {
|
} catch (UnsupportedOperationException e) {
|
||||||
if (subListSupported == true)
|
if (subListSupported)
|
||||||
fail("Should support subList.");
|
fail("Should support subList.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -133,7 +133,7 @@ public abstract class AbstractTestCase {
|
||||||
* Support method to get a random String for testing.
|
* Support method to get a random String for testing.
|
||||||
*/
|
*/
|
||||||
public static String randomString(int len) {
|
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++)
|
for (int i = 0; i < (int) (Math.random() * len) + 1; i++)
|
||||||
buf.append(randomChar());
|
buf.append(randomChar());
|
||||||
return buf.toString();
|
return buf.toString();
|
||||||
|
|
|
@ -53,7 +53,7 @@ public class TestPropertiesParser {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSimpleProperties() throws IOException {
|
public void testSimpleProperties() throws IOException {
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuilder buf = new StringBuilder();
|
||||||
buf.append("key: value" + LS);
|
buf.append("key: value" + LS);
|
||||||
buf.append("key2: value2"); // no EOL -- this is intentional
|
buf.append("key2: value2"); // no EOL -- this is intentional
|
||||||
Properties p = toProperties(buf.toString());
|
Properties p = toProperties(buf.toString());
|
||||||
|
@ -63,7 +63,7 @@ public class TestPropertiesParser {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testComments() throws IOException {
|
public void testComments() throws IOException {
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuilder buf = new StringBuilder();
|
||||||
buf.append("# this is a comment" + LS);
|
buf.append("# this is a comment" + LS);
|
||||||
buf.append(" # another one, with leading whitespace " + LS);
|
buf.append(" # another one, with leading whitespace " + LS);
|
||||||
buf.append(" # and more with interesting whitespace " + LS);
|
buf.append(" # and more with interesting whitespace " + LS);
|
||||||
|
@ -76,7 +76,7 @@ public class TestPropertiesParser {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMixedContent() throws IOException {
|
public void testMixedContent() throws IOException {
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuilder buf = new StringBuilder();
|
||||||
buf.append("# this is a comment" + LS);
|
buf.append("# this is a comment" + LS);
|
||||||
buf.append(" # another one, with leading whitespace " + LS);
|
buf.append(" # another one, with leading whitespace " + LS);
|
||||||
buf.append("foo: bar#baz" + LS);
|
buf.append("foo: bar#baz" + LS);
|
||||||
|
@ -137,7 +137,7 @@ public class TestPropertiesParser {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testLineTypes() throws IOException {
|
public void testLineTypes() throws IOException {
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuilder buf = new StringBuilder();
|
||||||
buf.append(" !comment" + LS + " \t " + LS + "name = no" + LS + " "
|
buf.append(" !comment" + LS + " \t " + LS + "name = no" + LS + " "
|
||||||
+ "#morec\tomm\\" + LS + "ents" + LS + LS + " dog=no\\cat " + LS
|
+ "#morec\tomm\\" + LS + "ents" + LS + LS + " dog=no\\cat " + LS
|
||||||
+ "burps :" + LS + "test=" + LS + "date today" + LS + LS + LS
|
+ "burps :" + LS + "test=" + LS + "date today" + LS + LS + LS
|
||||||
|
@ -252,7 +252,7 @@ public class TestPropertiesParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
static String randomString(int len) {
|
static String randomString(int len) {
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuilder buf = new StringBuilder();
|
||||||
for (int i = 0; i < (int) (Math.random() * len) + 1; i++)
|
for (int i = 0; i < (int) (Math.random() * len) + 1; i++)
|
||||||
buf.append(randomChar());
|
buf.append(randomChar());
|
||||||
return buf.toString();
|
return buf.toString();
|
||||||
|
@ -307,7 +307,7 @@ public class TestPropertiesParser {
|
||||||
static String stripComments(byte[] bytes) throws IOException {
|
static String stripComments(byte[] bytes) throws IOException {
|
||||||
BufferedReader reader = new BufferedReader(new InputStreamReader
|
BufferedReader reader = new BufferedReader(new InputStreamReader
|
||||||
(new ByteArrayInputStream(bytes)));
|
(new ByteArrayInputStream(bytes)));
|
||||||
StringBuffer sbuf = new StringBuffer();
|
StringBuilder sbuf = new StringBuilder();
|
||||||
String line;
|
String line;
|
||||||
while ((line = reader.readLine()) != null) {
|
while ((line = reader.readLine()) != null) {
|
||||||
// skip comments
|
// skip comments
|
||||||
|
|
|
@ -21,7 +21,6 @@ package org.apache.openjpa.lib.util;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
|
@ -55,7 +55,7 @@ public class TestDocTypeReader {
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
StringBuffer docType = new StringBuffer();
|
StringBuilder docType = new StringBuilder();
|
||||||
docType.append("<!DOCTYPE foo [\n");
|
docType.append("<!DOCTYPE foo [\n");
|
||||||
docType.append("\t<!ELEMENT foo (bar)>\n");
|
docType.append("\t<!ELEMENT foo (bar)>\n");
|
||||||
docType.append("\t<!ELEMENT bar EMPTY>\n");
|
docType.append("\t<!ELEMENT bar EMPTY>\n");
|
||||||
|
@ -64,19 +64,19 @@ public class TestDocTypeReader {
|
||||||
docType.append("]>\n");
|
docType.append("]>\n");
|
||||||
_docType = docType.toString();
|
_docType = docType.toString();
|
||||||
|
|
||||||
StringBuffer expectedXML = new StringBuffer();
|
StringBuilder expectedXML = new StringBuilder();
|
||||||
String header = "<?xml version=\"1.0\"?>\n";
|
String header = "<?xml version=\"1.0\"?>\n";
|
||||||
String comment = "<!-- some < ... > <! funky -> - comment -->\n";
|
String comment = "<!-- some < ... > <! funky -> - comment -->\n";
|
||||||
expectedXML.append(header);
|
expectedXML.append(header);
|
||||||
expectedXML.append(comment);
|
expectedXML.append(comment);
|
||||||
expectedXML.append(docType.toString());
|
expectedXML.append(docType.toString());
|
||||||
|
|
||||||
StringBuffer xmlWithDocType = new StringBuffer();
|
StringBuilder xmlWithDocType = new StringBuilder();
|
||||||
xmlWithDocType.append(header);
|
xmlWithDocType.append(header);
|
||||||
xmlWithDocType.append(comment);
|
xmlWithDocType.append(comment);
|
||||||
xmlWithDocType.append(docType.toString());
|
xmlWithDocType.append(docType.toString());
|
||||||
|
|
||||||
StringBuffer validXML = new StringBuffer();
|
StringBuilder validXML = new StringBuilder();
|
||||||
validXML.append("<foo>\n");
|
validXML.append("<foo>\n");
|
||||||
validXML.append("\t<bar attr=\"newValue\"/>\n");
|
validXML.append("\t<bar attr=\"newValue\"/>\n");
|
||||||
validXML.append("</foo>");
|
validXML.append("</foo>");
|
||||||
|
@ -86,18 +86,18 @@ public class TestDocTypeReader {
|
||||||
_expectedXML = expectedXML.toString();
|
_expectedXML = expectedXML.toString();
|
||||||
_xmlWithDocType = xmlWithDocType.toString();
|
_xmlWithDocType = xmlWithDocType.toString();
|
||||||
|
|
||||||
StringBuffer invalidXML = new StringBuffer();
|
StringBuilder invalidXML = new StringBuilder();
|
||||||
invalidXML.append("<?xml version=\"1.0\"?>\n");
|
invalidXML.append("<?xml version=\"1.0\"?>\n");
|
||||||
invalidXML.append("<foo>\n");
|
invalidXML.append("<foo>\n");
|
||||||
invalidXML.append("\t<xxx />\n");
|
invalidXML.append("\t<xxx />\n");
|
||||||
invalidXML.append("</foo>");
|
invalidXML.append("</foo>");
|
||||||
_invalidXML = invalidXML.toString();
|
_invalidXML = invalidXML.toString();
|
||||||
|
|
||||||
StringBuffer expectedHTML = new StringBuffer();
|
StringBuilder expectedHTML = new StringBuilder();
|
||||||
header = " \n ";
|
header = " \n ";
|
||||||
expectedHTML.append(header);
|
expectedHTML.append(header);
|
||||||
expectedHTML.append(docType.toString());
|
expectedHTML.append(docType.toString());
|
||||||
StringBuffer validHTML = new StringBuffer();
|
StringBuilder validHTML = new StringBuilder();
|
||||||
validHTML.append("some junk <html><body></body></html> ");
|
validHTML.append("some junk <html><body></body></html> ");
|
||||||
expectedHTML.append(validHTML.toString());
|
expectedHTML.append(validHTML.toString());
|
||||||
_validHTML = header + validHTML.toString();
|
_validHTML = header + validHTML.toString();
|
||||||
|
|
|
@ -58,7 +58,7 @@ public class TestXMLWriter {
|
||||||
trans.transform(source, result);
|
trans.transform(source, result);
|
||||||
|
|
||||||
// read the correct output into a buffer
|
// read the correct output into a buffer
|
||||||
StringBuffer correct = new StringBuffer();
|
StringBuilder correct = new StringBuilder();
|
||||||
InputStreamReader reader = new InputStreamReader
|
InputStreamReader reader = new InputStreamReader
|
||||||
(getClass().getResourceAsStream("formatted-result.xml"));
|
(getClass().getResourceAsStream("formatted-result.xml"));
|
||||||
for (int c; (c = reader.read()) != -1; correct.append((char) c)) ;
|
for (int c; (c = reader.read()) != -1; correct.append((char) c)) ;
|
||||||
|
|
|
@ -1589,7 +1589,7 @@ public class AnnotationPersistenceMappingParser
|
||||||
*/
|
*/
|
||||||
private void parseEnumerated(FieldMapping fm, Enumerated anno) {
|
private void parseEnumerated(FieldMapping fm, Enumerated anno) {
|
||||||
String strat = EnumValueHandler.class.getName() + "(StoreOrdinal="
|
String strat = EnumValueHandler.class.getName() + "(StoreOrdinal="
|
||||||
+ String.valueOf(anno.value() == EnumType.ORDINAL) + ")";
|
+ (anno.value() == EnumType.ORDINAL) + ")";
|
||||||
if (fm.isElementCollection())
|
if (fm.isElementCollection())
|
||||||
fm.getElementMapping().getValueInfo().setStrategy(strat);
|
fm.getElementMapping().getValueInfo().setStrategy(strat);
|
||||||
else
|
else
|
||||||
|
@ -1601,7 +1601,7 @@ public class AnnotationPersistenceMappingParser
|
||||||
*/
|
*/
|
||||||
private void parseMapKeyEnumerated(FieldMapping fm, MapKeyEnumerated anno) {
|
private void parseMapKeyEnumerated(FieldMapping fm, MapKeyEnumerated anno) {
|
||||||
String strat = EnumValueHandler.class.getName() + "(StoreOrdinal="
|
String strat = EnumValueHandler.class.getName() + "(StoreOrdinal="
|
||||||
+ String.valueOf(anno.value() == EnumType.ORDINAL) + ")";
|
+ (anno.value() == EnumType.ORDINAL) + ")";
|
||||||
fm.getKeyMapping().getValueInfo().setStrategy(strat);
|
fm.getKeyMapping().getValueInfo().setStrategy(strat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,8 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.openjpa.persistence.jdbc;
|
package org.apache.openjpa.persistence.jdbc;
|
||||||
|
|
||||||
import static java.util.Collections.singleton;
|
|
||||||
|
|
||||||
import java.security.AccessController;
|
import java.security.AccessController;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
|
|
@ -665,7 +665,7 @@ public class XMLPersistenceMappingParser
|
||||||
|
|
||||||
FieldMapping fm = (FieldMapping) currentElement();
|
FieldMapping fm = (FieldMapping) currentElement();
|
||||||
String strat = EnumValueHandler.class.getName() + "(StoreOrdinal="
|
String strat = EnumValueHandler.class.getName() + "(StoreOrdinal="
|
||||||
+ String.valueOf(type == EnumType.ORDINAL) + ")";
|
+ (type == EnumType.ORDINAL) + ")";
|
||||||
if (fm.isElementCollection())
|
if (fm.isElementCollection())
|
||||||
fm.getElementMapping().getValueInfo().setStrategy(strat);
|
fm.getElementMapping().getValueInfo().setStrategy(strat);
|
||||||
else
|
else
|
||||||
|
@ -683,7 +683,7 @@ public class XMLPersistenceMappingParser
|
||||||
|
|
||||||
FieldMapping fm = (FieldMapping) currentElement();
|
FieldMapping fm = (FieldMapping) currentElement();
|
||||||
String strat = EnumValueHandler.class.getName() + "(StoreOrdinal="
|
String strat = EnumValueHandler.class.getName() + "(StoreOrdinal="
|
||||||
+ String.valueOf(type == EnumType.ORDINAL) + ")";
|
+ (type == EnumType.ORDINAL) + ")";
|
||||||
fm.getKeyMapping().getValueInfo().setStrategy(strat);
|
fm.getKeyMapping().getValueInfo().setStrategy(strat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -63,8 +63,8 @@ public class UnenhancedCompoundPKFieldAccess {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return String.valueOf(id0)
|
return id0
|
||||||
+ "::" + String.valueOf(id1);
|
+ "::" + id1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -63,8 +63,8 @@ public class UnenhancedCompoundPKFieldAccessSuperclass {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return String.valueOf(id0)
|
return id0
|
||||||
+ "::" + String.valueOf(id1);
|
+ "::" + id1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -98,8 +98,8 @@ public class UnenhancedCompoundPKPropertyAccess {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return String.valueOf(id0)
|
return id0
|
||||||
+ "::" + String.valueOf(id1);
|
+ "::" + id1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -49,7 +49,7 @@ public class TestJDBCStoreOptSelect extends SQLListenerTestCase {
|
||||||
try {
|
try {
|
||||||
sql.clear();
|
sql.clear();
|
||||||
|
|
||||||
if (store instanceof JDBCStoreManager == false) {
|
if (!(store instanceof JDBCStoreManager)) {
|
||||||
fail("StoreManager is not an 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
|
// Set this JDBCFetchPlan property so that we will select FKs for fields that are in the DFG, but not
|
||||||
|
|
|
@ -31,8 +31,6 @@ import org.apache.openjpa.conf.OpenJPAConfiguration;
|
||||||
import org.apache.openjpa.datacache.DataCachePCData;
|
import org.apache.openjpa.datacache.DataCachePCData;
|
||||||
import org.apache.openjpa.jdbc.sql.DB2Dictionary;
|
import org.apache.openjpa.jdbc.sql.DB2Dictionary;
|
||||||
import org.apache.openjpa.jdbc.sql.MySQLDictionary;
|
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.meta.ClassMetaData;
|
||||||
import org.apache.openjpa.persistence.JPAFacadeHelper;
|
import org.apache.openjpa.persistence.JPAFacadeHelper;
|
||||||
import org.apache.openjpa.persistence.OpenJPAEntityManager;
|
import org.apache.openjpa.persistence.OpenJPAEntityManager;
|
||||||
|
|
|
@ -171,7 +171,7 @@ public class TestDelimitIdentifiers {
|
||||||
|
|
||||||
public enum EnumType {
|
public enum EnumType {
|
||||||
Value1, Value2
|
Value1, Value2
|
||||||
};
|
}
|
||||||
|
|
||||||
// @Basic types
|
// @Basic types
|
||||||
private short shortField;
|
private short shortField;
|
||||||
|
|
|
@ -202,7 +202,6 @@ public class TestAggregateFunctions extends SingleEMFTestCase {
|
||||||
+ "(SELECT " + func + "("
|
+ "(SELECT " + func + "("
|
||||||
+ attr.replaceFirst("^ae.", "ae2.")
|
+ attr.replaceFirst("^ae.", "ae2.")
|
||||||
+ ") FROM AggEntity ae2)";
|
+ ") FROM AggEntity ae2)";
|
||||||
;
|
|
||||||
Query q = em.createQuery(sql);
|
Query q = em.createQuery(sql);
|
||||||
verifyQueryResult(q, expectNull, isString);
|
verifyQueryResult(q, expectNull, isString);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,5 +22,5 @@
|
||||||
package org.apache.openjpa.jira2780;
|
package org.apache.openjpa.jira2780;
|
||||||
|
|
||||||
public enum Jira2780Enum {
|
public enum Jira2780Enum {
|
||||||
A, B, C;
|
A, B, C
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,6 @@ import java.util.Date;
|
||||||
|
|
||||||
import javax.persistence.Access;
|
import javax.persistence.Access;
|
||||||
import javax.persistence.AccessType;
|
import javax.persistence.AccessType;
|
||||||
import javax.persistence.Column;
|
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.NamedQueries;
|
import javax.persistence.NamedQueries;
|
||||||
import javax.persistence.NamedQuery;
|
import javax.persistence.NamedQuery;
|
||||||
|
|
|
@ -42,7 +42,7 @@ public class TestEJBEmbedded extends AnnotationTestCase
|
||||||
private static final String CLOB;
|
private static final String CLOB;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuilder buf = new StringBuilder();
|
||||||
for (int i = 0; i < 1000; i++)
|
for (int i = 0; i < 1000; i++)
|
||||||
buf.append('a');
|
buf.append('a');
|
||||||
CLOB = buf.toString();
|
CLOB = buf.toString();
|
||||||
|
|
|
@ -121,7 +121,7 @@ public class TestSerializedLobs extends AnnotationTestCase
|
||||||
startTx(em);
|
startTx(em);
|
||||||
|
|
||||||
AnnoTest1 pc = new AnnoTest1(1);
|
AnnoTest1 pc = new AnnoTest1(1);
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuilder buf = new StringBuilder();
|
||||||
for (int i = 0; i < 1000; i++)
|
for (int i = 0; i < 1000; i++)
|
||||||
buf.append((char) ('a' + (i % 24)));
|
buf.append((char) ('a' + (i % 24)));
|
||||||
pc.setClob(buf.toString());
|
pc.setClob(buf.toString());
|
||||||
|
|
|
@ -132,7 +132,7 @@ public class CompUser {
|
||||||
|
|
||||||
public enum CreditRating {
|
public enum CreditRating {
|
||||||
POOR, GOOD, EXCELLENT
|
POOR, GOOD, EXCELLENT
|
||||||
};
|
}
|
||||||
|
|
||||||
public String[] getNicknames() {
|
public String[] getNicknames() {
|
||||||
return nicknames;
|
return nicknames;
|
||||||
|
|
|
@ -444,7 +444,7 @@ public abstract class AbstractTestCase extends AbstractCachedEMFTestCase {
|
||||||
* Support method to get a random String for testing.
|
* Support method to get a random String for testing.
|
||||||
*/
|
*/
|
||||||
public static String randomString(int len) {
|
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++)
|
for (int i = 0; i < (int) (Math.random() * len) + 1; i++)
|
||||||
buf.append(randomChar());
|
buf.append(randomChar());
|
||||||
return buf.toString();
|
return buf.toString();
|
||||||
|
@ -454,7 +454,7 @@ public abstract class AbstractTestCase extends AbstractCachedEMFTestCase {
|
||||||
* Support method to get a random clob for testing.
|
* Support method to get a random clob for testing.
|
||||||
*/
|
*/
|
||||||
public static String randomClob() {
|
public static String randomClob() {
|
||||||
StringBuffer sbuf = new StringBuffer();
|
StringBuilder sbuf = new StringBuilder();
|
||||||
while (sbuf.length() < (5 * 1024)) // at least 5K
|
while (sbuf.length() < (5 * 1024)) // at least 5K
|
||||||
{
|
{
|
||||||
sbuf.append(randomString(1024));
|
sbuf.append(randomString(1024));
|
||||||
|
@ -832,7 +832,7 @@ public abstract class AbstractTestCase extends AbstractCachedEMFTestCase {
|
||||||
// get to everyone starting at the same time, the
|
// get to everyone starting at the same time, the
|
||||||
// better chance we have for identifying MT problems.
|
// better chance we have for identifying MT problems.
|
||||||
while (System.currentTimeMillis() < startMillis)
|
while (System.currentTimeMillis() < startMillis)
|
||||||
yield();
|
Thread.yield();
|
||||||
|
|
||||||
int thisIteration = 1;
|
int thisIteration = 1;
|
||||||
try {
|
try {
|
||||||
|
@ -980,7 +980,7 @@ public abstract class AbstractTestCase extends AbstractCachedEMFTestCase {
|
||||||
// skip our own methods!
|
// skip our own methods!
|
||||||
if (shortMethodName.equals("callingMethod"))
|
if (shortMethodName.equals("callingMethod"))
|
||||||
continue;
|
continue;
|
||||||
if (exclude != null && shortMethodName.equals(exclude))
|
if (shortMethodName.equals(exclude))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
return shortMethodName;
|
return shortMethodName;
|
||||||
|
|
|
@ -888,7 +888,7 @@ public class TestContainerSpecCompatibilityOptions
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString(List<String> list) {
|
public String toString(List<String> list) {
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuilder buf = new StringBuilder();
|
||||||
for (String s : list)
|
for (String s : list)
|
||||||
buf.append(s).append("\r\n");
|
buf.append(s).append("\r\n");
|
||||||
return buf.toString();
|
return buf.toString();
|
||||||
|
|
|
@ -855,7 +855,7 @@ extends AbstractCachedEMFTestCase {
|
||||||
"buildSchema(ForeignKeys=true,SchemaAction='drop,add')");
|
"buildSchema(ForeignKeys=true,SchemaAction='drop,add')");
|
||||||
map.put("openjpa.Compatibility", "StrictIdentityValues=true");
|
map.put("openjpa.Compatibility", "StrictIdentityValues=true");
|
||||||
|
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuilder buf = new StringBuilder();
|
||||||
for (Class<?> c : types) {
|
for (Class<?> c : types) {
|
||||||
if (buf.length() > 0) {
|
if (buf.length() > 0) {
|
||||||
buf.append(";");
|
buf.append(";");
|
||||||
|
@ -880,7 +880,7 @@ extends AbstractCachedEMFTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString(List<String> list) {
|
public String toString(List<String> list) {
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuilder buf = new StringBuilder();
|
||||||
for (String s : list)
|
for (String s : list)
|
||||||
buf.append(s).append("\r\n");
|
buf.append(s).append("\r\n");
|
||||||
return buf.toString();
|
return buf.toString();
|
||||||
|
|
|
@ -88,7 +88,7 @@ public abstract class AbstractCriteriaTestCase extends TestCase {
|
||||||
map.put("openjpa.Compatibility", "QuotedNumbersInQueries=true");
|
map.put("openjpa.Compatibility", "QuotedNumbersInQueries=true");
|
||||||
map.put("openjpa.jdbc.JDBCListeners", new JDBCListener[] { getAuditor() });
|
map.put("openjpa.jdbc.JDBCListeners", new JDBCListener[] { getAuditor() });
|
||||||
|
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuilder buf = new StringBuilder();
|
||||||
for (Class<?> c : types) {
|
for (Class<?> c : types) {
|
||||||
if (buf.length() > 0)
|
if (buf.length() > 0)
|
||||||
buf.append(";");
|
buf.append(";");
|
||||||
|
|
|
@ -118,5 +118,5 @@ public class CompUser
|
||||||
this.creditRating = rating;
|
this.creditRating = rating;
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum CreditRating { POOR, GOOD, EXCELLENT };
|
public enum CreditRating { POOR, GOOD, EXCELLENT }
|
||||||
}
|
}
|
||||||
|
|
|
@ -155,5 +155,5 @@ public class Customer {
|
||||||
this.creditRating = rating;
|
this.creditRating = rating;
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum CreditRating { POOR, GOOD, EXCELLENT };
|
public enum CreditRating { POOR, GOOD, EXCELLENT }
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,9 +19,7 @@
|
||||||
package org.apache.openjpa.persistence.criteria;
|
package org.apache.openjpa.persistence.criteria;
|
||||||
|
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javax.persistence.Parameter;
|
|
||||||
import javax.persistence.Tuple;
|
import javax.persistence.Tuple;
|
||||||
import javax.persistence.TypedQuery;
|
import javax.persistence.TypedQuery;
|
||||||
import javax.persistence.criteria.*;
|
import javax.persistence.criteria.*;
|
||||||
|
|
|
@ -30,7 +30,7 @@ import org.apache.openjpa.persistence.test.SingleEMFTestCase;
|
||||||
public class TestClearableScheduler extends SingleEMFTestCase {
|
public class TestClearableScheduler extends SingleEMFTestCase {
|
||||||
|
|
||||||
private static String getMinutesString() {
|
private static String getMinutesString() {
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuilder buf = new StringBuilder();
|
||||||
for (int i = 0; i < 60; i++) {
|
for (int i = 0; i < 60; i++) {
|
||||||
if (i % 2 == 0)
|
if (i % 2 == 0)
|
||||||
buf.append(i).append(',');
|
buf.append(i).append(',');
|
||||||
|
|
|
@ -25,12 +25,10 @@ import java.sql.SQLException;
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
import javax.persistence.LockModeType;
|
import javax.persistence.LockModeType;
|
||||||
import javax.persistence.RollbackException;
|
import javax.persistence.RollbackException;
|
||||||
import javax.sql.DataSource;
|
|
||||||
|
|
||||||
import org.apache.openjpa.event.RemoteCommitEvent;
|
import org.apache.openjpa.event.RemoteCommitEvent;
|
||||||
import org.apache.openjpa.event.RemoteCommitListener;
|
import org.apache.openjpa.event.RemoteCommitListener;
|
||||||
import org.apache.openjpa.persistence.JPAFacadeHelper;
|
import org.apache.openjpa.persistence.JPAFacadeHelper;
|
||||||
import org.apache.openjpa.persistence.OpenJPAEntityManagerFactorySPI;
|
|
||||||
import org.apache.openjpa.persistence.OpenJPAPersistence;
|
import org.apache.openjpa.persistence.OpenJPAPersistence;
|
||||||
import org.apache.openjpa.persistence.test.SingleEMFTestCase;
|
import org.apache.openjpa.persistence.test.SingleEMFTestCase;
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ public class A implements java.io.Serializable {
|
||||||
int value;
|
int value;
|
||||||
|
|
||||||
@ElementCollection
|
@ElementCollection
|
||||||
protected Set<Embed> embeds = new HashSet();
|
protected Set<Embed> embeds = new HashSet<>();
|
||||||
|
|
||||||
@CollectionTable(name = "collectionTemporalOrderColumnTable",
|
@CollectionTable(name = "collectionTemporalOrderColumnTable",
|
||||||
joinColumns = @JoinColumn(name = "parent_id"))
|
joinColumns = @JoinColumn(name = "parent_id"))
|
||||||
|
|
|
@ -127,6 +127,6 @@ public class EntityA_Coll_String implements Serializable {
|
||||||
lobs.add(lob);
|
lobs.add(lob);
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum CreditRating { POOR, GOOD, EXCELLENT };
|
public enum CreditRating { POOR, GOOD, EXCELLENT }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -153,7 +153,7 @@ public class EntityA_Embed_Complex implements Serializable {
|
||||||
lobs.add(lob);
|
lobs.add(lob);
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum CreditRating { POOR, GOOD, EXCELLENT };
|
public enum CreditRating { POOR, GOOD, EXCELLENT }
|
||||||
|
|
||||||
public Embed_Embed getEmbed() {
|
public Embed_Embed getEmbed() {
|
||||||
return embed;
|
return embed;
|
||||||
|
|
|
@ -60,6 +60,6 @@ public class Item4 {
|
||||||
return images.get(cat);
|
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
Loading…
Reference in New Issue