[JBoss JIRA] (LOGTOOL-101) Exception transformation
by David Lloyd (JIRA)
[ https://issues.jboss.org/browse/LOGTOOL-101?page=com.atlassian.jira.plugi... ]
David Lloyd commented on LOGTOOL-101:
-------------------------------------
Overloading is less good though because then I have to do this:
{code}
if (ex instanceof BindException) {
throw x.bindFailed(addr, (BindException) ex);
} else {
throw x.bindFailed(addr, ex);
}
{code}
or:
{code}
try {
// ...
} catch (BindException e) {
throw x.bindFailed(e);
} catch (IOException e) {
throw x.bindFailed(e);
}
{code}
Not the end of the world, but not ideal either.
> Exception transformation
> ------------------------
>
> Key: LOGTOOL-101
> URL: https://issues.jboss.org/browse/LOGTOOL-101
> Project: Log Tool
> Issue Type: Feature Request
> Reporter: David Lloyd
> Assignee: James Perkins
>
> I'd like to be able to transform an exception message. What this means is, create a new exception, embed its message in my message, and copy its stack trace to mine.
> Something like this:
> {code}
> @Message(id = 1234, "Binding to %s failed")
> IOException bindFailed(SocketAddress bindAddress, @TransformException IOException cause)
> {code}
> This would yield a message like: "Binding to 1.2.3.4/1234 failed: Address already in use". Note the addition of the ": " and the source string.
> Note that I can almost do this now, except that there's no way to copy the exception stack:
> {code}
> @Message(id = 1234, "Binding to %s failed: %s")
> IOException bindFailed(SocketAddress bindAddress, IOException cause)
> {code}
> An alternative approach is to add an annotation for copying the stack trace:
> {code}
> @Message(id = 1234, "Binding to %s failed")
> IOException bindFailed(SocketAddress bindAddress, @CopyStackFrom IOException cause)
> {code}
> Note that in this case the original exception message is lost. The next variant would preserve the message:
> {code}
> @Message(id = 1234, "Binding to %s failed: %s")
> IOException bindFailed(SocketAddress bindAddress, IOException cause, @CopyStackFrom IOException cause2)
> {code}
> And now to eliminate the duplication:
> {code}
> @Message(id = 1234, "Binding to %s failed: %s")
> IOException bindFailed(SocketAddress bindAddress, @CopyStackFrom @Pos(2) IOException cause)
> {code}
> Note that I don't recall if @Pos is 1- or 0-based, so I guessed.
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
8 years
[JBoss JIRA] (LOGTOOL-101) Exception transformation
by David Lloyd (JIRA)
[ https://issues.jboss.org/browse/LOGTOOL-101?page=com.atlassian.jira.plugi... ]
David Lloyd commented on LOGTOOL-101:
-------------------------------------
Failing that (cloning), an alternative is to allow overloading:
{code}
@Message(id = 1234, "Binding to %s failed: %s")
IOException bindFailed(SocketAddress bindAddress, @CopyStackFrom @Pos(2) IOException cause)
BindException bindFailed(SocketAddress bindAddress, @CopyStackFrom @Pos(2) BindException cause)
{code}
Which I think is allowed today (right?).
> Exception transformation
> ------------------------
>
> Key: LOGTOOL-101
> URL: https://issues.jboss.org/browse/LOGTOOL-101
> Project: Log Tool
> Issue Type: Feature Request
> Reporter: David Lloyd
> Assignee: James Perkins
>
> I'd like to be able to transform an exception message. What this means is, create a new exception, embed its message in my message, and copy its stack trace to mine.
> Something like this:
> {code}
> @Message(id = 1234, "Binding to %s failed")
> IOException bindFailed(SocketAddress bindAddress, @TransformException IOException cause)
> {code}
> This would yield a message like: "Binding to 1.2.3.4/1234 failed: Address already in use". Note the addition of the ": " and the source string.
> Note that I can almost do this now, except that there's no way to copy the exception stack:
> {code}
> @Message(id = 1234, "Binding to %s failed: %s")
> IOException bindFailed(SocketAddress bindAddress, IOException cause)
> {code}
> An alternative approach is to add an annotation for copying the stack trace:
> {code}
> @Message(id = 1234, "Binding to %s failed")
> IOException bindFailed(SocketAddress bindAddress, @CopyStackFrom IOException cause)
> {code}
> Note that in this case the original exception message is lost. The next variant would preserve the message:
> {code}
> @Message(id = 1234, "Binding to %s failed: %s")
> IOException bindFailed(SocketAddress bindAddress, IOException cause, @CopyStackFrom IOException cause2)
> {code}
> And now to eliminate the duplication:
> {code}
> @Message(id = 1234, "Binding to %s failed: %s")
> IOException bindFailed(SocketAddress bindAddress, @CopyStackFrom @Pos(2) IOException cause)
> {code}
> Note that I don't recall if @Pos is 1- or 0-based, so I guessed.
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
8 years
[JBoss JIRA] (LOGTOOL-101) Exception transformation
by David Lloyd (JIRA)
[ https://issues.jboss.org/browse/LOGTOOL-101?page=com.atlassian.jira.plugi... ]
David Lloyd commented on LOGTOOL-101:
-------------------------------------
Bonus points if you can figure out a way to clone the exception type!
> Exception transformation
> ------------------------
>
> Key: LOGTOOL-101
> URL: https://issues.jboss.org/browse/LOGTOOL-101
> Project: Log Tool
> Issue Type: Feature Request
> Reporter: David Lloyd
> Assignee: James Perkins
>
> I'd like to be able to transform an exception message. What this means is, create a new exception, embed its message in my message, and copy its stack trace to mine.
> Something like this:
> {code}
> @Message(id = 1234, "Binding to %s failed")
> IOException bindFailed(SocketAddress bindAddress, @TransformException IOException cause)
> {code}
> This would yield a message like: "Binding to 1.2.3.4/1234 failed: Address already in use". Note the addition of the ": " and the source string.
> Note that I can almost do this now, except that there's no way to copy the exception stack:
> {code}
> @Message(id = 1234, "Binding to %s failed: %s")
> IOException bindFailed(SocketAddress bindAddress, IOException cause)
> {code}
> An alternative approach is to add an annotation for copying the stack trace:
> {code}
> @Message(id = 1234, "Binding to %s failed")
> IOException bindFailed(SocketAddress bindAddress, @CopyStackFrom IOException cause)
> {code}
> Note that in this case the original exception message is lost. The next variant would preserve the message:
> {code}
> @Message(id = 1234, "Binding to %s failed: %s")
> IOException bindFailed(SocketAddress bindAddress, IOException cause, @CopyStackFrom IOException cause2)
> {code}
> And now to eliminate the duplication:
> {code}
> @Message(id = 1234, "Binding to %s failed: %s")
> IOException bindFailed(SocketAddress bindAddress, @CopyStackFrom @Pos(2) IOException cause)
> {code}
> Note that I don't recall if @Pos is 1- or 0-based, so I guessed.
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
8 years
[JBoss JIRA] (LOGTOOL-101) Exception transformation
by David Lloyd (JIRA)
David Lloyd created LOGTOOL-101:
-----------------------------------
Summary: Exception transformation
Key: LOGTOOL-101
URL: https://issues.jboss.org/browse/LOGTOOL-101
Project: Log Tool
Issue Type: Feature Request
Reporter: David Lloyd
Assignee: James Perkins
I'd like to be able to transform an exception message. What this means is, create a new exception, embed its message in my message, and copy its stack trace to mine.
Something like this:
{code}
@Message(id = 1234, "Binding to %s failed")
IOException bindFailed(SocketAddress bindAddress, @TransformException IOException cause)
{code}
This would yield a message like: "Binding to 1.2.3.4/1234 failed: Address already in use". Note the addition of the ": " and the source string.
Note that I can almost do this now, except that there's no way to copy the exception stack:
{code}
@Message(id = 1234, "Binding to %s failed: %s")
IOException bindFailed(SocketAddress bindAddress, IOException cause)
{code}
An alternative approach is to add an annotation for copying the stack trace:
{code}
@Message(id = 1234, "Binding to %s failed")
IOException bindFailed(SocketAddress bindAddress, @CopyStackFrom IOException cause)
{code}
Note that in this case the original exception message is lost. The next variant would preserve the message:
{code}
@Message(id = 1234, "Binding to %s failed: %s")
IOException bindFailed(SocketAddress bindAddress, IOException cause, @CopyStackFrom IOException cause2)
{code}
And now to eliminate the duplication:
{code}
@Message(id = 1234, "Binding to %s failed: %s")
IOException bindFailed(SocketAddress bindAddress, @CopyStackFrom @Pos(2) IOException cause)
{code}
Note that I don't recall if @Pos is 1- or 0-based, so I guessed.
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
8 years
[JBoss JIRA] (JGRP-2023) Network unreachable with localhost addresses if -Djava.net.preferIPv4Stack=true isn't specified
by Richard Janík (JIRA)
[ https://issues.jboss.org/browse/JGRP-2023?page=com.atlassian.jira.plugin.... ]
Richard Janík commented on JGRP-2023:
-------------------------------------
I've managed to set up multicast on localhost on my machine by doing the following:
* add multicast flag to my localhost interface: {{sudo ifconfig lo multicast}}
* add a routing with a interface local address: {{sudo route -6 add ff01::/16 dev lo}}
* and use the interface local multicast address {{ff01::1}}
* I also had firewall turned off (fedora 22: {{sudo service firewalld stop}}) so it might be necessary to tune that as well
> Network unreachable with localhost addresses if -Djava.net.preferIPv4Stack=true isn't specified
> -----------------------------------------------------------------------------------------------
>
> Key: JGRP-2023
> URL: https://issues.jboss.org/browse/JGRP-2023
> Project: JGroups
> Issue Type: Bug
> Affects Versions: 3.6.7, 3.6.8
> Environment: $ java -version
> java version "1.8.0_45"
> Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
> Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)
> Reporter: Richard Janík
> Assignee: Bela Ban
>
> When setting {{-bind_addr}} to localhost (either 127.0.0.1 or ::1) without specifying {{-Djava.net.preferIPv4Stack=true}}, JGroups fail to connect. The following errors are logged:
> {code}
> -------------------------------------------------------------------
> GMS: address=rjanik-24069, cluster=draw, physical address=0:0:0:0:0:0:0:1:37921
> -------------------------------------------------------------------
> Mar 03, 2016 11:41:12 AM org.jgroups.protocols.TP$BaseBundler sendSingleMessage
> SEVERE: JGRP000029: rjanik-24069: failed sending message to cluster (108 bytes): java.io.IOException: Network is unreachable, headers: PING: [type=GET_MBRS_REQ, cluster=draw], TP: [cluster_name=draw]
> ** View=[rjanik-24069|0] (1) [rjanik-24069]
> Mar 03, 2016 11:41:15 AM org.jgroups.protocols.TP$BaseBundler sendSingleMessage
> SEVERE: JGRP000029: rjanik-24069: failed sending message to cluster (56 bytes): java.io.IOException: Network is unreachable, headers: NAKACK2: [MSG, seqno=1], TP: [cluster_name=draw]
> {code}
> I'm not sure if there's some other configuration option that I forgot to add, but the example (in Steps to Reproduce) works with previous versions (3.6.6 for example), so I assume not.
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
8 years