aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Perot2014-07-30 14:45:05 (EDT)
committerMarc-Andre Laperle2014-08-07 18:22:05 (EDT)
commite2a16c394b755a57d745387bb207581caa5000c4 (patch)
treec300bb4a2ce056abfe1d0c95f46de28371db6868
parent640dde857f26904d052f6b0fdac3cf645aaa3f5f (diff)
downloadorg.eclipse.linuxtools-e2a16c394b755a57d745387bb207581caa5000c4.zip
org.eclipse.linuxtools-e2a16c394b755a57d745387bb207581caa5000c4.tar.gz
org.eclipse.linuxtools-e2a16c394b755a57d745387bb207581caa5000c4.tar.bz2
pcap: remove some sonar critical issues for pcap.corerefs/changes/56/30756/4
Change-Id: Ifd96292525f9707a47fd4dd795880460a49ab67a Signed-off-by: Vincent Perot <vincent.perot@ericsson.com> Reviewed-on: https://git.eclipse.org/r/30756 Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com> Tested-by: Hudson CI Reviewed-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
-rw-r--r--lttng/org.eclipse.linuxtools.pcap.core.tests/src/org/eclipse/linuxtools/pcap/core/tests/protocol/ipv4/IPv4PacketTest.java15
-rw-r--r--lttng/org.eclipse.linuxtools.pcap.core.tests/src/org/eclipse/linuxtools/pcap/core/tests/protocol/pcap/PcapPacketTest.java2
-rw-r--r--lttng/org.eclipse.linuxtools.pcap.core/src/org/eclipse/linuxtools/pcap/core/protocol/ethernet2/EthernetIIEndpoint.java2
-rw-r--r--lttng/org.eclipse.linuxtools.pcap.core/src/org/eclipse/linuxtools/pcap/core/protocol/ethernet2/EthernetIIPacket.java11
-rw-r--r--lttng/org.eclipse.linuxtools.pcap.core/src/org/eclipse/linuxtools/pcap/core/protocol/ipv4/IPv4Endpoint.java16
-rw-r--r--lttng/org.eclipse.linuxtools.pcap.core/src/org/eclipse/linuxtools/pcap/core/protocol/ipv4/IPv4Packet.java54
-rw-r--r--lttng/org.eclipse.linuxtools.pcap.core/src/org/eclipse/linuxtools/pcap/core/stream/PacketStreamBuilder.java2
-rw-r--r--lttng/org.eclipse.linuxtools.pcap.core/src/org/eclipse/linuxtools/pcap/core/util/ConversionHelper.java22
8 files changed, 64 insertions, 60 deletions
diff --git a/lttng/org.eclipse.linuxtools.pcap.core.tests/src/org/eclipse/linuxtools/pcap/core/tests/protocol/ipv4/IPv4PacketTest.java b/lttng/org.eclipse.linuxtools.pcap.core.tests/src/org/eclipse/linuxtools/pcap/core/tests/protocol/ipv4/IPv4PacketTest.java
index 2877b25..67f9993 100644
--- a/lttng/org.eclipse.linuxtools.pcap.core.tests/src/org/eclipse/linuxtools/pcap/core/tests/protocol/ipv4/IPv4PacketTest.java
+++ b/lttng/org.eclipse.linuxtools.pcap.core.tests/src/org/eclipse/linuxtools/pcap/core/tests/protocol/ipv4/IPv4PacketTest.java
@@ -19,6 +19,7 @@ import static org.junit.Assert.fail;
import static org.junit.Assume.assumeTrue;
import java.io.IOException;
+import java.net.InetAddress;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.Arrays;
@@ -42,7 +43,6 @@ import org.junit.Test;
*/
public class IPv4PacketTest {
-
private static final Map<String, String> EXPECTED_FIELDS;
static {
EXPECTED_FIELDS = new LinkedHashMap<>();
@@ -54,7 +54,7 @@ public class IPv4PacketTest {
EXPECTED_FIELDS.put("Identification", "0x0ff0");
EXPECTED_FIELDS.put("Don't Fragment Flag", "false");
EXPECTED_FIELDS.put("More Fragment Flag", "false");
- EXPECTED_FIELDS.put("Fragment Offset", "-31");
+ EXPECTED_FIELDS.put("Fragment Offset", "7905");
EXPECTED_FIELDS.put("Time to live", "160");
EXPECTED_FIELDS.put("Protocol", "Unknown (254)");
EXPECTED_FIELDS.put("Checksum", "0x3344");
@@ -69,7 +69,7 @@ public class IPv4PacketTest {
sb.append("Internet Protocol Version 4, Source: 192.168.1.0, Destination: 193.169.2.1\n");
sb.append("Version: 4, Identification: 0x0ff0, Header Length: 24 bytes, Total Length: 255 bytes\n");
sb.append("Differentiated Services Code Point: 0x26; Explicit Congestion Notification: 0x02\n");
- sb.append("Flags: 0x00 (Don't have more fragments), Fragment Offset: -31\n");
+ sb.append("Flags: 0x00 (Don't have more fragments), Fragment Offset: 7905\n");
sb.append("Time to live: 160\n");
sb.append("Protocol: 254\n");
sb.append("Header Checksum: 0x3344\n");
@@ -143,6 +143,7 @@ public class IPv4PacketTest {
/**
* Test that verify the correctness of the IPv4Packet's methods.
+ *
* @throws BadPcapFileException
* Thrown when the file is erroneous. Fails the test.
* @throws IOException
@@ -171,7 +172,7 @@ public class IPv4PacketTest {
// Abstract methods Testing
assertTrue(packet.validate());
- assertEquals(1910842322, packet.hashCode());
+ assertEquals(-222021887, packet.hashCode());
assertFalse(packet.equals(null));
assertEquals(new IPv4Packet(dummy, null, byteBuffer), packet);
@@ -189,8 +190,8 @@ public class IPv4PacketTest {
assertEquals(ByteBuffer.wrap(payload), packet.getPayload());
// Packet-specific methods Testing
- assertTrue(Arrays.equals(packet.getSourceIpAddress(), Arrays.copyOfRange(fPacket.array(), 12, 16)));
- assertTrue(Arrays.equals(packet.getDestinationIpAddress(), Arrays.copyOfRange(fPacket.array(), 16, 20)));
+ assertEquals(InetAddress.getByAddress(Arrays.copyOfRange(fPacket.array(), 12, 16)), packet.getSourceIpAddress());
+ assertEquals(InetAddress.getByAddress(Arrays.copyOfRange(fPacket.array(), 16, 20)), packet.getDestinationIpAddress());
assertTrue(Arrays.equals(packet.getOptions(), Arrays.copyOfRange(fPacket.array(), 20, 24)));
assertEquals(4, packet.getVersion());
assertEquals(24, packet.getHeaderLength());
@@ -201,7 +202,7 @@ public class IPv4PacketTest {
assertFalse(packet.getReservedFlag());
assertFalse(packet.getDontFragmentFlag());
assertFalse(packet.getHasMoreFragment());
- assertEquals(-31, packet.getFragmentOffset());
+ assertEquals(7905, packet.getFragmentOffset());
assertEquals(160, packet.getTimeToLive());
assertEquals(0xFE, packet.getIpDatagramProtocol());
assertEquals(0x3344, packet.getHeaderChecksum());
diff --git a/lttng/org.eclipse.linuxtools.pcap.core.tests/src/org/eclipse/linuxtools/pcap/core/tests/protocol/pcap/PcapPacketTest.java b/lttng/org.eclipse.linuxtools.pcap.core.tests/src/org/eclipse/linuxtools/pcap/core/tests/protocol/pcap/PcapPacketTest.java
index 3492bc9..3df865c 100644
--- a/lttng/org.eclipse.linuxtools.pcap.core.tests/src/org/eclipse/linuxtools/pcap/core/tests/protocol/pcap/PcapPacketTest.java
+++ b/lttng/org.eclipse.linuxtools.pcap.core.tests/src/org/eclipse/linuxtools/pcap/core/tests/protocol/pcap/PcapPacketTest.java
@@ -198,7 +198,7 @@ public class PcapPacketTest {
// Abstract methods Testing
assertTrue(packet.validate());
- assertEquals(842182851, packet.hashCode());
+ assertEquals(86567859, packet.hashCode());
assertFalse(packet.equals(null));
assertFalse(packet.equals(file.parseNextPacket()));
diff --git a/lttng/org.eclipse.linuxtools.pcap.core/src/org/eclipse/linuxtools/pcap/core/protocol/ethernet2/EthernetIIEndpoint.java b/lttng/org.eclipse.linuxtools.pcap.core/src/org/eclipse/linuxtools/pcap/core/protocol/ethernet2/EthernetIIEndpoint.java
index e2fb07f..284ebd9 100644
--- a/lttng/org.eclipse.linuxtools.pcap.core/src/org/eclipse/linuxtools/pcap/core/protocol/ethernet2/EthernetIIEndpoint.java
+++ b/lttng/org.eclipse.linuxtools.pcap.core/src/org/eclipse/linuxtools/pcap/core/protocol/ethernet2/EthernetIIEndpoint.java
@@ -90,7 +90,7 @@ public class EthernetIIEndpoint extends ProtocolEndpoint {
if (endpoint == null) {
return ConversionHelper.toMacAddress(fMacAddress);
}
- return (endpoint.toString() == EMPTY_STRING ?
+ return (endpoint.toString().equals(EMPTY_STRING) ?
ConversionHelper.toMacAddress(fMacAddress) :
endpoint.toString() + '/' + ConversionHelper.toMacAddress(fMacAddress));
diff --git a/lttng/org.eclipse.linuxtools.pcap.core/src/org/eclipse/linuxtools/pcap/core/protocol/ethernet2/EthernetIIPacket.java b/lttng/org.eclipse.linuxtools.pcap.core/src/org/eclipse/linuxtools/pcap/core/protocol/ethernet2/EthernetIIPacket.java
index 45a07a5..72ddfda 100644
--- a/lttng/org.eclipse.linuxtools.pcap.core/src/org/eclipse/linuxtools/pcap/core/protocol/ethernet2/EthernetIIPacket.java
+++ b/lttng/org.eclipse.linuxtools.pcap.core/src/org/eclipse/linuxtools/pcap/core/protocol/ethernet2/EthernetIIPacket.java
@@ -42,8 +42,11 @@ public class EthernetIIPacket extends Packet {
private final @Nullable Packet fChildPacket;
private final @Nullable ByteBuffer fPayload;
+ /* We store MAC addresses as byte arrays since
+ * there is no standard java class to store them. */
private final byte[] fSourceMacAddress;
private final byte[] fDestinationMacAddress;
+
private final int fType;
private @Nullable EthernetIIEndpoint fSourceEndpoint;
@@ -121,7 +124,9 @@ public class EthernetIIPacket extends Packet {
* @return The source MAC address.
*/
public byte[] getSourceMacAddress() {
- return fSourceMacAddress;
+ @SuppressWarnings("null")
+ @NonNull byte[] mac = Arrays.copyOf(fSourceMacAddress, fSourceMacAddress.length);
+ return mac;
}
/**
@@ -130,7 +135,9 @@ public class EthernetIIPacket extends Packet {
* @return The destination MAC address.
*/
public byte[] getDestinationMacAddress() {
- return fDestinationMacAddress;
+ @SuppressWarnings("null")
+ @NonNull byte[] mac = Arrays.copyOf(fDestinationMacAddress, fDestinationMacAddress.length);
+ return mac;
}
/**
diff --git a/lttng/org.eclipse.linuxtools.pcap.core/src/org/eclipse/linuxtools/pcap/core/protocol/ipv4/IPv4Endpoint.java b/lttng/org.eclipse.linuxtools.pcap.core/src/org/eclipse/linuxtools/pcap/core/protocol/ipv4/IPv4Endpoint.java
index 96cde6f..68b6392 100644
--- a/lttng/org.eclipse.linuxtools.pcap.core/src/org/eclipse/linuxtools/pcap/core/protocol/ipv4/IPv4Endpoint.java
+++ b/lttng/org.eclipse.linuxtools.pcap.core/src/org/eclipse/linuxtools/pcap/core/protocol/ipv4/IPv4Endpoint.java
@@ -12,11 +12,11 @@
package org.eclipse.linuxtools.pcap.core.protocol.ipv4;
-import java.util.Arrays;
+import java.net.Inet4Address;
+import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.linuxtools.pcap.core.endpoint.ProtocolEndpoint;
-import org.eclipse.linuxtools.pcap.core.util.ConversionHelper;
/**
* Class that extends the {@link ProtocolEndpoint} class. It represents the
@@ -26,7 +26,7 @@ import org.eclipse.linuxtools.pcap.core.util.ConversionHelper;
*/
public class IPv4Endpoint extends ProtocolEndpoint {
- private final byte[] fIPAddress;
+ private final Inet4Address fIPAddress;
/**
* Constructor of the {@link IPv4Endpoint} class. It takes a packet to get
@@ -57,7 +57,7 @@ public class IPv4Endpoint extends ProtocolEndpoint {
result = endpoint.hashCode();
}
- result = prime * result + Arrays.hashCode(fIPAddress);
+ result = prime * result + fIPAddress.hashCode();
return result;
}
@@ -73,7 +73,7 @@ public class IPv4Endpoint extends ProtocolEndpoint {
IPv4Endpoint other = (IPv4Endpoint) obj;
// Check on layer
- boolean localEquals = Arrays.equals(fIPAddress, other.fIPAddress);
+ boolean localEquals = fIPAddress.equals(other.fIPAddress);
if (!localEquals) {
return false;
}
@@ -90,9 +90,11 @@ public class IPv4Endpoint extends ProtocolEndpoint {
public String toString() {
ProtocolEndpoint endpoint = getParentEndpoint();
if (endpoint == null) {
- return ConversionHelper.toIpAddress(fIPAddress);
+ @SuppressWarnings("null")
+ @NonNull String ret = fIPAddress.getHostAddress();
+ return ret;
}
- return endpoint.toString() + '/' + ConversionHelper.toIpAddress(fIPAddress);
+ return endpoint.toString() + '/' + fIPAddress.getHostAddress();
}
}
diff --git a/lttng/org.eclipse.linuxtools.pcap.core/src/org/eclipse/linuxtools/pcap/core/protocol/ipv4/IPv4Packet.java b/lttng/org.eclipse.linuxtools.pcap.core/src/org/eclipse/linuxtools/pcap/core/protocol/ipv4/IPv4Packet.java
index a19209e..db605cc 100644
--- a/lttng/org.eclipse.linuxtools.pcap.core/src/org/eclipse/linuxtools/pcap/core/protocol/ipv4/IPv4Packet.java
+++ b/lttng/org.eclipse.linuxtools.pcap.core/src/org/eclipse/linuxtools/pcap/core/protocol/ipv4/IPv4Packet.java
@@ -12,6 +12,9 @@
package org.eclipse.linuxtools.pcap.core.protocol.ipv4;
+import java.net.Inet4Address;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.Arrays;
@@ -55,8 +58,8 @@ public class IPv4Packet extends Packet {
private final int fTimeToLive;
private final int fIpDatagramProtocol;
private final int fHeaderChecksum;
- private final byte[] fSourceIpAddress;
- private final byte[] fDestinationIpAddress;
+ private final Inet4Address fSourceIpAddress;
+ private final Inet4Address fDestinationIpAddress;
private final @Nullable byte[] fOptions;
private @Nullable IPv4Endpoint fSourceEndpoint;
@@ -107,16 +110,29 @@ public class IPv4Packet extends Packet {
fReservedFlag = isBitSet(storage, 7);
fDontFragmentFlag = isBitSet(storage, 6);
fMoreFragmentFlag = isBitSet(storage, 5);
- fFragmentOffset = ((storage & 0b00011111) << 8) | packet.get();
+ int msb = ((storage & 0b00011111) << 8);
+ int lsb = ConversionHelper.unsignedByteToInt(packet.get());
+ fFragmentOffset = msb + lsb;
fTimeToLive = ConversionHelper.unsignedByteToInt(packet.get());
fIpDatagramProtocol = ConversionHelper.unsignedByteToInt(packet.get());
fHeaderChecksum = ConversionHelper.unsignedShortToInt(packet.getShort());
- fSourceIpAddress = new byte[IPv4Values.IP_ADDRESS_SIZE];
- fDestinationIpAddress = new byte[IPv4Values.IP_ADDRESS_SIZE];
- packet.get(fSourceIpAddress);
- packet.get(fDestinationIpAddress);
+ byte[] source = new byte[IPv4Values.IP_ADDRESS_SIZE];
+ byte[] destination = new byte[IPv4Values.IP_ADDRESS_SIZE];
+ packet.get(source);
+ packet.get(destination);
+
+ try {
+ @SuppressWarnings("null")
+ @NonNull Inet4Address sourceIP = (Inet4Address) InetAddress.getByAddress(source);
+ @SuppressWarnings("null")
+ @NonNull Inet4Address destinationIP = (Inet4Address) InetAddress.getByAddress(destination);
+ fSourceIpAddress = sourceIP;
+ fDestinationIpAddress = destinationIP;
+ } catch (UnknownHostException e) {
+ throw new BadPacketException("The IP Address size is not valid!"); //$NON-NLS-1$
+ }
// Get options if there are any
if (fInternetHeaderLength > IPv4Values.DEFAULT_HEADER_LENGTH) {
@@ -207,7 +223,7 @@ public class IPv4Packet extends Packet {
// TODO calculate the expected checksum from packet
String checksumString = "Header Checksum: " + String.format("%s%04x", "0x", fHeaderChecksum); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- String string = getProtocol().getName() + ", Source: " + ConversionHelper.toIpAddress(fSourceIpAddress) + ", Destination: " + ConversionHelper.toIpAddress(fDestinationIpAddress) + //$NON-NLS-1$ //$NON-NLS-2$
+ String string = getProtocol().getName() + ", Source: " + fSourceIpAddress.getHostAddress() + ", Destination: " + fDestinationIpAddress.getHostAddress() + //$NON-NLS-1$ //$NON-NLS-2$
"\nVersion: " + fVersion + ", Identification: " + String.format("%s%04x", "0x", fIdentification) + ", Header Length: " + getHeaderLength() + " bytes, Total Length: " + getTotalLength() + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
" bytes\nDifferentiated Services Code Point: " + String.format("%s%02x", "0x", fDSCP) + "; Explicit Congestion Notification: " + String.format("%s%02x", "0x", fExplicitCongestionNotification) //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+ "\n" + flagString + "\nTime to live: " + fTimeToLive + //$NON-NLS-1$ //$NON-NLS-2$
@@ -359,7 +375,7 @@ public class IPv4Packet extends Packet {
*
* @return The source IP address, as a byte array in big-endian.
*/
- public byte[] getSourceIpAddress() {
+ public Inet4Address getSourceIpAddress() {
return fSourceIpAddress;
}
@@ -368,7 +384,7 @@ public class IPv4Packet extends Packet {
*
* @return The destination IP address, as a byte array in big-endian.
*/
- public byte[] getDestinationIpAddress() {
+ public Inet4Address getDestinationIpAddress() {
return fDestinationIpAddress;
}
@@ -434,8 +450,8 @@ public class IPv4Packet extends Packet {
.put("Time to live", String.valueOf(fTimeToLive)) //$NON-NLS-1$
.put("Protocol", IPProtocolNumberHelper.toString(fIpDatagramProtocol) + " (" + String.valueOf(fIpDatagramProtocol) + ")") //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
.put("Checksum", String.format("%s%04x", "0x", fHeaderChecksum)) //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- .put("Source IP Address", ConversionHelper.toIpAddress(fSourceIpAddress)) //$NON-NLS-1$
- .put("Destination IP Address", ConversionHelper.toIpAddress(fDestinationIpAddress)); //$NON-NLS-1$
+ .put("Source IP Address", fSourceIpAddress.getHostAddress()) //$NON-NLS-1$
+ .put("Destination IP Address", fDestinationIpAddress.getHostAddress()); //$NON-NLS-1$
byte[] options = fOptions;
if (options == null) {
builder.put("Options", EMPTY_STRING); //$NON-NLS-1$
@@ -454,15 +470,15 @@ public class IPv4Packet extends Packet {
@Override
public String getLocalSummaryString() {
- return "Src: " + ConversionHelper.toIpAddress(fSourceIpAddress) + " , Dst: " + ConversionHelper.toIpAddress(fDestinationIpAddress); //$NON-NLS-1$ //$NON-NLS-2$
+ return "Src: " + fSourceIpAddress.getHostAddress() + " , Dst: " + fDestinationIpAddress.getHostAddress(); //$NON-NLS-1$ //$NON-NLS-2$
}
@Override
protected String getSignificationString() {
StringBuilder sb = new StringBuilder();
- sb.append(ConversionHelper.toIpAddress(fSourceIpAddress))
+ sb.append(fSourceIpAddress.getHostAddress())
.append(" > ") //$NON-NLS-1$
- .append(ConversionHelper.toIpAddress(fDestinationIpAddress));
+ .append(fDestinationIpAddress.getHostAddress());
String flags = generateFlagString();
if (!(flags.equals(""))) { //$NON-NLS-1$
@@ -524,7 +540,7 @@ public class IPv4Packet extends Packet {
result = prime * result;
}
result = prime * result + fDSCP;
- result = prime * result + Arrays.hashCode(fDestinationIpAddress);
+ result = prime * result + fDestinationIpAddress.hashCode();
result = prime * result + (fDontFragmentFlag ? 1231 : 1237);
result = prime * result + fExplicitCongestionNotification;
result = prime * result + fFragmentOffset;
@@ -541,7 +557,7 @@ public class IPv4Packet extends Packet {
result = prime * result;
}
result = prime * result + (fReservedFlag ? 1231 : 1237);
- result = prime * result + Arrays.hashCode(fSourceIpAddress);
+ result = prime * result + fSourceIpAddress.hashCode();
result = prime * result + fTimeToLive;
result = prime * result + fTotalLength;
result = prime * result + fVersion;
@@ -574,7 +590,7 @@ public class IPv4Packet extends Packet {
if (fDSCP != other.fDSCP) {
return false;
}
- if (!Arrays.equals(fDestinationIpAddress, other.fDestinationIpAddress)) {
+ if (!(fDestinationIpAddress.equals(other.fDestinationIpAddress))) {
return false;
}
if (fDontFragmentFlag != other.fDontFragmentFlag) {
@@ -617,7 +633,7 @@ public class IPv4Packet extends Packet {
if (fReservedFlag != other.fReservedFlag) {
return false;
}
- if (!Arrays.equals(fSourceIpAddress, other.fSourceIpAddress)) {
+ if (!(fSourceIpAddress.equals(other.fSourceIpAddress))) {
return false;
}
if (fTimeToLive != other.fTimeToLive) {
diff --git a/lttng/org.eclipse.linuxtools.pcap.core/src/org/eclipse/linuxtools/pcap/core/stream/PacketStreamBuilder.java b/lttng/org.eclipse.linuxtools.pcap.core/src/org/eclipse/linuxtools/pcap/core/stream/PacketStreamBuilder.java
index 1048e69..9e006e8 100644
--- a/lttng/org.eclipse.linuxtools.pcap.core/src/org/eclipse/linuxtools/pcap/core/stream/PacketStreamBuilder.java
+++ b/lttng/org.eclipse.linuxtools.pcap.core/src/org/eclipse/linuxtools/pcap/core/stream/PacketStreamBuilder.java
@@ -161,7 +161,7 @@ public class PacketStreamBuilder {
* @throws BadPcapFileException
* When the PcapFile is not valid.
*/
- public void parsePcapFile(String file) throws IOException, BadPcapFileException {
+ public synchronized void parsePcapFile(String file) throws IOException, BadPcapFileException {
try (PcapFile pcapFile = new PcapFile(file);) {
while (pcapFile.hasNextPacket()) { // not eof
PcapPacket packet;
diff --git a/lttng/org.eclipse.linuxtools.pcap.core/src/org/eclipse/linuxtools/pcap/core/util/ConversionHelper.java b/lttng/org.eclipse.linuxtools.pcap.core/src/org/eclipse/linuxtools/pcap/core/util/ConversionHelper.java
index 1cade73..503ffc5 100644
--- a/lttng/org.eclipse.linuxtools.pcap.core/src/org/eclipse/linuxtools/pcap/core/util/ConversionHelper.java
+++ b/lttng/org.eclipse.linuxtools.pcap.core/src/org/eclipse/linuxtools/pcap/core/util/ConversionHelper.java
@@ -18,7 +18,6 @@ import java.util.Date;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.linuxtools.pcap.core.protocol.ethernet2.EthernetIIValues;
-import org.eclipse.linuxtools.pcap.core.protocol.ipv4.IPv4Values;
/**
* Class for helping with the conversion of data.
@@ -126,27 +125,6 @@ public final class ConversionHelper {
}
- // TODO Add little endian support
- /**
- * Generate a string representing the IP address.
- *
- * @param ip
- * The IP address as a byte array.
- * @return The string representing the IP address.
- */
- public static String toIpAddress(byte[] ip) {
-
- if (ip.length != IPv4Values.IP_ADDRESS_SIZE) {
- throw new IllegalArgumentException();
- }
- char separator = '.';
- return Integer.toString(ip[0] & 0xFF) + separator +
- Integer.toString(ip[1] & 0xFF) + separator +
- Integer.toString(ip[2] & 0xFF) + separator +
- Integer.toString(ip[3] & 0xFF);
-
- }
-
// TODO support non GMT time.
/**