Discussion:
git commit: The declared exception ClassNotFoundException is not actually thrown by the private method readObject(ObjectInputStream) from type MessageFormatMessage.
Matt Sicker
2014-09-28 15:27:10 UTC
Permalink
http://docs.oracle.com/javase/8/docs/api/java/io/Serializable.html

Is it ok to not have the exact exception signature then?

---------- Forwarded message ----------
From: <***@apache.org>
Date: 27 September 2014 07:31
Subject: git commit: The declared exception ClassNotFoundException is not
actually thrown by the private method readObject(ObjectInputStream) from
type MessageFormatMessage.
To: ***@logging.apache.org


Repository: logging-log4j2
Updated Branches:
refs/heads/master 12715841a -> 95132eb37


The declared exception ClassNotFoundException is not actually thrown by
the private method readObject(ObjectInputStream) from type
MessageFormatMessage.

Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit:
http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/95132eb3
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/95132eb3
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/95132eb3

Branch: refs/heads/master
Commit: 95132eb371e0cf6ed422ee9155ac4a64b2bfdcc5
Parents: 1271584
Author: Gary Gregory <***@gmail.com>
Authored: Sat Sep 27 08:31:08 2014 -0400
Committer: Gary Gregory <***@gmail.com>
Committed: Sat Sep 27 08:31:08 2014 -0400

----------------------------------------------------------------------
.../org/apache/logging/log4j/message/MessageFormatMessage.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/95132eb3/log4j-api/src/main/java/org/apache/logging/log4j/message/MessageFormatMessage.java
----------------------------------------------------------------------
diff --git
a/log4j-api/src/main/java/org/apache/logging/log4j/message/MessageFormatMessage.java
b/log4j-api/src/main/java/org/apache/logging/log4j/message/MessageFormatMessage.java
index 45a6b31..705aed9 100644
---
a/log4j-api/src/main/java/org/apache/logging/log4j/message/MessageFormatMessage.java
+++
b/log4j-api/src/main/java/org/apache/logging/log4j/message/MessageFormatMessage.java
@@ -144,7 +144,7 @@ public class MessageFormatMessage implements Message {
}
}

