Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2004-2022 the original author or authors.
* Copyright 2004-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -138,7 +138,7 @@ protected long compare(SqlTagContext ctx, SqlTag tag, Object parameterObject) {
* @return the long
*/
protected long compareValues(Class type, Object value1, Object value2) {
long result = NOT_COMPARABLE;
long result;

if (value1 == null || value2 == null) {
result = value1 == value2 ? 0 : NOT_COMPARABLE;
Expand Down Expand Up @@ -224,10 +224,8 @@ protected String getResolvedProperty(SqlTagContext ctx, SqlTag tag) {
}
}

if (prop.indexOf(START_INDEX) > -1) {
if (itCtx != null) {
prop = itCtx.addIndexToTagProperty(prop);
}
if (prop.indexOf(START_INDEX) > -1 && itCtx != null) {
prop = itCtx.addIndexToTagProperty(prop);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2004-2022 the original author or authors.
* Copyright 2004-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -23,7 +23,7 @@ public class DynamicTagHandler extends BaseTagHandler {
@Override
public int doStartFragment(SqlTagContext ctx, SqlTag tag, Object parameterObject) {
ctx.pushRemoveFirstPrependMarker(tag);
return BaseTagHandler.INCLUDE_BODY;
return SqlTagHandler.INCLUDE_BODY;
}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2004-2022 the original author or authors.
* Copyright 2004-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -42,7 +42,7 @@ public boolean isCondition(SqlTagContext ctx, SqlTag tag, Object parameterObject
value = parameterObject;
}
if (value instanceof Collection) {
return value == null || ((Collection) value).size() < 1;
return ((Collection) value).isEmpty();
} else if (value != null && value.getClass().isArray()) {
return Array.getLength(value) == 0;
} else {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2004-2022 the original author or authors.
* Copyright 2004-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -63,7 +63,7 @@ public int doStartFragment(SqlTagContext ctx, SqlTag tag, Object parameterObject
ctx.reEnableRemoveFirstPrependMarker();
}

if (iterate != null && iterate.hasNext()) {
if (iterate.hasNext()) {
return INCLUDE_BODY;
} else {
return SKIP_BODY;
Expand All @@ -80,7 +80,7 @@ public int doEndFragment(SqlTagContext ctx, SqlTag tag, Object parameterObject,
iterate.next();
}

if (bodyContent.toString().trim().length() > 0) {
if (!bodyContent.toString().trim().isEmpty()) {
// the sub element produced a result. If it is the first one
// to produce a result, then we need to add the open
// text. If it is not the first to produce a result then
Expand All @@ -102,10 +102,8 @@ public int doEndFragment(SqlTagContext ctx, SqlTag tag, Object parameterObject,
iterate.setSomeSubElementsHaveContent(true);
}

if (iterate.isLast() && iterate.someSubElementsHaveContent()) {
if (tag.isCloseAvailable()) {
bodyContent.append(tag.getCloseAttr());
}
if (iterate.isLast() && iterate.someSubElementsHaveContent() && tag.isCloseAvailable()) {
bodyContent.append(tag.getCloseAttr());
}

iterate.setAllowNext(true);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2004-2022 the original author or authors.
* Copyright 2004-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -66,7 +66,6 @@ public void begin(SessionScope sessionScope) throws SQLException, TransactionExc
* the transaction exception
*/
public void begin(SessionScope sessionScope, int transactionIsolation) throws SQLException, TransactionException {
Transaction trans = sessionScope.getTransaction();
TransactionState state = sessionScope.getTransactionState();
if (state == TransactionState.STATE_STARTED) {
throw new TransactionException(
Expand All @@ -77,7 +76,7 @@ public void begin(SessionScope sessionScope, int transactionIsolation) throws SQ
+ "The calling .setUserConnection (null) will clear the user provided transaction.");
}

trans = config.newTransaction(transactionIsolation);
Transaction trans = config.newTransaction(transactionIsolation);
sessionScope.setCommitRequired(false);

sessionScope.setTransaction(trans);
Expand Down Expand Up @@ -138,11 +137,10 @@ public void end(SessionScope sessionScope) throws SQLException, TransactionExcep
try {
if (trans != null) {
try {
if (state != TransactionState.STATE_COMMITTED) {
if (sessionScope.isCommitRequired() || config.isForceCommit()) {
trans.rollback();
sessionScope.setCommitRequired(false);
}
if (state != TransactionState.STATE_COMMITTED
&& (sessionScope.isCommitRequired() || config.isForceCommit())) {
trans.rollback();
sessionScope.setCommitRequired(false);
}
} finally {
sessionScope.closePreparedStatements();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2004-2024 the original author or authors.
* Copyright 2004-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -137,19 +137,17 @@ public void commit() throws SQLException, TransactionException {
}

public void rollback() throws SQLException, TransactionException {
if (connection != null) {
if (!commmitted) {
try {
if (userTransaction != null) {
if (newTransaction) {
userTransaction.rollback();
} else {
userTransaction.setRollbackOnly();
}
if (connection != null && !commmitted) {
try {
if (userTransaction != null) {
if (newTransaction) {
userTransaction.rollback();
} else {
userTransaction.setRollbackOnly();
}
} catch (Exception e) {
throw new TransactionException("JtaTransaction could not rollback. Cause: ", e);
}
} catch (Exception e) {
throw new TransactionException("JtaTransaction could not rollback. Cause: ", e);
}
}
}
Expand Down
Loading