Diff stringlengths 10 2k | Message stringlengths 28 159 |
|---|---|
@SuppressWarnings("all") public class TableInfo implements org.apache.thrift.TBase<TableInfo, TableInfo._Fields>, java.io.Serializable, Cloneable { | 13 duplicated blocks of code must be removed. |
public static void main(String[] args) throws Exception {
if (args.length != 6) {
System.err.println("Usage : " + Reverse.class.getName() + " <instance> <zoo keepers> <shard table> <doc2word table> <user> <pass>");
System.exit(-1);
String instance = args[0];
String zooKeepers = args[1];
String inTable = args[2];
String outTable = args[3];
String user = args[4];
String pass = args[5];
ZooKeeperInstance zki = new ZooKeeperInstance(instance, zooKeepers);
Connector conn = zki.getConnector(user, pass.getBytes());
Scanner scanner = conn.createScanner(inTable, Constants.NO_AUTHS);
BatchWriter bw = conn.createBatchWriter(outTable, 50000000, 600000l, 4);
for (Entry<Key,Value> entry : scanner) {
Key key = entry.getKey();
Mutation m = new Mutation(key.getColumnQualifier());
m.put(key.getColumnFamily(), new Text(), new Value(new byte[0]));
bw.addMutation(m);
}
bw.close();
} | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
import org.apache.accumulo.core.file.blockfile.impl.CachableBlockFile;
import org.apache.accumulo.core.file.rfile.RFile;
import org.apache.accumulo.core.file.rfile.RFile.Reader;
import org.apache.accumulo.server.tabletserver.compaction.WriteParameters;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
public class ConfigurableMajorCompactionIT extends ConfigurableMacIT {
public static class TestCompactionStrategy extends CompactionStrategy {
if (request.getFiles().size() != 5)
return null;
plan.writeParameters = new WriteParameters();
plan.writeParameters.setBlockSize(1024 * 1024);
plan.writeParameters.setCompressType("none");
plan.writeParameters.setHdfsBlockSize(1024 * 1024);
plan.writeParameters.setIndexBlockSize(10);
plan.writeParameters.setReplication(7); | Remove this unused import 'org.apache.hadoop.fs.FileSystem'. |
import org.junit.Test;
public class CreateManyScannersIT extends MacTest {
@Test(timeout=10*1000)
Connector c = getConnector();
c.tableOperations().create("mscant");
c.createScanner("mscant", Authorizations.EMPTY); | Use "Integer.toString" instead. |
import org.apache.accumulo.core.iterators.user.RowDeletingIterator; | Remove the literal "false" boolean value. |
@SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum { | 300 duplicated blocks of code must be removed. |
import java.util.concurrent.atomic.AtomicLong;
import org.apache.accumulo.core.iterators.IteratorEnvironment;
import org.apache.accumulo.core.iterators.WrappingIterator;
public class CountingIterator extends WrappingIterator {
private long count;
public CountingIterator deepCopy(IteratorEnvironment env) {
return new CountingIterator(this, env);
}
private CountingIterator(CountingIterator other, IteratorEnvironment env) {
setSource(other.getSource().deepCopy(env));
count = 0;
}
public CountingIterator(SortedKeyValueIterator<Key,Value> source) {
this.setSource(source);
count = 0;
}
@Override
public void init(SortedKeyValueIterator<Key,Value> source, Map<String,String> options, IteratorEnvironment env) {
throw new UnsupportedOperationException();
}
@Override
public void next() throws IOException {
super.next();
count++;
if (count % 1024 == 0) {
entriesRead.addAndGet(1024);
}
}
public long getCount() {
return count;
}
}
private AtomicLong entriesRead = new AtomicLong(0);
private AtomicLong entriesWritten = new AtomicLong(0);
private void clearStats() {
entriesRead.set(0);
entriesWritten.set(0);
}
this.localityGroup = compactor.currentLocalityGroup;
this.entriesRead = compactor.entriesRead.get();
this.entriesWritten = compactor.entriesWritten.get();
// Periodically update stats, do not want to do this too often since its volatile
entriesWritten.addAndGet(1024); | Move this constructor to comply with Java Code Conventions. |
scanner.fetchColumnFamily(BulkPlusOne.CHECK_COLUMN_FAMILY); | Remove this unused method parameter "table". |
ByteBuffer login = ByteBuffer.wrap(CredentialHelper.asByteArray(credential));
getConnector(login); // check to make sure user exists
return login; | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
final Option tokenOption = new Option("tc", "tokenClass", true, "token type to create, use the -l to pass options");
final Option loginOption = new Option("l", "tokenProperty", true,
"login properties in the format key=value. Reuse -l for each property and/or comma seperate (prompt for properties if this option is missing");
opts.addOption(tokenOption); | Remove the redundant '!unknownSymbol!' thrown exception declaration(s). |
/*
* 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.TableNotFoundException;
try{
c.tableOperations().delete(METADATA_TABLE_NAME);
} catch (TableNotFoundException tnfe) {}
;
try{
c.tableOperations().delete(TABLE_NAME);
} catch (TableNotFoundException tnfe) {}
;
try{
c.tableOperations().delete(INDEX_TABLE_NAME);
} catch (TableNotFoundException tnfe) {}
;
try{
c.tableOperations().delete(RINDEX_TABLE_NAME);
} catch (TableNotFoundException tnfe) {}
; | Either log or rethrow this exception. |
import org.apache.accumulo.core.trace.TraceFormatter;
connector.tableOperations().setProperty(table, Property.TABLE_FORMATTER_CLASS.getKey(), TraceFormatter.class.getName()); | The Cyclomatic Complexity of this method "update" is 13 which is greater than 10 authorized. |
import org.apache.accumulo.core.client.IteratorSetting;
/**
* Encode the terms to match against in the iterator
*
* @param si
* ScanIterator config to be updated
* @param rowTerm
* the pattern to match against the Key's row. Not used if null.
* @param cfTerm
* the pattern to match against the Key's column family. Not used if null.
* @param cqTerm
* the pattern to match against the Key's column qualifier. Not used if null.
* @param valueTerm
* the pattern to match against the Key's value. Not used if null.
* @param orFields
* if true, any of the non-null terms can match to return the entry
*/
public static void setRegexs(IteratorSetting si, String rowTerm, String cfTerm, String cqTerm, String valueTerm, boolean orFields) {
if (rowTerm != null)
si.addOption(RegExFilter.ROW_REGEX, rowTerm);
if (cfTerm != null)
si.addOption(RegExFilter.COLF_REGEX, cfTerm);
if (cqTerm != null)
si.addOption(RegExFilter.COLQ_REGEX, cqTerm);
if (valueTerm != null)
si.addOption(RegExFilter.VALUE_REGEX, valueTerm);
if (orFields) {
si.addOption(RegExFilter.OR_FIELDS, "true");
}
} | Remove this unused private "match" method. |
public StackOverflowException(String msg) {
super(msg);
}
private static final long serialVersionUID = 1L;
| Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
public static void setOutputInfo(JobContext job, String user, byte[] passwd, boolean createTables, String defaultTable) {
public static void setOutputInfo(Configuration conf, String user, byte[] passwd, boolean createTables, String defaultTable) {
try {
FileSystem fs = FileSystem.get(conf);
Path file = new Path(fs.getWorkingDirectory(), conf.get("mapred.job.name") + System.currentTimeMillis() + ".pw");
conf.set(PASSWORD_PATH, file.toString());
FSDataOutputStream fos = fs.create(file, false);
fs.setPermission(file, new FsPermission(FsAction.ALL, FsAction.NONE, FsAction.NONE));
fs.deleteOnExit(file);
byte[] encodedPw = Base64.encodeBase64(passwd);
fos.writeInt(encodedPw.length);
fos.write(encodedPw);
fos.close();
DistributedCache.addCacheFile(file.toUri(), conf);
} catch (IOException ioe) {
throw new RuntimeException(ioe);
} | Do not forget to remove this deprecated code someday. |
import org.apache.accumulo.core.security.thrift.Credentials;
Credentials auths = SecurityConstants.getSystemCredentials();
conn = HdfsZooInstance.getInstance().getConnector(auths.getPrincipal(), auths.getToken());
Credentials creds = SecurityConstants.getSystemCredentials();
Credentials creds = SecurityConstants.getSystemCredentials(); | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
package org.apache.accumulo.cloudtrace.instrument.impl;
import org.apache.accumulo.cloudtrace.instrument.Span;
| Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
import org.apache.accumulo.core.util.ServerServices.Service;
static volatile boolean warnedAboutTServersBeingDown = false;
warnedAboutTServersBeingDown = false;
if (!opened) {
if (!warnedAboutTServersBeingDown) {
if (servers.isEmpty()) {
log.warn("There are no tablet servers: check that zookeeper and accumulo are running.");
} else {
log.warn("Failed to find an available server in the list of servers: " + servers);
}
warnedAboutTServersBeingDown = true;
}
} | Move this variable to comply with Java Code Conventions. |
public TabletLocations lookupTablet(TabletLocation src, Text row, Text stopRow, TabletLocator parent, TCredentials credentials)
throws AccumuloSecurityException, AccumuloException {
| Do not override the Object.finalize() method. |
if (k.getColumnFamily().equals(QueryUtil.DIR_COLF))
dirCount++;
else
fileCount++;
if (slashIndex >= 0)
prefix = prefix.substring(0, slashIndex + 1);
if (lastRowFound == null)
return; | Remove this call to "exit" or ensure it is really required. |
import org.apache.accumulo.core.security.thrift.Credential;
public RootTabletStateStore(Instance instance, Credential auths, CurrentState state) { | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
public void cleanUp() throws Exception {}
public static void tearDown() throws Exception {} | Define and throw a dedicated exception instead of using a generic one. |
final private DatafileManager datafileManager;
// access to datafilesizes needs to be synchronized: see CompactionRunner#getNumFiles
final private Map<Path,DataFileValue> datafileSizes = Collections.synchronizedMap(new TreeMap<Path,DataFileValue>());
// We used to synchronize on the Tablet before fetching this information,
// but this method is called by the compaction queue thread to re-order the compactions.
// The compaction queue holds a lock during this sort.
// A tablet lock can be held while putting itself on the queue, so we can't lock the tablet
// while pulling information used to sort the tablets in the queue, or we may get deadlocked.
// See ACCUMULO-1110.
return datafileManager.datafileSizes.size(); | Do not forget to remove this deprecated code someday. |
private Option verboseOption;
@Override
public String description() {
return "specifies a file containing accumulo commands to execute";
}
@Override
public int execute(String fullCommand, CommandLine cl, Shell shellState) throws Exception {
java.util.Scanner scanner = new java.util.Scanner(new File(cl.getArgs()[0]));
while (scanner.hasNextLine())
shellState.execCommand(scanner.nextLine(), true, cl.hasOption(verboseOption.getOpt()));
return 0;
}
@Override
public int numArgs() {
return 1;
}
@Override
public Options getOptions() {
Options opts = new Options();
verboseOption = new Option("v", "verbose", false, "displays command prompt as commands are executed");
opts.addOption(verboseOption);
return opts;
} | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
import org.apache.accumulo.start.classloader.vfs.AccumuloVFSClassLoader;
Class<? extends K> clazz = AccumuloVFSClassLoader.loadClass(className, c); | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
tableList.addSortableColumn("Entries<br/>Read", new NumberType<Long>(),
"The number of Key/Value pairs read on the server side. Not all key values read may be returned to client because of filtering.");
tableList.addSortableColumn("Entries<br/>Returned", new NumberType<Long>(),
row.add(tableInfo == null ? null : tableInfo.scanRate); | Use isEmpty() to check whether the collection is empty or not. |
org.apache.thrift.protocol.TList _list62 = iprot.readListBegin();
struct.iterators = new ArrayList<TIteratorSetting>(_list62.size);
for (int _i63 = 0; _i63 < _list62.size; ++_i63)
TIteratorSetting _elem64; // required
_elem64 = new TIteratorSetting();
_elem64.read(iprot);
struct.iterators.add(_elem64);
for (TIteratorSetting _iter65 : struct.iterators)
_iter65.write(oprot);
for (TIteratorSetting _iter66 : struct.iterators)
_iter66.write(oprot);
org.apache.thrift.protocol.TList _list67 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
struct.iterators = new ArrayList<TIteratorSetting>(_list67.size);
for (int _i68 = 0; _i68 < _list67.size; ++_i68)
TIteratorSetting _elem69; // required
_elem69 = new TIteratorSetting();
_elem69.read(iprot);
struct.iterators.add(_elem69); | Replace all tab characters in this file by sequences of white-spaces. |
public class ShutdownIT extends ConfigurableMacIT {
Process ingest = cluster.exec(TestIngest.class, "-i", cluster.getInstanceName(), "-z", cluster.getZooKeepers(), "-p", ROOT_PASSWORD, "--createTable");
assertEquals(0, cluster.exec(TestIngest.class, "-i", cluster.getInstanceName(), "-z", cluster.getZooKeepers(), "-p", ROOT_PASSWORD, "--createTable").waitFor());
Process verify = cluster.exec(VerifyIngest.class, "-i", cluster.getInstanceName(), "-z", cluster.getZooKeepers(), "-p", ROOT_PASSWORD);
assertEquals(0, cluster.exec(TestIngest.class, "-i", cluster.getInstanceName(), "-z", cluster.getZooKeepers(), "-p", ROOT_PASSWORD, "--createTable").waitFor());
Process deleter = cluster.exec(TestRandomDeletes.class, "-i", cluster.getInstanceName(), "-z", cluster.getZooKeepers(), "-p", ROOT_PASSWORD);
assertEquals(0, cluster.exec(TestIngest.class, "-i", cluster.getInstanceName(), "-z", cluster.getZooKeepers(), "-p", ROOT_PASSWORD, "--createTable").waitFor()); | Use "Integer.toString" instead. |
import java.util.ArrayList;
import java.util.List;
public void testBadMutations() throws Exception {
Connector c = new MockConnector("root", new MockInstance());
c.tableOperations().create("test");
BatchWriter bw = c.createBatchWriter("test", 10000L, 1000L, 4);
try {
bw.addMutation(null);
Assert.fail("addMutation should throw IAE for null mutation");
} catch (IllegalArgumentException iae) {}
try {
bw.addMutations(null);
Assert.fail("addMutations should throw IAE for null iterable");
} catch (IllegalArgumentException iae) {}
bw.addMutations(Collections.EMPTY_LIST);
Mutation bad = new Mutation("bad");
try {
bw.addMutation(bad);
Assert.fail("addMutation should throw IAE for empty mutation");
} catch (IllegalArgumentException iae) {}
Mutation good = new Mutation("good");
good.put(asText(random.nextInt()), asText(random.nextInt()), new Value("good".getBytes()));
List<Mutation> mutations = new ArrayList<Mutation>();
mutations.add(good);
mutations.add(bad);
try {
bw.addMutations(mutations);
Assert.fail("addMutations should throw IAE if it contains empty mutation");
} catch (IllegalArgumentException iae) {}
bw.close();
}
@Test | Return empty string instead. |
package org.apache.accumulo.server.util;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import org.apache.accumulo.server.monitor.servlets.BasicServlet;
/**
* Function to get the list of expected tablet servers.
* @author Accumulo Team
*
*/
public class getSlaves{
public static final List<String> main() throws IOException {
List<String> result = new ArrayList<String>();
InputStream input = BasicServlet.class.getClassLoader().getResourceAsStream("slaves");
byte[] buffer = new byte[1024];
int n;
StringBuilder all = new StringBuilder();
while ((n = input.read(buffer)) > 0)
all.append(new String(buffer, 0, n));
for (String slave : all.toString().split("\n")) {
slave = slave.trim();
if (slave.length() > 0 && slave.indexOf("#") < 0)
result.add(slave);
}
return result;
}
} | Return empty string instead. |
import org.apache.thrift.transport.TFramedTransport;
TServer server = createProxyServer(apiclass, implementor, port, protoFactoryClass, opts.prop);
Properties properties) throws Exception {
args.transportFactory(new TFramedTransport.Factory()); | This block of commented-out lines of code should be removed. |
mbw = master.getConnector().createBatchWriter(MetadataTable.NAME, new BatchWriterConfig());
if (key.getColumnFamily().equals(MetadataTable.DATAFILE_COLUMN_FAMILY)) {
MetadataTable.DIRECTORY_COLUMN.put(m, new Value(FastFormat.toZeroPaddedString(dirCount++, 8, 16, "/c-".getBytes())));
MetadataTable.DIRECTORY_COLUMN.put(m, new Value(FastFormat.toZeroPaddedString(dirCount++, 8, 16, "/c-".getBytes())));
if (endRow == null && MetadataTable.PREV_ROW_COLUMN.hasColumns(key)) { | Use "Long.toString" instead. |
if (max < min)
return -1;
if (ret == -1)
return mid; // this must the max
else
return ret;
if (key.compareColumnQualifier(QueryUtil.COUNTS_COLQ) == 0)
cv.set(entry.getValue());
if (key.compareRow(currentRow) != 0)
return entry;
if (key.compareRow(currentRow) != 0)
return entry;
if (auths.length() > 0)
this.auths = new Authorizations(auths.split(","));
else
this.auths = new Authorizations(); | Remove this call to "exit" or ensure it is really required. |
Map<String,String> props = new TreeMap<String,String>(); | Remove this hard-coded password. |
@SuppressWarnings("all") public enum SecurityErrorCode implements org.apache.thrift.TEnum { | 300 duplicated blocks of code must be removed. |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ | Replace all tab characters in this file by sequences of white-spaces. |
import org.apache.log4j.Logger;
private static Logger log = Logger.getLogger(DefaultConfiguration.class);
} finally {
try {
data.close();
} catch (IOException ex) {
log .error(ex, ex);
} | Remove this unused method parameter "tservers". |
package org.apache.accumulo.maven.plugin;
private String rootPassword;
private String miniClasspath;
subdir = subdir.getCanonicalFile();
subdir.mkdirs();
configureMiniClasspath(miniClasspath);
System.out.println("Starting MiniAccumuloCluster: " + mac.getInstanceName() + " in " + mac.getConfig().getDir());
public static void main(String[] args) throws MojoExecutionException {
int a = 0;
for (String arg : args) {
if (a < 2) {
// skip the first two args
a++;
continue;
}
StartMojo starter = new StartMojo();
starter.outputDirectory = new File(args[0]);
String[] instArgs = arg.split(" ");
starter.instanceName = instArgs[0];
starter.rootPassword = instArgs[1];
starter.miniClasspath = args[1];
starter.execute();
}
} | Replace this use of System.out or System.err by a logger. |
shellState.updateUser(user, new PasswordToken(pass)); | Immediately return this expression instead of assigning it to the temporary variable "connector". |
@Override
public Long typedReduce(Key key, Iterator<Long> iter) {
long min = Long.MAX_VALUE;
while (iter.hasNext()) {
Long l = iter.next();
if (l < min) min = l;
return min;
} | 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");
createEvent.put(prevRow, new Text(String.format("%020d", timestamp)), new Value(metaTablet.toString().getBytes(utf8)));
tabletEvent.put(new Text(String.format("%020d", timestamp)), new Text("mtab"), new Value(metaTablet.toString().getBytes(utf8)));
tabletEvent.put(new Text(String.format("%020d", timestamp)), new Text("log"), new Value(logFile.getBytes(utf8)));
AccumuloOutputFormat.setOutputInfo(job.getConfiguration(), user, pass.getBytes(utf8), false, null); | Move this variable to comply with Java Code Conventions. |
public class BinaryStressIT extends ConfigurableMacIT { | Use "Integer.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.
*/
@Override
public void visit(State state, Properties props) throws Exception {} | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
private Option userOpt;
private Option scanOptAuths;
private Option clearOptAuths;
@Override
public int execute(String fullCommand, CommandLine cl, Shell shellState) throws AccumuloException, AccumuloSecurityException {
String user = cl.getOptionValue(userOpt.getOpt(), shellState.getConnector().whoami());
String scanOpts = cl.hasOption(clearOptAuths.getOpt()) ? null : cl.getOptionValue(scanOptAuths.getOpt());
shellState.getConnector().securityOperations().changeUserAuthorizations(user, CreateUserCommand.parseAuthorizations(scanOpts));
Shell.log.debug("Changed record-level authorizations for user " + user);
return 0;
}
@Override
public String description() {
return "sets the maximum scan authorizations for a user";
}
@Override
public void registerCompletion(Token root, Map<Command.CompletionSet,Set<String>> completionSet) {
registerCompletionForUsers(root, completionSet);
}
@Override
public Options getOptions() {
Options o = new Options();
OptionGroup setOrClear = new OptionGroup();
scanOptAuths = new Option("s", "scan-authorizations", true, "set the scan authorizations");
scanOptAuths.setArgName("comma-separated-authorizations");
setOrClear.addOption(scanOptAuths);
clearOptAuths = new Option("c", "clear-authorizations", false, "clears the scan authorizations");
setOrClear.addOption(clearOptAuths);
setOrClear.setRequired(true);
o.addOptionGroup(setOrClear);
userOpt = new Option(Shell.userOption, "user", true, "user to operate on");
userOpt.setArgName("user");
o.addOption(userOpt);
return o;
}
@Override
public int numArgs() {
return 0;
} | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
log.error("Failed to scan " + Constants.METADATA_TABLE_NAME + " looking for references to deleted table " + tableId, e); | Immediately return this expression instead of assigning it to the temporary variable "client". |
public ColumnUpdate(byte[] cf, byte[] cq, byte[] cv, boolean hasts, long ts, boolean deleted, byte[] val) {
/**
* @deprecated use setTimestamp(long);
* @param timestamp
*/
public void setSystemTimestamp(long timestamp) {
return this.timestamp;
@Override
public boolean equals(Object obj) {
if (!(obj instanceof ColumnUpdate))
return false;
ColumnUpdate upd = (ColumnUpdate)obj;
return Arrays.equals(getColumnFamily(), upd.getColumnFamily()) &&
Arrays.equals(getColumnQualifier(), upd.getColumnQualifier()) &&
Arrays.equals(getColumnVisibility(), upd.getColumnVisibility()) &&
isDeleted() == upd.isDeleted() &&
Arrays.equals(getValue(), upd.getValue()) &&
hasTimestamp() == upd.hasTimestamp() &&
getTimestamp() == upd.getTimestamp();
}
| Remove this unused method parameter "timestamp". |
import org.apache.accumulo.core.iterators.IteratorUtil.IteratorScope;
import org.apache.accumulo.core.iterators.OptionDescriber.IteratorOptions;
import org.apache.accumulo.core.util.shell.ShellCommandException;
String shortClassName = className;
if (className.contains("."))
shortClassName = className.substring(className.lastIndexOf('.') + 1);
prompt = Shell.repeat("-", 10) + "> set " + shortClassName + " parameter " + e.getKey() + ", " + e.getValue() + ": ";
prompt = Shell.repeat("-", 10) + "> set " + shortClassName + " option (<name> <value>, hit enter to skip): "; | Remove the literal "true" boolean value. |
@Deprecated | Return empty string instead. |
import org.junit.Assert; | 6 duplicated blocks of code must be removed. |
switch (ae.getSecurityErrorCode()) { | Do not forget to remove this deprecated code someday. |
/*
* 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.
*/ | 2 duplicated blocks of code must be removed. |
AgeOffFilter copy = (AgeOffFilter) super.deepCopy(env);
copy.currentTime = currentTime;
copy.threshold = threshold;
return copy; | Define and throw a dedicated exception instead of using a generic one. |
/*
* 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.
*/ | 296 duplicated blocks of code must be removed. |
if (iter.hasTop())
return iter.getTopKey().toString();
if (flags[i])
bytes[i] = 1;
else
bytes[i] = 0;
if (flags == null)
return null;
if (bytes[i] == 1)
bFlags[i] = true;
else
bFlags[i] = false; | Remove this call to "exit" or ensure it is really required. |
mmi = client.getMasterStats(Tracer.traceInfo(), SecurityConstants.getSystemCredentials());
result = client.getStatus(Tracer.traceInfo(), SecurityConstants.getSystemCredentials()); | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
package org.apache.accumulo.examples.simple.mapreduce; | Rename "table" which hides the field declared at line 107. |
if (files.length != 0)
throw new Exception("dir " + reportDir + " is not empty"); | Remove this call to "exit" or ensure it is really required. |
if (dataVersion != null)
return dataVersion;
if (System.getenv("ACCUMULO_LOG_DIR") != null)
System.setProperty("org.apache.accumulo.core.dir.log", System.getenv("ACCUMULO_LOG_DIR"));
else
System.setProperty("org.apache.accumulo.core.dir.log", System.getenv("ACCUMULO_HOME") + "/logs/");
if (System.getenv("ACCUMULO_LOG_HOST") != null)
System.setProperty("org.apache.accumulo.core.host.log", System.getenv("ACCUMULO_LOG_HOST"));
else
System.setProperty("org.apache.accumulo.core.host.log", localhost);
if (!dfs.setSafeMode(SafeModeAction.SAFEMODE_GET))
break; | Remove this call to "exit" or ensure it is really required. |
/**
* Autogenerated by Thrift
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
*/
package org.apache.accumulo.core.client.impl.thrift;
import java.util.Map;
import java.util.HashMap;
import org.apache.thrift.TEnum;
public enum TableOperationExceptionType implements org.apache.thrift.TEnum {
EXISTS(0),
NOTFOUND(1),
OFFLINE(2),
BULK_BAD_INPUT_DIRECTORY(3),
BULK_BAD_ERROR_DIRECTORY(4),
BAD_RANGE(5),
OTHER(6);
private final int value;
private TableOperationExceptionType(int value) {
this.value = value;
}
/**
* Get the integer value of this enum value, as defined in the Thrift IDL.
*/
public int getValue() {
return value;
}
/**
* Find a the enum type by its integer value, as defined in the Thrift IDL.
* @return null if the value is not found.
*/
public static TableOperationExceptionType findByValue(int value) {
switch (value) {
case 0:
return EXISTS;
case 1:
return NOTFOUND;
case 2:
return OFFLINE;
case 3:
return BULK_BAD_INPUT_DIRECTORY;
case 4:
return BULK_BAD_ERROR_DIRECTORY;
case 5:
return BAD_RANGE;
case 6:
return OTHER;
default:
return null;
}
}
} | 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. |
import org.apache.accumulo.core.client.impl.thrift.ClientService.Iface;
import org.apache.accumulo.core.util.Pair;
String server = null;
Pair<String,Iface> pair = ServerClient.getConnection(instance);
server = pair.getFirst();
client = pair.getSecond();
log.debug("ClientService request failed " + server + ", retrying ... ", tte);
String server = null;
Pair<String,Iface> pair = ServerClient.getConnection(instance);
server = pair.getFirst();
client = pair.getSecond();
log.debug("ClientService request failed " + server + ", retrying ... ", tte);
public static Pair<String,ClientService.Iface> getConnection(Instance instance) throws TTransportException {
Pair<String,TTransport> pair = ThriftTransportPool.getInstance().getAnyTransport(servers);
ClientService.Iface client = ThriftUtil.createClient(new ClientService.Client.Factory(), pair.getSecond());
return new Pair<String,ClientService.Iface>(pair.getFirst(), client); | Remove this unused import 'org.apache.accumulo.core.client.impl.thrift.ClientService.Iface'. |
/*
* 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.
*/
private static final String[] LETTERS = new String[] {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t",
"u", "v", "w", "x", "y", "z"};
public void cleanup() throws Exception {}
public Map<String,String> getInitialConfig() {
Mutation m = new Mutation(row + j);
for (Entry<Key,Value> entry : scanner) {
assertTrue((startText == null || row.compareTo(startText) <= 0) || (endText == null || row.compareTo(endText) > 0));
if (expected != value) throw new RuntimeException("Test failed, expected " + expected + " != " + value);
if (!b) throw new RuntimeException("test failed, false value");
if (!expected.equals(value)) throw new RuntimeException("expected " + expected + " != " + value);
| Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
import org.apache.accumulo.core.iterators.user.WholeRowIterator; | Remove the literal "false" boolean value. |
import org.apache.accumulo.core.security.thrift.TCredentials;
import org.apache.accumulo.core.security.tokens.AuthenticationToken;
public AuthenticationToken getToken() {
return new PasswordToken(password.value);
return new PasswordToken(securePassword.value);
public TCredentials getCredentials() throws AccumuloSecurityException { | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
* @deprecated not for client use | 1 duplicated blocks of code must be removed. |
options.ranges = Collections.singletonList(new Range(null, false, stop, false));
String cookie = tpc.proxy().createBatchScanner(userpass, testtable, options); | Refactor this code to not nest more than 3 if/for/while/switch/try statements. |
org.apache.thrift.protocol.TMap _map88 = iprot.readMapBegin();
struct.properties = new HashMap<String,String>(2*_map88.size);
for (int _i89 = 0; _i89 < _map88.size; ++_i89)
String _key90; // required
String _val91; // required
_key90 = iprot.readString();
_val91 = iprot.readString();
struct.properties.put(_key90, _val91);
for (Map.Entry<String, String> _iter92 : struct.properties.entrySet())
oprot.writeString(_iter92.getKey());
oprot.writeString(_iter92.getValue());
for (Map.Entry<String, String> _iter93 : struct.properties.entrySet())
oprot.writeString(_iter93.getKey());
oprot.writeString(_iter93.getValue());
org.apache.thrift.protocol.TMap _map94 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32());
struct.properties = new HashMap<String,String>(2*_map94.size);
for (int _i95 = 0; _i95 < _map94.size; ++_i95)
String _key96; // required
String _val97; // required
_key96 = iprot.readString();
_val97 = iprot.readString();
struct.properties.put(_key96, _val97); | 15 duplicated blocks of code must be removed. |
/*
ALGORITHM_NAME("algorithm.name"), CIPHER_SUITE("cipher.suite"), INITIALIZATION_VECTOR("initialization.vector"), PLAINTEXT_SESSION_KEY(
"plaintext.session.key");
* @param cryptoOpts
* @param cryptoOpts | Remove this empty statement. |
public class DeleteRowsSplitIT extends SimpleMacIT {
final String tableName = makeTableName();
getConnector().tableOperations().create(tableName);
fillTable(tableName);
getConnector().tableOperations().addSplits(tableName, afterEnd);
getConnector().tableOperations().deleteRows(tableName, start, end);
Scanner scanner = getConnector().createScanner(tableName, Authorizations.EMPTY);
getConnector().tableOperations().delete(tableName);
BatchWriter bw = getConnector().createBatchWriter(table, new BatchWriterConfig()); | 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. |
package org.apache.accumulo.examples.simple.dirlist; | Rename "table" which hides the field declared at line 107. |
import org.apache.accumulo.core.security.tokens.PasswordToken; | 1 duplicated blocks of code must be removed. |
MutationLogger.Iface client = ThriftUtil.getClient(new MutationLogger.Client.Factory(), addr, m.getSystemConfiguration()); | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
// TODO could use batch writer,would need to handle failure and retry like update does - ACCUMULO-1294 | Make the "log" logger private static final and rename it to comply with the format "LOG(?:GER)?". |
import org.apache.accumulo.core.util.ContextFactory;
JobContext job = ContextFactory.createJobContext();
TaskAttemptContext tac = ContextFactory.createTaskAttemptContext(job);
JobContext job = ContextFactory.createJobContext();
TaskAttemptContext tac = ContextFactory.createTaskAttemptContext(job);
JobContext job = ContextFactory.createJobContext();
TaskAttemptContext tac = ContextFactory.createTaskAttemptContext(job); | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
* @return The given key's dataLocation
* @return The given key's term
* @return The given key's DocID
* @return The given key's UID
* @return A Key object built from the given row and dataLocation.
* @return A Key object built from the given row, dataLocation, and term.
* @return The key directly following the given key.
* @return A Base64 encoded string (using a \n delimiter) of all columns to intersect on.
* @return A Base64 encoded string (using a \n delimiter) of all terms to intersect on.
* @return A base64 encoded string of which columns are NOT'ed
* @return A Text array of the decoded columns
* @return A Text array of decoded terms.
* @return A boolean array of decoded NOT flags | 1 duplicated blocks of code must be removed. |
Connector conn = master.getConnector();
public Repo<Master> call(long tid, Master master) throws Exception {
FileSystem fs = master.getFileSystem();
Connector conn = master.getConnector(); | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
import org.apache.accumulo.core.util.RootTable;
LocatorKey key = new LocatorKey(instance.getInstanceID(), tableId);
if (tableId.toString().equals(RootTable.ID)) {
tl = new RootTabletLocator(instance);
} else if (tableId.toString().equals(MetadataTable.ID)) {
tl = new TabletLocatorImpl(new Text(MetadataTable.ID), getInstance(instance, new Text(RootTable.ID)), mlo);
tl = new TabletLocatorImpl(tableId, getInstance(instance, new Text(MetadataTable.ID)), mlo); | Reduce this switch case number of lines from 12 to at most 5, for example by extracting code into methods. |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.accumulo.core.client.security.tokens;
/**
*
*/
public class SystemToken extends PasswordToken {
public SystemToken(byte[] systemPassword) {
super(systemPassword);
}
} | Move this constructor to comply with Java Code Conventions. |
* A byte array backed output stream with a limit. The limit should be smaller than the buffer capacity. The object can be reused through <code>reset</code> API
* and choose different limits in each round.
private final byte[] buffer;
private int limit;
private int count;
public BoundedByteArrayOutputStream(int capacity) {
this(capacity, capacity);
public BoundedByteArrayOutputStream(int capacity, int limit) {
if ((capacity < limit) || (capacity | limit) < 0) {
throw new IllegalArgumentException("Invalid capacity/limit");
}
this.buffer = new byte[capacity];
this.limit = limit;
this.count = 0;
@Override
public void write(int b) throws IOException {
if (count >= limit) {
throw new EOFException("Reaching the limit of the buffer.");
}
buffer[count++] = (byte) b;
@Override
public void write(byte b[], int off, int len) throws IOException {
if ((off < 0) || (off > b.length) || (len < 0) || ((off + len) > b.length) || ((off + len) < 0)) {
throw new IndexOutOfBoundsException();
} else if (len == 0) {
return;
}
if (count + len > limit) {
throw new EOFException("Reach the limit of the buffer");
}
System.arraycopy(b, off, buffer, count, len);
count += len;
public void reset(int newlim) {
if (newlim > buffer.length) {
throw new IndexOutOfBoundsException("Limit exceeds buffer size");
}
this.limit = newlim;
this.count = 0;
}
public void reset() {
this.limit = buffer.length;
this.count = 0;
}
public int getLimit() {
return limit;
}
public byte[] getBuffer() {
return buffer;
}
public int size() {
return count; | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
import org.apache.accumulo.test.functional.SlowIterator; | Move the "org.apache.accumulo.test.randomwalk.unit.CreateTable" string literal on the left side of this string comparison. |
SimpleTimer.getInstance().schedule(new Runnable() {
SimpleTimer.getInstance().schedule(new Runnable() { | Either log or rethrow this exception. |
/*
* (non-Javadoc)
*
* @see org.apache.accumulo.core.client.admin.InstanceOperations#ping(java.lang.String)
*/
@Override
public void ping(String tserver) throws AccumuloException {
// TODO Auto-generated method stub
} | 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. |
// TODO make split size configurable
SequenceFileInputFormat.setMinInputSplitSize(ingestJob, WikipediaConfiguration.getMinInputSplitSize(ingestConf)); | Complete the task associated to this TODO comment. |
if (myfile.exists())
myfile.delete();
if (v != null)
readData.put(rootDir + "/data" + i, new String(v));
if (v != null)
readData.put(rootDir + "/dataS", new String(v));
if (children != null)
for (String child : children) {
readData.put(rootDir + "/dir/" + child, "");
} | Remove this call to "exit" or ensure it is really required. |
import org.apache.accumulo.server.fs.VolumeManager;
import org.apache.accumulo.server.fs.VolumeManagerImpl;
private final VolumeManager fs;
private List<SortedKeyValueIterator<Key,Value>> openMapFiles(Collection<String> files, VolumeManager fs, AccumuloConfiguration conf) throws IOException {
FileSystem ns = fs.getFileSystemByPath(new Path(file));
FileSKVIterator reader = FileOperations.getInstance().openReader(file, true, ns, ns.getConf(), conf);
public OfflineMetadataScanner(AccumuloConfiguration conf, VolumeManager fs) throws IOException {
allFiles.add(fs.getFullPath(ssi.getTopKey()).toString());
VolumeManager fs = VolumeManagerImpl.get(); | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
import java.util.Map.Entry;
private static final int NUM_ROWS = 5;
private static final int NUM_DOCIDS = 200; | Remove the literal "true" boolean value. |
* For each of the methods, this lexicoder just passes the input through untouched. It is meant to be combined with other lexicoders like the
* {@link ReverseLexicoder}. | Remove this unused import 'java.util.Date'. |
if (currentTime - k.getTimestamp() > threshold)
return false;
if (options == null)
throw new IllegalArgumentException("ttl must be set for AgeOffFilter");
if (ttl == null)
throw new IllegalArgumentException("ttl must be set for AgeOffFilter");
if (time != null)
currentTime = Long.parseLong(time);
else
currentTime = System.currentTimeMillis(); | 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.
*/
| Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
AccumuloInputFormat.setConnectorInfo(job, user, new PasswordToken(pass));
AccumuloOutputFormat.setConnectorInfo(job, user, new PasswordToken(pass)); | 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.
*/ | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
try {
fis = new FileInputStream(filename);
while (numRead >= 0) {
while (numRead < buf.length) {
int moreRead = fis.read(buf, numRead, buf.length - numRead);
if (moreRead > 0)
numRead += moreRead;
else if (moreRead < 0)
break;
}
m = new Mutation(row);
Text chunkCQ = new Text(chunkSizeBytes);
chunkCQ.append(intToBytes(chunkCount), 0, 4);
m.put(CHUNK_CF, chunkCQ, cv, new Value(buf, 0, numRead));
bw.addMutation(m);
if (chunkCount == Integer.MAX_VALUE)
throw new RuntimeException("too many chunks for file " + filename + ", try raising chunk size");
chunkCount++;
numRead = fis.read(buf);
}
} finally {
fis.close();
@Parameter(names = "--vis", description = "use a given visibility for the new counts", converter = VisibilityConverter.class)
@Parameter(names = "--chunk", description = "size of the chunks used to store partial files")
int chunkSize = 64 * 1024;
@Parameter(description = "<file> { <file> ... }") | Immediately return this expression instead of assigning it to the temporary variable "ret". |
filter.init(new SortedMapIterator(tm), is.getOptions(), null);
filter.init(new SortedMapIterator(tm), is.getOptions(), null);
filter2.init(filter, is.getOptions(), null);
filter.init(new SortedMapIterator(tm), is.getOptions(), null);
a.init(new SortedMapIterator(tm), is.getOptions(), null);
a.init(new SortedMapIterator(tm), is.getOptions(), new DefaultIteratorEnvironment());
a.init(new SortedMapIterator(tm), is.getOptions(), new DefaultIteratorEnvironment());
a.init(new SortedMapIterator(tm), is.getOptions(), new DefaultIteratorEnvironment());
a.init(new SortedMapIterator(tm), is.getOptions(), null);
a.init(new SortedMapIterator(tm), is.getOptions(), null);
a.init(new SortedMapIterator(tm), is.getOptions(), null);
a.init(new SortedMapIterator(tm), is.getOptions(), null);
a.init(new SortedMapIterator(tm), is.getOptions(), null);
a.init(new SortedMapIterator(tm), is.getOptions(), null);
a.init(new SortedMapIterator(tm), is.getOptions(), null);
a.init(new SortedMapIterator(tm), is.getOptions(), null);
a.init(new SortedMapIterator(tm), is.getOptions(), null); | Refactor this code to not nest more than 3 if/for/while/switch/try statements. |
* 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.
*/
Encoded(String e, String v) {
encoding = e;
value = v;
}
// int timeout = 30 * 1000;
// String server = args[0];
if (args.length > 0) root = args[0];
zk = ZooReaderWriter.getInstance();
if (!child.equals("zookeeper")) dump(out, root, child, 1);
if (root.endsWith("/")) path = root + child;
if (stat == null) return;
if (data[i] < ' ' || data[i] > '~') return new Encoded("base64", new String(Base64.encodeBase64(data), "utf8"));
private static void write(PrintStream out, int indent, String fmt, Object... args) {
for (int i = 0; i < indent; i++) | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
Connector conn = new MockInstance("counttest").getConnector("root", "".getBytes());
BatchWriter bw = conn.createBatchWriter("dirlisttable", new BatchWriterConfig());
Scanner scanner = new MockInstance("counttest").getConnector("root", "".getBytes()).createScanner("dirlisttable", new Authorizations()); | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
import org.apache.accumulo.test.functional.SimpleMacIT;
import org.junit.Rule;
public class ShellServerIT extends SimpleMacIT {
@Rule
public TemporaryFolder folder2 = new TemporaryFolder(new File(System.getProperty("user.dir") + "/target"));
File fooFilterJar = folder2.newFile("FooFilter.jar");
File fooConstraintJar = folder2.newFile("FooConstraint.jar");
public static TemporaryFolder folder = new TemporaryFolder(new File(System.getProperty("user.dir") + "/target/"));
public MiniAccumuloCluster getCluster() {
return cluster;
}
| Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.