From 2cd26154e80fce60bd0e096066814127362a4c9e Mon Sep 17 00:00:00 2001 From: Lukas Ladenberger <lukas.ladenberger@googlemail.com> Date: Wed, 18 Jul 2012 10:39:06 +0200 Subject: [PATCH] fixed bug in switch coordinates observer: error message was shown when x or y was no valid integer --- .../gef/editor/model/BControl.java | 32 ++++++++++++------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BControl.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BControl.java index 45668cb3..019ad1ab 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BControl.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BControl.java @@ -293,18 +293,28 @@ public abstract class BControl implements IAdaptable, Cloneable { // TODO: check if strings are a correct integers - int width = Integer.valueOf(widthStr); - int height = Integer.valueOf(heightStr); - int x = Integer.valueOf(xStr); - int y = Integer.valueOf(yStr); - if (layout == null) { - layout = new Rectangle(x, y, width, height); - } else { - layout.x = x; - layout.y = y; - layout.width = width; - layout.height = height; + try { + + int width = Integer.valueOf(widthStr); + int height = Integer.valueOf(heightStr); + int x = Integer.valueOf(xStr); + int y = Integer.valueOf(yStr); + + if (layout == null) { + layout = new Rectangle(x, y, width, height); + } else { + layout.x = x; + layout.y = y; + layout.width = width; + layout.height = height; + } + + } catch (NumberFormatException e) { + // We ignore number format exceptions, however we should return an + // error message here + // TODO: return error message } + return layout; } -- GitLab