Skip to content

Commit

Permalink
Remove unnecessary casts
Browse files Browse the repository at this point in the history
  • Loading branch information
markt-asf committed Dec 15, 2024
1 parent 0a25ad7 commit 27fd358
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion java/org/apache/catalina/startup/HostConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -1691,7 +1691,7 @@ protected void check() {
*/
public void check(String name) {
synchronized (host) {
if (!((Lifecycle) host).getState().isAvailable()) {
if (!host.getState().isAvailable()) {
return;
}
if (tryAddServiced(name)) {
Expand Down
2 changes: 1 addition & 1 deletion java/org/apache/tomcat/util/net/Nio2Endpoint.java
Original file line number Diff line number Diff line change
Expand Up @@ -1699,7 +1699,7 @@ protected void doRun() {
} catch (Throwable t) {
log.error(sm.getString("endpoint.processing.fail"), t);
if (socketWrapper != null) {
((Nio2SocketWrapper) socketWrapper).close();
socketWrapper.close();
}
} finally {
if (launch) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@

import org.junit.Test;

import org.apache.tomcat.jdbc.pool.DataSourceProxy;

public class Async0IdleTestBug50477 extends DefaultTestCase {

@Test
Expand All @@ -33,7 +31,7 @@ public void testAsync0Idle0Size() throws Exception {
this.datasource.getPoolProperties().setFairQueue(true);
this.datasource.getPoolProperties().setInitialSize(0);
try {
Future<Connection> cf = ((DataSourceProxy)datasource).getConnectionAsync();
Future<Connection> cf = datasource.getConnectionAsync();
cf.get(5, TimeUnit.SECONDS);
}finally {
tearDown();
Expand Down
10 changes: 5 additions & 5 deletions test/org/apache/catalina/valves/TestRequestFilterValve.java
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ private void oneTest(String allow, String deny, boolean denyStatus, boolean addC
if (usePeerAddress) {
request.setRemoteAddr(ADDR_OTHER);
request.getCoyoteRequest().peerAddr().setString(property);
((RemoteAddrValve) valve).setUsePeerAddress(true);
valve.setUsePeerAddress(true);
msg.append(" peer='" + property + "'");
} else {
request.setRemoteAddr(property);
Expand All @@ -141,7 +141,7 @@ private void oneTest(String allow, String deny, boolean denyStatus, boolean addC
if (usePeerAddress) {
request.setRemoteAddr(ADDR_OTHER);
request.getCoyoteRequest().peerAddr().setString(property);
((RemoteCIDRValve) valve).setUsePeerAddress(true);
valve.setUsePeerAddress(true);
msg.append(" peer='" + property + "'");
} else {
request.setRemoteAddr(property);
Expand Down Expand Up @@ -170,11 +170,11 @@ private void oneTest(String allow, String deny, boolean denyStatus, boolean addC
}
if (addConnectorPort) {
if (valve instanceof RemoteAddrValve) {
((RemoteAddrValve) valve).setAddConnectorPort(true);
valve.setAddConnectorPort(true);
} else if (valve instanceof RemoteHostValve) {
((RemoteHostValve) valve).setAddConnectorPort(true);
valve.setAddConnectorPort(true);
} else if (valve instanceof RemoteCIDRValve) {
((RemoteCIDRValve) valve).setAddConnectorPort(true);
valve.setAddConnectorPort(true);
} else {
Assert.fail("Can only set 'addConnectorPort' for RemoteAddrValve, RemoteHostValve and RemoteCIDRValve");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public void doFilter (ServletRequest request, ServletResponse response, FilterCh
}

// Are we allowed to compress ?
String s = ((HttpServletRequest)request).getParameter("gzip");
String s = request.getParameter("gzip");
if ("false".equals(s)) {
if (debug > 0) {
System.out.println("got parameter gzip=false --> don't compress, just chain filter");
Expand Down

0 comments on commit 27fd358

Please sign in to comment.