Diff
stringlengths
10
2k
Message
stringlengths
28
159
* Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ @Override public int execute(String fullCommand, CommandLine cl, Shell shellState) throws AccumuloException, AccumuloSecurityException, TableNotFoundException, TableExistsException { shellState.getConnector().tableOperations().rename(cl.getArgs()[0], cl.getArgs()[1]); if (shellState.getTableName().equals(cl.getArgs()[0])) shellState.setTableName(cl.getArgs()[1]); return 0; } @Override public String usage() { return getName() + " <current table name> <new table name>"; } @Override public String description() { return "rename a table"; } public void registerCompletion(Token root, Map<Command.CompletionSet,Set<String>> completionSet) { registerCompletionForTables(root, completionSet); } @Override public int numArgs() { return 2; }
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
public class LogicalTimeIT extends ConfigurableMacIT {
Use "Integer.toString" instead.
import org.apache.accumulo.core.iterators.system.MapFileIterator; import org.apache.hadoop.io.MapFile; FileSKVIterator iter = new FileCFSkippingIterator(new RangeIterator(new MapFileIterator(acuconf, fs, file, conf))); return fs.getFileStatus(new Path(file + "/" + MapFile.DATA_FILE_NAME)).getLen(); MapFileIterator mfIter = new MapFileIterator(tableConf, fs, file, conf);
Remove this unused method parameter "acuconf".
public Repo<Master> call(long tid, Master master) throws Exception { String path = ZooUtil.getRoot(master.getInstance()) + Constants.ZTSERVERS + "/" + tserver; path = ZooUtil.getRoot(master.getInstance()) + Constants.ZDEADTSERVERS + "/" + tserver; Listener listener = master.getEventCoordinator().getListener(); master.shutdownTServer(server); while (master.onlineTabletServers().contains(server)) { TServerConnection connection = master.getConnection(server); connection.halt(master.getMasterLock());
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
if (txids == null) txids = new ArrayList<Long>(); if (txids.contains(txid)) throw new Exception("transaction already started"); if (txids == null) return false;
Remove this call to "exit" or ensure it is really required.
private static final int DEFAULT_TIMEOUT = 1000; // millis
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
MetadataTableUtil.deleteTable(cloneInfo.tableId, false, SystemCredentials.get(), environment.getMasterLock()); MetadataTableUtil.deleteTable(cloneInfo.tableId, false, SystemCredentials.get(), environment.getMasterLock()); AuditedSecurityOperation.getInstance().grantTablePermission(SystemCredentials.get().toThrift(environment.getInstance()), cloneInfo.user, cloneInfo.tableId, permission); AuditedSecurityOperation.getInstance().deleteTable(SystemCredentials.get().toThrift(environment.getInstance()), cloneInfo.tableId);
Immediately return this expression instead of assigning it to the temporary variable "onlineTabletsForTable".
assertEquals(0, cluster.exec(TestRandomDeletes.class, "-u", "root", "-p", MacTest.PASSWORD, "-i", cluster.getInstanceName(), "-z", cluster.getZooKeepers()).waitFor());
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
package org.apache.accumulo.core.util.shell.commands; import java.io.IOException; import org.apache.accumulo.core.util.shell.Shell; import org.apache.accumulo.core.util.shell.Shell.Command; import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.Option; import org.apache.commons.cli.Options; public class AboutCommand extends Command { private Option verboseOption; @Override public String description() { return "displays information about this program"; } @Override public int execute(String fullCommand, CommandLine cl, Shell shellState) throws IOException { shellState.printInfo(); if (cl.hasOption(verboseOption.getOpt())) shellState.printVerboseInfo(); return 0; } @Override public int numArgs() { return 0; } @Override public Options getOptions() { Options opts = new Options(); verboseOption = new Option("v", "verbose", false, "displays details session information"); opts.addOption(verboseOption); return opts; } }
Return empty string instead.
import org.apache.accumulo.core.security.thrift.TCredentials; private TCredentials credentials; MetadataLocationObtainer(TCredentials credentials, Instance instance) {
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
import org.apache.accumulo.core.security.tokens.SecurityToken; * @throws AccumuloSecurityException public static TabletLocator getTabletLocator(Class<?> implementingClass, Configuration conf) throws TableNotFoundException, AccumuloSecurityException { SecurityToken token = getToken(implementingClass, conf);
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.
mmi = client.getMasterStats(Tracer.traceInfo(), SystemCredentials.get().toThrift(HdfsZooInstance.getInstance())); result = client.getStatus(Tracer.traceInfo(), SystemCredentials.get().toThrift(instance));
Immediately return this expression instead of assigning it to the temporary variable "onlineTabletsForTable".
System.out.printf("tt : %6.2f%n", (t2 - t1) / 1000.0);
Use isEmpty() to check whether the collection is empty or not.
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */
Replace all tab characters in this file by sequences of white-spaces.
sb.append("<link rel='shortcut icon' type='image/jpg' href='/web/favicon.png' />\n");
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
import org.apache.accumulo.core.client.security.tokens.PasswordToken; Connector conn = inst.getConnector("root", new PasswordToken(""));
Rename "connector" which hides the field declared at line 67.
package ingest; import org.apache.hadoop.mapreduce.Counter; import org.apache.hadoop.mapreduce.Counters; import org.apache.hadoop.mapreduce.StatusReporter; public class StandaloneStatusReporter extends StatusReporter { 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++; } }
Return empty string instead.
import org.apache.accumulo.core.util.MetadataTable; Scanner scanner = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY); if (key.getColumnFamily().equals(MetadataTable.DATAFILE_COLUMN_FAMILY)) { if (key.getColumnFamily().equals(MetadataTable.CURRENT_LOCATION_COLUMN_FAMILY) || key.getColumnFamily().equals(MetadataTable.FUTURE_LOCATION_COLUMN_FAMILY)) { if (MetadataTable.PREV_ROW_COLUMN.hasColumns(key)) {
Use "Long.toString" instead.
try { t.attachIterator("table", setting); Assert.fail(); } catch (IllegalArgumentException e) {} setting.setName("thirdName"); try { t.attachIterator("table", setting); Assert.fail(); } catch (IllegalArgumentException e) {} setting.setPriority(10); t.attachIterator("table", setting);
Refactor this code to not nest more than 3 if/for/while/switch/try statements.
@Test(timeout = 4 * 60 * 1000)
Either log or rethrow this exception.
public boolean throwsError() throws org.apache.accumulo.core.security.thrift.ThriftSecurityException, org.apache.thrift.TException; public boolean throwsError() throws org.apache.accumulo.core.security.thrift.ThriftSecurityException, org.apache.thrift.TException public boolean recv_throwsError() throws org.apache.accumulo.core.security.thrift.ThriftSecurityException, org.apache.thrift.TException public boolean getResult() throws org.apache.accumulo.core.security.thrift.ThriftSecurityException, org.apache.thrift.TException { } catch (org.apache.accumulo.core.security.thrift.ThriftSecurityException ex) { public org.apache.accumulo.core.security.thrift.ThriftSecurityException ex; // required org.apache.accumulo.core.security.thrift.ThriftSecurityException ex) this.ex = new org.apache.accumulo.core.security.thrift.ThriftSecurityException(other.ex); public org.apache.accumulo.core.security.thrift.ThriftSecurityException getEx() { public throwsError_result setEx(org.apache.accumulo.core.security.thrift.ThriftSecurityException ex) { setEx((org.apache.accumulo.core.security.thrift.ThriftSecurityException)value); struct.ex = new org.apache.accumulo.core.security.thrift.ThriftSecurityException(); struct.ex = new org.apache.accumulo.core.security.thrift.ThriftSecurityException();
1 duplicated blocks of code must be removed.
import org.apache.accumulo.core.security.tokens.InstanceTokenWrapper; private InstanceTokenWrapper token; * @param token.toThrift() public TableOperationsImpl(Instance instance, InstanceTokenWrapper credentials) { this.token = credentials; return client.beginTableOperation(Tracer.traceInfo(), token.toThrift()); client.executeTableOperation(Tracer.traceInfo(), token.toThrift(), opid, op, args, opts, autoCleanUp); return client.waitForTableOperation(Tracer.traceInfo(), token.toThrift(), opid); client.finishTableOperation(Tracer.traceInfo(), token.toThrift(), opid); TabletLocator tabLocator = TabletLocator.getInstance(instance, token, new Text(tableId)); client.splitTablet(Tracer.traceInfo(), token.toThrift(), tl.tablet_extent.toThrift(), TextUtil.getByteBuffer(split)); MetadataTable.getEntries(instance, token, tableName, false, locations, tablets); flushID = client.initiateFlush(Tracer.traceInfo(), token.toThrift(), tableId); client.waitForFlush(Tracer.traceInfo(), token.toThrift(), tableId, TextUtil.getByteBuffer(start), TextUtil.getByteBuffer(end), flushID, wait ? Long.MAX_VALUE : 1); client.setTableProperty(Tracer.traceInfo(), token.toThrift(), tableName, property, value); client.removeTableProperty(Tracer.traceInfo(), token.toThrift(), tableName, property); TabletLocator tl = TabletLocator.getInstance(instance, token, new Text(tableId)); TabletLocator tabLocator = TabletLocator.getInstance(instance, token, new Text(Tables.getTableId(instance, tableName))); Scanner scanner = instance.getConnector(token.getToken()).createScanner(tableName, auths);
Immediately return this expression instead of assigning it to the temporary variable "ret".
import org.apache.accumulo.core.master.thrift.MasterClientService.Iface; Processor<Iface> processor = new Processor<Iface>(TraceWrap.service(new MasterClientServiceHandler()));
Immediately return this expression instead of assigning it to the temporary variable "client".
package org.apache.accumulo.examples.wikisearch.jexl;
Rename "table" which hides the field declared at line 107.
/* * 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.server.zookeeper; import org.apache.accumulo.core.zookeeper.ZooUtil.NodeExistsPolicy; import org.apache.accumulo.core.zookeeper.ZooUtil.NodeMissingPolicy; import org.apache.log4j.Logger; import org.apache.zookeeper.KeeperException; import org.apache.zookeeper.KeeperException.NoNodeException; import org.apache.zookeeper.KeeperException.NodeExistsException; import org.apache.zookeeper.data.Stat; public class ZooReservation { public static boolean attempt(ZooReaderWriter zk, String path, String reservationID, String debugInfo) throws KeeperException, InterruptedException{ if(reservationID.contains(":")) throw new IllegalArgumentException(); while(true){ try{ zk.putPersistentData(path, (reservationID+":"+debugInfo).getBytes(), NodeExistsPolicy.FAIL); return true; } catch (NodeExistsException nee) { Stat stat = new Stat(); byte[] zooData; try { zooData = zk.getData(path, stat); } catch (NoNodeException nne) { continue; } String idInZoo = new String(zooData).split(":")[0]; return idInZoo.equals(new String(reservationID)); } } } public static void release(ZooReaderWriter zk, String path, String reservationID) throws KeeperException, InterruptedException{ Stat stat = new Stat(); byte[] zooData; try { zooData = zk.getData(path, stat); } catch (NoNodeException e) { //TODO log warning? this may happen as a normal course of business.... could return a boolean... Logger.getLogger(ZooReservation.class).debug("Node does not exist "+path); return; } String idInZoo = new String(zooData).split(":")[0]; if(!idInZoo.equals(new String(reservationID))){ throw new IllegalStateException("Tried to release reservation "+path+" with data mismatch "+new String(reservationID)+" "+new String(zooData)); } zk.recursiveDelete(path, stat.getVersion(), NodeMissingPolicy.SKIP); } }
Return empty string instead.
LongCombiner.setEncodingType(is, SummingCombiner.Type.VARLEN); LongCombiner.setEncodingType(is, SummingCombiner.Type.FIXEDLEN); LongCombiner.setEncodingType(is, SummingCombiner.Type.VARLEN); public static void sumArray(Class<? extends Encoder<List<Long>>> encoderClass, SummingArrayCombiner.Type type) throws IOException, InstantiationException, SummingArrayCombiner.setEncodingType(is, type); sumArray(SummingArrayCombiner.VarLongArrayEncoder.class, SummingArrayCombiner.Type.VARLEN); sumArray(SummingArrayCombiner.FixedLongArrayEncoder.class, SummingArrayCombiner.Type.FIXEDLEN); sumArray(SummingArrayCombiner.StringArrayEncoder.class, SummingArrayCombiner.Type.STRING);
Remove the literal "true" boolean value.
/* * 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.util; import java.io.IOException; import java.net.ServerSocket; import java.util.Random; public class PortUtils { public static int getRandomFreePort() { Random r = new Random(); int count = 0; while (count < 13) { int port = r.nextInt((1 << 16) - 1024) + 1024; ServerSocket so = null; try { so = new ServerSocket(port); so.setReuseAddress(true); return port; } catch (IOException ioe) { } finally { if (so != null) try { so.close(); } catch (IOException e) {} } } throw new RuntimeException("Unable to find port"); } }
Either log or rethrow this exception.
@Test(timeout = 15 * 1000)
Either log or rethrow this exception.
import org.apache.accumulo.core.security.Authorizations; BatchScanner bs = connector.createBatchScanner("index", Authorizations.EMPTY, 10);
Remove this unused method parameter "range".
updateHosts(path, zoo.getChildren(path, this));
Reorder the modifiers to comply with the Java Language Specification.
return "sleeps for the given number of seconds"; }
Replace all tab characters in this file by sequences of white-spaces.
public interface Mutator { byte[] mutate(byte[] currentValue) throws Exception; }
Define and throw a dedicated exception instead of using a generic one.
void init(SortedKeyValueIterator<K,V> source, Map<String,String> options, IteratorEnvironment env) throws IOException; // we should add method to get a continue key that appropriately translates boolean hasTop(); void next() throws IOException; /** * An iterator must seek to the first key in the range taking inclusiveness into account. However, an iterator does not have to stop at the end of the range. * The whole range is provided so that iterators can make optimizations. */ void seek(Range range, Collection<ByteSequence> columnFamilies, boolean inclusive) throws IOException; K getTopKey(); V getTopValue(); // create a deep copy of this iterator as though seek had not yet been called // init must not be called after clone, on either of the instances SortedKeyValueIterator<K,V> deepCopy(IteratorEnvironment env);
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
* <li>{@link AccumuloOutputFormat#setConnectorInfo(Job, String, byte[])} OR {@link AccumuloOutputFormat#setConnectorInfo(Job, Path)} * @param principal * @param token public static void setConnectorInfo(Job job, String principal, byte[] token) { OutputConfigurator.setConnectorInfo(CLASS, job.getConfiguration(), principal, token); * @deprecated since 1.5.0; Use {@link #setConnectorInfo(Job, String, byte[])}, {@link #setConnectorInfo(Job, Path)}, {@link #setCreateTables(Job, boolean)},
Remove the redundant '!unknownSymbol!' thrown exception declaration(s).
if (cl.hasOption(timestampOpt.getOpt())) m.put(new Text(cl.getArgs()[1]), new Text(cl.getArgs()[2]), le, Long.parseLong(cl.getOptionValue(timestampOpt.getOpt())), new Value(cl.getArgs()[3].getBytes())); else m.put(new Text(cl.getArgs()[1]), new Text(cl.getArgs()[2]), le, new Value(cl.getArgs()[3].getBytes())); } else if (cl.hasOption(timestampOpt.getOpt())) m.put(new Text(cl.getArgs()[1]), new Text(cl.getArgs()[2]), Long.parseLong(cl.getOptionValue(timestampOpt.getOpt())), new Value(cl.getArgs()[3].getBytes())); else m.put(new Text(cl.getArgs()[1]), new Text(cl.getArgs()[2]), new Value(cl.getArgs()[3].getBytes())); if (e.getAuthorizationFailures().isEmpty() == false) lines.add(" Authorization Failures:"); if (e.getConstraintViolationSummaries().isEmpty() == false) lines.add(" Constraint Failures:");
Remove this call to "exit" or ensure it is really required.
return new ByteArrayInputStream(sb.toString().getBytes());
Remove this unused private "appendProp" method.
@Test(timeout = 4 * 60 * 1000)
Replace this use of System.out or System.err by a logger.
for (String key : IteratorUtil.generateInitialTableProperties(true).keySet()) {
Either log or rethrow this exception.
import org.apache.accumulo.core.security.tokens.InstanceTokenWrapper; public void initializeSecurity(InstanceTokenWrapper token, String rootuser) throws AccumuloSecurityException {
Immediately return this expression instead of assigning it to the temporary variable "ret".
import java.util.Arrays; throw new Exception("dir " + reportDir + " is not empty: " + Arrays.asList(files));
Remove this call to "exit" or ensure it is really required.
/* * If a minor compaction starts after a tablet opens, this indicates a log recovery occurred. This recovered data must be minor compacted. * * There are three reasons to wait for this minor compaction to finish before placing the tablet in online tablets. * * 1) The log recovery code does not handle data written to the tablet on multiple tablet servers. 2) The log recovery code does not block if memory * is full. Therefore recovering lots of tablets that use a lot of memory could run out of memory. 3) The minor compaction finish event did not make * it to the logs (the file will be in !METADATA, preventing replay of compacted data)... but do not want a majc to wipe the file out from !METADATA * and then have another process failure... this could cause duplicate data to replay */ if (tablet.getNumEntriesInMemory() > 0 && !tablet.minorCompactNow()) { throw new RuntimeException("Minor compaction after recovery fails for " + extentToOpen);
Either log or rethrow this exception.
+ "along with accumulo lib and zookeeper directory. Supports full regex on filename alone."), // needs special treatment in accumulo start jar GENERAL_KERBEROS_KEYTAB("general.kerberos.keytab", "", PropertyType.PATH, "Path to the kerberos keytab to use. Leave blank if not using kerberoized hdfs"), GENERAL_KERBEROS_PRINCIPAL("general.kerberos.principal", "", PropertyType.STRING, "Name of the kerberos principal to use. _HOST will automatically be " + "replaced by the machines hostname in the hostname portion of the principal. Leave blank if not using kerberoized hdfs"),
Move this constructor to comply with Java Code Conventions.
package org.apache.accumulo.cloudtrace.instrument; import org.apache.accumulo.cloudtrace.instrument.Span; import org.apache.accumulo.cloudtrace.instrument.Trace;
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
import java.util.ArrayList; import java.util.Collections; import java.util.List; import org.apache.accumulo.core.client.IteratorSetting; private Option noFlushOption, waitOpt, profileOpt; private List<IteratorSetting> iterators; shellState.getConnector().tableOperations().compact(tableName, startRow, endRow, iterators, flush, wait); if (cl.hasOption(profileOpt.getOpt())) { List<IteratorSetting> iterators = shellState.iteratorProfiles.get(cl.getOptionValue(profileOpt.getOpt())); if (iterators == null) { Shell.log.error("Profile " + cl.getOptionValue(profileOpt.getOpt()) + " does not exist"); return -1; } this.iterators = new ArrayList<IteratorSetting>(iterators); } else { this.iterators = Collections.emptyList(); } profileOpt = new Option("pn", "profile", true, "iterator profile name"); profileOpt.setArgName("profile"); opts.addOption(profileOpt);
Remove the redundant '!unknownSymbol!' thrown exception declaration(s).
new ServerServices(new String(data)).getAddressString(Service.TSERV_CLIENT), conf.getPort(Property.TSERV_CLIENTPORT),
Replace all tab characters in this file by sequences of white-spaces.
server = new EmbeddedWebServer(hostname, port);
Make this IP "0.0.0.0" address configurable.
package org.apache.accumulo.test;
Move the "org.apache.accumulo.test.randomwalk.unit.CreateTable" string literal on the left side of this string comparison.
/** * This class remains here for backwards compatibility. * * @deprecated since 1.4 * @see org.apache.accumulo.core.iterators.user.IntersectingIterator */ public class IntersectingIterator extends org.apache.accumulo.core.iterators.user.IntersectingIterator {
Remove this unused private "match" method.
import java.util.ArrayList; import java.util.List; import org.apache.accumulo.core.cli.BatchWriterOpts; import org.apache.accumulo.core.cli.ClientOnRequiredTable; import com.beust.jcommander.Parameter; public static class Opts extends ClientOnRequiredTable { @Parameter(names="--vis", description="use a given visibility for the new counts", converter=VisibilityConverter.class) ColumnVisibility visibility = new ColumnVisibility(); @Parameter(names="--chunk", description="size of the chunks used to store partial files") int chunkSize = 64*1024; @Parameter(description="<file> { <file> ... }") List<String> files = new ArrayList<String>(); } public static void main(String[] args) throws Exception { Opts opts = new Opts(); BatchWriterOpts bwOpts = new BatchWriterOpts(); opts.parseArgs(FileDataIngest.class.getName(), args, bwOpts); Connector conn = opts.getConnector(); if (!conn.tableOperations().exists(opts.tableName)) { conn.tableOperations().create(opts.tableName); conn.tableOperations().attachIterator(opts.tableName, new IteratorSetting(1, ChunkCombiner.class)); BatchWriter bw = conn.createBatchWriter(opts.tableName, bwOpts.getBatchWriterConfig()); FileDataIngest fdi = new FileDataIngest(opts.chunkSize, opts.visibility); for (String filename : opts.files) { fdi.insertFileData(filename, bw); opts.stopTracing();
Remove this unused private "appendProp" method.
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */
Replace all tab characters in this file by sequences of white-spaces.
import org.apache.accumulo.cloudtrace.instrument.Span; import org.apache.accumulo.cloudtrace.instrument.Trace;
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
public int execute(final String fullCommand, final CommandLine cl, final Shell shellState) throws AccumuloException, AccumuloSecurityException, IOException { final String user = cl.getArgs()[0]; final String p = shellState.readMaskedLine("Enter current password for '" + user + "': ", '*'); final byte[] password = p.getBytes(); final boolean valid = shellState.getConnector().securityOperations().authenticateUser(user, password); public void registerCompletion(final Token root, final Map<Command.CompletionSet,Set<String>> completionSet) {
Remove the redundant '!unknownSymbol!' thrown exception declaration(s).
return CredentialHelper.createSquelchError(getSysUserName(), getSysToken(), state.getInstance().getInstanceID()); return CredentialHelper.createSquelchError(getTabUserName(), getTabToken(), state.getInstance().getInstanceID()); } public AuthenticationToken getSysToken() { return new PasswordToken(getSysPassword()); } public AuthenticationToken getTabToken() { return new PasswordToken(getTabPassword());
Immediately return this expression instead of assigning it to the temporary variable "connector".
import org.apache.accumulo.fate.zookeeper.IZooReaderWriter;
Remove this call to "exit" or ensure it is really required.
fs.delete(new Path("tmp/testmf"), true); fs.delete(new Path("tmp/testmf_failures"), true); fs.delete(new Path("tmp/testmf"), true); bulkImport(fs, TABLE_NAME, "tmp/testmf");
Define a constant instead of duplicating this literal "tmp/testmf" 4 times.
if (out != null) out.close();
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.
if (r < 0) throw new IllegalArgumentException(); if (res != 0) System.exit(res);
Remove this call to "exit" or ensure it is really required.
String[] tableNames = getTableNames(3); // Logger logger = Logger.getLogger(Constants.CORE_PACKAGE_NAME); // logger.setLevel(Level.TRACE); // logger.setLevel(Level.TRACE);
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. */ /** * Autogenerated by Thrift Compiler (0.9.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated */ package org.apache.accumulo.proxy.thrift; import java.util.Map; import java.util.HashMap; import org.apache.thrift.TEnum; @SuppressWarnings("all") public enum PCompactionReason implements org.apache.thrift.TEnum { USER(0), SYSTEM(1), CHOP(2), IDLE(3), CLOSE(4); private final int value; private PCompactionReason(int value) { this.value = value; } /** * Get the integer value of this enum value, as defined in the Thrift IDL. */ public int getValue() { return value; } /** * Find a the enum type by its integer value, as defined in the Thrift IDL. * @return null if the value is not found. */ public static PCompactionReason findByValue(int value) { switch (value) { case 0: return USER; case 1: return SYSTEM; case 2: return CHOP; case 3: return IDLE; case 4: return CLOSE; default: return null; } } }
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
import org.apache.accumulo.core.security.Credentials; private Credentials credentials; ScannerIterator(Instance instance, Credentials credentials, Text table, Authorizations authorizations, Range range, int size, int timeOut, scanState = new ScanState(instance, credentials, tableId, authorizations, new Range(range), options.fetchedColumns, size, options.serverSideIteratorList, @Override @Override @Override
Immediately return this expression instead of assigning it to the temporary variable "onlineTabletsForTable".
import org.apache.accumulo.core.client.Connector; public class DeleteRowsIT extends SimpleMacIT { String tableName = makeTableName(); testSplit(tableName + i++, "f", "h", "abcdefijklmnopqrstuvwxyz", 260); testSplit(tableName + i++, "f1", "h", "abcdeff1ijklmnopqrstuvwxyz", 262); testSplit(tableName + i++, "f", "h1", "abcdefijklmnopqrstuvwxyz", 258); testSplit(tableName + i++, "f1", "h1", "abcdeff1ijklmnopqrstuvwxyz", 260); testSplit(tableName + i++, "f", "g", "abcdefhijklmnopqrstuvwxyz", 270); testSplit(tableName + i++, "f", "f1", "abcdefghijklmnopqrstuvwxyz", 278); testSplit(tableName + i++, "f1", "g", "abcdeff1hijklmnopqrstuvwxyz", 272); testSplit(tableName + i++, null, "h", "ijklmnopqrstuvwxyz", 200); testSplit(tableName + i++, "t", null, "abcdefghijklmnopqrst", 200); testSplit(tableName + i++, "t0", "t2", "abcdefghijklmnopqrstt0uvwxyz", 278); testSplit(tableName + i++, null, "A1", "abcdefghijklmnopqrstuvwxyz", 278); testSplit(tableName + i++, "{1", null, "abcdefghijklmnopqrstuvwxyz{1", 272); testSplit(tableName + i++, null, null, "", 0); Connector c = getConnector(); c.tableOperations().create(table); BatchWriter bw = c.createBatchWriter(table, null); c.tableOperations().addSplits(table, SPLITS); c.tableOperations().deleteRows(table, startText, endText); Collection<Text> remainingSplits = c.tableOperations().listSplits(table); Scanner scanner = c.createScanner(table, Authorizations.EMPTY);
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
import org.apache.accumulo.core.client.Instance; private MemoryManager memoryManager; private final LruBlockCache _dCache; private final LruBlockCache _iCache; private final ServerConfiguration conf; public TabletServerResourceManager(Instance instance, FileSystem fs) { this.conf = new ServerConfiguration(instance); AccumuloConfiguration acuConf = conf.getConfiguration(); boolean usingNativeMap = acuConf.getBoolean(Property.TSERV_NATIVEMAP_ENABLED) && NativeMap.loadedNativeLibraries(); fileManager = new FileManager(conf, fs, maxOpenFiles, _dCache, _iCache); Class<? extends MemoryManager> clazz = AccumuloClassLoader.loadClass(acuConf.get(Property.TSERV_MEM_MGMT), memoryManager = clazz.newInstance(); memoryManager.init(conf); log.debug("Loaded memory manager : " + memoryManager.getClass().getName()); if (memoryManager == null) { memoryManager = new LargestFirstMemoryManager(); maxMem = conf.getConfiguration().getMemoryInBytes(Property.TSERV_MAXMEM); mma = memoryManager.getMemoryManagementActions(tablets); long timeout = System.currentTimeMillis() + conf.getConfiguration().getTimeInMillis(Property.GENERAL_RPC_TIMEOUT); memoryManager.tabletClosed(tablet.getExtent()); if (tablet.isMeta()) { if (tablet.isRootTablet()) { } else if (tablet.isMeta()) { if (tablet.isRootTablet()) { } else if (tablet.isMeta()) { if (tablet.isRootTablet()) { } else if (tablet.isMeta()) {
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
super(); this.setSource(iterator); this.maxVersions = maxVersions;
Define and throw a dedicated exception instead of using a generic one.
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */
Replace all tab characters in this file by sequences of white-spaces.
private static String setUpOptions(ConsoleReader reader, String className, Map<String,String> options) throws IOException, ShellCommandException { } catch (ClassCastException e) { throw new ShellCommandException(ErrorCode.INITIALIZATION_FAILURE, "Unable to load " + className + " as type " + OptionDescriber.class.getName() + "; configure with 'config' instead");
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. */ package org.apache.accumulo.core.client.impl; * This class is intended to encapsulate errors that occurred on the server side. private static final long serialVersionUID = 1L; private String server; public AccumuloServerException(String server, TApplicationException tae) { super("Error on server " + server, tae); this.setServer(server); } private void setServer(String server) { this.server = server; } public String getServer() { return server; }
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
import org.apache.accumulo.cloudtrace.instrument.Span; import org.apache.accumulo.cloudtrace.instrument.Trace; import org.apache.accumulo.cloudtrace.thrift.TInfo;
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
/** * Subclasses must implement a typedReduce method: public Long typedReduce(Key key, Iterator<Long> iter); * A required option for this Combiner is "type" which indicates which type of Encoder to use to encode and decode Longs into Values. Supported types are /** /** /**
Remove the literal "true" boolean value.
Iterator<Entry<Key,Value>> makeIterator(final String... args) { final Map<Key,Value> result = new TreeMap<Key,Value>(); final String parts[] = s.split("[ \t]"); final Key key = new Key(parts[0], parts[1], parts[2]); final Value value = new Value(parts[3].getBytes()); List<List<Entry<Key,Value>>> getRows(final Iterator<Entry<Key,Value>> iter) { final List<List<Entry<Key,Value>>> result = new ArrayList<List<Entry<Key,Value>>>(); final RowIterator riter = new RowIterator(iter); final Iterator<Entry<Key,Value>> row = riter.next(); final List<Entry<Key,Value>> rlist = new ArrayList<Entry<Key,Value>>(); final RowIterator i = new RowIterator(makeIterator("a b c d", "a 1 2 3", "b 1 2 3"));
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.
* 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 long currentTime() { return value; } advice.value += 10000; assertTrue("after much advice, relative time is still closer to local time", (advice.value - many) < (once - local.value));
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
import org.apache.accumulo.server.util.MetadataTable; for (String cq : MetadataTable.getDataFileSizes(ke, token).keySet()) { files.add(ServerConstants.getTablesDir() + "/" + tableId + cq);
Remove this unused method parameter "extent".
@Test(timeout=60*1000)
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.
import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import com.google.gson.Gson; private Gson gson = new Gson(); private static Map<String,Object> addServer(String ip, String hostname, double osload, double ingest, double query, double ingestMB, double queryMB, Map<String,Object> map = new HashMap<String,Object>(); map.put("ip", ip); map.put("hostname", hostname); map.put("osload", osload); map.put("ingest", ingest); map.put("query", query); map.put("ingestMB", ingestMB); map.put("queryMB", queryMB); map.put("scans", scans); map.put("scans", scansessions); map.put("holdtime", holdtime); return map; Map<String,Object> results = new HashMap<String,Object>(); List<Map<String,Object>> servers = new ArrayList<Map<String,Object>>(); servers.add(addServer(status.name, TServerLinkType.displayName(status.name), status.osLoad, summary.ingestRate, summary.queryRate, status.holdTime)); Map<String,Object> badServer = new HashMap<String,Object>(); badServer.put("ip", entry.getKey()); badServer.put("bad", true); servers.add(badServer); Map<String,Object> deadServer = new HashMap<String,Object>(); deadServer.put("ip", dead.server); deadServer.put("dead", true); servers.add(deadServer); results.put("servers", servers); sb.append(gson.toJson(results)); protected void pageEnd(HttpServletRequest req, HttpServletResponse resp, StringBuilder sb) {}
Replace all tab characters in this file by sequences of white-spaces.
import java.util.LinkedHashSet; import java.util.Properties; import java.util.Set; @Override public void init(Properties properties) { if (properties.containsKey("password")) this.password = properties.getProperty("password").getBytes(Constants.UTF8); else throw new IllegalArgumentException("Missing 'password' property"); } @Override public Set<TokenProperty> getProperties() { Set<TokenProperty> internal = new LinkedHashSet<TokenProperty>(); internal.add(new TokenProperty("password", "the password for the principal", true)); return internal; }
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. */
1 duplicated blocks of code must be removed.
package org.apache.accumulo.core.client.mock; import org.apache.accumulo.core.client.BatchWriter; import org.apache.accumulo.core.client.MutationsRejectedException; import org.apache.accumulo.core.data.Mutation; public class MockBatchWriter implements BatchWriter { final String tablename; final MockAccumulo acu; MockBatchWriter(MockAccumulo acu, String tablename) { this.acu = acu; this.tablename = tablename; } @Override public void addMutation(Mutation m) throws MutationsRejectedException { acu.addMutation(tablename, m); } @Override public void addMutations(Iterable<Mutation> iterable) throws MutationsRejectedException { for (Mutation m : iterable) { acu.addMutation(tablename, m); } } @Override public void flush() throws MutationsRejectedException { } @Override public void close() throws MutationsRejectedException { } }
Return empty string instead.
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */
Replace all tab characters in this file by sequences of white-spaces.
* Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ for (long i = 0; i < 1000 * 1000; i++) { for (long i = 0; i < 1000 * 1000; i++) { for (long i = 0; i < 1000 * 1000; i++) {
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
import org.apache.accumulo.server.master.tableOps.TraceRepo; fate.seedTransaction(tid, new TraceRepo<Master>(new ShutdownTServer(doomed, force)), false); fate.seedTransaction(opid, new TraceRepo<Master>(new CreateTable(c.user, tableName, timeType, options)), autoCleanup); fate.seedTransaction(opid, new TraceRepo<Master>(new RenameTable(tableId, oldTableName, newTableName)), autoCleanup); fate.seedTransaction(opid, new TraceRepo<Master>(new CloneTable(c.user, srcTableId, tableName, propertiesToSet, propertiesToExclude)), autoCleanup); fate.seedTransaction(opid, new TraceRepo<Master>(new DeleteTable(tableId)), autoCleanup); fate.seedTransaction(opid, new TraceRepo<Master>(new ChangeTableState(tableId, TableOperation.ONLINE)), autoCleanup); fate.seedTransaction(opid, new TraceRepo<Master>(new ChangeTableState(tableId, TableOperation.OFFLINE)), autoCleanup); fate.seedTransaction(opid, new TraceRepo<Master>(new TableRangeOp(MergeInfo.Operation.MERGE, tableId, startRow, endRow)), autoCleanup); fate.seedTransaction(opid, new TraceRepo<Master>(new TableRangeOp(MergeInfo.Operation.DELETE, tableId, startRow, endRow)), autoCleanup); fate.seedTransaction(opid, new TraceRepo<Master>(new BulkImport(tableId, dir, failDir, setTime)), autoCleanup); fate.seedTransaction(opid, new TraceRepo<Master>(new CompactRange(tableId, startRow, endRow)), autoCleanup);
Rename this package name to match the regular expression '^[a-z]+(\.[a-z][a-z0-9]*)*$'.
/** * A Combiner that interprets Values as Longs and returns the largest Long among them. */
1 duplicated blocks of code must be removed.
if (!fs.delete(path, true)) if (fs.exists(path)) log.error("Unable to delete " + outputFile); if (e instanceof IOException) throw (IOException) e; if (env.getIteratorScope() == IteratorScope.majc) iterEnv = new TabletIteratorEnvironment(IteratorScope.majc, !propogateDeletes, acuTableConf); else if (env.getIteratorScope() == IteratorScope.minc) iterEnv = new TabletIteratorEnvironment(IteratorScope.minc, acuTableConf); else throw new IllegalArgumentException();
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.
import org.apache.accumulo.core.security.thrift.Credentials; authenticate(WalkingSecurity.get(state).getSysCredentials(), state, props); public static void authenticate(Credentials auth, State state, Properties props) throws Exception { Connector conn = state.getInstance().getConnector(auth.getPrincipal(), auth.getToken()); result = conn.securityOperations().authenticateUser(target, password);
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
import org.apache.accumulo.core.security.Credentials; String outString = new Credentials("root", new PasswordToken("")).serialize();
Remove this hard-coded password.
/* * 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 (this == o) return true; if (length() != obs.length()) return false;
Remove this call to "exit" or ensure it is really required.
import org.apache.accumulo.core.security.thrift.TCredentials; public void send(TCredentials credentials, String serverName, MasterClientService.Iface client) throws TException, ThriftSecurityException {
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.
import org.apache.accumulo.core.data.ByteSequence; int sum2 = 0; Key firstKey = null; if (rowIterator.hasTop()) { firstKey = new Key(rowIterator.getTopKey()); } // ensure that seeks are confined to the row rowIterator.seek(new Range(), new HashSet<ByteSequence>(), false); while (rowIterator.hasTop()) { sum2 += Integer.parseInt(rowIterator.getTopValue().toString()); rowIterator.next(); } rowIterator.seek(new Range(firstKey.getRow(), false, null, true), new HashSet<ByteSequence>(), false); while (rowIterator.hasTop()) { sum2 += Integer.parseInt(rowIterator.getTopValue().toString()); rowIterator.next(); } return sum == 2 && sum2 == 2;
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.
if (trackBlocks) listRegions.add(region);
Remove this call to "exit" or ensure it is really required.
for (String key : IteratorUtil.generateInitialTableProperties(true).keySet())
Either log or rethrow this exception.
boolean tableExists = SecurityHelper.getTableExists(state); boolean cloudTableExists = conn.tableOperations().list().contains(SecurityHelper.getTableName(state)); boolean tableUserExists = SecurityHelper.getTabUserExists(state); boolean cloudTableUserExists = conn.securityOperations().listUsers().contains(SecurityHelper.getTabUserName(state)); boolean tabUserExists = SecurityHelper.getTabUserExists(state); for (String user : new String[] {SecurityHelper.getSysUserName(state), SecurityHelper.getTabUserName(state)}) { boolean hasSp = SecurityHelper.getSysPerm(state, user, sp); if (tabUserExists) boolean hasTp = SecurityHelper.getTabPerm(state, user, tp); accuHasTp = conn.securityOperations().hasTablePermission(user, SecurityHelper.getTableName(state), tp); if (tabUserExists) Authorizations auths = SecurityHelper.getUserAuths(state, SecurityHelper.getTabUserName(state)); accuAuths = conn.securityOperations().getUserAuthorizations(SecurityHelper.getTabUserName(state)); if (tabUserExists)
Either log or rethrow this exception.
private final Span parent; private final Runnable runnable; public TraceRunnable(Runnable runnable) { this(Trace.currentTrace(), runnable); } public TraceRunnable(Span parent, Runnable runnable) { this.parent = parent; this.runnable = runnable; } @Override public void run() { if (parent != null) { Span chunk = Trace.startThread(parent, Thread.currentThread().getName()); try { runnable.run(); } finally { Trace.endThread(chunk); } } else { runnable.run(); } @SuppressWarnings({"rawtypes", "unchecked"}) @Override public int compareTo(TraceRunnable o) { return ((Comparable) this.runnable).compareTo(o.runnable); }
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
static private Logger log = Logger.getLogger(Halt.class); public static void halt(final String msg) { halt(0, new Runnable() { public void run() { log.fatal(msg); } }); } public static void halt(final String msg, int status) { halt(status, new Runnable() { public void run() { log.fatal(msg); } }); } public static void halt(final int status, Runnable runnable) { try { // give ourselves a little time to try and do something new Daemon() { public void run() { UtilWaitThread.sleep(100); Runtime.getRuntime().halt(status); }.start(); if (runnable != null) runnable.run(); Runtime.getRuntime().halt(status); } finally { // In case something else decides to throw a Runtime exception Runtime.getRuntime().halt(-1); }
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.