Merge r1582068 from trunk.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1582069 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Suresh Srinivas 2014-03-26 21:29:57 +00:00
parent 40c110c530
commit 53bebe2329
28 changed files with 132 additions and 135 deletions

View File

@ -16,6 +16,9 @@ Release 2.5.0 - UNRELEASED
HDFS-5196. Provide more snapshot information in WebUI. HDFS-5196. Provide more snapshot information in WebUI.
(Shinichi Yamashita via wheat9) (Shinichi Yamashita via wheat9)
HDFS-6155. Fix Boxing/unboxing to parse a primitive findbugs warnings.
(suresh)
OPTIMIZATIONS OPTIMIZATIONS
BUG FIXES BUG FIXES

View File

@ -618,9 +618,8 @@ public class ShortCircuitCache implements Closeable {
evictionTimeNs++; evictionTimeNs++;
} }
Preconditions.checkState(null == replica.getEvictableTimeNs()); Preconditions.checkState(null == replica.getEvictableTimeNs());
Long time = Long.valueOf(evictionTimeNs); replica.setEvictableTimeNs(evictionTimeNs);
replica.setEvictableTimeNs(time); map.put(evictionTimeNs, replica);
map.put(time, replica);
} }
/** /**

View File

@ -38,7 +38,7 @@ public class CacheDirectiveIterator
public CacheDirectiveIterator(ClientProtocol namenode, public CacheDirectiveIterator(ClientProtocol namenode,
CacheDirectiveInfo filter) { CacheDirectiveInfo filter) {
super(Long.valueOf(0)); super(0L);
this.namenode = namenode; this.namenode = namenode;
this.filter = filter; this.filter = filter;
} }

View File

@ -52,7 +52,7 @@ public class PipelineAck {
String[] ele = conf.get(DFS_DATANODE_OOB_TIMEOUT_KEY, String[] ele = conf.get(DFS_DATANODE_OOB_TIMEOUT_KEY,
DFS_DATANODE_OOB_TIMEOUT_DEFAULT).split(","); DFS_DATANODE_OOB_TIMEOUT_DEFAULT).split(",");
for (int i = 0; i < NUM_OOB_TYPES; i++) { for (int i = 0; i < NUM_OOB_TYPES; i++) {
OOB_TIMEOUT[i] = (i < ele.length) ? Long.valueOf(ele[i]) : 0; OOB_TIMEOUT[i] = (i < ele.length) ? Long.parseLong(ele[i]) : 0;
} }
} }

View File

@ -165,7 +165,7 @@ class JNStorage extends Storage {
if (matcher.matches()) { if (matcher.matches()) {
// This parsing will always succeed since the group(1) is // This parsing will always succeed since the group(1) is
// /\d+/ in the regex itself. // /\d+/ in the regex itself.
long txid = Long.valueOf(matcher.group(1)); long txid = Long.parseLong(matcher.group(1));
if (txid < minTxIdToKeep) { if (txid < minTxIdToKeep) {
LOG.info("Purging no-longer needed file " + txid); LOG.info("Purging no-longer needed file " + txid);
if (!f.delete()) { if (!f.delete()) {

View File

@ -1166,7 +1166,7 @@ public class DatanodeManager {
port = DFSConfigKeys.DFS_DATANODE_DEFAULT_PORT; port = DFSConfigKeys.DFS_DATANODE_DEFAULT_PORT;
} else { } else {
hostStr = hostLine.substring(0, idx); hostStr = hostLine.substring(0, idx);
port = Integer.valueOf(hostLine.substring(idx+1)); port = Integer.parseInt(hostLine.substring(idx+1));
} }
if (InetAddresses.isInetAddress(hostStr)) { if (InetAddresses.isInetAddress(hostStr)) {

View File

@ -382,11 +382,11 @@ class BlockPoolSliceScanner {
try { try {
if (name.equals("id")) { if (name.equals("id")) {
entry.blockId = Long.valueOf(value); entry.blockId = Long.parseLong(value);
} else if (name.equals("time")) { } else if (name.equals("time")) {
entry.verificationTime = Long.valueOf(value); entry.verificationTime = Long.parseLong(value);
} else if (name.equals("genstamp")) { } else if (name.equals("genstamp")) {
entry.genStamp = Long.valueOf(value); entry.genStamp = Long.parseLong(value);
} }
} catch(NumberFormatException nfe) { } catch(NumberFormatException nfe) {
LOG.warn("Cannot parse line: " + line, nfe); LOG.warn("Cannot parse line: " + line, nfe);

View File

@ -187,7 +187,7 @@ abstract public class ReplicaInfo extends Block implements Replica {
if (!internedBaseDirs.containsKey(replicaDirInfo.baseDirPath)) { if (!internedBaseDirs.containsKey(replicaDirInfo.baseDirPath)) {
// Create a new String path of this file and make a brand new File object // Create a new String path of this file and make a brand new File object
// to guarantee we drop the reference to the underlying char[] storage. // to guarantee we drop the reference to the underlying char[] storage.
File baseDir = new File(new String(replicaDirInfo.baseDirPath)); File baseDir = new File(replicaDirInfo.baseDirPath);
internedBaseDirs.put(replicaDirInfo.baseDirPath, baseDir); internedBaseDirs.put(replicaDirInfo.baseDirPath, baseDir);
} }
this.baseDir = internedBaseDirs.get(replicaDirInfo.baseDirPath); this.baseDir = internedBaseDirs.get(replicaDirInfo.baseDirPath);

View File

@ -154,7 +154,7 @@ class ReplicaMap {
/** /**
* Remove the replica's meta information from the map if present * Remove the replica's meta information from the map if present
* @param bpid block pool id * @param bpid block pool id
* @param the block id of the replica to be removed * @param blockId block id of the replica to be removed
* @return the removed replica's meta information * @return the removed replica's meta information
*/ */
ReplicaInfo remove(String bpid, long blockId) { ReplicaInfo remove(String bpid, long blockId) {

View File

@ -22,7 +22,6 @@ import java.io.IOException;
import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.hdfs.server.common.StorageInfo; import org.apache.hadoop.hdfs.server.common.StorageInfo;
import org.apache.hadoop.hdfs.server.common.HdfsServerConstants.NodeType; import org.apache.hadoop.hdfs.server.common.HdfsServerConstants.NodeType;
import org.apache.hadoop.hdfs.server.namenode.FSImage;
import com.google.common.collect.ComparisonChain; import com.google.common.collect.ComparisonChain;
@ -53,13 +52,13 @@ public class CheckpointSignature extends StorageInfo
assert fields.length == NUM_FIELDS : assert fields.length == NUM_FIELDS :
"Must be " + NUM_FIELDS + " fields in CheckpointSignature"; "Must be " + NUM_FIELDS + " fields in CheckpointSignature";
int i = 0; int i = 0;
layoutVersion = Integer.valueOf(fields[i++]); layoutVersion = Integer.parseInt(fields[i++]);
namespaceID = Integer.valueOf(fields[i++]); namespaceID = Integer.parseInt(fields[i++]);
cTime = Long.valueOf(fields[i++]); cTime = Long.parseLong(fields[i++]);
mostRecentCheckpointTxId = Long.valueOf(fields[i++]); mostRecentCheckpointTxId = Long.parseLong(fields[i++]);
curSegmentTxId = Long.valueOf(fields[i++]); curSegmentTxId = Long.parseLong(fields[i++]);
clusterID = fields[i++]; clusterID = fields[i++];
blockpoolID = fields[i++]; blockpoolID = fields[i];
} }
public CheckpointSignature(StorageInfo info, String blockpoolID, public CheckpointSignature(StorageInfo info, String blockpoolID,

View File

@ -2944,7 +2944,7 @@ public class FSDirectory implements Closeable {
final String inodeId = DFSUtil.bytes2String(pathComponents[3]); final String inodeId = DFSUtil.bytes2String(pathComponents[3]);
long id = 0; long id = 0;
try { try {
id = Long.valueOf(inodeId); id = Long.parseLong(inodeId);
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
throw new FileNotFoundException("Invalid inode path: " + src); throw new FileNotFoundException("Invalid inode path: " + src);
} }

View File

@ -288,7 +288,7 @@ public abstract class FSEditLogOp {
ClientId.toBytes(st.getValue("RPC_CLIENTID")) ClientId.toBytes(st.getValue("RPC_CLIENTID"))
: RpcConstants.DUMMY_CLIENT_ID; : RpcConstants.DUMMY_CLIENT_ID;
this.rpcCallId = st.hasChildren("RPC_CALLID") ? this.rpcCallId = st.hasChildren("RPC_CALLID") ?
Integer.valueOf(st.getValue("RPC_CALLID")) Integer.parseInt(st.getValue("RPC_CALLID"))
: RpcConstants.INVALID_CALL_ID; : RpcConstants.INVALID_CALL_ID;
} }
@ -305,7 +305,7 @@ public abstract class FSEditLogOp {
XMLUtils.addSaxString(contentHandler, "RPC_CLIENTID", XMLUtils.addSaxString(contentHandler, "RPC_CLIENTID",
ClientId.toString(clientId)); ClientId.toString(clientId));
XMLUtils.addSaxString(contentHandler, "RPC_CALLID", XMLUtils.addSaxString(contentHandler, "RPC_CALLID",
Integer.valueOf(callId).toString()); Integer.toString(callId));
} }
private static final class AclEditLogUtil { private static final class AclEditLogUtil {
@ -615,18 +615,18 @@ public abstract class FSEditLogOp {
@Override @Override
protected void toXml(ContentHandler contentHandler) throws SAXException { protected void toXml(ContentHandler contentHandler) throws SAXException {
XMLUtils.addSaxString(contentHandler, "LENGTH", XMLUtils.addSaxString(contentHandler, "LENGTH",
Integer.valueOf(length).toString()); Integer.toString(length));
XMLUtils.addSaxString(contentHandler, "INODEID", XMLUtils.addSaxString(contentHandler, "INODEID",
Long.valueOf(inodeId).toString()); Long.toString(inodeId));
XMLUtils.addSaxString(contentHandler, "PATH", path); XMLUtils.addSaxString(contentHandler, "PATH", path);
XMLUtils.addSaxString(contentHandler, "REPLICATION", XMLUtils.addSaxString(contentHandler, "REPLICATION",
Short.valueOf(replication).toString()); Short.valueOf(replication).toString());
XMLUtils.addSaxString(contentHandler, "MTIME", XMLUtils.addSaxString(contentHandler, "MTIME",
Long.valueOf(mtime).toString()); Long.toString(mtime));
XMLUtils.addSaxString(contentHandler, "ATIME", XMLUtils.addSaxString(contentHandler, "ATIME",
Long.valueOf(atime).toString()); Long.toString(atime));
XMLUtils.addSaxString(contentHandler, "BLOCKSIZE", XMLUtils.addSaxString(contentHandler, "BLOCKSIZE",
Long.valueOf(blockSize).toString()); Long.toString(blockSize));
XMLUtils.addSaxString(contentHandler, "CLIENT_NAME", clientName); XMLUtils.addSaxString(contentHandler, "CLIENT_NAME", clientName);
XMLUtils.addSaxString(contentHandler, "CLIENT_MACHINE", clientMachine); XMLUtils.addSaxString(contentHandler, "CLIENT_MACHINE", clientMachine);
for (Block b : blocks) { for (Block b : blocks) {
@ -643,13 +643,13 @@ public abstract class FSEditLogOp {
@Override @Override
void fromXml(Stanza st) throws InvalidXmlException { void fromXml(Stanza st) throws InvalidXmlException {
this.length = Integer.valueOf(st.getValue("LENGTH")); this.length = Integer.parseInt(st.getValue("LENGTH"));
this.inodeId = Long.valueOf(st.getValue("INODEID")); this.inodeId = Long.parseLong(st.getValue("INODEID"));
this.path = st.getValue("PATH"); this.path = st.getValue("PATH");
this.replication = Short.valueOf(st.getValue("REPLICATION")); this.replication = Short.valueOf(st.getValue("REPLICATION"));
this.mtime = Long.valueOf(st.getValue("MTIME")); this.mtime = Long.parseLong(st.getValue("MTIME"));
this.atime = Long.valueOf(st.getValue("ATIME")); this.atime = Long.parseLong(st.getValue("ATIME"));
this.blockSize = Long.valueOf(st.getValue("BLOCKSIZE")); this.blockSize = Long.parseLong(st.getValue("BLOCKSIZE"));
this.clientName = st.getValue("CLIENT_NAME"); this.clientName = st.getValue("CLIENT_NAME");
this.clientMachine = st.getValue("CLIENT_MACHINE"); this.clientMachine = st.getValue("CLIENT_MACHINE");
if (st.hasChildren("BLOCK")) { if (st.hasChildren("BLOCK")) {
@ -1103,10 +1103,10 @@ public abstract class FSEditLogOp {
@Override @Override
protected void toXml(ContentHandler contentHandler) throws SAXException { protected void toXml(ContentHandler contentHandler) throws SAXException {
XMLUtils.addSaxString(contentHandler, "LENGTH", XMLUtils.addSaxString(contentHandler, "LENGTH",
Integer.valueOf(length).toString()); Integer.toString(length));
XMLUtils.addSaxString(contentHandler, "TRG", trg); XMLUtils.addSaxString(contentHandler, "TRG", trg);
XMLUtils.addSaxString(contentHandler, "TIMESTAMP", XMLUtils.addSaxString(contentHandler, "TIMESTAMP",
Long.valueOf(timestamp).toString()); Long.toString(timestamp));
contentHandler.startElement("", "", "SOURCES", new AttributesImpl()); contentHandler.startElement("", "", "SOURCES", new AttributesImpl());
for (int i = 0; i < srcs.length; ++i) { for (int i = 0; i < srcs.length; ++i) {
XMLUtils.addSaxString(contentHandler, XMLUtils.addSaxString(contentHandler,
@ -1117,9 +1117,9 @@ public abstract class FSEditLogOp {
} }
@Override void fromXml(Stanza st) throws InvalidXmlException { @Override void fromXml(Stanza st) throws InvalidXmlException {
this.length = Integer.valueOf(st.getValue("LENGTH")); this.length = Integer.parseInt(st.getValue("LENGTH"));
this.trg = st.getValue("TRG"); this.trg = st.getValue("TRG");
this.timestamp = Long.valueOf(st.getValue("TIMESTAMP")); this.timestamp = Long.parseLong(st.getValue("TIMESTAMP"));
List<Stanza> sources = st.getChildren("SOURCES"); List<Stanza> sources = st.getChildren("SOURCES");
int i = 0; int i = 0;
while (true) { while (true) {
@ -1221,20 +1221,20 @@ public abstract class FSEditLogOp {
@Override @Override
protected void toXml(ContentHandler contentHandler) throws SAXException { protected void toXml(ContentHandler contentHandler) throws SAXException {
XMLUtils.addSaxString(contentHandler, "LENGTH", XMLUtils.addSaxString(contentHandler, "LENGTH",
Integer.valueOf(length).toString()); Integer.toString(length));
XMLUtils.addSaxString(contentHandler, "SRC", src); XMLUtils.addSaxString(contentHandler, "SRC", src);
XMLUtils.addSaxString(contentHandler, "DST", dst); XMLUtils.addSaxString(contentHandler, "DST", dst);
XMLUtils.addSaxString(contentHandler, "TIMESTAMP", XMLUtils.addSaxString(contentHandler, "TIMESTAMP",
Long.valueOf(timestamp).toString()); Long.toString(timestamp));
appendRpcIdsToXml(contentHandler, rpcClientId, rpcCallId); appendRpcIdsToXml(contentHandler, rpcClientId, rpcCallId);
} }
@Override @Override
void fromXml(Stanza st) throws InvalidXmlException { void fromXml(Stanza st) throws InvalidXmlException {
this.length = Integer.valueOf(st.getValue("LENGTH")); this.length = Integer.parseInt(st.getValue("LENGTH"));
this.src = st.getValue("SRC"); this.src = st.getValue("SRC");
this.dst = st.getValue("DST"); this.dst = st.getValue("DST");
this.timestamp = Long.valueOf(st.getValue("TIMESTAMP")); this.timestamp = Long.parseLong(st.getValue("TIMESTAMP"));
readRpcIdsFromXml(st); readRpcIdsFromXml(st);
} }
@ -1314,17 +1314,17 @@ public abstract class FSEditLogOp {
@Override @Override
protected void toXml(ContentHandler contentHandler) throws SAXException { protected void toXml(ContentHandler contentHandler) throws SAXException {
XMLUtils.addSaxString(contentHandler, "LENGTH", XMLUtils.addSaxString(contentHandler, "LENGTH",
Integer.valueOf(length).toString()); Integer.toString(length));
XMLUtils.addSaxString(contentHandler, "PATH", path); XMLUtils.addSaxString(contentHandler, "PATH", path);
XMLUtils.addSaxString(contentHandler, "TIMESTAMP", XMLUtils.addSaxString(contentHandler, "TIMESTAMP",
Long.valueOf(timestamp).toString()); Long.toString(timestamp));
appendRpcIdsToXml(contentHandler, rpcClientId, rpcCallId); appendRpcIdsToXml(contentHandler, rpcClientId, rpcCallId);
} }
@Override void fromXml(Stanza st) throws InvalidXmlException { @Override void fromXml(Stanza st) throws InvalidXmlException {
this.length = Integer.valueOf(st.getValue("LENGTH")); this.length = Integer.parseInt(st.getValue("LENGTH"));
this.path = st.getValue("PATH"); this.path = st.getValue("PATH");
this.timestamp = Long.valueOf(st.getValue("TIMESTAMP")); this.timestamp = Long.parseLong(st.getValue("TIMESTAMP"));
readRpcIdsFromXml(st); readRpcIdsFromXml(st);
} }
@ -1453,12 +1453,12 @@ public abstract class FSEditLogOp {
@Override @Override
protected void toXml(ContentHandler contentHandler) throws SAXException { protected void toXml(ContentHandler contentHandler) throws SAXException {
XMLUtils.addSaxString(contentHandler, "LENGTH", XMLUtils.addSaxString(contentHandler, "LENGTH",
Integer.valueOf(length).toString()); Integer.toString(length));
XMLUtils.addSaxString(contentHandler, "INODEID", XMLUtils.addSaxString(contentHandler, "INODEID",
Long.valueOf(inodeId).toString()); Long.toString(inodeId));
XMLUtils.addSaxString(contentHandler, "PATH", path); XMLUtils.addSaxString(contentHandler, "PATH", path);
XMLUtils.addSaxString(contentHandler, "TIMESTAMP", XMLUtils.addSaxString(contentHandler, "TIMESTAMP",
Long.valueOf(timestamp).toString()); Long.toString(timestamp));
FSEditLogOp.permissionStatusToXml(contentHandler, permissions); FSEditLogOp.permissionStatusToXml(contentHandler, permissions);
if (aclEntries != null) { if (aclEntries != null) {
appendAclEntriesToXml(contentHandler, aclEntries); appendAclEntriesToXml(contentHandler, aclEntries);
@ -1466,10 +1466,10 @@ public abstract class FSEditLogOp {
} }
@Override void fromXml(Stanza st) throws InvalidXmlException { @Override void fromXml(Stanza st) throws InvalidXmlException {
this.length = Integer.valueOf(st.getValue("LENGTH")); this.length = Integer.parseInt(st.getValue("LENGTH"));
this.inodeId = Long.valueOf(st.getValue("INODEID")); this.inodeId = Long.parseLong(st.getValue("INODEID"));
this.path = st.getValue("PATH"); this.path = st.getValue("PATH");
this.timestamp = Long.valueOf(st.getValue("TIMESTAMP")); this.timestamp = Long.parseLong(st.getValue("TIMESTAMP"));
this.permissions = permissionStatusFromXml(st); this.permissions = permissionStatusFromXml(st);
aclEntries = readAclEntriesFromXml(st); aclEntries = readAclEntriesFromXml(st);
} }
@ -1526,11 +1526,11 @@ public abstract class FSEditLogOp {
@Override @Override
protected void toXml(ContentHandler contentHandler) throws SAXException { protected void toXml(ContentHandler contentHandler) throws SAXException {
XMLUtils.addSaxString(contentHandler, "GENSTAMP", XMLUtils.addSaxString(contentHandler, "GENSTAMP",
Long.valueOf(genStampV1).toString()); Long.toString(genStampV1));
} }
@Override void fromXml(Stanza st) throws InvalidXmlException { @Override void fromXml(Stanza st) throws InvalidXmlException {
this.genStampV1 = Long.valueOf(st.getValue("GENSTAMP")); this.genStampV1 = Long.parseLong(st.getValue("GENSTAMP"));
} }
} }
@ -1579,11 +1579,11 @@ public abstract class FSEditLogOp {
@Override @Override
protected void toXml(ContentHandler contentHandler) throws SAXException { protected void toXml(ContentHandler contentHandler) throws SAXException {
XMLUtils.addSaxString(contentHandler, "GENSTAMPV2", XMLUtils.addSaxString(contentHandler, "GENSTAMPV2",
Long.valueOf(genStampV2).toString()); Long.toString(genStampV2));
} }
@Override void fromXml(Stanza st) throws InvalidXmlException { @Override void fromXml(Stanza st) throws InvalidXmlException {
this.genStampV2 = Long.valueOf(st.getValue("GENSTAMPV2")); this.genStampV2 = Long.parseLong(st.getValue("GENSTAMPV2"));
} }
} }
@ -1632,11 +1632,11 @@ public abstract class FSEditLogOp {
@Override @Override
protected void toXml(ContentHandler contentHandler) throws SAXException { protected void toXml(ContentHandler contentHandler) throws SAXException {
XMLUtils.addSaxString(contentHandler, "BLOCK_ID", XMLUtils.addSaxString(contentHandler, "BLOCK_ID",
Long.valueOf(blockId).toString()); Long.toString(blockId));
} }
@Override void fromXml(Stanza st) throws InvalidXmlException { @Override void fromXml(Stanza st) throws InvalidXmlException {
this.blockId = Long.valueOf(st.getValue("BLOCK_ID")); this.blockId = Long.parseLong(st.getValue("BLOCK_ID"));
} }
} }
@ -1832,12 +1832,12 @@ public abstract class FSEditLogOp {
protected void toXml(ContentHandler contentHandler) throws SAXException { protected void toXml(ContentHandler contentHandler) throws SAXException {
XMLUtils.addSaxString(contentHandler, "SRC", src); XMLUtils.addSaxString(contentHandler, "SRC", src);
XMLUtils.addSaxString(contentHandler, "NSQUOTA", XMLUtils.addSaxString(contentHandler, "NSQUOTA",
Long.valueOf(nsQuota).toString()); Long.toString(nsQuota));
} }
@Override void fromXml(Stanza st) throws InvalidXmlException { @Override void fromXml(Stanza st) throws InvalidXmlException {
this.src = st.getValue("SRC"); this.src = st.getValue("SRC");
this.nsQuota = Long.valueOf(st.getValue("NSQUOTA")); this.nsQuota = Long.parseLong(st.getValue("NSQUOTA"));
} }
} }
@ -1953,15 +1953,15 @@ public abstract class FSEditLogOp {
protected void toXml(ContentHandler contentHandler) throws SAXException { protected void toXml(ContentHandler contentHandler) throws SAXException {
XMLUtils.addSaxString(contentHandler, "SRC", src); XMLUtils.addSaxString(contentHandler, "SRC", src);
XMLUtils.addSaxString(contentHandler, "NSQUOTA", XMLUtils.addSaxString(contentHandler, "NSQUOTA",
Long.valueOf(nsQuota).toString()); Long.toString(nsQuota));
XMLUtils.addSaxString(contentHandler, "DSQUOTA", XMLUtils.addSaxString(contentHandler, "DSQUOTA",
Long.valueOf(dsQuota).toString()); Long.toString(dsQuota));
} }
@Override void fromXml(Stanza st) throws InvalidXmlException { @Override void fromXml(Stanza st) throws InvalidXmlException {
this.src = st.getValue("SRC"); this.src = st.getValue("SRC");
this.nsQuota = Long.valueOf(st.getValue("NSQUOTA")); this.nsQuota = Long.parseLong(st.getValue("NSQUOTA"));
this.dsQuota = Long.valueOf(st.getValue("DSQUOTA")); this.dsQuota = Long.parseLong(st.getValue("DSQUOTA"));
} }
} }
@ -2047,19 +2047,19 @@ public abstract class FSEditLogOp {
@Override @Override
protected void toXml(ContentHandler contentHandler) throws SAXException { protected void toXml(ContentHandler contentHandler) throws SAXException {
XMLUtils.addSaxString(contentHandler, "LENGTH", XMLUtils.addSaxString(contentHandler, "LENGTH",
Integer.valueOf(length).toString()); Integer.toString(length));
XMLUtils.addSaxString(contentHandler, "PATH", path); XMLUtils.addSaxString(contentHandler, "PATH", path);
XMLUtils.addSaxString(contentHandler, "MTIME", XMLUtils.addSaxString(contentHandler, "MTIME",
Long.valueOf(mtime).toString()); Long.toString(mtime));
XMLUtils.addSaxString(contentHandler, "ATIME", XMLUtils.addSaxString(contentHandler, "ATIME",
Long.valueOf(atime).toString()); Long.toString(atime));
} }
@Override void fromXml(Stanza st) throws InvalidXmlException { @Override void fromXml(Stanza st) throws InvalidXmlException {
this.length = Integer.valueOf(st.getValue("LENGTH")); this.length = Integer.parseInt(st.getValue("LENGTH"));
this.path = st.getValue("PATH"); this.path = st.getValue("PATH");
this.mtime = Long.valueOf(st.getValue("MTIME")); this.mtime = Long.parseLong(st.getValue("MTIME"));
this.atime = Long.valueOf(st.getValue("ATIME")); this.atime = Long.parseLong(st.getValue("ATIME"));
} }
} }
@ -2186,27 +2186,27 @@ public abstract class FSEditLogOp {
@Override @Override
protected void toXml(ContentHandler contentHandler) throws SAXException { protected void toXml(ContentHandler contentHandler) throws SAXException {
XMLUtils.addSaxString(contentHandler, "LENGTH", XMLUtils.addSaxString(contentHandler, "LENGTH",
Integer.valueOf(length).toString()); Integer.toString(length));
XMLUtils.addSaxString(contentHandler, "INODEID", XMLUtils.addSaxString(contentHandler, "INODEID",
Long.valueOf(inodeId).toString()); Long.toString(inodeId));
XMLUtils.addSaxString(contentHandler, "PATH", path); XMLUtils.addSaxString(contentHandler, "PATH", path);
XMLUtils.addSaxString(contentHandler, "VALUE", value); XMLUtils.addSaxString(contentHandler, "VALUE", value);
XMLUtils.addSaxString(contentHandler, "MTIME", XMLUtils.addSaxString(contentHandler, "MTIME",
Long.valueOf(mtime).toString()); Long.toString(mtime));
XMLUtils.addSaxString(contentHandler, "ATIME", XMLUtils.addSaxString(contentHandler, "ATIME",
Long.valueOf(atime).toString()); Long.toString(atime));
FSEditLogOp.permissionStatusToXml(contentHandler, permissionStatus); FSEditLogOp.permissionStatusToXml(contentHandler, permissionStatus);
appendRpcIdsToXml(contentHandler, rpcClientId, rpcCallId); appendRpcIdsToXml(contentHandler, rpcClientId, rpcCallId);
} }
@Override @Override
void fromXml(Stanza st) throws InvalidXmlException { void fromXml(Stanza st) throws InvalidXmlException {
this.length = Integer.valueOf(st.getValue("LENGTH")); this.length = Integer.parseInt(st.getValue("LENGTH"));
this.inodeId = Long.valueOf(st.getValue("INODEID")); this.inodeId = Long.parseLong(st.getValue("INODEID"));
this.path = st.getValue("PATH"); this.path = st.getValue("PATH");
this.value = st.getValue("VALUE"); this.value = st.getValue("VALUE");
this.mtime = Long.valueOf(st.getValue("MTIME")); this.mtime = Long.parseLong(st.getValue("MTIME"));
this.atime = Long.valueOf(st.getValue("ATIME")); this.atime = Long.parseLong(st.getValue("ATIME"));
this.permissionStatus = permissionStatusFromXml(st); this.permissionStatus = permissionStatusFromXml(st);
readRpcIdsFromXml(st); readRpcIdsFromXml(st);
@ -2330,11 +2330,11 @@ public abstract class FSEditLogOp {
@Override @Override
protected void toXml(ContentHandler contentHandler) throws SAXException { protected void toXml(ContentHandler contentHandler) throws SAXException {
XMLUtils.addSaxString(contentHandler, "LENGTH", XMLUtils.addSaxString(contentHandler, "LENGTH",
Integer.valueOf(length).toString()); Integer.toString(length));
XMLUtils.addSaxString(contentHandler, "SRC", src); XMLUtils.addSaxString(contentHandler, "SRC", src);
XMLUtils.addSaxString(contentHandler, "DST", dst); XMLUtils.addSaxString(contentHandler, "DST", dst);
XMLUtils.addSaxString(contentHandler, "TIMESTAMP", XMLUtils.addSaxString(contentHandler, "TIMESTAMP",
Long.valueOf(timestamp).toString()); Long.toString(timestamp));
StringBuilder bld = new StringBuilder(); StringBuilder bld = new StringBuilder();
String prefix = ""; String prefix = "";
for (Rename r : options) { for (Rename r : options) {
@ -2346,10 +2346,10 @@ public abstract class FSEditLogOp {
} }
@Override void fromXml(Stanza st) throws InvalidXmlException { @Override void fromXml(Stanza st) throws InvalidXmlException {
this.length = Integer.valueOf(st.getValue("LENGTH")); this.length = Integer.parseInt(st.getValue("LENGTH"));
this.src = st.getValue("SRC"); this.src = st.getValue("SRC");
this.dst = st.getValue("DST"); this.dst = st.getValue("DST");
this.timestamp = Long.valueOf(st.getValue("TIMESTAMP")); this.timestamp = Long.parseLong(st.getValue("TIMESTAMP"));
String opts = st.getValue("OPTIONS"); String opts = st.getValue("OPTIONS");
String o[] = opts.split("\\|"); String o[] = opts.split("\\|");
this.options = new Rename[o.length]; this.options = new Rename[o.length];
@ -2511,13 +2511,13 @@ public abstract class FSEditLogOp {
protected void toXml(ContentHandler contentHandler) throws SAXException { protected void toXml(ContentHandler contentHandler) throws SAXException {
FSEditLogOp.delegationTokenToXml(contentHandler, token); FSEditLogOp.delegationTokenToXml(contentHandler, token);
XMLUtils.addSaxString(contentHandler, "EXPIRY_TIME", XMLUtils.addSaxString(contentHandler, "EXPIRY_TIME",
Long.valueOf(expiryTime).toString()); Long.toString(expiryTime));
} }
@Override void fromXml(Stanza st) throws InvalidXmlException { @Override void fromXml(Stanza st) throws InvalidXmlException {
this.token = delegationTokenFromXml(st.getChildren( this.token = delegationTokenFromXml(st.getChildren(
"DELEGATION_TOKEN_IDENTIFIER").get(0)); "DELEGATION_TOKEN_IDENTIFIER").get(0));
this.expiryTime = Long.valueOf(st.getValue("EXPIRY_TIME")); this.expiryTime = Long.parseLong(st.getValue("EXPIRY_TIME"));
} }
} }
@ -2584,13 +2584,13 @@ public abstract class FSEditLogOp {
protected void toXml(ContentHandler contentHandler) throws SAXException { protected void toXml(ContentHandler contentHandler) throws SAXException {
FSEditLogOp.delegationTokenToXml(contentHandler, token); FSEditLogOp.delegationTokenToXml(contentHandler, token);
XMLUtils.addSaxString(contentHandler, "EXPIRY_TIME", XMLUtils.addSaxString(contentHandler, "EXPIRY_TIME",
Long.valueOf(expiryTime).toString()); Long.toString(expiryTime));
} }
@Override void fromXml(Stanza st) throws InvalidXmlException { @Override void fromXml(Stanza st) throws InvalidXmlException {
this.token = delegationTokenFromXml(st.getChildren( this.token = delegationTokenFromXml(st.getChildren(
"DELEGATION_TOKEN_IDENTIFIER").get(0)); "DELEGATION_TOKEN_IDENTIFIER").get(0));
this.expiryTime = Long.valueOf(st.getValue("EXPIRY_TIME")); this.expiryTime = Long.parseLong(st.getValue("EXPIRY_TIME"));
} }
} }
@ -3626,12 +3626,12 @@ public abstract class FSEditLogOp {
@Override @Override
protected void toXml(ContentHandler contentHandler) throws SAXException { protected void toXml(ContentHandler contentHandler) throws SAXException {
XMLUtils.addSaxString(contentHandler, name + "TIME", XMLUtils.addSaxString(contentHandler, name + "TIME",
Long.valueOf(time).toString()); Long.toString(time));
} }
@Override @Override
void fromXml(Stanza st) throws InvalidXmlException { void fromXml(Stanza st) throws InvalidXmlException {
this.time = Long.valueOf(st.getValue(name + "TIME")); this.time = Long.parseLong(st.getValue(name + "TIME"));
} }
@Override @Override
@ -3938,7 +3938,7 @@ public abstract class FSEditLogOp {
abstract void fromXml(Stanza st) throws InvalidXmlException; abstract void fromXml(Stanza st) throws InvalidXmlException;
public void decodeXml(Stanza st) throws InvalidXmlException { public void decodeXml(Stanza st) throws InvalidXmlException {
this.txid = Long.valueOf(st.getValue("TXID")); this.txid = Long.parseLong(st.getValue("TXID"));
fromXml(st); fromXml(st);
} }
@ -3946,19 +3946,19 @@ public abstract class FSEditLogOp {
throws SAXException { throws SAXException {
contentHandler.startElement("", "", "BLOCK", new AttributesImpl()); contentHandler.startElement("", "", "BLOCK", new AttributesImpl());
XMLUtils.addSaxString(contentHandler, "BLOCK_ID", XMLUtils.addSaxString(contentHandler, "BLOCK_ID",
Long.valueOf(block.getBlockId()).toString()); Long.toString(block.getBlockId()));
XMLUtils.addSaxString(contentHandler, "NUM_BYTES", XMLUtils.addSaxString(contentHandler, "NUM_BYTES",
Long.valueOf(block.getNumBytes()).toString()); Long.toString(block.getNumBytes()));
XMLUtils.addSaxString(contentHandler, "GENSTAMP", XMLUtils.addSaxString(contentHandler, "GENSTAMP",
Long.valueOf(block.getGenerationStamp()).toString()); Long.toString(block.getGenerationStamp()));
contentHandler.endElement("", "", "BLOCK"); contentHandler.endElement("", "", "BLOCK");
} }
public static Block blockFromXml(Stanza st) public static Block blockFromXml(Stanza st)
throws InvalidXmlException { throws InvalidXmlException {
long blockId = Long.valueOf(st.getValue("BLOCK_ID")); long blockId = Long.parseLong(st.getValue("BLOCK_ID"));
long numBytes = Long.valueOf(st.getValue("NUM_BYTES")); long numBytes = Long.parseLong(st.getValue("NUM_BYTES"));
long generationStamp = Long.valueOf(st.getValue("GENSTAMP")); long generationStamp = Long.parseLong(st.getValue("GENSTAMP"));
return new Block(blockId, numBytes, generationStamp); return new Block(blockId, numBytes, generationStamp);
} }
@ -3967,7 +3967,7 @@ public abstract class FSEditLogOp {
contentHandler.startElement("", "", "DELEGATION_TOKEN_IDENTIFIER", new AttributesImpl()); contentHandler.startElement("", "", "DELEGATION_TOKEN_IDENTIFIER", new AttributesImpl());
XMLUtils.addSaxString(contentHandler, "KIND", token.getKind().toString()); XMLUtils.addSaxString(contentHandler, "KIND", token.getKind().toString());
XMLUtils.addSaxString(contentHandler, "SEQUENCE_NUMBER", XMLUtils.addSaxString(contentHandler, "SEQUENCE_NUMBER",
Integer.valueOf(token.getSequenceNumber()).toString()); Integer.toString(token.getSequenceNumber()));
XMLUtils.addSaxString(contentHandler, "OWNER", XMLUtils.addSaxString(contentHandler, "OWNER",
token.getOwner().toString()); token.getOwner().toString());
XMLUtils.addSaxString(contentHandler, "RENEWER", XMLUtils.addSaxString(contentHandler, "RENEWER",
@ -3975,11 +3975,11 @@ public abstract class FSEditLogOp {
XMLUtils.addSaxString(contentHandler, "REALUSER", XMLUtils.addSaxString(contentHandler, "REALUSER",
token.getRealUser().toString()); token.getRealUser().toString());
XMLUtils.addSaxString(contentHandler, "ISSUE_DATE", XMLUtils.addSaxString(contentHandler, "ISSUE_DATE",
Long.valueOf(token.getIssueDate()).toString()); Long.toString(token.getIssueDate()));
XMLUtils.addSaxString(contentHandler, "MAX_DATE", XMLUtils.addSaxString(contentHandler, "MAX_DATE",
Long.valueOf(token.getMaxDate()).toString()); Long.toString(token.getMaxDate()));
XMLUtils.addSaxString(contentHandler, "MASTER_KEY_ID", XMLUtils.addSaxString(contentHandler, "MASTER_KEY_ID",
Integer.valueOf(token.getMasterKeyId()).toString()); Integer.toString(token.getMasterKeyId()));
contentHandler.endElement("", "", "DELEGATION_TOKEN_IDENTIFIER"); contentHandler.endElement("", "", "DELEGATION_TOKEN_IDENTIFIER");
} }
@ -3991,13 +3991,13 @@ public abstract class FSEditLogOp {
throw new InvalidXmlException("can't understand " + throw new InvalidXmlException("can't understand " +
"DelegationTokenIdentifier KIND " + kind); "DelegationTokenIdentifier KIND " + kind);
} }
int seqNum = Integer.valueOf(st.getValue("SEQUENCE_NUMBER")); int seqNum = Integer.parseInt(st.getValue("SEQUENCE_NUMBER"));
String owner = st.getValue("OWNER"); String owner = st.getValue("OWNER");
String renewer = st.getValue("RENEWER"); String renewer = st.getValue("RENEWER");
String realuser = st.getValue("REALUSER"); String realuser = st.getValue("REALUSER");
long issueDate = Long.valueOf(st.getValue("ISSUE_DATE")); long issueDate = Long.parseLong(st.getValue("ISSUE_DATE"));
long maxDate = Long.valueOf(st.getValue("MAX_DATE")); long maxDate = Long.parseLong(st.getValue("MAX_DATE"));
int masterKeyId = Integer.valueOf(st.getValue("MASTER_KEY_ID")); int masterKeyId = Integer.parseInt(st.getValue("MASTER_KEY_ID"));
DelegationTokenIdentifier token = DelegationTokenIdentifier token =
new DelegationTokenIdentifier(new Text(owner), new DelegationTokenIdentifier(new Text(owner),
new Text(renewer), new Text(realuser)); new Text(renewer), new Text(realuser));
@ -4012,9 +4012,9 @@ public abstract class FSEditLogOp {
DelegationKey key) throws SAXException { DelegationKey key) throws SAXException {
contentHandler.startElement("", "", "DELEGATION_KEY", new AttributesImpl()); contentHandler.startElement("", "", "DELEGATION_KEY", new AttributesImpl());
XMLUtils.addSaxString(contentHandler, "KEY_ID", XMLUtils.addSaxString(contentHandler, "KEY_ID",
Integer.valueOf(key.getKeyId()).toString()); Integer.toString(key.getKeyId()));
XMLUtils.addSaxString(contentHandler, "EXPIRY_DATE", XMLUtils.addSaxString(contentHandler, "EXPIRY_DATE",
Long.valueOf(key.getExpiryDate()).toString()); Long.toString(key.getExpiryDate()));
if (key.getEncodedKey() != null) { if (key.getEncodedKey() != null) {
XMLUtils.addSaxString(contentHandler, "KEY", XMLUtils.addSaxString(contentHandler, "KEY",
Hex.encodeHexString(key.getEncodedKey())); Hex.encodeHexString(key.getEncodedKey()));
@ -4024,8 +4024,8 @@ public abstract class FSEditLogOp {
public static DelegationKey delegationKeyFromXml(Stanza st) public static DelegationKey delegationKeyFromXml(Stanza st)
throws InvalidXmlException { throws InvalidXmlException {
int keyId = Integer.valueOf(st.getValue("KEY_ID")); int keyId = Integer.parseInt(st.getValue("KEY_ID"));
long expiryDate = Long.valueOf(st.getValue("EXPIRY_DATE")); long expiryDate = Long.parseLong(st.getValue("EXPIRY_DATE"));
byte key[] = null; byte key[] = null;
try { try {
key = Hex.decodeHex(st.getValue("KEY").toCharArray()); key = Hex.decodeHex(st.getValue("KEY").toCharArray());

View File

@ -115,7 +115,7 @@ class FSImageTransactionalStorageInspector extends FSImageStorageInspector {
if (imageMatch != null) { if (imageMatch != null) {
if (sd.getStorageDirType().isOfType(NameNodeDirType.IMAGE)) { if (sd.getStorageDirType().isOfType(NameNodeDirType.IMAGE)) {
try { try {
long txid = Long.valueOf(imageMatch.group(1)); long txid = Long.parseLong(imageMatch.group(1));
foundImages.add(new FSImageFile(sd, f, txid)); foundImages.add(new FSImageFile(sd, f, txid));
} catch (NumberFormatException nfe) { } catch (NumberFormatException nfe) {
LOG.error("Image file " + f + " has improperly formatted " + LOG.error("Image file " + f + " has improperly formatted " +

View File

@ -247,8 +247,8 @@ public class FileJournalManager implements JournalManager {
Matcher editsMatch = EDITS_REGEX.matcher(name); Matcher editsMatch = EDITS_REGEX.matcher(name);
if (editsMatch.matches()) { if (editsMatch.matches()) {
try { try {
long startTxId = Long.valueOf(editsMatch.group(1)); long startTxId = Long.parseLong(editsMatch.group(1));
long endTxId = Long.valueOf(editsMatch.group(2)); long endTxId = Long.parseLong(editsMatch.group(2));
ret.add(new EditLogFile(f, startTxId, endTxId)); ret.add(new EditLogFile(f, startTxId, endTxId));
} catch (NumberFormatException nfe) { } catch (NumberFormatException nfe) {
LOG.error("Edits file " + f + " has improperly formatted " + LOG.error("Edits file " + f + " has improperly formatted " +
@ -261,7 +261,7 @@ public class FileJournalManager implements JournalManager {
Matcher inProgressEditsMatch = EDITS_INPROGRESS_REGEX.matcher(name); Matcher inProgressEditsMatch = EDITS_INPROGRESS_REGEX.matcher(name);
if (inProgressEditsMatch.matches()) { if (inProgressEditsMatch.matches()) {
try { try {
long startTxId = Long.valueOf(inProgressEditsMatch.group(1)); long startTxId = Long.parseLong(inProgressEditsMatch.group(1));
ret.add( ret.add(
new EditLogFile(f, startTxId, HdfsConstants.INVALID_TXID, true)); new EditLogFile(f, startTxId, HdfsConstants.INVALID_TXID, true));
} catch (NumberFormatException nfe) { } catch (NumberFormatException nfe) {

View File

@ -105,7 +105,7 @@ public class HostFileManager {
prefix = entry.substring(0, idx); prefix = entry.substring(0, idx);
String portStr = entry.substring(idx + 1); String portStr = entry.substring(idx + 1);
try { try {
port = Integer.valueOf(portStr); port = Integer.parseInt(portStr);
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
throw new IOException("unable to parse port number for " + throw new IOException("unable to parse port number for " +
"'" + entry + "'", e); "'" + entry + "'", e);

View File

@ -786,7 +786,6 @@ public class NNStorage extends Storage implements Closeable,
* Marks a list of directories as having experienced an error. * Marks a list of directories as having experienced an error.
* *
* @param sds A list of storage directories to mark as errored. * @param sds A list of storage directories to mark as errored.
* @throws IOException
*/ */
void reportErrorsOnDirectories(List<StorageDirectory> sds) { void reportErrorsOnDirectories(List<StorageDirectory> sds) {
for (StorageDirectory sd : sds) { for (StorageDirectory sd : sds) {
@ -800,7 +799,6 @@ public class NNStorage extends Storage implements Closeable,
* available. * available.
* *
* @param sd A storage directory to mark as errored. * @param sd A storage directory to mark as errored.
* @throws IOException
*/ */
private void reportErrorsOnDirectory(StorageDirectory sd) { private void reportErrorsOnDirectory(StorageDirectory sd) {
LOG.error("Error reported on storage directory " + sd); LOG.error("Error reported on storage directory " + sd);

View File

@ -301,7 +301,7 @@ public class CacheAdmin extends Configured implements Tool {
} }
long id; long id;
try { try {
id = Long.valueOf(idString); id = Long.parseLong(idString);
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
System.err.println("Invalid directive ID " + idString + ": expected " + System.err.println("Invalid directive ID " + idString + ": expected " +
"a numeric value."); "a numeric value.");

View File

@ -144,7 +144,7 @@ class DelimitedImageVisitor extends TextWriterImageVisitor {
// Special case of file size, which is sum of the num bytes in each block // Special case of file size, which is sum of the num bytes in each block
if(element == ImageElement.NUM_BYTES) if(element == ImageElement.NUM_BYTES)
fileSize += Long.valueOf(value); fileSize += Long.parseLong(value);
if(elements.containsKey(element) && element != ImageElement.NUM_BYTES) if(elements.containsKey(element) && element != ImageElement.NUM_BYTES)
elements.put(element, value); elements.put(element, value);

View File

@ -159,10 +159,10 @@ class FileDistributionVisitor extends TextWriterImageVisitor {
current.path = (value.equals("") ? "/" : value); current.path = (value.equals("") ? "/" : value);
break; break;
case REPLICATION: case REPLICATION:
current.replication = Integer.valueOf(value); current.replication = Integer.parseInt(value);
break; break;
case NUM_BYTES: case NUM_BYTES:
current.fileSize += Long.valueOf(value); current.fileSize += Long.parseLong(value);
break; break;
default: default:
break; break;

View File

@ -135,7 +135,7 @@ class LsImageVisitor extends TextWriterImageVisitor {
perms = value; perms = value;
break; break;
case REPLICATION: case REPLICATION:
replication = Integer.valueOf(value); replication = Integer.parseInt(value);
break; break;
case USER_NAME: case USER_NAME:
username = value; username = value;
@ -144,7 +144,7 @@ class LsImageVisitor extends TextWriterImageVisitor {
group = value; group = value;
break; break;
case NUM_BYTES: case NUM_BYTES:
filesize += Long.valueOf(value); filesize += Long.parseLong(value);
break; break;
case MODIFICATION_TIME: case MODIFICATION_TIME:
modTime = value; modTime = value;
@ -173,6 +173,6 @@ class LsImageVisitor extends TextWriterImageVisitor {
if(element == ImageElement.INODE) if(element == ImageElement.INODE)
newLine(); newLine();
else if (element == ImageElement.BLOCKS) else if (element == ImageElement.BLOCKS)
numBlocks = Integer.valueOf(value); numBlocks = Integer.parseInt(value);
} }
} }

View File

@ -20,7 +20,6 @@ package org.apache.hadoop.hdfs.util;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileReader;
import java.io.IOException; import java.io.IOException;
import java.io.InputStreamReader; import java.io.InputStreamReader;
@ -96,7 +95,7 @@ public class PersistentLongFile {
new BufferedReader(new InputStreamReader(new FileInputStream( new BufferedReader(new InputStreamReader(new FileInputStream(
file), Charsets.UTF_8)); file), Charsets.UTF_8));
try { try {
val = Long.valueOf(br.readLine()); val = Long.parseLong(br.readLine());
br.close(); br.close();
br = null; br = null;
} finally { } finally {

View File

@ -134,7 +134,6 @@ public class HftpFileSystem extends FileSystem
* 3. DFS_NAMENODE_HTTP_PORT_DEFAULT i.e. 50070. * 3. DFS_NAMENODE_HTTP_PORT_DEFAULT i.e. 50070.
* *
* @param uri * @param uri
* @return
*/ */
protected InetSocketAddress getNamenodeAddr(URI uri) { protected InetSocketAddress getNamenodeAddr(URI uri) {
// use authority so user supplied uri can override port // use authority so user supplied uri can override port
@ -435,9 +434,9 @@ public class HftpFileSystem extends FileSystem
} catch (ParseException e) { throw new SAXException(e); } } catch (ParseException e) { throw new SAXException(e); }
FileStatus fs = "file".equals(qname) FileStatus fs = "file".equals(qname)
? new FileStatus( ? new FileStatus(
Long.valueOf(attrs.getValue("size")).longValue(), false, Long.parseLong(attrs.getValue("size")), false,
Short.valueOf(attrs.getValue("replication")).shortValue(), Short.valueOf(attrs.getValue("replication")).shortValue(),
Long.valueOf(attrs.getValue("blocksize")).longValue(), Long.parseLong(attrs.getValue("blocksize")),
modif, atime, FsPermission.valueOf(attrs.getValue("permission")), modif, atime, FsPermission.valueOf(attrs.getValue("permission")),
attrs.getValue("owner"), attrs.getValue("group"), attrs.getValue("owner"), attrs.getValue("group"),
HftpFileSystem.this.makeQualified( HftpFileSystem.this.makeQualified(

View File

@ -107,7 +107,7 @@ public class TestFetchImage {
for (File imageFile : new File(new File(nameDir), "current").listFiles()) { for (File imageFile : new File(new File(nameDir), "current").listFiles()) {
Matcher imageMatch = IMAGE_REGEX.matcher(imageFile.getName()); Matcher imageMatch = IMAGE_REGEX.matcher(imageFile.getName());
if (imageMatch.matches()) { if (imageMatch.matches()) {
long imageTxId = Long.valueOf(imageMatch.group(1)); long imageTxId = Long.parseLong(imageMatch.group(1));
if (imageTxId > highestImageTxId) { if (imageTxId > highestImageTxId) {
highestImageTxId = imageTxId; highestImageTxId = imageTxId;
highestImageOnNn = imageFile; highestImageOnNn = imageFile;

View File

@ -519,7 +519,7 @@ public class TestShortCircuitLocalRead {
} }
boolean shortcircuit = Boolean.valueOf(args[0]); boolean shortcircuit = Boolean.valueOf(args[0]);
boolean checksum = Boolean.valueOf(args[1]); boolean checksum = Boolean.valueOf(args[1]);
int threadCount = Integer.valueOf(args[2]); int threadCount = Integer.parseInt(args[2]);
// Setup create a file // Setup create a file
final Configuration conf = new Configuration(); final Configuration conf = new Configuration();

View File

@ -1059,11 +1059,11 @@ public class TestEditLog {
assertTrue("bad spec: " + logSpec, m.matches()); assertTrue("bad spec: " + logSpec, m.matches());
if (m.group(2) == null) { if (m.group(2) == null) {
files.add(NNStorage.getInProgressEditsFileName( files.add(NNStorage.getInProgressEditsFileName(
Long.valueOf(m.group(1)))); Long.parseLong(m.group(1))));
} else { } else {
files.add(NNStorage.getFinalizedEditsFileName( files.add(NNStorage.getFinalizedEditsFileName(
Long.valueOf(m.group(1)), Long.parseLong(m.group(1)),
Long.valueOf(m.group(2)))); Long.parseLong(m.group(2))));
} }
} }
StorageDirectory sd = FSImageTestUtil.mockStorageDirectory( StorageDirectory sd = FSImageTestUtil.mockStorageDirectory(

View File

@ -316,7 +316,7 @@ public class TestNameNodeJspHelper {
String digitLine = output.substring(matcher.start(), matcher.end()) String digitLine = output.substring(matcher.start(), matcher.end())
.trim(); .trim();
assertTrue("assertCounts error. actual != expected", assertTrue("assertCounts error. actual != expected",
Integer.valueOf(digitLine) == expectedCount); Integer.parseInt(digitLine) == expectedCount);
} else { } else {
fail("assertCount matcher error"); fail("assertCount matcher error");
} }

View File

@ -43,9 +43,9 @@ class SpotCheckImageVisitor extends ImageVisitor {
@Override @Override
void visit(ImageElement element, String value) throws IOException { void visit(ImageElement element, String value) throws IOException {
if(element == ImageElement.NUM_BYTES) if(element == ImageElement.NUM_BYTES)
current.totalFileSize += Long.valueOf(value); current.totalFileSize += Long.parseLong(value);
else if (element == ImageElement.REPLICATION) else if (element == ImageElement.REPLICATION)
current.totalReplications += Long.valueOf(value); current.totalReplications += Long.parseLong(value);
else if (element == ImageElement.INODE_PATH) else if (element == ImageElement.INODE_PATH)
current.pathNames.add(value); current.pathNames.add(value);
} }
@ -61,7 +61,7 @@ class SpotCheckImageVisitor extends ImageVisitor {
current = INUCs; current = INUCs;
break; break;
case BLOCKS: case BLOCKS:
current.totalNumBlocks += Long.valueOf(value); current.totalNumBlocks += Long.parseLong(value);
break; break;
// OK to not have a default, we're skipping most of the values // OK to not have a default, we're skipping most of the values
} }

View File

@ -186,7 +186,7 @@ public class TestDelegationTokenRemoteFetcher {
NumberFormatException, AuthenticationException { NumberFormatException, AuthenticationException {
bootstrap = startHttpServer(httpPort, testToken, serviceUrl); bootstrap = startHttpServer(httpPort, testToken, serviceUrl);
assertTrue("testRenewTokenFromHttp error", assertTrue("testRenewTokenFromHttp error",
Long.valueOf(EXP_DATE) == DelegationTokenFetcher.renewDelegationToken( Long.parseLong(EXP_DATE) == DelegationTokenFetcher.renewDelegationToken(
connectionFactory, serviceUrl, testToken)); connectionFactory, serviceUrl, testToken));
if (assertionError != null) if (assertionError != null)
throw assertionError; throw assertionError;