Skip to content

Commit 281b851

Browse files
committed
Improve exception for inconsistent mapping data
1 parent 6ffe636 commit 281b851

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

java/org/apache/catalina/mapper/LocalStrings.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ mapper.addHost.sameHost=Duplicate registration of the same host [{0}]. Ignored.
2222
mapper.addHost.success=Registered host [{0}]
2323
mapper.addHostAlias.sameHost=Duplicate registration of alias [{0}] for the same host [{1}]. Ignored.
2424
mapper.addHostAlias.success=Registered alias [{0}] for host [{1}]
25+
mapper.alreadyDone=Mapping was already done on this request on [{0}]
2526
mapper.duplicateHost=Duplicate Host [{0}]. The name is already used by Host [{1}]. This Host will be ignored.
2627
mapper.duplicateHostAlias=Duplicate host Alias [{0}] in Host [{1}]. The name is already used by Host [{2}]. This Alias will be ignored.
2728
mapper.findContext.noContext=No context found [{0}]

java/org/apache/catalina/mapper/Mapper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,7 @@ private void internalMap(CharChunk host, CharChunk uri, String version, MappingD
698698
// skipped all mapping work in this case. That behaviour has a risk
699699
// of returning an inconsistent result.
700700
// I do not see a valid use case for it.
701-
throw new AssertionError();
701+
throw new IllegalStateException(sm.getString("mapper.alreadyDone", mappingData));
702702
}
703703

704704
// Virtual host mapping

java/org/apache/catalina/mapper/MappingData.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,10 @@ public void recycle() {
5757
redirectPath.recycle();
5858
matchType = null;
5959
}
60+
61+
@Override
62+
public final String toString() {
63+
return "MappingData[" + host + ":" + context + ":" + wrapper + "]";
64+
}
65+
6066
}

0 commit comments

Comments
 (0)