From 0156c1305007bb128eec80be7c6fd6b781fcf23d Mon Sep 17 00:00:00 2001 From: aclement Date: Sat, 13 Nov 2010 16:31:19 +0000 Subject: [PATCH] 330170: debug added --- asm/src/org/aspectj/asm/AsmManager.java | 49 ++++++++++++++----------- 1 file changed, 28 insertions(+), 21 deletions(-) diff --git a/asm/src/org/aspectj/asm/AsmManager.java b/asm/src/org/aspectj/asm/AsmManager.java index 378d63e54..27f8ef2fa 100644 --- a/asm/src/org/aspectj/asm/AsmManager.java +++ b/asm/src/org/aspectj/asm/AsmManager.java @@ -622,30 +622,37 @@ public class AsmManager implements IStructureModel { } private String getTypeNameFromHandle(String handle, Map cache) { - String typename = cache.get(handle); - if (typename != null) { + try { + String typename = cache.get(handle); + if (typename != null) { + return typename; + } + // inpath handle - but for which type? + // let's do it the slow way, we can optimize this with a cache perhaps + int hasPackage = handle.indexOf(HandleProviderDelimiter.PACKAGEFRAGMENT.getDelimiter()); + int typeLocation = handle.indexOf(HandleProviderDelimiter.TYPE.getDelimiter()); + if (typeLocation == -1) { + typeLocation = handle.indexOf(HandleProviderDelimiter.ASPECT_TYPE.getDelimiter()); + } + if (typeLocation == -1) { + // unexpected - time to give up + return ""; + } + StringBuffer qualifiedTypeNameFromHandle = new StringBuffer(); + if (hasPackage != -1) { + qualifiedTypeNameFromHandle.append(handle.substring(hasPackage + 1, handle.indexOf(HandleProviderDelimiter.CLASSFILE.getDelimiter(), hasPackage))); + qualifiedTypeNameFromHandle.append('.'); + } + qualifiedTypeNameFromHandle.append(handle.substring(typeLocation + 1)); + typename = qualifiedTypeNameFromHandle.toString(); + cache.put(handle, typename); return typename; - } - // inpath handle - but for which type? - // let's do it the slow way, we can optimize this with a cache perhaps - int hasPackage = handle.indexOf('<'); - int typeLocation = handle.indexOf('['); - if (typeLocation == -1) { - typeLocation = handle.indexOf('}'); - } - if (typeLocation == -1) { - // unexpected - time to give up + } catch (StringIndexOutOfBoundsException sioobe) { + // debug for 330170 + System.err.println("Handle processing problem, the handle is: "+handle); + sioobe.printStackTrace(System.err); return ""; } - StringBuffer qualifiedTypeNameFromHandle = new StringBuffer(); - if (hasPackage != -1) { - qualifiedTypeNameFromHandle.append(handle.substring(hasPackage + 1, handle.indexOf('(', hasPackage))); - qualifiedTypeNameFromHandle.append('.'); - } - qualifiedTypeNameFromHandle.append(handle.substring(typeLocation + 1)); - typename = qualifiedTypeNameFromHandle.toString(); - cache.put(handle, typename); - return typename; } /** -- 2.39.5