- private void readObject(final ObjectInputStream in) throws
IOException, ClassNotFoundException {
+ private void readObject(final ObjectInputStream in) throws IOException
{
parameters = null;
throwable = null;
formattedMessage = in.readUTF();
--
Matt Sicker <***@gmail.com>
Ralph Goers
2014-09-28 20:20:21 UTC
Permalink
I find that surprising to me as well. I would have thought that would generate a compiler error.

Ralph
Post by Matt Sicker
http://docs.oracle.com/javase/8/docs/api/java/io/Serializable.html
Is it ok to not have the exact exception signature then?
---------- Forwarded message ----------
Date: 27 September 2014 07:31
Subject: git commit: The declared exception ClassNotFoundException is not actually thrown by the private method readObject(ObjectInputStream) from type MessageFormatMessage.
Repository: logging-log4j2
refs/heads/master 12715841a -> 95132eb37
The declared exception ClassNotFoundException is not actually thrown by
the private method readObject(ObjectInputStream) from type
MessageFormatMessage.
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/95132eb3
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/95132eb3
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/95132eb3
Branch: refs/heads/master
Commit: 95132eb371e0cf6ed422ee9155ac4a64b2bfdcc5
Parents: 1271584
Authored: Sat Sep 27 08:31:08 2014 -0400
Committed: Sat Sep 27 08:31:08 2014 -0400
----------------------------------------------------------------------
.../org/apache/logging/log4j/message/MessageFormatMessage.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/95132eb3/log4j-api/src/main/java/org/apache/logging/log4j/message/MessageFormatMessage.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/message/MessageFormatMessage.java b/log4j-api/src/main/java/org/apache/logging/log4j/message/MessageFormatMessage.java
index 45a6b31..705aed9 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/message/MessageFormatMessage.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/message/MessageFormatMessage.java
@@ -144,7 +144,7 @@ public class MessageFormatMessage implements Message {
}
}
- private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException {
+ private void readObject(final ObjectInputStream in) throws IOException {
parameters = null;
throwable = null;
formattedMessage = in.readUTF();
--
Remko Popma
2014-09-28 21:53:28 UTC
Permalink
It is ok for a subclass or interface impl to throw fewer exceptions than declared by super/interface. (But not more.)

Sent from my iPhone
Post by Ralph Goers
I find that surprising to me as well. I would have thought that would generate a compiler error.
Ralph
Post by Matt Sicker
http://docs.oracle.com/javase/8/docs/api/java/io/Serializable.html
Is it ok to not have the exact exception signature then?
---------- Forwarded message ----------
Date: 27 September 2014 07:31
Subject: git commit: The declared exception ClassNotFoundException is not actually thrown by the private method readObject(ObjectInputStream) from type MessageFormatMessage.
Repository: logging-log4j2
refs/heads/master 12715841a -> 95132eb37
The declared exception ClassNotFoundException is not actually thrown by
the private method readObject(ObjectInputStream) from type
MessageFormatMessage.
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/95132eb3
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/95132eb3
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/95132eb3
Branch: refs/heads/master
Commit: 95132eb371e0cf6ed422ee9155ac4a64b2bfdcc5
Parents: 1271584
Authored: Sat Sep 27 08:31:08 2014 -0400
Committed: Sat Sep 27 08:31:08 2014 -0400
----------------------------------------------------------------------
.../org/apache/logging/log4j/message/MessageFormatMessage.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/95132eb3/log4j-api/src/main/java/org/apache/logging/log4j/message/MessageFormatMessage.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/message/MessageFormatMessage.java b/log4j-api/src/main/java/org/apache/logging/log4j/message/MessageFormatMessage.java
index 45a6b31..705aed9 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/message/MessageFormatMessage.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/message/MessageFormatMessage.java
@@ -144,7 +144,7 @@ public class MessageFormatMessage implements Message {
}
}
- private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException {
+ private void readObject(final ObjectInputStream in) throws IOException {
parameters = null;
throwable = null;
formattedMessage = in.readUTF();
--
Remko Popma
2014-09-28 22:05:13 UTC
Permalink
Post by Remko Popma
It is ok for a subclass or interface impl to throw fewer exceptions than
declared by super/interface. (But not more.)
Actually, I take that back: I'm not sure that Serialization works: Matt's
link says it must have that _exact_ signature. The compiler may accept it,
but it may not do what we want.
Post by Remko Popma
Sent from my iPhone
I find that surprising to me as well. I would have thought that would
generate a compiler error.
Ralph
http://docs.oracle.com/javase/8/docs/api/java/io/Serializable.html
Is it ok to not have the exact exception signature then?
---------- Forwarded message ----------
Date: 27 September 2014 07:31
Subject: git commit: The declared exception ClassNotFoundException is not
actually thrown by the private method readObject(ObjectInputStream) from
type MessageFormatMessage.
Repository: logging-log4j2
refs/heads/master 12715841a -> 95132eb37
The declared exception ClassNotFoundException is not actually thrown by
the private method readObject(ObjectInputStream) from type
MessageFormatMessage.
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/95132eb3
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/95132eb3
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/95132eb3
Branch: refs/heads/master
Commit: 95132eb371e0cf6ed422ee9155ac4a64b2bfdcc5
Parents: 1271584
Authored: Sat Sep 27 08:31:08 2014 -0400
Committed: Sat Sep 27 08:31:08 2014 -0400
----------------------------------------------------------------------
.../org/apache/logging/log4j/message/MessageFormatMessage.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/95132eb3/log4j-api/src/main/java/org/apache/logging/log4j/message/MessageFormatMessage.java
----------------------------------------------------------------------
diff --git
a/log4j-api/src/main/java/org/apache/logging/log4j/message/MessageFormatMessage.java
b/log4j-api/src/main/java/org/apache/logging/log4j/message/MessageFormatMessage.java
index 45a6b31..705aed9 100644
---
a/log4j-api/src/main/java/org/apache/logging/log4j/message/MessageFormatMessage.java
+++
b/log4j-api/src/main/java/org/apache/logging/log4j/message/MessageFormatMessage.java
@@ -144,7 +144,7 @@ public class MessageFormatMessage implements Message {
}
}
- private void readObject(final ObjectInputStream in) throws
IOException, ClassNotFoundException {
+ private void readObject(final ObjectInputStream in) throws IOException {
parameters = null;
throwable = null;
formattedMessage = in.readUTF();
--
Matt Sicker
2014-09-28 22:14:57 UTC
Permalink
That's why I just went with the whole copy/paste notion of serializability.
Post by Remko Popma
Post by Remko Popma
It is ok for a subclass or interface impl to throw fewer exceptions than
declared by super/interface. (But not more.)
Actually, I take that back: I'm not sure that Serialization works: Matt's
link says it must have that _exact_ signature. The compiler may accept it,
but it may not do what we want.
Post by Remko Popma
Sent from my iPhone
I find that surprising to me as well. I would have thought that would
generate a compiler error.
Ralph
http://docs.oracle.com/javase/8/docs/api/java/io/Serializable.html
Is it ok to not have the exact exception signature then?
---------- Forwarded message ----------
Date: 27 September 2014 07:31
Subject: git commit: The declared exception ClassNotFoundException is not
actually thrown by the private method readObject(ObjectInputStream) from
type MessageFormatMessage.
Repository: logging-log4j2
refs/heads/master 12715841a -> 95132eb37
The declared exception ClassNotFoundException is not actually thrown by
the private method readObject(ObjectInputStream) from type
MessageFormatMessage.
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/95132eb3
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/95132eb3
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/95132eb3
Branch: refs/heads/master
Commit: 95132eb371e0cf6ed422ee9155ac4a64b2bfdcc5
Parents: 1271584
Authored: Sat Sep 27 08:31:08 2014 -0400
Committed: Sat Sep 27 08:31:08 2014 -0400
----------------------------------------------------------------------
.../org/apache/logging/log4j/message/MessageFormatMessage.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/95132eb3/log4j-api/src/main/java/org/apache/logging/log4j/message/MessageFormatMessage.java
----------------------------------------------------------------------
diff --git
a/log4j-api/src/main/java/org/apache/logging/log4j/message/MessageFormatMessage.java
b/log4j-api/src/main/java/org/apache/logging/log4j/message/MessageFormatMessage.java
index 45a6b31..705aed9 100644
---
a/log4j-api/src/main/java/org/apache/logging/log4j/message/MessageFormatMessage.java
+++
b/log4j-api/src/main/java/org/apache/logging/log4j/message/MessageFormatMessage.java
@@ -144,7 +144,7 @@ public class MessageFormatMessage implements Message {
}
}
- private void readObject(final ObjectInputStream in) throws
IOException, ClassNotFoundException {
+ private void readObject(final ObjectInputStream in) throws IOException {
parameters = null;
throwable = null;
formattedMessage = in.readUTF();
--
--
Matt Sicker <***@gmail.com>
Loading...