Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSPWIKI-1156 - Remove 'protected' member in 'final' class #141

Merged
merged 1 commit into from
Oct 28, 2021
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
Expand Up @@ -365,7 +365,7 @@ private static final class WikiEventDelegate {
* Constructor for an WikiEventDelegateImpl, provided with the client Object it will service, or the Class
* of client, the latter when used to preload a future incoming delegate.
*/
protected WikiEventDelegate( final Object client ) {
WikiEventDelegate( final Object client ) {
if( client instanceof Class ) {
m_class = ( Class< ? > )client;
}
Expand All @@ -374,7 +374,7 @@ protected WikiEventDelegate( final Object client ) {
/**
* Returns the class of the client-less delegate, null if this delegate is attached to a client Object.
*/
protected Class< ? > getClientClass() {
Class< ? > getClientClass() {
return m_class;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Licensed to the Apache Software Foundation (ASF) under one

/**
* <p>Event class for security events: login/logout, wiki group adds/changes, and authorization decisions. When a WikiSecurityEvent
* is constructed, the security logger {@link #log} is notified.</p>
* is constructed, the security logger {@link #LOG} is notified.</p>
* <p>These events are logged with priority <code>ERROR</code>:</p>
* <ul>
* <li>login failed - bad credential or password</li>
Expand Down Expand Up @@ -112,7 +112,7 @@ public final class WikiSecurityEvent extends WikiEvent {
public static final int PROFILE_NAME_CHANGED = 54;

/** The security logging service. */
protected static final Logger log = LogManager.getLogger( "SecurityLog" );
private static final Logger LOG = LogManager.getLogger( "SecurityLog" );

private final Principal m_principal;

Expand All @@ -126,7 +126,7 @@ public final class WikiSecurityEvent extends WikiEvent {

/**
* Constructs a new instance of this event type, which signals a security event has occurred. The <code>source</code> parameter is
* required, and may not be <code>null</code>. When the WikiSecurityEvent is constructed, the security logger {@link #log} is notified.
* required, and may not be <code>null</code>. When the WikiSecurityEvent is constructed, the security logger {@link #LOG} is notified.
*
* @param src the source of the event, which can be any object: a wiki page, group or authentication/authentication/group manager.
* @param type the type of event
Expand All @@ -140,19 +140,19 @@ public WikiSecurityEvent( final Object src, final int type, final Principal prin
}
this.m_principal = principal;
this.m_target = target;
if( log.isEnabled( Level.ERROR ) && ArrayUtils.contains( ERROR_EVENTS, type ) ) {
log.error( this );
} else if( log.isEnabled( Level.WARN ) && ArrayUtils.contains( WARN_EVENTS, type ) ) {
log.warn( this );
} else if( log.isEnabled( Level.INFO ) && ArrayUtils.contains( INFO_EVENTS, type ) ) {
log.info( this );
if( LOG.isEnabled( Level.ERROR ) && ArrayUtils.contains( ERROR_EVENTS, type ) ) {
LOG.error( this );
} else if( LOG.isEnabled( Level.WARN ) && ArrayUtils.contains( WARN_EVENTS, type ) ) {
LOG.warn( this );
} else if( LOG.isEnabled( Level.INFO ) && ArrayUtils.contains( INFO_EVENTS, type ) ) {
LOG.info( this );
}
log.debug( this );
LOG.debug( this );
}

/**
* Constructs a new instance of this event type, which signals a security event has occurred. The <code>source</code> parameter
* is required, and may not be <code>null</code>. When the WikiSecurityEvent is constructed, the security logger {@link #log}
* is required, and may not be <code>null</code>. When the WikiSecurityEvent is constructed, the security logger {@link #LOG}
* is notified.
*
* @param src the source of the event, which can be any object: a wiki page, group or authentication/authentication/group manager.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -454,8 +454,8 @@ private ContentType getContentType( final String filename ) {
* Updater thread that updates Kendra indexes.
*/
private static final class KendraUpdater extends WikiBackgroundThread {
protected static final int INDEX_DELAY = 5;
protected static final int INITIAL_DELAY = 10;
static final int INDEX_DELAY = 5;
static final int INITIAL_DELAY = 10;
private final KendraSearchProvider provider;

private final int initialDelay;
Expand Down
6 changes: 3 additions & 3 deletions jspwiki-main/src/main/java/org/apache/wiki/WikiSession.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Licensed to the Apache Software Foundation (ASF) under one
* methods for managing WikiSessions for an entire wiki. These methods allow callers to find, query and remove WikiSession objects, and
* to obtain a list of the current wiki session users.</p>
*/
public final class WikiSession implements Session {
public class WikiSession implements Session {

private static final Logger log = LogManager.getLogger( WikiSession.class );

Expand Down Expand Up @@ -388,7 +388,7 @@ public void invalidate() {
* This method should generally be called after a user's {@link org.apache.wiki.auth.user.UserProfile} is saved. If the wiki session
* is null, or there is no matching user profile, the method returns silently.
*/
protected void injectGroupPrincipals() {
void injectGroupPrincipals() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

protected should also be retained here.

// Flush the existing GroupPrincipals
m_subject.getPrincipals().removeAll( m_subject.getPrincipals(GroupPrincipal.class) );

Expand All @@ -406,7 +406,7 @@ protected void injectGroupPrincipals() {
* and login name. These Principals will be WikiPrincipals, and they will replace all other WikiPrincipals in the Subject. <em>Note:
* this method is never called during anonymous or asserted sessions.</em>
*/
protected void injectUserProfilePrincipals() {
void injectUserProfilePrincipals() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

protected should also be retained here.

// Search for the user profile
final String searchId = m_loginPrincipal.getName();
if ( searchId == null ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ public Principal[] webContainerRoles() throws WikiException {
* container <code>web.xml</code> file.
* @throws WikiException if the web authorizer cannot verify the roles
*/
protected void verifyPolicyAndContainerRoles() throws WikiException
void verifyPolicyAndContainerRoles() throws WikiException
{
final Authorizer authorizer = m_engine.getManager( AuthorizationManager.class ).getAuthorizer();
final Principal[] containerRoles = authorizer.getRoles();
Expand Down Expand Up @@ -469,7 +469,7 @@ protected void verifyPolicyAndContainerRoles() throws WikiException
* Verifies that the group datbase was initialized properly, and that
* user add and delete operations work as they should.
*/
protected void verifyGroupDatabase()
void verifyGroupDatabase()
{
final GroupManager mgr = m_engine.getManager( GroupManager.class );
GroupDatabase db = null;
Expand Down Expand Up @@ -549,7 +549,7 @@ protected void verifyGroupDatabase()
* {@value org.apache.wiki.auth.AuthenticationManager#PROP_LOGIN_MODULE}
* resolves to a valid class on the classpath.
*/
protected void verifyJaas() {
void verifyJaas() {
// Verify that the specified JAAS moduie corresponds to a class we can load successfully.
final String jaasClass = m_engine.getWikiProperties().getProperty( AuthenticationManager.PROP_LOGIN_MODULE );
if( jaasClass == null || jaasClass.isEmpty() ) {
Expand Down Expand Up @@ -585,7 +585,7 @@ protected void verifyJaas() {
* @param property the system property to look up
* @return the file object, or <code>null</code> if not found
*/
protected File getFileFromProperty( final String property )
File getFileFromProperty( final String property )
{
String propertyValue = null;
try
Expand Down Expand Up @@ -647,7 +647,7 @@ protected File getFileFromProperty( final String property )
* represents a valid policy.
*/
@SuppressWarnings("unchecked")
protected void verifyPolicy() {
void verifyPolicy() {
// Look up the policy file and set the status text.
final URL policyURL = m_engine.findConfigFile( AuthorizationManager.DEFAULT_POLICY );
String path = policyURL.getPath();
Expand Down Expand Up @@ -710,7 +710,7 @@ protected void verifyPolicy() {
* @return the result, based on consultation with the active Java security
* policy
*/
protected boolean verifyStaticPermission( final Principal principal, final Permission permission )
boolean verifyStaticPermission( final Principal principal, final Permission permission )
{
final Subject subject = new Subject();
subject.getPrincipals().add( principal );
Expand Down Expand Up @@ -738,7 +738,7 @@ protected boolean verifyStaticPermission( final Principal principal, final Permi
* Verifies that the user datbase was initialized properly, and that
* user add and delete operations work as they should.
*/
protected void verifyUserDatabase()
void verifyUserDatabase()
{
final UserDatabase db = m_engine.getManager( UserManager.class ).getUserDatabase();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public final class WikiPrincipal implements Principal, Comparable< Principal >,
private final String m_type;

/** For serialization purposes */
protected WikiPrincipal()
WikiPrincipal()
{
this(null);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public final class Role implements Principal, Serializable
/**
* Create an empty Role.
*/
protected Role()
Role()
{
this(null);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public final class AllPermission extends Permission implements Serializable {
private final String m_wiki;

/** For serialization purposes. */
protected AllPermission() {
AllPermission() {
this( null );
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,11 @@ public final class GroupPermission extends Permission implements Serializable
/** Action for viewing a group or collection of groups. */
public static final String VIEW_ACTION = "view";

protected static final int DELETE_MASK = 0x4;
static final int DELETE_MASK = 0x4;

protected static final int EDIT_MASK = 0x2;
static final int EDIT_MASK = 0x2;

protected static final int VIEW_MASK = 0x1;
static final int VIEW_MASK = 0x1;

/** Convenience constant that denotes <code>GroupPermission( "*:*, "delete" )</code>. */
public static final GroupPermission DELETE = new GroupPermission( DELETE_ACTION );
Expand All @@ -124,7 +124,7 @@ public final class GroupPermission extends Permission implements Serializable
private final String m_wiki;

/** For serialization purposes */
protected GroupPermission()
GroupPermission()
{
this("");
}
Expand Down Expand Up @@ -327,7 +327,7 @@ public String toString()
* @param mask binary mask for actions
* @return binary mask for implied actions
*/
protected static int impliedMask( int mask )
static int impliedMask( int mask )
{
if ( ( mask & DELETE_MASK ) > 0 )
{
Expand All @@ -346,7 +346,7 @@ protected static int impliedMask( int mask )
* @param actions the actions for this permission, separated by commas
* @return the binary actions mask
*/
protected static int createMask( final String actions )
static int createMask( final String actions )
{
if ( actions == null || actions.isEmpty() )
{
Expand Down Expand Up @@ -464,7 +464,7 @@ else if ( action.equalsIgnoreCase( DELETE_ACTION ) )
* GroupPrincipal matching the implied GroupPermission&#8217;s group;
* <code>false</code> otherwise
*/
protected boolean impliesMember(final Permission permission )
boolean impliesMember(final Permission permission )
{
if ( !( permission instanceof GroupPermission ) )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,19 +87,19 @@ public final class PagePermission extends Permission implements Serializable
/** Action name for the view permission. */
public static final String VIEW_ACTION = "view";

protected static final int COMMENT_MASK = 0x4;
static final int COMMENT_MASK = 0x4;

protected static final int DELETE_MASK = 0x10;
static final int DELETE_MASK = 0x10;

protected static final int EDIT_MASK = 0x2;
static final int EDIT_MASK = 0x2;

protected static final int MODIFY_MASK = 0x40;
static final int MODIFY_MASK = 0x40;

protected static final int RENAME_MASK = 0x20;
static final int RENAME_MASK = 0x20;

protected static final int UPLOAD_MASK = 0x8;
static final int UPLOAD_MASK = 0x8;

protected static final int VIEW_MASK = 0x1;
static final int VIEW_MASK = 0x1;

/** A static instance of the comment permission. */
public static final PagePermission COMMENT = new PagePermission( COMMENT_ACTION );
Expand Down Expand Up @@ -139,7 +139,7 @@ public final class PagePermission extends Permission implements Serializable
private final String m_wiki;

/** For serialization purposes. */
protected PagePermission()
PagePermission()
{
this("");
}
Expand Down Expand Up @@ -351,7 +351,7 @@ public String toString()
* @param mask binary mask for actions
* @return binary mask for implied actions
*/
protected static int impliedMask( int mask )
static int impliedMask( int mask )
{
if ( ( mask & DELETE_MASK ) > 0 )
{
Expand Down Expand Up @@ -387,7 +387,7 @@ protected static int impliedMask( int mask )
* @return the results of the test, where <code>true</code> indicates that
* <code>subSet</code> is a subset of <code>superSet</code>
*/
protected static boolean isSubset( final String superSet, final String subSet )
static boolean isSubset( final String superSet, final String subSet )
{
// If either is null, return false
if ( superSet == null || subSet == null )
Expand Down Expand Up @@ -430,7 +430,7 @@ protected static boolean isSubset( final String superSet, final String subSet )
* @param actions the actions for this permission, separated by commas
* @return the binary actions mask
*/
protected static int createMask( final String actions )
static int createMask( final String actions )
{
if ( actions == null || actions.isEmpty() )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ public final class WikiPermission extends Permission implements Serializable
/** Value for a generic wildcard. */
public static final String WILDCARD = "*";

protected static final int CREATE_GROUPS_MASK = 0x1;
static final int CREATE_GROUPS_MASK = 0x1;

protected static final int CREATE_PAGES_MASK = 0x2;
static final int CREATE_PAGES_MASK = 0x2;

protected static final int EDIT_PREFERENCES_MASK = 0x4;
static final int EDIT_PREFERENCES_MASK = 0x4;

protected static final int EDIT_PROFILE_MASK = 0x8;
static final int EDIT_PROFILE_MASK = 0x8;

protected static final int LOGIN_MASK = 0x10;
static final int LOGIN_MASK = 0x10;

/** A static instance of the createGroups permission. */
public static final WikiPermission CREATE_GROUPS = new WikiPermission( WILDCARD, CREATE_GROUPS_ACTION );
Expand Down Expand Up @@ -215,7 +215,7 @@ public String toString()
* @param mask the initial mask
* @return the implied mask
*/
protected static int impliedMask( int mask )
static int impliedMask( int mask )
{
if ( ( mask & CREATE_GROUPS_MASK ) > 0 )
{
Expand All @@ -230,7 +230,7 @@ protected static int impliedMask( int mask )
* @param actions the permission actions, separated by commas
* @return binary mask representing the permissions
*/
protected static int createMask(final String actions )
static int createMask(final String actions )
{
if ( actions == null || actions.isEmpty() )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ private PageFilterInfo( final String name ) {
super( name );
}

protected static PageFilterInfo newInstance( final String className, final Element pluginEl ) {
static PageFilterInfo newInstance( final String className, final Element pluginEl ) {
if( className == null || className.isEmpty() ) {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ public static final class WikiPluginInfo extends WikiModuleInfo {
* @param externalJars the list of external jars to search
* @return A WikiPluginInfo object.
*/
protected static WikiPluginInfo newInstance( final String className, final Element el, final List<String> searchPath, final List<String> externalJars ) {
static WikiPluginInfo newInstance( final String className, final Element el, final List<String> searchPath, final List<String> externalJars ) {
if( className == null || className.isEmpty() ) {
return null;
}
Expand All @@ -494,7 +494,7 @@ protected static WikiPluginInfo newInstance( final String className, final Eleme
* @param searchPath A List of Strings, containing different package names.
* @param externalJars the list of external jars to search
*/
protected void initializePlugin( final WikiPluginInfo info, final Engine engine , final List<String> searchPath, final List<String> externalJars) {
void initializePlugin( final WikiPluginInfo info, final Engine engine , final List<String> searchPath, final List<String> externalJars) {
if( !m_initialized ) {
// This makes sure we only try once per class, even if init fails.
m_initialized = true;
Expand Down Expand Up @@ -533,7 +533,7 @@ protected void initializeFromXML( final Element el ) {
* @param clazz The class to check
* @return A WikiPluginInfo instance
*/
protected static WikiPluginInfo newInstance( final Class< ? > clazz ) {
static WikiPluginInfo newInstance( final Class< ? > clazz ) {
return new WikiPluginInfo( clazz.getName() );
}

Expand Down
Loading