Diff stringlengths 10 2k | Message stringlengths 28 159 |
|---|---|
if (parentChildren.get(span.parentId) == null)
parentChildren.put(span.parentId, new ArrayList<Long>());
if (root == null || root.isEmpty())
return visited;
if (rootSpan == null)
return visited;
if (visited.contains(node.spanId))
return; | 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.
*/
| Remove this unused private "match" method. |
e.setTableInfo(Tables.getPrintableTableInfoFromId(instance, scanState.tableName.toString())); | Either log or rethrow this exception. |
import org.apache.accumulo.cloudtrace.instrument.Span;
import org.apache.accumulo.cloudtrace.instrument.Trace; | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
import org.apache.accumulo.core.security.tokens.AccumuloToken;
import org.apache.accumulo.core.security.tokens.InstanceTokenWrapper;
List<KeyExtent> candidates = findTablets(!opts.selectFarTablets, opts.getAccumuloToken(), opts.tableName, instance, locations);
List<String> files = getTabletFiles(opts.getAccumuloToken(), opts.getInstance(), tableId, ke);
private static List<KeyExtent> findTablets(boolean selectLocalTablets, AccumuloToken<?,?> token, String table, Instance zki,
MetadataTable.getEntries(zki, new InstanceTokenWrapper(token, zki.getInstanceID()), table, false, locations, tablets);
private static List<String> getTabletFiles(AccumuloToken<?,?> token, Instance zki, String tableId, KeyExtent ke) {
MetadataTable.getTabletAndPrevTabletKeyValues(zki, tkv, ke, null, new InstanceTokenWrapper(token, zki.getInstanceID())); | Immediately return this expression instead of assigning it to the temporary variable "ret". |
import org.apache.accumulo.server.zookeeper.IZooReaderWriter;
IZooReaderWriter zoo = ZooReaderWriter.getInstance();
IZooReaderWriter zoo = ZooReaderWriter.getInstance();
ZooReaderWriter.getRetryingInstance()), 4); | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
Scanner scanner = conn.createScanner(Constants.METADATA_TABLE_NAME, Authorizations.EMPTY); | Remove this unused method parameter "range". |
byte typeBytes[] = type.name().getBytes(); | Remove this unused private "appendProp" method. |
import org.apache.accumulo.server.fs.VolumeManager.FileType;
String[] parts = log.split("/", 2); // "host:port/filename"
Path finished = new Path(fs.getFullPath(FileType.RECOVERY, parts[parts.length - 1]), "finished"); | Remove this unused private "FileType" constructor. |
import org.apache.accumulo.core.cli.ClientOnRequiredTable;
import com.beust.jcommander.Parameter;
static class Opts extends ClientOnRequiredTable {
@Parameter(names="--inputDir", required=true)
String inputDir;
@Parameter(names="--workDir", required=true)
String workDir;
}
Opts opts = new Opts();
opts.parseArgs(BulkIngestExample.class.getName(), args);
opts.setAccumuloConfigs(job);
Connector connector = opts.getConnector();
TextInputFormat.setInputPaths(job, new Path(opts.inputDir));
AccumuloFileOutputFormat.setOutputPath(job, new Path(opts.workDir + "/files"));
out = new PrintStream(new BufferedOutputStream(fs.create(new Path(opts.workDir + "/splits.txt"))));
Collection<Text> splits = connector.tableOperations().getSplits(opts.tableName, 100);
RangePartitioner.setSplitFile(job, opts.workDir + "/splits.txt");
Path failures = new Path(opts.workDir, "failures");
fs.mkdirs(new Path(opts.workDir, "failures"));
connector.tableOperations().importDirectory(opts.tableName, opts.workDir + "/files", opts.workDir + "/failures", false); | Remove this unused private "appendProp" method. |
@Deprecated | Return empty string instead. |
import org.apache.accumulo.core.security.thrift.tokens.SecurityToken;
SecurityToken token;
MockUser(String principal, SecurityToken token, Authorizations auths) {
this.name = principal;
this.token = token.clone(); | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
partitions.add(decode ? new Text(Base64.decodeBase64(line.getBytes())) : new Text(line)); | Remove this unused private "appendProp" method. |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.accumulo.core.client.security.tokens;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import javax.security.auth.DestroyFailedException;
/**
*
*/
public class NullToken implements AuthenticationToken {
@Override
public void readFields(DataInput arg0) throws IOException {
return;
}
@Override
public void write(DataOutput arg0) throws IOException {
return;
}
@Override
public void destroy() throws DestroyFailedException {
return;
}
@Override
public boolean isDestroyed() {
return false;
}
public NullToken clone() {
return new NullToken();
}
public boolean equals(Object obj) {
return obj instanceof NullToken;
}
} | Move this constructor to comply with Java Code Conventions. |
import java.util.concurrent.TimeUnit;
BatchWriter bw = getConnector().createBatchWriter("bwlt", new BatchWriterConfig().setMaxLatency(2000, TimeUnit.MILLISECONDS)); | Remove this call to "exit" or ensure it is really required. |
package org.apache.accumulo.server.test;
import java.io.IOException;
import java.util.Arrays;
import java.util.Random;
import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.Value;
import org.apache.accumulo.core.file.map.MyMapFile;
import org.apache.accumulo.core.file.map.MyMapFile.Writer;
import org.apache.accumulo.core.file.map.MySequenceFile.CompressionType;
import org.apache.accumulo.core.util.CachedConfiguration;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.io.Text;
public class CreateRandomMapFile {
private static int num;
private static String file;
public static byte[] createValue(long rowid, int dataSize){
Random r = new Random(rowid);
byte value[] = new byte[dataSize];
r.nextBytes(value);
//transform to printable chars
for(int j = 0; j < value.length; j++) {
value[j] = (byte)(( (0xff & value[j]) % 92) + ' ');
}
return value;
}
public static void main(String[] args)
{
file = args[0];
num = Integer.parseInt(args[1]);
long rands[] = new long[num];
Random r = new Random();
for (int i = 0; i < rands.length; i++) {
rands[i] = Math.abs(r.nextLong()) % 10000000000l;
}
Arrays.sort(rands);
Configuration conf = CachedConfiguration.getInstance();
Writer mfw;
try {
FileSystem fs = FileSystem.get(conf);
mfw = new MyMapFile.Writer(conf, fs, file, Key.class, Value.class, CompressionType.BLOCK);
} catch (IOException e) {
throw new RuntimeException(e);
}
for (int i = 0; i < rands.length; i++) {
Text row = new Text(String.format("row_%010d", rands[i]));
Key key = new Key(row);
Value dv = new Value(createValue(rands[i], 40));
try {
mfw.append(key, dv);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
try {
mfw.close();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
} | 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. |
* 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.
*/
* <li>Unicode canonical decomposition ({@link Form#NFD})</li>
* <li>Removal of diacritical marks</li>
* <li>Unicode canonical composition ({@link Form#NFC})</li>
* <li>lower casing in the {@link Locale#ENGLISH English local}
public class LcNoDiacriticsNormalizer implements normalizer.Normalizer {
private static final Pattern diacriticals = Pattern.compile("\\p{InCombiningDiacriticalMarks}");
public String normalizeFieldValue(String fieldName, Object fieldValue) {
String decomposed = Normalizer.normalize(fieldValue.toString(), Form.NFD);
String noDiacriticals = removeDiacriticalMarks(decomposed);
String recomposed = Normalizer.normalize(noDiacriticals, Form.NFC);
return recomposed.toLowerCase(Locale.ENGLISH);
}
private String removeDiacriticalMarks(String str) {
Matcher matcher = diacriticals.matcher(str);
return matcher.replaceAll("");
}
| Immediately return this expression instead of assigning it to the temporary variable "r". |
*
*
*
*
*
*
*
*
| 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.
*/ | Remove this unused private "appendProp" method. |
if (result != null)
return result; | 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.
*/
final Map<String,String> copy = Collections.synchronizedMap(new HashMap<String,String>());
public ConfigurationCopy(Map<String,String> config) {
public ConfigurationCopy(Iterable<Entry<String,String>> config) {
for (Entry<String,String> entry : config) {
this(new HashMap<String,String>());
public Iterator<Entry<String,String>> iterator() {
| Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
import org.apache.accumulo.core.client.Connector;
import org.apache.accumulo.minicluster.MiniAccumuloConfig;
import org.junit.Test;
public class BatchScanSplitIT extends MacTest {
public void configure(MiniAccumuloConfig cfg) {
cfg.setSiteConfig(Collections.singletonMap(Property.TSERV_MAJC_DELAY.getKey(), "0"));
@Test(timeout=30*1000)
public void test() throws Exception {
Connector c = getConnector();
c.tableOperations().create("bss");
log.info(String.format("rate : %06.2f%n", ranges.size() / ((t2 - t1) / 1000.0)));
log.info("splits : " + splits); | Use "Long.toString" instead. |
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
| Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
import org.apache.accumulo.core.security.thrift.SecurityErrorCode; | 1 duplicated blocks of code must be removed. |
import org.apache.accumulo.core.security.tokens.TokenHelper;
import org.apache.hadoop.filecache.DistributedCache;
import org.apache.hadoop.fs.Path;
* <p>
* <b>WARNING:</b> The serialized token is stored in the configuration and shared with all MapReduce tasks. It is BASE64 encoded to provide a charset safe
* conversion to a string, and is not intended to be secure.
*
* a valid AccumuloToken (principal must have Table.CREATE permission)
* Sets the connector information needed to communicate with Accumulo in this job. The authentication information will be read from the specified file when
* the job runs. This prevents the user's token from being exposed on the Job Tracker web page. The specified path will be placed in the
* {@link DistributedCache}, for better performance during job execution. Users can create the contents of this file using
* {@link TokenHelper#asBase64String(AccumuloToken)}.
*
* @param job
* the Hadoop job instance to be configured
* @param path
* the path to a file in the configured file system, containing the serialized, base-64 encoded {@link AccumuloToken} with the user's authentication
* @since 1.5.0
*/
public static void setConnectorInfo(JobConf job, Path path) {
InputConfigurator.setConnectorInfo(CLASS, job, path);
}
/**
* @see #setConnectorInfo(JobConf, Path)
* @see #setConnectorInfo(JobConf, Path) | Define and throw a dedicated exception instead of using a generic one. |
System.out.printf("inserted %,d in %,d %,d %,6.2f%n", (numRows * numCols), (t2 - t1), nm.size(), rate((numRows * numCols), (t2 - t1)));
System.out.printf("%d %,d %,d %,d %,d %,6.2f%n", Thread.currentThread().getId(), (t2 - t1), t1, t2, count, rate(count, (t2 - t1))); | Use isEmpty() to check whether the collection is empty or not. |
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
public class ByeCommand extends ExitCommand {} | 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. |
oldPassword = shellState.readMaskedLine("Enter current password for '" + currentUser + "': ", '*');
password = shellState.readMaskedLine("Enter new password for '" + user + "': ", '*');
passwordConfirm = shellState.readMaskedLine("Please confirm new password for '" + user + "': ", '*'); | Either log or rethrow this exception. |
import org.apache.accumulo.core.security.tokens.SecurityToken;
public void initializeSecurity(InstanceTokenWrapper credentials, SecurityToken token) throws AccumuloSecurityException {
public boolean authenticateUser(SecurityToken token) {
public void createUser(SecurityToken token) throws AccumuloSecurityException {
public void changePassword(SecurityToken token) throws AccumuloSecurityException { | Either log or rethrow this exception. |
BatchWriter bw = conn.createBatchWriter(MetadataTable.NAME, new BatchWriterConfig());
bw.addMutation(MetadataTable.createDeleteMutation(MetadataTable.ID, "/" + fs.getPath().getName()));
if (mergeInfo.getOperation().equals(Operation.MERGE) && tableId.equals(MetadataTable.ID)) { | Use "Long.toString" instead. |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ | Replace all tab characters in this file by sequences of white-spaces. |
if (cl.hasOption("?"))
throw new ParseException("help requested");
.equalsIgnoreCase("stop"))))
throw new ParseException("Incorrect arguments");
if (cl == null || !cl.hasOption("?"))
log.error(e, e);
if (cl != null && cl.hasOption("?"))
log.info(str.toString());
else
log.error(str.toString()); | Remove this call to "exit" or ensure it is really required. |
import jline.console.ConsoleReader;
ConsoleReader reader = new ConsoleReader(this, output); | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
import java.util.ArrayList;
import java.util.List;
import org.apache.accumulo.core.cli.Help;
import com.beust.jcommander.JCommander;
import com.beust.jcommander.Parameter;
static class Opts extends Help {
@Parameter(names="-r", description="print only mutations associated with the given row")
String row;
@Parameter(names="-m", description="limit the number of mutations printed per row")
int maxMutations = 5;
@Parameter(names="-t", description="print only mutations that fall within the given key extent")
String extent;
@Parameter(names="-p", description="search for a row that matches the given regex")
String regexp;
@Parameter(description="<logfile> { <logfile> ... }")
List<String> files = new ArrayList<String>();
Opts opts = new Opts();
opts.parseArgs(LogReader.class.getName(), args);
if (opts.files.isEmpty()) {
new JCommander(opts).usage();
if (opts.row != null)
row = new Text(opts.row);
if (opts.extent != null) {
String sa[] = opts.extent.split(";");
if (opts.regexp != null) {
Pattern pattern = Pattern.compile(opts.regexp);
for (String file : opts.files) {
printLogEvent(key, value, row, rowMatcher, ke, tabletIds, opts.maxMutations);
printLogEvent(key, value, row, rowMatcher, ke, tabletIds, opts.maxMutations);
printLogEvent(key, value, row, rowMatcher, ke, tabletIds, opts.maxMutations); | Remove this unused private "appendProp" method. |
import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.trace.instrument.TraceExecutorService;
import org.apache.accumulo.trace.instrument.Tracer;
// This needs to execute after the arbiter is stopped
Scanner mscanner = new IsolatedScanner(conn.createScanner(Constants.METADATA_TABLE_NAME, Authorizations.EMPTY));
| Remove this unused method parameter "range". |
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
public class Flush extends Test {
@Override
public void visit(State state, Properties props) throws Exception {
String indexTableName = (String) state.get("indexTableName");
String dataTableName = (String) state.get("docTableName");
Random rand = (Random) state.get("rand");
String table;
if (rand.nextDouble() < .5) table = indexTableName;
else table = dataTableName;
state.getConnector().tableOperations().flush(table, null, null, true);
log.debug("Flushed " + table);
}
| Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.apache.accumulo.core.client.IteratorSetting;
private Option noFlushOption, waitOpt, profileOpt;
private List<IteratorSetting> iterators;
shellState.getConnector().tableOperations().compact(tableName, startRow, endRow, iterators, flush, wait);
if (cl.hasOption(profileOpt.getOpt())) {
List<IteratorSetting> iterators = shellState.iteratorProfiles.get(cl.getOptionValue(profileOpt.getOpt()));
if (iterators == null) {
Shell.log.error("Profile " + cl.getOptionValue(profileOpt.getOpt()) + " does not exist");
return -1;
}
this.iterators = new ArrayList<IteratorSetting>(iterators);
} else {
this.iterators = Collections.emptyList();
}
profileOpt = new Option("pn", "profile", true, "iterator profile name");
profileOpt.setArgName("profile");
opts.addOption(profileOpt);
| Move this constructor to comply with Java Code Conventions. |
package org.apache.accumulo.core.iterators.filter;
import java.util.Map;
import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.Value;
import org.apache.accumulo.core.iterators.OptionDescriber;
import org.apache.accumulo.core.security.ColumnVisibility;
@SuppressWarnings("deprecation")
public class NoLabelFilter implements Filter, OptionDescriber {
@Override
public boolean accept(Key k, Value v) {
ColumnVisibility label = new ColumnVisibility(k.getColumnVisibility());
return label.getExpression().length > 0;
}
@Override
public void init(Map<String, String> options) {
// No Options to set
}
@Override
public IteratorOptions describeOptions() {
return new IteratorOptions("nolabel","NoLabelFilter hides entries without a visibility label", null, null);
}
@Override
public boolean validateOptions(Map<String, String> options) { return true; }
}
| Return empty string instead. |
import org.apache.accumulo.start.classloader.vfs.AccumuloVFSClassLoader;
clazz = AccumuloVFSClassLoader.loadClass(cl.getOptionValue(interpreterOpt.getOpt()), ScanInterpreter.class);
clazz = AccumuloVFSClassLoader.loadClass(cl.getOptionValue(formatterInterpeterOpt.getOpt()), ScanInterpreter.class);
return AccumuloVFSClassLoader.loadClass(cl.getOptionValue(formatterOpt.getOpt()), Formatter.class);
return AccumuloVFSClassLoader.loadClass(cl.getOptionValue(formatterInterpeterOpt.getOpt()), Formatter.class); | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
import org.apache.accumulo.core.security.thrift.Credential;
private Credential credentials;
public TabletServerBatchWriter(Instance instance, Credential credentials, BatchWriterConfig config) { | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
sb.append(" docID=").append(doc);
Value v = iter.getTopValue();
assertTrue(new String(v.get()).endsWith(" docID="+iter.getDocID(k)));
Value v = iter.getTopValue();
assertTrue(new String(v.get()).endsWith(" docID="+iter.getDocID(k)));
Value v = iter.getTopValue();
assertTrue(new String(v.get()).endsWith(" docID="+iter.getDocID(k))); | Either log or rethrow this exception. |
import java.util.concurrent.TimeUnit;
import org.apache.accumulo.core.conf.AccumuloConfiguration;
private Option timeoutOption;
protected long getTimeout(final CommandLine cl) {
if (cl.hasOption(timeoutOption.getLongOpt())) {
return AccumuloConfiguration.getTimeInMillis(cl.getOptionValue(timeoutOption.getLongOpt()));
}
return Long.MAX_VALUE;
}
new BatchWriterConfig().setMaxMemory(m.estimatedMemoryUsed()).setMaxWriteThreads(1).setTimeout(getTimeout(cl), TimeUnit.MILLISECONDS));
timeoutOption = new Option(null, "timeout", true,
"time before insert should fail if no data is written. If no unit is given assumes seconds. Units d,h,m,s,and ms are supported. e.g. 30s or 100ms");
timeoutOption.setArgName("timeout");
o.addOption(timeoutOption);
| 3 duplicated blocks of code must be removed. |
public enum Operation {
MERGE, DELETE,
}
MergeState state = MergeState.NONE;
KeyExtent range;
Operation operation = Operation.MERGE;
public MergeInfo() {}
@Override
public void readFields(DataInput in) throws IOException {
range = new KeyExtent();
range.readFields(in);
state = MergeState.values()[in.readInt()];
operation = Operation.values()[in.readInt()];
}
@Override
public void write(DataOutput out) throws IOException {
range.write(out);
out.writeInt(state.ordinal());
out.writeInt(operation.ordinal());
}
public MergeInfo(KeyExtent range, Operation op) {
this.range = range;
this.operation = op;
}
public MergeState getState() {
return state;
}
public KeyExtent getRange() {
return range;
}
public Operation getOperation() {
return operation;
}
public void setState(MergeState state) {
this.state = state;
}
public boolean isDelete() {
return this.operation.equals(Operation.DELETE);
}
public boolean needsToBeChopped(KeyExtent extent) {
// During a delete, the block after the merge will be stretched to cover the deleted area.
// Therefore, it needs to be chopped
if (!extent.getTableId().equals(range.getTableId())) return false;
if (isDelete()) return extent.getPrevEndRow() != null && extent.getPrevEndRow().equals(range.getEndRow());
else return this.range.overlaps(extent);
}
public boolean overlaps(KeyExtent extent) {
boolean result = this.range.overlaps(extent);
if (!result && needsToBeChopped(extent)) return true;
return result;
}
public String toString() {
if (!state.equals(MergeState.NONE)) return "Merge " + operation.toString() + " of " + range + " State: " + state;
return "No Merge in progress";
} | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
public ChunkInputStream(PeekingIterator<Entry<Key,Value>> in) throws IOException {
public void setSource(PeekingIterator<Entry<Key,Value>> in) throws IOException {
throw new IOException("setting new source without closing old one");
if (buf.length == 0)
gotEndMarker = true;
if (currentChunk != 0) {
source = null;
throw new IOException("starting chunk number isn't 0 for " + currentKey.getRow());
}
throw new IllegalStateException("don't get visibilities before chunks have been completely read"); | Either log or rethrow this exception. |
import org.junit.Assert;
}
final String[] expectedDefault = new String[] {"row cf:cq [] 1234abcd", "row cf1:cq1 [] 9876fedc", "row2 cf:cq [] 13579bdf",
"row2 cf1:cq [] 2468ace"};
final String[] expectedFormatted = new String[] {"row cf:cq [] 0x31 0x32 0x33 0x34 0x61 0x62 0x63 0x64",
"row cf1:cq1 [] 0x39 0x38 0x37 0x36 0x66 0x65 0x64 0x63", "row2 cf:cq [] 0x31 0x33 0x35 0x37 0x39 0x62 0x64 0x66",
"row2 cf1:cq [] 0x32 0x34 0x36 0x38 0x61 0x63 0x65"};
return new String[] {"table test", "insert row cf cq 1234abcd", "insert row cf1 cq1 9876fedc", "insert row2 cf cq 13579bdf", "insert row2 cf1 cq 2468ace",
"scan", "formatter -t test -f org.apache.accumulo.core.util.shell.command.FormatterCommandTest$HexFormatter", "scan"};
* <p>
* Simple <code>Formatter</code> that will convert each character in the Value from decimal to hexadecimal. Will automatically skip over characters in the
* value which do not fall within the [0-9,a-f] range.
* </p>
* <p>
* Example: <code>'0'</code> will be displayed as <code>'0x30'</code>
* </p>
private Iterator<Entry<Key,Value>> iter = null;
final Entry<Key,Value> entry = iter.next();
final StringBuilder sb = new StringBuilder(key.length() + v.getSize() * 5);
public void remove() {}
| Remove this unused method parameter "range". |
System.out.printf("Max depth : %d%n", depth);
System.out.printf("Time to find max depth : %,d ms%n", (t2 - t1));
System.out.printf("Time to compute counts : %,d ms%n", (t3 - t2));
System.out.printf("Entries scanned : %,d %n", entriesScanned);
System.out.printf("Counts inserted : %,d %n", inserts); | Use isEmpty() to check whether the collection is empty or not. |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ | Replace all tab characters in this file by sequences of white-spaces. |
public Mutation(byte[] byteBuffer) {
this(byteBuffer, 0, byteBuffer.length);
}
public Mutation(byte[] byteBuffer, int start, int length) {
this.row = new byte[length];
System.arraycopy(byteBuffer, start, this.row, 0, length);
buffer = new ByteBuffer();
}
| Move this constructor to comply with Java Code Conventions. |
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
public class ConstraintLoader {
public static ConstraintChecker load(String table) throws IOException {
for (Entry<String,String> entry : conf) {
| Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import org.apache.accumulo.core.metadata.MetadataTable;
import org.junit.Rule;
import org.junit.rules.TemporaryFolder;
@Rule
public TemporaryFolder folder = new TemporaryFolder(new File(System.getProperty("user.dir") + "/target"));
@Test(timeout = 2 * 60 * 1000)
File siteFileBackup = new File(folder.getRoot(), "accumulo-site.xml.bak");
assertFalse(siteFileBackup.exists());
assertEquals(0, exec(Admin.class, new String[] {"dumpConfig", "-a", "-d", folder.getRoot().getPath()}).waitFor());
assertTrue(siteFileBackup.exists());
String site = FunctionalTestUtils.readAll(new FileInputStream(siteFileBackup));
String meta = FunctionalTestUtils.readAll(new FileInputStream(new File(folder.getRoot(), MetadataTable.NAME + ".cfg")));
| Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
import org.apache.accumulo.core.client.security.SecurityErrorCode;
if (ae.getSecurityErrorCode().equals(SecurityErrorCode.PERMISSION_DENIED)) {
if (ae.getSecurityErrorCode().equals(SecurityErrorCode.BAD_AUTHORIZATIONS)) {
&& ((AccumuloSecurityException) re.getCause()).getSecurityErrorCode().equals(SecurityErrorCode.PERMISSION_DENIED)) {
&& ((AccumuloSecurityException) re.getCause()).getSecurityErrorCode().equals(SecurityErrorCode.BAD_AUTHORIZATIONS)) {
if (ae.getSecurityErrorCode().equals(SecurityErrorCode.PERMISSION_DENIED)) {
} else if (ae.getSecurityErrorCode().equals(SecurityErrorCode.BAD_CREDENTIALS)) { | 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.
*/ | 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.
*/
package org.apache.accumulo.server.data;
import java.util.List;
import org.apache.accumulo.core.client.impl.Translator;
import org.apache.accumulo.core.data.thrift.TCondition;
import org.apache.accumulo.core.data.thrift.TConditionalMutation;
/**
*
*/
public class ServerConditionalMutation extends ServerMutation {
public static class TCMTranslator extends Translator<TConditionalMutation,ServerConditionalMutation> {
@Override
public ServerConditionalMutation translate(TConditionalMutation input) {
return new ServerConditionalMutation(input);
}
}
public static final TCMTranslator TCMT = new TCMTranslator();
private long cmid;
private List<TCondition> conditions;
public ServerConditionalMutation(TConditionalMutation input) {
super(input.mutation);
this.cmid = input.id;
this.conditions = input.conditions;
}
public long getID() {
return cmid;
}
public List<TCondition> getConditions() {
return conditions;
}
} | 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. |
protected long numKeysRead; | Either log or rethrow this exception. |
/**
* Exception to throw if an operation is attempted on a table that doesn't exist.
*
*/
private static final long serialVersionUID = 1L;
private String tableName;
/**
* @param tableId
* the internal id of the table that was sought
* @param tableName
* the visible name of the table that was sought
* @param description
* the specific reason why it failed
*/
public TableNotFoundException(String tableId, String tableName, String description) {
super("Table" + (tableName != null && !tableName.isEmpty() ? " " + tableName : "") + (tableId != null && !tableId.isEmpty() ? " (Id=" + tableId + ")" : "")
+ " does not exist" + (description != null && !description.isEmpty() ? " (" + description + ")" : ""));
this.tableName = tableName;
}
/**
* @param tableId
* the internal id of the table that was sought
* @param tableName
* the visible name of the table that was sought
* @param description
* the specific reason why it failed
* @param cause
* the exception that caused this failure
*/
public TableNotFoundException(String tableId, String tableName, String description, Throwable cause) {
this(tableId, tableName, description);
super.initCause(cause);
}
/**
* @param e
* constructs an exception from a thrift exception
*/
public TableNotFoundException(ThriftTableOperationException e) {
this(e.getTableId(), e.getTableName(), e.getDescription(), e);
}
/**
* @return the name of the table sought
*/
public String getTableName() {
return tableName;
} | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
*
*
*
*
* | Replace all tab characters in this file by sequences of white-spaces. |
import org.apache.accumulo.core.security.tokens.PasswordToken; | Replace all tab characters in this file by sequences of white-spaces. |
import org.apache.accumulo.core.conf.AccumuloConfiguration;
private AccumuloConfiguration acuTableConf;
AccumuloConfiguration acuTableConf, KeyExtent extent, CompactionEnv env, List<IteratorSetting> iterators, MajorCompactionReason reason) {
AccumuloConfiguration acuTableConf, KeyExtent extent, CompactionEnv env) { | Remove this unused import 'org.apache.hadoop.fs.FileSystem'. |
import org.apache.accumulo.core.metadata.RootTable;
import org.apache.accumulo.core.metadata.schema.MetadataSchema;
import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.DataFileColumnFamily;
import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.LogColumnFamily;
import org.apache.accumulo.server.util.MetadataTableUtil.LogEntry;
rwal = MetadataTableUtil.getLogEntries(null, RootTable.EXTENT);
columns.add(new Column(TextUtil.getBytes(DataFileColumnFamily.NAME), null, null));
columns.add(new Column(TextUtil.getBytes(LogColumnFamily.NAME), null, null));
if (ssi.getTopKey().compareColumnFamily(DataFileColumnFamily.NAME) == 0) {
scanner.setRange(MetadataSchema.TabletsSection.getRange()); | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
import org.apache.accumulo.core.security.tokens.PasswordToken; | 1 duplicated blocks of code must be removed. |
@SuppressWarnings("all") public class UpdateErrors implements org.apache.thrift.TBase<UpdateErrors, UpdateErrors._Fields>, java.io.Serializable, Cloneable { | 13 duplicated blocks of code must be removed. |
import org.apache.accumulo.core.iterators.IteratorUtil.IteratorScope; | Either log or rethrow this exception. |
String tableName = getTableNames(1)[0];
| Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
private final Set<MemoryIterator> activeIters = Collections.synchronizedSet(new HashSet<MemoryIterator>()); | Remove this unused private "appendProp" method. |
connector = instance.getConnector("user", "password");
Connector connector = instance.getConnector("user", "password"); | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
* Factory method to create a ConditionalWriter connected to Accumulo.
*
* @param tableName
* the name of the table to query data from
* @param config
* configuration used to create conditional writer
*
* @return ConditionalWriter object for writing ConditionalMutations
* @throws TableNotFoundException
* when the specified table doesn't exist
* @since 1.6.0
*/
public abstract ConditionalWriter createConditionalWriter(String tableName, ConditionalWriterConfig config) throws TableNotFoundException;
/** | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
private BatchWriter writer = null;
private Connector connector;
final String table;
if (writer == null)
resetWriter();
if (writer == null)
return;
table = conf.get(Property.TRACE_TABLE);
resetWriter();
}
}
synchronized private void resetWriter() {
try {
if (writer != null)
writer.close();
} catch (Exception ex) {
log.error("Error closing batch writer", ex);
} finally {
writer = null;
try {
writer = connector.createBatchWriter(table, 100l * 1024 * 1024, 5 * 1000l, 10);
} catch (Exception ex) {
log.error("Unable to create a batch writer: " + ex);
}
| Reorder the modifiers to comply with the Java Language Specification. |
if (this.credentials.getPrincipal().equals(principal)) { | Move this constructor to comply with Java Code Conventions. |
@Override
public void visit(State state, Properties props) throws Exception {
Connector conn = state.getConnector();
int nextId = ((Integer) state.get("nextId")).intValue();
String tableName = String.format("%s_%d", state.getString("tableNamePrefix"), nextId);
try {
conn.tableOperations().create(tableName);
String tableId = Tables.getNameToIdMap(state.getInstance()).get(tableName);
log.debug("created " + tableName + " (id:" + tableId + ")");
@SuppressWarnings("unchecked")
ArrayList<String> tables = (ArrayList<String>) state.get("tableList");
tables.add(tableName);
} catch (TableExistsException e) {
log.warn("Failed to create " + tableName + " as it already exists");
nextId++;
state.set("nextId", new Integer(nextId));
} | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
import org.apache.accumulo.core.Constants;
Value inVal = new Value(multiByteText.getBytes(Constants.UTF8));
String outVal = new String(outValue.get(), Constants.UTF8); | Move this variable to comply with Java Code Conventions. |
folder.delete(); | 2 duplicated blocks of code must be removed. |
@Override
| Reduce the number of conditional operators (6) used in the expression (maximum allowed 3). |
import org.apache.accumulo.cloudtrace.thrift.TInfo; | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
if (!fs.rename(tmpDatafile, newDatafile)) {
throw new IOException("rename fails");
} | Refactor this code to not nest more than 3 if/for/while/switch/try statements. |
String _elem108; // optional
IteratorSetting _elem111; // optional
String _elem118; // optional
IteratorSetting _elem121; // optional | 277 duplicated blocks of code must be removed. |
package org.apache.accumulo.server.tabletserver.mastermessage;
import java.util.Map;
import java.util.TreeMap;
import org.apache.accumulo.core.client.impl.Translator;
import org.apache.accumulo.core.data.KeyExtent;
import org.apache.accumulo.core.master.thrift.MasterClientService;
import org.apache.accumulo.core.master.thrift.TabletSplit;
import org.apache.accumulo.core.security.thrift.AuthInfo;
import org.apache.accumulo.core.security.thrift.ThriftSecurityException;
import org.apache.hadoop.io.Text;
import org.apache.thrift.TException;
public class SplitReportMessage implements MasterMessage {
Map<KeyExtent, Text> extents;
KeyExtent old_extent;
public SplitReportMessage(KeyExtent old_extent, Map<KeyExtent, Text> newExtents)
{
this.old_extent = old_extent;
extents = new TreeMap<KeyExtent, Text>(newExtents);
}
public SplitReportMessage(KeyExtent old_extent, KeyExtent ne1, Text np1, KeyExtent ne2, Text np2) {
this.old_extent = old_extent;
extents = new TreeMap<KeyExtent, Text>();
extents.put(ne1, np1);
extents.put(ne2, np2);
}
public void send(AuthInfo credentials, String serverName, MasterClientService.Iface client) throws TException, ThriftSecurityException {
TabletSplit split = new TabletSplit();
split.oldTablet = old_extent.toThrift();
split.newTablets = Translator.translate(extents.keySet(), Translator.KET);
client.reportSplitExtent(null, credentials, serverName, split);
}
} | Return empty string instead. |
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. |
import java.io.File;
public static TemporaryFolder folder = new TemporaryFolder(new File(System.getProperty("user.dir") + "/target"));
| Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
System.out.println("accumulo init | master | tserver | monitor | shell | admin | gc | classpath | rfile-info | login-info | tracer | mini | proxy | zookeeper | <accumulo class> args"); | Replace this use of System.out or System.err by a logger. |
if (super.validateOptions(options) == false)
return false;
try {
setEncoder(options);
} catch (Exception e) {
throw new IllegalArgumentException("bad encoder option", e);
} | Return empty string instead. |
leaf.jump(jumpKey);
if (testTreeState() && overallRange.contains(root.getTopKey())) {
next();
if (log.isDebugEnabled()) {
log.debug("overallRange " + overallRange + " topKey " + this.root.getTopKey() + " contains " + overallRange.contains(this.root.getTopKey()));
}
if (overallRange.contains(this.root.getTopKey()) && this.root.isValid()) { | 31 duplicated blocks of code must be removed. |
VARLEN, FIXEDLEN, STRING
case VARLEN:
case FIXEDLEN:
io.setName("longcombiner");
io.setDescription("LongCombiner can interpret Values as Longs in a variety of encodings (variable length, fixed length, or string) before combining");
io.addNamedOption(TYPE, "<VARLEN|FIXEDLEN|STRING|fullClassName>"); | Remove the literal "true" boolean value. |
import org.apache.accumulo.core.security.tokens.InstanceTokenWrapper;
private InstanceTokenWrapper credentials;
public ScannerImpl(Instance instance, InstanceTokenWrapper credentials, String table, Authorizations authorizations) { | Immediately return this expression instead of assigning it to the temporary variable "ret". |
import java.util.Arrays;
import org.apache.commons.logging.impl.Log4JCategoryLog;
for (int i = 0; i < 10; i++) {
exec("ping", true, "OK", true);
// wait for both tservers to start up
if (output.get().split("\n").length == 3)
break;
UtilWaitThread.sleep(1000);
} | Either log or rethrow this exception. |
// private static final Logger log = Logger.getLogger(TraceProxy.class);
static final Sampler ALWAYS = new Sampler() {
@Override
public boolean next() {
return true;
}
};
public static <T> T trace(T instance) {
return trace(instance, ALWAYS);
}
@SuppressWarnings("unchecked")
public static <T> T trace(final T instance, final Sampler sampler) {
InvocationHandler handler = new InvocationHandler() {
@Override
public Object invoke(Object obj, Method method, Object[] args) throws Throwable {
if (!sampler.next()) {
return method.invoke(instance, args);
}
Span span = Trace.on(method.getName());
try {
return method.invoke(instance, args);
} catch (Throwable ex) {
ex.printStackTrace();
throw ex;
} finally {
span.stop();
}
return (T) Proxy.newProxyInstance(instance.getClass().getClassLoader(), instance.getClass().getInterfaces(), handler);
}
| Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
/*
* 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. |
AccumuloInputFormat.addIterator(job, is);
AccumuloInputFormat.addIterator(job, new IteratorSetting(1, "WholeRow", WholeRowIterator.class));
AccumuloInputFormat.addIterator(job, new IteratorSetting(2, "Versions", "org.apache.accumulo.core.iterators.VersioningIterator"));
AccumuloInputFormat.addIterator(job, iter);
List<IteratorSetting> list = AccumuloInputFormat.getIterators(job);
AccumuloInputFormat.addIterator(job, someSetting);
List<IteratorSetting> list = AccumuloInputFormat.getIterators(job);
AccumuloInputFormat.addIterator(job, someSetting);
list = AccumuloInputFormat.getIterators(job);
AccumuloInputFormat.addIterator(job, new IteratorSetting(1, "WholeRow", "org.apache.accumulo.core.iterators.WholeRowIterator"));
AccumuloInputFormat.addIterator(job, new IteratorSetting(2, "Versions", "org.apache.accumulo.core.iterators.VersioningIterator"));
AccumuloInputFormat.addIterator(job, new IteratorSetting(3, "Count", "org.apache.accumulo.core.iterators.CountingIterator"));
List<IteratorSetting> list = AccumuloInputFormat.getIterators(job);
AccumuloInputFormat.addIterator(job, is);
assertTrue(regex.equals(AccumuloInputFormat.getIterators(job).get(0).getName()));
AccumuloInputFormat.setInputInfo(job, user, pass.getBytes(), table, Constants.NO_AUTHS);
AccumuloInputFormat.setMockInstance(job, "testmapinstance"); | Move this variable to comply with Java Code Conventions. |
SITE_CONF = System.getenv("ACCUMULO_CONF_DIR") + "/" + configFile; | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
import java.net.InetAddress;
HashMap<String,String> hostNameCache = new HashMap<String,String>();
String ip = tserverBin.getKey().split(":", 2)[0];
String location = hostNameCache.get(ip);
if (location == null) {
InetAddress inetAddress = InetAddress.getByName(ip);
location = inetAddress.getHostName();
hostNameCache.put(ip, location);
}
| Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
import org.apache.accumulo.server.tabletserver.TabletServer;
import org.apache.accumulo.server.tabletserver.log.RemoteLogger.LoggerOperation;
LoggerOperation write(RemoteLogger logger, int seq) throws Exception;
ArrayList<LoggerOperation> queuedOperations = new ArrayList<LoggerOperation>(copy.size());
LoggerOperation lop = writer.write(wal, seq);
if (lop != null)
queuedOperations.add(lop);
}
for (LoggerOperation lop : queuedOperations) {
lop.await();
public LoggerOperation write(RemoteLogger logger, int ignored) throws Exception {
return null;
public LoggerOperation write(RemoteLogger logger, int ignored) throws Exception {
return logger.log(tabletSeq, commitSession.getLogId(), m);
public LoggerOperation write(RemoteLogger logger, int ignored) throws Exception {
return logger.logManyTablets(copy);
public LoggerOperation write(RemoteLogger logger, int ignored) throws Exception {
return null;
public LoggerOperation write(RemoteLogger logger, int ignored) throws Exception {
return null; | Remove the redundant '!unknownSymbol!' thrown exception declaration(s). |
volatile boolean gotLock = false;
volatile Exception failureException = null;
@Override
public void acquiredLock() {
gotLock = true;
}
@Override
public void failedToAcquireLock(Exception e) {
failureException = e;
}
@Override
public void lostLock(LockLossReason reason) {}
| Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
import org.apache.accumulo.trace.thrift.TInfo;
* @see org.apache.accumulo.core.tabletserver.thrift.TabletClientService.Iface#removeLogs(org.apache.accumulo.trace.thrift.TInfo, | Remove the redundant '!unknownSymbol!' thrown exception declaration(s). |
if (sleepTime > 0)
Thread.sleep(sleepTime); | Remove this call to "exit" or ensure it is really required. |
* A lexicoder that flips the sort order from another lexicoder. If this is applied to {@link DateLexicoder}, the most recent date will be sorted first and the
* oldest date will be sorted last. If it's applied to {@link LongLexicoder}, the Long.MAX_VALUE will be sorted first and Long.MIN_VALUE will be sorted last,
* etc...
/**
* @param lexicoder
* The lexicoder who's sort order will be flipped.
*/ | Remove this unused import 'java.util.Date'. |
package org.apache.accumulo.core.iterators.system;
import java.io.IOException;
import java.util.Collection;
import java.util.Map;
import org.apache.accumulo.core.data.ByteSequence;
import org.apache.accumulo.core.data.Range;
import org.apache.accumulo.core.iterators.IteratorEnvironment;
import org.apache.accumulo.core.iterators.SortedKeyValueIterator;
import org.apache.hadoop.io.Writable;
import org.apache.hadoop.io.WritableComparable;
/***
* SynchronizedIterator: wrap a SortedKeyValueIterator so that all of its methods are synchronized
*/
public class SynchronizedIterator <K extends WritableComparable<?>,V extends Writable> implements SortedKeyValueIterator<K,V> {
private SortedKeyValueIterator<K,V> source = null;
@Override
public synchronized void init(SortedKeyValueIterator<K,V> source, Map<String,String> options, IteratorEnvironment env) throws IOException {
this.source = source;
source.init(source, options, env);
}
@Override
public synchronized boolean hasTop() {
return source.hasTop();
}
@Override
public synchronized void next() throws IOException {
source.next();
}
@Override
public synchronized void seek(Range range, Collection<ByteSequence> columnFamilies, boolean inclusive) throws IOException {
source.seek(range, columnFamilies, inclusive);
}
@Override
public synchronized K getTopKey() {
return source.getTopKey();
}
@Override
public synchronized V getTopValue() {
return source.getTopValue();
}
@Override
public synchronized SortedKeyValueIterator<K,V> deepCopy(IteratorEnvironment env) {
return new SynchronizedIterator<K,V>(source.deepCopy(env));
}
public SynchronizedIterator(){}
public SynchronizedIterator(SortedKeyValueIterator<K,V> source)
{
this.source = source;
}
} | Move this constructor to comply with Java Code Conventions. |
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
*
long isReady(long tid, T environment) throws Exception;
Repo<T> call(long tid, T environment) throws Exception;
void undo(long tid, T environment) throws Exception;
// this allows the last fate op to return something to the user | 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.