Diff stringlengths 10 2k | Message stringlengths 28 159 |
|---|---|
if (namedOptions != null)
this.namedOptions = new LinkedHashMap<String,String>(namedOptions);
if (unnamedOptionDescriptions != null)
this.unnamedOptionDescriptions = new ArrayList<String>(unnamedOptionDescriptions);
if (namedOptions == null)
namedOptions = new LinkedHashMap<String,String>();
if (unnamedOptionDescriptions == null)
unnamedOptionDescriptions = new ArrayList<String>(); | Remove this call to "exit" or ensure it is really required. |
mmi = client.getMasterStats(Tracer.traceInfo(), SecurityConstants.getThriftSystemCredentials());
result = client.getStatus(Tracer.traceInfo(), SecurityConstants.getThriftSystemCredentials()); | Immediately return this expression instead of assigning it to the temporary variable "ret". |
int timeOut = 0;
int batchSize = 0;
Range range = new Range();
MockScanner(MockTable table, Authorizations auths) {
super(table, auths);
}
@Override
public void setTimeOut(int timeOut) {
this.timeOut = timeOut;
}
@Override
public int getTimeOut() {
return timeOut;
}
@Override
public void setRange(Range range) {
this.range = range;
}
@Override
public Range getRange() {
return this.range;
}
@Override
public void setBatchSize(int size) {
this.batchSize = size;
}
@Override
public int getBatchSize() {
return this.batchSize;
}
@Override
public void enableIsolation() {}
@Override
public void disableIsolation() {}
static class RangeFilter extends Filter {
Range range;
public RangeFilter(SortedKeyValueIterator<Key,Value> i, Range range) {
super(i);
this.range = range;
public boolean accept(Key k, Value v) {
return range.contains(k);
}
@Override
public Iterator<Entry<Key,Value>> iterator() {
SortedKeyValueIterator<Key,Value> i = new SortedMapIterator(table.table);
try {
i = new RangeFilter(createFilter(i), range);
i.seek(range, createColumnBSS(fetchedColumns), !fetchedColumns.isEmpty());
return new IteratorAdapter(i);
} catch (IOException e) {
throw new RuntimeException(e);
}
| Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
getConnector().securityOperations().createUser(TEST_USER, TEST_PASS.getBytes());
test_user_conn.securityOperations().createUser(user, password.getBytes());
root_conn.securityOperations().createUser(user, password.getBytes());
root_conn.securityOperations().createUser(user, password.getBytes());
test_user_conn.securityOperations().createUser(user, password.getBytes());
root_conn.securityOperations().createUser(user, password.getBytes());
root_conn.securityOperations().createUser(user, password.getBytes());
getConnector().securityOperations().createUser(TEST_USER, TEST_PASS.getBytes()); | Remove this unused private "appendProp" method. |
import org.apache.accumulo.examples.wikisearch.ingest.WikipediaInputFormat.WikipediaInputSplit;
super.initialize(((WikipediaInputSplit)genericSplit).getFileSplit(), context); | Immediately return this expression instead of assigning it to the temporary variable "result". |
/*
* 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. |
import org.apache.accumulo.proxy.thrift.UserPass;
protected static ByteBuffer userpass;
userpass = tpc.proxy().login(new UserPass("root", ByteBuffer.wrap("".getBytes()))); | Immediately return this expression instead of assigning it to the temporary variable "connector". |
* 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.
*/
@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]*$'. |
bcfr = new BCFile.Reader(fsin, fs.getFileStatus(path).getLen(), conf);
Set<Entry<String,MetaIndexEntry>> es = bcfr.metaIndex.index.entrySet();
for (Entry<String,MetaIndexEntry> entry : es) {
PrintStream out = System.out;
out.println("Meta block : " + entry.getKey());
out.println(" Raw size : " + String.format("%,d", entry.getValue().getRegion().getRawSize()) + " bytes");
out.println(" Compressed size : " + String.format("%,d", entry.getValue().getRegion().getCompressedSize()) + " bytes");
out.println(" Compression type : " + entry.getValue().getCompressionAlgorithm().getName());
out.println();
}
if (bcfr != null) {
bcfr.close();
} | Extract the assignment out of this expression. |
private static long gcTimeIncreasedCount;
if (maxIncreaseInCollectionTime == 0) {
gcTimeIncreasedCount = 0;
} else {
gcTimeIncreasedCount++;
if (gcTimeIncreasedCount > 3 && mem < rt.totalMemory() * 0.05) {
log.warn("Running low on memory");
gcTimeIncreasedCount = 0;
}
} | Remove this call to "exit" or ensure it is really required. |
import org.apache.accumulo.core.security.thrift.ThriftSecurityException;
import org.apache.accumulo.server.security.SecurityOperationImpl;
SecurityOperationImpl.getInstance().grantTablePermission(SecurityConstants.getSystemCredentials(), cloneInfo.user, cloneInfo.tableId, permission);
} catch (ThriftSecurityException e) {
throw e;
SecurityOperationImpl.getInstance().deleteTable(SecurityConstants.getSystemCredentials(), cloneInfo.tableId); | Remove this unused method parameter "ex". |
Set<String> users = conn.securityOperations().listLocalUsers();
conn.securityOperations().dropLocalUser(tableUserName);
conn.securityOperations().dropLocalUser(systemUserName);
PasswordToken sysUserPass = new PasswordToken("sysUser");
conn.securityOperations().createLocalUser(systemUserName, sysUserPass);
conn.securityOperations().dropLocalUser(tableUserName);
conn.securityOperations().dropLocalUser(systemUserName); | Remove the redundant '!unknownSymbol!' thrown exception declaration(s). |
if (l.length == 0)
return new byte[] {}; | Remove this call to "exit" or ensure it is really required. |
import org.apache.accumulo.start.classloader.vfs.AccumuloVFSClassLoader;
String contextName = acuTableConf.get(Property.TABLE_CLASSPATH);
if (contextName != null && !contextName.equals("")) {
// initialize context classloader, instead of possibly waiting for it to initialize for a scan
// TODO this could hang causing other tablets to fail to load
AccumuloVFSClassLoader.getContextManager().getClassLoader(contextName);
}
| Complete the task associated to this TODO comment. |
opts.put(Combiner.COLUMNS_OPTION, "2");
opts.put(Combiner.COLUMNS_OPTION, "cf001");
opts.put(Combiner.COLUMNS_OPTION, "cf001");
opts.put(Combiner.COLUMNS_OPTION, "cf001");
opts.put(Combiner.COLUMNS_OPTION, "cf001");
opts.put(Combiner.COLUMNS_OPTION, "cf001");
opts.put(Combiner.COLUMNS_OPTION, "cf001");
opts.put(Combiner.COLUMNS_OPTION, "cf001");
opts.put(Combiner.COLUMNS_OPTION, "cf001"); | Use "Integer.toString" instead. |
@Parameter(names = "-r", description = "print only mutations associated with the given row")
@Parameter(names = "-m", description = "limit the number of mutations printed per row")
@Parameter(names = "-t", description = "print only mutations that fall within the given key extent")
@Parameter(names = "-p", description = "search for a row that matches the given regex")
@Parameter(description = "<logfile> { <logfile> ... }")
| Return empty string instead. |
JobContext job;
TaskAttemptContext tac;
@Before
public void setup() {
job = new JobContext(new Configuration(), new JobID());
tac = new TaskAttemptContext(job.getConfiguration(), new TaskAttemptID());
}
@Test
public void testSet() throws IOException, InterruptedException {
AccumuloFileOutputFormat.setBlockSize(job, 300);
validate(300);
}
@Test
public void testUnset() throws IOException, InterruptedException {
validate((int) AccumuloConfiguration.getDefaultConfiguration().getMemoryInBytes(Property.TABLE_FILE_COMPRESSED_BLOCK_SIZE));
}
public void validate(int size) throws IOException, InterruptedException {
AccumuloFileOutputFormat.handleBlockSize(job);
int detSize = job.getConfiguration().getInt("io.seqfile.compress.blocksize", -1);
assertEquals(size, detSize);
}
| Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
/**
*
*/
package org.apache.accumulo.server.master.state;
import org.apache.accumulo.core.data.KeyExtent;
public class TabletMigration {
public KeyExtent tablet;
public TServerInstance oldServer;
public TServerInstance newServer;
public TabletMigration(KeyExtent extent, TServerInstance before, TServerInstance after) {
this.tablet = extent;
this.oldServer = before;
this.newServer = after;
}
public String toString() {
return tablet + ": " + oldServer + " -> " + newServer;
}
} | Return empty string instead. |
/*
* 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. |
String tabletDir = parts[2];
if (tableState != null && tableState != TableState.DELETING) {
// clone directories don't always exist
if (!tabletDir.startsWith("c-"))
log.warn("File doesn't exist: " + p);
} | Merge this if statement with the enclosing one. |
throw new AccumuloException(new IllegalArgumentException("iterator name conflict for " + setting.getName() + ": " + property.getKey() + "=" + property.getValue()));
throw new AccumuloException(new IllegalArgumentException("iterator priority conflict: " + property.getKey() + "=" + property.getValue()));
throw new AccumuloException(new IllegalArgumentException("iterator options conflict for " + setting.getName() + ": " + optionConflicts)); | Use "Integer.toString" instead. |
import java.nio.charset.Charset;
ChunkInputFormat.setConnectorInfo(job, user, pass.getBytes(Charset.forName("UTF-8")));
ChunkInputFormat.setInputTableName(job, table);
ChunkInputFormat.setScanAuthorizations(job, AUTHS); | Either log or rethrow this exception. |
+ this.username + (password==null?", password = null":"") + "]. Check values in ejb-jar.xml");
+ this.username + (password==null?", password = null":"") + "]. Check values in ejb-jar.xml");
log.info("Connecting to [instanceName = " + this.instanceName + ", zookeepers = " + this.zooKeepers + ", username = " + this.username + "]."); | 2 duplicated blocks of code must be removed. |
import org.apache.accumulo.trace.instrument.CountSampler;
import org.apache.accumulo.trace.instrument.Sampler;
import org.apache.accumulo.trace.instrument.Span;
import org.apache.accumulo.trace.instrument.Trace;
import org.apache.accumulo.trace.instrument.thrift.TraceWrap;
import org.apache.accumulo.trace.thrift.TInfo; | Remove the redundant '!unknownSymbol!' thrown exception declaration(s). |
import org.apache.accumulo.core.security.CredentialHelper;
import org.apache.accumulo.core.security.thrift.Credential;
private Credential credentials;
public void init(FileSystem fs, Instance instance, Credential credentials, boolean noTrash) throws IOException {
Scanner scanner = instance.getConnector(credentials.getPrincipal(), CredentialHelper.extractToken(credentials)).createScanner(Constants.METADATA_TABLE_NAME, Constants.NO_AUTHS);
scanner = new IsolatedScanner(instance.getConnector(credentials.getPrincipal(), CredentialHelper.extractToken(credentials)).createScanner(Constants.METADATA_TABLE_NAME, Constants.NO_AUTHS));
public GCStatus getStatus(TInfo info, Credential credentials) { | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
import java.nio.charset.Charset;
private static final Charset utf8 = Charset.forName("UTF8");
m.put(Constants.METADATA_DATAFILE_COLUMN_FAMILY, new Text(filename), new Value(value.getBytes(utf8))); | Move this variable to comply with Java Code Conventions. |
package org.apache.accumulo.test.randomwalk.sequential; | Move the "org.apache.accumulo.test.randomwalk.unit.CreateTable" string literal on the left side of this string comparison. |
import static org.junit.Assert.*;
assertEquals(8, moved);
assertEquals(48, moved); | Remove this unused private "appendProp" method. |
public Collection<Text> listSplits(String tableName) throws TableNotFoundException {
return null;
}
@Override
public Collection<Text> listSplits(String tableName, int maxSplits) throws TableNotFoundException {
return null;
}
@Override | Remove the redundant '!unknownSymbol!' thrown exception declaration(s). |
shell.config("-u", "root", "-p", secret, "-z", cluster.getConfig().getInstanceName(), cluster.getConfig().getZooKeepers());
ZooKeeperInstance instance = new ZooKeeperInstance(cluster.getConfig().getInstanceName(), cluster.getConfig().getZooKeepers()); | Either log or rethrow this exception. |
long progress = System.currentTimeMillis();
synchronized public void makingProgress() {
progress = System.currentTimeMillis();
}
synchronized public long lastProgress() {
return progress;
} | Reorder the modifiers to comply with the Java Language Specification. |
*
*
*
*
*
*
*
*
* | Replace all tab characters in this file by sequences of white-spaces. |
import org.apache.accumulo.core.security.ColumnVisibility;
m = new ServerMutation(new Text("row"));
m.put(new Text("cf"), new Text("cq"), new ColumnVisibility("vis"), 12345, new Value("value".getBytes()));
m.put(new Text("cf"), new Text("cq"), new ColumnVisibility("vis2"), new Value("value".getBytes()));
readWrite(MUTATION, 8, 9, null, null, new Mutation[] {m}, key, value);
assertEquals(key.event, MUTATION);
assertEquals(key.seq, 8);
assertEquals(key.tid, 9);
assertEquals(value.mutations, Arrays.asList(m)); | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
package org.apache.accumulo.core.client.mock;
import java.util.Arrays;
import java.util.EnumSet;
import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.core.security.SystemPermission;
public class MockUser {
final EnumSet<SystemPermission> permissions;
final String name;
byte[] password;
Authorizations authorizations;
MockUser(String username, byte[] password, Authorizations auths) {
this.name = username;
this.password = Arrays.copyOf(password, password.length);
this.authorizations = auths;
this.permissions = EnumSet.noneOf(SystemPermission.class);
}
} | Return empty string instead. |
if (mapType.equals("SKIP_LIST"))
tm = new ConcurrentSkipListMap<Key,Value>();
else if (mapType.equals("TREE_MAP"))
tm = Collections.synchronizedSortedMap(new TreeMap<Key,Value>());
else if (mapType.equals("NATIVE_MAP"))
nm = new NativeMap();
else
throw new IllegalArgumentException(" map type must be SKIP_LIST, TREE_MAP, or NATIVE_MAP");
if (nm != null)
nm.delete();
if (tm != null)
tm.clear(); | 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.
*/ | Replace all tab characters in this file by sequences of white-spaces. |
public static void moveMetaDeleteMarkers(Instance instance, TCredentials creds) {
// move delete markers from the normal delete keyspace to the root tablet delete keyspace if the files are for the !METADATA table
Scanner scanner = new ScannerImpl(instance, creds, Constants.METADATA_TABLE_ID, Constants.NO_AUTHS);
scanner.setRange(new Range(Constants.METADATA_DELETES_KEYSPACE));
for (Entry<Key,Value> entry : scanner) {
String row = entry.getKey().getRow().toString();
if (row.startsWith(Constants.METADATA_DELETE_FLAG_PREFIX + "/" + Constants.METADATA_TABLE_ID)) {
String filename = row.substring(Constants.METADATA_DELETE_FLAG_PREFIX.length());
// add the new entry first
log.info("Moving " + filename + " marker to the root tablet");
Mutation m = new Mutation(Constants.METADATA_DELETE_FLAG_FOR_METADATA_PREFIX + filename);
m.put(new byte[]{}, new byte[]{}, new byte[]{});
update(creds, m);
// remove the old entry
m = new Mutation(entry.getKey().getRow());
m.putDelete(new byte[]{}, new byte[]{});
update(creds, m);
} else {
break;
}
}
} | 1 duplicated blocks of code must be removed. |
import org.apache.accumulo.core.util.RootTable;
if (tablet.equals(RootTable.ROOT_TABLET_EXTENT)) { | Use "Long.toString" instead. |
/*
* 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. |
public class Shell extends ShellOptions {
protected int exitCode = 0;
protected Instance instance;
protected ConsoleReader reader;
protected boolean configError = false;
protected boolean exit = false;
protected String execFile = null;
protected String execCommand = null;
protected boolean verbose = true;
super();
super();
// Use a fake (Mock), ZK, or HdfsZK Accumulo instance
setInstance(cl);
@SuppressWarnings("deprecation")
protected void setInstance(CommandLine cl) {
// should only be one instance option set
instance = null;
if (cl.hasOption(fakeOption.getLongOpt())) {
instance = new MockInstance();
} else if (cl.hasOption(hdfsZooInstance.getOpt())) {
instance = getDefaultInstance(AccumuloConfiguration.getSiteConfiguration());
} else if (cl.hasOption(zooKeeperInstance.getOpt())) {
String[] zkOpts = cl.getOptionValues(zooKeeperInstance.getOpt());
instance = new ZooKeeperInstance(zkOpts[0], zkOpts[1]);
} else {
instance = getDefaultInstance(AccumuloConfiguration.getSiteConfiguration());
}
}
protected String getDefaultPrompt() { | Either log or rethrow this exception. |
if (state.id > 99)
badStates.add(state);
if (mapping.containsKey(id))
return mapping.get(id); | Remove this call to "exit" or ensure it is really required. |
import org.apache.accumulo.minicluster.MiniAccumuloCluster;
| Either log or rethrow this exception. |
* Connector connects to an Accumulo instance and allows the user to request readers and writers for the instance as well as various objects that permit
* administrative operations.
* The Connector enforces security on the client side by forcing all API calls to be accompanied by user credentials.
* Construct a Connector from an {@link Instance}
* Retrieves a TableOperations object to perform table functions, such as create and delete.
* Retrieves a SecurityOperations object to perform user security operations, such as creating users.
* Retrieves an InstanceOperations object to modify instance configuration. | Complete the task associated to this TODO comment. |
if (scans.size() > 0)
break;
if (!scansIter.hasNext())
readNext(); | Remove this call to "exit" or ensure it is really required. |
boolean hasNext = false;
if (hasNext)
while (true) {
try {
return hasNext = true;
if (!hasNext && !hasNext())
hasNext = false;
| Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
import org.apache.accumulo.core.client.AccumuloException;
import org.apache.accumulo.core.client.AccumuloSecurityException;
import org.apache.accumulo.core.client.Connector;
import org.apache.accumulo.core.client.Instance;
import org.apache.accumulo.core.client.ZooKeeperInstance;
import org.apache.accumulo.core.client.security.tokens.PasswordToken;
public Connector getConnector(String user, String passwd) throws AccumuloException, AccumuloSecurityException {
Instance instance = new ZooKeeperInstance(this.getInstanceName(), this.getZooKeepers());
return instance.getConnector(user, new PasswordToken(passwd));
} | Introduce a new variable instead of reusing the parameter "suffix". |
import java.util.HashSet;
import org.apache.accumulo.core.Constants;
import org.apache.accumulo.core.client.Instance;
import org.apache.accumulo.core.conf.Property;
import org.apache.accumulo.core.zookeeper.ZooUtil;
import org.apache.accumulo.fate.zookeeper.ZooReader;
import org.apache.accumulo.server.util.AddressUtil;
import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.data.Stat;
Set<TServerInstance> getTServers(Instance instance) throws KeeperException, InterruptedException {
Set<TServerInstance> result = new HashSet<TServerInstance>();
ZooReader rdr = new ZooReader(instance.getZooKeepers(), instance.getZooKeepersSessionTimeOut());
String base = ZooUtil.getRoot(instance) + Constants.ZTSERVERS;
for (String child : rdr.getChildren(base)) {
List<String> children = rdr.getChildren(base + "/" + child);
if (children.size() > 0) {
Collections.sort(children);
Stat stat = new Stat();
byte[] data = rdr.getData(base + "/" + child + "/" + children.get(0), stat);
if (!"master".equals(new String(data))) {
result.add(new TServerInstance(AddressUtil.parseAddress(child, Property.TSERV_CLIENTPORT), stat.getEphemeralOwner()));
}
}
}
return result;
}
Instance instance = state.getInstance();
List<TServerInstance> currentServers = new ArrayList<TServerInstance>(getTServers(instance));
Process exec = runtime.exec(new String[] {System.getenv("ACCUMULO_HOME") + "/bin/accumulo", "admin", "stop", victim.hostPort()});
if (exec.waitFor() != 0)
throw new RuntimeException("admin stop returned a non-zero response: " + exec.exitValue());
Set<TServerInstance> set = getTServers(instance);
if (set.contains(victim)) | Define and throw a dedicated exception instead of using a generic one. |
// INITIAL HAVE_LOCK SAFE_MODE NORMAL UNLOAD_META UNLOAD_ROOT STOP
/* INITIAL */{X, X, _, _, _, _, X},
/* HAVE_LOCK */{_, X, X, X, _, _, X},
/* SAFE_MODE */{_, _, X, X, X, _, X},
/* NORMAL */{_, _, X, X, X, _, X},
/* UNLOAD_METADATA_TABLETS */{_, _, X, X, X, X, X},
/* UNLOAD_ROOT_TABLET */{_, _, _, _, _, X, X},
/* STOP */{_, _, _, _, _, _, X},};
private final AtomicBoolean upgradeMetadataRunning = new AtomicBoolean(false);
private final ServerConfiguration serverConfig;
final String tableId = Tables.getNameToIdMap(getConfiguration().getInstance()).get(tableName);
String zTablePath = Constants.ZROOT + "/" + getConfiguration().getInstance().getInstanceID() + Constants.ZTABLES + "/" + tableId
+ Constants.ZTABLE_FLUSH_ID;
@Override
@Override
@Override
final TabletStateStore stores[] = {new ZooTabletStateStore(new ZooStore(zroot)), new RootTabletStateStore(instance, systemAuths, this),
new MetaDataStateStore(instance, systemAuths, this)};
@Override
| Define a constant instead of duplicating this literal " for table " 4 times. |
/*
* 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. |
TabletServerStatus _elem24; // optional
String _elem31; // optional
DeadServer _elem34; // optional
TabletServerStatus _elem51; // optional
String _elem58; // optional
DeadServer _elem61; // optional | 277 duplicated blocks of code must be removed. |
if (portHint != 0 && i > 0)
String hostname = address.getAddress().getHostAddress();
if (hostname.equals("0.0.0.0")) {
hostname = InetAddress.getLocalHost().getHostName();
int port = address.getPort();
if (port == 0) {
port = transport.getPort();
}
return new ServerAddress(new THsHaServer(options), new InetSocketAddress(hostname, port)); | Either log or rethrow this exception. |
import org.apache.accumulo.core.util.Pair;
Pair<String,TTransport> getAnyTransport(List<ThriftTransportKey> servers) throws TTransportException {
return new Pair<String,TTransport>(entry.getKey().getLocation() + ":" + entry.getKey().getPort(), cachedConnection.transport);
return new Pair<String,TTransport>(servers.get(index).getLocation() + ":" + servers.get(index).getPort(), createNewTransport(servers.get(index))); | The Cyclomatic Complexity of this method "call" is 13 which is greater than 10 authorized. |
import static org.junit.Assert.assertFalse;
assertTrue(((AgeOffFilter) a).validateOptions(is.getOptions()));
assertFalse(((AgeOffFilter) a).validateOptions(EMPTY_OPTS));
assertTrue(a.validateOptions(is.getOptions()));
assertTrue(a.validateOptions(is.getOptions()));
assertTrue(a.validateOptions(is.getOptions()));
TimestampFilter.setEnd(is, 253402300800001l, true);
a.init(new SortedMapIterator(tm), is.getOptions(), null);
is.clearOptions();
is.addOption(TimestampFilter.START, "19990101000011GMT");
assertTrue(a.validateOptions(is.getOptions()));
a.init(new SortedMapIterator(tm), is.getOptions(), null);
a.seek(new Range(), EMPTY_COL_FAMS, false);
assertEquals(size(a), 89);
is.clearOptions();
is.addOption(TimestampFilter.END, "19990101000031GMT");
assertTrue(a.validateOptions(is.getOptions()));
a.init(new SortedMapIterator(tm), is.getOptions(), null);
a.seek(new Range(), EMPTY_COL_FAMS, false);
assertEquals(size(a), 32);
assertFalse(a.validateOptions(EMPTY_OPTS)); | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
import org.apache.accumulo.core.util.MetadataTable;
if (table.equals(MetadataTable.NAME)) | Use "Long.toString" instead. |
throw new IllegalArgumentException(e); | Complete the task associated to this TODO comment. |
+ "Examples of invalid memories are '1M500K', '1M 2K', '1MB', '1.5G', '1,024K', '', and 'a'.<br />"
@Override
@Override | Make the "log" logger private static final and rename it to comply with the format "LOG(?:GER)?". |
getClassLoader(); | Define and throw a dedicated exception instead of using a generic one. |
import org.apache.accumulo.start.classloader.vfs.AccumuloVFSClassLoader;
Class<? extends TabletBalancer> clazz = AccumuloVFSClassLoader.loadClass(clazzName, TabletBalancer.class); | Remove this unused private "appendProp" method. |
import org.apache.accumulo.core.security.thrift.Credential;
import org.apache.accumulo.core.security.thrift.tokens.PasswordToken;
import org.apache.accumulo.core.security.thrift.tokens.SecurityToken;
public final class ZKAuthenticator extends org.apache.accumulo.core.security.handler.ZKAuthenticator implements Authenticator {
public void initializeSecurity(Credential credentials, String principal, byte[] token) throws AccumuloSecurityException {
public void createUser(String principal, SecurityToken token) throws AccumuloSecurityException {
if (!(token instanceof PasswordToken))
throw new AccumuloSecurityException(principal, SecurityErrorCode.INVALID_TOKEN);
PasswordToken pt = (PasswordToken) token;
constructUser(principal, ZKSecurityTool.createPass(pt.getPassword()));
public void changePassword(String principal, SecurityToken token) throws AccumuloSecurityException {
if (!(token instanceof PasswordToken))
throw new AccumuloSecurityException(principal, SecurityErrorCode.INVALID_TOKEN);
PasswordToken pt = (PasswordToken) token;
ZooReaderWriter.getRetryingInstance().putPrivatePersistentData(ZKUserPath + "/" + principal, ZKSecurityTool.createPass(pt.getPassword()),
public boolean authenticateUser(String principal, SecurityToken token) throws AccumuloSecurityException {
if (!(token instanceof PasswordToken))
throw new AccumuloSecurityException(principal, SecurityErrorCode.INVALID_TOKEN);
PasswordToken pt = (PasswordToken) token;
boolean result = ZKSecurityTool.checkPass(pt.getPassword(), pass);
result = ZKSecurityTool.checkPass(pt.getPassword(), pass);
public String getTokenLoginClass() {
@Override
public boolean validTokenClass(String tokenClass) {
return tokenClass.equals(PasswordToken.class.getCanonicalName());
} | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
public abstract class Connector {
public abstract BatchScanner createBatchScanner(String tableName, Authorizations authorizations, int numQueryThreads) throws TableNotFoundException;
* @deprecated since 1.5.0; Use {@link #createBatchDeleter(String, Authorizations, int, BatchWriterConfig)} instead.
public abstract BatchDeleter createBatchDeleter(String tableName, Authorizations authorizations, int numQueryThreads, long maxMemory, long maxLatency,
int maxWriteThreads) throws TableNotFoundException;
public abstract BatchDeleter createBatchDeleter(String tableName, Authorizations authorizations, int numQueryThreads, BatchWriterConfig config)
throws TableNotFoundException;
* @deprecated since 1.5.0; Use {@link #createBatchWriter(String, BatchWriterConfig)} instead.
public abstract BatchWriter createBatchWriter(String tableName, long maxMemory, long maxLatency, int maxWriteThreads) throws TableNotFoundException;
public abstract BatchWriter createBatchWriter(String tableName, BatchWriterConfig config) throws TableNotFoundException;
* @deprecated since 1.5.0; Use {@link #createMultiTableBatchWriter(BatchWriterConfig)} instead.
public abstract MultiTableBatchWriter createMultiTableBatchWriter(long maxMemory, long maxLatency, int maxWriteThreads);
public abstract MultiTableBatchWriter createMultiTableBatchWriter(BatchWriterConfig config);
public abstract Scanner createScanner(String tableName, Authorizations authorizations) throws TableNotFoundException;
public abstract Instance getInstance();
public abstract String whoami();
public abstract TableOperations tableOperations();
public abstract SecurityOperations securityOperations();
public abstract InstanceOperations instanceOperations(); | Extract the assignment out of this expression. |
zk.putPersistentData(getTXPath(tid), TStatus.NEW.name().getBytes(), NodeExistsPolicy.FAIL);
zk.putPersistentData(getTXPath(tid), status.name().getBytes(), NodeExistsPolicy.OVERWRITE);
zk.putPersistentData(getTXPath(tid) + "/prop_" + prop, ("S " + so).getBytes(), NodeExistsPolicy.OVERWRITE); | Remove this unused method parameter "ex". |
* 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.
*/
for (Entry<Key,Value> elt : scanner) {
assert (elt.getKey().getRow().toString().equals(expected));
assert (last == count);
for (String table : tableNames)
for (int i = 0; i < count; i++) {
| Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
import org.apache.accumulo.core.client.Instance;
import org.apache.accumulo.core.client.TableNotFoundException;
import org.apache.accumulo.core.security.thrift.AuthInfo;
final protected Instance instance;
final protected AuthInfo auths;
public MetaDataStateStore(Instance instance, AuthInfo auths, CurrentState state) {
this.instance = instance;
this.auths = auths;
public MetaDataStateStore() {
this(HdfsZooInstance.getInstance(), SecurityConstants.getSystemCredentials(), null);
}
return new MetaDataTableScanner(instance, auths, Constants.NON_ROOT_METADATA_KEYSPACE, state);
try {
return instance.getConnector(auths).createBatchWriter(Constants.METADATA_TABLE_NAME, MAX_MEMORY, LATENCY, THREADS);
} catch (TableNotFoundException e) {
// ya, I don't think so
throw new RuntimeException(e);
} catch (Exception e) {
throw new RuntimeException(e);
} | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
if (!done)
return 50; | 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.
*/
public class NullKeyValueIterator implements Iterator<Entry<Key,Value>> {
public Entry<Key,Value> next() {
public void remove() {} | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
import org.apache.accumulo.core.iterators.user.RegExFilter;
AccumuloInputFormat.addIterator(job, new IteratorSetting(1, "WholeRow", "org.apache.accumulo.core.iterators.WholeRowIterator"));
AccumuloInputFormat.addIterator(job, new IteratorSetting(1, "WholeRow", "org.apache.accumulo.core.iterators.WholeRowIterator"));
AccumuloInputFormat.addIterator(job, new IteratorSetting(2, "Versions", "org.apache.accumulo.core.iterators.VersioningIterator"));
AccumuloInputFormat.addIterator(job, new IteratorSetting(3, "Count", "org.apache.accumulo.core.iterators.CountingIterator"));
IteratorSetting is = new IteratorSetting(50, regex, RegExFilter.class);
RegExFilter.setRegexs(is, regex, null, null, null, false);
AccumuloInputFormat.addIterator(job, is);
assertTrue(regex.equals(AccumuloInputFormat.getIterators(job).get(0).getIteratorName())); | Define a constant instead of duplicating this literal "org.apache.accumulo.core.iterators.WholeRowIterator" 4 times. |
import org.apache.accumulo.trace.instrument.Span;
import org.apache.accumulo.trace.instrument.Trace; | Remove the redundant '!unknownSymbol!' thrown exception declaration(s). |
import org.apache.accumulo.core.client.impl.thrift.SecurityErrorCode;
import org.apache.accumulo.core.client.security.tokens.AuthenticationToken;
import org.apache.accumulo.core.client.security.tokens.PasswordToken; | Move this constructor to comply with Java Code Conventions. |
/*
* 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. |
import org.apache.accumulo.core.security.thrift.Credential;
private Credential credentials;
public InstanceOperationsImpl(Instance instance, Credential credentials) { | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
import org.apache.accumulo.core.iterators.user.IntersectingIterator; | Remove this unused private "match" method. |
fs.delete(dir, true);
fs.delete(fail, true);
| Remove this unused import 'org.apache.log4j.Logger'. |
* 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.
*/
private static final Logger log = Logger.getLogger(ZooKeeperStatus.class);
if (parts.length > 1) addr = new InetSocketAddress(parts[0], Integer.parseInt(parts[1]));
else addr = new InetSocketAddress(parts[0], 2181);
transport = TTimeoutTransport.create(addr, 10 * 1000l);
byte[] buffer = new byte[1024 * 100];
if (line.startsWith(" ")) clients++;
if (line.startsWith("Mode")) mode = line.split(":")[1];
| Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
* To move trace data from client to server, the RPC call must be annotated to take a TInfo object as its first argument. The user can simply pass null, so long
* as they wrap their Client and Service objects with these functions.
* Trace.on("remoteMethod");
public Object invoke(Object obj, Method method, Object[] args) throws Throwable {
Span span = Trace.trace((TInfo) args[0], method.getName());
return (T) Proxy.newProxyInstance(instance.getClass().getClassLoader(), instance.getClass().getInterfaces(), handler);
public Object invoke(Object obj, Method method, Object[] args) throws Throwable {
return (T) Proxy.newProxyInstance(instance.getClass().getClassLoader(), instance.getClass().getInterfaces(), handler);
| Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
/**
* A filter that ages off key/value pairs based on the Key's column and timestamp. It removes an entry if its timestamp is less than currentTime - threshold.
* Different thresholds are set for each column.
*/ | Remove the literal "true" boolean value. |
package org.apache.accumulo.server.thrift.metrics;
import javax.management.ObjectName;
import org.apache.accumulo.server.metrics.AbstractMetricsImpl;
public class ThriftMetrics extends AbstractMetricsImpl implements ThriftMetricsMBean {
static final org.apache.log4j.Logger log = org.apache.log4j.Logger.getLogger(ThriftMetrics.class);
private static final String METRICS_PREFIX = "thrift";
private static ObjectName OBJECT_NAME = null;
public ThriftMetrics(String serverName, String threadName) {
super();
reset();
try {
OBJECT_NAME = new ObjectName("accumulo.server.metrics:service="+serverName+",name=ThriftMetricsMBean,instance="+threadName);
} catch (Exception e) {
log.error("Exception setting MBean object name", e);
}
}
@Override
protected ObjectName getObjectName() {
return OBJECT_NAME;
}
@Override
protected String getMetricsPrefix() {
return METRICS_PREFIX;
}
public void reset() {
createMetric(idle);
createMetric(execute);
}
public long getExecutionAvgTime() { return this.getMetricAvg(execute); }
public long getExecutionCount() { return this.getMetricCount(execute); }
public long getExecutionMaxTime() { return this.getMetricMax(execute); }
public long getExecutionMinTime() { return this.getMetricMin(execute); }
public long getIdleAvgTime() { return this.getMetricAvg(idle); }
public long getIdleCount() { return this.getMetricCount(idle); }
public long getIdleMaxTime() { return this.getMetricMax(idle); }
public long getIdleMinTime() { return this.getMetricMin(idle); }
} | Return empty string instead. |
import org.apache.accumulo.core.iterators.user.IntersectingIterator; | Remove this unused private "match" method. |
import java.util.concurrent.TimeUnit;
* Setting to zero or Long.MAX_VALUE and TimeUnit.MILLISECONDS means to retry forever.
*
* @param timeUnit
* determines how timeout is interpreted
public void setTimeout(long timeOut, TimeUnit timeUnit);
public long getTimeout(TimeUnit timeUnit); | Move this constructor to comply with Java Code Conventions. |
import org.apache.accumulo.core.security.thrift.ThriftSecurityException;
import org.apache.accumulo.server.security.SecurityOperationImpl;
private static void initSecurity(String iid, byte[] rootpass) throws AccumuloSecurityException, ThriftSecurityException {
SecurityOperationImpl.getInstance(iid).initializeSecurity(SecurityConstants.getSystemCredentials(), ROOT_USER, rootpass); | Remove this unused method parameter "ex". |
import org.apache.accumulo.core.client.security.SecurityErrorCode;
if (e.getSecurityErrorCode() != SecurityErrorCode.PERMISSION_DENIED || root_conn.tableOperations().list().contains(tableName))
if (e.getSecurityErrorCode() != SecurityErrorCode.PERMISSION_DENIED || !root_conn.tableOperations().list().contains(tableName))
if (e.getSecurityErrorCode() != SecurityErrorCode.PERMISSION_DENIED
if (e.getSecurityErrorCode() != SecurityErrorCode.PERMISSION_DENIED
if (e.getSecurityErrorCode() != SecurityErrorCode.PERMISSION_DENIED || !root_conn.tableOperations().list().contains(tableName)
if (e.getSecurityErrorCode() != SecurityErrorCode.PERMISSION_DENIED
|| root_conn.securityOperations().authenticateUser(user, new PasswordToken(password)))
if (e.getSecurityErrorCode() != SecurityErrorCode.PERMISSION_DENIED
|| !root_conn.securityOperations().authenticateUser(user, new PasswordToken(password)))
if (e.getSecurityErrorCode() != SecurityErrorCode.PERMISSION_DENIED || !root_conn.securityOperations().getUserAuthorizations(user).isEmpty())
if (se.getSecurityErrorCode() != SecurityErrorCode.PERMISSION_DENIED)
throw new AccumuloSecurityException(test_user_conn.whoami(), org.apache.accumulo.core.client.impl.thrift.SecurityErrorCode.PERMISSION_DENIED,
e1);
if (e.getSecurityErrorCode() != SecurityErrorCode.PERMISSION_DENIED)
if (e.getSecurityErrorCode() != SecurityErrorCode.PERMISSION_DENIED)
if (e.getSecurityErrorCode() != SecurityErrorCode.PERMISSION_DENIED)
if (e.getSecurityErrorCode() != SecurityErrorCode.PERMISSION_DENIED) | Do not forget to remove this deprecated code someday. |
import org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException; | 1 duplicated blocks of code must be removed. |
package org.apache.accumulo.cloudtrace.instrument;
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]*$'. |
*
*
* @deprecated since 1.4
* @use org.apache.accumulo.core.file.rfile.RFile
/**
* @deprecated since 1.4
* @use org.apache.accumulo.core.Constants.MAPFILE_EXTENSION
*/ | 6 duplicated blocks of code must be removed. |
import java.nio.ByteBuffer;
import org.apache.accumulo.core.security.thrift.Credentials;
private Credentials credentials;
connector = instance.getConnector(user, pass);
this.credentials = new Credentials(user, ByteBuffer.wrap(pass), connector.getInstance().getInstanceID());
Command[] userCommands = {new AddAuthsCommand(), new CreateUserCommand(), new DeleteUserCommand(), new DropUserCommand(), new GetAuthsCommand(), new PasswdCommand(),
new SetAuthsCommand(), new UsersCommand()};
authFailed = !connector.securityOperations().authenticateUser(connector.whoami(), pwd.getBytes());
public void updateUser(Credentials authInfo) throws AccumuloException, AccumuloSecurityException {
connector = instance.getConnector(authInfo);
credentials = authInfo;
}
public Credentials getCredentials() { | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
private Object writeSerializer = new Object();
int numKVs = 0;
// Can not update mutationCount while writes that started before
// are in progress, this would cause partial mutations to be seen.
// Also, can not continue until mutation count is updated, because
// a read may not see a successful write. Therefore writes must
// wait for writes that started before to finish.
//
// using separate lock from this map, to allow read/write in parallel
synchronized (writeSerializer ) {
try {
map.mutate(mutations, mc);
} finally { | Move this variable to comply with Java Code Conventions. |
* 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.
*/
* Not merging
* when the number of chopped tablets in the range matches the number of online tablets in the range, take the tablets offline
/**
* merge is complete, the resulting tablet can be brought online, remove the marker in zookeeper
| 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.
*/ | Replace all tab characters in this file by sequences of white-spaces. |
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
@SuppressWarnings("deprecation") | 6 duplicated blocks of code must be removed. |
public abstract <T extends Mutation> void binMutations(List<T> mutations, Map<String,TabletServerMutations<T>> binnedMutations, List<T> failures,
public static class TabletServerMutations<T extends Mutation> {
private Map<KeyExtent,List<T>> mutations;
mutations = new HashMap<KeyExtent,List<T>>();
public void addMutation(KeyExtent ke, T m) {
List<T> mutList = mutations.get(ke);
mutList = new ArrayList<T>();
public Map<KeyExtent,List<T>> getMutations() { | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
protected static ByteBuffer userpass;
userpass = tpc.proxy().login(new UserPass("root", ByteBuffer.wrap("".getBytes()))); | Replace this use of System.out or System.err by a logger. |
@Deprecated | Remove this unused method parameter "ex". |
/**
*
*/
package org.apache.accumulo.server.master.state;
public enum TabletState {
UNASSIGNED, ASSIGNED, HOSTED, ASSIGNED_TO_DEAD_SERVER
} | Return empty string instead. |
while (!tl.binRanges(ranges, binnedRanges,
new TCredentials(getPrincipal(context), getTokenClass(context), ByteBuffer.wrap(getToken(context)), getInstance(context).getInstanceID())).isEmpty()) { | Remove the redundant '!unknownSymbol!' thrown exception declaration(s). |
import org.apache.accumulo.core.security.tokens.InstanceTokenWrapper;
private final InstanceTokenWrapper credentials;
public TabletServerBatchReaderIterator(Instance instance, InstanceTokenWrapper credentials, String table, Authorizations authorizations, ArrayList<Range> ranges,
ResultReceiver receiver, List<Column> columns, InstanceTokenWrapper credentials, ScannerOptions options, Authorizations authorizations, AccumuloConfiguration conf)
ResultReceiver receiver, List<Column> columns, InstanceTokenWrapper credentials, ScannerOptions options, Authorizations authorizations, AccumuloConfiguration conf,
InitialMultiScan imsr = client.startMultiScan(Tracer.traceInfo(), credentials.toThrift(), thriftTabletRanges, Translator.translate(columns, Translator.CT), | Immediately return this expression instead of assigning it to the temporary variable "ret". |
@Override
public void visit(State state, Properties props) throws Exception {
@SuppressWarnings("unchecked")
ArrayList<String> tables = (ArrayList<String>) state.get("tableList");
// don't drop a table if we only have one table or less
if (tables.size() <= 1) {
return;
}
Random rand = new Random();
String tableName = tables.remove(rand.nextInt(tables.size()));
try {
state.getConnector().tableOperations().delete(tableName);
log.debug("Dropped " + tableName);
} catch (TableNotFoundException e) {
log.error("Tried to drop table " + tableName + " but could not be found!");
} | 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.
*/ | Replace all tab characters in this file by sequences of white-spaces. |
public static final void strictlyPositive(final int i) {
if (i <= 0)
throw new IllegalArgumentException("integer should be > 0, was " + i);
} | Remove this unused method parameter "scopes". |
import org.apache.accumulo.core.security.crypto.CryptoModuleFactory;
import org.apache.accumulo.core.security.crypto.CryptoModuleParameters;
CryptoModuleParameters params = CryptoModuleFactory.createParamsObjectFromAccumuloConfiguration(conf.getConfiguration());
params.setPlaintextOutputStream(logFile);
// In order to bootstrap the reading of this file later, we have to record the CryptoModule that was used to encipher it here,
// so that that crypto module can re-read its own parameters.
logFile.writeUTF(conf.getConfiguration().get(Property.CRYPTO_MODULE_CLASS));
//@SuppressWarnings("deprecation")
//OutputStream encipheringOutputStream = cryptoModule.getEncryptingOutputStream(logFile, cryptoOpts);
params = cryptoModule.getEncryptingOutputStream(params);
OutputStream encipheringOutputStream = params.getEncryptedOutputStream(); | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
* A lexicoder to encode/decode a BigInteger to/from bytes that maintain its native Java sort order. | Remove this unused import 'java.util.Date'. |
import org.apache.accumulo.server.security.SystemCredentials;
MasterMonitorInfo stats = client.getMasterStats(Tracer.traceInfo(), SystemCredentials.get().getAsThrift());
static class Opts extends ClientOnRequiredTable {} | Move this constructor to comply with Java Code Conventions. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.