You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by mg...@apache.org on 2015/09/06 23:27:58 UTC
wicket git commit: WICKET-5973 IllegalArgumentException 'bytes'
cannot be negative. on opening Inspector
Repository: wicket
Updated Branches:
refs/heads/wicket-6.x 8f8b1a49b -> 25242467a
WICKET-5973 IllegalArgumentException 'bytes' cannot be negative. on opening Inspector
Component#getSizeInBytes() should not return negative size when there is an error in the calculation.
Errors are just logged and the size could be used at the call site. For example, this breaks Bytes.bytes()
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/25242467
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/25242467
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/25242467
Branch: refs/heads/wicket-6.x
Commit: 25242467abf4c13b99b7d97bd1ed9b5bb30172cb
Parents: 8f8b1a4
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Sun Sep 6 23:26:06 2015 +0200
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Sun Sep 6 23:26:06 2015 +0200
----------------------------------------------------------------------
wicket-core/src/main/java/org/apache/wicket/Component.java | 4 ++--
wicket-util/src/main/java/org/apache/wicket/util/lang/Bytes.java | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/25242467/wicket-core/src/main/java/org/apache/wicket/Component.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/Component.java b/wicket-core/src/main/java/org/apache/wicket/Component.java
index 20e15e5..d1db86e 100644
--- a/wicket-core/src/main/java/org/apache/wicket/Component.java
+++ b/wicket-core/src/main/java/org/apache/wicket/Component.java
@@ -1822,13 +1822,13 @@ public abstract class Component
}
/**
- * @return Size of this Component in bytes
+ * @return Size of this Component in bytes. Returns {@code 0} - if the size cannot be calculated for some reason
*/
public long getSizeInBytes()
{
final MarkupContainer originalParent = parent;
parent = null;
- long size = -1;
+ long size = 0;
try
{
size = WicketObjects.sizeof(this);
http://git-wip-us.apache.org/repos/asf/wicket/blob/25242467/wicket-util/src/main/java/org/apache/wicket/util/lang/Bytes.java
----------------------------------------------------------------------
diff --git a/wicket-util/src/main/java/org/apache/wicket/util/lang/Bytes.java b/wicket-util/src/main/java/org/apache/wicket/util/lang/Bytes.java
index 9d860ef..425b061 100644
--- a/wicket-util/src/main/java/org/apache/wicket/util/lang/Bytes.java
+++ b/wicket-util/src/main/java/org/apache/wicket/util/lang/Bytes.java
@@ -108,7 +108,7 @@ public final class Bytes extends LongValue
if (bytes < 0)
{
- throw new IllegalArgumentException("'bytes' cannot be negative.");
+ throw new IllegalArgumentException("'bytes' cannot be negative: " + bytes);
}
}