Bug 357403 - StringIndexOutOfBounds exception viewing monitor
information in the Debug view
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/JDIModelPresentation.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/JDIModelPresentation.java
index ea8d8d4..60be8e9 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/JDIModelPresentation.java
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/JDIModelPresentation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -444,14 +444,14 @@
if ("V".equals(signature)) { //$NON-NLS-1$
valueString= DebugUIMessages.JDIModelPresentation__No_explicit_return_value__30;
}
- boolean isObject= isObjectValue(signature);
+ boolean isObject= isObjectValue(signature) || value instanceof IJavaObject;
boolean isArray= value instanceof IJavaArray;
StringBuffer buffer= new StringBuffer();
// Always show type name for objects & arrays (but not Strings)
if (isObject && !isString && (refTypeName.length() > 0)) {
// Don't show type name for instances and references
if (!(value instanceof JDIReferenceListValue || value instanceof JDIAllInstancesValue)){
- String qualTypeName= getQualifiedName(refTypeName);
+ String qualTypeName= getQualifiedName(refTypeName).trim();
if (isArray) {
qualTypeName= adjustTypeNameForArrayIndex(qualTypeName, ((IJavaArray)value).getLength());
}
diff --git a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIReferenceType.java b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIReferenceType.java
index 3bc4cd5..2d43250 100644
--- a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIReferenceType.java
+++ b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIReferenceType.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -261,8 +261,17 @@
if (parameterStart < 0) {
name.append(genericTypeSignature.substring(arrayDimension + 1, genericTypeSignature.length() - 1).replace('/', '.'));
} else {
- name.append(genericTypeSignature.substring(arrayDimension + 1, parameterStart).replace('/', '.'));
- name.append(Signature.toString(genericTypeSignature).substring(parameterStart - 1 - arrayDimension).replace('/', '.'));
+ if(parameterStart != 0) {
+ name.append(genericTypeSignature.substring(arrayDimension + 1, parameterStart).replace('/', '.'));
+ }
+ try {
+ String sig = Signature.toString(genericTypeSignature).substring(Math.max(parameterStart - 1, 0) - arrayDimension);
+ name.append(sig.replace('/', '.'));
+ }
+ catch(IllegalArgumentException iae) {
+ //do nothing
+ name.append(genericTypeSignature);
+ }
}
for (int i= 0; i < arrayDimension; i++) {
name.append("[]"); //$NON-NLS-1$