Author: scheu
Date: Thu Sep 30 12:08:09 2010
New Revision: 1003028
URL: http://svn.apache.org/viewvc?rev=1003028&view=rev
Log:
AXIS2-4803
Fixed containsClasses method
Modified:
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/JAXBUtils.java
Modified:
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/JAXBUtils.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/JAXBUtils.java?rev=1003028&r1=1003027&r2=1003028&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/JAXBUtils.java
(original)
+++
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/JAXBUtils.java
Thu Sep 30 12:08:09 2010
@@ -936,15 +936,32 @@ public class JAXBUtils {
*/
private static boolean containsClasses(JAXBContext context, List<String>
classRefs) {
String text = context.toString();
-
text = text.replace('\n', ' ');
text = text.replace('\t', ' ');
text = text.replace('\r', ' ');
+ text = text.replace('<', ' ');
+ text = text.replace('[', ' ');
+ text = text.replace(']', ' ');
for (String classRef: classRefs) {
- if (!classRef.endsWith(".ObjectFactory")) {
+ // Strip off generic and array chars
+ int index = classRef.indexOf('<');
+ if (index > 0) {
+ classRef = classRef.substring(0, index);
+ }
+ index = classRef.indexOf('[');
+ if (index > 0) {
+ classRef = classRef.substring(0, index);
+ }
+
+ if (classRef.length() > 0 ||
+ classRef.endsWith(".ObjectFactory") ||
+ classRef.startsWith("java.util.") ||
+ classRef.startsWith("java.lang.")) {
+ // skip these
+ } else {
String search = " " + classRef + " ";
- if (text.contains(search)) {
+ if (!text.contains(search)) {
if (log.isDebugEnabled()) {
log.debug("The context does not contain " + classRef +
" " + context);
}