Diff
stringlengths 10
2k
| Message
stringlengths 28
159
|
---|---|
AccumuloRowInputFormat.setInputInfo(job, user, pass.getBytes(), table, Constants.NO_AUTHS);
AccumuloRowInputFormat.setMockInstance(job, "instance1");
|
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.
*/
|
Replace all tab characters in this file by sequences of white-spaces.
|
void send(AuthInfo info, String serverName, MasterClientService.Iface client) throws TException, ThriftSecurityException;
|
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.accumulo.core.security.thrift.TCredentials;
public void initializeSecurity(TCredentials credentials, String rootuser) throws AccumuloSecurityException, ThriftSecurityException;
|
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.
*/
public List<KeyExtent> tabletsToMinorCompact;
|
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.
*/
super(new BufferedInputStream(sock.getSocket().getInputStream(), bufferSize), new BufferedOutputStream(sock.getSocket().getOutputStream(), bufferSize));
client = sock.getSocket().getInetAddress().getHostAddress() + ":" + sock.getSocket().getPort();
|
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
|
import org.apache.accumulo.core.security.thrift.tokens.PasswordToken;
import org.apache.accumulo.core.security.thrift.tokens.SecurityToken;
private static final SecurityToken TEST_PASS = new PasswordToken().setPassword("test_password".getBytes());
getConnector().securityOperations().createUser(TEST_USER, TEST_PASS);
Connector test_user_conn = getInstance().getConnector(TEST_USER, TEST_PASS);
test_user_conn.securityOperations().createUser(user, new PasswordToken().setPassword(password.getBytes()));
root_conn.securityOperations().createUser(user, new PasswordToken().setPassword(password.getBytes()));
root_conn.securityOperations().createUser(user, new PasswordToken().setPassword(password.getBytes()));
test_user_conn.securityOperations().createUser(user, new PasswordToken().setPassword(password.getBytes()));
root_conn.securityOperations().createUser(user, new PasswordToken().setPassword(password.getBytes()));
root_conn.securityOperations().createUser(user, new PasswordToken().setPassword(password.getBytes()));
getConnector().securityOperations().createUser(TEST_USER, TEST_PASS);
Connector test_user_conn = getInstance().getConnector(TEST_USER, TEST_PASS);
|
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
|
iter.init(source, is.getOptions(), env);
iter.init(source, is.getOptions(), env);
iter.init(mi, is.getOptions(), env);
iter.init(source, is.getOptions(), env);
|
Refactor this code to not nest more than 3 if/for/while/switch/try statements.
|
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
@Override
public List<Set<AuthProperty>> getProperties() {
Set<AuthProperty> internal = new TreeSet<AuthProperty>();
List<Set<AuthProperty>> toRet = new LinkedList<Set<AuthProperty>>();
toRet.add(internal);
return toRet;
}
|
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
|
org.apache.thrift.protocol.TList _list106 = iprot.readListBegin();
struct.iterators = new ArrayList<TIteratorSetting>(_list106.size);
for (int _i107 = 0; _i107 < _list106.size; ++_i107)
TIteratorSetting _elem108; // required
_elem108 = new TIteratorSetting();
_elem108.read(iprot);
struct.iterators.add(_elem108);
for (TIteratorSetting _iter109 : struct.iterators)
_iter109.write(oprot);
for (TIteratorSetting _iter110 : struct.iterators)
_iter110.write(oprot);
org.apache.thrift.protocol.TList _list111 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
struct.iterators = new ArrayList<TIteratorSetting>(_list111.size);
for (int _i112 = 0; _i112 < _list111.size; ++_i112)
TIteratorSetting _elem113; // required
_elem113 = new TIteratorSetting();
_elem113.read(iprot);
struct.iterators.add(_elem113);
|
Either log or rethrow this exception.
|
/*
* 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.client.BatchWriterConfig;
BatchWriter bw = this.getConnector().createBatchWriter(table, new BatchWriterConfig());
|
Remove this unused method parameter "e".
|
import org.apache.accumulo.core.security.tokens.PasswordToken;
|
1 duplicated blocks of code must be removed.
|
SimpleTimer.getInstance().schedule(new Runnable() {
|
Return empty string instead.
|
import org.apache.accumulo.core.cli.ClientOnRequiredTable;
import com.beust.jcommander.Parameter;
static class Opts extends ClientOnRequiredTable {
@Parameter(names="--output", description="output directory", required=true)
String output;
@Parameter(names="--columns", description="columns to extract, in cf:cq{,cf:cq,...} form")
String columns;
}
Opts opts = new Opts();
opts.parseArgs(getClass().getName(), args);
opts.setAccumuloConfigs(job);
for (String col : opts.columns.split(",")) {
TextOutputFormat.setOutputPath(job, new Path(opts.output));
|
Remove this unused private "appendProp" method.
|
@Override
public void visit(State state, Properties props) throws Exception {
Connector conn = SecurityHelper.getSystemConnector(state);
String tableUserName = SecurityHelper.getTabUserName(state);
boolean exists = SecurityHelper.getTabUserExists(state);
boolean hasPermission = false;
if (SecurityHelper.getSysPerm(state, SecurityHelper.getSysUserName(state), SystemPermission.CREATE_USER)) hasPermission = true;
byte[] tabUserPass = "Super Sekret Table User Password".getBytes();
try {
conn.securityOperations().createUser(tableUserName, tabUserPass, new Authorizations());
} catch (AccumuloSecurityException ae) {
switch (ae.getErrorCode()) {
case PERMISSION_DENIED:
if (hasPermission) throw new AccumuloException("Got a security exception when I should have had permission.", ae);
else
// create user anyway for sake of state
{
if (!exists) {
state.getConnector().securityOperations().createUser(tableUserName, tabUserPass, new Authorizations());
SecurityHelper.setTabUserPass(state, tabUserPass);
SecurityHelper.setTabUserExists(state, true);
return;
}
case USER_EXISTS:
if (!exists) throw new AccumuloException("Got security exception when the user shouldn't have existed", ae);
else return;
default:
throw new AccumuloException("Got unexpected exception", ae);
}
SecurityHelper.setTabUserPass(state, tabUserPass);
SecurityHelper.setTabUserExists(state, true);
if (!hasPermission) throw new AccumuloException("Didn't get Security Exception when we should have");
}
|
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
|
@Test(timeout = 60 * 1000)
|
Either log or rethrow this exception.
|
if (o instanceof MockServer)
return name.compareTo(((MockServer) o).name);
if (newLoggers.size() >= numberOfLoggers)
break;
if (!result.containsKey(logger))
result.put(logger, 0);
|
Remove this call to "exit" or ensure it is really required.
|
import java.util.concurrent.TimeUnit;
import org.apache.accumulo.core.client.Connector;
import org.junit.Test;
public class BatchWriterFlushIT extends MacTest {
@Test(timeout=30*1000)
Connector c = getConnector();
c.tableOperations().create("bwft");
c.tableOperations().create("bwlt");
// should automatically flush after 2 seconds
BatchWriter bw = getConnector().createBatchWriter("bwlt", new BatchWriterConfig().setMaxLatency(1000, TimeUnit.MILLISECONDS));
UtilWaitThread.sleep(500);
UtilWaitThread.sleep(1500);
|
Use "Long.toString" instead.
|
import org.apache.accumulo.core.util.Pair;
Pair<Text,Text> pcic = ColumnSet.decodeColumns(column);
if (pcic.getSecond() == null) {
addObject(pcic.getFirst(), clazz.newInstance());
addObject(pcic.getFirst(), pcic.getSecond(), clazz.newInstance());
|
1 duplicated blocks of code must be removed.
|
import org.apache.accumulo.start.classloader.vfs.MiniDFSUtil;
private MiniDFSCluster miniDFS = null;
private List<Process> cleanup = new ArrayList<Process>();
Process proc = exec(clazz, Collections.singletonList("-Xmx" + config.getDefaultMemory()), args);
cleanup.add(proc);
return proc;
File dfs = new File(config.getAccumuloDir(), "dfs");
dfs.mkdirs();
conf.set("dfs.datanode.synconclose", "true");
conf.set("dfs.datanode.data.dir.perm", MiniDFSUtil.computeDatanodeDirectoryPermission());
String oldTestBuildData = System.setProperty("test.build.data", dfs.getAbsolutePath());
if (oldTestBuildData == null)
System.clearProperty("test.build.data");
else
System.setProperty("test.build.data", oldTestBuildData);
writeConfig(coreFile, Collections.singletonMap("fs.default.name", uri).entrySet());
writeConfig(hdfsFile, conf);
writeConfig(siteFile, config.getSiteConfig().entrySet());
private void writeConfig(File file, Iterable<Map.Entry<String, String>> settings) throws IOException {
for (Entry<String,String> entry : settings) {
String value = entry.getValue().replace("&", "&").replace("<", "<").replace(">", ">");
fileWriter.append("<property><name>" + entry.getKey() + "</name><value>" + value + "</value></property>\n");
}
// sleep a little bit to let zookeeper come up before calling init, seems to work better
UtilWaitThread.sleep(250);
int ret = 0;
for (int i = 0; i < 5; i++) {
ret = exec(Main.class, SetGoalState.class.getName(), MasterGoalState.NORMAL.toString()).waitFor();
if (ret == 0)
break;
UtilWaitThread.sleep(1000);
}
for (Process p : cleanup)
p.destroy();
Runtime.getRuntime().exec("pkill -f " + config.getDir().getAbsolutePath());
|
Either log or rethrow this exception.
|
import org.apache.accumulo.core.Constants;
for (KeyExtent ke : unassigned.keySet()) {
for (Entry<TServerInstance,TabletServerStatus> e : current.entrySet()) {
for (String table : e.getValue().getTableMap().keySet()) {
if (!moveMetadata && Constants.METADATA_TABLE_NAME.equals(table))
public void init(ServerConfiguration conf) {}
|
Immediately return this expression instead of assigning it to the temporary variable "client".
|
* 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 interface ABlockReader extends DataInput {
public long getRawSize();
public DataInputStream getStream() throws IOException;
public void close() throws IOException;
|
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
|
package org.apache.accumulo.fate.zookeeper;
import org.apache.accumulo.fate.util.UtilWaitThread;
|
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.
|
import static org.apache.accumulo.core.util.ByteBufferUtil.toBytes;
import java.io.DataInput;
|
Replace all tab characters in this file by sequences of white-spaces.
|
AccumuloInputFormat.setInputInfo(job.getConfiguration(), args[0], args[1].getBytes(), args[2], new Authorizations());
AccumuloInputFormat.setZooKeeperInstance(job.getConfiguration(), args[3], args[4]);
|
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.
*/
@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]*$'.
|
* 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.
*/
setDaemon(true);
public Daemon(ThreadGroup group, Runnable target, String name, long stackSize) {
|
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
|
ArgumentChecker.notNull(instance, credentials, table);
if (config == null)
config= new BatchWriterConfig();
|
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
|
private static class SimpleCacheEntry implements CacheEntry {
private byte[] buffer;
private Object index;
SimpleCacheEntry(byte[] buffer) {
this.buffer = buffer;
}
@Override
public byte[] getBuffer() {
return buffer;
}
@Override
public Object getIndex() {
return index;
}
@Override
public void setIndex(Object idx) {
this.index = idx;
}
}
private static class Ref extends SoftReference<SimpleCacheEntry> {
public Ref(String blockId, SimpleCacheEntry sce, ReferenceQueue<SimpleCacheEntry> q) {
super(sce, q);
private ReferenceQueue<SimpleCacheEntry> q = new ReferenceQueue<SimpleCacheEntry>();
public synchronized SimpleCacheEntry getBlock(String blockName) {
public synchronized SimpleCacheEntry cacheBlock(String blockName, byte buf[]) {
SimpleCacheEntry sce = new SimpleCacheEntry(buf);
cache.put(blockName, new Ref(blockName, sce, q));
return sce;
public synchronized SimpleCacheEntry cacheBlock(String blockName, byte buf[], boolean inMemory) {
SimpleCacheEntry sce = new SimpleCacheEntry(buf);
cache.put(blockName, new Ref(blockName, sce, q));
return sce;
@Override
public long getMaxSize() {
return Long.MAX_VALUE;
}
|
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
|
* Autogenerated by Thrift Compiler (0.9.0)
import org.apache.thrift.protocol.TProtocolException;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.TException;
private byte __isset_bitfield = 0;
__isset_bitfield = other.__isset_bitfield;
__isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __MORE_ISSET_ID);
return EncodingUtils.testBit(__isset_bitfield, __MORE_ISSET_ID);
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __MORE_ISSET_ID, value);
// check for sub-struct validity
__isset_bitfield = 0;
|
Rename this class name 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.
|
* @deprecated since 1.4, replaced by {@link org.apache.accumulo.core.iterators.system.VisibilityFilter}
|
Either log or rethrow this exception.
|
import org.apache.accumulo.core.metadata.MetadataServicer;
import org.apache.accumulo.core.metadata.MetadataTable;
import org.apache.accumulo.core.metadata.RootTable;
TabletLocator tabLocator = TabletLocator.getLocator(instance, new Text(tableId));
TreeMap<KeyExtent,String> tabletLocations = new TreeMap<KeyExtent,String>();
tabletLocations.clear();
MetadataServicer.forTableId(instance, credentials, tableId).getTabletLocations(tabletLocations);
} catch (Exception e) {
if (e instanceof RuntimeException && e.getCause() instanceof AccumuloSecurityException) {
throw (AccumuloSecurityException) e.getCause();
log.info(e.getMessage() + " ... retrying ...");
ArrayList<Text> endRows = new ArrayList<Text>(tabletLocations.size());
for (KeyExtent ke : tabletLocations.keySet())
TabletLocator tl = TabletLocator.getLocator(instance, new Text(tableId));
TabletLocator tabLocator = TabletLocator.getLocator(instance, new Text(Tables.getTableId(instance, tableName)));
|
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
|
import org.apache.accumulo.core.security.tokens.UserPassToken;
AuditedSecurityOperation.getInstance(iid).initializeSecurity(SecurityConstants.getSystemCredentials(), new UserPassToken(ROOT_USER, opts.rootpass));
|
Immediately return this expression instead of assigning it to the temporary variable "ret".
|
import org.apache.accumulo.start.classloader.vfs.ContextManager.ContextsConfig;
cm.setContextConfig(new ContextsConfig() {
public ContextConfig getContextConfig(String context) {
return new ContextConfig(new Path(TEST_DIR, "HelloWorld.jar").toUri().toString(), true);
return new ContextConfig(new Path(TEST_DIR2, "HelloWorld.jar").toUri().toString(), true);
@Test
public void testPostDelegation() throws Exception {
final VFSClassLoader parent = new VFSClassLoader(new FileObject[] {vfs.resolveFile(new Path(TEST_DIR, "HelloWorld.jar").toUri().toString())}, vfs);
Class<?> pclass = parent.loadClass("test.HelloWorld");
ContextManager cm = new ContextManager(vfs, new ReloadingClassLoader() {
@Override
public ClassLoader getClassLoader() {
return parent;
}
});
cm.setContextConfig(new ContextsConfig() {
@Override
public ContextConfig getContextConfig(String context) {
if (context.equals("CX1")) {
return new ContextConfig(new Path(TEST_DIR2, "HelloWorld.jar").toUri().toString(), true);
} else if (context.equals("CX2")) {
return new ContextConfig(new Path(TEST_DIR2, "HelloWorld.jar").toUri().toString(), false);
}
return null;
}
});
Assert.assertTrue(cm.getClassLoader("CX1").loadClass("test.HelloWorld") == pclass);
Assert.assertFalse(cm.getClassLoader("CX2").loadClass("test.HelloWorld") == pclass);
}
|
Either log or rethrow this exception.
|
{
disableUnflaggedTableOptions();
}
|
Move the "y" string literal on the left side of this string comparison.
|
package org.apache.accumulo.server.tabletserver.compaction;
import java.util.ArrayList;
import java.util.List;
import org.apache.accumulo.server.fs.FileRef;
/**
* Information about a single compaction pass: input files and the number of output files to write.
* Presently, the number of output files must always be 1.
*/
public class CompactionPass {
public List<FileRef> inputFiles = new ArrayList<FileRef>();
public int outputFiles = 1;
public String toString() {
return inputFiles.toString() + " -> " + outputFiles + " files";
}
}
|
Immediately return this expression instead of assigning it to the temporary variable "openReader".
|
import org.apache.accumulo.core.security.Authorizations;
Scanner scanner = getConnector().createScanner("foo", Authorizations.EMPTY);
|
Remove this unused method parameter "range".
|
import org.apache.accumulo.core.iterators.IteratorUtil.IteratorScope;
|
Either log or rethrow this exception.
|
public int execute(final String fullCommand, final CommandLine cl, final Shell shellState) throws Exception {
final String tableName = OptUtil.getTableOpt(cl, shellState);
if (cl.getArgList().isEmpty()) {
}
final Class<? extends Formatter> formatter = getFormatter(cl, tableName, shellState);
final ScanInterpreter interpeter = getInterpreter(cl, tableName, shellState);
final Authorizations auths = getAuths(cl, shellState);
final BatchScanner scanner = shellState.getConnector().createBatchScanner(tableName, auths, numThreads);
for (int i = 0; i < cl.getArgs().length; i++) {
}
protected void setUpIterator(final int prio, final String name, final String term, final BatchScanner scanner) throws IOException {
if (prio < 0) {
}
final IteratorSetting grep = new IteratorSetting(prio, name, GrepIterator.class);
final Options opts = super.getOptions();
|
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
|
import org.apache.accumulo.server.conf.ServerConfiguration;
/*
* (non-Javadoc)
*
* @see org.apache.accumulo.server.master.balancer.TabletBalancer#init(org.apache.accumulo.server.conf.ServerConfiguration)
*/
@Override
public void init(ServerConfiguration conf) {
}
|
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
|
import java.io.IOException;
import org.apache.hadoop.mapreduce.Job;
public void testNoSubBins() throws IOException {
public void testSubBins() throws IOException {
private RangePartitioner prepPartitioner(int numSubBins) throws IOException {
Job job = new Job();
private void checkExpectedRangeBins(int numSubBins, String[] strings, int[] rangeEnds) throws IOException {
private void checkExpectedBins(int numSubBins, String[] strings, int[] bins) throws IOException {
|
Remove this unused private "appendProp" method.
|
import org.apache.accumulo.core.cli.ClientOnRequiredTable;
import com.beust.jcommander.Parameter;
private final BatchWriter bw;
private final long iterations;
Writer(BatchWriter bw, long iterations) {
this.iterations = iterations;
static class Opts extends ClientOnRequiredTable {
@Parameter(names="--iterations", description="number of times to run", required=true)
long iterations = 0;
@Parameter(names="--isolated", description="use isolated scans")
boolean isolated = false;
}
Opts opts = new Opts();
opts.parseArgs(InterferenceTest.class.getName(), args);
if (opts.iterations < 1)
opts.iterations = Long.MAX_VALUE;
Connector conn = opts.getConnector();
if (!conn.tableOperations().exists(opts.tableName))
conn.tableOperations().create(opts.tableName);
Thread writer = new Thread(new Writer(conn.createBatchWriter(opts.tableName, opts.getBatchWriterConfig()), opts.iterations));
if (opts.isolated)
r = new Reader(new IsolatedScanner(conn.createScanner(opts.tableName, opts.auths)));
r = new Reader(conn.createScanner(opts.tableName, opts.auths));
|
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.
|
import org.apache.accumulo.core.security.thrift.TCredentials;
import org.apache.accumulo.core.security.tokens.AuthenticationToken;
TCredentials auth;
for (int i = 0; i < newPassw.length; i++)
newPassw[i] = (byte) ((r.nextInt(26) + 65) & 0xFF);
AuthenticationToken newPass = new PasswordToken(newPassw);
|
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
|
* Minimal interface to write a block to a
*
|
Replace all tab characters in this file by sequences of white-spaces.
|
import org.apache.accumulo.core.cli.Help;
import org.apache.accumulo.server.client.HdfsZooInstance;
Help opts = new Help();
Instance instance = HdfsZooInstance.getInstance();
|
Remove this unused method parameter "opts".
|
import org.junit.Assert;
|
Remove this unused private "appendProp" method.
|
public static final ThreadLocal<String> clientAddress = new ThreadLocal<String>();
|
Make this member "protected".
|
import org.apache.accumulo.fate.Repo;
import org.apache.accumulo.fate.zookeeper.IZooReaderWriter;
import org.apache.accumulo.fate.zookeeper.ZooUtil.NodeExistsPolicy;
|
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.
|
AccumuloInputFormat.setInputInfo(job.getConfiguration(), args[0], args[1].getBytes(), args[2], new Authorizations());
AccumuloInputFormat.setZooKeeperInstance(job.getConfiguration(), args[3], args[4]);
|
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.
*/
List<Long> sums = new ArrayList<Long>();
@Override
public void reset() {
sums.clear();
}
@Override
public void collect(Value value) {
String[] longs = value.toString().split(",");
int i;
for (i = 0; i < sums.size() && i < longs.length; i++) {
sums.set(i, NumSummation.safeAdd(sums.get(i).longValue(), Long.parseLong(longs[i])));
}
for (; i < longs.length; i++) {
sums.add(Long.parseLong(longs[i]));
}
}
@Override
public Value aggregate() {
return new Value(longArrayToStringBytes(sums.toArray(new Long[sums.size()])));
}
public static byte[] longArrayToStringBytes(Long[] l) {
if (l.length == 0) return new byte[] {};
StringBuilder sb = new StringBuilder(Long.toString(l[0]));
for (int i = 1; i < l.length; i++) {
sb.append(",");
sb.append(Long.toString(l[i]));
}
return sb.toString().getBytes();
}
|
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
|
TABLE_SCAN_MAXMEM("table.scan.max.memory", "512K", PropertyType.MEMORY,
|
Merge this if statement with the enclosing one.
|
import org.apache.accumulo.trace.instrument.receivers.SendSpansViaThrift;
|
Remove the redundant '!unknownSymbol!' thrown exception declaration(s).
|
return "lists what scans are currently running in accumulo. See the accumulo.core.client.admin.ActiveScan javadoc for more information about columns.";
tserverOption = new Option("ts", "tabletServer", true, "tablet server to list scans for");
disablePaginationOpt = new Option("np", "no-pagination", false, "disable pagination of output");
|
2 duplicated blocks of code must be removed.
|
super.next();
|
At most one statement is allowed per line, but 2 statements were found on this line.
|
package org.apache.accumulo.server.monitor.util.celltypes;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
public class DateTimeType extends CellType<Long> {
private SimpleDateFormat simple;
private int dateFormat;
private int timeFormat;
public DateTimeType(int dateFormat, int timeFormat) {
this.dateFormat = dateFormat;
this.timeFormat = timeFormat;
this.simple = null;
}
public DateTimeType(SimpleDateFormat fmt) {
simple = fmt;
}
@Override
public String format(Object obj) {
if (obj == null)
return "-";
Long millis = (Long) obj;
if (millis == 0)
return "-";
if (simple != null)
return simple.format(new Date(millis)).replace(" ", " ");
return DateFormat.getDateTimeInstance(dateFormat, timeFormat, Locale.getDefault()).format(new Date(millis)).replace(" ", " ");
}
@Override
public int compare(Long o1, Long o2) {
if (o1 == null && o2 == null)
return 0;
else if (o1 == null)
return -1;
else
return o1.compareTo(o2);
}
@Override
public String alignment() {
return "right";
}
}
|
Return empty string instead.
|
if (endRow == null && prevEndRow == null)
mi = new MultiIterator(iters, init);
if (init)
for (SortedKeyValueIterator<Key,Value> iter : iters)
iter.seek(range, LocalityGroupUtil.EMPTY_CF_SET, false);
if (init)
mi.seek(range, LocalityGroupUtil.EMPTY_CF_SET, false);
if (seekKey != null)
mi.seek(new Range(seekKey, null), EMPTY_COL_FAMS, false);
else
mi.seek(new Range(), EMPTY_COL_FAMS, false);
if (incrRow)
assertEquals(nk(i, 0), mi.getTopKey());
else
assertEquals(nk(0, i), mi.getTopKey());
if (incrRow)
i++;
else
i--;
if (i % 2 == 0)
nkv(tm1, 0, i, false, "v" + i);
else
nkv(tm2, 0, i, false, "v" + i);
if (i % 2 == 0)
nkv(tm1, i, 0, false, "v" + i);
else
nkv(tm2, i, 0, false, "v" + i);
if (start > er)
end = start;
if (per >= 8)
end = start;
|
Remove this call to "exit" or ensure it is really required.
|
package org.apache.accumulo.test.functional;
|
Move the "org.apache.accumulo.test.randomwalk.unit.CreateTable" string literal on the left side of this string comparison.
|
/*
* 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.tokens.PasswordToken;
AccumuloInputFormat.setConnectorInfo(job, user, new PasswordToken().setPassword(pass.getBytes()));
AccumuloOutputFormat.setConnectorInfo(job, user, new PasswordToken().setPassword(pass.getBytes()));
|
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
|
import org.apache.accumulo.cloudtrace.thrift.RemoteSpan;
|
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
|
org.apache.thrift.protocol.TList _list118 = iprot.readListBegin();
this.mutations = new ArrayList<TabletMutations>(_list118.size);
for (int _i119 = 0; _i119 < _list118.size; ++_i119)
TabletMutations _elem120;
_elem120 = new TabletMutations();
_elem120.read(iprot);
this.mutations.add(_elem120);
for (TabletMutations _iter121 : this.mutations)
_iter121.write(oprot);
org.apache.thrift.protocol.TList _list122 = iprot.readListBegin();
this.success = new ArrayList<String>(_list122.size);
for (int _i123 = 0; _i123 < _list122.size; ++_i123)
String _elem124;
_elem124 = iprot.readString();
this.success.add(_elem124);
for (String _iter125 : this.success)
oprot.writeString(_iter125);
org.apache.thrift.protocol.TList _list126 = iprot.readListBegin();
this.files = new ArrayList<String>(_list126.size);
for (int _i127 = 0; _i127 < _list126.size; ++_i127)
String _elem128;
_elem128 = iprot.readString();
this.files.add(_elem128);
for (String _iter129 : this.files)
oprot.writeString(_iter129);
|
Use "Long.toString" instead.
|
ZooReaderWriter.getInstance().putPersistentData(zPath, value.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.
*/
|
Remove this unused private "appendProp" method.
|
import org.apache.accumulo.core.util.MetadataTable;
if (tableName.equals(MetadataTable.NAME)) {
Shell.log.info(" The " + MetadataTable.NAME + " is always online.");
|
Use "Long.toString" instead.
|
import org.apache.accumulo.core.security.Authorizations;
Scanner scanner = getConnector().createScanner(table, Authorizations.EMPTY);
|
Remove this unused method parameter "range".
|
if (super.validateOptions(options) == false)
return false;
try {
setLossyness(options);
} catch (Exception e) {
throw new IllegalArgumentException("bad boolean " + LOSSY + ":" + options.get(LOSSY));
}
|
Return empty string instead.
|
private static final Logger log = Logger.getLogger(VerifyIngest.class);
public static void main(String[] args) throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
if (args.length != 7) {
System.err.println("VerifyIngest <instance name> <zoo keepers> <username> <password> <table> <startRow> <numRows> ");
return;
}
String instanceName = args[0];
String zooKeepers = args[1];
String user = args[2];
byte[] pass = args[3].getBytes();
String table = args[4];
int startRow = Integer.parseInt(args[5]);
int numRows = Integer.parseInt(args[6]);
Instance instance = new ZooKeeperInstance(instanceName, zooKeepers);
Connector connector = instance.getConnector(user, pass);
Scanner scanner = connector.createScanner(table, Constants.NO_AUTHS);
scanner.setRange(new Range(new Text(String.format("row_%08d", startRow)), null));
Iterator<Entry<Key,Value>> si = scanner.iterator();
boolean ok = true;
for (int i = startRow; i < numRows; i++) {
if (si.hasNext()) {
Entry<Key,Value> entry = si.next();
if (!entry.getKey().getRow().toString().equals(String.format("row_%08d", i))) {
log.error("unexpected row key " + entry.getKey().getRow().toString() + " expected " + String.format("row_%08d", i));
ok = false;
if (!entry.getValue().toString().equals(String.format("value_%08d", i))) {
log.error("unexpected value " + entry.getValue().toString() + " expected " + String.format("value_%08d", i));
ok = false;
}
} else {
log.error("no more rows, expected " + String.format("row_%08d", i));
ok = false;
break;
}
if (ok) System.out.println("OK");
System.exit(ok ? 0 : 1);
}
|
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
|
import jline.console.ConsoleReader;
|
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.
|
/*
* 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.Credentials;
import org.apache.accumulo.core.util.ByteBufferUtil;
@SuppressWarnings("deprecation")
// Not really deprecated, just not for client use
return new ConnectorImpl(this, user, pass);
@SuppressWarnings("deprecation")
// Not really deprecated, just not for client use
return new ConnectorImpl(this, user, ByteBufferUtil.toBytes(pass));
public Connector getConnector(Credentials auth) throws AccumuloException, AccumuloSecurityException {
return getConnector(auth.getPrincipal(), auth.getToken());
public String getAuthenticatorClassName() throws AccumuloException {
return client.getAuthenticatorClassName();
|
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
|
import org.apache.accumulo.core.cli.BatchWriterOpts;
import org.apache.accumulo.core.cli.ScannerOpts;
ScannerOpts scanOpts = new ScannerOpts();
BatchWriterOpts bwOpts = new BatchWriterOpts();
opts.parseArgs(Reverse.class.getName(), args, scanOpts, bwOpts);
scanner.setBatchSize(scanOpts.scanBatchSize);
BatchWriter bw = conn.createBatchWriter(opts.doc2TermTable, bwOpts.getBatchWriterConfig());
|
Remove this unused method parameter "opts".
|
package org.apache.accumulo.fate.zookeeper;
|
Remove this call to "exit" or ensure it is really required.
|
import org.apache.accumulo.core.metadata.MetadataTable;
import org.apache.accumulo.core.metadata.RootTable;
|
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.
*/
@SuppressWarnings("all") public enum SystemPermission implements org.apache.thrift.TEnum {
|
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
|
stats.update(tss.extent, tss.getState(state.onlineTabletServers()), tss.chopped, false);
|
The Cyclomatic Complexity of this method "update" is 13 which is greater than 10 authorized.
|
package org.apache.accumulo.server;
import org.apache.accumulo.core.conf.Property;
import org.apache.accumulo.server.conf.ServerConfiguration;
import org.apache.hadoop.fs.Path;
import static org.apache.accumulo.core.Constants.*;
public class ServerConstants {
// these are functions to delay loading the Accumulo configuration unless we must
public static String getBaseDir() {
return ServerConfiguration.getSiteConfiguration().get(Property.INSTANCE_DFS_DIR);
}
public static String getTablesDir() {
return getBaseDir() + "/tables";
}
public static String getRecoveryDir() {
return getBaseDir() + "/recovery";
}
public static Path getInstanceIdLocation() {
return new Path(getBaseDir() + "/instance_id");
}
public static Path getDataVersionLocation() {
return new Path(getBaseDir() + "/version");
}
public static String getMetadataTableDir() {
return getTablesDir() + "/" + METADATA_TABLE_ID;
}
public static String getRootTabletDir() {
return getMetadataTableDir()+ZROOT_TABLET;
}
}
|
Return empty string instead.
|
import org.apache.accumulo.core.security.thrift.TCredentials;
private TCredentials credentials;
public TabletServerBatchWriter(Instance instance, TCredentials credentials, BatchWriterConfig config) {
|
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
|
import org.apache.accumulo.server.tabletserver.log.DfsLogger.LoggerOperation;
private final List<DfsLogger> loggers = new ArrayList<DfsLogger>();
private int initializeLoggers(final List<DfsLogger> copy) throws IOException {
for (DfsLogger logger : loggers) {
loggersOut.add(logger.toString());
DfsLogger alog = new DfsLogger(tserver.getServerConfig());
alog.open(tserver.getClientAddressString());
loggers.add(alog);
throw new RuntimeException(t);
for (DfsLogger logger : loggers) {
} catch (DfsLogger.LogClosedException ex) {
// ignore
log.error("Unable to cleanly close log " + logger.getFileName() + ": " + ex);
LoggerOperation write(DfsLogger logger, int seq) throws Exception;
ArrayList<DfsLogger> copy = new ArrayList<DfsLogger>();
for (DfsLogger wal : copy) {
} catch (DfsLogger.LogClosedException ex) {
log.debug("Logs closed while writing, retrying " + (attempt + 1));
log.error("Unexpected error writing to log, retrying attempt " + (attempt + 1), t);
UtilWaitThread.sleep(100);
public LoggerOperation write(DfsLogger logger, int ignored) throws Exception {
public LoggerOperation write(DfsLogger logger, int ignored) throws Exception {
public LoggerOperation write(DfsLogger logger, int ignored) throws Exception {
public LoggerOperation write(DfsLogger logger, int ignored) throws Exception {
public LoggerOperation write(DfsLogger logger, int ignored) throws Exception {
|
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
|
public interface CacheEntry {
byte[] getBuffer();
public Object getIndex();
public void setIndex(Object idx);
|
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
|
package org.apache.accumulo.core.security.tokens;
|
1 duplicated blocks of code must be removed.
|
return "lists table-specific iterators configured in this shell session";
|
Remove the redundant '!unknownSymbol!' thrown exception declaration(s).
|
shellState.updateUser(CredentialHelper.create(user, new PasswordToken(pass), shellState.getConnector().getInstance().getInstanceID()));
|
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
|
protected Encoder<V> encoder;
private static class VIterator<V> implements Iterator<V> {
private Iterator<Value> source;
private Encoder<V> encoder;
VIterator(Iterator<Value> iter, Encoder<V> encoder) {
this.source = iter;
this.encoder = encoder;
@Override
public boolean hasNext() {
return source.hasNext();
}
@Override
public V next() {
if (!source.hasNext()) throw new NoSuchElementException();
return encoder.decode(source.next().get());
public void remove() {
source.remove();
}
public static interface Encoder<V> {
public byte[] encode(V v);
public V decode(byte[] b);
}
@Override
public Value reduce(Key key, Iterator<Value> iter) {
return new Value(encoder.encode(typedReduce(key, new VIterator<V>(iter, encoder))));
}
public abstract V typedReduce(Key key, Iterator<V> iter);
|
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
|
package org.apache.accumulo.examples.wikisearch.ingest;
import org.apache.accumulo.examples.wikisearch.ingest.ArticleExtractor.Article;
import org.apache.accumulo.examples.wikisearch.normalizer.LcNoDiacriticsNormalizer;
import org.apache.accumulo.examples.wikisearch.protobuf.Uid;
import org.apache.accumulo.examples.wikisearch.protobuf.Uid.List.Builder;
|
2 duplicated blocks of code must be removed.
|
package org.apache.accumulo.trace.instrument.thrift;
import org.apache.accumulo.trace.instrument.Span;
import org.apache.accumulo.trace.instrument.Trace;
import org.apache.accumulo.trace.instrument.Tracer;
import org.apache.accumulo.trace.thrift.TInfo;
|
Remove the redundant '!unknownSymbol!' thrown exception declaration(s).
|
import org.apache.accumulo.core.security.Credentials;
public RootTabletStateStore(Instance instance, Credentials credentials, CurrentState state) {
super(instance, credentials, state, RootTable.NAME);
return new MetaDataTableScanner(instance, credentials, MetadataSchema.TabletsSection.getRange(), state, RootTable.NAME);
|
Immediately return this expression instead of assigning it to the temporary variable "onlineTabletsForTable".
|
public static final Map<TabletType,Set<String>> serversWaitedForWrites = new EnumMap<TabletType,Set<String>>(TabletType.class);
|
Remove this unused private "appendProp" method.
|
private Option removeFormatterOption, formatterClassOption, listClassOption;
String tableName = OptUtil.configureTableOpt(cl, shellState);
Entry<String,String> ent = iter.next();
Iterator<Entry<String,String>> props;
Entry<String,String> ent = props.next();
o.addOption(OptUtil.tableOpt("table to set the formatter on"));
|
Reduce this switch case number of lines from 8 to at most 5, for example by extracting code into methods.
|
package org.apache.accumulo.core.util.format;
import java.util.Iterator;
import java.util.Map.Entry;
import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.Value;
public interface Formatter extends Iterator<String>
{
public void initialize(Iterable<Entry<Key, Value>> scanner, boolean printTimestamps);
}
|
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.
|
if (expectInitialized && si == null)
throw new IllegalStateException("Not initialized");
if (!expectInitialized && si != null)
throw new IllegalStateException("Already initialized");
if (showTimestamps)
sb.append(" ").append(entry.getKey().getTimestamp());
if (c == '\\')
sb.append("\\\\");
else if (c >= 32 && c <= 126)
sb.append((char) c);
else
sb.append("\\x").append(String.format("%02X", c));
|
Remove this call to "exit" or ensure it is really required.
|
public <T extends Mutation> void binMutations(List<T> mutations, Map<String,TabletServerMutations<T>> binnedMutations, List<T> failures,
TCredentials credentials) throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
TabletServerMutations<T> tsm = new TabletServerMutations<T>();
for (T m : mutations)
|
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
|
import java.io.File;
+ "If delegation is not specified, it defaults to loading from parent classloader first."),
VFS_CLASSLOADER_CACHE_DIR(
AccumuloVFSClassLoader.VFS_CACHE_DIR,
new File(System.getProperty("java.io.tmpdir"), "accumulo-vfs-cache")
.getAbsolutePath(),
PropertyType.ABSOLUTEPATH,
"Directory to use for the vfs cache. The cache will keep a soft reference to all of the classes loaded in the VM. This should be on local disk on each node with sufficient space. It defaults to /tmp",
false);
|
Either log or rethrow this exception.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.