Diff
stringlengths 10
2k
| Message
stringlengths 28
159
|
---|---|
@SuppressWarnings("all") public enum ConfigurationType implements org.apache.thrift.TEnum {
|
300 duplicated blocks of code must be removed.
|
Combiner.setColumns(is, Collections.singletonList(new IteratorSetting.Column("acf")));
|
Remove this unused method parameter "hasStart".
|
import org.apache.accumulo.server.zookeeper.TransactionWatcher.ZooArbitrator;
if (new ColumnFQ(update).equals(Constants.METADATA_DIRECTORY_COLUMN)) {
isSplitMutation = true;
|
Make the "log" logger private static final and rename it to comply with the format "LOG(?:GER)?".
|
import org.apache.accumulo.core.security.thrift.ThriftInstanceTokenWrapper;
void send(ThriftInstanceTokenWrapper info, String serverName, MasterClientService.Iface client) throws TException, ThriftSecurityException;
|
Immediately return this expression instead of assigning it to the temporary variable "ret".
|
import java.util.Iterator;
import java.util.Map.Entry;
import java.util.TreeMap;
import java.util.UUID;
import org.apache.accumulo.core.conf.DefaultConfiguration;
import org.apache.accumulo.core.conf.Property;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
@Parameter(names="--site-file", description="Read the given accumulo site file to find the accumulo instance")
public String siteFile = null;
@SuppressWarnings("deprecation")
if (siteFile != null) {
AccumuloConfiguration config = new AccumuloConfiguration() {
Configuration xml = new Configuration();
{
xml.addResource(new Path(siteFile));
}
@Override
public Iterator<Entry<String,String>> iterator() {
TreeMap<String, String> map = new TreeMap<String, String>();
for (Entry<String, String> props : DefaultConfiguration.getInstance())
map.put(props.getKey(), props.getValue());
for (Entry<String, String> props : xml)
map.put(props.getKey(), props.getValue());
return map.entrySet().iterator();
}
@Override
public String get(Property property) {
String value = xml.get(property.getKey());
if (value != null)
return value;
return DefaultConfiguration.getInstance().get(property);
}
};
this.zookeepers = config.get(Property.INSTANCE_ZK_HOST);
Path instanceDir = new Path(config.get(Property.INSTANCE_DFS_DIR), "instance_id");
return cachedInstance = new ZooKeeperInstance(UUID.fromString(ZooKeeperInstance.getInstanceIDFromHdfs(instanceDir)), zookeepers);
}
|
Extract the assignment out of this expression.
|
instance = new MockInstance("fake");
|
1 duplicated blocks of code must be removed.
|
if (event.getType() == AbstractFileConfiguration.EVENT_RELOAD)
needsReloading = true;
if (null == envConfig)
envConfig = new EnvironmentConfiguration();
if (null == sysConfig)
sysConfig = new SystemConfiguration();
if (null == config || needsReloading)
synchronized (lock) {
if (needsReloading) {
loadConfiguration();
} else if (null == config) {
loadConfiguration();
}
needsReloading = false;
if (log.isDebugEnabled())
log.debug("Loading config file: " + mFile.getAbsolutePath());
if (!alreadyWarned)
log.warn("Unable to find metrics file: " + mFile.getAbsolutePath());
if (!alreadyWarned)
log.warn("ACCUMULO_HOME variable not found in environment. Metrics collection will be disabled.");
if (log.isDebugEnabled())
log.debug("Metrics collection enabled=" + enabled);
if (null == getMetricsConfiguration())
return false;
if (null == v)
v = config.getList(k);
|
Remove this call to "exit" or ensure it is really required.
|
if (o instanceof Key)
return this.equals((Key) o, PartialKey.ROW_COLFAM_COLQUAL_COLVIS_TIME_DEL);
if (len == 0)
return EMPTY_BYTES;
if (!copyData && ba.length == len && off == 0)
return ba;
if (result != 0 || part.equals(PartialKey.ROW))
return result;
if (result != 0 || part.equals(PartialKey.ROW_COLFAM))
return result;
if (result != 0 || part.equals(PartialKey.ROW_COLFAM_COLQUAL))
return result;
if (result != 0 || part.equals(PartialKey.ROW_COLFAM_COLQUAL_COLVIS))
return result;
if (timestamp < other.timestamp)
result = 1;
else if (timestamp > other.timestamp)
result = -1;
else
result = 0;
if (result != 0 || part.equals(PartialKey.ROW_COLFAM_COLQUAL_COLVIS_TIME))
return result;
if (deleted)
result = other.deleted ? 0 : -1;
else
result = other.deleted ? 1 : 0;
if (c >= 32 && c <= 126)
sb.append((char) c);
else
sb.append("%" + String.format("%02x;", c));
if (a1 == a2)
return true;
if (last != a2.length)
return false;
if (last == 0)
return true;
if (a1[i] != a2[i])
return false;
if (param.size() > 0)
tkvl.set(0, new TKeyValue(param.get(0).key.toThrift(), ByteBuffer.wrap(param.get(0).value)));
if (newKey == null)
newKey = key.toThrift();
if (newKey == null)
newKey = key.toThrift();
if (newKey == null)
newKey = key.toThrift();
if (newKey == null)
newKey = key.toThrift();
|
Remove this call to "exit" or ensure it is really required.
|
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
|
Replace all tab characters in this file by sequences of white-spaces.
|
return !SystemCredentials.get().getToken().getClass().getName().equals(credentials.getTokenClassName());
|
Move this constructor to comply with Java Code Conventions.
|
if (!shellState.getConnector().tableOperations().exists(tableName))
throw new TableNotFoundException(null, tableName, null);
if (iterator == null)
return 0;
if (!iterator.getProperties().isEmpty() && !deleteAll)
shellState.getConnector().tableOperations().attachIterator(tableName, iterator);
|
Remove this call to "exit" or ensure it is really required.
|
result.add(new TServerInstance(AddressUtil.parseAddress(child), stat.getEphemeralOwner()));
|
Immediately return this expression instead of assigning it to the temporary variable "client".
|
import java.util.concurrent.atomic.AtomicBoolean;
boolean test = false;
if (initNode instanceof Test) {
startTimer(initNode.toString());
test = true;
}
if (test)
stopTimer(initNode.toString());
test = false;
if (nextNode instanceof Test) {
startTimer(nextNode.toString());
test = true;
}
if (test)
stopTimer(nextNode.toString());
Thread timer = null;
final int time = 5 * 1000 * 60;
AtomicBoolean runningLong = new AtomicBoolean(false);
long systemTime;
/**
*
*/
private void startTimer(final String nodeName) {
runningLong.set(false);
timer = new Thread(new Runnable() {
@Override
public void run() {
try {
log.debug("Starting timer for " + nodeName);
systemTime = System.currentTimeMillis();
synchronized (timer) {
timer.wait(time);
}
} catch (InterruptedException ie) {
return;
}
log.warn("Node " + nodeName + " has been running for " + time / 1000.0 + " seconds. You may want to look into it.");
runningLong.set(true);
}
});
timer.start();
}
/**
*
*/
private void stopTimer(String nodeName) {
synchronized (timer) {
timer.interrupt();
try {
timer.join();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
if (runningLong.get())
log.warn("Node " + nodeName + ", which was running long, has now completed after " + (System.currentTimeMillis() - systemTime) / 1000.0 + " seconds");
}
|
Move this variable to comply with Java Code Conventions.
|
import java.util.concurrent.atomic.AtomicBoolean;
boolean test = false;
if (initNode instanceof Test) {
startTimer(initNode.toString());
test = true;
}
if (test)
stopTimer(initNode.toString());
test = false;
if (nextNode instanceof Test) {
startTimer(nextNode.toString());
test = true;
}
if (test)
stopTimer(nextNode.toString());
Thread timer = null;
final int time = 5 * 1000 * 60;
AtomicBoolean runningLong = new AtomicBoolean(false);
long systemTime;
/**
*
*/
private void startTimer(final String nodeName) {
runningLong.set(false);
timer = new Thread(new Runnable() {
@Override
public void run() {
try {
systemTime = System.currentTimeMillis();
synchronized (timer) {
timer.wait(time);
}
} catch (InterruptedException ie) {
return;
}
log.warn("Node " + nodeName + " has been running for " + time / 1000.0 + " seconds. You may want to look into it.");
runningLong.set(true);
}
});
timer.start();
}
/**
*
*/
private void stopTimer(String nodeName) {
synchronized (timer) {
timer.interrupt();
try {
timer.join();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
if (runningLong.get())
log.warn("Node " + nodeName + ", which was running long, has now completed after " + (System.currentTimeMillis() - systemTime) / 1000.0 + " seconds");
}
|
Move this variable to comply with Java Code Conventions.
|
import java.io.IOException;
import java.util.Map;
private boolean lossy = false;
protected static final String LOSSY = "lossy";
private boolean lossy;
*
* @param lossy
* Determines whether to error on failure to decode or ignore and move on
VIterator(Iterator<Value> iter, Encoder<V> encoder, boolean lossy) {
this.lossy = lossy;
V next = null;
if (next != null)
return true;
while (true)
{
if (!source.hasNext())
return false;
try
{
next = encoder.decode(source.next().get());
return true;
} catch (ValueFormatException vfe) {
if (!lossy)
throw vfe;
}
}
if (!hasNext())
V toRet = next;
next = null;
return toRet;
public V decode(byte[] b) throws ValueFormatException;
return new Value(encoder.encode(typedReduce(key, new VIterator<V>(iter, encoder, lossy))));
}
@Override
public void init(SortedKeyValueIterator<Key,Value> source, Map<String,String> options, IteratorEnvironment env) throws IOException {
super.init(source, options, env);
setLossyness(options);
}
private void setLossyness(Map<String,String> options) {
String loss = options.get(LOSSY);
if (loss == null)
lossy = false;
else
lossy = Boolean.parseBoolean(loss);
}
@Override
public IteratorOptions describeOptions() {
IteratorOptions io = super.describeOptions();
io.addNamedOption(LOSSY, "if true, failed decodes are ignored. Otherwise combiner will error on failed decodes (default false): <TRUE|FALSE>");
return io;
@Override
public boolean validateOptions(Map<String,String> options) {
super.validateOptions(options);
setLossyness(options);
return true;
}
|
Move this variable to comply with Java Code Conventions.
|
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
|
Replace all tab characters in this file by sequences of white-spaces.
|
import java.util.Collections;
List<String> children = cache.getChildren(path + "/" + candidate);
if (children != null && children.size() > 0) {
List<String> copy = new ArrayList<String>(children);
Collections.sort(copy);
byte[] data = cache.get(path + "/" + candidate + "/" + copy.get(0));
|
Use isEmpty() to check whether the collection is empty or not.
|
public void initialize(String instanceId);
public boolean validAuthorizor(Authorizor auth);
public void initializeSecurity(AuthInfo credentials, String rootuser, byte[] rootpass) throws AccumuloSecurityException;
public boolean authenticateUser(String user, ByteBuffer password, String instanceId);
public Set<String> listUsers() throws AccumuloSecurityException;
public void createUser(String user, byte[] pass) throws AccumuloSecurityException;
public void dropUser(String user) throws AccumuloSecurityException;
public void changePassword(String user, byte[] pass) throws AccumuloSecurityException;
public boolean cachesToClear();
public boolean userExists(String user);
|
Remove this unused method parameter "ex".
|
import java.util.EnumSet;
t.attachIterator("table", new IteratorSetting(10, "someName", "foo.bar", EnumSet.of(IteratorScope.scan), empty));
t.removeIterator("table", "someName", EnumSet.of(IteratorScope.scan));
setting.setScopes(EnumSet.of(IteratorScope.majc));
setting.addOptions(Collections.singletonMap("key", "value"));
t.attachIterator("table", setting);
setting = new IteratorSetting(10, "someName", "foo.bar");
setting = new IteratorSetting(20, "otherName", "some.classname");
setting.setScopes(EnumSet.of(IteratorScope.majc));
setting.addOptions(Collections.singletonMap("key", "value"));
t.attachIterator("table", setting);
Set<String> two = t.listIterators("table");
t.removeIterator("table", "someName", EnumSet.allOf(IteratorScope.class));
setting = t.getIteratorSetting("table", "otherName", IteratorScope.scan);
Assert.assertEquals(20, setting.getPriority());
Assert.assertEquals("some.classname", setting.getIteratorClass());
Assert.assertFalse(setting.hasProperties());
setting = t.getIteratorSetting("table", "otherName", IteratorScope.majc);
Assert.assertTrue(setting.hasProperties());
Assert.assertEquals(Collections.singletonMap("key", "value"), setting.getProperties());
setting.setScopes(EnumSet.of(IteratorScope.minc));
t.attachIterator("table", setting);
t.check("table", new String[] {"table.iterator.majc.otherName=20,some.classname", "table.iterator.majc.otherName.opt.key=value",
"table.iterator.minc.otherName=20,some.classname", "table.iterator.minc.otherName.opt.key=value", "table.iterator.scan.otherName=20,some.classname",});
|
Remove this unused method parameter "scopes".
|
if (i == parts - 1)
end = (int) (LOTS - ctr);
if (failures != null && failures.length > 0)
throw new Exception("Failures " + Arrays.asList(failures) + " found importing files from " + dir);
|
Remove this call to "exit" or ensure it is really required.
|
super.seek(seekRange, columnFamilies, inclusive);
|
Remove the literal "false" boolean value.
|
protected ColumnUpdate newColumnUpdate(byte[] cf, byte[] cq, byte[] cv, boolean hasts, long ts, boolean deleted, byte[] val) {
return new ColumnUpdate(cf, cq, cv, hasts, ts, deleted, val);
}
return newColumnUpdate(cf, cq, cv, hasts, ts, deleted, val);
return newColumnUpdate(cf, cq, cv, hasts, ts, deleted, val);
|
Constructor has 8 parameters, which is greater than 7 authorized.
|
import org.apache.accumulo.server.master.state.TabletLocationState.BadLocationStateException;
// something is wrong with the records in the !METADATA table, just skip over it
log.error(ex, ex);
return null;
}
public static TabletLocationState createTabletLocationState(Key k, Value v) throws IOException, BadLocationStateException {
TServerInstance location = new TServerInstance(entry.getValue(), cq);
if (future != null) {
throw new BadLocationStateException("found two assignments for the same extent " + key.getRow() + ": " + future + " and " + location);
}
future = location;
TServerInstance location = new TServerInstance(entry.getValue(), cq);
if (current != null) {
throw new BadLocationStateException("found two locations for the same extent " + key.getRow() + ": " + current + " and " + location);
}
current = location;
TServerInstance location = new TServerInstance(entry.getValue(), cq);
if (last != null) {
throw new BadLocationStateException("found two last locations for the same extent " + key.getRow() + ": " + last + " and " + location);
}
} catch (BadLocationStateException ex) {
throw new RuntimeException(ex);
}
|
Either log or rethrow this exception.
|
package org.apache.accumulo.test.continuous;
|
Move the "org.apache.accumulo.test.randomwalk.unit.CreateTable" string literal on the left side of this string comparison.
|
import org.apache.accumulo.core.security.thrift.Credential;
private Credential credentials;
public TabletServerBatchReader(Instance instance, Credential credentials, String table, Authorizations authorizations, int numQueryThreads) {
|
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.
*/
void propertyChanged(String key);
void propertiesChanged();
void sessionExpired();
|
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
|
private String lastReserved = "";
List<String> txdirs = new ArrayList<String>(zk.getChildren(path));
Collections.sort(txdirs);
synchronized (this) {
if (txdirs.size() > 0 && txdirs.get(txdirs.size() - 1).compareTo(lastReserved) <= 0)
lastReserved = "";
}
// this check makes reserve pick up where it left off, so that it cycles through all as it is repeatedly called.... failing to do so can lead to
// starvation where fate ops that sort higher and hold a lock are never reserved.
if (txdir.compareTo(lastReserved) <= 0)
continue;
if (!reserved.contains(tid)) {
lastReserved = txdir;
}
|
Use "Integer.toString" instead.
|
package org.apache.accumulo.cloudtrace.instrument;
* @see Trace.wrapAll
|
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
|
public File getLogDir() {
|
Remove this unused method parameter "range".
|
import java.util.concurrent.atomic.AtomicInteger;
final AtomicInteger tableCounter = new AtomicInteger(0);
String makeTableName() {
return "table" + tableCounter.getAndIncrement();
}
@Test(timeout = 30 * 1000)
String tableName = makeTableName();
connector.tableOperations().create(tableName);
List<DiskUsage> diskUsage = connector.tableOperations().getDiskUsage(Collections.singleton(tableName));
assertEquals(tableName, diskUsage.get(0).getTables().iterator().next());
connector.securityOperations().revokeTablePermission(ROOT, tableName, TablePermission.READ);
connector.tableOperations().getDiskUsage(Collections.singleton(tableName));
connector.tableOperations().delete(tableName);
connector.tableOperations().getDiskUsage(Collections.singleton(tableName));
@Test(timeout = 30 * 1000)
String tableName = makeTableName();
connector.tableOperations().create(tableName);
List<DiskUsage> diskUsages = connector.tableOperations().getDiskUsage(Collections.singleton(tableName));
assertEquals(tableName, diskUsages.get(0).getTables().first());
BatchWriter bw = connector.createBatchWriter(tableName, new BatchWriterConfig());
connector.tableOperations().compact(tableName, new Text("A"), new Text("z"), true, true);
diskUsages = connector.tableOperations().getDiskUsage(Collections.singleton(tableName));
assertEquals(tableName, diskUsages.get(0).getTables().first());
connector.tableOperations().clone(tableName, "table2", false, null, null);
tables.add(tableName);
connector.tableOperations().compact(tableName, new Text("A"), new Text("z"), true, true);
connector.tableOperations().delete(tableName);
@Test(timeout = 30 * 1000)
String tableName = makeTableName();
connector.tableOperations().create(tableName);
Iterable<Map.Entry<String,String>> itrProps = connector.tableOperations().getProperties(tableName);
connector.tableOperations().delete(tableName);
|
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.
|
Constants.METADATA_DIRECTORY_COLUMN.put(mut, new Value(dir.getBytes()));
Constants.METADATA_PREV_ROW_COLUMN.fetch(bs);
|
Replace all tab characters in this file by sequences of white-spaces.
|
/**
* @deprecated since 1.4
* @use org.apache.accumulo.core.iterators.user.SummingCombiner with SummingCombiner.Type.VARNUM
*/
|
Either log or rethrow this exception.
|
package org.apache.accumulo.wikisearch.iterator;
|
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
|
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.
|
package org.apache.accumulo.server.upgrade;
import java.util.SortedMap;
import org.apache.accumulo.core.client.impl.Tables;
import org.apache.accumulo.core.util.CachedConfiguration;
import org.apache.accumulo.server.ServerConstants;
import org.apache.accumulo.server.client.HdfsZooInstance;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileStatus;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
public class RenameFiles {
public static void main(String[] args) throws Exception {
String tablesDir = ServerConstants.getTablesDir();
System.out.println(" "+tablesDir);
SortedMap<String, String> tableIds = Tables.getNameToIdMap(HdfsZooInstance.getInstance());
Configuration conf = CachedConfiguration.getInstance();
FileSystem fs = FileSystem.get(conf);
FileStatus[] tables = fs.listStatus(new Path(tablesDir));
for (FileStatus tableStatus : tables) {
String tid = tableIds.get(tableStatus.getPath().getName());
Path newPath = new Path(tableStatus.getPath().getParent(), tid);
fs.rename(tableStatus.getPath(), newPath);
}
tables = fs.listStatus(new Path(tablesDir));
for (FileStatus tableStatus : tables) {
FileStatus[] tablets = fs.listStatus(tableStatus.getPath());
for (FileStatus tabletStatus : tablets) {
FileStatus[] files = fs.listStatus(tabletStatus.getPath());
for (FileStatus fileStatus : files) {
String name = fileStatus.getPath().getName();
if(name.matches("map_\\d+_\\d+")){
fs.rename(fileStatus.getPath(), new Path(fileStatus.getPath().getParent(), name.substring(4)+".map"));
}
}
}
}
}
}
|
Return empty string instead.
|
* @return A map of Aggregator Table Properties.
* @see TableOperations#attachIterator(String, IteratorSetting)
|
1 duplicated blocks of code must be removed.
|
if (super.validateOptions(options) == false)
return false;
try {
setEncoder(options);
} catch (Exception e) {
throw new IllegalArgumentException("bad encoder option", e);
}
|
Remove the literal "false" boolean value.
|
public class KeyValueAndPeek implements org.apache.thrift.TBase<KeyValueAndPeek, KeyValueAndPeek._Fields>, java.io.Serializable, Cloneable {
public KeyValue keyValue; // required
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, KeyValue.class)));
KeyValue keyValue,
this.keyValue = new KeyValue(other.keyValue);
public KeyValue getKeyValue() {
public KeyValueAndPeek setKeyValue(KeyValue keyValue) {
setKeyValue((KeyValue)value);
struct.keyValue = new KeyValue();
struct.keyValue = new KeyValue();
|
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
|
final private ServerConfiguration serverConfiguration;
public TraceServer(ServerConfiguration serverConfiguration, String hostname) throws Exception {
this.serverConfiguration = serverConfiguration;
AccumuloConfiguration conf = serverConfiguration.getConfiguration();
connector = serverConfiguration.getInstance().getConnector(conf.get(Property.TRACE_USER), conf.get(Property.TRACE_PASSWORD).getBytes());
String root = ZooUtil.getRoot(serverConfiguration.getInstance()) + Constants.ZTRACERS;
ServerConfiguration conf = new ServerConfiguration(instance);
FileSystem fs = FileUtil.getFileSystem(CachedConfiguration.getInstance(), conf.getConfiguration());
Accumulo.init(fs, conf, "tracer");
String hostname = Accumulo.getLocalAddress(args);
TraceServer server = new TraceServer(conf, hostname);
|
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
|
if (job != null)
throw new RuntimeException("job has already run");
if ("-r".equals(args[i]))
num_reduces = Integer.parseInt(args[++i]);
else if ("-q".equals(args[i]))
queueName = args[++i];
else if ("-p".equals(args[i]))
poolName = args[++i];
else
otherArgs.add(args[i]);
if (background)
sort.job.submit();
else
sort.job.waitForCompletion(true);
if (!job.isSuccessful())
System.exit(1);
|
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 "appendProp" method.
|
@SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum {
|
300 duplicated blocks of code must be removed.
|
@Deprecated
@Deprecated
|
Remove this unused private "appendProp" method.
|
Connector connector = instance.getConnector(args[2], args[3].getBytes());
|
Remove this unused method parameter "ex".
|
shellState.getReader().flush();
|
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
|
import org.apache.accumulo.core.security.Authorizations;
Scanner scanner = conn.createScanner(tableName, Authorizations.EMPTY);
|
Remove this unused method parameter "range".
|
private static final String PASSWORD = PREFIX + ".password";
conf.set(PASSWORD, new String(Base64.encodeBase64(passwd)));
* WARNING: The password 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.
protected static byte[] getPassword(JobContext job) {
* WARNING: The password 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.
protected static byte[] getPassword(Configuration conf) {
return Base64.decodeBase64(conf.get(PASSWORD, "").getBytes());
AccumuloRecordWriter(TaskAttemptContext attempt) throws AccumuloException, AccumuloSecurityException {
|
Remove the redundant '!unknownSymbol!' thrown exception declaration(s).
|
shellState.getReader().println();
shellState.getReader().println(
|
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
|
package org.apache.accumulo.core.util.shell;
public class ShellCommandException extends Exception
{
private static final long serialVersionUID = 1L;
public enum ErrorCode
{
UNKNOWN_ERROR("Unknown error"),
UNSUPPORTED_LANGUAGE("Programming language used is not supported"),
UNRECOGNIZED_COMMAND("Command is not supported"),
INITIALIZATION_FAILURE("Command could not be initialized"),
XML_PARSING_ERROR("Failed to parse the XML file");
private String description;
private ErrorCode(String description) { this.description = description; }
public String getDescription() { return this.description; }
public String toString() { return getDescription(); }
}
private ErrorCode code;
private String command;
public ShellCommandException(ErrorCode code) { this(code, null); }
public ShellCommandException(ErrorCode code, String command) { this.code = code; this.command = command; }
public String getMessage() { return code + (command != null ? " (" + command + ")" : ""); }
}
|
Return empty string instead.
|
import java.util.Collection;
import org.apache.accumulo.core.data.ByteSequence;
import org.apache.accumulo.core.data.Range;
static private final String SEEK_SLEEP_TIME = "seekSleepTime";
private long sleepTime = 0;
private long seekSleepTime = 0;
public static void setSeekSleepTime(IteratorSetting is, long t) {
is.addOption(SEEK_SLEEP_TIME, Long.toString(t));
}
public void seek(Range range, Collection<ByteSequence> columnFamilies, boolean inclusive) throws IOException {
UtilWaitThread.sleep(seekSleepTime);
super.seek(range, columnFamilies, inclusive);
}
@Override
if (options.containsKey(SLEEP_TIME))
sleepTime = Long.parseLong(options.get(SLEEP_TIME));
if (options.containsKey(SEEK_SLEEP_TIME))
seekSleepTime = Long.parseLong(options.get(SEEK_SLEEP_TIME));
|
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
|
if (entry.getKey().startsWith(Property.TRACE_TOKEN_PROPERTY_PREFIX.getKey()))
continue;
|
Remove the redundant '!unknownSymbol!' thrown exception declaration(s).
|
import org.apache.accumulo.core.util.AddressUtil;
|
2 duplicated blocks of code must be removed.
|
/**
* @deprecated since 1.4
* @use org.apache.accumulo.core.iterators.user.ColumnAgeOffFilter
**/
|
Remove this unused private "match" method.
|
import org.apache.accumulo.proxy.thrift.PTablePermission;
import org.apache.accumulo.proxy.thrift.PTimeType;
tpc.proxy().securityOperations_createUser(userpass, "testuser", ByteBuffer.wrap("testpass".getBytes()));
tpc.proxy().tableOperations_create(userpass, testTable, true, PTimeType.MILLIS);
tpc.proxy().tableOperations_create(userpass, testTable, true, PTimeType.MILLIS);
|
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
|
} else if (event.getState() != KeeperState.Disconnected && event.getState() != KeeperState.Expired && (lock != null || asyncLock != null)) {
} catch (KeeperException.ConnectionLossException ex) {
// we can't look at the lock because we aren't connected, but our session is still good
log.warn("lost connection to zookeeper");
|
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
|
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
|
Replace all tab characters in this file by sequences of white-spaces.
|
package org.apache.accumulo.core.master;
public class MasterNotRunningException extends Exception {
/**
* eclipse generated this ...
*/
private static final long serialVersionUID = 1L;
private String message;
public MasterNotRunningException(String msg) {
message = msg;
}
public String getMessage() {
return message;
}
}
|
Return empty string instead.
|
if (p != null && shellState.getConnector().securityOperations().hasSystemPermission(user, p)) {
|
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
|
switch (ae.getSecurityErrorCode()) {
|
Do not forget to remove this deprecated code someday.
|
final long offset;
private static Logger log = Logger.getLogger(TestTime.class);
public TestTime(long millis) {
super(new SystemTime());
offset = millis;
}
@Override
public long currentTime() {
log.debug("Using time offset of " + offset);
return super.currentTime() + offset;
}
|
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
|
import org.apache.accumulo.core.security.Authorizations;
BatchScanner bs = state.getConnector().createBatchScanner(indexTableName, Authorizations.EMPTY, 10);
Scanner scanner = state.getConnector().createScanner(dataTableName, Authorizations.EMPTY);
|
Remove this unused method parameter "range".
|
if (o == this) {
return true;
}
if (o != null && o.getClass().equals(this.getClass())) {
return equalMutation((Mutation) o);
}
/**
* Checks if this mutation equals another. This method may be removed in a
* future API revision in favor of {@link #equals(Object)}. See ACCUMULO-1627
* for more information.
*
* @param m mutation
* @return true if the given mutation equals this one, false otehrwise
*/
return this.equals((Object) m);
}
private boolean equalMutation(Mutation m) {
|
Move this variable to comply with Java Code Conventions.
|
client.flush(Tracer.traceInfo(), SecurityConstants.getSystemCredentials(), lockString(lock), tableId,
startRow == null ? null : ByteBuffer.wrap(startRow), endRow == null ? null : ByteBuffer.wrap(endRow));
client.splitTablet(Tracer.traceInfo(), SecurityConstants.getSystemCredentials(), extent.toThrift(),
ByteBuffer.wrap(splitPoint.getBytes(), 0, splitPoint.getLength()));
client.compact(Tracer.traceInfo(), SecurityConstants.getSystemCredentials(), lockString(lock), tableId,
startRow == null ? null : ByteBuffer.wrap(startRow), endRow == null ? null : ByteBuffer.wrap(endRow));
|
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
|
@Override
public void visit(State state, Properties props) throws Exception {}
|
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
|
FILE_READ, FILE_WRITE, TABLET_LOAD
|
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
|
private Logger log;
private Level level;
private long t1;
private long opid;
private static AtomicLong nextOpid = new AtomicLong();
public OpTimer(Logger log, Level level) {
this.log = log;
this.level = level;
}
public OpTimer start(String msg) {
opid = nextOpid.getAndIncrement();
if (log.isEnabledFor(level)) log.log(level, "tid=" + Thread.currentThread().getId() + " oid=" + opid + " " + msg);
t1 = System.currentTimeMillis();
return this;
}
public void stop(String msg) {
if (log.isEnabledFor(level)) {
long t2 = System.currentTimeMillis();
String duration = String.format("%.3f secs", (t2 - t1) / 1000.0);
msg = msg.replace("%DURATION%", duration);
log.log(level, "tid=" + Thread.currentThread().getId() + " oid=" + opid + " " + msg);
}
|
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
|
@Override
public void visit(State state, Properties props) throws Exception {
Connector conn = state.getConnector();
Random rand = (Random) state.get("rand");
@SuppressWarnings("unchecked")
List<String> tableNames = (List<String>) state.get("tables");
String tableName = tableNames.get(rand.nextInt(tableNames.size()));
// TODO need to sometimes do null start and end ranges
TreeSet<Text> range = new TreeSet<Text>();
range.add(new Text(String.format("%016x", Math.abs(rand.nextLong()))));
range.add(new Text(String.format("%016x", Math.abs(rand.nextLong()))));
try {
conn.tableOperations().merge(tableName, range.first(), range.last());
log.debug("merged " + tableName);
} catch (TableOfflineException toe) {
log.debug("merge " + tableName + " failed, table is not online");
} catch (TableNotFoundException tne) {
log.debug("merge " + tableName + " failed, doesnt exist");
}
|
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
|
import org.apache.hadoop.fs.Trash;
private Trash trash;
GarbageCollectWriteAheadLogs(Instance instance, FileSystem fs, boolean noTrash) throws IOException {
if (!noTrash)
this.trash = new Trash(fs, fs.getConf());
Path path = new Path(Constants.getWalDirectory(conf), filename);
if (trash == null || !trash.moveToTrash(path))
fs.delete(path, true);
|
Remove this unused import 'org.apache.hadoop.fs.Trash'.
|
MASTER_BULK_TIMEOUT("master.bulk.timeout", "5m", PropertyType.TIMEDURATION, "The time to wait for a tablet server to process a bulk import request"),
MASTER_MINTHREADS("master.server.threads.minimum", "20", PropertyType.COUNT, "The minimum number of threads to use to handle incoming requests."),
TSERV_BULK_TIMEOUT("tserver.bulk.timeout", "5m", PropertyType.TIMEDURATION, "The time to wait for a tablet server to process a bulk import request."),
TSERV_MINTHREADS("tserver.server.threads.minimum", "20", PropertyType.COUNT, "The minimum number of threads to use to handle incoming requests."),
|
Replace all tab characters in this file by sequences of white-spaces.
|
package org.apache.accumulo.server.mini;
|
Return empty string instead.
|
tsStats.addAll(client.getTabletStats(Tracer.traceInfo(), SystemCredentials.get().toThrift(Monitor.getInstance()), tableId));
historical = client.getHistoricalStats(Tracer.traceInfo(), SystemCredentials.get().toThrift(Monitor.getInstance()));
|
Immediately return this expression instead of assigning it to the temporary variable "onlineTabletsForTable".
|
/*
* 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.
|
* @return false if a row should be suppressed, otherwise true.
|
1 duplicated blocks of code must be removed.
|
import org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException;
|
1 duplicated blocks of code must be removed.
|
import org.apache.accumulo.core.client.security.tokens.PasswordToken;
|
Move this constructor to comply with Java Code Conventions.
|
private static void putMarkerDeleteMutation(final String delete, final BatchWriter writer, final BatchWriter rootWriter) throws MutationsRejectedException {
if (delete.startsWith(METADATA_TABLE_DIR)) {
Mutation m = new Mutation(new Text(Constants.METADATA_DELETE_FLAG_FOR_METADATA_PREFIX + delete));
m.putDelete(EMPTY_TEXT, EMPTY_TEXT);
rootWriter.addMutation(m);
} else {
Mutation m = new Mutation(new Text(Constants.METADATA_DELETE_FLAG_PREFIX + delete));
m.putDelete(EMPTY_TEXT, EMPTY_TEXT);
writer.addMutation(m);
}
// deletes; Need separate writer for the root tablet.
BatchWriter rootWriter = null;
rootWriter = c.createBatchWriter(Constants.METADATA_TABLE_NAME, new BatchWriterConfig());
putMarkerDeleteMutation(delete, writer, rootWriter);
final BatchWriter finalRootWriter = rootWriter;
putMarkerDeleteMutation(delete, finalWriter, finalRootWriter);
|
1 duplicated blocks of code must be removed.
|
import org.apache.accumulo.core.util.format.BinaryFormatter;
String tableName = OptUtil.getTableOpt(cl, shellState);
BinaryFormatter.getlength(text.getLength());
return encode ? new String(Base64.encodeBase64(TextUtil.getBytes(text))) : BinaryFormatter.appendText(new StringBuilder(), text).toString();
|
Either log or rethrow this exception.
|
AccumuloOutputFormat.setConnectorInfo(job, opts.user, opts.getPassword());
|
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
|
import org.apache.accumulo.core.Constants;
if (name.startsWith(Constants.MAPFILE_EXTENSION + "_")) {
if (extension.equals(Constants.MAPFILE_EXTENSION) || extension.equals(Constants.MAPFILE_EXTENSION + "_tmp")) {
private static final HashSet<String> validExtensions = new HashSet<String>(Arrays.asList(Constants.MAPFILE_EXTENSION, RFile.EXTENSION));
|
6 duplicated blocks of code must be removed.
|
static class BogusTime implements ProvidesTime {
public long value = 0;
public long currentTime() {
return value;
}
@Test
public void testMatchesTime() {
BogusTime bt = new BogusTime();
BogusTime now = new BogusTime();
now.value = bt.value = System.currentTimeMillis();
BaseRelativeTime brt = new BaseRelativeTime(now);
assertEquals(brt.currentTime(), now.value);
brt.updateTime(now.value);
assertEquals(brt.currentTime(), now.value);
}
@Test
public void testFutureTime() {
BogusTime advice = new BogusTime();
BogusTime local = new BogusTime();
local.value = advice.value = System.currentTimeMillis();
// Ten seconds into the future
advice.value += 10000;
BaseRelativeTime brt = new BaseRelativeTime(local);
assertEquals(brt.currentTime(), local.value);
brt.updateTime(advice.value);
long once = brt.currentTime();
assertTrue(once < advice.value);
assertTrue(once > local.value);
for (int i = 0; i < 100; i++) {
brt.updateTime(advice.value);
long many = brt.currentTime();
assertTrue(many > once);
assertTrue("after much advice, relative time is still closer to local time", (advice.value - many) < (once - local.value));
}
@Test
public void testPastTime() {
BogusTime advice = new BogusTime();
BogusTime local = new BogusTime();
local.value = advice.value = System.currentTimeMillis();
// Ten seconds into the past
advice.value -= 10000;
BaseRelativeTime brt = new BaseRelativeTime(local);
brt.updateTime(advice.value);
long once = brt.currentTime();
assertTrue(once < local.value);
brt.updateTime(advice.value);
long twice = brt.currentTime();
assertTrue("Time cannot go backwards", once <= twice);
brt.updateTime(advice.value - 10000);
assertTrue("Time cannot go backwards", once <= twice);
}
|
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
|
assertTrue(rei.validateOptions(is.getOptions()));
assertTrue(rei.validateOptions(is.getOptions()));
assertTrue(rei.validateOptions(is.getOptions()));
assertTrue(rei.validateOptions(is.getOptions()));
|
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
|
import org.apache.accumulo.core.client.security.tokens.AuthenticationToken;
import org.apache.accumulo.core.security.CredentialHelper;
String principal;
AuthenticationToken token;
principal = WalkingSecurity.get(state).getTabUserName();
token = WalkingSecurity.get(state).getTabToken();
principal = WalkingSecurity.get(state).getSysUserName();
token = WalkingSecurity.get(state).getSysToken();
Connector conn = state.getInstance().getConnector(principal, token);
boolean hasPermission = WalkingSecurity.get(state).canDeleteTable(CredentialHelper.create(principal, token, state.getInstance().getInstanceID()), tableName);
|
Immediately return this expression instead of assigning it to the temporary variable "connector".
|
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
|
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 class Key implements org.apache.thrift.TBase<Key, Key._Fields>, java.io.Serializable, Cloneable {
@SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum {
|
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
|
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
KeyExtent getExtent();
long getLastCommitTime();
long getMemTableSize();
long getMinorCompactingMemTableSize();
|
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
|
package org.apache.accumulo.fate;
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.
|
if (opts.columns != null) {
for (ScanColumn col : opts.columns) {
if (col.isSetColQualifier())
scanner.fetchColumn(ByteBufferUtil.toText(col.colFamily), ByteBufferUtil.toText(col.colQualifier));
else
scanner.fetchColumnFamily(ByteBufferUtil.toText(col.colFamily));
}
}
|
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
|
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
|
Replace all tab characters in this file by sequences of white-spaces.
|
import org.apache.accumulo.core.security.thrift.Credential;
import org.apache.accumulo.core.security.thrift.tokens.PasswordToken;
import org.apache.accumulo.core.security.thrift.tokens.SecurityToken;
Credential auth;
byte[] newPassw = new byte[r.nextInt(50) + 1];
for (int i =0; i < newPassw.length; i++)
newPassw[i] = (byte) ((r.nextInt(26)+65) & 0xFF);
SecurityToken newPass = new PasswordToken().setPassword(newPassw);
conn.securityOperations().changeLoginInfo(target, newPass);
|
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
|
* Autogenerated by Thrift Compiler (0.9.0)
|
Rename this class name to match the regular expression '^[A-Z][a-zA-Z0-9]*$'.
|
@SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum {
|
300 duplicated blocks of code must be removed.
|
import org.apache.accumulo.core.metadata.MetadataTable;
|
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
|
private static final long serialVersionUID = 1L;
public IterationInterruptedException() {
super();
}
public IterationInterruptedException(String msg) {
super(msg);
}
|
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
|
public ZooLock(String zookeepers, int timeInMillis, String scheme, byte[] auth, String path) {
this(new ZooCache(zookeepers, timeInMillis), ZooReaderWriter.getInstance(zookeepers, timeInMillis, scheme, auth), path);
|
Move this constructor to comply with Java Code Conventions.
|
import org.apache.accumulo.core.client.security.SecurityErrorCode;
import org.apache.accumulo.trace.instrument.Trace;
|
Do not forget to remove this deprecated code someday.
|
public int execute(final String fullCommand, final CommandLine cl, final Shell shellState) throws AccumuloException, AccumuloSecurityException, IOException {
final String user = cl.getOptionValue(userOpt.getOpt(), shellState.getConnector().whoami());
|
Remove the redundant '!unknownSymbol!' thrown exception declaration(s).
|
@Override
public String getViolationDescription(short violationCode) {
switch (violationCode) {
case 1:
return "Malformed column visibility";
case 2:
return "User does not have authorization on column visibility";
return null;
}
@Override
public List<Short> check(Environment env, Mutation mutation) {
List<ColumnUpdate> updates = mutation.getUpdates();
HashSet<String> ok = null;
if (updates.size() > 1) ok = new HashSet<String>();
VisibilityEvaluator ve = null;
for (ColumnUpdate update : updates) {
byte[] cv = update.getColumnVisibility();
if (cv.length > 0) {
String key = null;
if (ok != null && ok.contains(key = new String(cv))) continue;
try {
if (ve == null) ve = new VisibilityEvaluator(env.getAuthorizations());
if (!ve.evaluate(new ColumnVisibility(cv))) return Collections.singletonList(new Short((short) 2));
} catch (BadArgumentException bae) {
return Collections.singletonList(new Short((short) 1));
} catch (VisibilityParseException e) {
return Collections.singletonList(new Short((short) 1));
if (ok != null) ok.add(key);
}
return null;
}
|
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
|
if (r != null)
r.close();
if (r != null)
r.close();
|
Remove this call to "exit" or ensure it is really required.
|
import org.apache.accumulo.start.classloader.vfs.AccumuloVFSClassLoader;
Class<? extends T> clazz = AccumuloVFSClassLoader.loadClass(clazzName, base);
|
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.