From: toshihiro Date: Sat, 30 Jun 2007 13:41:52 +0000 (+0000) Subject: Avoid ArrayIndexOutOfBoundsException which occurs at changing value of variable. X-Git-Url: http://secure.phpeclipse.com Avoid ArrayIndexOutOfBoundsException which occurs at changing value of variable. (e.g. assign string (without quotes) to a variable which has integer value) --- diff --git a/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/model/PHPVariable.java b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/model/PHPVariable.java index 91b2a78..40519a2 100644 --- a/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/model/PHPVariable.java +++ b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/model/PHPVariable.java @@ -14,7 +14,10 @@ package net.sourceforge.phpdt.internal.debug.core.model; import java.util.Vector; +import net.sourceforge.phpdt.internal.debug.core.PHPDebugCorePlugin; + import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.Status; import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.ILaunch; import org.eclipse.debug.core.model.IDebugTarget; @@ -197,6 +200,20 @@ public class PHPVariable implements IVariable { else evalString=fLongName+"="+expression; PHPVariable[] vars=fStackFrame.getPHPDBGProxy().eval(fStackFrame,evalString); + + if (vars == null || vars.length == 0) { + vars = fStackFrame.getPHPDBGProxy().eval(fStackFrame, fLongName); + if (vars == null || vars.length == 0) { + // TODO code and message + int code = 0; + String msg = "Could not assign and get variable"; + Status status = new Status(Status.ERROR, + PHPDebugCorePlugin.PLUGIN_ID, code, msg, null); + PHPDebugCorePlugin.log(status); + throw new DebugException(status); + } + } + setValue(vars[0].fValue); }