You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ta...@apache.org on 2023/01/18 10:31:55 UTC
[myfaces] branch main updated: cosmetics
This is an automated email from the ASF dual-hosted git repository.
tandraschko pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/myfaces.git
The following commit(s) were added to refs/heads/main by this push:
new e62fac80d cosmetics
e62fac80d is described below
commit e62fac80d2657c48087c0f6abba5e2007ed522cd
Author: Thomas Andraschko <ta...@apache.org>
AuthorDate: Wed Jan 18 11:31:46 2023 +0100
cosmetics
---
.../context/servlet/StartupFacesContextImpl.java | 54 ++++----
.../servlet/StartupServletExternalContextImpl.java | 144 ++++++++++-----------
2 files changed, 96 insertions(+), 102 deletions(-)
diff --git a/impl/src/main/java/org/apache/myfaces/context/servlet/StartupFacesContextImpl.java b/impl/src/main/java/org/apache/myfaces/context/servlet/StartupFacesContextImpl.java
index b49d46e0b..fbee285f0 100644
--- a/impl/src/main/java/org/apache/myfaces/context/servlet/StartupFacesContextImpl.java
+++ b/impl/src/main/java/org/apache/myfaces/context/servlet/StartupFacesContextImpl.java
@@ -40,7 +40,7 @@ import jakarta.faces.lifecycle.Lifecycle;
*/
public class StartupFacesContextImpl extends FacesContextImplBase
{
- private boolean _startup;
+ private boolean startup;
public StartupFacesContextImpl(
ExternalContext externalContext,
@@ -50,8 +50,8 @@ public class StartupFacesContextImpl extends FacesContextImplBase
{
// setCurrentInstance is called in constructor of super class
super(externalContext, defaultExternalContext);
-
- _startup = startup;
+
+ this.startup = startup;
setExceptionHandler(exceptionHandler);
}
@@ -74,28 +74,28 @@ public class StartupFacesContextImpl extends FacesContextImplBase
public FacesMessage.Severity getMaximumSeverity()
{
assertNotReleased();
- throw constructUnsupportedOperationException();
+ throw unsupportedOperation();
}
@Override
public List<FacesMessage> getMessageList()
{
assertNotReleased();
- throw constructUnsupportedOperationException();
+ throw unsupportedOperation();
}
@Override
public List<FacesMessage> getMessageList(String clientId)
{
assertNotReleased();
- throw constructUnsupportedOperationException();
+ throw unsupportedOperation();
}
@Override
public Iterator<FacesMessage> getMessages()
{
assertNotReleased();
- throw constructUnsupportedOperationException();
+ throw unsupportedOperation();
}
@@ -103,119 +103,119 @@ public class StartupFacesContextImpl extends FacesContextImplBase
public Iterator<String> getClientIdsWithMessages()
{
assertNotReleased();
- throw constructUnsupportedOperationException();
+ throw unsupportedOperation();
}
@Override
public Iterator<FacesMessage> getMessages(String clientId)
{
assertNotReleased();
- throw constructUnsupportedOperationException();
+ throw unsupportedOperation();
}
@Override
public void addMessage(String clientId, FacesMessage message)
{
assertNotReleased();
- throw constructUnsupportedOperationException();
+ throw unsupportedOperation();
}
@Override
public PartialViewContext getPartialViewContext()
{
assertNotReleased();
- throw constructUnsupportedOperationException();
+ throw unsupportedOperation();
}
@Override
public boolean isPostback()
{
assertNotReleased();
- throw constructUnsupportedOperationException();
+ throw unsupportedOperation();
}
@Override
public void validationFailed()
{
assertNotReleased();
- throw constructUnsupportedOperationException();
+ throw unsupportedOperation();
}
@Override
public boolean isValidationFailed()
{
assertNotReleased();
- throw constructUnsupportedOperationException();
+ throw unsupportedOperation();
}
@Override
public void renderResponse()
{
assertNotReleased();
- throw constructUnsupportedOperationException();
+ throw unsupportedOperation();
}
@Override
public void responseComplete()
{
assertNotReleased();
- throw constructUnsupportedOperationException();
+ throw unsupportedOperation();
}
@Override
public PhaseId getCurrentPhaseId()
{
assertNotReleased();
- throw constructUnsupportedOperationException();
+ throw unsupportedOperation();
}
@Override
public void setCurrentPhaseId(PhaseId currentPhaseId)
{
assertNotReleased();
- throw constructUnsupportedOperationException();
+ throw unsupportedOperation();
}
@Override
public boolean getRenderResponse()
{
assertNotReleased();
- throw constructUnsupportedOperationException();
+ throw unsupportedOperation();
}
@Override
public boolean getResponseComplete()
{
assertNotReleased();
- throw constructUnsupportedOperationException();
+ throw unsupportedOperation();
}
@Override
public void setResponseStream(ResponseStream responseStream)
{
assertNotReleased();
- throw constructUnsupportedOperationException();
+ throw unsupportedOperation();
}
@Override
public ResponseStream getResponseStream()
{
assertNotReleased();
- throw constructUnsupportedOperationException();
+ throw unsupportedOperation();
}
@Override
public void setResponseWriter(ResponseWriter responseWriter)
{
assertNotReleased();
- throw constructUnsupportedOperationException();
+ throw unsupportedOperation();
}
@Override
public ResponseWriter getResponseWriter()
{
assertNotReleased();
- throw constructUnsupportedOperationException();
+ throw unsupportedOperation();
}
@Override
@@ -224,9 +224,9 @@ public class StartupFacesContextImpl extends FacesContextImplBase
return null;
}
- private UnsupportedOperationException constructUnsupportedOperationException()
+ private UnsupportedOperationException unsupportedOperation()
{
- throw new UnsupportedOperationException("This method is not supported during "
- + (_startup ? "startup" : "shutdown"));
+ return new UnsupportedOperationException("This method is not supported during "
+ + (startup ? "startup" : "shutdown"));
}
}
diff --git a/impl/src/main/java/org/apache/myfaces/context/servlet/StartupServletExternalContextImpl.java b/impl/src/main/java/org/apache/myfaces/context/servlet/StartupServletExternalContextImpl.java
index 53a444869..5f22c89c2 100644
--- a/impl/src/main/java/org/apache/myfaces/context/servlet/StartupServletExternalContextImpl.java
+++ b/impl/src/main/java/org/apache/myfaces/context/servlet/StartupServletExternalContextImpl.java
@@ -44,15 +44,14 @@ public class StartupServletExternalContextImpl extends ServletExternalContextImp
{
public static final String EXCEPTION_TEXT = "This method is not supported during ";
- private boolean _startup;
- private ServletContext _servletContext;
-
- public StartupServletExternalContextImpl(final ServletContext servletContext,
- boolean startup)
+ private boolean startup;
+ private ServletContext servletContext;
+
+ public StartupServletExternalContextImpl(ServletContext servletContext, boolean startup)
{
super(servletContext);
- _servletContext = servletContext;
- _startup = startup;
+ this.servletContext = servletContext;
+ this.startup = startup;
}
// ~ Methods which are valid to be called during startup and shutdown------
@@ -68,31 +67,31 @@ public class StartupServletExternalContextImpl extends ServletExternalContextImp
@Override
public String encodeActionURL(String url)
{
- throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime());
+ throw unsupportedOperation();
}
@Override
public String encodeNamespace(String name)
{
- throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime());
+ throw unsupportedOperation();
}
@Override
public String encodeResourceURL(String url)
{
- throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime());
+ throw unsupportedOperation();
}
@Override
public String getAuthType()
{
- throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime());
+ throw unsupportedOperation();
}
@Override
public String getRemoteUser()
{
- throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime());
+ throw unsupportedOperation();
}
@Override
@@ -105,61 +104,61 @@ public class StartupServletExternalContextImpl extends ServletExternalContextImp
@Override
public String getRequestContextPath()
{
- return _servletContext.getContextPath();
+ return servletContext.getContextPath();
}
@Override
public Map<String, Object> getRequestCookieMap()
{
- throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime());
+ throw unsupportedOperation();
}
@Override
public Map<String, String> getRequestHeaderMap()
{
- throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime());
+ throw unsupportedOperation();
}
@Override
public Map<String, String[]> getRequestHeaderValuesMap()
{
- throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime());
+ throw unsupportedOperation();
}
@Override
public Locale getRequestLocale()
{
- throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime());
+ throw unsupportedOperation();
}
@Override
public Iterator<Locale> getRequestLocales()
{
- throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime());
+ throw unsupportedOperation();
}
@Override
public Map<String, Object> getRequestMap()
{
- throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime());
+ throw unsupportedOperation();
}
@Override
public Map<String, String> getRequestParameterMap()
{
- throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime());
+ throw unsupportedOperation();
}
@Override
public Iterator<String> getRequestParameterNames()
{
- throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime());
+ throw unsupportedOperation();
}
@Override
public Map<String, String[]> getRequestParameterValuesMap()
{
- throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime());
+ throw unsupportedOperation();
}
@Override
@@ -186,7 +185,7 @@ public class StartupServletExternalContextImpl extends ServletExternalContextImp
{
if (create)
{
- throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime());
+ throw unsupportedOperation();
}
return null;
}
@@ -196,7 +195,7 @@ public class StartupServletExternalContextImpl extends ServletExternalContextImp
{
if (create)
{
- throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime());
+ throw unsupportedOperation();
}
return null;
}
@@ -204,263 +203,258 @@ public class StartupServletExternalContextImpl extends ServletExternalContextImp
@Override
public Map<String, Object> getSessionMap()
{
- throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime());
+ throw unsupportedOperation();
}
@Override
public Principal getUserPrincipal()
{
- throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime());
+ throw unsupportedOperation();
}
@Override
public boolean isUserInRole(String role)
{
- throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime());
+ throw unsupportedOperation();
}
@Override
public String encodeBookmarkableURL(String baseUrl,
Map<String, List<String>> parameters)
{
- throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime());
+ throw unsupportedOperation();
}
@Override
public String encodePartialActionURL(String url)
{
- throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime());
+ throw unsupportedOperation();
}
@Override
public String encodeRedirectURL(String baseUrl,
Map<String, List<String>> parameters)
{
- throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime());
+ throw unsupportedOperation();
}
@Override
public String getRequestCharacterEncoding()
{
- throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime());
+ throw unsupportedOperation();
}
@Override
public int getRequestContentLength()
{
- throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime());
+ throw unsupportedOperation();
}
@Override
public String getRequestContentType()
{
- throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime());
+ throw unsupportedOperation();
}
@Override
public String getRequestScheme()
{
- throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime());
+ throw unsupportedOperation();
}
@Override
public String getRequestServerName()
{
- throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime());
+ throw unsupportedOperation();
}
@Override
public int getRequestServerPort()
{
- throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime());
+ throw unsupportedOperation();
}
@Override
public int getResponseBufferSize()
{
- throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime());
+ throw unsupportedOperation();
}
@Override
public String getResponseCharacterEncoding()
{
- throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime());
+ throw unsupportedOperation();
}
@Override
public String getResponseContentType()
{
- throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime());
+ throw unsupportedOperation();
}
@Override
public void invalidateSession()
{
- throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime());
+ throw unsupportedOperation();
}
@Override
public boolean isResponseCommitted()
{
- throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime());
+ throw unsupportedOperation();
}
@Override
public void setRequest(Object request)
{
- throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime());
+ throw unsupportedOperation();
}
@Override
public void setRequestCharacterEncoding(String encoding)
throws UnsupportedEncodingException
{
- throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime());
+ throw unsupportedOperation();
}
@Override
public void setResponse(Object response)
{
- throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime());
+ throw unsupportedOperation();
}
@Override
public void setResponseBufferSize(int size)
{
- throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime());
+ throw unsupportedOperation();
}
@Override
public void setResponseCharacterEncoding(String encoding)
{
- throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime());
+ throw unsupportedOperation();
}
@Override
public void setResponseContentLength(int length)
{
- throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime());
+ throw unsupportedOperation();
}
@Override
public void setResponseContentType(String contentType)
{
- throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime());
+ throw unsupportedOperation();
}
@Override
public void setResponseHeader(String name, String value)
{
- throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime());
+ throw unsupportedOperation();
}
@Override
public void setResponseStatus(int statusCode)
{
- throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime());
+ throw unsupportedOperation();
}
-
+
/**
* Cannot dispatch because this is not a page request
*/
@Override
public void dispatch(String path) throws IOException
{
- throw new IllegalStateException(EXCEPTION_TEXT + _getTime());
+ throw unsupportedOperation();
}
-
+
/**
* Cannot redirect because this is not a page request
*/
@Override
public void redirect(String url) throws IOException
{
- throw new IllegalStateException(EXCEPTION_TEXT + _getTime());
+ throw unsupportedOperation();
}
@Override
public void responseFlushBuffer() throws IOException
{
- throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime());
+ throw unsupportedOperation();
}
@Override
public void responseReset()
{
- throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime());
+ throw unsupportedOperation();
}
@Override
public void responseSendError(int statusCode, String message)
throws IOException
{
- throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime());
+ throw unsupportedOperation();
}
@Override
public void addResponseCookie(String name, String value,
Map<String, Object> properties)
{
- throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime());
+ throw unsupportedOperation();
}
@Override
public void addResponseHeader(String name, String value)
{
- throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime());
+ throw unsupportedOperation();
}
@Override
public Flash getFlash()
{
- throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime());
+ throw unsupportedOperation();
}
@Override
public OutputStream getResponseOutputStream() throws IOException
{
- throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime());
+ throw unsupportedOperation();
}
@Override
public Writer getResponseOutputWriter() throws IOException
{
- throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime());
+ throw unsupportedOperation();
}
@Override
public boolean isSecure()
{
- throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime());
+ throw unsupportedOperation();
}
@Override
public int getSessionMaxInactiveInterval()
{
- throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime()); }
+ throw unsupportedOperation();
+ }
@Override
public void setSessionMaxInactiveInterval(int interval)
{
- throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime());
+ throw unsupportedOperation();
}
@Override
public String encodeWebsocketURL(String url)
{
- throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime());
+ throw unsupportedOperation();
}
- // ~ private Methods ------------------------------------------------------
-
- /**
- * Returns startup or shutdown as String according to the field _startup.
- * @return
- */
- private String _getTime()
+ private UnsupportedOperationException unsupportedOperation()
{
- return _startup ? "startup" : "shutdown";
+ return new UnsupportedOperationException("This method is not supported during "
+ + (startup ? "startup" : "shutdown"));
}
-
}