You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by sk...@apache.org on 2008/07/03 23:58:25 UTC
svn commit: r673833 [5/18] - in /myfaces/tomahawk/trunk:
core/src/main/java/org/apache/myfaces/component/
core/src/main/java/org/apache/myfaces/component/html/ext/
core/src/main/java/org/apache/myfaces/component/html/util/
core/src/main/java/org/apache...
Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/taglib/html/ext/HtmlSelectBooleanCheckboxTag.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/taglib/html/ext/HtmlSelectBooleanCheckboxTag.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/taglib/html/ext/HtmlSelectBooleanCheckboxTag.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/taglib/html/ext/HtmlSelectBooleanCheckboxTag.java Thu Jul 3 14:58:05 2008
@@ -48,10 +48,10 @@
private String _visibleOnUserRole;
private String _displayValueOnly;
- private String _displayValueOnlyStyle;
- private String _displayValueOnlyStyleClass;
-
- private String _escape;
+ private String _displayValueOnlyStyle;
+ private String _displayValueOnlyStyleClass;
+
+ private String _escape;
public void release() {
super.release();
Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/taglib/html/ext/HtmlSelectManyCheckboxTag.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/taglib/html/ext/HtmlSelectManyCheckboxTag.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/taglib/html/ext/HtmlSelectManyCheckboxTag.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/taglib/html/ext/HtmlSelectManyCheckboxTag.java Thu Jul 3 14:58:05 2008
@@ -50,8 +50,8 @@
private String _visibleOnUserRole;
private String _displayValueOnly;
- private String _displayValueOnlyStyle;
- private String _displayValueOnlyStyleClass;
+ private String _displayValueOnlyStyle;
+ private String _displayValueOnlyStyleClass;
public void release() {
super.release();
Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/taglib/html/ext/HtmlSelectManyListboxTag.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/taglib/html/ext/HtmlSelectManyListboxTag.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/taglib/html/ext/HtmlSelectManyListboxTag.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/taglib/html/ext/HtmlSelectManyListboxTag.java Thu Jul 3 14:58:05 2008
@@ -48,8 +48,8 @@
private String _visibleOnUserRole;
private String _displayValueOnly;
- private String _displayValueOnlyStyle;
- private String _displayValueOnlyStyleClass;
+ private String _displayValueOnlyStyle;
+ private String _displayValueOnlyStyleClass;
public void release() {
super.release();
Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/taglib/html/ext/HtmlSelectManyMenuTag.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/taglib/html/ext/HtmlSelectManyMenuTag.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/taglib/html/ext/HtmlSelectManyMenuTag.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/taglib/html/ext/HtmlSelectManyMenuTag.java Thu Jul 3 14:58:05 2008
@@ -48,8 +48,8 @@
private String _visibleOnUserRole;
private String _displayValueOnly;
- private String _displayValueOnlyStyle;
- private String _displayValueOnlyStyleClass;
+ private String _displayValueOnlyStyle;
+ private String _displayValueOnlyStyleClass;
public void release() {
super.release();
Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/taglib/html/ext/HtmlSelectOneListboxTag.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/taglib/html/ext/HtmlSelectOneListboxTag.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/taglib/html/ext/HtmlSelectOneListboxTag.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/taglib/html/ext/HtmlSelectOneListboxTag.java Thu Jul 3 14:58:05 2008
@@ -48,8 +48,8 @@
private String _visibleOnUserRole;
private String _displayValueOnly;
- private String _displayValueOnlyStyle;
- private String _displayValueOnlyStyleClass;
+ private String _displayValueOnlyStyle;
+ private String _displayValueOnlyStyleClass;
public void release() {
super.release();
Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/taglib/html/ext/HtmlSelectOneMenuTag.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/taglib/html/ext/HtmlSelectOneMenuTag.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/taglib/html/ext/HtmlSelectOneMenuTag.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/taglib/html/ext/HtmlSelectOneMenuTag.java Thu Jul 3 14:58:05 2008
@@ -48,8 +48,8 @@
private String _visibleOnUserRole;
private String _displayValueOnly;
- private String _displayValueOnlyStyle;
- private String _displayValueOnlyStyleClass;
+ private String _displayValueOnlyStyle;
+ private String _displayValueOnlyStyleClass;
public void release() {
super.release();
Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/taglib/html/ext/HtmlSelectOneRadioTag.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/taglib/html/ext/HtmlSelectOneRadioTag.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/taglib/html/ext/HtmlSelectOneRadioTag.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/taglib/html/ext/HtmlSelectOneRadioTag.java Thu Jul 3 14:58:05 2008
@@ -49,8 +49,8 @@
private String _visibleOnUserRole;
private String _displayValueOnly;
- private String _displayValueOnlyStyle;
- private String _displayValueOnlyStyleClass;
+ private String _displayValueOnlyStyle;
+ private String _displayValueOnlyStyleClass;
public void release() {
super.release();
Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/tomahawk/util/ExternalContextUtils.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/tomahawk/util/ExternalContextUtils.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/tomahawk/util/ExternalContextUtils.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/tomahawk/util/ExternalContextUtils.java Thu Jul 3 14:58:05 2008
@@ -44,156 +44,156 @@
*/
public final class ExternalContextUtils
{
- // prevent this from being instantiated
- private ExternalContextUtils()
- {
- }
-
- /**
- * Returns the content length or -1 if the unknown.
- *
- * @param externalContext
- * the ExternalContext
- * @return the length or -1
- */
- public static final int getContentLength(ExternalContext externalContext)
- {
- RequestType type = getRequestType(externalContext);
-
- if(type.isRequestFromClient())
- {
- try
- {
- Object request = externalContext.getRequest();
- Method contentLenMethod = request.getClass().getMethod("getContentLength",new Class[]{});
- return ((Integer) contentLenMethod.invoke(request,new Object[]{})).intValue(); //this will autobox
- }
- catch(Exception e)
- {
- _LOG.error("Unsupported request type.", e);
- }
- }
-
- return -1;
- }
-
- /**
- * Returns the request input stream if one is available
- *
- * @param externalContext
- * @return
- * @throws IOException
- */
- public static final InputStream getRequestInputStream(ExternalContext externalContext)
- throws IOException
- {
- RequestType type = getRequestType(externalContext);
-
- if(type.isRequestFromClient())
- {
- try
- {
- Object request = externalContext.getRequest();
-
- Method method = request.getClass().getMethod(type.isPortlet()?"getPortletInputStream":"getInputStream",new Class[]{});
- return (InputStream) method.invoke(request,new Object[]{});
- }
- catch (Exception e)
- {
- _LOG.error("Unable to get the request input stream because of an error", e);
- }
- }
- return null;
- }
-
- /**
- * Returns the requestType of this ExternalContext.
- *
- * @param externalContext the current external context
- * @return the appropriate RequestType for this external context
- * @see RequestType
- */
- public static final RequestType getRequestType(ExternalContext externalContext)
- {
- //Stuff is laid out strangely in this class in order to optimize
- //performance. We want to do as few instanceof's as possible so
- //things are laid out according to the expected frequency of the
- //various requests occurring.
- if(_PORTLET_CONTEXT_CLASS != null)
- {
- if (_PORTLET_CONTEXT_CLASS.isInstance(externalContext.getContext()))
- {
- //We are inside of a portlet container
- Object request = externalContext.getRequest();
-
- if(_PORTLET_RENDER_REQUEST_CLASS.isInstance(request))
- {
- return RequestType.RENDER;
- }
-
- if(_PORTLET_RESOURCE_REQUEST_CLASS != null)
- {
- if(_PORTLET_ACTION_REQUEST_CLASS.isInstance(request))
- {
- return RequestType.ACTION;
- }
-
- //We are in a JSR-286 container
- if(_PORTLET_RESOURCE_REQUEST_CLASS.isInstance(request))
- {
- return RequestType.RESOURCE;
- }
-
- return RequestType.EVENT;
- }
-
- return RequestType.ACTION;
- }
- }
-
- return RequestType.SERVLET;
- }
+ // prevent this from being instantiated
+ private ExternalContextUtils()
+ {
+ }
+
+ /**
+ * Returns the content length or -1 if the unknown.
+ *
+ * @param externalContext
+ * the ExternalContext
+ * @return the length or -1
+ */
+ public static final int getContentLength(ExternalContext externalContext)
+ {
+ RequestType type = getRequestType(externalContext);
+
+ if(type.isRequestFromClient())
+ {
+ try
+ {
+ Object request = externalContext.getRequest();
+ Method contentLenMethod = request.getClass().getMethod("getContentLength",new Class[]{});
+ return ((Integer) contentLenMethod.invoke(request,new Object[]{})).intValue(); //this will autobox
+ }
+ catch(Exception e)
+ {
+ _LOG.error("Unsupported request type.", e);
+ }
+ }
+
+ return -1;
+ }
+
+ /**
+ * Returns the request input stream if one is available
+ *
+ * @param externalContext
+ * @return
+ * @throws IOException
+ */
+ public static final InputStream getRequestInputStream(ExternalContext externalContext)
+ throws IOException
+ {
+ RequestType type = getRequestType(externalContext);
+
+ if(type.isRequestFromClient())
+ {
+ try
+ {
+ Object request = externalContext.getRequest();
+
+ Method method = request.getClass().getMethod(type.isPortlet()?"getPortletInputStream":"getInputStream",new Class[]{});
+ return (InputStream) method.invoke(request,new Object[]{});
+ }
+ catch (Exception e)
+ {
+ _LOG.error("Unable to get the request input stream because of an error", e);
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the requestType of this ExternalContext.
+ *
+ * @param externalContext the current external context
+ * @return the appropriate RequestType for this external context
+ * @see RequestType
+ */
+ public static final RequestType getRequestType(ExternalContext externalContext)
+ {
+ //Stuff is laid out strangely in this class in order to optimize
+ //performance. We want to do as few instanceof's as possible so
+ //things are laid out according to the expected frequency of the
+ //various requests occurring.
+ if(_PORTLET_CONTEXT_CLASS != null)
+ {
+ if (_PORTLET_CONTEXT_CLASS.isInstance(externalContext.getContext()))
+ {
+ //We are inside of a portlet container
+ Object request = externalContext.getRequest();
+
+ if(_PORTLET_RENDER_REQUEST_CLASS.isInstance(request))
+ {
+ return RequestType.RENDER;
+ }
+
+ if(_PORTLET_RESOURCE_REQUEST_CLASS != null)
+ {
+ if(_PORTLET_ACTION_REQUEST_CLASS.isInstance(request))
+ {
+ return RequestType.ACTION;
+ }
+
+ //We are in a JSR-286 container
+ if(_PORTLET_RESOURCE_REQUEST_CLASS.isInstance(request))
+ {
+ return RequestType.RESOURCE;
+ }
+
+ return RequestType.EVENT;
+ }
+
+ return RequestType.ACTION;
+ }
+ }
+
+ return RequestType.SERVLET;
+ }
private static final Log _LOG = LogFactory.getLog(ExternalContextUtils.class);
- private static final Class _PORTLET_ACTION_REQUEST_CLASS;
- private static final Class _PORTLET_RENDER_REQUEST_CLASS;
- private static final Class _PORTLET_RESOURCE_REQUEST_CLASS; //Will be present in JSR-286 containers only
- private static final Class _PORTLET_CONTEXT_CLASS;
-
- static
- {
- Class context;
- Class actionRequest;
- Class renderRequest;
- Class resourceRequest;
- try
- {
- ClassLoader loader = Thread.currentThread().getContextClassLoader();
- context = loader.loadClass("javax.portlet.PortletContext");
- actionRequest = loader.loadClass("javax.portlet.ActionRequest");
- renderRequest = loader.loadClass("javax.portlet.RenderRequest");
-
- try
- {
- resourceRequest = loader.loadClass("javax.portlet.ResourceRequest");
- }
- catch (ClassNotFoundException e)
- {
- resourceRequest = null;
- }
- }
- catch (ClassNotFoundException e)
- {
- context = null;
- actionRequest = null;
- renderRequest = null;
- resourceRequest = null;
- }
-
- _PORTLET_CONTEXT_CLASS = context;
- _PORTLET_ACTION_REQUEST_CLASS = actionRequest;
- _PORTLET_RENDER_REQUEST_CLASS = renderRequest;
- _PORTLET_RESOURCE_REQUEST_CLASS = resourceRequest;
- }
+ private static final Class _PORTLET_ACTION_REQUEST_CLASS;
+ private static final Class _PORTLET_RENDER_REQUEST_CLASS;
+ private static final Class _PORTLET_RESOURCE_REQUEST_CLASS; //Will be present in JSR-286 containers only
+ private static final Class _PORTLET_CONTEXT_CLASS;
+
+ static
+ {
+ Class context;
+ Class actionRequest;
+ Class renderRequest;
+ Class resourceRequest;
+ try
+ {
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ context = loader.loadClass("javax.portlet.PortletContext");
+ actionRequest = loader.loadClass("javax.portlet.ActionRequest");
+ renderRequest = loader.loadClass("javax.portlet.RenderRequest");
+
+ try
+ {
+ resourceRequest = loader.loadClass("javax.portlet.ResourceRequest");
+ }
+ catch (ClassNotFoundException e)
+ {
+ resourceRequest = null;
+ }
+ }
+ catch (ClassNotFoundException e)
+ {
+ context = null;
+ actionRequest = null;
+ renderRequest = null;
+ resourceRequest = null;
+ }
+
+ _PORTLET_CONTEXT_CLASS = context;
+ _PORTLET_ACTION_REQUEST_CLASS = actionRequest;
+ _PORTLET_RENDER_REQUEST_CLASS = renderRequest;
+ _PORTLET_RESOURCE_REQUEST_CLASS = resourceRequest;
+ }
}
Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/tomahawk/util/RequestType.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/tomahawk/util/RequestType.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/tomahawk/util/RequestType.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/tomahawk/util/RequestType.java Thu Jul 3 14:58:05 2008
@@ -35,100 +35,100 @@
*/
public class RequestType
{
- /**
- * The type for all servlet requests. SERVLET request types are
- * both client requests and response writable.
- */
- final public static RequestType SERVLET = new RequestType(true, true, false);
-
- /**
- * The type for a portlet RenderRequest. RENDER request types are
- * for portlets and are response writable but are NOT client
- * requests.
- */
- final public static RequestType RENDER = new RequestType(false, true, true);
-
- /**
- * The type for a portlet ActionRequest. ACTION request types are
- * for portlets and are client requests but are NOT response
- * writable.
- */
- final public static RequestType ACTION = new RequestType(true, false, true);
-
- /**
- * The type for a portlet ResourceRequest. RESOURCE request types
- * are for portlets and are both client requests and response
- * writable. RESOURCE request types will only be returned in a
- * Portlet 2.0 portlet container.
- */
- final public static RequestType RESOURCE = new RequestType(true, true, true);
-
- /**
- * The type for a portlet EventRequest. EVENT request types
- * are for portlets and are neither client requests nor response
- * writable. EVENT request types will only be returned in a
- * Portlet 2.0 portlet container.
- */
- final public static RequestType EVENT = new RequestType(false, false, true);
-
- private boolean _client;
- private boolean _writable;
- private boolean _portlet;
-
- RequestType(boolean client, boolean writable, boolean portlet)
- {
- _client = client;
- _writable = writable;
- _portlet = portlet;
- }
-
- /**
- * Returns <code>true</code> if this request was a direct
- * result of a call from the client. This implies that
- * the current application is the "owner" of the current
- * request and that it has access to the inputStream, can
- * get and set character encodings, etc. Currently all
- * SERVLET, ACTION, and RESOURCE RequestTypes are client
- * requests.
- *
- * @return <code>true</code> if the current request is a
- * client data type request and <code>false</code>
- * if it is not.
- */
- public boolean isRequestFromClient()
- {
- return _client;
- }
-
- /**
- * Returns <code>true</code> if the response for this
- * RequestType is intended to produce output to the client.
- * Currently the SERVLET, RENDER, and RESOURCE request are
- * response writable.
- *
- * @return <code>true</code> if the current request is
- * intended to produce output and <code>false</code>
- * if it is not.
- */
- public boolean isResponseWritable()
- {
- return _writable;
- }
-
- /**
- * Returns <code>true</code> if the response for this
- * RequestType originated from a JSR-168 or JSR-286
- * portlet container. Currently RENDER, ACTION,
- * RESOURCE, and EVENT RequestTypes are all portlet
- * requests.
- *
- * @return <code>true</code> if the current request
- * originated inside of a JSR-168 or JSR-286
- * Portlet Container or <code>false</code> if
- * it did not.
- */
- public boolean isPortlet()
- {
- return _portlet;
- }
+ /**
+ * The type for all servlet requests. SERVLET request types are
+ * both client requests and response writable.
+ */
+ final public static RequestType SERVLET = new RequestType(true, true, false);
+
+ /**
+ * The type for a portlet RenderRequest. RENDER request types are
+ * for portlets and are response writable but are NOT client
+ * requests.
+ */
+ final public static RequestType RENDER = new RequestType(false, true, true);
+
+ /**
+ * The type for a portlet ActionRequest. ACTION request types are
+ * for portlets and are client requests but are NOT response
+ * writable.
+ */
+ final public static RequestType ACTION = new RequestType(true, false, true);
+
+ /**
+ * The type for a portlet ResourceRequest. RESOURCE request types
+ * are for portlets and are both client requests and response
+ * writable. RESOURCE request types will only be returned in a
+ * Portlet 2.0 portlet container.
+ */
+ final public static RequestType RESOURCE = new RequestType(true, true, true);
+
+ /**
+ * The type for a portlet EventRequest. EVENT request types
+ * are for portlets and are neither client requests nor response
+ * writable. EVENT request types will only be returned in a
+ * Portlet 2.0 portlet container.
+ */
+ final public static RequestType EVENT = new RequestType(false, false, true);
+
+ private boolean _client;
+ private boolean _writable;
+ private boolean _portlet;
+
+ RequestType(boolean client, boolean writable, boolean portlet)
+ {
+ _client = client;
+ _writable = writable;
+ _portlet = portlet;
+ }
+
+ /**
+ * Returns <code>true</code> if this request was a direct
+ * result of a call from the client. This implies that
+ * the current application is the "owner" of the current
+ * request and that it has access to the inputStream, can
+ * get and set character encodings, etc. Currently all
+ * SERVLET, ACTION, and RESOURCE RequestTypes are client
+ * requests.
+ *
+ * @return <code>true</code> if the current request is a
+ * client data type request and <code>false</code>
+ * if it is not.
+ */
+ public boolean isRequestFromClient()
+ {
+ return _client;
+ }
+
+ /**
+ * Returns <code>true</code> if the response for this
+ * RequestType is intended to produce output to the client.
+ * Currently the SERVLET, RENDER, and RESOURCE request are
+ * response writable.
+ *
+ * @return <code>true</code> if the current request is
+ * intended to produce output and <code>false</code>
+ * if it is not.
+ */
+ public boolean isResponseWritable()
+ {
+ return _writable;
+ }
+
+ /**
+ * Returns <code>true</code> if the response for this
+ * RequestType originated from a JSR-168 or JSR-286
+ * portlet container. Currently RENDER, ACTION,
+ * RESOURCE, and EVENT RequestTypes are all portlet
+ * requests.
+ *
+ * @return <code>true</code> if the current request
+ * originated inside of a JSR-168 or JSR-286
+ * Portlet Container or <code>false</code> if
+ * it did not.
+ */
+ public boolean isPortlet()
+ {
+ return _portlet;
+ }
}
\ No newline at end of file
Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/webapp/filter/ExtensionsResponseWrapper.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/webapp/filter/ExtensionsResponseWrapper.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/webapp/filter/ExtensionsResponseWrapper.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/webapp/filter/ExtensionsResponseWrapper.java Thu Jul 3 14:58:05 2008
@@ -52,34 +52,34 @@
}
public String toString(){
- try{
+ try{
return stream.toString(getCharacterEncoding());
- }catch(UnsupportedEncodingException e){
- // an attempt to set an invalid character encoding would have caused this exception before
+ }catch(UnsupportedEncodingException e){
+ // an attempt to set an invalid character encoding would have caused this exception before
throw new RuntimeException("Response accepted invalid character encoding " + getCharacterEncoding());
- }
+ }
}
/** This method is used by Tomcat.
*/
public PrintWriter getWriter(){
if( printWriter == null ){
- OutputStreamWriter streamWriter = new OutputStreamWriter(stream, Charset.forName(getCharacterEncoding()));
- printWriter = new PrintWriter(streamWriter, true);
- //printWriter = new PrintWriter(stream, true); // autoFlush is true
+ OutputStreamWriter streamWriter = new OutputStreamWriter(stream, Charset.forName(getCharacterEncoding()));
+ printWriter = new PrintWriter(streamWriter, true);
+ //printWriter = new PrintWriter(stream, true); // autoFlush is true
}
return printWriter;
}
- /** This method is used by Jetty.
- */
- public ServletOutputStream getOutputStream(){
- return new MyServletOutputStream( stream );
- }
+ /** This method is used by Jetty.
+ */
+ public ServletOutputStream getOutputStream(){
+ return new MyServletOutputStream( stream );
+ }
public InputSource getInputSource(){
- ByteArrayInputStream bais = new ByteArrayInputStream( stream.toByteArray() );
- return new InputSource( bais );
+ ByteArrayInputStream bais = new ByteArrayInputStream( stream.toByteArray() );
+ return new InputSource( bais );
}
/**
@@ -90,22 +90,22 @@
}
public void setContentType(String contentType) {
- super.setContentType(contentType);
- this.contentType = contentType;
+ super.setContentType(contentType);
+ this.contentType = contentType;
}
public String getContentType() {
- return contentType;
- }
+ return contentType;
+ }
public void flushBuffer() throws IOException{
- stream.flush();
+ stream.flush();
}
public void finishResponse() {
try {
if (printWriter != null) {
- printWriter.close();
+ printWriter.close();
} else {
if (stream != null) {
stream.close();
@@ -123,22 +123,22 @@
/** Used in the <code>getOutputStream()</code> method.
*/
private class MyServletOutputStream extends ServletOutputStream {
- private ByteArrayOutputStream outputStream;
+ private ByteArrayOutputStream outputStream;
+
+ public MyServletOutputStream(ByteArrayOutputStream outputStream){
+ this.outputStream = outputStream;
+ }
- public MyServletOutputStream(ByteArrayOutputStream outputStream){
- this.outputStream = outputStream;
- }
-
- public void write(int b){
- outputStream.write( b );
- }
-
- public void write(byte[] bytes) throws IOException{
- outputStream.write( bytes );
- }
-
- public void write(byte[] bytes, int off, int len){
- outputStream.write(bytes, off, len);
- }
+ public void write(int b){
+ outputStream.write( b );
+ }
+
+ public void write(byte[] bytes) throws IOException{
+ outputStream.write( bytes );
+ }
+
+ public void write(byte[] bytes, int off, int len){
+ outputStream.write(bytes, off, len);
+ }
}
}
Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/webapp/filter/MultipartRequestWrapper.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/webapp/filter/MultipartRequestWrapper.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/webapp/filter/MultipartRequestWrapper.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/webapp/filter/MultipartRequestWrapper.java Thu Jul 3 14:58:05 2008
@@ -109,7 +109,7 @@
// The following code avoids commons-fileupload charset problem.
// After fixing commons-fileupload, this code should be
//
- // String value = fileItem.getString();
+ // String value = fileItem.getString();
//
String value = null;
if ( charset == null) {
Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/webapp/filter/TomahawkFacesContextWrapper.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/webapp/filter/TomahawkFacesContextWrapper.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/webapp/filter/TomahawkFacesContextWrapper.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/webapp/filter/TomahawkFacesContextWrapper.java Thu Jul 3 14:58:05 2008
@@ -70,15 +70,15 @@
AddResource addResource= AddResourceFactory.getInstance(this);
addResource.responseStarted();
- if (addResource.requiresBuffer())
- {
+ if (addResource.requiresBuffer())
+ {
throw new IllegalStateException("buffering not supported in the portal environment. "+
" Use for org.apache.myfaces.ADD_RESOURCE_CLASS the value"+
" org.apache.myfaces.renderkit.html.util.NonBufferingAddResource.");
}
-
- //externalContextDelegate = new PortletExternalContextWrapper(
- // delegate.getExternalContext(), extendedRequest, extendedResponse, multipartContent);
+
+ //externalContextDelegate = new PortletExternalContextWrapper(
+ // delegate.getExternalContext(), extendedRequest, extendedResponse, multipartContent);
}
else {
HttpServletResponse httpResponse = (HttpServletResponse) delegate.getExternalContext().getResponse();
@@ -100,10 +100,10 @@
AddResource addResource= AddResourceFactory.getInstance(this);
addResource.responseStarted();
- if (addResource.requiresBuffer())
- {
+ if (addResource.requiresBuffer())
+ {
extensionsResponseWrapper = new ExtensionsResponseWrapper(httpResponse);
- extendedResponse = extensionsResponseWrapper;
+ extendedResponse = extensionsResponseWrapper;
}
externalContextDelegate = new ServletExternalContextWrapper(
@@ -228,51 +228,51 @@
{
addResource= AddResourceFactory.getInstance(this);
if (addResource.requiresBuffer())
- {
+ {
if(extensionsResponseWrapper == null) {
throw new NullPointerException("When wrapping the faces-context, add-resource told us that no buffer is required, " +
"now it is required, and we have a null-extensionsResponseWrapper. Please fix add-resource to be consistent over a single request.");
}
extensionsResponseWrapper.finishResponse();
- // write the javascript stuff for myfaces and headerInfo, if needed
- HttpServletResponse servletResponse = extensionsResponseWrapper.getDelegate();
+ // write the javascript stuff for myfaces and headerInfo, if needed
+ HttpServletResponse servletResponse = extensionsResponseWrapper.getDelegate();
HttpServletRequest servletRequest = (HttpServletRequest) getExternalContext().getRequest();
// only parse HTML responses
- if (extensionsResponseWrapper.getContentType() != null && isValidContentType(extensionsResponseWrapper.getContentType()))
- {
- addResource.parseResponse(servletRequest, extensionsResponseWrapper.toString(),
- servletResponse);
-
- addResource.writeMyFacesJavascriptBeforeBodyEnd(servletRequest,
- servletResponse);
-
- if( ! addResource.hasHeaderBeginInfos() ){
- // writes the response if no header info is needed
- addResource.writeResponse(servletRequest, servletResponse);
- return;
- }
-
- // Some headerInfo has to be added
- addResource.writeWithFullHeader(servletRequest, servletResponse);
-
- // writes the response
- addResource.writeResponse(servletRequest, servletResponse);
- }
- else
- {
+ if (extensionsResponseWrapper.getContentType() != null && isValidContentType(extensionsResponseWrapper.getContentType()))
+ {
+ addResource.parseResponse(servletRequest, extensionsResponseWrapper.toString(),
+ servletResponse);
+
+ addResource.writeMyFacesJavascriptBeforeBodyEnd(servletRequest,
+ servletResponse);
- byte[] responseArray = extensionsResponseWrapper.getBytes();
+ if( ! addResource.hasHeaderBeginInfos() ){
+ // writes the response if no header info is needed
+ addResource.writeResponse(servletRequest, servletResponse);
+ return;
+ }
+
+ // Some headerInfo has to be added
+ addResource.writeWithFullHeader(servletRequest, servletResponse);
+
+ // writes the response
+ addResource.writeResponse(servletRequest, servletResponse);
+ }
+ else
+ {
+
+ byte[] responseArray = extensionsResponseWrapper.getBytes();
if(responseArray.length > 0)
{
- // When not filtering due to not valid content-type, deliver the byte-array instead of a charset-converted string.
- // Otherwise a binary stream gets corrupted.
- servletResponse.getOutputStream().write(responseArray);
- }
+ // When not filtering due to not valid content-type, deliver the byte-array instead of a charset-converted string.
+ // Otherwise a binary stream gets corrupted.
+ servletResponse.getOutputStream().write(responseArray);
+ }
}
- }
+ }
}
catch(Throwable th) {
throw new FacesException(th);
Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/webapp/filter/WelcomeFileFilter.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/webapp/filter/WelcomeFileFilter.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/webapp/filter/WelcomeFileFilter.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/webapp/filter/WelcomeFileFilter.java Thu Jul 3 14:58:05 2008
@@ -133,7 +133,7 @@
File file = new File(_context.getRealPath(sb.toString()));
- // context.log("Welcome File: " + file.getAbsolutePath());
+ // context.log("Welcome File: " + file.getAbsolutePath());
if (file.exists())
{
// REVISIT: This will force all "welcome" JSPs through MyFaces.
Modified: myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/custom/date/UserDataTest.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/custom/date/UserDataTest.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/custom/date/UserDataTest.java (original)
+++ myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/custom/date/UserDataTest.java Thu Jul 3 14:58:05 2008
@@ -12,204 +12,204 @@
import junit.framework.TestCase;
public class UserDataTest extends TestCase {
-
- private UserData userData;
-
- private String getDefaultTimeZoneId() {
- return TimeZone.getDefault().getID();
- }
-
- public void testConstructorDoesNotSetDateVariablesWhenTheDateIsNull() {
- userData = new UserData(null, Locale.getDefault(), getDefaultTimeZoneId() , false, "date");
- assertNull(userData.getYear());
- assertNull(userData.getDay());
- assertNull(userData.getHours());
- }
-
- public void testParseReturnsNullWhenTypeIsDateAndComponentNotUsed() {
- userData = new UserData(null, Locale.getDefault(), getDefaultTimeZoneId(), false, "date");
- userData.setDay("");
- userData.setMonth("-1");
- userData.setYear("");
- try {
- Date date = userData.parse();
- assertNull(date);
- } catch (ParseException e) {
- fail();
- }
- }
-
- public void testParseThrowsParseExceptionWhenInvalidDataIsEnteredForTypeDate() {
- userData = new UserData(null, Locale.getDefault(), getDefaultTimeZoneId(), false, "date");
- userData.setDay("40");
- userData.setMonth("-1");
- userData.setYear("2005");
- try {
- userData.parse();
- fail();
- } catch (ParseException e) {
- }
- }
-
- public void testParseGivesCorrectDateWhenValidDataIsEnteredForTypeDate() {
- userData = new UserData(null, Locale.getDefault(), getDefaultTimeZoneId(), false, "date");
- userData.setDay("20");
- userData.setMonth("7");
- userData.setYear("2006");
-
- Calendar calendar = Calendar.getInstance(TimeZone.getDefault(), Locale.getDefault());
- calendar.set(Calendar.DAY_OF_MONTH, 20);
- calendar.set(Calendar.MONTH, 6);
- calendar.set(Calendar.YEAR, 2006);
-
- //only day, month and year is considered for equality
- SimpleDateFormat formatter = new SimpleDateFormat("dd.MM.yyyy");
- try {
- Date date1 = userData.parse();
- Date date2 = calendar.getTime();
- assertEquals(formatter.format(date1), formatter.format(date2));
- } catch (ParseException e) {
- e.printStackTrace();
- }
- }
-
- public void testParseReturnsNullWhenTypeIsTimeAndComponentNotUsed() {
- userData = new UserData(null, Locale.getDefault(), getDefaultTimeZoneId(), false, "time");
- userData.setHours("");
- userData.setMinutes("");
- userData.setSeconds("");
-
- try {
- assertNull(userData.parse());
- } catch (ParseException e) {
- fail();
- }
- }
-
- public void testParseThrowsParseExceptionWhenInvalidDataIsEnteredForTypeTime() {
- userData = new UserData(null, Locale.getDefault(), getDefaultTimeZoneId(), false, "time");
- userData.setHours("25");
- userData.setMinutes("");
- userData.setSeconds("10");
-
- try {
- userData.parse();
- fail();
- } catch (ParseException e) {
- }
- }
-
- public void testParseGivesCorrectDateWhenValidDataIsEnteredForTypeTime() {
- userData = new UserData(null, Locale.getDefault(), getDefaultTimeZoneId(), false, "time");
- userData.setHours("10");
- userData.setMinutes("50");
- userData.setSeconds("30");
-
- Calendar calendar = Calendar.getInstance(TimeZone.getDefault(), Locale.getDefault());
- calendar.set(Calendar.HOUR_OF_DAY, 10);
- calendar.set(Calendar.MINUTE, 50);
- calendar.set(Calendar.SECOND, 30);
-
- //hour, minute, seconds is considered for equality
- SimpleDateFormat formatter = new SimpleDateFormat("hh:mm:ss");
- try {
- Date date1 = userData.parse();
- Date date2 = calendar.getTime();
- assertEquals(formatter.format(date1), formatter.format(date2));
- } catch (ParseException e) {
- e.printStackTrace();
- }
- }
-
- public void testParseReturnsNullWhenTypeIsFullAndComponentNotUsed() {
- userData = new UserData(null, Locale.ENGLISH, "GMT+2:00", true, "full");
- userData.setDay("");
- userData.setMonth("-1");
- userData.setYear("");
- userData.setHours("");
- userData.setMinutes("");
- userData.setSeconds("");
- userData.setAmpm("-1");
-
- try {
- assertNull(userData.parse());
- } catch (ParseException e) {
- fail();
- }
- }
-
- public void testParseThrowsParseExceptionWhenInvalidDataIsEnteredForTypeFullCase1() {
- userData = new UserData(null, Locale.getDefault(), getDefaultTimeZoneId(), true, "full");
- //date is used, time is not
- userData.setDay("40");
- userData.setMonth("-1");
- userData.setYear("");
- userData.setHours("");
- userData.setMinutes("");
- userData.setSeconds("");
- userData.setAmpm("-1");
-
- try {
- userData.parse();
- fail();
- } catch (ParseException e) {
- }
- }
-
- public void testParseThrowsParseExceptionWhenInvalidDataIsEnteredForTypeFullCase2() {
- userData = new UserData(null, Locale.getDefault(), getDefaultTimeZoneId(), true, "full");
- //date is used time is not
- userData.setDay("");
- userData.setMonth("0");
- userData.setYear("2005");
- userData.setHours("");
- userData.setMinutes("");
- userData.setSeconds("");
- userData.setAmpm("-1");
-
- try {
- userData.parse();
- fail();
- } catch (ParseException e) {
- }
- }
-
- public void testParseThrowsParseExceptionWhenInvalidDataIsEnteredForTypeFullCase3() {
- userData = new UserData(null, Locale.getDefault(), getDefaultTimeZoneId(), true, "full");
- //date is used time is not
- userData.setDay("5");
- userData.setMonth("10");
- userData.setYear("2005");
- userData.setHours("");
- userData.setMinutes("");
- userData.setSeconds("");
- userData.setAmpm("-1");
-
- try {
- userData.parse();
- fail();
- } catch (ParseException e) {
- }
- }
-
- public void testParseThrowsParseExceptionWhenInvalidDataIsEnteredForTypeFullCase4() {
- userData = new UserData(null, Locale.getDefault(), getDefaultTimeZoneId(), true, "full");
- //date is not used but time is
- userData.setDay("");
- userData.setMonth("-1");
- userData.setYear("");
- userData.setHours("");
- userData.setMinutes("30");
- userData.setSeconds("");
- userData.setAmpm("-1");
-
- try {
- userData.parse();
- fail();
- } catch (ParseException e) {
- }
- }
-
-
+
+ private UserData userData;
+
+ private String getDefaultTimeZoneId() {
+ return TimeZone.getDefault().getID();
+ }
+
+ public void testConstructorDoesNotSetDateVariablesWhenTheDateIsNull() {
+ userData = new UserData(null, Locale.getDefault(), getDefaultTimeZoneId() , false, "date");
+ assertNull(userData.getYear());
+ assertNull(userData.getDay());
+ assertNull(userData.getHours());
+ }
+
+ public void testParseReturnsNullWhenTypeIsDateAndComponentNotUsed() {
+ userData = new UserData(null, Locale.getDefault(), getDefaultTimeZoneId(), false, "date");
+ userData.setDay("");
+ userData.setMonth("-1");
+ userData.setYear("");
+ try {
+ Date date = userData.parse();
+ assertNull(date);
+ } catch (ParseException e) {
+ fail();
+ }
+ }
+
+ public void testParseThrowsParseExceptionWhenInvalidDataIsEnteredForTypeDate() {
+ userData = new UserData(null, Locale.getDefault(), getDefaultTimeZoneId(), false, "date");
+ userData.setDay("40");
+ userData.setMonth("-1");
+ userData.setYear("2005");
+ try {
+ userData.parse();
+ fail();
+ } catch (ParseException e) {
+ }
+ }
+
+ public void testParseGivesCorrectDateWhenValidDataIsEnteredForTypeDate() {
+ userData = new UserData(null, Locale.getDefault(), getDefaultTimeZoneId(), false, "date");
+ userData.setDay("20");
+ userData.setMonth("7");
+ userData.setYear("2006");
+
+ Calendar calendar = Calendar.getInstance(TimeZone.getDefault(), Locale.getDefault());
+ calendar.set(Calendar.DAY_OF_MONTH, 20);
+ calendar.set(Calendar.MONTH, 6);
+ calendar.set(Calendar.YEAR, 2006);
+
+ //only day, month and year is considered for equality
+ SimpleDateFormat formatter = new SimpleDateFormat("dd.MM.yyyy");
+ try {
+ Date date1 = userData.parse();
+ Date date2 = calendar.getTime();
+ assertEquals(formatter.format(date1), formatter.format(date2));
+ } catch (ParseException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public void testParseReturnsNullWhenTypeIsTimeAndComponentNotUsed() {
+ userData = new UserData(null, Locale.getDefault(), getDefaultTimeZoneId(), false, "time");
+ userData.setHours("");
+ userData.setMinutes("");
+ userData.setSeconds("");
+
+ try {
+ assertNull(userData.parse());
+ } catch (ParseException e) {
+ fail();
+ }
+ }
+
+ public void testParseThrowsParseExceptionWhenInvalidDataIsEnteredForTypeTime() {
+ userData = new UserData(null, Locale.getDefault(), getDefaultTimeZoneId(), false, "time");
+ userData.setHours("25");
+ userData.setMinutes("");
+ userData.setSeconds("10");
+
+ try {
+ userData.parse();
+ fail();
+ } catch (ParseException e) {
+ }
+ }
+
+ public void testParseGivesCorrectDateWhenValidDataIsEnteredForTypeTime() {
+ userData = new UserData(null, Locale.getDefault(), getDefaultTimeZoneId(), false, "time");
+ userData.setHours("10");
+ userData.setMinutes("50");
+ userData.setSeconds("30");
+
+ Calendar calendar = Calendar.getInstance(TimeZone.getDefault(), Locale.getDefault());
+ calendar.set(Calendar.HOUR_OF_DAY, 10);
+ calendar.set(Calendar.MINUTE, 50);
+ calendar.set(Calendar.SECOND, 30);
+
+ //hour, minute, seconds is considered for equality
+ SimpleDateFormat formatter = new SimpleDateFormat("hh:mm:ss");
+ try {
+ Date date1 = userData.parse();
+ Date date2 = calendar.getTime();
+ assertEquals(formatter.format(date1), formatter.format(date2));
+ } catch (ParseException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public void testParseReturnsNullWhenTypeIsFullAndComponentNotUsed() {
+ userData = new UserData(null, Locale.ENGLISH, "GMT+2:00", true, "full");
+ userData.setDay("");
+ userData.setMonth("-1");
+ userData.setYear("");
+ userData.setHours("");
+ userData.setMinutes("");
+ userData.setSeconds("");
+ userData.setAmpm("-1");
+
+ try {
+ assertNull(userData.parse());
+ } catch (ParseException e) {
+ fail();
+ }
+ }
+
+ public void testParseThrowsParseExceptionWhenInvalidDataIsEnteredForTypeFullCase1() {
+ userData = new UserData(null, Locale.getDefault(), getDefaultTimeZoneId(), true, "full");
+ //date is used, time is not
+ userData.setDay("40");
+ userData.setMonth("-1");
+ userData.setYear("");
+ userData.setHours("");
+ userData.setMinutes("");
+ userData.setSeconds("");
+ userData.setAmpm("-1");
+
+ try {
+ userData.parse();
+ fail();
+ } catch (ParseException e) {
+ }
+ }
+
+ public void testParseThrowsParseExceptionWhenInvalidDataIsEnteredForTypeFullCase2() {
+ userData = new UserData(null, Locale.getDefault(), getDefaultTimeZoneId(), true, "full");
+ //date is used time is not
+ userData.setDay("");
+ userData.setMonth("0");
+ userData.setYear("2005");
+ userData.setHours("");
+ userData.setMinutes("");
+ userData.setSeconds("");
+ userData.setAmpm("-1");
+
+ try {
+ userData.parse();
+ fail();
+ } catch (ParseException e) {
+ }
+ }
+
+ public void testParseThrowsParseExceptionWhenInvalidDataIsEnteredForTypeFullCase3() {
+ userData = new UserData(null, Locale.getDefault(), getDefaultTimeZoneId(), true, "full");
+ //date is used time is not
+ userData.setDay("5");
+ userData.setMonth("10");
+ userData.setYear("2005");
+ userData.setHours("");
+ userData.setMinutes("");
+ userData.setSeconds("");
+ userData.setAmpm("-1");
+
+ try {
+ userData.parse();
+ fail();
+ } catch (ParseException e) {
+ }
+ }
+
+ public void testParseThrowsParseExceptionWhenInvalidDataIsEnteredForTypeFullCase4() {
+ userData = new UserData(null, Locale.getDefault(), getDefaultTimeZoneId(), true, "full");
+ //date is not used but time is
+ userData.setDay("");
+ userData.setMonth("-1");
+ userData.setYear("");
+ userData.setHours("");
+ userData.setMinutes("30");
+ userData.setSeconds("");
+ userData.setAmpm("-1");
+
+ try {
+ userData.parse();
+ fail();
+ } catch (ParseException e) {
+ }
+ }
+
+
}
Modified: myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/custom/savestate/SaveStateTestBean.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/custom/savestate/SaveStateTestBean.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/custom/savestate/SaveStateTestBean.java (original)
+++ myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/custom/savestate/SaveStateTestBean.java Thu Jul 3 14:58:05 2008
@@ -30,45 +30,45 @@
*/
public class SaveStateTestBean implements Serializable, StateHolder {
- private LinkedList linkedList;
+ private LinkedList linkedList;
- private String name;
+ private String name;
- public LinkedList getLinkedList() {
- if(linkedList == null)
- linkedList = new LinkedList();
- return linkedList;
- }
-
- public void setLinkedList(LinkedList linkedList) {
- this.linkedList = linkedList;
- }
-
- public boolean isTransient() {
- return false;
- }
+ public LinkedList getLinkedList() {
+ if(linkedList == null)
+ linkedList = new LinkedList();
+ return linkedList;
+ }
+
+ public void setLinkedList(LinkedList linkedList) {
+ this.linkedList = linkedList;
+ }
+
+ public boolean isTransient() {
+ return false;
+ }
- public void restoreState(FacesContext context, Object state) {
- Object values[] = (Object[])state;
+ public void restoreState(FacesContext context, Object state) {
+ Object values[] = (Object[])state;
name = (String)values[0];
- }
+ }
- public Object saveState(FacesContext context) {
- Object values[] = new Object[1];
+ public Object saveState(FacesContext context) {
+ Object values[] = new Object[1];
values[0] = name;
return values;
- }
+ }
- public void setTransient(boolean newTransientValue) {
-
- }
-
- public String name() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
+ public void setTransient(boolean newTransientValue) {
+
+ }
+
+ public String name() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
}
Modified: myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/custom/savestate/UISaveStateTest.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/custom/savestate/UISaveStateTest.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/custom/savestate/UISaveStateTest.java (original)
+++ myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/custom/savestate/UISaveStateTest.java Thu Jul 3 14:58:05 2008
@@ -33,63 +33,63 @@
*/
public class UISaveStateTest extends AbstractTomahawkViewControllerTestCase{
- private UISaveState saveState;
- private SaveStateTestBean saveStateTestBean;
+ private UISaveState saveState;
+ private SaveStateTestBean saveStateTestBean;
- public UISaveStateTest(String name) {
- super(name);
- }
-
- public static Test suite() {
- return new TestSuite(UISaveStateTest.class);
- }
-
- public void setUp() throws Exception{
- super.setUp();
- saveState = new UISaveState();
- saveStateTestBean = new SaveStateTestBean();
- facesContext.getExternalContext().getRequestMap().put("testBean", saveStateTestBean);
- }
-
- public void tearDown() throws Exception{
- saveState = null;
- saveStateTestBean = null;
- super.tearDown();
- }
-
- public void testWorksWithLinkedList() {
- ValueBinding valueBinding = facesContext.getApplication().createValueBinding("#{testBean.linkedList}");
- saveState.setValueBinding("value", valueBinding);
-
- LinkedList linkedList = (LinkedList) valueBinding.getValue(facesContext);
-
- try {
- Object state = saveState.saveState(facesContext);
- Object values[] = (Object[])state;
- assertEquals(values[2], linkedList);
-
- saveState.restoreState(facesContext, state);
-
- }catch(Exception exception) {
- fail();
- }
- }
-
- public void testWorksWithStateHolder() {
- ValueBinding valueBinding = facesContext.getApplication().createValueBinding("#{testBean}");
- saveState.setValueBinding("value", valueBinding);
-
- SaveStateTestBean testBean = (SaveStateTestBean) valueBinding.getValue(facesContext);
-
- try {
- Object state = saveState.saveState(facesContext);
- Object values[] = (Object[])state;
- assertNotSame(values[2], testBean); //values[2] should be a type of "javax.faces.component._AttachedStateWrapper"
-
- saveState.restoreState(facesContext, state);
- }catch(Exception exception) {
- fail();
- }
- }
+ public UISaveStateTest(String name) {
+ super(name);
+ }
+
+ public static Test suite() {
+ return new TestSuite(UISaveStateTest.class);
+ }
+
+ public void setUp() throws Exception{
+ super.setUp();
+ saveState = new UISaveState();
+ saveStateTestBean = new SaveStateTestBean();
+ facesContext.getExternalContext().getRequestMap().put("testBean", saveStateTestBean);
+ }
+
+ public void tearDown() throws Exception{
+ saveState = null;
+ saveStateTestBean = null;
+ super.tearDown();
+ }
+
+ public void testWorksWithLinkedList() {
+ ValueBinding valueBinding = facesContext.getApplication().createValueBinding("#{testBean.linkedList}");
+ saveState.setValueBinding("value", valueBinding);
+
+ LinkedList linkedList = (LinkedList) valueBinding.getValue(facesContext);
+
+ try {
+ Object state = saveState.saveState(facesContext);
+ Object values[] = (Object[])state;
+ assertEquals(values[2], linkedList);
+
+ saveState.restoreState(facesContext, state);
+
+ }catch(Exception exception) {
+ fail();
+ }
+ }
+
+ public void testWorksWithStateHolder() {
+ ValueBinding valueBinding = facesContext.getApplication().createValueBinding("#{testBean}");
+ saveState.setValueBinding("value", valueBinding);
+
+ SaveStateTestBean testBean = (SaveStateTestBean) valueBinding.getValue(facesContext);
+
+ try {
+ Object state = saveState.saveState(facesContext);
+ Object values[] = (Object[])state;
+ assertNotSame(values[2], testBean); //values[2] should be a type of "javax.faces.component._AttachedStateWrapper"
+
+ saveState.restoreState(facesContext, state);
+ }catch(Exception exception) {
+ fail();
+ }
+ }
}
Modified: myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/custom/selectitems/Movie.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/custom/selectitems/Movie.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/custom/selectitems/Movie.java (original)
+++ myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/custom/selectitems/Movie.java Thu Jul 3 14:58:05 2008
@@ -24,28 +24,28 @@
* Simple test entity
*/
public class Movie {
- private String name;
-
- private String director;
-
- public Movie() {}
-
- public Movie(String name, String director) {
- this.name = name;
- this.director = director;
- }
-
- public String getName() {
- return name;
- }
- public void setName(String name) {
- this.name = name;
- }
+ private String name;
+
+ private String director;
+
+ public Movie() {}
+
+ public Movie(String name, String director) {
+ this.name = name;
+ this.director = director;
+ }
+
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
- public String getDirector() {
- return director;
- }
- public void setDirector(String director) {
- this.director = director;
- }
+ public String getDirector() {
+ return director;
+ }
+ public void setDirector(String director) {
+ this.director = director;
+ }
}
Modified: myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/custom/selectitems/UISelectItemsTest.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/custom/selectitems/UISelectItemsTest.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/custom/selectitems/UISelectItemsTest.java (original)
+++ myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/custom/selectitems/UISelectItemsTest.java Thu Jul 3 14:58:05 2008
@@ -37,106 +37,106 @@
* @version $Revision$ $Date$
*/
public class UISelectItemsTest extends AbstractJsfTestCase{
-
- private UISelectItems selectItems;
-
- private Collection movieCollection;
-
- private Collection movieSelectItemsGroupCollection;
-
- private Map movieMap;
-
- private SelectItem[] movieSelectItems;
+
+ private UISelectItems selectItems;
+
+ private Collection movieCollection;
+
+ private Collection movieSelectItemsGroupCollection;
+
+ private Map movieMap;
+
+ private SelectItem[] movieSelectItems;
- public UISelectItemsTest(String testName) {
- super(testName);
- }
-
- public static Test suite() {
- return new TestSuite(UISelectItemsTest.class);
- }
+ public UISelectItemsTest(String testName) {
+ super(testName);
+ }
+
+ public static Test suite() {
+ return new TestSuite(UISelectItemsTest.class);
+ }
- /**
- * Sets up the test environment for <s:selectItems value="#{PossibleValueHere}" var="Movie" itemLabel="#{Movie.name} itemValue="#{Movie.director}" />
- * Accepted possible values for the component can be a SelectItems array, a collection, a map and SelectItems group collection.
- */
- public void setUp() throws Exception{
- super.setUp();
- //component
- selectItems = new UISelectItems();
- ValueBinding itemLabelVb = facesContext.getApplication().createValueBinding("#{Movie.name}");
- ValueBinding itemValueVb = facesContext.getApplication().createValueBinding("#{Movie.director}");
-
- selectItems.setValueBinding("itemLabel", itemLabelVb);
- selectItems.setValueBinding("itemValue", itemValueVb);
- selectItems.getAttributes().put("var", "Movie");
-
- //entities
- Movie movie1 = new Movie("Godfather", "Francis Ford Coppola");
- Movie movie2 = new Movie("Goodfellas", "Martin Scorsese");
- Movie movie3 = new Movie("Casino", "Martin Scorsese");
- Movie movie4 = new Movie("Scarface", "Brian De Palma");
-
- //different value types
- movieSelectItems = new SelectItem[3];
- movieSelectItems[0] = new SelectItem(movie2.getDirector(), movie2.getName());
- movieSelectItems[1] = new SelectItem(movie3.getDirector(), movie3.getName());
- movieSelectItems[2] = new SelectItem(movie4.getDirector(), movie4.getName());
-
- movieCollection = new ArrayList();
- movieCollection.add(movie1);
- movieCollection.add(movie2);
- movieCollection.add(movie3);
- movieCollection.add(movie4);
-
- movieMap = new HashMap();
- movieMap.put(movie3.getName(), movie3);
- movieMap.put(movie4.getName(), movie4);
+ /**
+ * Sets up the test environment for <s:selectItems value="#{PossibleValueHere}" var="Movie" itemLabel="#{Movie.name} itemValue="#{Movie.director}" />
+ * Accepted possible values for the component can be a SelectItems array, a collection, a map and SelectItems group collection.
+ */
+ public void setUp() throws Exception{
+ super.setUp();
+ //component
+ selectItems = new UISelectItems();
+ ValueBinding itemLabelVb = facesContext.getApplication().createValueBinding("#{Movie.name}");
+ ValueBinding itemValueVb = facesContext.getApplication().createValueBinding("#{Movie.director}");
+
+ selectItems.setValueBinding("itemLabel", itemLabelVb);
+ selectItems.setValueBinding("itemValue", itemValueVb);
+ selectItems.getAttributes().put("var", "Movie");
+
+ //entities
+ Movie movie1 = new Movie("Godfather", "Francis Ford Coppola");
+ Movie movie2 = new Movie("Goodfellas", "Martin Scorsese");
+ Movie movie3 = new Movie("Casino", "Martin Scorsese");
+ Movie movie4 = new Movie("Scarface", "Brian De Palma");
+
+ //different value types
+ movieSelectItems = new SelectItem[3];
+ movieSelectItems[0] = new SelectItem(movie2.getDirector(), movie2.getName());
+ movieSelectItems[1] = new SelectItem(movie3.getDirector(), movie3.getName());
+ movieSelectItems[2] = new SelectItem(movie4.getDirector(), movie4.getName());
+
+ movieCollection = new ArrayList();
+ movieCollection.add(movie1);
+ movieCollection.add(movie2);
+ movieCollection.add(movie3);
+ movieCollection.add(movie4);
+
+ movieMap = new HashMap();
+ movieMap.put(movie3.getName(), movie3);
+ movieMap.put(movie4.getName(), movie4);
- movieSelectItemsGroupCollection = new ArrayList();
- movieSelectItemsGroupCollection.add(createSelectItemGroup("group1", movieSelectItems));
- movieSelectItemsGroupCollection.add(createSelectItemGroup("group2", movieSelectItems));
- }
-
- private SelectItemGroup createSelectItemGroup(String groupName, SelectItem[] items) {
- SelectItemGroup group = new SelectItemGroup();
- group.setLabel(groupName);
- group.setSelectItems(items);
- return group;
- }
-
- public void tearDown() throws Exception{
- selectItems = null;
- super.tearDown();
- }
-
- public void testCreateSelectItemsBySelectItems() {
- selectItems.setValue(movieSelectItems);
- SelectItem[] items = (SelectItem[]) selectItems.getValue();
- assertEquals(items[1].getValue(), new String("Martin Scorsese"));
- assertEquals(items[1].getLabel(), new String("Casino"));
- assertEquals(items.length, 3);
- }
-
- public void testCreateSelectItemsFromCollection() {
- selectItems.setValue(movieCollection);
- SelectItem[] items = (SelectItem[]) selectItems.getValue();
- assertEquals(items[0].getValue(), "Francis Ford Coppola");
- assertEquals(items[0].getLabel(), "Godfather");
- assertEquals(items.length, 4);
- }
-
- public void testCreateSelectItemsFromMap() {
- selectItems.setValue(movieMap);
- SelectItem[] items = (SelectItem[]) selectItems.getValue();
- assertEquals(items.length, 2);
- }
-
- public void testCreateSelectItemsFromSelectItemsGroupCollection() {
- selectItems.setValue(movieSelectItemsGroupCollection);
- SelectItem[] items = (SelectItem[]) selectItems.getValue();
- assertEquals(items[5].getValue(), "Brian De Palma");
- assertEquals(items[5].getLabel(),"Scarface");
- assertEquals(items.length, 6);
- }
+ movieSelectItemsGroupCollection = new ArrayList();
+ movieSelectItemsGroupCollection.add(createSelectItemGroup("group1", movieSelectItems));
+ movieSelectItemsGroupCollection.add(createSelectItemGroup("group2", movieSelectItems));
+ }
+
+ private SelectItemGroup createSelectItemGroup(String groupName, SelectItem[] items) {
+ SelectItemGroup group = new SelectItemGroup();
+ group.setLabel(groupName);
+ group.setSelectItems(items);
+ return group;
+ }
+
+ public void tearDown() throws Exception{
+ selectItems = null;
+ super.tearDown();
+ }
+
+ public void testCreateSelectItemsBySelectItems() {
+ selectItems.setValue(movieSelectItems);
+ SelectItem[] items = (SelectItem[]) selectItems.getValue();
+ assertEquals(items[1].getValue(), new String("Martin Scorsese"));
+ assertEquals(items[1].getLabel(), new String("Casino"));
+ assertEquals(items.length, 3);
+ }
+
+ public void testCreateSelectItemsFromCollection() {
+ selectItems.setValue(movieCollection);
+ SelectItem[] items = (SelectItem[]) selectItems.getValue();
+ assertEquals(items[0].getValue(), "Francis Ford Coppola");
+ assertEquals(items[0].getLabel(), "Godfather");
+ assertEquals(items.length, 4);
+ }
+
+ public void testCreateSelectItemsFromMap() {
+ selectItems.setValue(movieMap);
+ SelectItem[] items = (SelectItem[]) selectItems.getValue();
+ assertEquals(items.length, 2);
+ }
+
+ public void testCreateSelectItemsFromSelectItemsGroupCollection() {
+ selectItems.setValue(movieSelectItemsGroupCollection);
+ SelectItem[] items = (SelectItem[]) selectItems.getValue();
+ assertEquals(items[5].getValue(), "Brian De Palma");
+ assertEquals(items[5].getLabel(),"Scarface");
+ assertEquals(items.length, 6);
+ }
}
Modified: myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/custom/tree2/UITreeDataTest.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/custom/tree2/UITreeDataTest.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/custom/tree2/UITreeDataTest.java (original)
+++ myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/custom/tree2/UITreeDataTest.java Thu Jul 3 14:58:05 2008
@@ -56,7 +56,7 @@
*/
public void testNodeSelected() throws Exception
{
- tree.setClientSideToggle(false);
+ tree.setClientSideToggle(false);
// tree.getAttributes().put(JSFAttr.CLIENT_SIDE_TOGGLE, Boolean.FALSE);
ActionEvent event = new ActionEvent(new HtmlCommandLink());
@@ -67,7 +67,7 @@
assertTrue("Node 0:1:0 should be selected", tree.isNodeSelected());
- tree.setClientSideToggle(true);
+ tree.setClientSideToggle(true);
// tree.getAttributes().put(JSFAttr.CLIENT_SIDE_TOGGLE, Boolean.TRUE);
// set the node to be selected
Modified: myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/dateformat/TestSimpleDateFormatter.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/dateformat/TestSimpleDateFormatter.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/dateformat/TestSimpleDateFormatter.java (original)
+++ myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/dateformat/TestSimpleDateFormatter.java Thu Jul 3 14:58:05 2008
@@ -64,12 +64,12 @@
*/
public void testParseNamedMonth()
{
- Locale locale = Locale.ENGLISH;
+ Locale locale = Locale.ENGLISH;
org.apache.myfaces.dateformat.DateFormatSymbols symbols =
- new org.apache.myfaces.dateformat.DateFormatSymbols(locale);
+ new org.apache.myfaces.dateformat.DateFormatSymbols(locale);
int firstDayOfWeek = 0;
SimpleDateFormatter sdf = new SimpleDateFormatter(
- "dd-MMM-yyyy", symbols, firstDayOfWeek);
+ "dd-MMM-yyyy", symbols, firstDayOfWeek);
Date d = sdf.parse("12-Mar-2008");
assertNotNull(d);
@@ -333,35 +333,35 @@
// 23-31 dec
for(int year = 2000; year < 2020; ++year)
{
- checkWeekFormatAgainstJoda(year, 0, 1);
- checkWeekFormatAgainstJoda(year, 0, 2);
- checkWeekFormatAgainstJoda(year, 0, 3);
- checkWeekFormatAgainstJoda(year, 0, 4);
- checkWeekFormatAgainstJoda(year, 0, 5);
- checkWeekFormatAgainstJoda(year, 0, 6);
- checkWeekFormatAgainstJoda(year, 0, 7);
- checkWeekFormatAgainstJoda(year, 0, 8);
-
- checkWeekFormatAgainstJoda(year, 4, 29);
- checkWeekFormatAgainstJoda(year, 4, 30);
- checkWeekFormatAgainstJoda(year, 5, 1);
- checkWeekFormatAgainstJoda(year, 5, 2);
- checkWeekFormatAgainstJoda(year, 5, 3);
- checkWeekFormatAgainstJoda(year, 5, 4);
- checkWeekFormatAgainstJoda(year, 5, 5);
- checkWeekFormatAgainstJoda(year, 5, 6);
- checkWeekFormatAgainstJoda(year, 5, 7);
- checkWeekFormatAgainstJoda(year, 5, 8);
-
- checkWeekFormatAgainstJoda(year, 11, 23);
- checkWeekFormatAgainstJoda(year, 11, 24);
- checkWeekFormatAgainstJoda(year, 11, 25);
- checkWeekFormatAgainstJoda(year, 11, 26);
- checkWeekFormatAgainstJoda(year, 11, 27);
- checkWeekFormatAgainstJoda(year, 11, 28);
- checkWeekFormatAgainstJoda(year, 11, 29);
- checkWeekFormatAgainstJoda(year, 11, 30);
- checkWeekFormatAgainstJoda(year, 11, 31);
+ checkWeekFormatAgainstJoda(year, 0, 1);
+ checkWeekFormatAgainstJoda(year, 0, 2);
+ checkWeekFormatAgainstJoda(year, 0, 3);
+ checkWeekFormatAgainstJoda(year, 0, 4);
+ checkWeekFormatAgainstJoda(year, 0, 5);
+ checkWeekFormatAgainstJoda(year, 0, 6);
+ checkWeekFormatAgainstJoda(year, 0, 7);
+ checkWeekFormatAgainstJoda(year, 0, 8);
+
+ checkWeekFormatAgainstJoda(year, 4, 29);
+ checkWeekFormatAgainstJoda(year, 4, 30);
+ checkWeekFormatAgainstJoda(year, 5, 1);
+ checkWeekFormatAgainstJoda(year, 5, 2);
+ checkWeekFormatAgainstJoda(year, 5, 3);
+ checkWeekFormatAgainstJoda(year, 5, 4);
+ checkWeekFormatAgainstJoda(year, 5, 5);
+ checkWeekFormatAgainstJoda(year, 5, 6);
+ checkWeekFormatAgainstJoda(year, 5, 7);
+ checkWeekFormatAgainstJoda(year, 5, 8);
+
+ checkWeekFormatAgainstJoda(year, 11, 23);
+ checkWeekFormatAgainstJoda(year, 11, 24);
+ checkWeekFormatAgainstJoda(year, 11, 25);
+ checkWeekFormatAgainstJoda(year, 11, 26);
+ checkWeekFormatAgainstJoda(year, 11, 27);
+ checkWeekFormatAgainstJoda(year, 11, 28);
+ checkWeekFormatAgainstJoda(year, 11, 29);
+ checkWeekFormatAgainstJoda(year, 11, 30);
+ checkWeekFormatAgainstJoda(year, 11, 31);
}
}
Modified: myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/test/AbstractTagLibTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/test/AbstractTagLibTestCase.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/test/AbstractTagLibTestCase.java (original)
+++ myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/test/AbstractTagLibTestCase.java Thu Jul 3 14:58:05 2008
@@ -51,190 +51,190 @@
*/
public abstract class AbstractTagLibTestCase extends TestCase {
- private static Log log = LogFactory.getLog(AbstractTagLibTestCase.class);
+ private static Log log = LogFactory.getLog(AbstractTagLibTestCase.class);
- protected Tld[] tlds;
+ protected Tld[] tlds;
- protected String[] tldPaths;
-
- private ClassLoader classLoader = getClass().getClassLoader();
+ protected String[] tldPaths;
+
+ private ClassLoader classLoader = getClass().getClassLoader();
- /**
- * Unmarshall TLDs to an object model. TLDs are supplied by a subclass.
- */
+ /**
+ * Unmarshall TLDs to an object model. TLDs are supplied by a subclass.
+ */
- protected void setUp() throws Exception {
+ protected void setUp() throws Exception {
- if (tldPaths == null)
- throw new NullPointerException(
- "tldPaths cannot point to null before setUp() is called");
+ if (tldPaths == null)
+ throw new NullPointerException(
+ "tldPaths cannot point to null before setUp() is called");
- int length = tldPaths.length;
+ int length = tldPaths.length;
- if (length == 0)
- throw new IllegalStateException(
- "tldPaths should have at least one resource path");
+ if (length == 0)
+ throw new IllegalStateException(
+ "tldPaths should have at least one resource path");
- tlds = new Tld[length];
+ tlds = new Tld[length];
- for (int t = 0; t < length; t++) {
- String name = tldPaths[t];
+ for (int t = 0; t < length; t++) {
+ String name = tldPaths[t];
- InputStream stream = classLoader.getResourceAsStream(name);
+ InputStream stream = classLoader.getResourceAsStream(name);
- if (stream == null)
- throw new NullPointerException(
- "couldn't get an input stream for " + name);
+ if (stream == null)
+ throw new NullPointerException(
+ "couldn't get an input stream for " + name);
- tlds[t] = TldTestUtils.getTld(name, stream);
- stream.close();
- }
- }
+ tlds[t] = TldTestUtils.getTld(name, stream);
+ stream.close();
+ }
+ }
- public void testUniqueTagTestCase() throws Exception {
+ public void testUniqueTagTestCase() throws Exception {
- for (int lib = 0; lib < tlds.length; lib++) {
- Tld tld = tlds[lib];
- List tagNames = new ArrayList();
- Tag[] tags = tld.getTags();
+ for (int lib = 0; lib < tlds.length; lib++) {
+ Tld tld = tlds[lib];
+ List tagNames = new ArrayList();
+ Tag[] tags = tld.getTags();
- for (int t = 0; t < tags.length; t++) {
- Tag tag = tags[t];
+ for (int t = 0; t < tags.length; t++) {
+ Tag tag = tags[t];
- if (tag == null)
- throw new NullPointerException("tag");
+ if (tag == null)
+ throw new NullPointerException("tag");
- String name = tag.getName();
- String msg = name + " found more than once in " + tldPaths[lib];
- assertFalse(msg, tagNames.contains(name));
- tagNames.add(name);
- } // end t
- } // end lib
- }
+ String name = tag.getName();
+ String msg = name + " found more than once in " + tldPaths[lib];
+ assertFalse(msg, tagNames.contains(name));
+ tagNames.add(name);
+ } // end t
+ } // end lib
+ }
- public void testUniqueTagAttributes() throws Exception {
+ public void testUniqueTagAttributes() throws Exception {
- for (int lib = 0; lib < tlds.length; lib++) {
- Tld tld = tlds[lib];
- Tag[] tags = tld.getTags();
+ for (int lib = 0; lib < tlds.length; lib++) {
+ Tld tld = tlds[lib];
+ Tag[] tags = tld.getTags();
- for (int t = 0; t < tags.length; t++) {
+ for (int t = 0; t < tags.length; t++) {
- Tag tag = tags[t];
- assertUniqueTagAttributes(tag, tldPaths[lib]);
+ Tag tag = tags[t];
+ assertUniqueTagAttributes(tag, tldPaths[lib]);
- } // end t
- } // end lib
- }
+ } // end t
+ } // end lib
+ }
- private void assertUniqueTagAttributes(final Tag tag, final String path) {
+ private void assertUniqueTagAttributes(final Tag tag, final String path) {
- List attributeNames = new ArrayList();
- TagAttribute[] atts = tag.getAttributes();
- String tagName = tag.getName();
+ List attributeNames = new ArrayList();
+ TagAttribute[] atts = tag.getAttributes();
+ String tagName = tag.getName();
- for (int a = 0; a < atts.length;) {
+ for (int a = 0; a < atts.length;) {
- TagAttribute att = atts[a++];
- String name = att.getAttributeName();
- String msg = " @" + name + " of " + path + ":" + tagName
- + " is duplicated.";
- assertFalse(msg, attributeNames.contains(name));
- attributeNames.add(name);
+ TagAttribute att = atts[a++];
+ String name = att.getAttributeName();
+ String msg = " @" + name + " of " + path + ":" + tagName
+ + " is duplicated.";
+ assertFalse(msg, attributeNames.contains(name));
+ attributeNames.add(name);
- } // end a
+ } // end a
- }
+ }
- /**
- * Make sure the class exists. Make sure there is a setter for each
- * attribute.
- */
+ /**
+ * Make sure the class exists. Make sure there is a setter for each
+ * attribute.
+ */
- public void testSetters() throws Exception {
+ public void testSetters() throws Exception {
- for (int t = 0; t < tlds.length; t++) {
- Tld tld = tlds[t];
- Tag[] tags = tld.getTags();
+ for (int t = 0; t < tlds.length; t++) {
+ Tld tld = tlds[t];
+ Tag[] tags = tld.getTags();
- for (int s = 0; s < tags.length; s++) {
- Tag tag = tags[s];
- String filename = tld.getFilename();
+ for (int s = 0; s < tags.length; s++) {
+ Tag tag = tags[s];
+ String filename = tld.getFilename();
- Object object = TldTestUtils.makeTagClassInstance(tag,
- filename, classLoader);
+ Object object = TldTestUtils.makeTagClassInstance(tag,
+ filename, classLoader);
log.debug("filename = " + filename + " ; tag = " + tag.getName());
assertSetters(tag, filename, object);
- } // end for tag
- } // end for lib
+ } // end for tag
+ } // end for lib
- }
+ }
- private void assertSetters(final Tag tag, final String path,
- final Object object) {
+ private void assertSetters(final Tag tag, final String path,
+ final Object object) {
- TagAttribute[] attributes = tag.getAttributes();
- String tagName = tag.getName();
+ TagAttribute[] attributes = tag.getAttributes();
+ String tagName = tag.getName();
- for (int a = 0; a < attributes.length; a++) {
- TagAttribute attribute = attributes[a];
- String name = attribute.getAttributeName();
+ for (int a = 0; a < attributes.length; a++) {
+ TagAttribute attribute = attributes[a];
+ String name = attribute.getAttributeName();
- if (name == null || "".equals(name.trim()))
- throw new IllegalStateException(path + ":" + tagName
- + " has a nameless attribute ");
+ if (name == null || "".equals(name.trim()))
+ throw new IllegalStateException(path + ":" + tagName
+ + " has a nameless attribute ");
- String msg = path + ":" + tagName + "@" + name
- + " exists, but " + object.getClass().getName()
- + " has no setter.";
-
- assertTrue(msg, PropertyUtils.isWriteable(object, name));
- } // end for attributes
+ String msg = path + ":" + tagName + "@" + name
+ + " exists, but " + object.getClass().getName()
+ + " has no setter.";
+
+ assertTrue(msg, PropertyUtils.isWriteable(object, name));
+ } // end for attributes
- }
+ }
- private static class TldTestUtils {
- private static Log log = LogFactory.getLog(TldTestUtils.class);
+ private static class TldTestUtils {
+ private static Log log = LogFactory.getLog(TldTestUtils.class);
- private static DocumentBuilderFactory dbf = DocumentBuilderFactory
- .newInstance();
+ private static DocumentBuilderFactory dbf = DocumentBuilderFactory
+ .newInstance();
- public static Tld getTld(String name, InputStream stream)
- throws Exception {
- if (stream == null)
- log.error(" input stream is null ");
+ public static Tld getTld(String name, InputStream stream)
+ throws Exception {
+ if (stream == null)
+ log.error(" input stream is null ");
- DocumentBuilder db = dbf.newDocumentBuilder();
- Document doc = db.parse(stream);
+ DocumentBuilder db = dbf.newDocumentBuilder();
+ Document doc = db.parse(stream);
- return TldParser.parse(doc, name);
- }
+ return TldParser.parse(doc, name);
+ }
- public static Object makeTagClassInstance(Tag tag, String filename,
- ClassLoader classLoader) throws Exception {
+ public static Object makeTagClassInstance(Tag tag, String filename,
+ ClassLoader classLoader) throws Exception {
- String clazzName = tag.getTagClass();
+ String clazzName = tag.getTagClass();
- if (clazzName == null || "".equals(clazzName.trim()))
- throw new NullPointerException(tag.getName()
- + " is missing a tag class.");
+ if (clazzName == null || "".equals(clazzName.trim()))
+ throw new NullPointerException(tag.getName()
+ + " is missing a tag class.");
- try {
+ try {
- Class clazz = classLoader.loadClass(clazzName);
- return clazz.newInstance();
+ Class clazz = classLoader.loadClass(clazzName);
+ return clazz.newInstance();
- } catch (ClassNotFoundException e) {
- throw new ClassNotFoundException(clazzName);
- } catch (IllegalAccessException ie) {
- throw new IllegalAccessException(clazzName);
- } catch (InstantiationException iste) {
- throw new InstantiationException(clazzName);
- }
+ } catch (ClassNotFoundException e) {
+ throw new ClassNotFoundException(clazzName);
+ } catch (IllegalAccessException ie) {
+ throw new IllegalAccessException(clazzName);
+ } catch (InstantiationException iste) {
+ throw new InstantiationException(clazzName);
+ }
- }
+ }
- }
+ }
}
\ No newline at end of file
Modified: myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/test/MyFacesTagLibTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/test/MyFacesTagLibTestCase.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/test/MyFacesTagLibTestCase.java (original)
+++ myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/test/MyFacesTagLibTestCase.java Thu Jul 3 14:58:05 2008
@@ -25,18 +25,18 @@
public class MyFacesTagLibTestCase extends AbstractTagLibTestCase {
- protected static final String META_INF = "META-INF/";
+ protected static final String META_INF = "META-INF/";
- public MyFacesTagLibTestCase(){
+ public MyFacesTagLibTestCase(){
- // TODO get the sandbox in here
+ // TODO get the sandbox in here
- tldPaths = new String[3];
- tldPaths[0] = META_INF + "myfaces_html.tld";
- tldPaths[1] = META_INF + "myfaces_core.tld";
- tldPaths[2] = META_INF + "tomahawk.tld";
- // tldPaths[3] = META_INF + "myfaces_sandbox.tld";
+ tldPaths = new String[3];
+ tldPaths[0] = META_INF + "myfaces_html.tld";
+ tldPaths[1] = META_INF + "myfaces_core.tld";
+ tldPaths[2] = META_INF + "tomahawk.tld";
+ // tldPaths[3] = META_INF + "myfaces_sandbox.tld";
- }
+ }
}