HADOOP-8814. Replace string equals by String#isEmpty(). Contributed by Brandon Li.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1387853 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d26f05b7f5
commit
4c56bccf5e
@ -103,6 +103,9 @@ Trunk (Unreleased)
|
|||||||
|
|
||||||
HADOOP-8736. Add Builder for building RPC server. (Brandon Li via Suresh)
|
HADOOP-8736. Add Builder for building RPC server. (Brandon Li via Suresh)
|
||||||
|
|
||||||
|
HADOOP-8814. Replace string equals "" by String#isEmpty().
|
||||||
|
(Brandon Li via suresh)
|
||||||
|
|
||||||
BUG FIXES
|
BUG FIXES
|
||||||
|
|
||||||
HADOOP-8177. MBeans shouldn't try to register when it fails to create MBeanName.
|
HADOOP-8177. MBeans shouldn't try to register when it fails to create MBeanName.
|
||||||
|
@ -1073,7 +1073,7 @@ public class Configuration implements Iterable<Map.Entry<String,String>>,
|
|||||||
*/
|
*/
|
||||||
public boolean getBoolean(String name, boolean defaultValue) {
|
public boolean getBoolean(String name, boolean defaultValue) {
|
||||||
String valueString = getTrimmed(name);
|
String valueString = getTrimmed(name);
|
||||||
if (null == valueString || "".equals(valueString)) {
|
if (null == valueString || valueString.isEmpty()) {
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1140,7 +1140,7 @@ public class Configuration implements Iterable<Map.Entry<String,String>>,
|
|||||||
*/
|
*/
|
||||||
public Pattern getPattern(String name, Pattern defaultValue) {
|
public Pattern getPattern(String name, Pattern defaultValue) {
|
||||||
String valString = get(name);
|
String valString = get(name);
|
||||||
if (null == valString || "".equals(valString)) {
|
if (null == valString || valString.isEmpty()) {
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
@ -153,9 +153,9 @@ public class ReconfigurationServlet extends HttpServlet {
|
|||||||
StringEscapeUtils.unescapeHtml(req.getParameter(rawParam));
|
StringEscapeUtils.unescapeHtml(req.getParameter(rawParam));
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
if (value.equals(newConf.getRaw(param)) || value.equals("default") ||
|
if (value.equals(newConf.getRaw(param)) || value.equals("default") ||
|
||||||
value.equals("null") || value.equals("")) {
|
value.equals("null") || value.isEmpty()) {
|
||||||
if ((value.equals("default") || value.equals("null") ||
|
if ((value.equals("default") || value.equals("null") ||
|
||||||
value.equals("")) &&
|
value.isEmpty()) &&
|
||||||
oldConf.getRaw(param) != null) {
|
oldConf.getRaw(param) != null) {
|
||||||
out.println("<p>Changed \"" +
|
out.println("<p>Changed \"" +
|
||||||
StringEscapeUtils.escapeHtml(param) + "\" from \"" +
|
StringEscapeUtils.escapeHtml(param) + "\" from \"" +
|
||||||
@ -163,7 +163,7 @@ public class ReconfigurationServlet extends HttpServlet {
|
|||||||
"\" to default</p>");
|
"\" to default</p>");
|
||||||
reconf.reconfigureProperty(param, null);
|
reconf.reconfigureProperty(param, null);
|
||||||
} else if (!value.equals("default") && !value.equals("null") &&
|
} else if (!value.equals("default") && !value.equals("null") &&
|
||||||
!value.equals("") &&
|
!value.isEmpty() &&
|
||||||
(oldConf.getRaw(param) == null ||
|
(oldConf.getRaw(param) == null ||
|
||||||
!oldConf.getRaw(param).equals(value))) {
|
!oldConf.getRaw(param).equals(value))) {
|
||||||
// change from default or value to different value
|
// change from default or value to different value
|
||||||
|
@ -2003,7 +2003,7 @@ public final class FileContext {
|
|||||||
String filename = inPathPattern.toUri().getPath();
|
String filename = inPathPattern.toUri().getPath();
|
||||||
|
|
||||||
// path has only zero component
|
// path has only zero component
|
||||||
if ("".equals(filename) || Path.SEPARATOR.equals(filename)) {
|
if (filename.isEmpty() || Path.SEPARATOR.equals(filename)) {
|
||||||
Path p = inPathPattern.makeQualified(uri, null);
|
Path p = inPathPattern.makeQualified(uri, null);
|
||||||
return getFileStatus(new Path[]{p});
|
return getFileStatus(new Path[]{p});
|
||||||
}
|
}
|
||||||
|
@ -1597,7 +1597,7 @@ public abstract class FileSystem extends Configured implements Closeable {
|
|||||||
String filename = pathPattern.toUri().getPath();
|
String filename = pathPattern.toUri().getPath();
|
||||||
|
|
||||||
// path has only zero component
|
// path has only zero component
|
||||||
if ("".equals(filename) || Path.SEPARATOR.equals(filename)) {
|
if (filename.isEmpty() || Path.SEPARATOR.equals(filename)) {
|
||||||
return getFileStatus(new Path[]{pathPattern});
|
return getFileStatus(new Path[]{pathPattern});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ public class Path implements Comparable {
|
|||||||
// Add a slash to parent's path so resolution is compatible with URI's
|
// Add a slash to parent's path so resolution is compatible with URI's
|
||||||
URI parentUri = parent.uri;
|
URI parentUri = parent.uri;
|
||||||
String parentPath = parentUri.getPath();
|
String parentPath = parentUri.getPath();
|
||||||
if (!(parentPath.equals("/") || parentPath.equals(""))) {
|
if (!(parentPath.equals("/") || parentPath.isEmpty())) {
|
||||||
try {
|
try {
|
||||||
parentUri = new URI(parentUri.getScheme(), parentUri.getAuthority(),
|
parentUri = new URI(parentUri.getScheme(), parentUri.getAuthority(),
|
||||||
parentUri.getPath()+"/", null, parentUri.getFragment());
|
parentUri.getPath()+"/", null, parentUri.getFragment());
|
||||||
|
@ -492,7 +492,7 @@ public class RawLocalFileSystem extends FileSystem {
|
|||||||
* onwer.equals("").
|
* onwer.equals("").
|
||||||
*/
|
*/
|
||||||
private boolean isPermissionLoaded() {
|
private boolean isPermissionLoaded() {
|
||||||
return !super.getOwner().equals("");
|
return !super.getOwner().isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
RawLocalFileStatus(File f, long defaultBlockSize, FileSystem fs) {
|
RawLocalFileStatus(File f, long defaultBlockSize, FileSystem fs) {
|
||||||
|
@ -128,7 +128,7 @@ public class RawLocalFs extends DelegateToFileSystem {
|
|||||||
try {
|
try {
|
||||||
FileStatus fs = getFileStatus(f);
|
FileStatus fs = getFileStatus(f);
|
||||||
// If f refers to a regular file or directory
|
// If f refers to a regular file or directory
|
||||||
if ("".equals(target)) {
|
if (target.isEmpty()) {
|
||||||
return fs;
|
return fs;
|
||||||
}
|
}
|
||||||
// Otherwise f refers to a symlink
|
// Otherwise f refers to a symlink
|
||||||
@ -150,7 +150,7 @@ public class RawLocalFs extends DelegateToFileSystem {
|
|||||||
* the readBasicFileAttributes method in java.nio.file.attributes
|
* the readBasicFileAttributes method in java.nio.file.attributes
|
||||||
* when available.
|
* when available.
|
||||||
*/
|
*/
|
||||||
if (!"".equals(target)) {
|
if (!target.isEmpty()) {
|
||||||
return new FileStatus(0, false, 0, 0, 0, 0, FsPermission.getDefault(),
|
return new FileStatus(0, false, 0, 0, 0, 0, FsPermission.getDefault(),
|
||||||
"", "", new Path(target), f);
|
"", "", new Path(target), f);
|
||||||
}
|
}
|
||||||
|
@ -300,7 +300,7 @@ public class NativeS3FileSystem extends FileSystem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static String pathToKey(Path path) {
|
private static String pathToKey(Path path) {
|
||||||
if (path.toUri().getScheme() != null && "".equals(path.toUri().getPath())) {
|
if (path.toUri().getScheme() != null && path.toUri().getPath().isEmpty()) {
|
||||||
// allow uris without trailing slash after bucket to refer to root,
|
// allow uris without trailing slash after bucket to refer to root,
|
||||||
// like s3n://mybucket
|
// like s3n://mybucket
|
||||||
return "";
|
return "";
|
||||||
|
@ -276,7 +276,7 @@ public class ActiveStandbyElector implements StatCallback, StringCallback {
|
|||||||
|
|
||||||
String pathParts[] = znodeWorkingDir.split("/");
|
String pathParts[] = znodeWorkingDir.split("/");
|
||||||
Preconditions.checkArgument(pathParts.length >= 1 &&
|
Preconditions.checkArgument(pathParts.length >= 1 &&
|
||||||
"".equals(pathParts[0]),
|
pathParts[0].isEmpty(),
|
||||||
"Invalid path: %s", znodeWorkingDir);
|
"Invalid path: %s", znodeWorkingDir);
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
@ -241,7 +241,7 @@ public class SshFenceByTcpPort extends Configured
|
|||||||
sshPort = DEFAULT_SSH_PORT;
|
sshPort = DEFAULT_SSH_PORT;
|
||||||
|
|
||||||
// Parse optional user and ssh port
|
// Parse optional user and ssh port
|
||||||
if (arg != null && !"".equals(arg)) {
|
if (arg != null && !arg.isEmpty()) {
|
||||||
Matcher m = USER_PORT_RE.matcher(arg);
|
Matcher m = USER_PORT_RE.matcher(arg);
|
||||||
if (!m.matches()) {
|
if (!m.matches()) {
|
||||||
throw new BadFencingConfigurationException(
|
throw new BadFencingConfigurationException(
|
||||||
|
@ -192,7 +192,7 @@ public class DefaultStringifier<T> implements Stringifier<T> {
|
|||||||
String[] parts = itemStr.split(SEPARATOR);
|
String[] parts = itemStr.split(SEPARATOR);
|
||||||
|
|
||||||
for (String part : parts) {
|
for (String part : parts) {
|
||||||
if (!part.equals(""))
|
if (!part.isEmpty())
|
||||||
list.add(stringifier.fromString(part));
|
list.add(stringifier.fromString(part));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2105,7 +2105,7 @@ public class TFile {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSorted() {
|
public boolean isSorted() {
|
||||||
return !strComparator.equals("");
|
return !strComparator.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getComparatorString() {
|
public String getComparatorString() {
|
||||||
|
@ -129,7 +129,7 @@ public abstract class MetricsDynamicMBeanBase implements DynamicMBean {
|
|||||||
@Override
|
@Override
|
||||||
public Object getAttribute(String attributeName) throws AttributeNotFoundException,
|
public Object getAttribute(String attributeName) throws AttributeNotFoundException,
|
||||||
MBeanException, ReflectionException {
|
MBeanException, ReflectionException {
|
||||||
if (attributeName == null || attributeName.equals(""))
|
if (attributeName == null || attributeName.isEmpty())
|
||||||
throw new IllegalArgumentException();
|
throw new IllegalArgumentException();
|
||||||
|
|
||||||
updateMbeanInfoIfMetricsListChanged();
|
updateMbeanInfoIfMetricsListChanged();
|
||||||
@ -197,7 +197,7 @@ public abstract class MetricsDynamicMBeanBase implements DynamicMBean {
|
|||||||
public Object invoke(String actionName, Object[] parms, String[] signature)
|
public Object invoke(String actionName, Object[] parms, String[] signature)
|
||||||
throws MBeanException, ReflectionException {
|
throws MBeanException, ReflectionException {
|
||||||
|
|
||||||
if (actionName == null || actionName.equals(""))
|
if (actionName == null || actionName.isEmpty())
|
||||||
throw new IllegalArgumentException();
|
throw new IllegalArgumentException();
|
||||||
|
|
||||||
|
|
||||||
|
@ -144,7 +144,7 @@ public class CsvRecordInput implements RecordInput {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void startRecord(String tag) throws IOException {
|
public void startRecord(String tag) throws IOException {
|
||||||
if (tag != null && !"".equals(tag)) {
|
if (tag != null && !tag.isEmpty()) {
|
||||||
char c1 = (char) stream.read();
|
char c1 = (char) stream.read();
|
||||||
char c2 = (char) stream.read();
|
char c2 = (char) stream.read();
|
||||||
if (c1 != 's' || c2 != '{') {
|
if (c1 != 's' || c2 != '{') {
|
||||||
@ -156,7 +156,7 @@ public class CsvRecordInput implements RecordInput {
|
|||||||
@Override
|
@Override
|
||||||
public void endRecord(String tag) throws IOException {
|
public void endRecord(String tag) throws IOException {
|
||||||
char c = (char) stream.read();
|
char c = (char) stream.read();
|
||||||
if (tag == null || "".equals(tag)) {
|
if (tag == null || tag.isEmpty()) {
|
||||||
if (c != '\n' && c != '\r') {
|
if (c != '\n' && c != '\r') {
|
||||||
throw new IOException("Error deserializing record.");
|
throw new IOException("Error deserializing record.");
|
||||||
} else {
|
} else {
|
||||||
|
@ -115,7 +115,7 @@ public class CsvRecordOutput implements RecordOutput {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void startRecord(Record r, String tag) throws IOException {
|
public void startRecord(Record r, String tag) throws IOException {
|
||||||
if (tag != null && !"".equals(tag)) {
|
if (tag != null && ! tag.isEmpty()) {
|
||||||
printCommaUnlessFirst();
|
printCommaUnlessFirst();
|
||||||
stream.print("s{");
|
stream.print("s{");
|
||||||
isFirst = true;
|
isFirst = true;
|
||||||
@ -124,7 +124,7 @@ public class CsvRecordOutput implements RecordOutput {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void endRecord(Record r, String tag) throws IOException {
|
public void endRecord(Record r, String tag) throws IOException {
|
||||||
if (tag == null || "".equals(tag)) {
|
if (tag == null || tag.isEmpty()) {
|
||||||
stream.print("\n");
|
stream.print("\n");
|
||||||
isFirst = true;
|
isFirst = true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -212,7 +212,7 @@ public class SecurityUtil {
|
|||||||
private static String replacePattern(String[] components, String hostname)
|
private static String replacePattern(String[] components, String hostname)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
String fqdn = hostname;
|
String fqdn = hostname;
|
||||||
if (fqdn == null || fqdn.equals("") || fqdn.equals("0.0.0.0")) {
|
if (fqdn == null || fqdn.isEmpty() || fqdn.equals("0.0.0.0")) {
|
||||||
fqdn = getLocalHostName();
|
fqdn = getLocalHostName();
|
||||||
}
|
}
|
||||||
return components[0] + "/" + fqdn.toLowerCase() + "@" + components[2];
|
return components[0] + "/" + fqdn.toLowerCase() + "@" + components[2];
|
||||||
|
@ -992,7 +992,7 @@ public class UserGroupInformation {
|
|||||||
@InterfaceAudience.Public
|
@InterfaceAudience.Public
|
||||||
@InterfaceStability.Evolving
|
@InterfaceStability.Evolving
|
||||||
public static UserGroupInformation createRemoteUser(String user) {
|
public static UserGroupInformation createRemoteUser(String user) {
|
||||||
if (user == null || "".equals(user)) {
|
if (user == null || user.isEmpty()) {
|
||||||
throw new IllegalArgumentException("Null user");
|
throw new IllegalArgumentException("Null user");
|
||||||
}
|
}
|
||||||
Subject subject = new Subject();
|
Subject subject = new Subject();
|
||||||
@ -1027,7 +1027,7 @@ public class UserGroupInformation {
|
|||||||
@InterfaceStability.Evolving
|
@InterfaceStability.Evolving
|
||||||
public static UserGroupInformation createProxyUser(String user,
|
public static UserGroupInformation createProxyUser(String user,
|
||||||
UserGroupInformation realUser) {
|
UserGroupInformation realUser) {
|
||||||
if (user == null || "".equals(user)) {
|
if (user == null || user.isEmpty()) {
|
||||||
throw new IllegalArgumentException("Null user");
|
throw new IllegalArgumentException("Null user");
|
||||||
}
|
}
|
||||||
if (realUser == null) {
|
if (realUser == null) {
|
||||||
|
@ -88,7 +88,7 @@ public class ServiceAuthorizationManager {
|
|||||||
String clientPrincipal = null;
|
String clientPrincipal = null;
|
||||||
if (krbInfo != null) {
|
if (krbInfo != null) {
|
||||||
String clientKey = krbInfo.clientPrincipal();
|
String clientKey = krbInfo.clientPrincipal();
|
||||||
if (clientKey != null && !clientKey.equals("")) {
|
if (clientKey != null && !clientKey.isEmpty()) {
|
||||||
try {
|
try {
|
||||||
clientPrincipal = SecurityUtil.getServerPrincipal(
|
clientPrincipal = SecurityUtil.getServerPrincipal(
|
||||||
conf.get(clientKey), addr);
|
conf.get(clientKey), addr);
|
||||||
|
@ -87,12 +87,12 @@ extends TokenIdentifier {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public UserGroupInformation getUser() {
|
public UserGroupInformation getUser() {
|
||||||
if ( (owner == null) || ("".equals(owner.toString()))) {
|
if ( (owner == null) || (owner.toString().isEmpty())) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
final UserGroupInformation realUgi;
|
final UserGroupInformation realUgi;
|
||||||
final UserGroupInformation ugi;
|
final UserGroupInformation ugi;
|
||||||
if ((realUser == null) || ("".equals(realUser.toString()))
|
if ((realUser == null) || (realUser.toString().isEmpty())
|
||||||
|| realUser.equals(owner)) {
|
|| realUser.equals(owner)) {
|
||||||
ugi = realUgi = UserGroupInformation.createRemoteUser(owner.toString());
|
ugi = realUgi = UserGroupInformation.createRemoteUser(owner.toString());
|
||||||
} else {
|
} else {
|
||||||
|
@ -265,7 +265,7 @@ extends AbstractDelegationTokenIdentifier>
|
|||||||
throw new InvalidToken("User " + renewer +
|
throw new InvalidToken("User " + renewer +
|
||||||
" tried to renew an expired token");
|
" tried to renew an expired token");
|
||||||
}
|
}
|
||||||
if ((id.getRenewer() == null) || ("".equals(id.getRenewer().toString()))) {
|
if ((id.getRenewer() == null) || (id.getRenewer().toString().isEmpty())) {
|
||||||
throw new AccessControlException("User " + renewer +
|
throw new AccessControlException("User " + renewer +
|
||||||
" tried to renew a token without " +
|
" tried to renew a token without " +
|
||||||
"a renewer");
|
"a renewer");
|
||||||
@ -321,7 +321,7 @@ extends AbstractDelegationTokenIdentifier>
|
|||||||
HadoopKerberosName cancelerKrbName = new HadoopKerberosName(canceller);
|
HadoopKerberosName cancelerKrbName = new HadoopKerberosName(canceller);
|
||||||
String cancelerShortName = cancelerKrbName.getShortName();
|
String cancelerShortName = cancelerKrbName.getShortName();
|
||||||
if (!canceller.equals(owner)
|
if (!canceller.equals(owner)
|
||||||
&& (renewer == null || "".equals(renewer.toString()) || !cancelerShortName
|
&& (renewer == null || renewer.toString().isEmpty() || !cancelerShortName
|
||||||
.equals(renewer.toString()))) {
|
.equals(renewer.toString()))) {
|
||||||
throw new AccessControlException(canceller
|
throw new AccessControlException(canceller
|
||||||
+ " is not authorized to cancel the token");
|
+ " is not authorized to cancel the token");
|
||||||
|
@ -63,7 +63,7 @@ public class HostsFileReader {
|
|||||||
// Everything from now on is a comment
|
// Everything from now on is a comment
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!nodes[i].equals("")) {
|
if (!nodes[i].isEmpty()) {
|
||||||
LOG.info("Adding " + nodes[i] + " to the list of hosts from " + filename);
|
LOG.info("Adding " + nodes[i] + " to the list of hosts from " + filename);
|
||||||
set.add(nodes[i]); // might need to add canonical name
|
set.add(nodes[i]); // might need to add canonical name
|
||||||
}
|
}
|
||||||
@ -80,13 +80,13 @@ public class HostsFileReader {
|
|||||||
|
|
||||||
public synchronized void refresh() throws IOException {
|
public synchronized void refresh() throws IOException {
|
||||||
LOG.info("Refreshing hosts (include/exclude) list");
|
LOG.info("Refreshing hosts (include/exclude) list");
|
||||||
if (!includesFile.equals("")) {
|
if (!includesFile.isEmpty()) {
|
||||||
Set<String> newIncludes = new HashSet<String>();
|
Set<String> newIncludes = new HashSet<String>();
|
||||||
readFileToSet(includesFile, newIncludes);
|
readFileToSet(includesFile, newIncludes);
|
||||||
// switch the new hosts that are to be included
|
// switch the new hosts that are to be included
|
||||||
includes = newIncludes;
|
includes = newIncludes;
|
||||||
}
|
}
|
||||||
if (!excludesFile.equals("")) {
|
if (!excludesFile.isEmpty()) {
|
||||||
Set<String> newExcludes = new HashSet<String>();
|
Set<String> newExcludes = new HashSet<String>();
|
||||||
readFileToSet(excludesFile, newExcludes);
|
readFileToSet(excludesFile, newExcludes);
|
||||||
// switch the excluded hosts
|
// switch the excluded hosts
|
||||||
|
@ -348,7 +348,7 @@ public class StringUtils {
|
|||||||
* @return an array of <code>String</code> values
|
* @return an array of <code>String</code> values
|
||||||
*/
|
*/
|
||||||
public static String[] getTrimmedStrings(String str){
|
public static String[] getTrimmedStrings(String str){
|
||||||
if (null == str || "".equals(str.trim())) {
|
if (null == str || str.trim().isEmpty()) {
|
||||||
return emptyStringArray;
|
return emptyStringArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -408,7 +408,7 @@ public class StringUtils {
|
|||||||
String str, char separator) {
|
String str, char separator) {
|
||||||
// String.split returns a single empty result for splitting the empty
|
// String.split returns a single empty result for splitting the empty
|
||||||
// string.
|
// string.
|
||||||
if ("".equals(str)) {
|
if (str.isEmpty()) {
|
||||||
return new String[]{""};
|
return new String[]{""};
|
||||||
}
|
}
|
||||||
ArrayList<String> strList = new ArrayList<String>();
|
ArrayList<String> strList = new ArrayList<String>();
|
||||||
|
@ -67,7 +67,7 @@ public class TestNativeIO {
|
|||||||
|
|
||||||
assertEquals(System.getProperty("user.name"), stat.getOwner());
|
assertEquals(System.getProperty("user.name"), stat.getOwner());
|
||||||
assertNotNull(stat.getGroup());
|
assertNotNull(stat.getGroup());
|
||||||
assertTrue(!"".equals(stat.getGroup()));
|
assertTrue(!stat.getGroup().isEmpty());
|
||||||
assertEquals("Stat mode field should indicate a regular file",
|
assertEquals("Stat mode field should indicate a regular file",
|
||||||
NativeIO.Stat.S_IFREG, stat.getMode() & NativeIO.Stat.S_IFMT);
|
NativeIO.Stat.S_IFREG, stat.getMode() & NativeIO.Stat.S_IFMT);
|
||||||
}
|
}
|
||||||
@ -96,7 +96,7 @@ public class TestNativeIO {
|
|||||||
NativeIO.Stat stat = NativeIO.fstat(fos.getFD());
|
NativeIO.Stat stat = NativeIO.fstat(fos.getFD());
|
||||||
assertEquals(System.getProperty("user.name"), stat.getOwner());
|
assertEquals(System.getProperty("user.name"), stat.getOwner());
|
||||||
assertNotNull(stat.getGroup());
|
assertNotNull(stat.getGroup());
|
||||||
assertTrue(!"".equals(stat.getGroup()));
|
assertTrue(!stat.getGroup().isEmpty());
|
||||||
assertEquals("Stat mode field should indicate a regular file",
|
assertEquals("Stat mode field should indicate a regular file",
|
||||||
NativeIO.Stat.S_IFREG, stat.getMode() & NativeIO.Stat.S_IFMT);
|
NativeIO.Stat.S_IFREG, stat.getMode() & NativeIO.Stat.S_IFMT);
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
|
@ -112,7 +112,7 @@ public class TestSaslRPC {
|
|||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public UserGroupInformation getUser() {
|
public UserGroupInformation getUser() {
|
||||||
if ("".equals(realUser.toString())) {
|
if (realUser.toString().isEmpty()) {
|
||||||
return UserGroupInformation.createRemoteUser(tokenid.toString());
|
return UserGroupInformation.createRemoteUser(tokenid.toString());
|
||||||
} else {
|
} else {
|
||||||
UserGroupInformation realUgi = UserGroupInformation
|
UserGroupInformation realUgi = UserGroupInformation
|
||||||
|
@ -231,7 +231,8 @@ public class TestStringUtils extends UnitTestcaseTimeLimit {
|
|||||||
assertArrayEquals(expectedArray, StringUtils.getTrimmedStrings(pathologicalDirList2));
|
assertArrayEquals(expectedArray, StringUtils.getTrimmedStrings(pathologicalDirList2));
|
||||||
|
|
||||||
assertArrayEquals(emptyArray, StringUtils.getTrimmedStrings(emptyList1));
|
assertArrayEquals(emptyArray, StringUtils.getTrimmedStrings(emptyList1));
|
||||||
assertArrayEquals(emptyArray, StringUtils.getTrimmedStrings(emptyList2));
|
String[] estring = StringUtils.getTrimmedStrings(emptyList2);
|
||||||
|
assertArrayEquals(emptyArray, estring);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
Loading…
x
Reference in New Issue
Block a user