Diff stringlengths 10 2k | Message stringlengths 28 159 |
|---|---|
public static void main(String[] args) throws AccumuloException, AccumuloSecurityException, TableExistsException {
Connector conn = new ZooKeeperInstance(args[0], args[1]).getConnector(args[2], args[3].getBytes());
if (args.length == 5) {
// create a basic table
conn.tableOperations().create(args[4]);
} else if (args.length > 5) {
// create a table with initial partitions
TreeSet<Text> intialPartitions = new TreeSet<Text>();
for (int i = 5; i < args.length; ++i)
intialPartitions.add(new Text(args[i]));
conn.tableOperations().create(args[4]);
try {
conn.tableOperations().addSplits(args[4], intialPartitions);
} catch (TableNotFoundException e) {
// unlikely
throw new RuntimeException(e);
}
} else {
System.err.println("Usage : SetupTable <instance> <zookeepers> <username> <password> <table name> [<split point>{ <split point}]");
} | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
import org.apache.accumulo.core.security.tokens.InstanceTokenWrapper;
public static boolean getBatchFromServer(InstanceTokenWrapper credentials, Text startRow, KeyExtent extent, String server, SortedMap<Key,Value> results,
static boolean getBatchFromServer(InstanceTokenWrapper credentials, Key key, Key endKey, KeyExtent extent, String server, SortedMap<Key,Value> results,
static boolean getBatchFromServer(InstanceTokenWrapper credentials, Range range, KeyExtent extent, String server, SortedMap<Key,Value> results,
InitialScan isr = client.startScan(tinfo, scanState.credentials.toThrift(), extent.toThrift(), scanState.range.toThrift(),
InstanceTokenWrapper credentials;
public ScanState(InstanceTokenWrapper credentials, Text tableName, Authorizations authorizations, Range range, SortedSet<Column> fetchedColumns, int size,
public static List<KeyValue> scan(Instance instance, InstanceTokenWrapper credentials, ScanState scanState, int timeOut, AccumuloConfiguration conf)
InitialScan is = client.startScan(tinfo, scanState.credentials.toThrift(), loc.tablet_extent.toThrift(), scanState.range.toThrift(), | Immediately return this expression instead of assigning it to the temporary variable "ret". |
package org.apache.accumulo.server.test.randomwalk.concurrent;
import java.util.List;
import java.util.Properties;
import java.util.Random;
import org.apache.accumulo.core.client.AccumuloSecurityException;
import org.apache.accumulo.core.client.Connector;
import org.apache.accumulo.core.security.SystemPermission;
import org.apache.accumulo.core.security.TablePermission;
import org.apache.accumulo.server.test.randomwalk.State;
import org.apache.accumulo.server.test.randomwalk.Test;
public class CheckPermission extends Test{
@Override
public void visit(State state, Properties props) throws Exception {
Connector conn = state.getConnector();
Random rand = (Random) state.get("rand");
@SuppressWarnings("unchecked")
List<String> userNames = (List<String>) state.get("users");
String userName = userNames.get(rand.nextInt(userNames.size()));
@SuppressWarnings("unchecked")
List<String> tableNames = (List<String>)state.get("tables");
String tableName = tableNames.get(rand.nextInt(tableNames.size()));
try {
if (rand.nextBoolean()){
log.debug("Checking systerm permission "+userName);
conn.securityOperations().hasSystemPermission(userName, SystemPermission.values()[rand.nextInt(SystemPermission.values().length)]);
}else{
log.debug("Checking table permission "+userName+" "+tableName);
conn.securityOperations().hasTablePermission(userName, tableName, TablePermission.values()[rand.nextInt(TablePermission.values().length)]);
}
} catch (AccumuloSecurityException ex) {
log.debug("Unable to check permissions: " + ex.getCause());
}
}
} | Return empty string instead. |
Class<?> loadClass;
try {
loadClass = getClass().getClassLoader().loadClass(classname);
} catch (ClassNotFoundException e) {
throw new ShellCommandException(ErrorCode.INITIALIZATION_FAILURE, "Unable to load " + classname);
}
try {
loadClass.asSubclass(SortedKeyValueIterator.class);
} catch (ClassCastException ex) {
throw new ShellCommandException(ErrorCode.INITIALIZATION_FAILURE, "Unable to load " + classname + " as type " | Either log or rethrow this exception. |
@SuppressWarnings("all") public class InitialScan implements org.apache.thrift.TBase<InitialScan, InitialScan._Fields>, java.io.Serializable, Cloneable { | 13 duplicated blocks of code must be removed. |
MetaDataTableScanner metaDataTableScanner = new MetaDataTableScanner(environment.getInstance(), SecurityConstants.getSystemCredentials(), tableRange, null); | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.protocol.TProtocolException;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.TException;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@SuppressWarnings("all") public class AuthInfo implements org.apache.thrift.TBase<AuthInfo, AuthInfo._Fields>, java.io.Serializable, Cloneable { | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
import org.apache.accumulo.core.metadata.MetadataLocationObtainer;
import org.apache.accumulo.core.metadata.MetadataTable;
import org.apache.accumulo.core.metadata.RootTable;
import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection;
public TabletLocations lookupTablet(TabletLocation src, Text row, Text stopRow, TabletLocator parent, TCredentials credentials)
throws AccumuloSecurityException {
Pair<SortedMap<KeyExtent,Text>,List<KeyExtent>> metadata = MetadataLocationObtainer.getMetadataLocationEntries(results);
SortedMap<KeyExtent,Text> metadata = MetadataLocationObtainer.getMetadataLocationEntries(results).getFirst();
Key lk = new Key(mr, TabletsSection.CurrentLocationColumnFamily.NAME, new Text(instance));
Key pk = new Key(mr, TabletsSection.TabletColumnFamily.PREV_ROW_COLUMN.getColumnFamily(),
TabletsSection.TabletColumnFamily.PREV_ROW_COLUMN.getColumnQualifier());
| Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
import org.apache.accumulo.core.client.security.SecurityErrorCode;
if (ae.getSecurityErrorCode().equals(SecurityErrorCode.PERMISSION_DENIED)) { | Do not forget to remove this deprecated code someday. |
import org.apache.accumulo.core.security.tokens.SecurityToken;
* <li>{@link AccumuloOutputFormat#setConnectorInfo(Job, SecurityToken)} OR {@link AccumuloOutputFormat#setConnectorInfo(Job, Path)}
* @throws AccumuloSecurityException
public static void setConnectorInfo(Job job, SecurityToken token) throws AccumuloSecurityException {
* {@link TokenHelper#asBase64String(SecurityToken)}.
* the path to a file in the configured file system, containing the serialized, base-64 encoded {@link SecurityToken} with the user's authentication
* @see #setConnectorInfo(Job, SecurityToken)
* @throws AccumuloSecurityException
* @see #setConnectorInfo(Job, SecurityToken)
protected static SecurityToken getToken(JobContext context) throws AccumuloSecurityException {
* @deprecated since 1.5.0; Use {@link #setConnectorInfo(Job, SecurityToken)}, {@link #setConnectorInfo(Job, Path)}, {@link #setCreateTables(Job, boolean)},
try {
OutputConfigurator.setConnectorInfo(CLASS, conf, new UserPassToken(user, passwd));
} catch (AccumuloSecurityException e) {
throw new RuntimeException(e);
}
try {
return OutputConfigurator.getToken(CLASS, conf).getPrincipal();
} catch (AccumuloSecurityException e) {
throw new RuntimeException(e);
}
SecurityToken token;
try {
token = OutputConfigurator.getToken(CLASS, conf);
} catch (AccumuloSecurityException e) {
throw new RuntimeException(e);
} | Either log or rethrow this exception. |
import org.apache.accumulo.core.security.tokens.PasswordToken; | Replace all tab characters in this file by sequences of white-spaces. |
package org.apache.accumulo.server.test.randomwalk.bulk;
import java.util.Arrays;
import java.util.Random;
import org.apache.accumulo.server.test.randomwalk.State;
import org.apache.hadoop.io.Text;
public class Merge extends BulkTest {
@Override
protected void runLater(State state) throws Exception {
Text[] points = getRandomTabletRange(state);
log.info("merging " + rangeToString(points));
state.getConnector().tableOperations().merge(Setup.getTableName(), points[0], points[1]);
log.info("merging " + rangeToString(points) + " complete");
}
public static String rangeToString(Text[] points) {
return "(" + (points[0] == null ? "-inf" : points[0]) +
" -> " + (points[1] == null ? "+inf" : points[1]) + "]";
}
public static Text getRandomRow(Random rand) {
return new Text(String.format(BulkPlusOne.FMT, Math.abs(rand.nextLong()) % BulkPlusOne.LOTS));
}
public static Text[] getRandomTabletRange(State state) {
Random rand = (Random)state.get("rand");
Text points[] = {
getRandomRow(rand),
getRandomRow(rand),
};
Arrays.sort(points);
if (rand.nextInt(10) == 0) {
points[0] = null;
}
if (rand.nextInt(10) == 0) {
points[1] = null;
}
if (rand.nextInt(20) == 0) {
points[0] = null;
points[1] = null;
}
return points;
}
} | Return empty string instead. |
if (shellState.getConnector().tableOperations().exists(tableName))
throw new TableExistsException(null, tableName, null);
if (colToks.count() < 1 || colToks.count() > 2)
throw new BadArgumentException("column must be in the format cf[:cq]", fullCommand, fullCommand.indexOf(col));
if (colToks.count() == 2)
cq = new Text(tokIter.next());
if (!line.isEmpty())
partitions.add(decode ? new Text(Base64.decodeBase64(line.getBytes())) : new Text(line));
if (!shellState.getConnector().tableOperations().exists(oldTable))
throw new TableNotFoundException(null, oldTable, null);
if (!shellState.getConnector().tableOperations().exists(oldTable))
throw new TableNotFoundException(null, oldTable, null);
if (cl.hasOption(createTableOptTimeLogical.getOpt()))
timeType = TimeType.LOGICAL;
if (num > max)
max = num;
if (entry.getValue().equals(VisibilityConstraint.class.getName()))
vcSet = true;
if (!vcSet)
shellState.getConnector().tableOperations()
.setProperty(tableName, Property.TABLE_CONSTRAINT_PREFIX.getKey() + (max + 1), VisibilityConstraint.class.getName()); | Remove this call to "exit" or ensure it is really required. |
import org.apache.accumulo.cloudtrace.instrument.Span;
import org.apache.accumulo.cloudtrace.instrument.Trace; | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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 org.apache.accumulo.core.security.thrift.tokens;
import javax.security.auth.Destroyable;
import org.apache.hadoop.io.Writable;
public interface SecurityToken extends Writable, Destroyable, Cloneable {
public SecurityToken clone();
} | Make the "log" logger private static final and rename it to comply with the format "LOG(?:GER)?". |
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*/
public static final byte[] nullbyte = new byte[] {0};
public static Text buildNullSepText(String... s) {
Text t = new Text(s[0]);
for (int i = 1; i < s.length; i++) {
t.append(nullbyte, 0, 1);
t.append(s[i].getBytes(), 0, s[i].length());
}
return t;
}
public static String[] splitNullSepText(Text t) {
ArrayList<String> s = new ArrayList<String>();
byte[] b = t.getBytes();
int lastindex = 0;
for (int i = 0; i < t.getLength(); i++) {
if (b[i] == (byte) 0) {
s.add(new String(b, lastindex, i - lastindex));
lastindex = i + 1;
}
}
s.add(new String(b, lastindex, t.getLength() - lastindex));
return s.toArray(new String[s.size()]);
} | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
package org.apache.accumulo.core.trace;
import org.apache.accumulo.core.client.Instance;
public class InstanceUserPassword {
public Instance instance;
public String username;
public byte[] password;
public InstanceUserPassword(Instance instance, String username, String password) {
this.instance = instance;
this.username = username;
this.password = password.getBytes();
}
} | Return empty string instead. |
import org.apache.accumulo.core.security.CredentialHelper;
import org.apache.accumulo.core.security.thrift.Credential;
import org.apache.accumulo.core.security.thrift.tokens.PasswordToken;
import org.junit.Assert;
Credential auth = CredentialHelper.create("root", new PasswordToken().setPassword(new byte[0]), "instance");
Credential credential = CredentialHelper.create("root", new PasswordToken().setPassword(new byte[0]), "instance");
Scanner scanner = instance.getConnector(credential.getPrincipal(), CredentialHelper.extractToken(credential)).createScanner(Constants.METADATA_TABLE_NAME, Constants.NO_AUTHS);
Connector conn = instance.getConnector(credential.getPrincipal(), CredentialHelper.extractToken(credential)); | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
@Override
public Key getTopKey() {
throw new NullPointerException();
}
@Override
public SortedKeyValueIterator<Key,Value> deepCopy(IteratorEnvironment env) {
throw new UnsupportedOperationException();
} | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
dataIn.readFully(initVector);
dataIn.readFully(encryptedSecretKey); | Immediately return this expression instead of assigning it to the temporary variable "fullPath". |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*/ | Replace all tab characters in this file by sequences of white-spaces. |
if (seekNeeded)
if (initialSeek)
iter.seek(range, columnFamilies, inclusive);
else
iter.seek(new Range(key, false, range.getEndKey(), range.isEndKeyInclusive()), columnFamilies, inclusive);
if (iflag != null)
((InterruptibleIterator) iter).setInterruptFlag(iflag);
if (iflag != null)
((InterruptibleIterator) iter).setInterruptFlag(iflag);
if (onlySwitchAfterRow)
throw new IllegalStateException("Can only switch on row boundries");
if (copies.size() != 1)
throw new IllegalStateException("setInterruptFlag() called after deep copies made " + copies.size());
if (iter != null)
((InterruptibleIterator) iter).setInterruptFlag(flag); | Remove this call to "exit" or ensure it is really required. |
if (offset == 0 && length == data.length)
return data; | Remove this call to "exit" or ensure it is really required. |
* Add an iterator to a table on all scopes.
* Add an iterator to a table on the given scopes.
*
* @param tableName
* the name of the table
* @param setting
* object specifying the properties of the iterator
* @throws AccumuloSecurityException
* thrown if the user does not have the ability to set properties on the table
* @throws AccumuloException
* @throws TableNotFoundException
* throw if the table no longer exists
* @throws IllegalArgumentException
* if the setting conflicts with any existing iterators
*/
public void attachIterator(String tableName, IteratorSetting setting, EnumSet<IteratorScope> scopes) throws AccumuloSecurityException, AccumuloException,
TableNotFoundException;
/**
public void checkIteratorConflicts(String tableName, IteratorSetting setting, EnumSet<IteratorScope> scopes) throws AccumuloException, TableNotFoundException; | This block of commented-out lines of code should be removed. |
import org.apache.accumulo.core.security.CredentialHelper;
import org.apache.accumulo.core.security.thrift.Credential;
private Credential credentials;
public TableOperationsImpl(Instance instance, Credential credentials) {
Scanner scanner = instance.getConnector(credentials.getPrincipal(), CredentialHelper.extractToken(credentials)).createScanner(tableName, auths); | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
MasterMonitorInfo stats = client.getMasterStats(Tracer.traceInfo(), SecurityConstants.getThriftSystemCredentials()); | Immediately return this expression instead of assigning it to the temporary variable "ret". |
if (server == null)
return null;
TServerInfo serverInfo = current.get(server.hostPort());
// lock was lost?
if (serverInfo == null)
return null;
// instance changed?
if (!serverInfo.instance.equals(server))
return null;
TServerConnection result = serverInfo.connection; | Immediately return this expression instead of assigning it to the temporary variable "result". |
import org.apache.accumulo.core.security.thrift.ThriftSecurityException; | 1 duplicated blocks of code must be removed. |
package org.apache.accumulo.core.client;
/**
* A generic Accumulo Exception for general accumulo failures.
*
*/
public class AccumuloException extends Exception {
private static final long serialVersionUID = 1L;
/**
* @param why is the reason for the error being thrown
*/
public AccumuloException(String why)
{ super(why); }
/**
* @param cause is the exception that this exception wraps
*/
public AccumuloException(Throwable cause)
{ super(cause); }
/**
* @param why is the reason for the error being thrown
* @param cause is the exception that this exception wraps
*/
public AccumuloException(String why, Throwable cause)
{ super(why, cause); }
} | Return empty string instead. |
import org.apache.accumulo.core.security.thrift.tokens.PasswordToken;
conn.securityOperations().createUser("user1", new PasswordToken().setPassword("pass1".getBytes())); | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
import org.apache.accumulo.core.client.impl.thrift.SecurityErrorCode; | 1 duplicated blocks of code must be removed. |
.println("bin/accumulo accumulo.examples.helloworld.ReadData <instance name> <zoo keepers> <username> <password> <tablename> [startkey [endkey]]");
String user = args[2];
byte[] pass = args[3].getBytes();
String tableName = args[4]; | Move this variable to comply with Java Code Conventions. |
public static void main(String[] args) throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
if (args.length != 3) {
System.out.println("Usage : PrintTable <table> <user> <password>");
return;
Connector connector = HdfsZooInstance.getInstance().getConnector(args[1], args[2].getBytes());
Authorizations auths = connector.securityOperations().getUserAuthorizations(args[1]);
Scanner scanner = connector.createScanner(args[0], auths);
for (Entry<Key,Value> entry : scanner)
System.out.println(DefaultFormatter.formatEntry(entry, true));
} | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
@SuppressWarnings("all") public class TooManyFilesException extends Exception implements org.apache.thrift.TBase<TooManyFilesException, TooManyFilesException._Fields>, java.io.Serializable, Cloneable { | 13 duplicated blocks of code must be removed. |
import java.util.concurrent.atomic.AtomicLong;
import org.apache.accumulo.core.iterators.IteratorEnvironment;
import org.apache.accumulo.core.iterators.WrappingIterator;
public class CountingIterator extends WrappingIterator {
private long count;
public CountingIterator deepCopy(IteratorEnvironment env) {
return new CountingIterator(this, env);
}
private CountingIterator(CountingIterator other, IteratorEnvironment env) {
setSource(other.getSource().deepCopy(env));
count = 0;
}
public CountingIterator(SortedKeyValueIterator<Key,Value> source) {
this.setSource(source);
count = 0;
}
@Override
public void init(SortedKeyValueIterator<Key,Value> source, Map<String,String> options, IteratorEnvironment env) {
throw new UnsupportedOperationException();
}
@Override
public void next() throws IOException {
super.next();
count++;
if (count % 1024 == 0) {
entriesRead.addAndGet(1024);
}
}
public long getCount() {
return count;
}
}
private AtomicLong entriesRead = new AtomicLong(0);
private AtomicLong entriesWritten = new AtomicLong(0);
private void clearStats() {
entriesRead.set(0);
entriesWritten.set(0);
}
this.localityGroup = compactor.currentLocalityGroup;
this.entriesRead = compactor.entriesRead.get();
this.entriesWritten = compactor.entriesWritten.get();
// Periodically update stats, do not want to do this too often since its volatile
entriesWritten.addAndGet(1024); | Move this constructor to comply with Java Code Conventions. |
/**
* @deprecated Use {@link #createUser(String,byte[])} instead
*/
@Override
public void createUser(String user, byte[] password) throws AccumuloException, AccumuloSecurityException {
createUser(user, password, new Authorizations());
} | Remove this unused private "appendProp" method. |
import org.apache.accumulo.core.client.BatchWriterConfig;
BatchWriter bw = conn.createBatchWriter(Constants.METADATA_TABLE_NAME, new BatchWriterConfig()); | Remove this unused method parameter "e". |
import org.apache.accumulo.core.util.AddressUtil;
List<String> masters = Monitor.getInstance().getMasterLocations();
return "Master Server" + (masters.size() == 0 ? "" : ":" + AddressUtil.parseAddress(masters.get(0), 0).getHostName());
List<String> masters = Monitor.getInstance().getMasterLocations();
masterStatus.addSortableColumn("Master");
row.add(masters.size() == 0 ? "<div class='error'>Down</div>" : AddressUtil.parseAddress(masters.get(0), 0).getHostName()); | Use isEmpty() to check whether the collection is empty or not. |
if (hd == null)
return 0;
if (o1.count < o2.count)
return -1;
if (o1.count > o2.count)
return 1; | Remove this call to "exit" or ensure it is really required. |
recentlyUnloadedCache.remove(tablet); | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
AccumuloRowInputFormat.setInputInfo(job.getConfiguration(), "root", "".getBytes(), "test", new Authorizations());
AccumuloRowInputFormat.setMockInstance(job.getConfiguration(), "instance1"); | Remove this unused private "debugQuery" method. |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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 org.apache.accumulo.start.classloader.vfs.providers;
import org.apache.commons.vfs2.FileContent;
import org.apache.commons.vfs2.FileContentInfo;
import org.apache.commons.vfs2.FileContentInfoFactory;
import org.apache.commons.vfs2.FileSystemException;
import org.apache.commons.vfs2.impl.DefaultFileContentInfo;
/**
* Creates FileContentInfo instances for HDFS.
*
* @since 2.1
*/
public class HdfsFileContentInfoFactory implements FileContentInfoFactory
{
private static final String CONTENT = "text/plain";
private static final String ENCODING = "UTF-8";
/**
* Creates a FileContentInfo for a the given FileContent.
*
* @param fileContent
* Use this FileContent to create a matching FileContentInfo
* @return a FileContentInfo for the given FileContent with content set to "text/plain" and encoding set to "UTF-8"
* @throws FileSystemException
* when a problem occurs creating the FileContentInfo.
*/
@Override
public FileContentInfo create(final FileContent fileContent) throws FileSystemException
{
return new DefaultFileContentInfo(CONTENT, ENCODING);
}
} | Remove this unused private "appendProp" method. |
if (value == null || value.isEmpty()) {
if (entry.getValue() == null || entry.getValue().isEmpty()) { | Immediately return this expression instead of assigning it to the temporary variable "connector". |
import org.apache.accumulo.core.security.Authorizations;
Scanner scanner = conn.createScanner(Constants.METADATA_TABLE_NAME, Authorizations.EMPTY);
Scanner scanner = conn.createScanner(Constants.METADATA_TABLE_NAME, Authorizations.EMPTY);
Scanner scanner = conn.createScanner(Constants.METADATA_TABLE_NAME, Authorizations.EMPTY);
Scanner scanner = conn.createScanner(Constants.METADATA_TABLE_NAME, Authorizations.EMPTY);
Scanner scanner = conn.createScanner(Constants.METADATA_TABLE_NAME, Authorizations.EMPTY); | Remove this unused method parameter "range". |
MockConnector(String username, MockInstance instance) {
MockConnector(String username, MockAccumulo acu, MockInstance instance) { | Extract the assignment out of this expression. |
Authorizations a = new Authorizations("a", "abcdefg", "hijklmno", ",");
System.out.println(b); | Move this constructor to comply with Java Code Conventions. |
org.apache.accumulo.core.data.thrift.TColumn _elem10; // optional
org.apache.accumulo.core.data.thrift.IterInfo _elem13; // optional
ByteBuffer _elem24; // optional
org.apache.accumulo.core.data.thrift.TColumn _elem37; // optional
org.apache.accumulo.core.data.thrift.IterInfo _elem40; // optional
ByteBuffer _elem51; // optional | 277 duplicated blocks of code must be removed. |
*
*
*
*
*
*
*
*
*
| Replace all tab characters in this file by sequences of white-spaces. |
*
*
*
*
* | Replace all tab characters in this file by sequences of white-spaces. |
if (table.matches(cl.getOptionValue(optTablePattern.getOpt())))
tablesToFlush.add(table); | Remove this call to "exit" or ensure it is really required. |
public BlockIndexEntry(int pos, int entriesLeft, Key prevKey) {
this.prevKey = key;
return prevKey.compareTo(o.prevKey);
return prevKey + " " + entriesLeft + " " + pos;
while (index > 0) {
if (blockIndex[index].getPrevKey().equals(startKey))
index--;
else
break;
}
if (blockIndex[index].getPrevKey().equals(blockIndex[index - 1].getPrevKey()))
if (index == 0 && blockIndex[index].getPrevKey().equals(startKey))
index.add(new BlockIndexEntry(pos, indexEntry.getNumEntries() - count, myPrevKey));
BlockIndexEntry[] getIndexEntries() {
return blockIndex;
} | 4 duplicated blocks of code must be removed. |
if (f.matches("^accumulo-core-.+jar$") || f.matches("^accumulo-server-.+jar$") || f.matches("^accumulo-fate-.+jar$") || f.matches("^cloudtrace-.+jar$")
|| f.matches("^libthrift-.+jar$")) { | Remove this call to "exit" or ensure it is really required. |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*/
/**
* Autogenerated by Thrift Compiler (0.9.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package org.apache.accumulo.proxy.thrift;
import java.util.Map;
import java.util.HashMap;
import org.apache.thrift.TEnum;
@SuppressWarnings("all") public enum TablePermission implements org.apache.thrift.TEnum {
READ(2),
WRITE(3),
BULK_IMPORT(4),
ALTER_TABLE(5),
GRANT(6),
DROP_TABLE(7);
private final int value;
private TablePermission(int value) {
this.value = value;
}
/**
* Get the integer value of this enum value, as defined in the Thrift IDL.
*/
public int getValue() {
return value;
}
/**
* Find a the enum type by its integer value, as defined in the Thrift IDL.
* @return null if the value is not found.
*/
public static TablePermission findByValue(int value) {
switch (value) {
case 2:
return READ;
case 3:
return WRITE;
case 4:
return BULK_IMPORT;
case 5:
return ALTER_TABLE;
case 6:
return GRANT;
case 7:
return DROP_TABLE;
default:
return null;
}
}
} | Return empty string instead. |
if (!shellState.getConnector().tableOperations().exists(tableName))
throw new TableNotFoundException(null, tableName, null); | Remove this call to "exit" or ensure it is really required. |
public class ReqVisFilter extends Filter {
io.setName("reqvis");
io.setDescription("ReqVisFilter hides entries without a visibility label"); | Either log or rethrow this exception. |
@Override
public void visit(State state, Properties props) throws Exception {
String indexTableName = (String) state.get("indexTableName");
String tmpIndexTableName = indexTableName + "_tmp";
String docTableName = (String) state.get("docTableName");
int numPartitions = (Integer) state.get("numPartitions");
Random rand = (Random) state.get("rand");
ShardFixture.createIndexTable(this.log, state, "_tmp", rand);
Scanner scanner = state.getConnector().createScanner(docTableName, Constants.NO_AUTHS);
BatchWriter tbw = state.getConnector().createBatchWriter(tmpIndexTableName, 100000000, 60000l, 4);
int count = 0;
for (Entry<Key,Value> entry : scanner) {
String docID = entry.getKey().getRow().toString();
String doc = entry.getValue().toString();
Insert.indexDocument(tbw, doc, docID, numPartitions);
count++;
tbw.close();
log.debug("Reindexed " + count + " documents into " + tmpIndexTableName);
}
| Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
public List<String> getChildren(String path) throws DistributedStoreException;
public byte[] get(String path) throws DistributedStoreException;
public void put(String path, byte[] bs) throws DistributedStoreException;
public void remove(String path) throws DistributedStoreException;
| Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
import org.apache.hadoop.ipc.RemoteException;
Path path = new Path(ServerConfiguration.getSystemConfiguration().get(Property.INSTANCE_DFS_DIR));
log.debug("Reading the content summary for " + path);
ContentSummary acu = fs.getContentSummary(path);
consumed = String.format("%.2f%%", acu.getSpaceConsumed() * 100. / fs.getUsed());
boolean highlight = false;
tableRow(sb, (highlight = !highlight), "Disk Used", diskUsed);
tableRow(sb, (highlight = !highlight), "% of Used DFS", consumed);
tableRow(sb, (highlight = !highlight), "<a href='/tables'>Tables</a>", NumberType.commas(Monitor.getTotalTables()));
tableRow(sb, (highlight = !highlight), "<a href='/tservers'>Tablet Servers</a>", NumberType.commas(info.tServerInfo.size()));
tableRow(sb, (highlight = !highlight), "<a href='/tservers'>Dead Tablet Servers</a>", NumberType.commas(info.deadTabletServers.size()));
tableRow(sb, (highlight = !highlight), "Tablets", NumberType.commas(Monitor.getTotalTabletCount()));
tableRow(sb, (highlight = !highlight), "Entries", NumberType.commas(Monitor.getTotalEntries()));
tableRow(sb, (highlight = !highlight), "Lookups", NumberType.commas(Monitor.getTotalLookups()));
tableRow(sb, (highlight = !highlight), "Uptime", Duration.format(System.currentTimeMillis() - Monitor.getStartTime()));
} catch (RemoteException ex) {
sb.append("<tr><td colspan='2'>Permission Denied</td></tr>\n");
sb.append("<tr><td colspan='2'><span class='error'>Down</span></td></tr>\n"); | Either log or rethrow this exception. |
import java.util.HashMap;
import org.apache.accumulo.core.cli.BatchWriterOpts;
import org.apache.accumulo.core.client.Connector;
import org.apache.accumulo.minicluster.MiniAccumuloConfig;
import org.junit.Test;
* A functional test that exercises hitting the max open file limit on a tablet server. This test assumes there are one or two tablet servers.
public class MaxOpenIT extends MacTest {
public void configure(MiniAccumuloConfig cfg) {
Map<String, String> conf = new HashMap<String, String>();
conf.put(Property.TSERV_SCAN_MAX_OPENFILES.getKey(), "4");
conf.put(Property.TSERV_MAJC_MAXCONCURRENT.getKey(), "1");
conf.put(Property.TSERV_MAJC_THREAD_MAXOPEN.getKey(), "2");
cfg.setSiteConfig(conf);
private static final int NUM_TABLETS = 16;
private static final int NUM_TO_INGEST = 10000;
@Test
Connector c = getConnector();
c.tableOperations().create("test_ingest");
c.tableOperations().setProperty("test_ingest", Property.TABLE_MAJC_RATIO.getKey(), "10");
c.tableOperations().addSplits("test_ingest", TestIngest.getSplitPoints(0, NUM_TO_INGEST, NUM_TABLETS));
TestIngest.Opts opts = new TestIngest.Opts();
opts.timestamp = i;
opts.dataSize = 50;
opts.rows = NUM_TO_INGEST;
opts.cols = 1;
opts.random = i;
TestIngest.ingest(c, opts, new BatchWriterOpts());
c.tableOperations().flush("test_ingest", null, null, true);
FunctionalTestUtils.checkRFiles(c, "test_ingest", NUM_TABLETS, NUM_TABLETS, i + 1, i + 1);
long time1 = batchScan(c, ranges, 1);
time1 = batchScan(c, ranges, 1);
long time2 = batchScan(c, ranges, NUM_TABLETS);
private long batchScan(Connector c, List<Range> ranges, int threads) throws Exception {
BatchScanner bs = c.createBatchScanner("test_ingest", TestIngest.AUTHS, threads); | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
public CacheEntry cacheBlock(String blockName, byte buf[], boolean inMemory);
public CacheEntry cacheBlock(String blockName, byte buf[]);
public CacheEntry getBlock(String blockName);
/**
* @return
*/
public long getMaxSize(); | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
import org.apache.accumulo.core.security.Authorizations;
MetadataTable.getEntries(conn.getInstance(), CredentialHelper.create(opts.principal, opts.getToken(), opts.instance), tableName, false, locations, tablets);
private static void checkTabletServer(AccumuloConfiguration conf, TCredentials st, Entry<String,List<KeyExtent>> entry, HashSet<KeyExtent> failures)
throws ThriftSecurityException, TException, NoSuchScanIDException {
InitialMultiScan is = client.startMultiScan(tinfo, st, batch, emptyListColumn, emptyListIterInfo, emptyMapSMapSS,
Authorizations.EMPTY.getAuthorizationsBB(), false); | Remove this unused method parameter "range". |
package org.apache.accumulo.examples.wikisearch.iterator; | Rename "table" which hides the field declared at line 107. |
rei.validateOptions(is.getOptions());
rei.init(new SortedMapIterator(tm), is.getOptions(), new DefaultIteratorEnvironment());
rei.validateOptions(is.getOptions());
rei.init(new SortedMapIterator(tm), is.getOptions(), new DefaultIteratorEnvironment());
rei.validateOptions(is.getOptions());
rei.init(new SortedMapIterator(tm), is.getOptions(), new DefaultIteratorEnvironment());
rei.validateOptions(is.getOptions());
rei.init(new SortedMapIterator(tm), is.getOptions(), new DefaultIteratorEnvironment());
rei.init(new SortedMapIterator(tm), is.getOptions(), new DefaultIteratorEnvironment());
rei.init(new SortedMapIterator(tm), is.getOptions(), new DefaultIteratorEnvironment());
rei.init(new SortedMapIterator(tm), is.getOptions(), new DefaultIteratorEnvironment());
rei.init(new SortedMapIterator(tm), is.getOptions(), new DefaultIteratorEnvironment());
rei.init(new SortedMapIterator(tm), is.getOptions(), new DefaultIteratorEnvironment());
rei.init(new SortedMapIterator(tm), is.getOptions(), new DefaultIteratorEnvironment());
rei.init(new SortedMapIterator(tm), is.getOptions(), new DefaultIteratorEnvironment());
rei.init(new SortedMapIterator(tm), is.getOptions(), new DefaultIteratorEnvironment());
rei.init(new SortedMapIterator(tm), is.getOptions(), new DefaultIteratorEnvironment()); | Refactor this code to not nest more than 3 if/for/while/switch/try statements. |
typeCheckValidFormat(PropertyType.ABSOLUTEPATH, "/foo", "/foo/c", "/");
// in hadoop 2.0 Path only normalizes Windows paths properly when run on a Windows system
// this makes the following checks fail
// typeCheckValidFormat(PropertyType.ABSOLUTEPATH, "d:\\foo12", "c:\\foo\\g", "c:\\foo\\c", "c:\\"); | This block of commented-out lines of code should be removed. |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*/ | Replace all tab characters in this file by sequences of white-spaces. |
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*/
/**
* Creates normalized content for ingest based upon implemented logic.
*
* @param field
* The field being normalized
* @param value
* The value to normalize
* @return a normalized value
*/
public String normalizeFieldValue(String field, Object value);
| Immediately return this expression instead of assigning it to the temporary variable "r". |
if (stat > max)
max = stat;
if (stat < min)
min = stat; | Remove this call to "exit" or ensure it is really required. |
* Queues one mutation to write.
* Queues several mutations to write. | Complete the task associated to this TODO comment. |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*/ | Replace all tab characters in this file by sequences of white-spaces. |
return client.getConfiguration(Tracer.traceInfo(), credentials, ConfigurationType.CURRENT);
return client.getConfiguration(Tracer.traceInfo(), credentials, ConfigurationType.SITE);
return client.checkClass(Tracer.traceInfo(), credentials, className, asTypeName); | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
import org.apache.accumulo.cloudtrace.instrument.Tracer;
import org.apache.accumulo.core.tabletserver.thrift.TabletClientService.Iface;
import org.apache.accumulo.core.tabletserver.thrift.TabletClientService.Processor;
Processor<Iface> processor = new Processor<Iface>(tch);
tch.halt(Tracer.traceInfo(), null, null); | Immediately return this expression instead of assigning it to the temporary variable "client". |
package org.apache.accumulo.core.iterators.user;
import java.util.Iterator;
import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.iterators.LongCombiner;
public class MaxCombiner extends LongCombiner {
@Override
public Long typedReduce(Key key, Iterator<Long> iter) {
long max = Long.MIN_VALUE;
while (iter.hasNext()) {
Long l = iter.next();
if (l > max) max = l;
}
return max;
}
} | Return empty string instead. |
* @return true if options are valid, false otherwise (IllegalArgumentException preferred)
* @exception IllegalArgumentException
* if there are problems with the options | Return empty string instead. |
import org.apache.accumulo.core.util.shell.Shell.TableOperation;
public class DeleteTableCommand extends TableOperation {
private Option forceOpt;
public int execute(String fullCommand, CommandLine cl, Shell shellState) throws Exception {
if (cl.hasOption(forceOpt.getOpt()))
super.force();
else
super.noForce();
return super.execute(fullCommand, cl, shellState);
protected void doTableOp(Shell shellState, String tableName) throws Exception {
shellState.getConnector().tableOperations().delete(tableName);
shellState.getReader().printString("Table: [" + tableName + "] has been deleted. \n");
if (shellState.getTableName().equals(tableName))
shellState.setTableName("");
forceOpt = new Option("f", "force", false, "force deletion without prompting");
Options opts = super.getOptions();
opts.addOption(forceOpt);
return opts; | Reduce this switch case number of lines from 8 to at most 5, for example by extracting code into methods. |
Scanner scanner = conn.createScanner(Constants.METADATA_TABLE_NAME, Authorizations.EMPTY); | Remove this unused method parameter "range". |
package org.apache.accumulo.core.metadata;
/**
* DFS location relative to the Accumulo directory
*/
/**
* ZK path relative to the instance directory for information about the root tablet
*/ | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
props.put("instance", accumulo.getInstanceName());
props.put("zookeepers", accumulo.getZooKeepers());
| Either log or rethrow this exception. |
if (order <= entry)
result.put(order, data);
if (writeLock.tryLock(100, TimeUnit.MILLISECONDS))
throw new RuntimeException("Write lock achieved during read lock!");
if (readLock.tryLock(100, TimeUnit.MILLISECONDS))
throw new RuntimeException("Read lock achieved during write lock!"); | Remove this call to "exit" or ensure it is really required. |
package org.apache.accumulo.fate; | Remove this call to "exit" or ensure it is really required. |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*/
@SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum { | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
import org.apache.accumulo.core.client.Connector;
import org.apache.accumulo.minicluster.MiniAccumuloConfig;
import org.junit.Test;
public class DeleteEverythingIT extends MacTest {
public void configure(MiniAccumuloConfig cfg) {
cfg.setSiteConfig(Collections.singletonMap(Property.TSERV_MAJC_DELAY.getKey(), "1s"));
@Test(timeout=20*1000)
Connector c = getConnector();
c.tableOperations().create("de");
FunctionalTestUtils.checkRFiles(c, "de", 1, 1, 1, 1);
FunctionalTestUtils.checkRFiles(c, "de", 1, 1, 0, 0); | Either log or rethrow this exception. |
import org.apache.accumulo.core.cli.BatchWriterOpts;
import org.apache.accumulo.core.cli.ScannerOpts;
BatchWriterOpts bwOpts = new BatchWriterOpts();
ScannerOpts scanOpts = new ScannerOpts();
opts.parseArgs(TestBinaryRows.class.getName(), args, scanOpts, bwOpts);
BatchWriter bw = connector.createBatchWriter(opts.tableName, bwOpts.getBatchWriterConfig());
s.setBatchSize(scanOpts.scanBatchSize);
s.setBatchSize(scanOpts.scanBatchSize);
s.setBatchSize(scanOpts.scanBatchSize); | Remove this unused method parameter "opts". |
public abstract class InputFormatBase<K,V> extends AbstractInputFormat<K,V> {
* Initializes an Accumulo {@link org.apache.accumulo.core.client.impl.TabletLocator} based on the configuration.
* @throws org.apache.accumulo.core.client.TableNotFoundException
protected static TabletLocator getTabletLocator(JobContext context) throws TableNotFoundException {
return InputConfigurator.getTabletLocator(CLASS, getConfiguration(context), InputConfigurator.getInputTableName(CLASS, getConfiguration(context))); | Either log or rethrow this exception. |
if (loc.tablet_extent.getEndRow() != null)
trie.add(loc.tablet_extent.getEndRow(), loc);
if (tl != null)
notNull++;
if (loc.tablet_extent.getEndRow() != null)
mc.put(loc.tablet_extent.getEndRow(), loc);
if (args[4].equals("binary"))
generator = new BinaryGenerator();
else if (args[4].equals("hex"))
generator = new HexGenerator();
else
throw new IllegalArgumentException(args[4]);
if (args[5].equals("trie"))
tli = new TrieLocator(trieDepth, new SimpleLocationObtainer(numTablets, rowLen, generator));
else if (args[5].equals("tree"))
tli = new TreeLocator(new SimpleLocationObtainer(numTablets, rowLen, generator));
} else
throw new IllegalArgumentException(args[5]); | Remove this call to "exit" or ensure it is really required. |
FileSKVWriter writer1 = FileOperations.getInstance().openWriter(dir + "/f1." + RFile.EXTENSION, fs, conf,
ServerConfiguration.getSystemConfiguration());
FileSKVWriter writer2 = FileOperations.getInstance().openWriter(dir + "/f2." + RFile.EXTENSION, fs, conf,
ServerConfiguration.getSystemConfiguration());
checkRFiles("bulkFile", 6, 6, 1, 1); | Either log or rethrow this exception. |
public static final String idle = "idle";
public static final String execute = "execute";
public long getIdleCount();
public long getIdleMinTime();
public long getIdleMaxTime();
public long getIdleAvgTime();
public long getExecutionCount();
public long getExecutionMinTime();
public long getExecutionMaxTime();
public long getExecutionAvgTime();
public void reset();
| Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
private RFile.Reader source;
MultiIndexIterator(RFile.Reader source, List<Iterator<IndexEntry>> indexes) {
super(indexes.size());
this.source = source;
for (Iterator<IndexEntry> index : indexes) {
addSource(new IndexIterator(index));
}
@Override
public SortedKeyValueIterator<Key,Value> deepCopy(IteratorEnvironment env) {
throw new UnsupportedOperationException();
}
@Override
public void init(SortedKeyValueIterator<Key,Value> source, Map<String,String> options, IteratorEnvironment env) throws IOException {
throw new UnsupportedOperationException();
}
@Override
public void seek(Range range, Collection<ByteSequence> columnFamilies, boolean inclusive) throws IOException {
throw new UnsupportedOperationException();
}
@Override
public void close() throws IOException {
source.close();
}
@Override
public void closeDeepCopies() throws IOException {
throw new UnsupportedOperationException();
}
@Override
public Key getFirstKey() throws IOException {
throw new UnsupportedOperationException();
}
@Override
public Key getLastKey() throws IOException {
throw new UnsupportedOperationException();
}
@Override
public DataInputStream getMetaStore(String name) throws IOException {
throw new UnsupportedOperationException();
}
@Override
public void setInterruptFlag(AtomicBoolean flag) {
throw new UnsupportedOperationException();
}
| Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
import java.io.FileNotFoundException;
import org.apache.accumulo.core.metadata.schema.MetadataSchema;
s.fetchColumnFamily(MetadataSchema.TabletsSection.DataFileColumnFamily.NAME);
try {
assertEquals(0, fs.listStatus(new Path(rootPath() + "/accumulo/tables/" + id)).length);
} catch (FileNotFoundException ex) {
// that's fine, too
} | Either log or rethrow this exception. |
import org.apache.accumulo.trace.instrument.Tracer; | Remove the redundant '!unknownSymbol!' thrown exception declaration(s). |
Scanner scanner = conn.createScanner(opts.getTableName(), auths); | Reorder the modifiers to comply with the Java Language Specification. |
import java.nio.charset.Charset;
private static final Charset utf8 = Charset.forName("UTF8");
return newTableName.getBytes(utf8); | Move this variable to comply with Java Code Conventions. |
import org.apache.accumulo.cloudtrace.instrument.Tracer;
import org.apache.accumulo.core.tabletserver.thrift.TabletClientService.Client;
MasterClient.execute(instance, new ClientExec<MasterClientService.Client>() {
public void execute(MasterClientService.Client client) throws Exception {
client.setSystemProperty(Tracer.traceInfo(), credentials, property, value);
MasterClient.execute(instance, new ClientExec<MasterClientService.Client>() {
public void execute(MasterClientService.Client client) throws Exception {
client.removeSystemProperty(Tracer.traceInfo(), credentials, property);
return ServerClient.execute(instance, new ClientExecReturn<Map<String,String>,ClientService.Client>() {
public Map<String,String> execute(ClientService.Client client) throws Exception {
return ServerClient.execute(instance, new ClientExecReturn<Map<String,String>,ClientService.Client>() {
public Map<String,String> execute(ClientService.Client client) throws Exception {
new ClientExecReturn<List<org.apache.accumulo.core.tabletserver.thrift.ActiveScan>,TabletClientService.Client>() {
public List<org.apache.accumulo.core.tabletserver.thrift.ActiveScan> execute(TabletClientService.Client client) throws Exception {
return client.getActiveScans(Tracer.traceInfo(), credentials);
return ServerClient.execute(instance, new ClientExecReturn<Boolean,ClientService.Client>() {
public Boolean execute(ClientService.Client client) throws Exception {
return client.checkClass(Tracer.traceInfo(), className, asTypeName); | Immediately return this expression instead of assigning it to the temporary variable "client". |
@Test(timeout=60*1000) | Either log or rethrow this exception. |
return new Value(Long.toString(sum).getBytes()); | Remove this unused method parameter "ex". |
import org.apache.accumulo.core.util.NamingThreadFactory;
import org.apache.accumulo.start.classloader.vfs.AccumuloVFSClassLoader;
Class<? extends MemoryManager> clazz = AccumuloVFSClassLoader.loadClass(acuConf.get(Property.TSERV_MEM_MGMT), MemoryManager.class);
private final Map<KeyExtent,TabletStateImpl> tabletReports;
private final Object commitHold = new Object(); | Remove this unused private "appendProp" method. |
import org.apache.hadoop.mapreduce.Job;
public static void setSplitFile(Job job, String file) {
public static void setNumSubBins(Job job, int num) { | Remove this unused private "appendProp" method. |
principal = "root"; | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
package org.apache.accumulo.core.iterators.system; | Remove the literal "true" boolean value. |
import org.apache.accumulo.core.security.tokens.AuthenticationToken; | 1 duplicated blocks of code must be removed. |
import java.nio.ByteBuffer;
import org.apache.accumulo.core.security.thrift.Credentials;
import org.apache.accumulo.trace.instrument.Tracer;
Credentials creds;
if (opts.getPassword() == null) {
creds = new Credentials(opts.user, ByteBuffer.wrap(opts.getPassword()), instance.getInstanceID());
private static void stopServer(Instance instance, final Credentials credentials, final boolean tabletServersToo) throws AccumuloException, AccumuloSecurityException {
client.shutdown(Tracer.traceInfo(), credentials, tabletServersToo);
private static void stopTabletServer(Instance instance, final Credentials creds, List<String> servers, final boolean force) throws AccumuloException, AccumuloSecurityException {
client.shutdownTabletServer(Tracer.traceInfo(), creds, finalServer, force); | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.