Diff stringlengths 10 2k | Message stringlengths 28 159 |
|---|---|
package org.apache.accumulo.core.iterators.user;
import org.apache.accumulo.core.iterators.IteratorEnvironment;
import org.apache.accumulo.core.iterators.IteratorUtil;
import org.apache.accumulo.core.iterators.SortedKeyValueIterator;
import org.apache.accumulo.core.iterators.SortedMapIterator;
import org.apache.accumulo.core.iterators.user.RowDeletingIterator; | Remove the literal "false" boolean value. |
Authorizations.EMPTY); | Remove this unused method parameter "range". |
Accumulo.enableTracing(local.getHostName(), "tserver"); | Rename this package name to match the regular expression '^[a-z]+(\.[a-z][a-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. |
@Test(timeout = 2 * 60 * 1000) | Either log or rethrow this exception. |
import org.apache.accumulo.examples.wikisearch.ingest.WikipediaInputFormat.WikipediaInputSplit;
private int myGroup = -1;
private int numGroups = -1;
WikipediaInputSplit wiSplit = (WikipediaInputSplit)context.getInputSplit();
myGroup = wiSplit.getPartition();
numGroups = WikipediaConfiguration.getNumGroups(conf);
FileSplit split = wiSplit.getFileSplit();
int groupId = WikipediaMapper.getPartitionId(article, numGroups);
if(groupId != myGroup)
return; | Move this variable to comply with Java Code Conventions. |
*
*
*
*
*
| Replace all tab characters in this file by sequences of white-spaces. |
if (suffix.startsWith("/"))
suffix = suffix.substring(1);
return new Path(getBaseDirs()[0], "instance_id");
return new Path(getBaseDirs()[0], "version"); | Introduce a new variable instead of reusing the parameter "suffix". |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ | Replace all tab characters in this file by sequences of white-spaces. |
public class BinaryIT extends ConfigurableMacIT { | Use "Integer.toString" instead. |
tableOpt = new Option(Shell.tableOption, "table", true, "table to fetch locality groups for"); | 2 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.
*/
@SuppressWarnings("all") public enum CompactionType implements org.apache.thrift.TEnum { | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
client = MasterClient.getConnectionWithRetry(HdfsZooInstance.getInstance()); | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
state.set("bulkImportSuccess", "true"); | 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. |
public class CreateAndUseIT extends SimpleMacIT {
String tableName = makeTableName();
getConnector().tableOperations().create(tableName);
getConnector().tableOperations().addSplits(tableName, splits);
BatchWriter bw = getConnector().createBatchWriter(tableName, new BatchWriterConfig());
Scanner scanner1 = getConnector().createScanner(tableName, Authorizations.EMPTY);
String table2 = makeTableName();
getConnector().tableOperations().create(table2);
getConnector().tableOperations().addSplits(table2, splits);
Scanner scanner2 = getConnector().createScanner(table2, Authorizations.EMPTY);
String table3 = makeTableName();
getConnector().tableOperations().create(table3);
getConnector().tableOperations().addSplits(table3, splits);
BatchScanner bs = getConnector().createBatchScanner(table3, Authorizations.EMPTY, 3); | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
if (ref == null)
return null; | Remove this call to "exit" or ensure it is really required. |
timestampOpt = new Option("st", "show-timestamps", false, "enable displaying timestamps");
disablePaginationOpt = new Option("np", "no-pagination", false, "disable pagination of output");
tableOpt = new Option(Shell.tableOption, "tableName", true, "table to select row from"); | 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. |
this(priority, name, iteratorClass, new HashMap<String,String>());
public IteratorSetting(int priority, String name, String iteratorClass, Map<String,String> properties) {
public IteratorSetting(int priority, Class<? extends SortedKeyValueIterator<Key,Value>> iteratorClass,
this(priority, iteratorClass.getSimpleName(), iteratorClass.getName(), properties);
this(priority, name, iteratorClass.getName(), properties);
public Text getColumnFamily() {
return getFirst();
}
public Text getColumnQualifierf() {
return getSecond();
}
| Remove this unused method parameter "table". |
/*
* 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. |
/*
* 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.wikisearch.normalizer;
public class NoOpNormalizer implements Normalizer {
public String normalizeFieldValue(String field, Object value) {
return value.toString();
}
} | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
import java.util.Collections;
@Test
public void testReseekUnconsumed() throws Exception {
TestRFile trf = new TestRFile();
trf.openWriter();
for (int i = 0; i < 2500; i++) {
trf.writer.append(nk(nf("r_", i), "cf1", "cq1", "L1", 42), nv("foo" + i));
}
trf.closeWriter();
trf.openReader();
Set<ByteSequence> cfs = Collections.emptySet();
Random rand = new Random();
for (int count = 0; count < 100; count++) {
int start = rand.nextInt(2300);
Range range = new Range(nk(nf("r_", start), "cf1", "cq1", "L1", 42), nk(nf("r_", start + 100), "cf1", "cq1", "L1", 42));
trf.reader.seek(range, cfs, false);
int numToScan = rand.nextInt(100);
for (int j = 0; j < numToScan; j++) {
assertTrue(trf.reader.hasTop());
assertEquals(nk(nf("r_", start + j), "cf1", "cq1", "L1", 42), trf.reader.getTopKey());
trf.reader.next();
}
assertTrue(trf.reader.hasTop());
assertEquals(nk(nf("r_", start + numToScan), "cf1", "cq1", "L1", 42), trf.reader.getTopKey());
// seek a little forward from the last range and read a few keys within the unconsumed portion of the last range
int start2 = start + numToScan + rand.nextInt(3);
int end2 = start2 + rand.nextInt(3);
range = new Range(nk(nf("r_", start2), "cf1", "cq1", "L1", 42), nk(nf("r_", end2), "cf1", "cq1", "L1", 42));
trf.reader.seek(range, cfs, false);
for (int j = start2; j <= end2; j++) {
assertTrue(trf.reader.hasTop());
assertEquals(nk(nf("r_", j), "cf1", "cq1", "L1", 42), trf.reader.getTopKey());
trf.reader.next();
}
assertFalse(trf.reader.hasTop());
}
trf.closeReader();
}
| Replace all tab characters in this file by sequences of white-spaces. |
AccumuloOutputFormat.setZooKeeperInstance(job.getConfiguration(), args[0], args[1]);
AccumuloOutputFormat.setOutputInfo(job.getConfiguration(), args[3], args[4].getBytes(), true, null); | 1 duplicated blocks of code must be removed. |
import org.apache.accumulo.cloudtrace.instrument.Tracer;
ServerClient.execute(instance, new ClientExec<ClientService.Client>() {
public void execute(ClientService.Client iface) throws Exception {
iface.authenticateUser(Tracer.traceInfo(), credentials, credentials.user, credentials.password); | Immediately return this expression instead of assigning it to the temporary variable "client". |
import java.io.UnsupportedEncodingException;
public static final String ENCODING = "encoding";
public static final String ENCODING_DEFAULT = "UTF-8";
private String encoding = ENCODING_DEFAULT;
private Matcher copyMatcher(Matcher m) {
if (m == null)
return m;
else
return m.pattern().matcher("");
try {
matcher.reset(new String(bs.getBackingArray(), bs.offset(), bs.length(), encoding));
return matcher.matches();
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
try {
matcher.reset(new String(data, offset, len, encoding));
return matcher.matches();
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
if (options.containsKey(ENCODING)) {
encoding = options.get(ENCODING);
}
io.addNamedOption(RegExFilter.ENCODING, "character encoding of byte array value (default is " + ENCODING_DEFAULT + ")");
if (options.containsKey(ENCODING)) {
try {
this.encoding = options.get(ENCODING);
@SuppressWarnings("unused")
String test = new String("test".getBytes(), encoding);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
return false;
}
}
/**
* Set the encoding string to use when interpreting characters
*
* @param si
* ScanIterator config to be updated
* @param encoding
* the encoding string to use for character interpretation.
*
*/
public static void setEncoding(IteratorSetting si, String encoding) {
if (!encoding.isEmpty()) {
si.addOption(RegExFilter.ENCODING, encoding);
}
} | Either log or rethrow this exception. |
List<String> fail = client.bulkImportFiles(Tracer.traceInfo(), SecurityConstants.getSystemCredentials(), tid, tableId, attempt, errorDir, setTime); | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ | Replace all tab characters in this file by sequences of white-spaces. |
import org.apache.accumulo.core.iterators.user.IntersectingIterator; | Remove this unused private "match" method. |
@Override
@Override
* Allow the concrete servlet implementation to provide attributes on the body HTML tag, such as 'onload', which can be used to call Javascript methods on
* page load. By default, nothing is specified.
return URLEncoder.encode(s, Constants.UTF8.name());
Logger.getLogger(BasicServlet.class).fatal(Constants.UTF8.name() + " is not a recognized encoding", e);
return URLDecoder.decode(s, Constants.UTF8.name());
Logger.getLogger(BasicServlet.class).fatal(Constants.UTF8.name() + " is not a recognized encoding", e); | Move this variable to comply with Java Code Conventions. |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ | 296 duplicated blocks of code must be removed. |
import org.apache.accumulo.core.client.security.SecurityErrorCode; | Do not forget to remove this deprecated code someday. |
public int execute(final String fullCommand, final CommandLine cl, final Shell shellState) throws IOException, AccumuloException, AccumuloSecurityException,
final String tableName = OptUtil.getTableOpt(cl, shellState);
final PrintLine p = outputFile == null ? new PrintShell(shellState.getReader()) : new PrintFile(outputFile);
private static String encode(final boolean encode, final Text text) {
if (text == null) {
}
private static String obscuredTabletName(final KeyExtent extent) {
final Options opts = new Options(); | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
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.client.ConditionalWriter;
import org.apache.accumulo.core.client.ConditionalWriterConfig;
public ConditionalWriter createConditionalWriter(String tableName, ConditionalWriterConfig config) throws TableNotFoundException {
return new ConditionalWriterImpl(instance, credentials, getTableId(tableName), config);
}
@Override | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
import org.apache.accumulo.core.client.security.tokens.PasswordToken;
import org.apache.accumulo.proxy.thrift.ScanColumn;
prop.put("org.apache.accumulo.proxy.ProxyServer.tokenClass", PasswordToken.class.getName()); | Remove the redundant '!unknownSymbol!' thrown exception declaration(s). |
int kvCount;
this.kvCount = mc;
this.kvCount = Integer.MAX_VALUE;
this.kvCount = mc;
return super.toString() + " mc=" + kvCount;
out.writeInt(kvCount);
kvCount = in.readInt();
cmp = ((MemKey) k).kvCount - kvCount; | Either log or rethrow this exception. |
import java.util.concurrent.atomic.AtomicBoolean;
import org.apache.zookeeper.AsyncCallback.VoidCallback;
import org.apache.zookeeper.KeeperException.Code;
@Override
public void sync(final String path) throws KeeperException, InterruptedException {
final int[] rc = { 0 };
final AtomicBoolean waiter = new AtomicBoolean(false);
getZooKeeper().sync(path, new VoidCallback() {
@Override
public void processResult(int code, String arg1, Object arg2) {
rc[0] = code;
synchronized (waiter) {
waiter.set(true);
waiter.notifyAll();
}
}}, null);
synchronized (waiter) {
while (!waiter.get())
waiter.wait();
}
Code code = Code.get(rc[0]);
if (code != KeeperException.Code.OK) {
throw KeeperException.create(code);
}
}
| Reorder the modifiers to comply with the Java Language Specification. |
import org.apache.accumulo.proxy.thrift.KeyValueAndPeek;
@Override
public void cancelCompaction(UserPass userpass, String tableName) throws org.apache.accumulo.proxy.thrift.AccumuloSecurityException,
org.apache.accumulo.proxy.thrift.TableNotFoundException, org.apache.accumulo.proxy.thrift.AccumuloException, TException {
try {
getConnector(userpass).tableOperations().cancelCompaction(tableName);
} catch (Exception e) {
throw translateException(e);
}
}
| Rename this package name to match the regular expression '^[a-z]+(\.[a-z][a-z0-9]*)*$'. |
import org.apache.accumulo.core.tabletserver.thrift.LogCopyInfo;
public LogCopyInfo startCopy(TInfo info, AuthInfo credentials, final String localLog, final String fullyQualifiedFileName, final boolean sort) {
return new LogCopyInfo(result, null); | Remove this unused method parameter "acuConf". |
* Initializes a new user
*
* @param user
* @throws AccumuloSecurityException
*/
public void initTable(String table) throws AccumuloSecurityException;
/** | Reduce this switch case number of lines from 44 to at most 5, for example by extracting code into methods. |
client.loadTablet(Tracer.traceInfo(), SecurityConstants.getSystemCredentials(), lockString(lock), extent.toThrift());
client.unloadTablet(Tracer.traceInfo(), SecurityConstants.getSystemCredentials(), lockString(lock), extent.toThrift(), save);
return client.getTabletServerStatus(Tracer.traceInfo(), SecurityConstants.getSystemCredentials());
client.halt(Tracer.traceInfo(), SecurityConstants.getSystemCredentials(), lockString(lock));
client.fastHalt(Tracer.traceInfo(), SecurityConstants.getSystemCredentials(), lockString(lock));
client.flush(Tracer.traceInfo(), SecurityConstants.getSystemCredentials(), lockString(lock), tableId, startRow == null ? null : ByteBuffer.wrap(startRow),
client.chop(Tracer.traceInfo(), SecurityConstants.getSystemCredentials(), lockString(lock), extent.toThrift());
.splitTablet(Tracer.traceInfo(), SecurityConstants.getSystemCredentials(), extent.toThrift(), ByteBuffer.wrap(splitPoint.getBytes(), 0, splitPoint.getLength()));
client.flushTablet(Tracer.traceInfo(), SecurityConstants.getSystemCredentials(), lockString(lock), extent.toThrift());
client.compact(Tracer.traceInfo(), SecurityConstants.getSystemCredentials(), lockString(lock), tableId, startRow == null ? null : ByteBuffer.wrap(startRow), | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
import org.apache.accumulo.core.client.admin.TimeType;
import org.apache.accumulo.proxy.thrift.PTimeType;
public void tableOperations_compact(UserPass userpass, String tableName, ByteBuffer start, ByteBuffer end, List<PIteratorSetting> iterators, boolean flush, boolean wait)
getConnector(userpass).tableOperations().compact(tableName, ByteBufferUtil.toText(start), ByteBufferUtil.toText(end), getPIteratorSettings(iterators), flush, wait);
private List<IteratorSetting> getPIteratorSettings(List<PIteratorSetting> iterators) {
List<IteratorSetting> result = new ArrayList<IteratorSetting>();
for (PIteratorSetting is : iterators) {
result.add(getIteratorSetting(is));
}
return result;
}
public void tableOperations_create(UserPass userpass, String tableName, boolean versioningIter, PTimeType timeType) throws AccumuloException, AccumuloSecurityException, TableExistsException, TException {
getConnector(userpass).tableOperations().create(tableName, versioningIter, TimeType.valueOf(timeType.toString()));
public void securityOperations_createUser(UserPass userpass, String user, ByteBuffer password) throws AccumuloException,
@Override
public void instanceOperations_pingTabletServer(UserPass userpass, String tserver) throws AccumuloException, AccumuloSecurityException, TException {
try {
getConnector(userpass).instanceOperations().ping(tserver);
} catch (Exception e) {
throw new TException(e);
}
} | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
import org.apache.accumulo.fate.zookeeper.IZooReaderWriter;
import org.apache.accumulo.fate.zookeeper.ZooUtil.NodeExistsPolicy;
import org.apache.accumulo.fate.zookeeper.ZooUtil.NodeMissingPolicy; | Remove this call to "exit" or ensure it is really required. |
package cloudtrace.instrument;
import java.util.concurrent.Callable;
/**
* Wrap a Callable with a Span that survives a change in threads.
*
*/
public class TraceCallable<V> implements Callable<V> {
private final Callable<V> impl;
private final Span parent;
TraceCallable(Callable<V> impl) {
this(Trace.currentTrace(), impl);
}
TraceCallable(Span parent, Callable<V> impl) {
this.impl = impl;
this.parent = parent;
}
@Override
public V call() throws Exception {
if (parent != null) {
Span chunk = Trace.startThread(parent, Thread.currentThread().getName());
try {
return impl.call();
} finally {
Trace.endThread(chunk);
}
} else {
return impl.call();
}
}
} | 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.
*/ | Remove this unused private "appendProp" method. |
import org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException; | Move this constructor to comply with Java Code Conventions. |
/**
* Utility program that will change the goal state for the master from the command line.
*/
public static void main(String[] args) throws Exception {
if (args.length != 1 || MasterGoalState.valueOf(args[0]) == null) {
System.err.println("Usage: accumulo " + SetGoalState.class.getName() + " [NORMAL|SAFE_MODE|CLEAN_STOP]");
System.exit(-1);
Accumulo.waitForZookeeperAndHdfs();
ZooReaderWriter.getInstance().putPersistentData(ZooUtil.getRoot(HdfsZooInstance.getInstance()) + Constants.ZMASTER_GOAL_STATE, args[0].getBytes(),
NodeExistsPolicy.OVERWRITE);
}
| Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
/**
import org.apache.accumulo.core.iterators.user.IndexedDocIterator;
* This class remains here for backwards compatibility.
* @deprecated since 1.4
* @see org.apache.accumulo.core.iterators.user.IndexedDocIterator
public class FamilyIntersectingIterator extends IndexedDocIterator { | Either log or rethrow this exception. |
@Test(timeout=60*1000) | Either log or rethrow this exception. |
import org.apache.accumulo.core.client.security.tokens.AuthenticationToken;
import org.mortbay.log.Log;
TCredentials user = CredentialHelper.fromByteArray(ByteBufferUtil.toBytes(login));
logger.debug(e,e);
logger.debug(e,e);
logger.debug(e,e);
logger.debug(e,e);
auth = connector.securityOperations().getUserAuthorizations(connector.whoami());
public boolean authenticateUser(ByteBuffer login, String user, Map<String, String> properties) throws TException {
return getConnector(login).securityOperations().authenticateUser(user, getToken(properties));
public void changeLocalUserPassword(ByteBuffer login, String user, ByteBuffer password) throws TException {
public void createLocalUser(ByteBuffer login, String user, ByteBuffer password) throws TException {
getConnector(login).securityOperations().createLocalUser(user, new PasswordToken(password));
public void dropLocalUser(ByteBuffer login, String user) throws TException {
public Set<String> listLocalUsers(ByteBuffer login) throws TException {
auth = connector.securityOperations().getUserAuthorizations(connector.whoami());
auth = connector.securityOperations().getUserAuthorizations(connector.whoami());
public ByteBuffer login(String principal, Map<String,String> loginProperties) throws TException {
try {
AuthenticationToken token = getToken(loginProperties);
TCredentials credential = CredentialHelper.create(principal, token, instance.getInstanceID());
return ByteBuffer.wrap(CredentialHelper.asByteArray(credential));
} catch (Exception e) {
throw translateException(e);
}
}
private AuthenticationToken getToken(Map<String, String> properties) throws AccumuloSecurityException, AccumuloException {
Properties props = new Properties();
props.putAll(properties);
return instance.getAuthenticator().login(props); | Remove this hard-coded password. |
import static org.junit.Assert.assertNotEquals;
import java.util.concurrent.TimeUnit;
import org.apache.hadoop.mapreduce.JobContext;
public void testBWSettings() throws IOException {
Job job = new Job();
// make sure we aren't testing defaults
final BatchWriterConfig bwDefaults = new BatchWriterConfig();
assertNotEquals(7654321l, bwDefaults.getMaxLatency(TimeUnit.MILLISECONDS));
assertNotEquals(9898989l, bwDefaults.getTimeout(TimeUnit.MILLISECONDS));
assertNotEquals(42, bwDefaults.getMaxWriteThreads());
assertNotEquals(1123581321l, bwDefaults.getMaxMemory());
final BatchWriterConfig bwConfig = new BatchWriterConfig();
bwConfig.setMaxLatency(7654321l, TimeUnit.MILLISECONDS);
bwConfig.setTimeout(9898989l, TimeUnit.MILLISECONDS);
bwConfig.setMaxWriteThreads(42);
bwConfig.setMaxMemory(1123581321l);
AccumuloOutputFormat.setBatchWriterOptions(job, bwConfig);
AccumuloOutputFormat myAOF = new AccumuloOutputFormat() {
@Override
public void checkOutputSpecs(JobContext job) throws IOException {
BatchWriterConfig bwOpts = getBatchWriterOptions(job);
// passive check
assertEquals(bwConfig.getMaxLatency(TimeUnit.MILLISECONDS), bwOpts.getMaxLatency(TimeUnit.MILLISECONDS));
assertEquals(bwConfig.getTimeout(TimeUnit.MILLISECONDS), bwOpts.getTimeout(TimeUnit.MILLISECONDS));
assertEquals(bwConfig.getMaxWriteThreads(), bwOpts.getMaxWriteThreads());
assertEquals(bwConfig.getMaxMemory(), bwOpts.getMaxMemory());
// explicit check
assertEquals(7654321l, bwOpts.getMaxLatency(TimeUnit.MILLISECONDS));
assertEquals(9898989l, bwOpts.getTimeout(TimeUnit.MILLISECONDS));
assertEquals(42, bwOpts.getMaxWriteThreads());
assertEquals(1123581321l, bwOpts.getMaxMemory());
}
};
myAOF.checkOutputSpecs(job);
}
@Test | Either log or rethrow this exception. |
import org.apache.accumulo.server.mini.MiniAccumuloCluster; | Either log or rethrow this exception. |
public class BulkSplitOptimizationIT extends ConfigurableMacIT {
opts.password = new Password(ROOT_PASSWORD); | 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.
*/ | Replace all tab characters in this file by sequences of white-spaces. |
// TODO get the table configuration for the given table?
// TODO account for object overhead
// TODO use a MutableLong instead
| Complete the task associated to this TODO comment. |
try {
Boolean.parseBoolean(options.get(NEGATE));
} catch (Exception e) {
throw new IllegalArgumentException("bad boolean " + NEGATE + ":" + options.get(NEGATE));
} | Remove the literal "false" boolean value. |
import java.util.Scanner;
public int execute(final String fullCommand, final CommandLine cl, final Shell shellState) throws Exception {
Scanner scanner = new Scanner(new File(cl.getArgs()[0]));
while (scanner.hasNextLine()) {
}
final Options opts = new Options(); | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ | Replace all tab characters in this file by sequences of white-spaces. |
public static String putEphemeralData(ZooKeeper zk, String zPath, byte[] data) throws KeeperException, InterruptedException {
return zk.create(zPath, data, ZooUtil.PUBLIC, CreateMode.EPHEMERAL);
}
| Reduce this switch case number of lines from 11 to at most 5, for example by extracting code into methods. |
try {
shellState.getConnector().tableOperations().addConstraint(tableName, VisibilityConstraint.class.getName());
} catch (AccumuloException e) {
Shell.log.warn(e.getMessage() + " while setting visibility constraint, but table was created"); | Either log or rethrow this exception. |
if (startOS.size() < endOS.size())
appendZeros(startOS, endOS.size() - startOS.size());
else if (endOS.size() < startOS.size())
appendZeros(endOS, startOS.size() - endOS.size());
if (ba[0] != 0)
throw new RuntimeException();
if (iter.hasNext())
return iter.next().getKey().getRow();
if (!iter.hasNext())
return next.getRow();
if (ret == null)
return next.getRow();
else
return ret;
if (end == null)
end = findInitialEnd(scanner); | Remove this call to "exit" or ensure it is really required. |
private static final String TTL = "ttl";
private long threshold;
private long currentTime;
public AgeOffFilter() {}
public AgeOffFilter(SortedKeyValueIterator<Key,Value> iterator, long threshold, long currentTime) {
super(iterator);
this.threshold = threshold;
this.currentTime = currentTime;
}
@Override
public boolean accept(Key k, Value v) {
if (currentTime - k.getTimestamp() > threshold) return false;
return true;
}
@Override
public void init(SortedKeyValueIterator<Key,Value> source, Map<String,String> options, IteratorEnvironment env) throws IOException {
super.init(source, options, env);
threshold = -1;
if (options == null) throw new IllegalArgumentException(TTL + " must be set for AgeOffFilter");
String ttl = options.get(TTL);
if (ttl == null) throw new IllegalArgumentException(TTL + " must be set for AgeOffFilter");
threshold = Long.parseLong(ttl);
String time = options.get("currentTime");
if (time != null) currentTime = Long.parseLong(time);
else currentTime = System.currentTimeMillis();
// add sanity checks for threshold and currentTime?
}
@Override
public SortedKeyValueIterator<Key,Value> deepCopy(IteratorEnvironment env) {
return new AgeOffFilter(getSource(), threshold, currentTime);
}
@Override
public IteratorOptions describeOptions() {
IteratorOptions io = super.describeOptions();
io.addNamedOption(TTL, "time to live (milliseconds)");
io.addNamedOption("currentTime", "if set, use the given value as the absolute time in milliseconds as the current time of day");
io.setName("ageoff");
io.setDescription("AgeOffFilter removes entries with timestamps more than <ttl> milliseconds old");
return io;
}
@Override
public boolean validateOptions(Map<String,String> options) {
try {
Long.parseLong(options.get(TTL));
} catch (NumberFormatException e) {
return false;
return true;
} | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
import java.util.HashSet;
@Override
public Set<Class<? extends AuthenticationToken>> getSupportedTokenTypes() {
Set<Class<? extends AuthenticationToken>> cs = new HashSet<Class<? extends AuthenticationToken>>();
cs.add(PasswordToken.class);
return cs;
} | Remove the redundant '!unknownSymbol!' thrown exception declaration(s). |
String path = ZooUtil.getRoot(instance) + "/" + type + "/" + Long.toString(tid);
rdr.sync(path);
return rdr.exists(path); | Reorder the modifiers to comply with the Java Language Specification. |
* 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]*$'. |
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
private static final Logger log = Logger.getLogger(DumpMapFile.class);
public static void main(String[] args) {
try {
Configuration conf = CachedConfiguration.getInstance();
FileSystem fs = FileSystem.get(conf);
MyMapFile.Reader mr = new MyMapFile.Reader(fs, args[0], conf);
Key key = new Key();
Value value = new Value();
long start = System.currentTimeMillis();
while (mr.next(key, value)) {
log.info(key + " -> " + value);
}
long stop = System.currentTimeMillis();
log.info(stop - start);
} catch (IOException e) {
throw new RuntimeException(e);
}
} | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
* @see org.apache.accumulo.core.iterators.user.SummingCombiner with SummingCombiner.Type.FIXEDLEN | 1 duplicated blocks of code must be removed. |
state.set("numWrites", new Long(0)); | Return an empty array instead of null. |
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
public static final String minc = "minc";
public static final String queue = "queue";
public long getMinorCompactionCount();
public long getMinorCompactionAvgTime();
public long getMinorCompactionMinTime();
public long getMinorCompactionMaxTime();
public long getMinorCompactionQueueCount();
public long getMinorCompactionQueueAvgTime();
public long getMinorCompactionQueueMinTime();
public long getMinorCompactionQueueMaxTime();
public void reset();
| Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
if (super.validateOptions(options) == false)
return false;
try {
setEncoder(options);
} catch (Exception e) {
throw new IllegalArgumentException("bad encoder option", e);
} | Return empty string instead. |
import org.apache.accumulo.core.security.thrift.TCredentials;
private TCredentials credentials;
public InstanceOperationsImpl(Instance instance, TCredentials credentials) { | 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.
*/
@SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum { | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
public synchronized void replaceLockData(byte[] b) throws KeeperException, InterruptedException {
if (getLockPath()!=null)
zooKeeper.getZooKeeper().setData(getLockPath(), b, -1);
}
| 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.
*/
} catch (IllegalArgumentException t) {}
}
| Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
* @deprecated since 1.4, replaced by {@link org.apache.accumulo.core.iterators.user.LargeRowFilter} | Do not forget to remove this deprecated code someday. |
public Collection<Text> listSplits(String tableName) throws TableNotFoundException {
return null;
}
@Override
public Collection<Text> listSplits(String tableName, int maxSplits) throws TableNotFoundException {
return null;
}
@Override | Either log or rethrow this exception. |
public NoVisFilter() {}
public NoVisFilter(SortedKeyValueIterator<Key,Value> iterator) {
super(iterator);
}
@Override
public boolean accept(Key k, Value v) {
ColumnVisibility vis = new ColumnVisibility(k.getColumnVisibility());
return vis.getExpression().length > 0;
}
@Override
public IteratorOptions describeOptions() {
IteratorOptions io = super.describeOptions();
io.setName("novis");
io.setDescription("NoLabelFilter hides entries without a visibility label");
return io;
} | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
import org.apache.accumulo.core.util.BadArgumentException;
} catch (BadArgumentException e) {
log.error("Parse Error", e);
return false; | Return empty string instead. |
import static org.apache.accumulo.core.util.ByteBufferUtil.toBytes;
import java.io.ByteArrayOutputStream;
*
* @deprecated since 1.4.1. There is no replacement.
*
* @deprecated since 1.4.1. There is no replacement.
*
* @deprecated since 1.4.1. There is no replacement.
*
* @deprecated since 1.4.1. There is no replacement.
*
* @deprecated since 1.4.1. There is no replacement.
*
* @deprecated since 1.4.1. There is no replacement. | Replace all tab characters in this file by sequences of white-spaces. |
* Autogenerated by Thrift Compiler (0.9.0) | Rename this class name to match the regular expression '^[A-Z][a-zA-Z0-9]*$'. |
if (options.containsKey(indexFamilyOptionName))
indexColf = new Text(options.get(indexFamilyOptionName));
if (options.containsKey(docFamilyOptionName))
docColf = new Text(options.get(docFamilyOptionName));
if (topKey == null)
return;
if (log.isTraceEnabled())
log.trace("using top key to seek for doc: " + topKey.toString());
if (log.isTraceEnabled())
log.trace("building doc key for " + currentPartition + " " + currentDocID);
if (zeroIndex < 0)
throw new IllegalArgumentException("bad current docID");
if (log.isTraceEnabled())
log.trace(zeroIndex + " " + currentDocID.getLength());
if (log.isTraceEnabled())
log.trace("built doc key for seek: " + k.toString()); | Remove this call to "exit" or ensure it is really required. |
Collection<Text> actualSplits = getConnector().tableOperations().listSplits("foo");
actualSplits = getConnector().tableOperations().listSplits("foo"); | Either log or rethrow this exception. |
if (count == 0 || ranges.size() == 0)
return; | Remove this call to "exit" or ensure it is really required. |
import java.nio.charset.Charset;
private static final Charset utf8 = Charset.forName("UTF8");
return builder.toString().getBytes(utf8);
this(expression.getBytes(utf8)); | Move this variable to comply with Java Code Conventions. |
package org.apache.accumulo.core.util; | Cast one of the operands of this multiplication operation to a "long". |
// Initiate tracing if it isn't already started
public static Span on(String description) {
return Tracer.getInstance().on(description);
}
// Turn tracing off:
public static void off() {
Tracer.getInstance().stopTracing();
Tracer.getInstance().flush();
}
public static void offNoFlush() {
Tracer.getInstance().stopTracing();
}
// Are we presently tracing?
public static boolean isTracing() {
return Tracer.getInstance().isTracing();
}
// If we are tracing, return the current span, else null
public static Span currentTrace() {
return Tracer.getInstance().currentTrace();
}
// Create a new time span, if tracing is on
public static Span start(String description) {
return Tracer.getInstance().start(description);
}
// Start a trace in the current thread from information passed via RPC
public static Span trace(TInfo info, String description) {
if (info.traceId == 0) {
return Tracer.NULL_SPAN;
return Tracer.getInstance().continueTrace(description, info.traceId, info.parentId);
}
// Initiate a trace in this thread, starting now
public static Span startThread(Span parent, String description) {
return Tracer.getInstance().startThread(parent, description);
}
// Stop a trace in this thread, starting now
public static void endThread(Span span) {
Tracer.getInstance().endThread(span);
}
// Wrap the runnable in a new span, if tracing
public static Runnable wrap(Runnable runnable) {
if (isTracing()) return new TraceRunnable(Trace.currentTrace(), runnable);
return runnable;
}
// Wrap all calls to the given object with spans
public static <T> T wrapAll(T instance) {
return TraceProxy.trace(instance);
}
// Sample trace all calls to the given object
public static <T> T wrapAll(T instance, Sampler dist) {
return TraceProxy.trace(instance, dist);
} | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
boolean hasTokenOptions = !loginOptions.isEmpty();
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() {
reader.getTerminal().setEchoEnabled(true);
}
});
// Need either both a token and options, or neither, but not just one.
if (hasToken != hasTokenOptions) {
throw new ParameterException("Must supply either both or neither of '--tokenClass' and '--tokenProperty'");
} else if (hasToken) { // implied hasTokenOptions
} else {
if (!options.isFake()) {
ZooReader zr = new ZooReader(instance.getZooKeepers(), instance.getZooKeepersSessionTimeOut());
DistributedTrace.enable(instance, zr, "shell", InetAddress.getLocalHost().getHostName());
}
| Remove this hard-coded password. |
package org.apache.accumulo.test.randomwalk.security;
import org.apache.accumulo.test.randomwalk.State;
import org.apache.accumulo.test.randomwalk.Test; | Move the "org.apache.accumulo.test.randomwalk.unit.CreateTable" string literal on the left side of this string comparison. |
@Override
public void visit(State state, Properties props) throws Exception {
state.getMultiTableBatchWriter().flush();
log.debug("Committed inserts ");
}
| Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
sb.append("<option selected='true'></option>");
addOptions(sb, null); | Replace all tab characters in this file by sequences of white-spaces. |
import org.apache.accumulo.core.client.AccumuloSecurityException;
import org.apache.accumulo.core.security.thrift.AuthInfo;
public static ByteBuffer encodeUserPrincipal(String principal, String token, String instanceId) throws AccumuloSecurityException {
return ByteBuffer.wrap(CredentialHelper.asByteArray(new AuthInfo(principal, ByteBuffer.wrap(token.getBytes()), instanceId)));
} | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
FileStatus errorStatus = null;
try {
errorStatus = fs.getFileStatus(errorPath);
} catch (FileNotFoundException ex) {
// ignored
} | Either log or rethrow this exception. |
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
Logger.getLogger("org.apache.zookeeper").setLevel(Level.WARN);
| Define and throw a dedicated exception instead of using a generic one. |
offline(tableName, false);
}
@Override
public void offline(String tableName, boolean wait) throws AccumuloSecurityException, AccumuloException, TableNotFoundException {
online(tableName, false);
}
@Override
public void online(String tableName, boolean wait) throws AccumuloSecurityException, AccumuloException, TableNotFoundException { | Cast one of the operands of this multiplication operation to a "long". |
import org.apache.accumulo.core.security.tokens.AuthenticationToken; | 1 duplicated blocks of code must be removed. |
import org.apache.accumulo.core.client.security.tokens.AuthenticationToken;
import org.apache.accumulo.core.security.CredentialHelper;
public void visit(State state, Properties props) throws Exception {
String authPrincipal;
AuthenticationToken authToken;
authPrincipal = WalkingSecurity.get(state).getSysUserName();
authToken = WalkingSecurity.get(state).getSysToken();
authPrincipal = state.getUserName();
authToken = state.getToken();
Connector conn = state.getInstance().getConnector(authPrincipal, authToken);
boolean hasPermission = WalkingSecurity.get(state).canChangeAuthorizations(CredentialHelper.create(authPrincipal, authToken, state.getInstance().getInstanceID()), target); | Immediately return this expression instead of assigning it to the temporary variable "connector". |
MetadataTable.updateTabletPrevEndRow(ke, opts.getCredentials());
Writer t = MetadataTable.getMetadataTable(opts.getCredentials()); | Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'. |
switch (ae.getSecurityErrorCode()) {
switch (ae.getSecurityErrorCode()) { | Do not forget to remove this deprecated code someday. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.