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

Commit d6405ad

Browse files
committed
Update SPR-9209 with new sources
1 parent e76b233 commit d6405ad

File tree

14 files changed

+193
-353
lines changed

14 files changed

+193
-353
lines changed

SPR-9209/README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
This is a small web application that reproduces the bug behind [SPR-9209](https://jira.springsource.org/browse/SPR-9209).
2+
3+
# How to reproduce the bug
4+
5+
## Normal behavior
6+
7+
1. Start the webapp with `mvn jetty:run`.
8+
9+
2. In another console window, execute `curl -i localhost:8080/request1`. The application correctly returns
10+
HTTP 500 Internal Server Error since the request handler for `/request1` simply throws an NullPointerException.
11+
12+
3. Execute `curl -i localhost:8080/request2`. The handler for `/request2/ throws an IllegalArgumentException, but the
13+
controller contains an @ExceptionResolver which handles a IllegalArgumentException. The curl command shows
14+
the application returning HTTP 400 Bad Request as the @ExceptionHandler in WebController specifies.
15+
16+
4. Execute `curl -i localhost:8080/request1` again - the application still returns HTTP 500 because of the NullPointerException.
17+
18+
## The buggy behavior
19+
20+
1. Kill the jetty server from the previous steps and start the server fresh with `mvn jetty:run`.
21+
22+
2. Execute `curl localhost:8080/request2` first this time. Notice that the server returns HTTP 400 and prints
23+
out that it is handling a IllegalArgumentException.
24+
25+
3. Now execute `curl localhost:8080/request1`. Now the application incorrectly returns HTTP 400 and prints
26+
"Handling IllegalArgumentException" instead of returning HTTP 500 because of an uncaught exception!

SPR-9209/pom.xml

Lines changed: 62 additions & 219 deletions
Original file line numberDiff line numberDiff line change
@@ -1,220 +1,63 @@
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-9209</artifactId>
6-
<version>1.0-SNAPSHOT</version>
7-
<name>Spring MVC Issue Reproduction Project</name>
8-
<packaging>war</packaging>
9-
10-
<properties>
11-
<java-version>1.6</java-version>
12-
<org.springframework-version>3.1.0.RELEASE</org.springframework-version>
13-
<org.slf4j-version>1.6.1</org.slf4j-version>
14-
</properties>
15-
16-
<dependencies>
17-
<!-- Spring Framework -->
18-
<dependency>
19-
<groupId>org.springframework</groupId>
20-
<artifactId>spring-context</artifactId>
21-
<version>${org.springframework-version}</version>
22-
<exclusions>
23-
<!-- Exclude Commons Logging in favor of SLF4j -->
24-
<exclusion>
25-
<groupId>commons-logging</groupId>
26-
<artifactId>commons-logging</artifactId>
27-
</exclusion>
28-
</exclusions>
29-
</dependency>
30-
<dependency>
31-
<groupId>org.springframework</groupId>
32-
<artifactId>spring-webmvc</artifactId>
33-
<version>${org.springframework-version}</version>
34-
</dependency>
35-
36-
<!-- Logging -->
37-
<dependency>
38-
<groupId>org.slf4j</groupId>
39-
<artifactId>slf4j-api</artifactId>
40-
<version>${org.slf4j-version}</version>
41-
</dependency>
42-
<dependency>
43-
<groupId>org.slf4j</groupId>
44-
<artifactId>jcl-over-slf4j</artifactId>
45-
<version>${org.slf4j-version}</version>
46-
<scope>runtime</scope>
47-
</dependency>
48-
<dependency>
49-
<groupId>org.slf4j</groupId>
50-
<artifactId>slf4j-log4j12</artifactId>
51-
<version>${org.slf4j-version}</version>
52-
<scope>runtime</scope>
53-
</dependency>
54-
<dependency>
55-
<groupId>log4j</groupId>
56-
<artifactId>log4j</artifactId>
57-
<version>1.2.16</version>
58-
<scope>runtime</scope>
59-
</dependency>
60-
61-
<!-- Servlet API -->
62-
<dependency>
63-
<groupId>javax.servlet</groupId>
64-
<artifactId>servlet-api</artifactId>
65-
<version>2.5</version>
66-
<scope>provided</scope>
67-
</dependency>
68-
69-
<!-- JSP API and JSTL
70-
<dependency>
71-
<groupId>javax.servlet.jsp</groupId>
72-
<artifactId>jsp-api</artifactId>
73-
<version>2.1</version>
74-
<scope>provided</scope>
75-
</dependency>
76-
<dependency>
77-
<groupId>javax.servlet</groupId>
78-
<artifactId>jstl</artifactId>
79-
<version>1.2</version>
80-
</dependency>
81-
-->
82-
83-
<!-- Apache Tiles
84-
<dependency>
85-
<groupId>org.apache.tiles</groupId>
86-
<artifactId>tiles-jsp</artifactId>
87-
<version>2.1.3</version>
88-
<exclusions>
89-
<exclusion>
90-
<groupId>commons-logging</groupId>
91-
<artifactId>commons-logging-api</artifactId>
92-
</exclusion>
93-
</exclusions>
94-
</dependency>
95-
-->
96-
97-
<!-- JSR 303 with Hibernate Validator
98-
<dependency>
99-
<groupId>javax.validation</groupId>
100-
<artifactId>validation-api</artifactId>
101-
<version>1.0.0.GA</version>
102-
</dependency>
103-
<dependency>
104-
<groupId>org.hibernate</groupId>
105-
<artifactId>hibernate-validator</artifactId>
106-
<version>4.1.0.Final</version>
107-
</dependency>
108-
-->
109-
110-
<!-- Joda Time Library
111-
<dependency>
112-
<groupId>joda-time</groupId>
113-
<artifactId>joda-time</artifactId>
114-
<version>1.6.2</version>
115-
</dependency>
116-
<dependency>
117-
<groupId>joda-time</groupId>
118-
<artifactId>joda-time-jsptags</artifactId>
119-
<version>1.0.2</version>
120-
<scope>runtime</scope>
121-
</dependency>
122-
-->
123-
124-
<!-- Apache Commons File Upload
125-
<dependency>
126-
<groupId>commons-fileupload</groupId>
127-
<artifactId>commons-fileupload</artifactId>
128-
<version>1.2.2</version>
129-
</dependency>
130-
<dependency>
131-
<groupId>commons-io</groupId>
132-
<artifactId>commons-io</artifactId>
133-
<version>2.0.1</version>
134-
</dependency>
135-
-->
136-
137-
<!-- Jackson JSON Processor
138-
<dependency>
139-
<groupId>org.codehaus.jackson</groupId>
140-
<artifactId>jackson-mapper-asl</artifactId>
141-
<version>1.8.1</version>
142-
</dependency>
143-
-->
144-
145-
<!-- Rome Atom+RSS
146-
<dependency>
147-
<groupId>rome</groupId>
148-
<artifactId>rome</artifactId>
149-
<version>1.0</version>
150-
</dependency>
151-
-->
152-
153-
<!-- Test -->
154-
<dependency>
155-
<groupId>junit</groupId>
156-
<artifactId>junit</artifactId>
157-
<version>4.8</version>
158-
<scope>test</scope>
159-
</dependency>
160-
</dependencies>
161-
162-
<repositories>
163-
<repository>
164-
<id>spring-maven-snapshot</id>
165-
<name>Springframework Maven Snapshot Repository</name>
166-
<url>http://repo.springsource.org/snapshot</url>
167-
<snapshots>
168-
<enabled>true</enabled>
169-
</snapshots>
170-
</repository>
171-
</repositories>
172-
173-
<build>
174-
<plugins>
175-
<plugin>
176-
<artifactId>maven-compiler-plugin</artifactId>
177-
<configuration>
178-
<source>${java-version}</source>
179-
<target>${java-version}</target>
180-
</configuration>
181-
</plugin>
182-
<plugin>
183-
<groupId>org.apache.maven.plugins</groupId>
184-
<artifactId>maven-dependency-plugin</artifactId>
185-
<executions>
186-
<execution>
187-
<id>install</id>
188-
<phase>install</phase>
189-
<goals>
190-
<goal>sources</goal>
191-
</goals>
192-
</execution>
193-
</executions>
194-
</plugin>
195-
<plugin>
196-
<groupId>org.apache.maven.plugins</groupId>
197-
<artifactId>maven-eclipse-plugin</artifactId>
198-
<version>2.8</version>
199-
<configuration>
200-
<downloadSources>true</downloadSources>
201-
<downloadJavadocs>false</downloadJavadocs>
202-
<wtpversion>2.0</wtpversion>
203-
</configuration>
204-
</plugin>
205-
<plugin>
206-
<artifactId>maven-surefire-plugin</artifactId>
207-
<configuration>
208-
<includes>
209-
<include>**/*Tests.java</include>
210-
</includes>
211-
<excludes>
212-
<exclude>**/*Abstract*.java</exclude>
213-
</excludes>
214-
</configuration>
215-
</plugin>
216-
</plugins>
217-
</build>
218-
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<groupId>brown</groupId>
8+
<artifactId>SPR-9209</artifactId>
9+
<version>1.0-SNAPSHOT</version>
10+
<packaging>war</packaging>
11+
12+
<description>Test case for https://jira.springsource.org/browse/SPR-9209</description>
13+
14+
<developers>
15+
<developer>
16+
<email>[email protected]</email>
17+
<name>Matt Brown</name>
18+
</developer>
19+
</developers>
20+
21+
<properties>
22+
<spring.version>3.1.2.RELEASE</spring.version>
23+
</properties>
24+
25+
<dependencies>
26+
<dependency>
27+
<groupId>org.springframework</groupId>
28+
<artifactId>spring-webmvc</artifactId>
29+
<version>${spring.version}</version>
30+
</dependency>
31+
<dependency>
32+
<groupId>org.springframework</groupId>
33+
<artifactId>spring-web</artifactId>
34+
<version>${spring.version}</version>
35+
</dependency>
36+
<dependency>
37+
<groupId>javax.servlet</groupId>
38+
<artifactId>servlet-api</artifactId>
39+
<version>2.5</version>
40+
<scope>provided</scope>
41+
</dependency>
42+
<dependency>
43+
<groupId>org.slf4j</groupId>
44+
<artifactId>slf4j-log4j12</artifactId>
45+
<version>1.7.1</version>
46+
</dependency>
47+
</dependencies>
48+
49+
<build>
50+
<plugins>
51+
<plugin>
52+
<groupId>org.apache.maven.plugins</groupId>
53+
<artifactId>maven-compiler-plugin</artifactId>
54+
<version>2.3.2</version>
55+
<configuration>
56+
<source>1.6</source>
57+
<target>1.6</target>
58+
</configuration>
59+
</plugin>
60+
61+
</plugins>
62+
</build>
21963
</project>
220-

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

Whitespace-only changes.

SPR-9209/src/main/java/org/springframework/issues/AbstractExceptionController.java

Lines changed: 0 additions & 36 deletions
This file was deleted.

SPR-9209/src/main/java/org/springframework/issues/ExceptionController.java

Lines changed: 0 additions & 31 deletions
This file was deleted.

0 commit comments

Comments
 (0)