You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Christopher Schultz <ch...@christopherschultz.net> on 2025/03/21 14:11:29 UTC

Sharing code across packages

All,

I'm looking at adding file-based allow/deny for the 
RemoteCIDR(Filter|Valve) and I can see that there is a bunch of 
duplicate code between the two classes.

Is there any reason not to re-use methods such as 
RemoteCIDR(Filter|Valve).fillFromInput between the two classes?

They are in different packages, so maybe that's the reason?

-chris


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: Sharing code across packages

Posted by Mark Thomas <ma...@apache.org>.
On 21/03/2025 14:11, Christopher Schultz wrote:
> All,
> 
> I'm looking at adding file-based allow/deny for the RemoteCIDR(Filter| 
> Valve) and I can see that there is a bunch of duplicate code between the 
> two classes.
> 
> Is there any reason not to re-use methods such as RemoteCIDR(Filter| 
> Valve).fillFromInput between the two classes?
> 
> They are in different packages, so maybe that's the reason?

Possibly. Moving the common code to o.a.catalina.util might be an 
option. Or o.a.tomcat.util if the options for re-use extend beyond the 
o.a.catalina package.

Mark


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org