Skip to content

Commit

Permalink
Fix malformed JMX ObjectName containing IPv6 addresses
Browse files Browse the repository at this point in the history
Patch by Erik Forsberg; Reviewed by Robert Stupp for CASSANDRA-9027
  • Loading branch information
forsberg authored and snazy committed Mar 25, 2015
1 parent f5f97d8 commit 495ae9c
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
2.0.14:
* Fix malformed JMX ObjectName containing IPv6 addresses (CASSANDRA-9027)
* Fix potential data loss in CompressedSequentialWriter (CASSANDRA-8949)
* (cqlsh) Allow increasing CSV field size limit through
cqlshrc config option (CASSANDRA-8934)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public class ConnectionMetrics
public ConnectionMetrics(InetAddress ip, final OutboundTcpConnectionPool connectionPool)
{
// ipv6 addresses will contain colons, which are invalid in a JMX ObjectName
address = ip.getHostAddress().replaceAll(":", ".");
address = ip.getHostAddress().replace(':', '.');

factory = new DefaultNameFactory("Connection", address);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public DifferencingCounter load(InetAddress address)
{
public Counter load(InetAddress address)
{
return Metrics.newCounter(factory.createMetricName("Hints_created-" + address.getHostAddress()));
return Metrics.newCounter(factory.createMetricName("Hints_created-" + address.getHostAddress().replace(':', '.')));
}
});

Expand Down Expand Up @@ -88,7 +88,7 @@ public class DifferencingCounter

public DifferencingCounter(InetAddress address)
{
this.meter = Metrics.newCounter(factory.createMetricName("Hints_not_stored-" + address.getHostAddress()));
this.meter = Metrics.newCounter(factory.createMetricName("Hints_not_stored-" + address.getHostAddress().replace(':', '.')));
}

public long difference()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public static StreamingMetrics get(InetAddress ip)

public StreamingMetrics(final InetAddress peer)
{
MetricNameFactory factory = new DefaultNameFactory("Streaming", peer.getHostAddress().replaceAll(":", "."));
MetricNameFactory factory = new DefaultNameFactory("Streaming", peer.getHostAddress().replace(':', '.'));
incomingBytes = Metrics.newCounter(factory.createMetricName("IncomingBytes"));
outgoingBytes= Metrics.newCounter(factory.createMetricName("OutgoingBytes"));
}
Expand Down

0 comments on commit 495ae9c

Please sign in to comment.