PMD-问题

1:An instanceof check is being performed on the caught exception.  Create a separate catch clause for this exception type

 

catch (AxisFault e)
            {
                if (e instanceof RemoteException)
                {
                    connState = false;
                }

            }

 

修改成:

catch (AxisFault e)
            {
                if (e.getCause() instanceof RemoteException)
                {
                    connState = false;
                }

            }

 

但是注意:e.getCause() instanceof RemoteException 虽然可以通过PMD检查,但是功能失效,原因是e.getCause() instanceof RemoteException 为false。修改成:e.getCause() instanceof ConnectException。则可通过。

你可能感兴趣的:(问题)