Skip to content

Commit

Permalink
javadoc fixes. Removed stack trace instances that were printed to con…
Browse files Browse the repository at this point in the history
…sole as well as syserr messages.
  • Loading branch information
SavvasMisaghMoayyed committed May 17, 2013
1 parent a7bfb66 commit 1e0ab4c
Show file tree
Hide file tree
Showing 23 changed files with 199 additions and 148 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
*/
package org.jasig.cas.services.web;


import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
Expand Down Expand Up @@ -148,12 +147,10 @@ protected Object formBackingObject(final HttpServletRequest request)

/**
* {@inheritDoc}
* Returns the attributes, page title, and command name.
*
* @see org.springframework.web.servlet.mvc.SimpleFormController#referenceData(javax.servlet.http.HttpServletRequest)
*/
@Override
protected Map referenceData(final HttpServletRequest request) throws Exception {
protected Map<?, ?> referenceData(final HttpServletRequest request) throws Exception {

final Map<String, Object> model = new HashMap<String, Object>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,8 @@
import static org.junit.Assert.*;

/**
*
* @author Scott Battaglia
* @since 3.1
*
*/
public class ManageRegisteredServicesMultiActionControllerTests {

Expand Down Expand Up @@ -68,7 +66,8 @@ public void testDeleteService() {
final MockHttpServletRequest request = new MockHttpServletRequest();
request.setParameter("id", "1200");

final ModelAndView modelAndView = this.controller.deleteRegisteredService(request, new MockHttpServletResponse());
final ModelAndView modelAndView = this.controller.deleteRegisteredService(request,
new MockHttpServletResponse());

assertNotNull(modelAndView);
assertNull(this.servicesManager.findServiceBy(1200));
Expand All @@ -80,7 +79,8 @@ public void testDeleteServiceNoService() {
final MockHttpServletRequest request = new MockHttpServletRequest();
request.setParameter("id", "1200");

final ModelAndView modelAndView = this.controller.deleteRegisteredService(request, new MockHttpServletResponse());
final ModelAndView modelAndView = this.controller.deleteRegisteredService(request,
new MockHttpServletResponse());

assertNotNull(modelAndView);
assertNull(this.servicesManager.findServiceBy(1200));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@

/**
* @author Scott Battaglia
* @since 3.3.5
*/
public abstract class AbstractAuthenticationManager implements AuthenticationManager {
Expand All @@ -48,11 +47,15 @@ public abstract class AbstractAuthenticationManager implements AuthenticationMan
private List<AuthenticationMetaDataPopulator> authenticationMetaDataPopulators =
new ArrayList<AuthenticationMetaDataPopulator>();

/**
* {@inheritDoc}
*/
@Audit(
action="AUTHENTICATION",
actionResolverName="AUTHENTICATION_RESOLVER",
resourceResolverName="AUTHENTICATION_RESOURCE_RESOLVER")
@Profiled(tag = "AUTHENTICATE", logFailuresSeparately = false)
@Override
public final Authentication authenticate(final Credentials credentials) throws AuthenticationException {

final Pair<AuthenticationHandler, Principal> pair = authenticateAndObtainPrincipal(credentials);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
*/
public interface AuthenticationManager {

/** Authentication method attribute name. **/
String AUTHENTICATION_METHOD_ATTRIBUTE = "authenticationMethod";

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@
*
* @author Scott Battaglia
* @since 3.1
*
*/
public abstract class AbstractWebApplicationService implements SingleLogoutService {

private static final long serialVersionUID = 610105280927740076L;

/** Logger instance. **/
protected static final Logger LOGGER = LoggerFactory.getLogger(AbstractWebApplicationService.class);

private static final Map<String, Object> EMPTY_MAP = Collections.unmodifiableMap(new HashMap<String, Object>());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@
*/
public interface RememberMeCredentials extends Credentials {

/** Authentication attribute name for remember-me. **/
String AUTHENTICATION_ATTRIBUTE_REMEMBER_ME = "org.jasig.cas.authentication.principal.REMEMBER_ME";

/** Request parameter name. **/
String REQUEST_PARAMETER_REMEMBER_ME = "rememberMe";

boolean isRememberMe();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ public final class SimpleWebApplicationServiceImpl extends AbstractWebApplicatio

private final ResponseType responseType;

private boolean loggedOutAlready = false;

private static final long serialVersionUID = 8334068957483758042L;

public SimpleWebApplicationServiceImpl(final String id) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,117 +1,120 @@
/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a
* copy of the License at the following location:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

package org.jasig.cas.monitor;

import java.util.Formatter;

/**
* Simple implementation of cache statistics.
*
* @author Marvin S. Addison
* @since 3.5.1
*/
public class SimpleCacheStatistics implements CacheStatistics {

private static final double BYTES_PER_MB = 1048510.0;

private final long size;

private final long capacity;

private final long evictions;

private String name;


/**
* Creates a new instance with given parameters.
*
* @param size Current cache size (e.g. items, bytes, etc).
* @param capacity Current cache capacity (e.g. items, bytes, etc). The units of capacity must be equal to size
* in order to produce a meaningful value for {@link #getPercentFree}.
* @param evictions Number of evictions reported by cache.
*/
public SimpleCacheStatistics(final long size, final long capacity, final long evictions) {
this.size = size;
this.capacity = capacity;
this.evictions = evictions;
}


/**
* Creates a new named instance with given parameters.
*
* @param size Current cache size (e.g. items, bytes, etc).
* @param capacity Current cache capacity (e.g. items, bytes, etc). The units of capacity must be equal to size
* in order to produce a meaningful value for {@link #getPercentFree}.
* @param evictions Number of evictions reported by cache.
* @param name Name of cache instance to which statistics apply.
*/
public SimpleCacheStatistics(final long size, final long capacity, final long evictions, final String name) {
this.size = size;
this.capacity = capacity;
this.evictions = evictions;
this.name = name;
}

public long getSize() {
return this.size;
}


public long getCapacity() {
return this.capacity;
}


public long getEvictions() {
return this.evictions;
}


public int getPercentFree() {
if (this.capacity == 0) {
return 0;
}
return (int) ((this.capacity - this.size) * 100 / this.capacity);
}


public void toString(final StringBuilder builder) {
if (this.name != null) {
builder.append(this.name).append(':');
}
final Formatter formatter = new Formatter(builder);
formatter.format("%.2f", this.size / BYTES_PER_MB);
builder.append("MB used, ");
builder.append(getPercentFree()).append("% free, ");
builder.append(this.evictions).append(" evictions");
}


/**
* Gets a descriptive name of the cache instance for which statistics apply.
*
* @return Name of cache instance/host to which statistics apply.
*/
public String getName() {
return this.name;
}
}
/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a
* copy of the License at the following location:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

package org.jasig.cas.monitor;

import java.util.Formatter;

import org.apache.commons.io.IOUtils;

/**
* Simple implementation of cache statistics.
*
* @author Marvin S. Addison
* @since 3.5.1
*/
public class SimpleCacheStatistics implements CacheStatistics {

private static final double BYTES_PER_MB = 1048510.0;

private final long size;

private final long capacity;

private final long evictions;

private String name;


/**
* Creates a new instance with given parameters.
*
* @param size Current cache size (e.g. items, bytes, etc).
* @param capacity Current cache capacity (e.g. items, bytes, etc). The units of capacity must be equal to size
* in order to produce a meaningful value for {@link #getPercentFree}.
* @param evictions Number of evictions reported by cache.
*/
public SimpleCacheStatistics(final long size, final long capacity, final long evictions) {
this.size = size;
this.capacity = capacity;
this.evictions = evictions;
}


/**
* Creates a new named instance with given parameters.
*
* @param size Current cache size (e.g. items, bytes, etc).
* @param capacity Current cache capacity (e.g. items, bytes, etc). The units of capacity must be equal to size
* in order to produce a meaningful value for {@link #getPercentFree}.
* @param evictions Number of evictions reported by cache.
* @param name Name of cache instance to which statistics apply.
*/
public SimpleCacheStatistics(final long size, final long capacity, final long evictions, final String name) {
this.size = size;
this.capacity = capacity;
this.evictions = evictions;
this.name = name;
}

public long getSize() {
return this.size;
}


public long getCapacity() {
return this.capacity;
}


public long getEvictions() {
return this.evictions;
}


public int getPercentFree() {
if (this.capacity == 0) {
return 0;
}
return (int) ((this.capacity - this.size) * 100 / this.capacity);
}


public void toString(final StringBuilder builder) {
if (this.name != null) {
builder.append(this.name).append(':');
}
final Formatter formatter = new Formatter(builder);
formatter.format("%.2f", this.size / BYTES_PER_MB);
builder.append("MB used, ");
builder.append(getPercentFree()).append("% free, ");
builder.append(this.evictions).append(" evictions");
IOUtils.closeQuietly(formatter);
}


/**
* Gets a descriptive name of the cache instance for which statistics apply.
*
* @return Name of cache instance/host to which statistics apply.
*/
public String getName() {
return this.name;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ public abstract class AbstractRegisteredService implements RegisteredService, Co
@Column(length = 255, updatable = true, insertable = true, nullable = false)
private String description;

/**
* The unique identifier for this service.
*/
@Column(length = 255, updatable = true, insertable = true, nullable = false)
protected String serviceId;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@
*/
public final class CalendarUtils {

/** Array that defines week days by name, including one that is "undefined". **/
public static final String[] WEEKDAYS = new String[] {"UNDEFINED", "Sunday", "Monday",
"Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};

/** Constructor. **/
private CalendarUtils() {
// nothing to do
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public class AuthenticationViaFormAction {
@NotNull
private CookieGenerator warnCookieGenerator;

/** Logger instance. **/
protected final Logger logger = LoggerFactory.getLogger(getClass());

public final void doBind(final RequestContext context, final Credentials credentials) throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,6 @@ public void contextInitialized(final ServletContextEvent sce) {
// log it via Commons Logging
logger.error(message, t);

// log it to System.err
System.err.println(message);
t.printStackTrace();

// log it to the ServletContext
ServletContext context = sce.getServletContext();
context.log(message, t);
Expand Down
Loading

0 comments on commit 1e0ab4c

Please sign in to comment.