Permalink
Browse files

Change project build to enforce (as errors) some sloppy coding such a…

…s unused imports

git-svn-id: https://svn.apache.org/repos/asf/tapestry/tapestry5/trunk@575936 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
1 parent 29b300a commit 2bdd5ef68ff0d260813a27c329e2a9352407c790 @hlship hlship committed Sep 15, 2007
Showing with 92 additions and 143 deletions.
  1. +8 −7 .settings/org.eclipse.jdt.core.prefs
  2. +0 −3 .settings/org.eclipse.jdt.ui.prefs
  3. +5 −2 tapestry-component-report/src/main/java/org/apache/tapestry/mojo/ComponentReport.java
  4. +0 −1 tapestry-component-report/src/main/java/org/apache/tapestry/mojo/ParametersDoclet.java
  5. +10 −0 tapestry-core/src/main/java/org/apache/tapestry/corelib/base/AbstractField.java
  6. +2 −14 tapestry-core/src/main/java/org/apache/tapestry/corelib/components/BeanEditForm.java
  7. +1 −0 tapestry-core/src/main/java/org/apache/tapestry/internal/parser/DTDToken.java
  8. +0 −1 tapestry-core/src/main/java/org/apache/tapestry/internal/services/BeanModelSourceImpl.java
  9. +2 −3 tapestry-core/src/main/java/org/apache/tapestry/internal/services/ContextImpl.java
  10. +2 −7 tapestry-core/src/main/java/org/apache/tapestry/internal/services/LinkFactoryImpl.java
  11. +2 −5 tapestry-core/src/main/java/org/apache/tapestry/internal/services/RootPathDispatcher.java
  12. +1 −3 tapestry-core/src/main/java/org/apache/tapestry/json/JSONArray.java
  13. +4 −2 tapestry-core/src/main/java/org/apache/tapestry/json/JSONObject.java
  14. +1 −0 tapestry-core/src/main/java/org/apache/tapestry/json/JSONTokener.java
  15. +1 −7 tapestry-core/src/main/java/org/apache/tapestry/services/TapestryModule.java
  16. +6 −0 tapestry-core/src/main/java/org/apache/tapestry/test/TapestryTestCase.java
  17. +0 −1 tapestry-core/src/test/java/org/apache/tapestry/corelib/components/BeanEditFormTest.java
  18. +0 −7 tapestry-core/src/test/java/org/apache/tapestry/corelib/components/SubmitTest.java
  19. +0 −2 tapestry-core/src/test/java/org/apache/tapestry/internal/TapestryInternalUtilsTest.java
  20. +0 −1 tapestry-core/src/test/java/org/apache/tapestry/internal/bindings/TargetBean.java
  21. +0 −2 tapestry-core/src/test/java/org/apache/tapestry/internal/services/BeanModelSourceImplTest.java
  22. +5 −16 tapestry-core/src/test/java/org/apache/tapestry/internal/services/LinkFactoryImplTest.java
  23. +4 −4 tapestry-core/src/test/java/org/apache/tapestry/internal/services/PageRenderDispatcherTest.java
  24. +0 −3 tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/InternalRegistry.java
  25. +1 −0 tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/ServiceResourcesImpl.java
  26. +1 −0 tapestry-ioc/src/main/java/org/apache/tapestry/ioc/services/CoercionTuple.java
  27. +18 −2 tapestry-upload/src/main/java/org/apache/tapestry/upload/components/Upload.java
  28. +2 −0 tapestry-upload/src/main/java/org/apache/tapestry/upload/services/ParameterValue.java
  29. +5 −1 ...try-upload/src/main/java/org/apache/tapestry/upload/services/ParametersServletRequestWrapper.java
  30. +11 −49 tapestry-upload/src/test/java/org/apache/tapestry/upload/components/UploadTest.java
