Skip to content
This repository was archived by the owner on Dec 15, 2021. It is now read-only.

Commit 5bf23a0

Browse files
committed
Add repro project for SPR-13490
Issue: SPR-13490
1 parent 49a4122 commit 5bf23a0

File tree

12 files changed

+492
-0
lines changed

12 files changed

+492
-0
lines changed

SPR-13490/README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Repro project for SPR-13490
2+
3+
4+
## Running the example
5+
6+
`mvn test`
7+
8+
## Logging
9+
10+
This project contains a `log4j.properties` file in `src/main/resources` that you
11+
may wish to configure to emit more detailed logging. The root logger is set to
12+
`INFO` and a custom `org.springframework.web` logger is set to `DEBUG`.
13+
14+

SPR-13490/pom.xml

Lines changed: 306 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,306 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
<groupId>org.springframework.issues</groupId>
5+
<artifactId>SPR-13490</artifactId>
6+
<version>1.0-SNAPSHOT</version>
7+
<name>Spring MVC Issue Reproduction Project</name>
8+
<packaging>war</packaging>
9+
10+
<properties>
11+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
12+
13+
<java.version>1.6</java.version>
14+
<spring.version>4.1.7.RELEASE</spring.version>
15+
<slf4j.version>1.7.5</slf4j.version>
16+
17+
<jetty.version>9.1.2.v20140210</jetty.version>
18+
<cargo.container.id>tomcat7x</cargo.container.id>
19+
<cargo.container.url>
20+
http://www.eu.apache.org/dist/tomcat/tomcat-7/v7.0.57/bin/apache-tomcat-7.0.57.zip
21+
</cargo.container.url>
22+
<cargo.container.jvmargs>-Xms96m -Xmx512m -Djava.awt.headless=true</cargo.container.jvmargs>
23+
<cargo.jvm.debug.port>8000</cargo.jvm.debug.port>
24+
</properties>
25+
26+
<dependencies>
27+
<!-- Spring Framework -->
28+
<dependency>
29+
<groupId>org.springframework</groupId>
30+
<artifactId>spring-context</artifactId>
31+
<version>${spring.version}</version>
32+
<exclusions>
33+
<!-- Exclude Commons Logging in favor of SLF4j -->
34+
<exclusion>
35+
<groupId>commons-logging</groupId>
36+
<artifactId>commons-logging</artifactId>
37+
</exclusion>
38+
</exclusions>
39+
</dependency>
40+
<dependency>
41+
<groupId>org.springframework</groupId>
42+
<artifactId>spring-webmvc</artifactId>
43+
<version>${spring.version}</version>
44+
</dependency>
45+
46+
<!-- Logging -->
47+
<dependency>
48+
<groupId>org.slf4j</groupId>
49+
<artifactId>slf4j-api</artifactId>
50+
<version>${slf4j.version}</version>
51+
</dependency>
52+
<dependency>
53+
<groupId>org.slf4j</groupId>
54+
<artifactId>jcl-over-slf4j</artifactId>
55+
<version>${slf4j.version}</version>
56+
<scope>runtime</scope>
57+
</dependency>
58+
<dependency>
59+
<groupId>org.slf4j</groupId>
60+
<artifactId>slf4j-log4j12</artifactId>
61+
<version>${slf4j.version}</version>
62+
<scope>runtime</scope>
63+
</dependency>
64+
<dependency>
65+
<groupId>log4j</groupId>
66+
<artifactId>log4j</artifactId>
67+
<version>1.2.17</version>
68+
<scope>runtime</scope>
69+
</dependency>
70+
71+
<!-- Servlet API -->
72+
<dependency>
73+
<groupId>javax.servlet</groupId>
74+
<artifactId>javax.servlet-api</artifactId>
75+
<version>3.0.1</version>
76+
<scope>provided</scope>
77+
</dependency>
78+
79+
<!-- JSP API and JSTL
80+
<dependency>
81+
<groupId>javax.servlet.jsp</groupId>
82+
<artifactId>jsp-api</artifactId>
83+
<version>2.1</version>
84+
<scope>provided</scope>
85+
</dependency>
86+
<dependency>
87+
<groupId>javax.servlet</groupId>
88+
<artifactId>jstl</artifactId>
89+
<version>1.2</version>
90+
</dependency>
91+
-->
92+
93+
<!-- Apache Tiles
94+
<dependency>
95+
<groupId>org.apache.tiles</groupId>
96+
<artifactId>tiles-jsp</artifactId>
97+
<version>2.1.3</version>
98+
<exclusions>
99+
<exclusion>
100+
<groupId>commons-logging</groupId>
101+
<artifactId>commons-logging-api</artifactId>
102+
</exclusion>
103+
</exclusions>
104+
</dependency>
105+
-->
106+
107+
<!-- JSR 303 with Hibernate Validator
108+
<dependency>
109+
<groupId>javax.validation</groupId>
110+
<artifactId>validation-api</artifactId>
111+
<version>1.0.0.GA</version>
112+
</dependency>
113+
<dependency>
114+
<groupId>org.hibernate</groupId>
115+
<artifactId>hibernate-validator</artifactId>
116+
<version>4.1.0.Final</version>
117+
</dependency>
118+
-->
119+
120+
<!-- Joda Time Library
121+
<dependency>
122+
<groupId>joda-time</groupId>
123+
<artifactId>joda-time</artifactId>
124+
<version>1.6.2</version>
125+
</dependency>
126+
<dependency>
127+
<groupId>joda-time</groupId>
128+
<artifactId>joda-time-jsptags</artifactId>
129+
<version>1.0.2</version>
130+
<scope>runtime</scope>
131+
</dependency>
132+
-->
133+
134+
<!-- Apache Commons File Upload
135+
<dependency>
136+
<groupId>commons-fileupload</groupId>
137+
<artifactId>commons-fileupload</artifactId>
138+
<version>1.2.2</version>
139+
</dependency>
140+
<dependency>
141+
<groupId>commons-io</groupId>
142+
<artifactId>commons-io</artifactId>
143+
<version>2.0.1</version>
144+
</dependency>
145+
-->
146+
147+
<dependency>
148+
<groupId>com.fasterxml.jackson.core</groupId>
149+
<artifactId>jackson-databind</artifactId>
150+
<version>2.6.1</version>
151+
</dependency>
152+
153+
<!-- Rome Atom+RSS
154+
<dependency>
155+
<groupId>rome</groupId>
156+
<artifactId>rome</artifactId>
157+
<version>1.0</version>
158+
</dependency>
159+
-->
160+
161+
<!-- Test -->
162+
<dependency>
163+
<groupId>org.springframework</groupId>
164+
<artifactId>spring-test</artifactId>
165+
<version>${spring.version}</version>
166+
</dependency>
167+
<dependency>
168+
<groupId>junit</groupId>
169+
<artifactId>junit</artifactId>
170+
<version>4.11</version>
171+
<scope>test</scope>
172+
</dependency>
173+
</dependencies>
174+
175+
<build>
176+
<plugins>
177+
<plugin>
178+
<groupId>org.apache.maven.plugins</groupId>
179+
<artifactId>maven-compiler-plugin</artifactId>
180+
<version>2.5.1</version>
181+
<configuration>
182+
<source>${java.version}</source>
183+
<target>${java.version}</target>
184+
</configuration>
185+
</plugin>
186+
<plugin>
187+
<groupId>org.apache.maven.plugins</groupId>
188+
<artifactId>maven-dependency-plugin</artifactId>
189+
<version>2.8</version>
190+
<executions>
191+
<execution>
192+
<id>install</id>
193+
<phase>install</phase>
194+
<goals>
195+
<goal>sources</goal>
196+
</goals>
197+
</execution>
198+
</executions>
199+
</plugin>
200+
<plugin>
201+
<groupId>org.apache.maven.plugins</groupId>
202+
<artifactId>maven-eclipse-plugin</artifactId>
203+
<version>2.8</version>
204+
<configuration>
205+
<downloadSources>true</downloadSources>
206+
<downloadJavadocs>false</downloadJavadocs>
207+
<wtpversion>2.0</wtpversion>
208+
</configuration>
209+
</plugin>
210+
<plugin>
211+
<groupId>org.apache.maven.plugins</groupId>
212+
<artifactId>maven-surefire-plugin</artifactId>
213+
<version>2.12.4</version>
214+
<configuration>
215+
<includes>
216+
<include>**/*Tests.java</include>
217+
<include>**/*Test.java</include>
218+
</includes>
219+
<excludes>
220+
<exclude>**/*Abstract*.java</exclude>
221+
</excludes>
222+
</configuration>
223+
</plugin>
224+
<plugin>
225+
<groupId>org.eclipse.jetty</groupId>
226+
<artifactId>jetty-maven-plugin</artifactId>
227+
<version>${jetty.version}</version>
228+
</plugin>
229+
<plugin>
230+
<groupId>org.codehaus.cargo</groupId>
231+
<artifactId>cargo-maven2-plugin</artifactId>
232+
<version>1.4.7</version>
233+
<configuration>
234+
<configuration>
235+
<properties>
236+
<cargo.servlet.port>8080</cargo.servlet.port>
237+
<cargo.tomcat.ajp.port>1099</cargo.tomcat.ajp.port>
238+
<cargo.rmi.port>1099</cargo.rmi.port>
239+
<cargo.logging>medium</cargo.logging>
240+
<cargo.jvmargs>${cargo.container.jvmargs}</cargo.jvmargs>
241+
</properties>
242+
</configuration>
243+
<container>
244+
<containerId>${cargo.container.id}</containerId>
245+
<zipUrlInstaller>
246+
<url>${cargo.container.url}</url>
247+
</zipUrlInstaller>
248+
</container>
249+
</configuration>
250+
</plugin>
251+
</plugins>
252+
</build>
253+
254+
<profiles>
255+
<profile>
256+
<id>tomcat8</id>
257+
<properties>
258+
<cargo.container.id>tomcat8x</cargo.container.id>
259+
<cargo.container.url>
260+
http://www.eu.apache.org/dist/tomcat/tomcat-8/v8.0.15/bin/apache-tomcat-8.0.15.zip
261+
</cargo.container.url>
262+
</properties>
263+
</profile>
264+
<profile>
265+
<id>jetty8</id>
266+
<build>
267+
<plugins>
268+
<plugin>
269+
<groupId>org.codehaus.cargo</groupId>
270+
<artifactId>cargo-maven2-plugin</artifactId>
271+
<configuration>
272+
<container>
273+
<containerId>jetty8x</containerId>
274+
<type>embedded</type>
275+
</container>
276+
</configuration>
277+
</plugin>
278+
</plugins>
279+
</build>
280+
</profile>
281+
<profile>
282+
<id>debug</id>
283+
<properties>
284+
<cargo.container.jvmargs>
285+
-Xdebug
286+
-Xrunjdwp:transport=dt_socket,address=${cargo.jvm.debug.port},suspend=n,server=y
287+
-Xnoagent
288+
-Djava.compiler=NONE
289+
</cargo.container.jvmargs>
290+
</properties>
291+
</profile>
292+
</profiles>
293+
294+
<repositories>
295+
<repository>
296+
<id>spring-maven-snapshot</id>
297+
<name>Springframework Maven Snapshot Repository</name>
298+
<url>http://repo.spring.io/snapshot</url>
299+
<snapshots>
300+
<enabled>true</enabled>
301+
</snapshots>
302+
</repository>
303+
</repositories>
304+
305+
</project>
306+

SPR-13490/src/main/java/org/springframework/issues/.gitignore

Whitespace-only changes.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package org.springframework.issues;
2+
3+
public class Payload {
4+
5+
private String message;
6+
7+
public Payload() {
8+
}
9+
10+
public String getMessage() {
11+
return message;
12+
}
13+
14+
public void setMessage(String message) {
15+
this.message = message;
16+
}
17+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package org.springframework.issues;
2+
3+
import org.springframework.stereotype.Component;
4+
import org.springframework.validation.Errors;
5+
import org.springframework.validation.ValidationUtils;
6+
import org.springframework.validation.Validator;
7+
8+
public class PayloadValidator implements Validator {
9+
10+
@Override
11+
public boolean supports(Class<?> aClass) {
12+
return Payload.class.equals(aClass);
13+
}
14+
15+
@Override
16+
public void validate(Object o, Errors errors) {
17+
ValidationUtils.rejectIfEmpty(errors, "message", "empty message");
18+
19+
}
20+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package org.springframework.issues;
2+
3+
import org.springframework.validation.annotation.Validated;
4+
import org.springframework.web.bind.WebDataBinder;
5+
import org.springframework.web.bind.annotation.InitBinder;
6+
import org.springframework.web.bind.annotation.RequestBody;
7+
import org.springframework.web.bind.annotation.RequestMapping;
8+
import org.springframework.web.bind.annotation.RestController;
9+
10+
@RestController
11+
public class TestController {
12+
13+
@InitBinder
14+
public void initBinder(WebDataBinder binder) {
15+
binder.addValidators(new PayloadValidator());
16+
}
17+
18+
@RequestMapping("/")
19+
public String emptyBody(@RequestBody @Validated Payload payload) {
20+
return "hello";
21+
}
22+
}

0 commit comments

Comments
 (0)