From 734b4fa1a99835b1270549d482cf4b2f0f7c9428 Mon Sep 17 00:00:00 2001 From: Henri Sara Date: Tue, 1 Jun 2010 10:36:59 +0000 Subject: #5111 incorrect null check in Panel.removeAction() svn changeset:13457/svn branch:6.3 --- src/com/vaadin/ui/Panel.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/com/vaadin') diff --git a/src/com/vaadin/ui/Panel.java b/src/com/vaadin/ui/Panel.java index d4fb66deb6..ce3e8bb582 100644 --- a/src/com/vaadin/ui/Panel.java +++ b/src/com/vaadin/ui/Panel.java @@ -501,7 +501,7 @@ public class Panel extends AbstractComponentContainer implements Scrollable, public void removeAction( T action) { - if (actionManager == null) { + if (actionManager != null) { actionManager.removeAction(action); } } -- cgit v1.2.3 From e4efbe682e49bcb3f473df2a9d28237450ec2682 Mon Sep 17 00:00:00 2001 From: Henri Sara Date: Tue, 1 Jun 2010 10:53:07 +0000 Subject: Fixed some high priority warnings by FindBugs svn changeset:13459/svn branch:6.3 --- src/com/vaadin/terminal/gwt/client/DateTimeService.java | 6 +++--- src/com/vaadin/terminal/gwt/client/RenderInformation.java | 12 ++++++++++-- src/com/vaadin/terminal/gwt/client/VDebugConsole.java | 2 +- src/com/vaadin/terminal/gwt/client/ui/VMarginInfo.java | 5 +++++ src/com/vaadin/terminal/gwt/client/ui/VPanel.java | 2 +- src/com/vaadin/ui/AbstractField.java | 2 +- src/com/vaadin/ui/Form.java | 2 +- src/com/vaadin/ui/MenuBar.java | 3 --- 8 files changed, 22 insertions(+), 12 deletions(-) (limited to 'src/com/vaadin') diff --git a/src/com/vaadin/terminal/gwt/client/DateTimeService.java b/src/com/vaadin/terminal/gwt/client/DateTimeService.java index 7bc8e8eba4..c2b44f2e20 100644 --- a/src/com/vaadin/terminal/gwt/client/DateTimeService.java +++ b/src/com/vaadin/terminal/gwt/client/DateTimeService.java @@ -195,9 +195,9 @@ public class DateTimeService { if (resolution == RESOLUTION_YEAR) { return (start <= target && end >= target); } - start += s.getMonth() * 100000000; - end += e.getMonth() * 100000000; - target += date.getMonth() * 100000000; + start += s.getMonth() * 100000000l; + end += e.getMonth() * 100000000l; + target += date.getMonth() * 100000000l; if (resolution == RESOLUTION_MONTH) { return (start <= target && end >= target); } diff --git a/src/com/vaadin/terminal/gwt/client/RenderInformation.java b/src/com/vaadin/terminal/gwt/client/RenderInformation.java index a91c0d7e24..6fb92c63e4 100644 --- a/src/com/vaadin/terminal/gwt/client/RenderInformation.java +++ b/src/com/vaadin/terminal/gwt/client/RenderInformation.java @@ -3,7 +3,7 @@ */ package com.vaadin.terminal.gwt.client; -import com.google.gwt.user.client.Element; +import com.google.gwt.user.client.Element; /** * Contains size information about a rendered container and its content area. @@ -90,9 +90,17 @@ public class RenderInformation { private int width, height; @Override - public boolean equals(Object obj) { + public boolean equals(Object obj) { + if (!(obj instanceof Size)) { + return false; + } Size other = (Size) obj; return other.width == width && other.height == height; + } + + @Override + public int hashCode() { + return (width << 8) | height; } public Size() { diff --git a/src/com/vaadin/terminal/gwt/client/VDebugConsole.java b/src/com/vaadin/terminal/gwt/client/VDebugConsole.java index dae9bdfa88..427cd097b1 100755 --- a/src/com/vaadin/terminal/gwt/client/VDebugConsole.java +++ b/src/com/vaadin/terminal/gwt/client/VDebugConsole.java @@ -365,7 +365,7 @@ public final class VDebugConsole extends VOverlay implements Console { str = msg.toString(); } panel.add((new Label(str))); - consoleLog(msg.toString()); + consoleLog(str); } /* diff --git a/src/com/vaadin/terminal/gwt/client/ui/VMarginInfo.java b/src/com/vaadin/terminal/gwt/client/ui/VMarginInfo.java index 961624dcd7..2fb047c007 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VMarginInfo.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VMarginInfo.java @@ -73,4 +73,9 @@ public class VMarginInfo implements Serializable { return ((VMarginInfo) obj).bitMask == bitMask; } + @Override + public int hashCode() { + return bitMask; + } + } diff --git a/src/com/vaadin/terminal/gwt/client/ui/VPanel.java b/src/com/vaadin/terminal/gwt/client/ui/VPanel.java index d41a739655..dfceb55416 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VPanel.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VPanel.java @@ -394,7 +394,7 @@ public class VPanel extends SimplePanel implements Container { public void setHeight(String height) { this.height = height; super.setHeight(height); - if (height != null && height != "") { + if (height != null && !"".equals(height)) { final int targetHeight = getOffsetHeight(); int containerHeight = targetHeight - captionNode.getParentElement().getOffsetHeight() diff --git a/src/com/vaadin/ui/AbstractField.java b/src/com/vaadin/ui/AbstractField.java index f7d1ddd79e..8d02602aab 100644 --- a/src/com/vaadin/ui/AbstractField.java +++ b/src/com/vaadin/ui/AbstractField.java @@ -1232,7 +1232,7 @@ public abstract class AbstractField extends AbstractComponent implements Field, } public void removeShortcutListener(ShortcutListener shortcut) { - if (actionManager == null) { + if (actionManager != null) { actionManager.removeAction(shortcut); } } diff --git a/src/com/vaadin/ui/Form.java b/src/com/vaadin/ui/Form.java index 0929c05b68..901d96db21 100644 --- a/src/com/vaadin/ui/Form.java +++ b/src/com/vaadin/ui/Form.java @@ -1325,7 +1325,7 @@ public class Form extends AbstractField implements Item.Editor, Buffered, Item, public void removeAction( T action) { - if (ownActionManager == null) { + if (ownActionManager != null) { ownActionManager.removeAction(action); } } diff --git a/src/com/vaadin/ui/MenuBar.java b/src/com/vaadin/ui/MenuBar.java index 036aa1b718..f53c7469ee 100644 --- a/src/com/vaadin/ui/MenuBar.java +++ b/src/com/vaadin/ui/MenuBar.java @@ -55,9 +55,6 @@ public class MenuBar extends AbstractComponent { // Superclass writes any common attributes in the paint target. super.paintContent(target); - // Stack for list iterators - Stack> iteratorStack = new Stack>(); - target.startTag("options"); if (submenuIcon != null) { -- cgit v1.2.3 From 77360c9efcc60eeb06aedcd6b1af409812fb1582 Mon Sep 17 00:00:00 2001 From: Henri Sara Date: Tue, 1 Jun 2010 11:42:07 +0000 Subject: Fixed some normal priority warnings by FindBugs svn changeset:13463/svn branch:6.3 --- .../vaadin/terminal/gwt/client/DateTimeService.java | 18 +++++++++--------- .../vaadin/terminal/gwt/server/DragAndDropService.java | 5 +---- src/com/vaadin/ui/GridLayout.java | 2 +- src/com/vaadin/ui/Table.java | 2 +- 4 files changed, 12 insertions(+), 15 deletions(-) (limited to 'src/com/vaadin') diff --git a/src/com/vaadin/terminal/gwt/client/DateTimeService.java b/src/com/vaadin/terminal/gwt/client/DateTimeService.java index c2b44f2e20..0693994a9e 100644 --- a/src/com/vaadin/terminal/gwt/client/DateTimeService.java +++ b/src/com/vaadin/terminal/gwt/client/DateTimeService.java @@ -201,21 +201,21 @@ public class DateTimeService { if (resolution == RESOLUTION_MONTH) { return (start <= target && end >= target); } - start += s.getDate() * 1000000; - end += e.getDate() * 1000000; - target += date.getDate() * 1000000; + start += s.getDate() * 1000000l; + end += e.getDate() * 1000000l; + target += date.getDate() * 1000000l; if (resolution == RESOLUTION_DAY) { return (start <= target && end >= target); } - start += s.getHours() * 10000; - end += e.getHours() * 10000; - target += date.getHours() * 10000; + start += s.getHours() * 10000l; + end += e.getHours() * 10000l; + target += date.getHours() * 10000l; if (resolution == RESOLUTION_HOUR) { return (start <= target && end >= target); } - start += s.getMinutes() * 100; - end += e.getMinutes() * 100; - target += date.getMinutes() * 100; + start += s.getMinutes() * 100l; + end += e.getMinutes() * 100l; + target += date.getMinutes() * 100l; if (resolution == RESOLUTION_MIN) { return (start <= target && end >= target); } diff --git a/src/com/vaadin/terminal/gwt/server/DragAndDropService.java b/src/com/vaadin/terminal/gwt/server/DragAndDropService.java index 9f8e3ba17e..4bc8d386b4 100644 --- a/src/com/vaadin/terminal/gwt/server/DragAndDropService.java +++ b/src/com/vaadin/terminal/gwt/server/DragAndDropService.java @@ -47,10 +47,7 @@ public class DragAndDropService implements VariableOwner { + " must implement DropTarget"); return; } - if (owner == null) { - System.err.println("DropHandler owner is null"); - return; - } + // owner cannot be null here DropTarget dropTarget = (DropTarget) owner; lastVisitId = (Integer) variables.get("visitId"); diff --git a/src/com/vaadin/ui/GridLayout.java b/src/com/vaadin/ui/GridLayout.java index 18a602280b..b7e92402cc 100644 --- a/src/com/vaadin/ui/GridLayout.java +++ b/src/com/vaadin/ui/GridLayout.java @@ -572,7 +572,7 @@ public class GridLayout extends AbstractLayout implements // Removes the cellUsed key as it has become // obsolete - cellUsed.remove(new Integer(curx)); + cellUsed.remove(Integer.valueOf(curx)); } } else { diff --git a/src/com/vaadin/ui/Table.java b/src/com/vaadin/ui/Table.java index 610d638ab4..ad9a0c2f3f 100644 --- a/src/com/vaadin/ui/Table.java +++ b/src/com/vaadin/ui/Table.java @@ -712,7 +712,7 @@ public class Table extends AbstractSelect implements Action.Container, if (width < 0) { columnWidths.remove(columnId); } else { - columnWidths.put(columnId, new Integer(width)); + columnWidths.put(columnId, Integer.valueOf(width)); } } -- cgit v1.2.3 From 367fc17f832c1e94937a128a4b2322a5afd38ca1 Mon Sep 17 00:00:00 2001 From: Henri Sara Date: Tue, 1 Jun 2010 11:46:55 +0000 Subject: Javadoc typo correction svn changeset:13466/svn branch:6.3 --- src/com/vaadin/event/dd/DropTarget.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/com/vaadin') diff --git a/src/com/vaadin/event/dd/DropTarget.java b/src/com/vaadin/event/dd/DropTarget.java index fcb9670f6f..0d88bf2893 100644 --- a/src/com/vaadin/event/dd/DropTarget.java +++ b/src/com/vaadin/event/dd/DropTarget.java @@ -24,7 +24,7 @@ public interface DropTarget extends Component { /** * Called before the {@link DragAndDropEvent} is passed to - * {@link DropHandler}. Implementation may for exmaple translate the drop + * {@link DropHandler}. Implementation may for example translate the drop * target details provided by the client side (drop target) to meaningful * server side values. If null is returned the terminal implementation will * automatically create a {@link TargetDetails} with raw client side data. -- cgit v1.2.3