Skip to content

Commit

Permalink
Fix PMD:AvoidUncheckedExceptionsInSignatures (bridge-jms)
Browse files Browse the repository at this point in the history
  • Loading branch information
pzygielo committed Jul 11, 2022
1 parent edccf80 commit 481752d
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 18 deletions.
Expand Up @@ -86,7 +86,7 @@ public TransactionImpl(GlobalXid xid, TransactionManagerImpl tm) throws SystemEx
*/
@Override
public void commit()
throws RollbackException, HeuristicMixedException, HeuristicRollbackException, SecurityException, IllegalStateException, SystemException {
throws RollbackException, HeuristicMixedException, HeuristicRollbackException, SystemException {

if (_logger.isLoggable(Level.FINE)) {
_logger.log(Level.FINE, _tm + " commit " + this);
Expand Down Expand Up @@ -268,7 +268,7 @@ public void commit()
*
*/
@Override
public boolean delistResource(XAResource xaRes, int flag) throws IllegalStateException, SystemException {
public boolean delistResource(XAResource xaRes, int flag) throws SystemException {

if (_logger.isLoggable(Level.FINE)) {
_logger.log(Level.FINE, _tm + " dellistResource " + xaRes + " from " + this);
Expand Down Expand Up @@ -324,7 +324,7 @@ public boolean delistResource(XAResource xaRes, int flag) throws IllegalStateExc
*
*/
@Override
public boolean enlistResource(XAResource xaRes) throws RollbackException, IllegalStateException, SystemException {
public boolean enlistResource(XAResource xaRes) throws RollbackException, SystemException {

if (_logger.isLoggable(Level.FINE)) {
_logger.log(Level.FINE, _tm + " enlistResource " + xaRes + " to " + this);
Expand Down Expand Up @@ -423,7 +423,7 @@ public int getStatus() throws SystemException {
*
*/
@Override
public void registerSynchronization(Synchronization sync) throws RollbackException, IllegalStateException, SystemException {
public void registerSynchronization(Synchronization sync) throws RollbackException, SystemException {
throw new SystemException("operation not supported");
}

Expand All @@ -437,7 +437,7 @@ public void registerSynchronization(Synchronization sync) throws RollbackExcepti
*
*/
@Override
public void rollback() throws IllegalStateException, SystemException {
public void rollback() throws SystemException {
if (_logger.isLoggable(Level.FINE)) {
_logger.log(Level.FINE, _tm + " rollback " + this);
}
Expand Down Expand Up @@ -541,7 +541,7 @@ public void rollback() throws IllegalStateException, SystemException {
*
*/
@Override
public void setRollbackOnly() throws IllegalStateException, SystemException {
public void setRollbackOnly() throws SystemException {
_status = Status.STATUS_MARKED_ROLLBACK;
}

Expand Down
Expand Up @@ -86,8 +86,10 @@ private enum TMState {

/**
* to be called before init() if JDBC store
*
* @throws IllegalStateException
*/
public void setJDBCStore(JMSBridgeStore store) throws IllegalStateException {
public void setJDBCStore(JMSBridgeStore store) {

if (_state != TMState.UNINITIALIZED) {
throw new IllegalStateException("setJDBCStore");
Expand Down Expand Up @@ -600,7 +602,7 @@ public void begin() throws NotSupportedException, SystemException {
*/
@Override
public void commit()
throws RollbackException, HeuristicMixedException, HeuristicRollbackException, SecurityException, IllegalStateException, SystemException {
throws RollbackException, HeuristicMixedException, HeuristicRollbackException, SystemException {

TransactionImpl tx = _threadLocal.get();
if (tx == null) {
Expand Down Expand Up @@ -664,7 +666,7 @@ public Transaction getTransaction() throws SystemException {
* @exception SystemException Thrown if the transaction manager encounters an unexpected error condition.
*/
@Override
public void resume(Transaction tobj) throws InvalidTransactionException, IllegalStateException, SystemException {
public void resume(Transaction tobj) throws InvalidTransactionException, SystemException {
throw new SystemException("operation not supported");

}
Expand All @@ -681,7 +683,7 @@ public void resume(Transaction tobj) throws InvalidTransactionException, Illegal
*
*/
@Override
public void rollback() throws IllegalStateException, SecurityException, SystemException {
public void rollback() throws SystemException {
TransactionImpl tx = _threadLocal.get();
if (tx == null) {
throw new IllegalStateException("No transaction associate with the calling thread " + Thread.currentThread());
Expand All @@ -703,7 +705,7 @@ public void rollback() throws IllegalStateException, SecurityException, SystemEx
*
*/
@Override
public void setRollbackOnly() throws IllegalStateException, SystemException {
public void setRollbackOnly() throws SystemException {
TransactionImpl tx = _threadLocal.get();
if (tx == null) {
throw new IllegalStateException("No transaction associate with the calling thread " + Thread.currentThread());
Expand Down
Expand Up @@ -139,7 +139,8 @@ public void start(int flags) throws RollbackException, SystemException {
}
}

public void end(int flags) throws IllegalStateException, RollbackException, SystemException {
/** @throws IllegalStateException */
public void end(int flags) throws RollbackException, SystemException {

if (_state != XAState.STARTED && _state != XAState.START_FAILED && _state != XAState.END_FAILED) {
_logger.log(Level.SEVERE, "end called at an illegal state " + this);
Expand Down Expand Up @@ -206,7 +207,8 @@ public void end(int flags) throws IllegalStateException, RollbackException, Syst
}
}

public void rollback() throws IllegalStateException, SystemException, HeuristicCommitException, HeuristicRollbackException, HeuristicMixedException {
/** @throws IllegalStateException */
public void rollback() throws SystemException, HeuristicCommitException, HeuristicRollbackException, HeuristicMixedException {
if (!_recovery && _state != XAState.ENDED && _state != XAState.END_FAILED && _state != XAState.PREPARED && _state != XAState.PREPARE_FAILED
&& _state != XAState.ROLLEDBACK && _state != XAState.ROLLBACK_FAILED) {
_logger.log(Level.SEVERE, "rollback called at an illegal state " + this);
Expand Down Expand Up @@ -298,7 +300,8 @@ public void rollback() throws IllegalStateException, SystemException, HeuristicC
}
}

public void prepare() throws IllegalStateException, RollbackException, SystemException {
/** @throws IllegalStateException */
public void prepare() throws RollbackException, SystemException {
if (_state != XAState.ENDED) {
throw new IllegalStateException(toString());
}
Expand Down Expand Up @@ -365,8 +368,9 @@ public void prepare() throws IllegalStateException, RollbackException, SystemExc
}
}

/** @throws IllegalStateException */
public void commit(boolean onePhase)
throws IllegalStateException, RollbackException, HeuristicCommitException, HeuristicMixedException, HeuristicRollbackException, SystemException {
throws RollbackException, HeuristicCommitException, HeuristicMixedException, HeuristicRollbackException, SystemException {
if (onePhase) {
if (_state != XAState.ENDED) {
throw new IllegalStateException(toString());
Expand Down
Expand Up @@ -43,7 +43,8 @@ public class JDBCTxLogImpl extends TxLog {

private static JMSBridgeResources _jbr = JMSBridge.getJMSBridgeResources();

public void setJDBCStore(JMSBridgeStore store) throws IllegalArgumentException {
/** @throws IllegalArgumentException */
public void setJDBCStore(JMSBridgeStore store) {
if (store == null) {
throw new IllegalArgumentException("null JDBC store");
}
Expand Down
Expand Up @@ -31,7 +31,8 @@ public class DestinationElement {
private Properties _props = null;
private String _type = null;

public void setAttributes(Properties a) throws IllegalArgumentException {
/** @throws IllegalArgumentException */
public void setAttributes(Properties a) {
if (a != null) {
String refname = a.getProperty(JMSBridgeXMLConstant.Common.REFNAME);
if (refname.equals(DMQElement.BUILTIN_DMQ_DESTNAME) || refname.equals(DMQElement.BUILTIN_DMQ_NAME)
Expand Down
Expand Up @@ -145,7 +145,8 @@ public enum Element {

private static List<String> _reservedNames = Arrays.asList(DMQElement.BUILTIN_DMQ_NAME, DMQElement.BUILTIN_DMQ_DESTNAME, Target.DESTINATIONREF_AS_SOURCE);

public static void checkReserved(String name) throws IllegalArgumentException {
/** @throws IllegalArgumentException */
public static void checkReserved(String name) {
if (name == null) {
return;
}
Expand Down

0 comments on commit 481752d

Please sign in to comment.