Diff
stringlengths
10
2k
Message
stringlengths
28
159
// @Test
Immediately return this expression instead of assigning it to the temporary variable "result".
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.
String removeProperty(String key) { return systemProperties.remove(key); }
Either log or rethrow this exception.
public class StartIT extends SimpleMacIT { assertTrue(exec(TestMain.class, "exception").waitFor() != 0); assertEquals(0, exec(TestMain.class, "success").waitFor()); assertTrue(exec(TestMain.class).waitFor() != 0);
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
* * BatchWriter bw = opts.getConnector().createBatchWriter(opts.tableName, bwOpts.getBatchWriterConfig());
Replace all tab characters in this file by sequences of white-spaces.
* Table to check * number of rows the table should contain
Make the "log" logger private static final and rename it to comply with the format "LOG(?:GER)?".
throw new ThriftSecurityException(user, SecurityErrorCode.INVALID_INSTANCEID);
Immediately return this expression instead of assigning it to the temporary variable "res".
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */
Replace all tab characters in this file by sequences of white-spaces.
import org.apache.accumulo.core.client.security.tokens.AuthenticationToken.AuthenticationTokenSerializer; * <li>{@link AccumuloOutputFormat#setConnectorInfo(JobConf, String, String)} this.conn = getInstance(job).getConnector(getPrincipal(job), AuthenticationTokenSerializer.deserialize(getTokenClass(job), getToken(job))); Connector c = getInstance(job).getConnector(getPrincipal(job), AuthenticationTokenSerializer.deserialize(getTokenClass(job), getToken(job))); if (!c.securityOperations().authenticateUser(getPrincipal(job), AuthenticationTokenSerializer.deserialize(getTokenClass(job), getToken(job))))
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. */ private Counters c = new Counters(); private long filesProcessed = 0; private long recordsProcessed = 0; public Counters getCounters() { return c; } @Override public Counter getCounter(Enum<?> name) { return c.findCounter(name); } @Override public Counter getCounter(String group, String name) { return c.findCounter(group, name); } @Override public void progress() { // do nothing } @Override public void setStatus(String status) { // do nothing } public long getFilesProcessed() { return filesProcessed; } public long getRecordsProcessed() { return recordsProcessed; } public void incrementFilesProcessed() { filesProcessed++; recordsProcessed = 0; } public void incrementRecordsProcessed() { recordsProcessed++; }
Immediately return this expression instead of assigning it to the temporary variable "r".
@Deprecated conn.securityOperations().createLocalUser(principal, (PasswordToken) token);
Remove the redundant '!unknownSymbol!' thrown exception declaration(s).
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.accumulo.server.tabletserver.compaction; public class WriteParameters { private String compressType = null; private long hdfsBlockSize = 0; private long blockSize = 0; private long indexBlockSize = 0; private int replication = 0; public String getCompressType() { return compressType; } public void setCompressType(String compressType) { this.compressType = compressType; } public long getHdfsBlockSize() { return hdfsBlockSize; } public void setHdfsBlockSize(long hdfsBlockSize) { this.hdfsBlockSize = hdfsBlockSize; } public long getBlockSize() { return blockSize; } public void setBlockSize(long blockSize) { this.blockSize = blockSize; } public long getIndexBlockSize() { return indexBlockSize; } public void setIndexBlockSize(long indexBlockSize) { this.indexBlockSize = indexBlockSize; } public int getReplication() { return replication; } public void setReplication(int replication) { this.replication = replication; } }
Remove this unused import 'org.apache.hadoop.fs.FileSystem'.
HashSet<KeyExtent> authFailures = new HashSet<KeyExtent>(); if (us.currentTablet != null && us.currentTablet.getExtent().equals(keyExtent)) return; if (us.currentTablet == null && (us.failures.containsKey(keyExtent) || us.authFailures.contains(keyExtent))) { // if there were previous failures, then do not accept additional writes return; } setUpdateTablet(us, keyExtent);
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
import org.apache.accumulo.core.security.thrift.TCredentials; public TabletLocation locateTablet(Text row, boolean skipRow, boolean retry, TCredentials credentials) throws AccumuloException, AccumuloSecurityException, TableNotFoundException { public void binMutations(List<Mutation> mutations, Map<String,TabletServerMutations> binnedMutations, List<Mutation> failures, TCredentials credentials) throws AccumuloException, public List<Range> binRanges(List<Range> ranges, Map<String,Map<KeyExtent,List<Range>>> binnedRanges, TCredentials credentials) throws AccumuloException, AccumuloSecurityException, TCredentials credentials = null; List<TabletLocation> overlaps = BulkImporter.findOverlappingTablets(acuConf, fs, locator, new Path(file), credentials); "b")), credentials);
Remove the redundant '!unknownSymbol!' thrown exception declaration(s).
import org.apache.accumulo.server.ServerConstants; this.logPath = new Path(ServerConstants.getWalDirectory(), filename); logPath = new Path(ServerConstants.getWalDirectory() + "/" + logger + "/" + filename);
Make the "audit" logger private static final and rename it to comply with the format "LOG(?:GER)?".
import java.util.TreeSet; /** * Gets the number of bytes being used in the files for a set of tables * * @param tables * a set of tables * @return a list of disk usage objects containing linked table names and sizes * @throws AccumuloException * @throws AccumuloSecurityException */ public List<DiskUsage> getDiskUsage(Set<String> tables) throws AccumuloException, AccumuloSecurityException, TableNotFoundException;
Either log or rethrow this exception.
import org.apache.accumulo.core.util.MetadataTable; conn.securityOperations().grantTablePermission(conn.whoami(), MetadataTable.NAME, TablePermission.WRITE); BatchWriter bw = conn.createBatchWriter(MetadataTable.NAME, bwOpts.getBatchWriterConfig()); Text row = new Text(String.format("%s%s%020d%s", MetadataTable.DELETE_FLAG_PREFIX, "/", i,
Use "Long.toString" instead.
import java.util.Arrays; import java.util.HashMap; import java.util.Map; import javax.security.auth.DestroyFailedException; public class Properties extends HashMap<String, char[]> implements Destroyable { private static final long serialVersionUID = 507486847276806489L; boolean destroyed = false; public char[] put(String key, CharSequence value) { char[] toPut = new char[value.length()]; for (int i = 0; i < value.length(); i++) toPut[i] = value.charAt(i); return this.put(key, toPut); } public void putAllStrings(Map<String, ? extends CharSequence> map) { for (Map.Entry<String,? extends CharSequence> entry : map.entrySet()) { put(entry.getKey(), entry.getValue()); } } @Override public void destroy() throws DestroyFailedException { for (String key : this.keySet()) { char[] val = this.get(key); Arrays.fill(val, (char) 0); } this.clear(); destroyed = true; } @Override public boolean isDestroyed() { return destroyed; } }
Override the "equals" method in this class.
@Deprecated
Return empty string instead.
import org.apache.hadoop.fs.Trash; private Trash trash; public CoordinateRecoveryTask(FileSystem fs) throws IOException { this.trash = new Trash(fs, fs.getConf()); if (!trash.moveToTrash(child.getPath())) fs.delete(child.getPath(), true);
Move this constructor to comply with Java Code Conventions.
* Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ public enum TableState {
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
import org.apache.accumulo.core.client.impl.ClientExecReturn; import org.apache.accumulo.core.client.impl.ServerClient; import org.apache.accumulo.core.client.impl.thrift.ClientService; public String getAuthenticatorClassName() throws AccumuloException, AccumuloSecurityException { return ServerClient.execute(this, new ClientExecReturn<String,ClientService.Client>() { @Override public String execute(ClientService.Client iface) throws Exception { return iface.getAuthenticatorClassName(); }); public Authenticator getAuthenticator() throws AccumuloException, AccumuloSecurityException {
Remove the redundant '!unknownSymbol!' thrown exception declaration(s).
import org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException;
1 duplicated blocks of code must be removed.
import org.apache.accumulo.cloudtrace.instrument.Span; import org.apache.accumulo.cloudtrace.instrument.Trace; import org.apache.accumulo.cloudtrace.instrument.Tracer; import org.apache.accumulo.cloudtrace.instrument.receivers.ZooSpanClient;
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
import org.apache.accumulo.core.cli.BatchWriterOpts; import org.apache.accumulo.core.cli.ScannerOpts; ScannerOpts scanOpts = new ScannerOpts(); BatchWriterOpts bwOpts = new BatchWriterOpts(); opts.parseArgs(RemoveEntriesForMissingFiles.class.getName(), args, scanOpts, bwOpts); metadata.setBatchSize(scanOpts.scanBatchSize); writer = connector.createBatchWriter(Constants.METADATA_TABLE_NAME, bwOpts.getBatchWriterConfig());
Remove this unused method parameter "opts".
package org.apache.accumulo.test;
Move the "org.apache.accumulo.test.randomwalk.unit.CreateTable" string literal on the left side of this string comparison.
boolean moveMetadata = r.nextInt(4) == 0; if (!moveMetadata && "!METADATA".equals(table)) continue;
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.CredentialHelper; List<KeyExtent> candidates = findTablets(!opts.selectFarTablets, CredentialHelper.create(opts.principal, opts.getToken(), opts.instance), opts.tableName, instance, locations); List<String> files = getTabletFiles(CredentialHelper.create(opts.principal, opts.getToken(), opts.instance), opts.getInstance(), tableId, ke);
Immediately return this expression instead of assigning it to the temporary variable "connector".
import org.apache.accumulo.server.master.state.ZooTabletStateStore; import org.mortbay.log.Log; String clientAddress, ZooLock lock) throws AccumuloSecurityException, DistributedStoreException { ZooTabletStateStore store = new ZooTabletStateStore(); if (!store.iterator().hasNext()) { log.warn("Illegal state: location is not set in zookeeper"); return null; } TabletLocationState next = store.iterator().next(); if (!instance.equals(next.future)) { log.warn("Future location is not to this server for the root tablet"); return null; }
Remove the redundant '!unknownSymbol!' thrown exception declaration(s).
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ @SuppressWarnings("all") public class Range implements org.apache.thrift.TBase<Range, Range._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]*$'.
@Override public IteratorOptions describeOptions() { IteratorOptions io = super.describeOptions(); io.setName("sum"); io.setDescription("SummingCombiner interprets Values as Longs and adds them together. A variety of encodings (variable length, fixed length, or string) are available"); return io; }
Rename this local variable 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.
package org.apache.accumulo.core.util; import org.apache.commons.codec.binary.Base64; import org.apache.hadoop.io.Text; public class Encoding { public static String encodeAsBase64FileName(Text data) { String encodedRow = new String(Base64.encodeBase64(TextUtil.getBytes(data))); encodedRow = encodedRow.replace('/', '_').replace('+', '-'); int index = encodedRow.length() - 1; while(index >=0 && encodedRow.charAt(index) == '=') index--; encodedRow = encodedRow.substring(0, index+1); return encodedRow; } public static byte[] decodeBase64FileName(String node) { while(node.length() % 4 != 0) node += "="; node = node.replace('_', '/').replace('-', '+'); return Base64.decodeBase64(node.getBytes()); } }
Return empty string instead.
} else if (instance instanceof MockInstance) { scanner = instance.getConnector(principal, token).createScanner(split.getTableName(), authorizations); setupIterators(attempt, scanner, split.getTableName()); Instance instance = getInstance(context); if (instance instanceof MockInstance) tableId = ""; else tableId = Tables.getTableId(instance, tableName);
4 duplicated blocks of code must be removed.
import org.apache.accumulo.server.security.SystemCredentials; MetadataTableUtil.addTablet(extent, Constants.DEFAULT_TABLET_LOCATION, SystemCredentials.get().getAsThrift(), tableInfo.timeType, MetadataTableUtil.deleteTable(tableInfo.tableId, false, SystemCredentials.get().getAsThrift(), environment.getMasterLock()); for (String dir : ServerConstants.getTablesDirs()) { security.grantTablePermission(SystemCredentials.get().getAsThrift(), tableInfo.user, tableInfo.tableId, permission); AuditedSecurityOperation.getInstance().deleteTable(SystemCredentials.get().getAsThrift(), tableInfo.tableId);
Move this constructor to comply with Java Code Conventions.
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */
Replace all tab characters in this file by sequences of white-spaces.
import org.apache.accumulo.cloudtrace.instrument.receivers.SendSpansViaThrift;
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
import org.apache.accumulo.server.fs.VolumeManager; import org.apache.accumulo.server.fs.VolumeManagerImpl; VolumeManager fs = VolumeManagerImpl.get(); files.add(fs.getFullPath(key).toString()); private void addBlocks(VolumeManager fs, String host, ArrayList<String> files, Map<String,Long> totalBlocks, Map<String,Long> localBlocks) throws Exception { Path filePath = new Path(file); FileSystem ns = fs.getFileSystemByPath(filePath); FileStatus fileStatus = ns.getFileStatus(filePath); BlockLocation[] fileBlockLocations = ns.getFileBlockLocations(fileStatus, 0, fileStatus.getLen());
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. */
296 duplicated blocks of code must be removed.
import org.apache.accumulo.core.tabletserver.thrift.ActiveCompaction; @Override public List<ActiveCompaction> getActiveCompactions(TInfo tinfo, ThriftInstanceTokenWrapper credentials) throws ThriftSecurityException, TException { return new ArrayList<ActiveCompaction>(); }
Return empty string instead.
try { // if this class exists Class.forName("org.apache.hadoop.fs.CreateFlag"); // we're running hadoop 2.0, 1.1 if (!fs.getConf().getBoolean("dfs.datanode.synconclose", false)) { log.warn("dfs.datanode.synconclose set to false: data loss is possible on system reset or power loss"); } } catch (ClassNotFoundException ex) { // hadoop 1.0 }
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. */ protected final Logger log = Logger.getLogger(this.getClass()); /** * Visits node * * @param state * Random walk state passed between nodes * @throws Exception */ public abstract void visit(State state, Properties props) throws Exception; @Override public boolean equals(Object o) { return toString().equals(o.toString()); } @Override public int hashCode() { return toString().hashCode(); }
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. */
Remove this unused private "appendProp" method.
package org.apache.accumulo.core.util; import java.net.InetSocketAddress; import org.apache.hadoop.io.Text; import org.apache.thrift.transport.TSocket; public class AddressUtil { static public InetSocketAddress parseAddress(String address, int defaultPort) throws NumberFormatException { final String[] parts = address.split(":", 2); if (parts.length == 2) { if (parts[1].isEmpty()) return new InetSocketAddress(parts[0], defaultPort); return new InetSocketAddress(parts[0], Integer.parseInt(parts[1])); } return new InetSocketAddress(address, defaultPort); } static public InetSocketAddress parseAddress(Text address, int defaultPort) { return parseAddress(address.toString(), defaultPort); } static public TSocket createTSocket(String address, int defaultPort) { InetSocketAddress addr = parseAddress(address, defaultPort); return new TSocket(addr.getHostName(), addr.getPort()); } static public String toString(InetSocketAddress addr) { return addr.getAddress().getHostAddress() + ":" + addr.getPort(); } }
Return empty string instead.
import org.apache.accumulo.core.data.Mutation; static Mutation nm(String row, String cf, String cq, Value value) { Mutation m = new Mutation(new Text(row)); m.put(new Text(cf), new Text(cq), value); return m; } static Mutation nm(String row, String cf, String cq, String value) { return nm(row, cf, cq, new Value(value.getBytes())); }
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
if (!usingNativeMap && maxMemory + dCacheSize + iCacheSize > runtime.maxMemory()) { throw new IllegalArgumentException(String.format("Maximum tablet server map memory %,d and block cache sizes %,d is too large for this JVM configuration %,d", maxMemory, dCacheSize + iCacheSize, runtime.maxMemory()));
Remove this call to "exit" or ensure it is really required.
import org.apache.accumulo.core.security.tokens.PasswordToken;
Replace all tab characters in this file by sequences of white-spaces.
private static final Logger log = Logger.getLogger(Proxy.class); opts.prop.setProperty("instance", accumulo.getConfig().getInstanceName()); opts.prop.setProperty("zookeepers", accumulo.getConfig().getZooKeepers());
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 int execute(final String fullCommand, final CommandLine cl, final Shell shellState) throws Exception { final String histDir = System.getenv("HOME") + "/.accumulo"; final FileWriter outFile = new FileWriter(histDir + "/shell_history.txt"); final PrintWriter out = new PrintWriter(outFile); final BufferedReader in = new BufferedReader(new FileReader(histDir + "/shell_history.txt")); final Options o = new Options();
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
* @since 1.5.0
Move this constructor to comply with Java Code Conventions.
import junit.framework.Assert; import org.apache.accumulo.core.client.AccumuloException; import org.apache.accumulo.core.client.AccumuloSecurityException; import org.apache.accumulo.core.client.Instance; Connector c = new MockConnector("root", new MockInstance()); Connector c = new MockConnector("root", new MockInstance()); Connector c = new MockConnector("root", new MockInstance()); Connector c = new MockConnector("root", new MockInstance()); Connector c = new MockConnector("root", new MockInstance()); Connector c = new MockConnector("root", new MockInstance()); Connector c = new MockConnector("root", new MockInstance()); @Test public void testMockConnectorReturnsCorrectInstance() throws AccumuloException, AccumuloSecurityException{ String name = "an-interesting-instance-name"; Instance mockInstance = new MockInstance(name); Assert.assertEquals(mockInstance, mockInstance.getConnector("foo", "bar").getInstance()); Assert.assertEquals(name, mockInstance.getConnector("foo","bar").getInstance().getInstanceName()); }
Return empty string instead.
import org.apache.hadoop.conf.Configuration; import org.junit.Rule; import org.junit.rules.TemporaryFolder; Configuration conf = CachedConfiguration.getInstance(); conf.set("hadoop.tmp.dir", new File(args[1]).getParent()); assertEquals(0, ToolRunner.run(conf, new MRTokenFileTester(), args)); @Rule public TemporaryFolder folder = new TemporaryFolder(new File(System.getProperty("user.dir") + "/target")); File tf = folder.newFile("root_test.pw");
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
else { public boolean hasTop() { if (o != null) Integer.parseInt(o); throw new IllegalArgumentException("bad integer " + NUM_SCANS_STRING_NAME + ":" + options.get(NUM_SCANS_STRING_NAME), e); return true;
Remove the literal "false" boolean value.
import org.apache.accumulo.core.tabletserver.thrift.LogCopyInfo; public synchronized LogCopyInfo startCopy(String name, String fullyQualifiedFileName) throws ThriftSecurityException, TException {
Remove this unused method parameter "acuConf".
String tableName = getTableNames(1)[0];
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
import java.util.ArrayList; import org.apache.accumulo.core.data.ArrayByteSequence; * | Row | Column Family | Column Qualifier | Value * | {RowID} | {dataLocation} | {term}\0{dataType}\0{UID} | Empty Text dataLocation = (sources[i].dataLocation == null) ? nullText : sources[i].dataLocation; Collection<ByteSequence> columnFamilies = new ArrayList<ByteSequence>(); columnFamilies.add(new ArrayByteSequence(dataLocation.getBytes(), 0, dataLocation.getLength())); if (range.getStartKey().getColumnFamily() != null) { sourceKey = buildKey(getPartition(range.getStartKey()), dataLocation, sourceKey = buildKey(getPartition(range.getStartKey()), dataLocation, sources[i].iter.seek(new Range(sourceKey, true, null, false), columnFamilies, inclusive); sources[i].iter.seek(range, columnFamilies, inclusive);
Replace all tab characters in this file by sequences of white-spaces.
import org.apache.accumulo.core.util.shell.Token; tableOpt = new Option(Shell.tableOption, "table", true, "table to grant a table permission for"); tablePatternOpt = new Option("p", "pattern", true, "regex pattern of tables to grant permissions for");
2 duplicated blocks of code must be removed.
public static void createTables(TableOperations tops, String tableName, boolean configureLocalityGroups) throws AccumuloException, AccumuloSecurityException, TableNotFoundException, TableExistsException { if (configureLocalityGroups) tops.setLocalityGroups(tableName, Collections.singletonMap("WikipediaDocuments", Collections.singleton(new Text(WikipediaMapper.DOCUMENT_COLUMN_FAMILY)))); createTables(tops, tablename, true);
This block of commented-out lines of code should be removed.
Logger.getLogger(AbstractQueryLogic.class).setLevel(Level.OFF); Logger.getLogger(RangeCalculator.class).setLevel(Level.OFF);
2 duplicated blocks of code must be removed.
package org.apache.accumulo.core.util.shell.commands; import java.util.Map; import java.util.Set; import org.apache.accumulo.core.client.AccumuloException; import org.apache.accumulo.core.client.AccumuloSecurityException; import org.apache.accumulo.core.client.TableNotFoundException; import org.apache.accumulo.core.util.shell.Shell; import org.apache.accumulo.core.util.shell.Token; import org.apache.accumulo.core.util.shell.Shell.Command; import org.apache.commons.cli.CommandLine; public class TableCommand extends Command { @Override public int execute(String fullCommand, CommandLine cl, Shell shellState) throws AccumuloException, AccumuloSecurityException, TableNotFoundException { String tableName = cl.getArgs()[0]; if (!shellState.getConnector().tableOperations().exists(tableName)) throw new TableNotFoundException(null, tableName, null); shellState.setTableName(tableName); return 0; } @Override public String description() { return "switches to the specified table"; } @Override public void registerCompletion(Token root, Map<Command.CompletionSet, Set<String>> special) { registerCompletionForTables(root, special); } @Override public String usage() { return getName() + " <tableName>"; } @Override public int numArgs() { return 1; } }
Return empty string instead.
package org.apache.accumulo.core.iterators.aggregation; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; import org.apache.accumulo.core.data.Value; import org.apache.hadoop.io.WritableUtils; public class NumSummation implements Aggregator { long sum = 0l; public Value aggregate() { try { return new Value(NumSummation.longToBytes(sum)); } catch (IOException e) { throw new RuntimeException(e); } } public void collect(Value value) { long l; try { l = NumSummation.bytesToLong(value.get()); } catch (IOException e) { throw new RuntimeException(e); } sum = NumSummation.safeAdd(sum, l); } public static byte[] longToBytes(long l) throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); DataOutputStream dos = new DataOutputStream(baos); WritableUtils.writeVLong(dos, l); return baos.toByteArray(); } public static long bytesToLong(byte[] b) throws IOException { DataInputStream dis = new DataInputStream(new ByteArrayInputStream(b)); return WritableUtils.readVLong(dis); } public static long safeAdd(long a, long b) { long aSign = Long.signum(a); long bSign = Long.signum(b); if ((aSign != 0) && (bSign != 0) && (aSign==bSign)) { if (aSign > 0) { if (Long.MAX_VALUE-a < b) return Long.MAX_VALUE; } else { if (Long.MIN_VALUE-a > b) return Long.MIN_VALUE; } } return a+b; } public void reset() { sum = 0l; } }
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. */ public class ColumnFamilyFunctor implements KeyFunctor { public static final PartialKey kDepth = PartialKey.ROW_COLFAM; @Override public org.apache.hadoop.util.bloom.Key transform(org.apache.accumulo.core.data.Key acuKey) { byte keyData[]; ByteSequence row = acuKey.getRowData(); ByteSequence cf = acuKey.getColumnFamilyData(); keyData = new byte[row.length() + cf.length()]; System.arraycopy(row.getBackingArray(), row.offset(), keyData, 0, row.length()); System.arraycopy(cf.getBackingArray(), cf.offset(), keyData, row.length(), cf.length()); return new org.apache.hadoop.util.bloom.Key(keyData, 1.0); } @Override public Key transform(Range range) { if (RowFunctor.isRangeInBloomFilter(range, PartialKey.ROW_COLFAM)) { return transform(range.getStartKey()); } return null; }
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
for (int i = 0; i < 5; i++) { UtilWaitThread.sleep(10*1000); if (c.tableOperations().listSplits("test_ingest").size() > 20) break; } assertTrue(c.tableOperations().listSplits("test_ingest").size() > 20);
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
if (!prop.isExperimental() && !prop.getType().equals(PropertyType.PREFIX)) if (prop.isExperimental()) if (prefix.isExperimental()) if (prefix.isExperimental()) if (prop.isExperimental())
Replace all tab characters in this file by sequences of white-spaces.
import org.apache.accumulo.core.security.thrift.TCredentials; return TabletLocator.getInstance(instance, new TCredentials(principal, tokenClass, ByteBuffer.wrap(token), instance.getInstanceID()), new TCredentials(getPrincipal(implementingClass, conf), getTokenClass(implementingClass, conf), ByteBuffer.wrap(getToken(implementingClass, conf)),
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
conn.securityOperations().dropLocalUser(tableUserName); state.getConnector().securityOperations().dropLocalUser(tableUserName);
Remove the redundant '!unknownSymbol!' thrown exception declaration(s).
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */
Replace all tab characters in this file by sequences of white-spaces.
Connector connector = inst.getConnector("user", "pass");
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
* @throws IllegalArgumentException * if the setting conflicts with any existing iterators /** * Check whether a given iterator configuration conflicts with existing configuration; in particular, determine if the name or priority are already in use for * the specified scopes. * * @param tableName * the name of the table * @param setting * object specifying the properties of the iterator * @throws AccumuloException * @throws TableNotFoundException * @throws IllegalStateException * if the setting conflicts with any existing iterators */ public void checkIteratorConflicts(String tableName, IteratorSetting setting) throws AccumuloException, TableNotFoundException;
Refactor this code to not nest more than 3 if/for/while/switch/try statements.
public void parseArgs(String programName, String[] args, Object ... others) { super.parseArgs(programName, args, others);
Remove this unused method parameter "opts".
opts = IteratorUtil.generateInitialTableProperties(); public void addAggregators(String tableName, List<? extends org.apache.accumulo.core.iterators.conf.PerColumnIteratorConfig> aggregators) throws AccumuloSecurityException, TableNotFoundException, for (Entry<String,String> entry : IteratorUtil.generateAggTableProperties(aggregators).entrySet()) {
Remove this unused private "match" method.
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */
Replace all tab characters in this file by sequences of white-spaces.
fos.close();
Remove this unused method parameter "tservers".
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */
Replace all tab characters in this file by sequences of white-spaces.
if (group.length() > 0) result.put(group, new HashSet<ByteSequence>()); if (c == '\\') sb.append("\\\\"); else if (c >= 32 && c <= 126 && c != ',') sb.append((char) c); else sb.append("\\x").append(String.format("%02X", c));
Remove this call to "exit" or ensure it is really required.
import org.apache.accumulo.core.client.BatchWriterConfig; final BatchWriter writer = shellState.getConnector().createBatchWriter(tableName, new BatchWriterConfig());
Remove this unused method parameter "e".
public static final String ACCUMULO_CLASSPATH_VALUE = "$ACCUMULO_CONF_DIR,\n" + "$ACCUMULO_HOME/lib/[^.].$ACCUMULO_VERSION.jar,\n" if (System.getenv("ACCUMULO_CONF_DIR") != null) { // accumulo conf dir should be set. SITE_CONF = System.getenv("ACCUMULO_CONF_DIR") + "/" + configFile; } else if (System.getenv("ACCUMULO_HOME") != null) { // if no accumulo conf dir, try accumulo home default
2 duplicated blocks of code must be removed.
import java.util.NoSuchElementException; private ArrayBlockingQueue<List<Entry<Key,Value>>> resultsQueue; private Iterator<Entry<Key,Value>> batchIterator; private List<Entry<Key,Value>> batch; private static final List<Entry<Key,Value>> LAST_BATCH = new ArrayList<Map.Entry<Key,Value>>(); void receive(List<Entry<Key,Value>> entries); resultsQueue = new ArrayBlockingQueue<List<Entry<Key,Value>>>(numThreads); public void receive(List<Entry<Key,Value>> entries) { resultsQueue.put(entries); log.debug("Failed to add Batch Scan result", e); log.warn("Failed to add Batch Scan result", e); if (batch == LAST_BATCH) return false; if (batch != null && batchIterator.hasNext()) return true; batch = null; while (batch == null && fatalException == null && !queryThreadPool.isShutdown()) batch = resultsQueue.poll(1, TimeUnit.SECONDS); batchIterator = batch.iterator(); return batch != LAST_BATCH; if (hasNext()) return batchIterator.next(); else throw new NoSuchElementException(); if (!resultsQueue.offer(LAST_BATCH)) { if (!resultsQueue.offer(LAST_BATCH)) { resultsQueue.put(LAST_BATCH); if (!resultsQueue.offer(LAST_BATCH)) { ArrayList<Entry<Key,Value>> entries = new ArrayList<Map.Entry<Key,Value>>(scanResult.results.size()); entries.add(new MyEntry(new Key(kv.key), new Value(kv.value))); if (entries.size() > 0) receiver.receive(entries); entries = new ArrayList<Map.Entry<Key,Value>>(scanResult.results.size()); entries.add(new MyEntry(new Key(kv.key), new Value(kv.value))); if (entries.size() > 0) receiver.receive(entries);
Merge this if statement with the enclosing one.
import org.apache.accumulo.server.master.tableOps.CancelCompactions; zoo.putPersistentData(ZooUtil.getRoot(instance) + Constants.ZTABLES + "/" + id + Constants.ZTABLE_COMPACT_CANCEL_ID, "0".getBytes(), NodeExistsPolicy.SKIP); case COMPACT_CANCEL: { String tableId = ByteBufferUtil.toString(arguments.get(0)); if (!security.canCompact(itw, tableId)) throw new ThriftSecurityException(itw.getPrincipal(), SecurityErrorCode.PERMISSION_DENIED); fate.seedTransaction(opid, new TraceRepo<Master>(new CancelCompactions(tableId)), autoCleanup); break; }
Rename this package name to match the regular expression '^[a-z]+(\.[a-z][a-z0-9]*)*$'.
import java.nio.charset.Charset; private static final Charset utf8 = Charset.forName("UTF8"); public static final Value SUPPRESS_ROW_VALUE = new Value("SUPPRESS_ROW".getBytes(utf8));
Move this variable to comply with Java Code Conventions.
public List<ByteBuffer> listSplits(ByteBuffer login, String tableName, int maxSplits) throws TException { Collection<Text> splits = getConnector(login).tableOperations().listSplits(tableName, maxSplits);
Remove the redundant '!unknownSymbol!' thrown exception declaration(s).
import com.beust.jcommander.Parameter; import com.beust.jcommander.validators.PositiveInteger; static class Opts extends ContinuousWalk.Opts { @Parameter(names="--numToScan", description="Number rows to scan between sleeps", required=true, validateWith=PositiveInteger.class) long numToScan = 0; Opts opts = new Opts(); opts.parseArgs(ContinuousScanner.class.getName(), args); Connector conn = opts.getConnector(); Authorizations auths = opts.randomAuths.getAuths(r); Scanner scanner = conn.createScanner(opts.tableName, auths); scanner.setBatchSize(opts.scanBatchSize); double delta = Math.min(.05, .05 / (opts.numToScan / 1000.0)); long startRow = ContinuousIngest.genLong(opts.min, opts.max - distance, r); if (count < (1 - delta) * opts.numToScan || count > (1 + delta) * opts.numToScan) { double ratio = (double) opts.numToScan / count; if (opts.sleepTime > 0) UtilWaitThread.sleep(opts.sleepTime);
Remove this call to "exit" or ensure it is really required.
import org.apache.accumulo.core.cli.ScannerOpts; ScannerOpts scanOpts = new ScannerOpts(); opts.parseArgs(QueryMetadataTable.class.getName(), args, scanOpts); scanner.setBatchSize(scanOpts.scanBatchSize);
Remove this unused method parameter "opts".
import com.beust.jcommander.Parameter; import com.beust.jcommander.validators.PositiveInteger; static class Opts extends ContinuousWalk.Opts { @Parameter(names="--numToScan", description="Number rows to scan between sleeps", required=true, validateWith=PositiveInteger.class) long numToScan = 0; Opts opts = new Opts(); opts.parseArgs(ContinuousBatchWalker.class.getName(), args); Authorizations auths = opts.randomAuths.getAuths(r); Connector conn = opts.getConnector(); Scanner scanner = conn.createScanner(opts.tableName, auths); scanner.setBatchSize(opts.scanBatchSize); BatchScanner bs = conn.createBatchScanner(opts.tableName, auths, opts.scanThreads); Set<Text> batch = getBatch(scanner, opts.min, opts.max, opts.scanBatchSize, r); runBatchScan(opts.scanBatchSize, bs, batch, ranges); UtilWaitThread.sleep(opts.sleepTime);
Remove this call to "exit" or ensure it is really required.
* List the active compaction running on a tablet server * * @param tserver * The tablet server address should be of the form <ip address>:<port> * @return * @throws AccumuloException * @throws AccumuloSecurityException */ public List<ActiveCompaction> getActiveCompactions(String tserver) throws AccumuloException, AccumuloSecurityException; /**
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
import org.apache.accumulo.core.client.TableExistsException; if (args.length != 14) { + " [--debug <debug log>] <instance name> <zookeepers> <user> <pass> <table> <num> <min> <max> <max colf> <max colq> <max mem> <max latency> <max threads> <enable checksum>"); long num = Long.parseLong(args[5]); long min = Long.parseLong(args[6]); long max = Long.parseLong(args[7]); short maxColF = Short.parseShort(args[8]); short maxColQ = Short.parseShort(args[9]); long maxMemory = Long.parseLong(args[10]); long maxLatency = Integer.parseInt(args[11]); int maxWriteThreads = Integer.parseInt(args[12]); boolean checksum = Boolean.parseBoolean(args[13]); if (!conn.tableOperations().exists(table)) try { conn.tableOperations().create(table); } catch (TableExistsException tee) {} out: while (true) { if (count >= num) break out; if (count >= num) break out; if (count >= num) break out;
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. */
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
import org.apache.accumulo.examples.wikisearch.ingest.WikipediaMapper; import org.apache.accumulo.examples.wikisearch.normalizer.LcNoDiacriticsNormalizer; import org.apache.accumulo.examples.wikisearch.normalizer.Normalizer;
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. */
Replace all tab characters in this file by sequences of white-spaces.
import org.apache.accumulo.core.data.Value; /** * @deprecated since 1.4 */
1 duplicated blocks of code must be removed.
private static final Logger log = Logger.getLogger(RoundRobinLoggerStrategy.class); final List<String> preferences = new ArrayList<String>(); final String myHostName; public RoundRobinLoggerStrategy(TabletServer tserver) { String address = tserver.getClientAddressString(); myHostName = address.split(":", 2)[0]; } @Override public Set<String> getLoggers(Set<String> allLoggers) { if (allLoggers.size() == 0) return allLoggers; int numberOfLoggersToUse = getNumberOfLoggersToUse(); Set<String> result = new HashSet<String>(); // use the preferred loggers if they exist if (!preferences.isEmpty()) { for (int i = 0; result.size() < numberOfLoggersToUse && i < preferences.size(); i++) { String preferred = preferences.get(i); if (allLoggers.contains(preferred)) result.add(preferred); } // use logs closest to us (in name) List<String> loggers = new ArrayList<String>(allLoggers); Collections.sort(loggers); int pos = Collections.binarySearch(loggers, myHostName); if (pos < 0) pos = -pos - 1; for (int i = 0; result.size() < numberOfLoggersToUse && i < loggers.size(); i++) { String selection = loggers.get((pos + i) % loggers.size()); log.debug("Choosing logger " + selection); result.add(selection); return result; } @Override public void preferLoggers(Set<String> preference) { preferences.addAll(preference); }
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
@Override public String format(Object obj) { if (obj == null) return "-"; TabletServerStatus status = (TabletServerStatus) obj; return String.format("<a href='/tservers?s=%s'>%s</a>", status.name, displayName(status)); } public static String displayName(TabletServerStatus status) { return displayName(status == null ? null : status.name); } public static String displayName(String address) { if (address == null) return "--Unknown--"; InetSocketAddress inetAddress = AddressUtil.parseAddress(address, 0); return inetAddress.getHostName() + ":" + inetAddress.getPort(); } @Override public int compare(TabletServerStatus o1, TabletServerStatus o2) { return displayName(o1).compareTo(displayName(o2)); } @Override public String alignment() { return "left"; }
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
package org.apache.accumulo.test.randomwalk.concurrent; import org.apache.accumulo.test.randomwalk.State; import org.apache.accumulo.test.randomwalk.Test; * @see org.apache.accumulo.test.randomwalk.Node#visit(org.apache.accumulo.test.randomwalk.State, java.util.Properties)
Move the "org.apache.accumulo.test.randomwalk.unit.CreateTable" string literal on the left side of this string comparison.
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */
Replace all tab characters in this file by sequences of white-spaces.
package org.apache.accumulo.test;
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.CredentialHelper; import org.apache.accumulo.core.security.thrift.Credential; import org.apache.accumulo.core.security.thrift.tokens.PasswordToken; shellState.updateUser(CredentialHelper.create(user, new PasswordToken().setPassword(pass), shellState.getConnector().getInstance().getInstanceID()));
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
if (instance == null) return new LogService(); if (application == null || application.toString().isEmpty()) return;
Remove this call to "exit" or ensure it is really required.
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ @SuppressWarnings("all") public class AccumuloException extends TException implements org.apache.thrift.TBase<AccumuloException, AccumuloException._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]*$'.