View
15 .settings/org.eclipse.jdt.core.prefs
@@ -1,8 +1,8 @@
-#Mon Jul 30 09:36:58 PDT 2007
+#Sat Sep 15 07:54:57 PDT 2007
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.compliance=1.5
-org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=error
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
org.eclipse.jdt.core.compiler.problem.deprecation=warning
@@ -22,8 +22,8 @@ org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
-org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=error
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=error
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
@@ -33,6 +33,7 @@ org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
org.eclipse.jdt.core.compiler.problem.parameterAssignment=warning
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=error
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
@@ -42,13 +43,13 @@ org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
-org.eclipse.jdt.core.compiler.problem.unusedImport=warning
+org.eclipse.jdt.core.compiler.problem.unusedImport=error
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
-org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=error
org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
View
3 .settings/org.eclipse.jdt.ui.prefs
@@ -1,3 +0,0 @@
-#Mon Jul 30 09:36:58 PDT 2007
-eclipse.preferences.version=1
-internal.default.compliance=default
View
7 tapestry-component-report/src/main/java/org/apache/tapestry/mojo/ComponentReport.java
@@ -95,16 +95,19 @@
*/
private String workDirectory;
+ @Override
protected String getOutputDirectory()
{
return outputDirectory;
}
+ @Override
protected MavenProject getProject()
{
return project;
}
+ @Override
protected SiteRenderer getSiteRenderer()
{
return siteRenderer;
@@ -345,7 +348,7 @@ private void cell(Sink sink, String value)
@SuppressWarnings("unchecked")
private String sourcePath()
{
- List<String> roots = (List<String>) project.getCompileSourceRoots();
+ List<String> roots = project.getCompileSourceRoots();
return toArgumentPath(roots);
}
@@ -401,7 +404,7 @@ private String docletPath() throws MavenReportException
@SuppressWarnings("unchecked")
private String classPath() throws MavenReportException
{
- List<Artifact> artifacts = (List<Artifact>) project.getCompileArtifacts();
+ List<Artifact> artifacts = project.getCompileArtifacts();
return artifactsToArgumentPath(artifacts);
}
View
1 tapestry-component-report/src/main/java/org/apache/tapestry/mojo/ParametersDoclet.java
@@ -18,7 +18,6 @@
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.HashSet;
-import java.util.LinkedList;
import java.util.Map;
import java.util.Set;
import java.util.regex.Pattern;
View
10 tapestry-core/src/main/java/org/apache/tapestry/corelib/base/AbstractField.java
@@ -240,4 +240,14 @@ protected final ValidationDecorator getValidationDecorator()
{
return _decorator;
}
+
+ protected final void setDecorator(ValidationDecorator decorator)
+ {
+ _decorator = decorator;
+ }
+
+ protected final void setFormSupport(FormSupport formSupport)
+ {
+ _formSupport = formSupport;
+ }
}
View
16 tapestry-core/src/main/java/org/apache/tapestry/corelib/components/BeanEditForm.java
@@ -14,37 +14,25 @@
package org.apache.tapestry.corelib.components;
-import java.util.Locale;
-
import org.apache.tapestry.Binding;
-import org.apache.tapestry.Block;
import org.apache.tapestry.ClientElement;
import org.apache.tapestry.ComponentResources;
import org.apache.tapestry.Field;
-import org.apache.tapestry.FieldValidator;
import org.apache.tapestry.FormValidationControl;
-import org.apache.tapestry.Translator;
import org.apache.tapestry.annotations.Component;
import org.apache.tapestry.annotations.Inject;
import org.apache.tapestry.annotations.Parameter;
import org.apache.tapestry.annotations.SupportsInformalParameters;
import org.apache.tapestry.beaneditor.BeanModel;
-import org.apache.tapestry.beaneditor.PropertyModel;
-import org.apache.tapestry.ioc.Messages;
import org.apache.tapestry.ioc.internal.util.TapestryException;
-import org.apache.tapestry.services.BeanBlockSource;
import org.apache.tapestry.services.BeanModelSource;
import org.apache.tapestry.services.ComponentDefaultProvider;
-import org.apache.tapestry.services.Environment;
-import org.apache.tapestry.services.FieldValidatorDefaultSource;
-import org.apache.tapestry.services.PropertyEditContext;
-import org.apache.tapestry.services.TranslatorDefaultSource;
/**
- * A component that creates an entire form editting the properties of a particular bean. Inspired by
+ * A component that creates an entire form editing the properties of a particular bean. Inspired by
* <a href="http://www.trailsframework.org/">Trails</a> and <a
* href="http://beanform.sourceforge.net/">BeanForm</a> (both for Tapestry 4). Generates a simple
- * UI for editting the properties of a JavaBean, with the flavor of UI for each property (text
+ * UI for editing the properties of a JavaBean, with the flavor of UI for each property (text
* field, checkbox, drop down list) determined from the property type, and the order and validation
* for the properties determined from annotations on the property's getter and setter methods.
* <p>
View
1 tapestry-core/src/main/java/org/apache/tapestry/internal/parser/DTDToken.java
@@ -57,6 +57,7 @@ public String getSystemId()
return _systemId;
}
+ @Override
public String toString()
{
return String.format("DTD[name=%s; publicId=%s; systemId=%s]", _name, _publicId, _systemId);
View
1 tapestry-core/src/main/java/org/apache/tapestry/internal/services/BeanModelSourceImpl.java
@@ -28,7 +28,6 @@
import org.apache.tapestry.internal.beaneditor.BeanModelImpl;
import org.apache.tapestry.ioc.LoggerSource;
import org.apache.tapestry.ioc.Messages;
-import org.apache.tapestry.ioc.internal.util.CollectionFactory;
import org.apache.tapestry.ioc.services.ClassFactory;
import org.apache.tapestry.ioc.services.ClassPropertyAdapter;
import org.apache.tapestry.ioc.services.PropertyAccess;
View
5 tapestry-core/src/main/java/org/apache/tapestry/internal/services/ContextImpl.java
@@ -66,13 +66,12 @@ public String getInitParameter(String name)
{
String current = queue.pop();
- Set<String> matches = (Set<String>) _servletContext.getResourcePaths(current);
+ Set<String> matches = _servletContext.getResourcePaths(current);
// Tomcat 5.5.20 inside JBoss 4.0.2 has been observed to do this!
// Perhaps other servers do as well.
- if (matches == null)
- continue;
+ if (matches == null) continue;
for (String match : matches)
{
View
9 tapestry-core/src/main/java/org/apache/tapestry/internal/services/LinkFactoryImpl.java
@@ -34,7 +34,6 @@
import org.apache.tapestry.ioc.services.TypeCoercer;
import org.apache.tapestry.ioc.util.StrategyRegistry;
import org.apache.tapestry.runtime.Component;
-import org.apache.tapestry.services.ComponentClassResolver;
import org.apache.tapestry.services.Request;
import org.apache.tapestry.services.Response;
@@ -44,8 +43,6 @@
private final Response _response;
- private final ComponentClassResolver _componentClassResolver;
-
private final ComponentInvocationMap _componentInvocationMap;
private final RequestPageCache _pageCache;
@@ -62,13 +59,11 @@
}
public LinkFactoryImpl(Request request, Response encoder,
- ComponentClassResolver componentClassResolver,
- ComponentInvocationMap componentInvocationMap, RequestPageCache pageCache,
- TypeCoercer typeCoercer)
+ ComponentInvocationMap componentInvocationMap,
+ RequestPageCache pageCache, TypeCoercer typeCoercer)
{
_request = request;
_response = encoder;
- _componentClassResolver = componentClassResolver;
_componentInvocationMap = componentInvocationMap;
_pageCache = pageCache;
_typeCoercer = typeCoercer;
View
7 tapestry-core/src/main/java/org/apache/tapestry/internal/services/RootPathDispatcher.java
@@ -32,19 +32,16 @@
private final PageRenderRequestHandler _handler;
- private final PageResponseRenderer _renderer;
-
+
private final String _startPageName;
private final String[] _emptyContext = new String[0];
public RootPathDispatcher(final ComponentClassResolver componentClassResolver,
- final PageRenderRequestHandler handler, final PageResponseRenderer renderer,
- final String startPageName)
+ final PageRenderRequestHandler handler, final String startPageName)
{
_componentClassResolver = componentClassResolver;
_handler = handler;
- _renderer = renderer;
_startPageName = startPageName;
}
View
4 tapestry-core/src/main/java/org/apache/tapestry/json/JSONArray.java
@@ -38,9 +38,6 @@ of this software and associated documentation files (the "Software"), to deal
SOFTWARE.
*/
-import java.io.IOException;
-import java.io.Writer;
-import java.util.Collection;
import java.util.List;
import org.apache.tapestry.ioc.internal.util.CollectionFactory;
@@ -414,6 +411,7 @@ public JSONArray put(int index, Object value)
*
* @return a printable, displayable, transmittable representation of the array.
*/
+ @Override
public String toString()
{
try
View
6 tapestry-core/src/main/java/org/apache/tapestry/json/JSONObject.java
@@ -38,8 +38,6 @@ of this software and associated documentation files (the "Software"), to deal
SOFTWARE.
*/
-import java.io.IOException;
-import java.io.Writer;
import java.util.Map;
import java.util.Set;
@@ -115,6 +113,7 @@ of this software and associated documentation files (the "Software"), to deal
*
* @return NULL.
*/
+ @Override
protected final Object clone()
{
return this;
@@ -127,6 +126,7 @@ protected final Object clone()
* An object to test for nullness.
* @return true if the object parameter is the JSONObject.NULL object or null.
*/
+ @Override
public boolean equals(Object object)
{
return object == null || object == this;
@@ -137,6 +137,7 @@ public boolean equals(Object object)
*
* @return The string "null".
*/
+ @Override
public String toString()
{
return "null";
@@ -797,6 +798,7 @@ static void testValidity(Object value)
* beginning with <code>{</code>&nbsp;<small>(left brace)</small> and ending with
* <code>}</code>&nbsp;<small>(right brace)</small>.
*/
+ @Override
public String toString()
{
boolean comma = false;
View
1 tapestry-core/src/main/java/org/apache/tapestry/json/JSONTokener.java
@@ -503,6 +503,7 @@ RuntimeException syntaxError(String message)
*
* @return " at character [myIndex] of [mySource]"
*/
+ @Override
public String toString()
{
return " at character " + _index + " of " + _source;
View
8 tapestry-core/src/main/java/org/apache/tapestry/services/TapestryModule.java
@@ -129,7 +129,6 @@
import org.apache.tapestry.internal.services.PageRenderDispatcher;
import org.apache.tapestry.internal.services.PageRenderRequestHandlerImpl;
import org.apache.tapestry.internal.services.PageRenderSupportImpl;
-import org.apache.tapestry.internal.services.PageResponseRenderer;
import org.apache.tapestry.internal.services.ParameterWorker;
import org.apache.tapestry.internal.services.PersistWorker;
import org.apache.tapestry.internal.services.PersistentFieldManagerImpl;
@@ -863,8 +862,6 @@ private static void add(OrderedConfiguration<ComponentClassTransformWorker> conf
private final RequestPageCache _requestPageCache;
- private final PageResponseRenderer _pageResponseRenderer;
-
private final Environment _environment;
private final StrategyBuilder _strategyBuilder;
@@ -889,8 +886,6 @@ public TapestryModule(PipelineBuilder pipelineBuilder,
RequestPageCache requestPageCache,
- PageResponseRenderer pageResponseRenderer,
-
Environment environment,
StrategyBuilder strategyBuilder,
@@ -910,7 +905,6 @@ public TapestryModule(PipelineBuilder pipelineBuilder,
_applicationGlobals = applicationGlobals;
_chainBuilder = chainBuilder;
_requestPageCache = requestPageCache;
- _pageResponseRenderer = pageResponseRenderer;
_environment = environment;
_strategyBuilder = strategyBuilder;
_componentInstantiatorSource = componentInstantiatorSource;
@@ -1335,7 +1329,7 @@ public void contributeMasterDispatcher(OrderedConfiguration<Dispatcher> configur
// Looks for the root path and renders the start page
configuration.add("RootPath", new RootPathDispatcher(componentClassResolver,
- pageRenderRequestHandler, _pageResponseRenderer, startPageName), "before:Asset");
+ pageRenderRequestHandler, startPageName), "before:Asset");
// This goes first because an asset to be streamed may have an file extension, such as
// ".html", that will confuse the later dispatchers.
View
6 tapestry-core/src/main/java/org/apache/tapestry/test/TapestryTestCase.java
@@ -82,6 +82,7 @@
import org.apache.tapestry.services.Context;
import org.apache.tapestry.services.Environment;
import org.apache.tapestry.services.FieldValidatorSource;
+import org.apache.tapestry.services.FormSupport;
import org.apache.tapestry.services.Heartbeat;
import org.apache.tapestry.services.InjectionProvider;
import org.apache.tapestry.services.MethodFilter;
@@ -980,4 +981,9 @@ protected final void train_getPageName(ComponentResourcesCommon resources, Strin
expect(resources.getPageName()).andReturn(pageName).atLeastOnce();
}
+ protected final FormSupport mockFormSupport()
+ {
+ return newMock(FormSupport.class);
+ }
+
}
View
1 tapestry-core/src/test/java/org/apache/tapestry/corelib/components/BeanEditFormTest.java
@@ -22,7 +22,6 @@
import org.apache.tapestry.integration.app1.data.RegistrationData;
import org.apache.tapestry.ioc.Location;
import org.apache.tapestry.ioc.internal.util.TapestryException;
-import org.apache.tapestry.services.PropertyEditContext;
import org.apache.tapestry.services.BeanModelSource;
import org.apache.tapestry.services.Environment;
import org.apache.tapestry.test.TapestryTestCase;
View
7 tapestry-core/src/test/java/org/apache/tapestry/corelib/components/SubmitTest.java
@@ -105,12 +105,5 @@ public void trigger_immediate()
heartbeat.end();
verify();
-
}
-
- protected final FormSupport mockFormSupport()
- {
- return newMock(FormSupport.class);
- }
-
}
View
2 tapestry-core/src/test/java/org/apache/tapestry/internal/TapestryInternalUtilsTest.java
@@ -27,9 +27,7 @@
import org.apache.tapestry.ComponentResources;
import org.apache.tapestry.OptionModel;
-import org.apache.tapestry.PropertyConduit;
import org.apache.tapestry.SelectModel;
-import org.apache.tapestry.beaneditor.OrderBefore;
import org.apache.tapestry.internal.test.InternalBaseTestCase;
import org.apache.tapestry.ioc.Messages;
import org.apache.tapestry.ioc.services.ClassFactory;
View
1 tapestry-core/src/test/java/org/apache/tapestry/internal/bindings/TargetBean.java
@@ -17,7 +17,6 @@
import org.apache.tapestry.annotations.BeforeRenderBody;
import org.apache.tapestry.beaneditor.OrderAfter;
import org.apache.tapestry.beaneditor.OrderBefore;
-import org.apache.tapestry.ioc.annotations.Symbol;
public class TargetBean extends DefaultComponent
{
View
2 ...try-core/src/test/java/org/apache/tapestry/internal/services/BeanModelSourceImplTest.java
@@ -148,8 +148,6 @@ public void add_before_using_default_conduit()
ComponentResources resources = mockComponentResources();
Messages messages = mockMessages();
- Class propertyType = String.class;
-
train_getMessages(resources, messages);
stub_contains(messages, false);
View
21 tapestry-core/src/test/java/org/apache/tapestry/internal/services/LinkFactoryImplTest.java
@@ -27,7 +27,6 @@
import org.apache.tapestry.internal.test.InternalBaseTestCase;
import org.apache.tapestry.internal.util.Holder;
import org.apache.tapestry.ioc.services.TypeCoercer;
-import org.apache.tapestry.services.ComponentClassResolver;
import org.apache.tapestry.services.Request;
import org.apache.tapestry.services.Response;
import org.easymock.EasyMock;
@@ -124,7 +123,6 @@ public void page_link()
{
Request request = mockRequest();
Response response = mockResponse();
- ComponentClassResolver resolver = mockComponentClassResolver();
Page page = mockPage();
ComponentPageElement rootElement = mockComponentPageElement();
LinkFactoryListener listener = mockLinkFactoryListener();
@@ -150,8 +148,7 @@ public void page_link()
replay();
- LinkFactory factory = new LinkFactoryImpl(request, response, resolver, map, null,
- _typeCoercer);
+ LinkFactory factory = new LinkFactoryImpl(request, response, map, null, _typeCoercer);
factory.addListener(listener);
Link link = factory.createPageLink(page, false);
@@ -171,7 +168,6 @@ public void page_link_using_supplied_activation_context()
{
Request request = mockRequest();
Response response = mockResponse();
- ComponentClassResolver resolver = mockComponentClassResolver();
Page page = mockPage();
LinkFactoryListener listener = mockLinkFactoryListener();
ComponentInvocationMap map = mockComponentInvocationMap();
@@ -195,8 +191,7 @@ public void page_link_using_supplied_activation_context()
replay();
- LinkFactory factory = new LinkFactoryImpl(request, response, resolver, map, null,
- _typeCoercer);
+ LinkFactory factory = new LinkFactoryImpl(request, response, map, null, _typeCoercer);
factory.addListener(listener);
Link link = factory.createPageLink(page, false, "biff", "bazz");
@@ -216,7 +211,6 @@ public void page_link_using_empty_activation_context_and_override()
{
Request request = mockRequest();
Response response = mockResponse();
- ComponentClassResolver resolver = mockComponentClassResolver();
Page page = mockPage();
LinkFactoryListener listener = mockLinkFactoryListener();
ComponentInvocationMap map = mockComponentInvocationMap();
@@ -239,8 +233,7 @@ public void page_link_using_empty_activation_context_and_override()
replay();
- LinkFactory factory = new LinkFactoryImpl(request, response, resolver, map, null,
- _typeCoercer);
+ LinkFactory factory = new LinkFactoryImpl(request, response, map, null, _typeCoercer);
factory.addListener(listener);
Link link = factory.createPageLink(page, true);
@@ -259,7 +252,6 @@ public void page_link_by_name()
{
Request request = mockRequest();
Response response = mockResponse();
- ComponentClassResolver resolver = mockComponentClassResolver();
Page page = mockPage();
ComponentPageElement rootElement = mockComponentPageElement();
LinkFactoryListener listener = mockLinkFactoryListener();
@@ -289,8 +281,7 @@ public void page_link_by_name()
replay();
- LinkFactory factory = new LinkFactoryImpl(request, response, resolver, map, cache,
- _typeCoercer);
+ LinkFactory factory = new LinkFactoryImpl(request, response, map, cache, _typeCoercer);
factory.addListener(listener);
Link link = factory.createPageLink(PAGE_LOGICAL_NAME, false);
@@ -385,7 +376,6 @@ private void testActionLink(String contextPath, String logicalPageName, String n
{
Request request = mockRequest();
Response response = mockResponse();
- ComponentClassResolver resolver = mockComponentClassResolver();
ComponentPageElement element = mockComponentPageElement();
Page page = mockPage();
ComponentPageElement rootElement = mockComponentPageElement();
@@ -414,8 +404,7 @@ private void testActionLink(String contextPath, String logicalPageName, String n
replay();
- LinkFactory factory = new LinkFactoryImpl(request, response, resolver, map, cache,
- _typeCoercer);
+ LinkFactory factory = new LinkFactoryImpl(request, response, map, cache, _typeCoercer);
factory.addListener(listener);
Link link = factory.createActionLink(element, eventName, false, context);
View
8 ...ry-core/src/test/java/org/apache/tapestry/internal/services/PageRenderDispatcherTest.java
@@ -37,7 +37,6 @@
public void not_a_page_request() throws Exception
{
ComponentClassResolver resolver = mockComponentClassResolver();
- PageResponseRenderer renderer = mockPageResponseRenderer();
RequestPageCache cache = mockRequestPageCache();
PageRenderRequestHandler handler = new PageRenderRequestHandlerImpl(cache, null, null, null);
Request request = mockRequest();
@@ -61,7 +60,6 @@ public void not_a_page_request() throws Exception
public void empty_path() throws Exception
{
ComponentClassResolver resolver = mockComponentClassResolver();
- PageResponseRenderer renderer = mockPageResponseRenderer();
PageRenderRequestHandler handler = newMock(PageRenderRequestHandler.class);
Request request = mockRequest();
Response response = mockResponse();
@@ -120,7 +118,8 @@ private void no_extra_context(boolean finalSlash) throws Exception
replay();
- PageRenderRequestHandler handler = new PageRenderRequestHandlerImpl(cache, processor, renderer, response);
+ PageRenderRequestHandler handler = new PageRenderRequestHandlerImpl(cache, processor,
+ renderer, response);
Dispatcher d = new PageRenderDispatcher(resolver, handler);
@@ -168,7 +167,8 @@ private void context_passed_in_path(boolean finalSlash) throws Exception
replay();
- PageRenderRequestHandler handler = new PageRenderRequestHandlerImpl(cache, processor, renderer, response);
+ PageRenderRequestHandler handler = new PageRenderRequestHandlerImpl(cache, processor,
+ renderer, response);
Dispatcher d = new PageRenderDispatcher(resolver, handler);
View
3 tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/InternalRegistry.java
@@ -18,12 +18,9 @@
import java.util.List;
import java.util.Map;
-import org.apache.tapestry.ioc.AnnotationProvider;
-import org.apache.tapestry.ioc.ObjectProvider;
import org.apache.tapestry.ioc.Registry;
import org.apache.tapestry.ioc.ServiceDecorator;
import org.apache.tapestry.ioc.ServiceLifecycle;
-import org.apache.tapestry.ioc.ObjectLocator;
import org.apache.tapestry.ioc.def.ServiceDef;
import org.apache.tapestry.ioc.services.ClassFab;
import org.apache.tapestry.ioc.services.RegistryShutdownHub;
View
1 tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/ServiceResourcesImpl.java
@@ -107,6 +107,7 @@ public Object getModuleBuilder()
return getModule().getModuleBuilder();
}
+ @Override
public <T> T autobuild(Class<T> clazz)
{
notNull(clazz, "clazz");
View
1 tapestry-ioc/src/main/java/org/apache/tapestry/ioc/services/CoercionTuple.java
@@ -53,6 +53,7 @@ public WT coerce(WS input)
return _coercion.coerce(input);
}
+ @Override
public String toString()
{
return String.format("%s --> %s", convert(_sourceType), convert(_targetType));
View
20 tapestry-upload/src/main/java/org/apache/tapestry/upload/components/Upload.java
@@ -20,6 +20,7 @@
import org.apache.tapestry.ComponentResources;
import org.apache.tapestry.FieldValidator;
import org.apache.tapestry.MarkupWriter;
+import org.apache.tapestry.ValidationDecorator;
import org.apache.tapestry.ValidationException;
import org.apache.tapestry.ValidationTracker;
import org.apache.tapestry.annotations.Environmental;
@@ -105,6 +106,7 @@ public Upload()
_resources = resources;
}
+ @Override
protected void processSubmission(FormSupport formSupport, String elementName)
{
UploadedFile uploaded = _decoder.getFileUpload(elementName);
@@ -140,9 +142,9 @@ protected void beginRender(MarkupWriter writer)
writer.element("input", "type", "file", "name", getElementName(), "id", getClientId());
_validate.render(writer);
-
+
_resources.renderInformalParameters(writer);
-
+
getValidationDecorator().insideField(this);
}
@@ -160,4 +162,18 @@ Binding defaultValue()
{
return createDefaultParameterBinding("value");
}
+
+ void injectDecorator(ValidationDecorator decorator)
+ {
+ setDecorator(decorator);
+ }
+
+ void injectFormSupport(FormSupport formSupport)
+ {
+ // We have our copy ...
+ _formSupport = formSupport;
+
+ // As does AbstractField
+ setFormSupport(formSupport);
+ }
}
View
2 tapestry-upload/src/main/java/org/apache/tapestry/upload/services/ParameterValue.java
@@ -27,11 +27,13 @@
public static final ParameterValue NULL = new ParameterValue()
{
+ @Override
public String single()
{
return null;
}
+ @Override
public String[] multi()
{
return null;
View
6 ...ad/src/main/java/org/apache/tapestry/upload/services/ParametersServletRequestWrapper.java
@@ -28,7 +28,7 @@
/**
* Wrapper for HttpServletRequest that overrides the parameter methods of the wrapped request. i.e.
- * parameters are retreived from the wrapper rather than the real request.
+ * parameters are retrieved from the wrapper rather than the real request.
*/
public class ParametersServletRequestWrapper extends HttpServletRequestWrapper
{
@@ -39,11 +39,13 @@ public ParametersServletRequestWrapper(HttpServletRequest httpServletRequest)
super(httpServletRequest);
}
+ @Override
public String getParameter(String name)
{
return getValueFor(name).single();
}
+ @Override
public Map<String, Object> getParameterMap()
{
Map<String, Object> paramMap = newMap();
@@ -58,11 +60,13 @@ public String getParameter(String name)
return paramMap;
}
+ @Override
public Enumeration getParameterNames()
{
return Collections.enumeration(_parameters.keySet());
}
+ @Override
public String[] getParameterValues(String name)
{
return getValueFor(name).multi();
View
60 tapestry-upload/src/test/java/org/apache/tapestry/upload/components/UploadTest.java
@@ -55,9 +55,8 @@ public void begin_render_writes_input_tag() throws Exception
Upload component = new Upload(null, null, null, null, resources);
- setValidationDecorator(component, new StubValidationDecorator());
-
- setFormSupport(component, formSupport);
+ component.injectDecorator(new StubValidationDecorator());
+ component.injectFormSupport(formSupport);
component.beginRender(writer);
@@ -72,34 +71,24 @@ public void begin_render_writes_input_tag() throws Exception
}
- protected final FormSupport mockFormSupport()
- {
- return newMock(FormSupport.class);
- }
-
- private void setFormSupport(Upload component, FormSupport formSupport)
- throws IllegalAccessException
- {
- setField(component, "_formSupport", formSupport);
- }
-
@Test
public void validation_decorator_invoked_inside_begin_render() throws Exception
{
getMocksControl().checkOrder(true);
-
+
ComponentResources resources = mockComponentResources();
Upload component = new Upload(null, null, null, null, resources);
MarkupWriter writer = createMarkupWriter();
writer.element("form");
FormSupport formSupport = mockFormSupport();
formSupport.setEncodingType(Upload.MULTIPART_ENCTYPE);
- setField(component, "_formSupport", formSupport);
+
+ component.injectFormSupport(formSupport);
ValidationDecorator decorator = mockValidationDecorator();
- setValidationDecorator(component, decorator);
+ component.injectDecorator(decorator);
resources.renderInformalParameters(writer);
decorator.insideField(component);
@@ -116,6 +105,7 @@ private ValidationDecorator mockValidationDecorator()
return newMock(ValidationDecorator.class);
}
+ @SuppressWarnings("unchecked")
@Test
public void begin_render_invokes_field_validator() throws Exception
{
@@ -129,11 +119,11 @@ public void begin_render_invokes_field_validator() throws Exception
FormSupport formSupport = mockFormSupport();
formSupport.setEncodingType(Upload.MULTIPART_ENCTYPE);
- setField(component, "_formSupport", formSupport);
+ component.injectFormSupport(formSupport);
ValidationDecorator decorator = mockValidationDecorator();
- setValidationDecorator(component, decorator);
+ component.injectDecorator(decorator);
validate.render(writer);
resources.renderInformalParameters(writer);
@@ -204,6 +194,7 @@ public void process_submission_ignores_null_value() throws Exception
assertNull(component.getValue());
}
+ @SuppressWarnings("unchecked")
@Test
public void process_submission_calls_validator() throws Exception
{
@@ -224,6 +215,7 @@ public void process_submission_calls_validator() throws Exception
verify();
}
+ @SuppressWarnings("unchecked")
@Test
public void process_submission_tracks_validator_errors() throws Exception
{
@@ -256,34 +248,4 @@ protected final MultipartDecoder mockMultipartDecoder()
{
return newMock(MultipartDecoder.class);
}
-
- private void setValidationDecorator(Upload component, ValidationDecorator decorator)
- throws IllegalAccessException
- {
- setField(component, "_decorator", decorator);
- }
-
- private void setField(Object bean, String name, Object value) throws IllegalAccessException
- {
- Class clazz = bean.getClass();
- java.lang.reflect.Field field = null;
-
- while (field == null && clazz != null)
- {
- try
- {
- field = clazz.getDeclaredField(name);
- }
- catch (NoSuchFieldException e)
- {
- field = null;
- }
- clazz = clazz.getSuperclass();
- }
- if (field != null)
- {
- field.setAccessible(true);
- field.set(bean, value);
- }
- }
}

0 comments on commit 2bdd5ef

Please sign in to comment.