You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2013/06/21 23:07:06 UTC
svn commit: r1495600 -
/tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoMethodMapping.java
Author: markt
Date: Fri Jun 21 21:07:06 2013
New Revision: 1495600
URL: http://svn.apache.org/r1495600
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=55126
For methods annotated with @onMessage
It is OK for multiple decoders to match a single message parameter
It is not OK for multiple parameters within a method to be possible message parameters.
Modified:
tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoMethodMapping.java
Modified: tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoMethodMapping.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoMethodMapping.java?rev=1495600&r1=1495599&r2=1495600&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoMethodMapping.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoMethodMapping.java Fri Jun 21 21:07:06 2013
@@ -367,6 +367,8 @@ public class PojoMethodMapping {
m.getName(), m.getDeclaringClass().getName()));
}
} else {
+ boolean foundBinaryDecoderMatch = false;
+ boolean foundTextDecoderMatch = false;
for (DecoderEntry decoderEntry : decoderEntries) {
if (decoderEntry.getClazz().isAssignableFrom(
types[i])) {
@@ -374,21 +376,26 @@ public class PojoMethodMapping {
decoderEntry.getDecoder().getClass()) ||
BinaryStream.class.isAssignableFrom(
decoderEntry.getDecoder().getClass())) {
- if (indexByteBuffer == -1) {
- indexByteBuffer = i;
- } else {
- throw new IllegalArgumentException(sm.getString(
- "pojoMethodMapping.duplicateMessageParam",
- m.getName(), m.getDeclaringClass().getName()));
+ if (!foundBinaryDecoderMatch) {
+ if (indexByteBuffer == -1) {
+ indexByteBuffer = i;
+ foundBinaryDecoderMatch = true;
+ } else {
+ throw new IllegalArgumentException(sm.getString(
+ "pojoMethodMapping.duplicateMessageParam",
+ m.getName(), m.getDeclaringClass().getName()));
+ }
}
- break;
} else {
- if (indexString == -1) {
- indexString = i;
- } else {
- throw new IllegalArgumentException(sm.getString(
- "pojoMethodMapping.duplicateMessageParam",
- m.getName(), m.getDeclaringClass().getName()));
+ if (!foundTextDecoderMatch) {
+ if (indexString == -1) {
+ indexString = i;
+ foundTextDecoderMatch = true;
+ } else {
+ throw new IllegalArgumentException(sm.getString(
+ "pojoMethodMapping.duplicateMessageParam",
+ m.getName(), m.getDeclaringClass().getName()));
+ }
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org