Author: ema Date: Tue Jan 15 08:24:48 2013 New Revision: 1433311 URL: http://svn.apache.org/viewvc?rev=1433311&view=rev Log: Merged revisions 1433309 via svnmerge from https://svn.apache.org/repos/asf/cxf/branches/2.6.x-fixes
................ r1433309 | ema | 2013-01-15 16:15:04 +0800 (Tue, 15 Jan 2013) | 16 lines Merged revisions 1433306 via svnmerge from https://svn.apache.org/repos/asf/cxf/branches/2.7.x-fixes ................ r1433306 | ema | 2013-01-15 16:09:33 +0800 (Tue, 15 Jan 2013) | 9 lines Merged revisions 1433305 via svnmerge from https://svn.apache.org/repos/asf/cxf/trunk ........ r1433305 | ema | 2013-01-15 16:04:51 +0800 (Tue, 15 Jan 2013) | 1 line CXF-4755- StackOverflowError when ASMHelper tries to getClassCode from a parametrized type <E extends Enum> ........ ................ ................ Added: cxf/branches/2.5.x-fixes/common/common/src/test/java/org/apache/cxf/common/util/ASMHelperTest.java (with props) Modified: cxf/branches/2.5.x-fixes/common/common/src/main/java/org/apache/cxf/common/util/ASMHelper.java Modified: cxf/branches/2.5.x-fixes/common/common/src/main/java/org/apache/cxf/common/util/ASMHelper.java URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/common/common/src/main/java/org/apache/cxf/common/util/ASMHelper.java?rev=1433311&r1=1433310&r2=1433311&view=diff ============================================================================== --- cxf/branches/2.5.x-fixes/common/common/src/main/java/org/apache/cxf/common/util/ASMHelper.java (original) +++ cxf/branches/2.5.x-fixes/common/common/src/main/java/org/apache/cxf/common/util/ASMHelper.java Tue Jan 15 08:24:48 2013 @@ -113,12 +113,14 @@ public class ASMHelper { } else if (type instanceof ParameterizedType) { ParameterizedType pt = (ParameterizedType)type; StringBuilder a = new StringBuilder(getClassCode(pt.getRawType())); - a.setLength(a.length() - 1); - a.append('<'); - for (Type t : pt.getActualTypeArguments()) { - a.append(getClassCode(t)); + if (!pt.getRawType().equals(Enum.class)) { + a.setLength(a.length() - 1); + a.append('<'); + for (Type t : pt.getActualTypeArguments()) { + a.append(getClassCode(t)); + } + a.append(">;"); } - a.append(">;"); return a.toString(); } else if (type instanceof WildcardType) { WildcardType wt = (WildcardType)type; Added: cxf/branches/2.5.x-fixes/common/common/src/test/java/org/apache/cxf/common/util/ASMHelperTest.java URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/common/common/src/test/java/org/apache/cxf/common/util/ASMHelperTest.java?rev=1433311&view=auto ============================================================================== --- cxf/branches/2.5.x-fixes/common/common/src/test/java/org/apache/cxf/common/util/ASMHelperTest.java (added) +++ cxf/branches/2.5.x-fixes/common/common/src/test/java/org/apache/cxf/common/util/ASMHelperTest.java Tue Jan 15 08:24:48 2013 @@ -0,0 +1,56 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cxf.common.util; + +import java.lang.reflect.Method; +import java.lang.reflect.Type; + +import org.junit.Assert; +import org.junit.Test; + +public class ASMHelperTest extends Assert { + @Test + public void testEnumParamType() throws Exception { + Method method = EnumTest.class.getMethod("test", new Class[] { + EnumObject.class + }); + Type[] types = method.getGenericParameterTypes(); + String classCode = ASMHelper.getClassCode(types[0]); + assertEquals("Lorg/apache/cxf/common/util/ASMHelperTest$EnumObject<Ljava/lang/Enum;>;", classCode); + } + + public class EnumObject<E extends Enum<E>> { + private String name; + + public String getName() { + return name; + } + + public void setName(String param) { + this.name = param; + } + } + + public class EnumTest { + public <T extends Enum<T>> EnumObject<T> test(EnumObject<T> o) { + return o; + } + } + +} Propchange: cxf/branches/2.5.x-fixes/common/common/src/test/java/org/apache/cxf/common/util/ASMHelperTest.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: cxf/branches/2.5.x-fixes/common/common/src/test/java/org/apache/cxf/common/util/ASMHelperTest.java ------------------------------------------------------------------------------ svn:keywords = Rev Date
