Fix checkstyle whitespace issues - WHITESPACE ONLY
Change-Id: Ic205c1afd639c6008d61d9de95cb764eeb6238ca
diff --git a/src/main/java/net/onrc/onos/core/packet/Ethernet.java b/src/main/java/net/onrc/onos/core/packet/Ethernet.java
index 794b3b7..8a4b0fb 100644
--- a/src/main/java/net/onrc/onos/core/packet/Ethernet.java
+++ b/src/main/java/net/onrc/onos/core/packet/Ethernet.java
@@ -1,19 +1,19 @@
/**
-* Copyright 2011, Big Switch Networks, Inc.
-* Originally created by David Erickson, Stanford University
-*
-* Licensed under the Apache License, Version 2.0 (the "License"); you may
-* not use this file except in compliance with the License. You may obtain
-* a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-* License for the specific language governing permissions and limitations
-* under the License.
-**/
+ * Copyright 2011, Big Switch Networks, Inc.
+ * Originally created by David Erickson, Stanford University
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License. You may obtain
+ * a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ **/
package net.onrc.onos.core.packet;
@@ -27,7 +27,6 @@
import org.openflow.util.HexString;
/**
- *
* @author David Erickson (daviderickson@cs.stanford.edu)
*/
public class Ethernet extends BasePacket {
@@ -37,7 +36,7 @@
public static final short TYPE_IPv4 = 0x0800;
public static final short TYPE_LLDP = (short) 0x88cc;
public static final short TYPE_BSN = (short) 0x8942;
- public static final short VLAN_UNTAGGED = (short)0xffff;
+ public static final short VLAN_UNTAGGED = (short) 0xffff;
public static final short DATALAYER_ADDRESS_LENGTH = 6; // bytes
public static Map<Short, Class<? extends IPacket>> etherTypeClassMap;
@@ -64,14 +63,14 @@
super();
this.vlanID = VLAN_UNTAGGED;
}
-
+
/**
* @return the destination MAC as a byte array
*/
public byte[] getDestinationMACAddress() {
return destinationMACAddress.toBytes();
}
-
+
/**
* @return the destination MAC
*/
@@ -101,7 +100,7 @@
public byte[] getSourceMACAddress() {
return sourceMACAddress.toBytes();
}
-
+
/**
* @return the source MACAddress
*/
@@ -169,23 +168,25 @@
this.etherType = etherType;
return this;
}
-
+
/**
* @return True if the Ethernet frame is broadcast, false otherwise
*/
public boolean isBroadcast() {
- assert(destinationMACAddress.length() == 6);
+ assert (destinationMACAddress.length() == 6);
return destinationMACAddress.isBroadcast();
}
-
+
/**
* @return True is the Ethernet frame is multicast, False otherwise
*/
public boolean isMulticast() {
return destinationMACAddress.isMulticast();
}
+
/**
* Pad this packet to 60 bytes minimum, filling with zeros?
+ *
* @return the pad
*/
public boolean isPad() {
@@ -194,6 +195,7 @@
/**
* Pad this packet to 60 bytes minimum, filling with zeros?
+ *
* @param pad the pad to set
*/
public Ethernet setPad(boolean pad) {
@@ -208,7 +210,7 @@
payloadData = payload.serialize();
}
int length = 14 + ((vlanID == VLAN_UNTAGGED) ? 0 : 4) +
- ((payloadData == null) ? 0 : payloadData.length);
+ ((payloadData == null) ? 0 : payloadData.length);
if (pad && length < 60) {
length = 60;
}
@@ -224,7 +226,7 @@
if (payloadData != null)
bb.put(payloadData);
if (pad) {
- Arrays.fill(data, bb.position(), data.length, (byte)0x0);
+ Arrays.fill(data, bb.position(), data.length, (byte) 0x0);
}
return data;
}
@@ -256,7 +258,7 @@
this.vlanID = VLAN_UNTAGGED;
}
this.etherType = etherType;
-
+
IPacket payload;
if (Ethernet.etherTypeClassMap.containsKey(this.etherType)) {
Class<? extends IPacket> clazz = Ethernet.etherTypeClassMap.get(this.etherType);
@@ -268,13 +270,14 @@
} else {
payload = new Data();
}
- this.payload = payload.deserialize(data, bb.position(), bb.limit()-bb.position());
+ this.payload = payload.deserialize(data, bb.position(), bb.limit() - bb.position());
this.payload.setParent(this);
return this;
}
/**
* Checks to see if a string is a valid MAC address.
+ *
* @param macAddress
* @return True if macAddress is a valid MAC, False otherwise
*/
@@ -283,8 +286,8 @@
if (macBytes.length != 6)
return false;
for (int i = 0; i < 6; ++i) {
- if (HEXES.indexOf(macBytes[i].toUpperCase().charAt(0)) == -1 ||
- HEXES.indexOf(macBytes[i].toUpperCase().charAt(1)) == -1) {
+ if (HEXES.indexOf(macBytes[i].toUpperCase().charAt(0)) == -1 ||
+ HEXES.indexOf(macBytes[i].toUpperCase().charAt(1)) == -1) {
return false;
}
}
@@ -294,8 +297,9 @@
/**
* Accepts a MAC address of the form 00:aa:11:bb:22:cc, case does not
* matter, and returns a corresponding byte[].
+ *
* @param macAddress The MAC address to convert into a bye array
- * @return The macAddress as a byte array
+ * @return The macAddress as a byte array
*/
public static byte[] toMACAddress(String macAddress) {
return MACAddress.valueOf(macAddress).toBytes();
@@ -305,6 +309,7 @@
/**
* Accepts a MAC address and returns the corresponding long, where the
* MAC bytes are set on the lower order bytes of the long.
+ *
* @param macAddress
* @return a long containing the mac address bytes
*/
@@ -314,13 +319,14 @@
/**
* Convert a long MAC address to a byte array
+ *
* @param macAddress
* @return the bytes of the mac address
*/
public static byte[] toByteArray(long macAddress) {
return MACAddress.valueOf(macAddress).toBytes();
}
-
+
/* (non-Javadoc)
* @see java.lang.Object#hashCode()
*/
@@ -363,7 +369,7 @@
return false;
return true;
}
-
+
/* (non-Javadoc)
* @see java.lang.Object#toString(java.lang.Object)
*/
@@ -384,7 +390,7 @@
sb.append("ip");
else if (pkt instanceof DHCP)
sb.append("dhcp");
- else sb.append(this.getEtherType());
+ else sb.append(this.getEtherType());
sb.append("\ndl_vlan: ");
if (this.getVlanID() == Ethernet.VLAN_UNTAGGED)
@@ -405,18 +411,15 @@
sb.append(IPv4.fromIPv4Address(IPv4.toIPv4Address(p.getSenderProtocolAddress())));
sb.append("\nnw_dst: ");
sb.append(IPv4.fromIPv4Address(IPv4.toIPv4Address(p.getTargetProtocolAddress())));
- }
- else if (pkt instanceof LLDP) {
+ } else if (pkt instanceof LLDP) {
sb.append("lldp packet");
- }
- else if (pkt instanceof ICMP) {
+ } else if (pkt instanceof ICMP) {
ICMP icmp = (ICMP) pkt;
sb.append("\nicmp_type: ");
sb.append(icmp.getIcmpType());
sb.append("\nicmp_code: ");
sb.append(icmp.getIcmpCode());
- }
- else if (pkt instanceof IPv4) {
+ } else if (pkt instanceof IPv4) {
IPv4 p = (IPv4) pkt;
sb.append("\nnw_src: ");
sb.append(IPv4.fromIPv4Address(p.getSourceAddress()));
@@ -448,20 +451,15 @@
sb.append(icmp.getIcmpCode());
}
- }
- else if (pkt instanceof DHCP) {
+ } else if (pkt instanceof DHCP) {
sb.append("\ndhcp packet");
- }
- else if (pkt instanceof Data) {
+ } else if (pkt instanceof Data) {
sb.append("\ndata packet");
- }
- else if (pkt instanceof LLC) {
+ } else if (pkt instanceof LLC) {
sb.append("\nllc packet");
- }
- else if (pkt instanceof BPDU) {
+ } else if (pkt instanceof BPDU) {
sb.append("\nbpdu packet");
- }
- else sb.append("\nunknwon packet");
+ } else sb.append("\nunknwon packet");
return sb.toString();
}