Diff
stringlengths
10
2k
Message
stringlengths
28
159
tmpInput = DfsLogger.readHeader(fs, srcPath, cryptoOpts); if (!cryptoOpts.containsKey(Property.CRYPTO_MODULE_CLASS.getKey())) {
Either log or rethrow this exception.
private static final WeakHashMap<String,WeakReference<String>> tabletLocs = new WeakHashMap<String,WeakReference<String>>();
Remove this unused private "appendProp" method.
import org.apache.accumulo.core.client.impl.thrift.ClientService.Client; public static <T> T execute(Instance instance, ClientExecReturn<T,ClientService.Client> exec) throws AccumuloException, AccumuloSecurityException { public static void execute(Instance instance, ClientExec<ClientService.Client> exec) throws AccumuloException, AccumuloSecurityException { public static <T> T executeRaw(Instance instance, ClientExecReturn<T,ClientService.Client> exec) throws Exception { ClientService.Client client = null; Pair<String,Client> pair = ServerClient.getConnection(instance); public static void executeRaw(Instance instance, ClientExec<ClientService.Client> exec) throws Exception { ClientService.Client client = null; Pair<String,Client> pair = ServerClient.getConnection(instance); public static Pair<String,ClientService.Client> getConnection(Instance instance) throws TTransportException { public static Pair<String,ClientService.Client> getConnection(Instance instance, boolean preferCachedConnections) throws TTransportException { ClientService.Client client = ThriftUtil.createClient(new ClientService.Client.Factory(), pair.getSecond()); return new Pair<String,ClientService.Client>(pair.getFirst(), client); public static void close(ClientService.Client client) {
Immediately return this expression instead of assigning it to the temporary variable "client".
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum {
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
import org.apache.accumulo.core.security.thrift.SecurityErrorCode; import org.apache.accumulo.core.security.thrift.ThriftSecurityException; import org.apache.accumulo.core.security.tokens.AuthenticationToken;
1 duplicated blocks of code must be removed.
import org.apache.accumulo.core.client.BatchWriterConfig; public BatchWriterImpl(Instance instance, AuthInfo credentials, String table, BatchWriterConfig config) { this.bw = new TabletServerBatchWriter(instance, credentials, config);
Remove this unused method parameter "e".
c.securityOperations().createLocalUser("greg", new PasswordToken(new byte[0]));
Remove the redundant '!unknownSymbol!' thrown exception declaration(s).
if (!fs.exists(logfile)) logout = fs.create(logfile);
Remove this call to "exit" or ensure it is really required.
if (rand.nextDouble() < .5) table = indexTableName; else table = dataTableName;
Remove this call to "exit" or ensure it is really required.
import org.apache.accumulo.cloudtrace.instrument.Tracer;
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. */ package org.apache.accumulo.core.client.lexicoder; public class UIntegerLexicoderTest extends LexicoderTest { public void testEncoding() { UIntegerLexicoder uil = new UIntegerLexicoder(); assertEqualsB(uil.encode(0), new byte[] {0x00}); assertEqualsB(uil.encode(0x01), new byte[] {0x01, 0x01}); assertEqualsB(uil.encode(0x0102), new byte[] {0x02, 0x01, 0x02}); assertEqualsB(uil.encode(0x010203), new byte[] {0x03, 0x01, 0x02, 0x03}); assertEqualsB(uil.encode(0x01020304), new byte[] {0x04, 0x01, 0x02, 0x03, 0x04}); assertEqualsB(uil.encode(0xff020304), new byte[] {0x05, 0x02, 0x03, 0x04}); assertEqualsB(uil.encode(0xffff0304), new byte[] {0x06, 0x03, 0x04}); assertEqualsB(uil.encode(0xffffff04), new byte[] {0x07, 0x04}); assertEqualsB(uil.encode(-1), new byte[] {0x08}); } }
Rename this generic name to match the regular expression '^[A-Z]$'.
//folder.delete();
This block of commented-out lines of code should be removed.
import org.apache.accumulo.core.cli.ClientOnRequiredTable; import com.beust.jcommander.Parameter; static class Opts extends ClientOnRequiredTable { @Parameter(names="--start-row") int startRow = 0; @Parameter(names="--count", required=true, description="number of rows to verify") int numRows = 0; } Opts opts = new Opts(); opts.parseArgs(VerifyIngest.class.getName(), args); Connector connector = opts.getConnector(); Scanner scanner = connector.createScanner(opts.tableName, opts.auths); scanner.setRange(new Range(new Text(String.format("row_%08d", opts.startRow)), null)); for (int i = opts.startRow; i < opts.numRows; i++) {
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 com.beust.jcommander.Parameter; static class Opts extends org.apache.accumulo.core.cli.Help { @Parameter(names="--configDir", required=true, description="directory containing the test configuration") String configDir; @Parameter(names="--logDir", required=true, description="location of the local logging directory") String localLogPath; @Parameter(names="--logId", required=true, description="a unique log identifier (like a hostname, or pid)") String logId; @Parameter(names="--module", required=true, description="the name of the module to run") String module; } Opts opts = new Opts(); opts.parseArgs(Framework.class.getName(), args); FileInputStream fis = new FileInputStream(opts.configDir + "/randomwalk.conf"); System.setProperty("localLog", opts.localLogPath + "/" + opts.logId); System.setProperty("nfsLog", props.getProperty("NFS_LOGPATH") + "/" + opts.logId); DOMConfigurator.configure(opts.configDir + "logger.xml"); int retval = getInstance().run(opts.module, state, configDir);
Remove this call to "exit" or ensure it is really required.
@Deprecated TRACE_PRINCIPAL("trace.principal", "root", PropertyType.STRING, "The principal to store distributed traces"), @Deprecated TRACE_LOGIN_PROPERTIES("trace.login", null, PropertyType.PREFIX, "The login credentials prefix for the principal used to store distributed traces"),
Immediately return this expression instead of assigning it to the temporary variable "scanner".
import org.apache.hadoop.io.Text; public void testVisibilityFollowingKey() { Key k = new Key("r", "f", "q", "v"); assertEquals(k.followingKey(PartialKey.ROW_COLFAM_COLQUAL_COLVIS).toString(), "r f:q [v%00;] " + Long.MAX_VALUE + " false"); }
Move the array designator from the variable to the type.
diskUsages.add(new DiskUsage(new TreeSet<String>(tables), 0l));
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */
Replace all tab characters in this file by sequences of white-spaces.
public void initialize(String instanceId, boolean initialize) {
Remove this call to "exit" or ensure it is really required.
import org.apache.accumulo.core.client.security.tokens.PasswordToken;
Move this constructor to comply with Java Code Conventions.
private final Object lock = new Object();
Move this variable to comply with Java Code Conventions.
public void updateAndFlush(UserPass userpass, String tableName, Map<ByteBuffer,List<PColumnUpdate>> cells) addCellsToWriter(cells, writer); private void addCellsToWriter(Map<ByteBuffer,List<PColumnUpdate>> cells, BatchWriter writer) for (Entry<ByteBuffer,List<PColumnUpdate>> entry : cells.entrySet()) { Mutation m = new Mutation(ByteBufferUtil.toBytes(entry.getKey())); for (PColumnUpdate update : entry.getValue()) { ColumnVisibility viz = EMPTY_VIS; if (update.isSetColVisibility()) { Text vizText = new Text(update.getColVisibility()); viz = vizMap.get(vizText); if (viz == null) { vizMap.put(vizText, viz = new ColumnVisibility(vizText)); byte[] value = new byte[0]; if (update.isSetValue()) value = update.getValue(); if (update.isSetTimestamp()) { if (update.isSetDeleteCell()) { m.putDelete(update.getColFamily(), update.getColQualifier(), viz, update.getTimestamp()); } else { if (update.isSetDeleteCell()) { m.putDelete(update.getColFamily(), update.getColQualifier(), viz, update.getTimestamp()); } else { m.put(update.getColFamily(), update.getColQualifier(), viz, update.getTimestamp(), value); } else { m.put(update.getColFamily(), update.getColQualifier(), viz, value); writer.addMutation(m); public void writer_update(String writer, Map<ByteBuffer,List<PColumnUpdate>> cells) throws TException { addCellsToWriter(cells, batchwriter);
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.
writer = FileOperations.getInstance().openWriter(ingestArgs.outputFile + "." + RFile.EXTENSION, fs, conf,
Either log or rethrow this exception.
/** * A filter that ages off key/value pairs based on the Key's timestamp. It removes an entry if its timestamp is less than currentTime - threshold. * * This filter requires a "ttl" option, in milliseconds, to determine the age off threshold. */ /** * Constructs a filter that omits entries read from a source iterator if the Key's timestamp is less than currentTime - threshold. * * @param iterator * The source iterator. * * @param threshold * Maximum age in milliseconds of data to keep. * * @param threshold * Current time in milliseconds. */ /** * Accepts entries whose timestamps are less than currentTime - threshold. * * @see org.apache.accumulo.core.iterators.Filter#accept(org.apache.accumulo.core.data.Key, org.apache.accumulo.core.data.Value) */
1 duplicated blocks of code must be removed.
private Option profileOpt; addScanIterators(shellState, cl, scanner, tableName); protected void addScanIterators(final Shell shellState, CommandLine cl, final Scanner scanner, final String tableName) { List<IteratorSetting> tableScanIterators; if (cl.hasOption(profileOpt.getOpt())) { String profile = cl.getOptionValue(profileOpt.getOpt()); tableScanIterators = shellState.iteratorProfiles.get(profile); if (tableScanIterators == null) { throw new IllegalArgumentException("Profile " + profile + " does not exist"); } } else { tableScanIterators = shellState.scanIteratorOptions.get(shellState.getTableName()); if (tableScanIterators == null) { Shell.log.debug("Found no scan iterators to set"); return; } profileOpt = new Option("pn", "profile", true, "iterator profile name"); profileOpt.setArgName("profile"); o.addOption(profileOpt);
Remove the redundant '!unknownSymbol!' thrown exception declaration(s).
@Override public void visit(State state, Properties props) throws Exception { String indexTableName = (String) state.get("indexTableName"); Collection<Text> splits = state.getConnector().tableOperations().getSplits(indexTableName); SortedSet<Text> splitSet = new TreeSet<Text>(splits); log.debug("merging " + indexTableName); state.getConnector().tableOperations().merge(indexTableName, null, null); org.apache.accumulo.core.util.Merge merge = new org.apache.accumulo.core.util.Merge(); merge.mergomatic(state.getConnector(), indexTableName, null, null, 256 * 1024 * 1024, true); splits = state.getConnector().tableOperations().getSplits(indexTableName); if (splits.size() > splitSet.size()) { // throw an excpetion so that test will die an no further changes to table will occur... // this way table is left as is for debugging. throw new Exception("There are more tablets after a merge: " + splits.size() + " was " + splitSet.size()); }
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
import java.util.Map.Entry; import org.apache.accumulo.core.client.security.SecurityErrorCode;
Do not forget to remove this deprecated code someday.
public void testXML() { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder docbuilder; SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); Schema moduleSchema = null; try { moduleSchema = sf.newSchema(new File(this.getClass().getClassLoader().getResource("randomwalk/module.xsd").toURI())); } catch (Exception e) { e.printStackTrace(); dbf.setSchema(moduleSchema); try { File f = new File(this.getClass().getClassLoader().getResource("randomwalk/Basic.xml").toURI()); docbuilder = dbf.newDocumentBuilder(); docbuilder.parse(f); } catch (Exception e) { e.printStackTrace(); } public void testRWTest() { Test t1 = new CreateTable(); assertTrue(t1.toString().equals("org.apache.accumulo.server.test.randomwalk.unit.CreateTable")); Test t2 = new CreateTable(); assertTrue(t1.equals(t2)); } public void testModule() { // don't run test if accumulo home is not set String acuHome = System.getenv("ACCUMULO_HOME"); if (acuHome == null) return; String confDir = acuHome + "/test/system/randomwalk/conf/"; Framework.setConfigDir(confDir); try { Module module = new Module(new File(confDir + "modules/unit/Basic.xml")); module.visit(new State(new Properties()), new Properties()); } catch (Exception e) { e.printStackTrace(); } public void testFramework() { // don't run test if accumulo home is not set String acuHome = System.getenv("ACCUMULO_HOME"); if (acuHome == null) return; Framework framework = Framework.getInstance(); String confDir = acuHome + "/test/system/randomwalk/conf/"; framework.run("unit/Basic.xml", new State(new Properties()), confDir); }
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
Iterator<E> source; E top; public PeekingIterator(Iterator<E> source) { this.source = source; if (source.hasNext()) top = source.next(); else top = null; } public E peek() { return top; } public E next() { E lastPeeked = top; if (source.hasNext()) top = source.next(); else top = null; return lastPeeked; } public void remove() { throw new UnsupportedOperationException(); } @Override public boolean hasNext() { return top != null; }
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
import java.util.ArrayList; * @deprecated since 1.5, see {@link #getAuthorizationFailuresMap()} List<KeyExtent> getAuthorizationFailures() { return new ArrayList<KeyExtent>(af.keySet()); } /** * * @return the internal mapping of keyextent mappings to SecurityErrorCode */ public Map<KeyExtent,Set<SecurityErrorCode>> getAuthorizationFailuresMap() {
Remove the literal "false" boolean value.
org.apache.accumulo.core.data.thrift.TColumn _elem108; // optional org.apache.accumulo.core.data.thrift.IterInfo _elem111; // optional ByteBuffer _elem122; // optional org.apache.accumulo.core.data.thrift.TColumn _elem135; // optional org.apache.accumulo.core.data.thrift.IterInfo _elem138; // optional ByteBuffer _elem149; // optional org.apache.accumulo.core.data.thrift.TRange _elem156; // optional org.apache.accumulo.core.data.thrift.TColumn _elem159; // optional org.apache.accumulo.core.data.thrift.IterInfo _elem162; // optional ByteBuffer _elem173; // optional org.apache.accumulo.core.data.thrift.TRange _elem194; // optional org.apache.accumulo.core.data.thrift.TColumn _elem197; // optional org.apache.accumulo.core.data.thrift.IterInfo _elem200; // optional ByteBuffer _elem211; // optional org.apache.accumulo.core.data.thrift.TMutation _elem214; // optional org.apache.accumulo.core.data.thrift.TMutation _elem219; // optional org.apache.accumulo.core.data.thrift.TKeyExtent _elem242; // optional org.apache.accumulo.core.data.thrift.TKeyExtent _elem247; // optional TabletStats _elem250; // optional TabletStats _elem255; // optional ActiveScan _elem258; // optional ActiveScan _elem263; // optional ActiveCompaction _elem266; // optional ActiveCompaction _elem271; // optional String _elem274; // optional String _elem279; // optional
277 duplicated blocks of code must be removed.
import org.apache.accumulo.core.Constants; byte[] bytes = output.getBytes(Constants.UTF8); byte[] len = String.format("%6s#", Integer.toString(bytes.length, 36)).getBytes(Constants.UTF8); String strLen = new String(len, Constants.UTF8); String strFields = new String(bytes, Constants.UTF8);
Move this variable to comply with Java Code Conventions.
return "sleeps for the given number of seconds";
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. */ // DO NOT CHANGE ORDER OF ENUMS, ORDER IS USED IN SERIALIZATION
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
import java.nio.charset.Charset; private static final Charset utf8 = Charset.forName("UTF8"); return new Value(Long.toString(max).getBytes(utf8));
Move this variable to comply with Java Code Conventions.
write("bt1", 1, 0, 1000000000, 1000); write("bt2", 2, 0, 1000000000, 1000); write("bt3", 3, 0, 1000000000, 1000); for (String table : new String[]{"bt1", "bt2", "bt3"}) { getConnector().tableOperations().setProperty(table, Property.TABLE_INDEXCACHE_ENABLED.getKey(), "false"); getConnector().tableOperations().setProperty(table, Property.TABLE_BLOCKCACHE_ENABLED.getKey(), "false"); getConnector().tableOperations().flush(table, null, null, true); getConnector().tableOperations().compact(table, null, null, false, true); } // ensure compactions are finished long t1 = query("bt1", 1, 0, 1000000000, 100000, 1000); long t2 = query("bt2", 2, 0, 1000000000, 100000, 1000); long t3 = query("bt3", 3, 0, 1000000000, 100000, 1000); getConnector().tableOperations().compact("bt1", null, null, false, true); getConnector().tableOperations().compact("bt2", null, null, false, true); getConnector().tableOperations().compact("bt3", null, null, false, true); getConnector().tableOperations().compact("bt4", null, null, false, true); long tb1 = query("bt1", 1, 0, 1000000000, 100000, 1000); long tb2 = query("bt2", 2, 0, 1000000000, 100000, 1000); long tb3 = query("bt3", 3, 0, 1000000000, 100000, 1000); throw new Exception("Queries had less than 10% improvement (old: " + t1 + " new: " + t2 + " improvement: " + ((t1 - t2) * 100. / t1) + "%)");
Define and throw a dedicated exception instead of using a generic one.
MetadataTableUtil.getMetadataTable(SystemCredentials.get()).update(delMut);
Immediately return this expression instead of assigning it to the temporary variable "onlineTabletsForTable".
import org.apache.accumulo.core.client.security.tokens.PasswordToken;
1 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. */ /** * Autogenerated by Thrift * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING */ package org.apache.accumulo.proxy.thrift; import java.util.Map; import java.util.HashMap; import org.apache.thrift.TEnum; @SuppressWarnings("all") public enum IteratorScope implements org.apache.thrift.TEnum { MINC(0), MAJC(1), SCAN(2); private final int value; private IteratorScope(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 IteratorScope findByValue(int value) { switch (value) { case 0: return MINC; case 1: return MAJC; case 2: return SCAN; default: return null; } } }
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
* } while(itr.hasNext()) { } * * * * * * * * * * * * * * *
Replace all tab characters in this file by sequences of white-spaces.
/** * Prevent the instantiation of class. */ private CompareUtils() { // nothing } /** * A comparator to compare anything that implements {@link RawComparable} using a customized comparator. */ public static final class BytesComparator implements Comparator<RawComparable> { private RawComparator<Object> cmp; public BytesComparator(RawComparator<Object> cmp) { this.cmp = cmp; @Override public int compare(RawComparable o1, RawComparable o2) { return compare(o1.buffer(), o1.offset(), o1.size(), o2.buffer(), o2.offset(), o2.size()); public int compare(byte[] a, int off1, int len1, byte[] b, int off2, int len2) { return cmp.compare(a, off1, len1, b, off2, len2); } /** * Interface for all objects that has a single integer magnitude. */ static interface Scalar { long magnitude(); } static final class ScalarLong implements Scalar { private long magnitude; public ScalarLong(long m) { magnitude = m; public long magnitude() { return magnitude; } } public static final class ScalarComparator implements Comparator<Scalar> { @Override public int compare(Scalar o1, Scalar o2) { long diff = o1.magnitude() - o2.magnitude(); if (diff < 0) return -1; if (diff > 0) return 1; return 0; } } public static final class MemcmpRawComparator implements RawComparator<Object> { @Override public int compare(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2) { return WritableComparator.compareBytes(b1, s1, l1, b2, s2, l2); @Override public int compare(Object o1, Object o2) { throw new RuntimeException("Object comparison not supported"); }
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
import org.apache.accumulo.core.cli.ScannerOpts; ScannerOpts scanOpts = new ScannerOpts(); opts.parseArgs(ContinuousScanner.class.getName(), args, scanOpts); scanner.setBatchSize(scanOpts.scanBatchSize);
Remove this unused method parameter "opts".
/* * 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.fate.zookeeper.ZooCache;
Remove this call to "exit" or ensure it is really required.
return "merges tablets in a table";
2 duplicated blocks of code must be removed.
import org.apache.accumulo.core.security.thrift.Credential; private static Credential credentials;
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
import org.apache.accumulo.core.client.impl.thrift.SecurityErrorCode;
1 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. */ private static final long serialVersionUID = 1L; private static String getTableName(Instance instance, String tableId) { if (tableId == null) return " <unknown table> "; try { } public TableOfflineException(Instance instance, String tableId) { super("Table " + getTableName(instance, tableId) + " is offline"); }
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. */ public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException { public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks) throws InterruptedException { public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) throws InterruptedException { public <T> T invokeAny(Collection<? extends Callable<T>> tasks) throws InterruptedException, ExecutionException { return impl.invokeAny(wrapCollection(tasks)); public <T> T invokeAny(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException {
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
import org.apache.accumulo.core.security.tokens.UserPassToken; Connector c = mockInstance.getConnector(new UserPassToken("root", ""));
Immediately return this expression instead of assigning it to the temporary variable "ret".
public static void setOutputInfo(Configuration conf, String user, byte[] passwd, boolean createTables, String defaultTable) { try { FileSystem fs = FileSystem.get(conf); Path file = new Path(fs.getWorkingDirectory(), conf.get("mapred.job.name") + System.currentTimeMillis() + ".pw"); conf.set(PASSWORD_PATH, file.toString()); FSDataOutputStream fos = fs.create(file, false); fs.setPermission(file, new FsPermission(FsAction.ALL, FsAction.NONE, FsAction.NONE)); fs.deleteOnExit(file); byte[] encodedPw = Base64.encodeBase64(passwd); fos.writeInt(encodedPw.length); fos.write(encodedPw); fos.close(); DistributedCache.addCacheFile(file.toUri(), conf); } catch (IOException ioe) { throw new RuntimeException(ioe); }
Define and throw a dedicated exception instead of using a generic one.
for (int threads: new int[]{1, 2, 16, /* 64, 256*/} ) {
1 duplicated blocks of code must be removed.
port, TCompactProtocol.Factory.class, prop);
This block of commented-out lines of code should be removed.
MockTable(boolean limitVersion, TimeType timeType) { settings = IteratorUtil.generateInitialTableProperties(limitVersion);
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. */
296 duplicated blocks of code must be removed.
package org.apache.accumulo.start.classloader.vfs.providers;
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.
tl = new RootTabletLocator(instance, new ZookeeperLockChecker(instance)); tl = new TabletLocatorImpl(new Text(MetadataTable.ID), getLocator(instance, new Text(RootTable.ID)), mlo, new ZookeeperLockChecker(instance)); tl = new TabletLocatorImpl(tableId, getLocator(instance, new Text(MetadataTable.ID)), mlo, new ZookeeperLockChecker(instance)); public final String tablet_session; public TabletLocation(KeyExtent tablet_extent, String tablet_location, String session) { ArgumentChecker.notNull(tablet_extent, tablet_location, session); this.tablet_session = dedupeLocation(session); return tablet_extent.equals(otl.tablet_extent) && tablet_location.equals(otl.tablet_location) && tablet_session.equals(otl.tablet_session); return "(" + tablet_extent + "," + tablet_location + "," + tablet_session + ")"; if (result == 0) { if (result == 0) result = tablet_session.compareTo(o.tablet_session); } private String tserverSession; public TabletServerMutations(String tserverSession) { this.tserverSession = tserverSession; this.mutations = new HashMap<KeyExtent,List<T>>(); final String getSession() { return tserverSession; }
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
bs.close();
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 org.apache.accumulo.start.classloader.vfs.MiniDFSUtil; conf.set("dfs.datanode.data.dir.perm", MiniDFSUtil.computeDatanodeDirectoryPermission());
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 org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException;
1 duplicated blocks of code must be removed.
public static final Value DELETE_ROW_VALUE = new Value("DEL_ROW".getBytes());
Remove this unused private "appendProp" method.
import org.apache.commons.cli.OptionGroup; OptionGroup nameGroup = new OptionGroup(); allOpt = new Option("a", "all", false, "delete all scan iterators"); nameGroup.addOption(nameOpt); nameGroup.addOption(allOpt); nameGroup.setRequired(true); o.addOptionGroup(nameGroup);
Replace all tab characters in this file by sequences of white-spaces.
import org.apache.accumulo.core.Constants; return new String(Base64.encodeBase64(asByteArray(cred)), Constants.UTF8); return fromByteArray(Base64.decodeBase64(string.getBytes(Constants.UTF8))); return new String(Base64.encodeBase64(toBytes(token)), Constants.UTF8);
Move this variable to comply with Java Code Conventions.
result.rowMatcher = copyMatcher(rowMatcher); result.colfMatcher = copyMatcher(colfMatcher); result.colqMatcher = copyMatcher(colqMatcher); result.valueMatcher = copyMatcher(valueMatcher); private Matcher copyMatcher(Matcher m) { if(m == null) return m; else return m.pattern().matcher(""); }
Rename this constant name to match the regular expression '^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$'.
for (Entry<String,String> option : setting.getOptions().entrySet()) {
Refactor this code to not nest more than 3 if/for/while/switch/try statements.
package org.apache.accumulo.examples.simple.client;
Rename "table" which hides the field declared at line 107.
import org.apache.accumulo.core.client.impl.thrift.SecurityErrorCode; import org.apache.accumulo.core.client.security.tokens.AuthenticationToken;
Move this constructor to comply with Java Code Conventions.
VerifyIngest.verifyIngest(c, opts, SOPTS);
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
package org.apache.accumulo.core.data; public class ArrayByteSequence extends ByteSequence { protected byte data[]; protected int offset; protected int length; public ArrayByteSequence(byte data[]){ this.data = data; this.offset = 0; this.length = data.length; } public ArrayByteSequence(byte data[], int offset, int length) { if(offset < 0 || offset > data.length || length < 0 || (offset+length) > data.length){ throw new IllegalArgumentException(" Bad offset and/or length data.length = "+data.length+" offset = "+offset+" length = "+length); } this.data = data; this.offset = offset; this.length = length; } public ArrayByteSequence(String s) { this(s.getBytes()); } @Override public byte byteAt(int i) { if(i < 0){ throw new IllegalArgumentException("i < 0, "+i); } if(i >= length){ throw new IllegalArgumentException("i >= length, "+i+" >= "+length); } return data[offset + i]; } @Override public byte[] getBackingArray() { return data; } @Override public boolean isBackedByArray() { return true; } @Override public int length() { return length; } @Override public int offset() { return offset; } @Override public ByteSequence subSequence(int start, int end) { if(start > end || start < 0 || end > length){ throw new IllegalArgumentException("Bad start and/end start = "+start+" end="+end+" offset="+offset+" length="+length); } return new ArrayByteSequence(data, offset+start, end - start); } @Override public byte[] toArray() { if(offset == 0 && length == data.length) return data; byte[] copy = new byte[length]; System.arraycopy(data, offset, copy, 0, length); return copy; } public String toString(){ return new String(data, offset, length); } }
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.
public int execute(final String fullCommand, final CommandLine cl, final Shell shellState) throws IOException { if (cl.hasOption(verboseOption.getOpt())) { } final Options opts = new Options();
Remove the redundant '!unknownSymbol!' thrown exception declaration(s).
@Deprecated
Remove this unused method parameter "ex".
package org.apache.accumulo.examples.simple.filedata;
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.
static class EmptyMapFileException extends Exception { private static final long serialVersionUID = 1L; public EmptyMapFileException() { super(); } } try { tids[i] = findLastStartToFinish(reader, i, extent, tabletFiles, lastStartToFinish); } catch (EmptyMapFileException ex) { log.info("Ignoring empty map file " + logfile); tids[i] = -1; } int findLastStartToFinish(MultiReader reader, int fileno, KeyExtent extent, Set<String> tabletFiles, LastStartToFinish lastStartToFinish) throws IOException, EmptyMapFileException { throw new EmptyMapFileException();
Remove this unused private "appendProp" method.
import org.apache.accumulo.core.conf.AccumuloConfiguration; ServerConfiguration conf = new ServerConfiguration(instance); checkTable(conf.getConfiguration(), user, passw, table, null, cl.hasOption(verboseOption.getOpt())); private static void checkTable(final AccumuloConfiguration conf, final String user, final String pass, String table, HashSet<KeyExtent> check, boolean verbose) throws AccumuloException, checkTabletServer(conf, user, ByteBuffer.wrap(pass.getBytes()), entry, failures); checkTable(conf, user, pass, table, failures, verbose); private static void checkTabletServer(AccumuloConfiguration conf, final String user, final ByteBuffer pass, Entry<String,List<KeyExtent>> entry, HashSet<KeyExtent> failures) TabletClientService.Iface client = ThriftUtil.getTServerClient(entry.getKey(), conf);
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
MONITOR_SSL_KEYSTORE("monitor.ssl.keyStore", "", PropertyType.PATH, "The keystore for enabling monitor SSL."), MONITOR_SSL_KEYSTOREPASS("monitor.ssl.keyStorePassword", "", PropertyType.STRING, "The keystore password for enabling monitor SSL."), MONITOR_SSL_TRUSTSTORE("monitor.ssl.trustStore", "", PropertyType.PATH, "The truststore for enabling monitor SSL."), MONITOR_SSL_TRUSTSTOREPASS("monitor.ssl.trustStorePassword", "", PropertyType.STRING, "The truststore password for enabling monitor SSL."), Property.TSERV_SCAN_MAX_OPENFILES, Property.TSERV_LOGGER_COUNT, Property.LOGGER_PORT, Property.MASTER_CLIENTPORT, Property.GC_PORT);
Add the "@Override" annotation above this method signature
byte[] passwd = conf.get(Property.TRACE_PASSWORD).getBytes();
Remove this unused method parameter "ex".
import org.apache.accumulo.core.cli.BatchWriterOpts; BatchWriterOpts bwOpts = new BatchWriterOpts(); opts.parseArgs(InterferenceTest.class.getName(), args, bwOpts); Thread writer = new Thread(new Writer(conn.createBatchWriter(opts.tableName, bwOpts.getBatchWriterConfig()), opts.iterations));
Remove this unused method parameter "opts".
getConnector().securityOperations().changeUserAuthorizations(getToken().getPrincipal(), new Authorizations(nbas(userAuths))); getConnector().securityOperations().changeUserAuthorizations(getToken().getPrincipal(), new Authorizations("BASE", "DEFLABEL"));
Return empty string instead.
import org.apache.accumulo.server.data.ServerMutation; Mutation mutation = new ServerMutation(tmutation); Mutation mutation = new ServerMutation(tmutation);
Remove this unused method parameter "timestamp".
/* * 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.
IteratorSetting is = new IteratorSetting(10, "String Summation", SummingCombiner.class); Combiner.setColumns(is, Collections.singletonList(new IteratorSetting.Column("day"))); SummingCombiner.setEncodingType(is, SummingCombiner.Type.STRING);
Remove the literal "true" boolean value.
* Autogenerated by Thrift Compiler (0.9.0) import org.apache.thrift.protocol.TProtocolException; import org.apache.thrift.EncodingUtils; import org.apache.thrift.TException; private byte __isset_bitfield = 0; __isset_bitfield = other.__isset_bitfield; __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __NUMENTRIES_ISSET_ID); return EncodingUtils.testBit(__isset_bitfield, __NUMENTRIES_ISSET_ID); __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __NUMENTRIES_ISSET_ID, value); __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __INGESTRATE_ISSET_ID); return EncodingUtils.testBit(__isset_bitfield, __INGESTRATE_ISSET_ID); __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __INGESTRATE_ISSET_ID, value); __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __QUERYRATE_ISSET_ID); return EncodingUtils.testBit(__isset_bitfield, __QUERYRATE_ISSET_ID); __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __QUERYRATE_ISSET_ID, value); __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __SPLITCREATIONTIME_ISSET_ID); return EncodingUtils.testBit(__isset_bitfield, __SPLITCREATIONTIME_ISSET_ID); __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __SPLITCREATIONTIME_ISSET_ID, value); // check for sub-struct validity if (extent != null) { extent.validate(); } if (major != null) { major.validate(); } if (minor != null) { minor.validate(); } if (split != null) { split.validate(); } __isset_bitfield = 0;
Rename this class name to match the regular expression '^[A-Z][a-zA-Z0-9]*$'.
if (auth != null) zooKeeper.addAuthInfo("digest", auth.getBytes()); } else UtilWaitThread.sleep(TIME_BETWEEN_CONNECT_CHECKS_MS); if (tryAgain && zooKeeper != null) try { zooKeeper.close(); zooKeeper = null; } catch (InterruptedException e) { log.warn("interrupted", e); } if (sleepTime < 10000) sleepTime = (int) (sleepTime + sleepTime * Math.random()); if (auth != null && sessions.get(readOnlySessionKey) == zsi) sessions.remove(readOnlySessionKey); if (auth != null && !sessions.containsKey(readOnlySessionKey)) sessions.put(readOnlySessionKey, zsi);
Remove this call to "exit" or ensure it is really required.
if (sizes.size() > 1) mergeMany(conn, table, sizes, goalSize, force, true); if (sizes.get(0).size < goalSize) break;
Remove this call to "exit" or ensure it is really required.
this(s.getBytes());
Remove this unused private "appendProp" method.
import org.apache.accumulo.core.security.thrift.Credential; public static List<String> bulkLoad(AccumuloConfiguration conf, Instance instance, Credential creds, long tid, String tableId, List<String> files, private Credential credentials; public BulkImporter(AccumuloConfiguration conf, Instance instance, Credential credentials, long tid, String tableId, boolean setTime) { private Map<Path,List<KeyExtent>> assignMapFiles(AccumuloConfiguration acuConf, Instance instance, Configuration conf, Credential credentials, FileSystem fs, Credential credentials; public AssignmentTask(Credential credentials, Map<Path,List<KeyExtent>> assignmentFailures, String tableName, String location, private Map<Path,List<KeyExtent>> assignMapFiles(Credential credentials, String tableName, Map<Path,List<AssignmentInfo>> assignments, private List<KeyExtent> assignMapFiles(Credential credentials, String location, Map<KeyExtent,List<PathSize>> assignmentsPerTablet) throws AccumuloException,
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
* @deprecated since 1.4 (will become CreateRandomRFile)
Either log or rethrow this exception.
verboseOption = new Option("v", "verbose", false, "display command prompt as commands are executed");
2 duplicated blocks of code must be removed.
import java.util.SortedSet; import java.util.TreeSet; import org.apache.accumulo.core.client.Connector; import org.junit.Test; public class BulkFileIT extends MacTest { @Test(timeout=30*1000) public void testBulkFile() throws Exception { Connector c = getConnector(); c.tableOperations().create("bulkFile"); SortedSet<Text> splits = new TreeSet<Text>(); for (String split : "0333 0666 0999 1333 1666".split(" ")) splits.add(new Text(split)); c.tableOperations().addSplits("bulkFile", splits); FunctionalTestUtils.bulkImport(c, fs, "bulkFile", dir); FunctionalTestUtils.checkRFiles(c, "bulkFile", 6, 6, 1, 1);
Use "Long.toString" instead.
/** * Autogenerated by Thrift * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING */ package org.apache.accumulo.core.master.thrift; import java.util.Map; import java.util.HashMap; import org.apache.thrift.TEnum; public enum MasterGoalState implements org.apache.thrift.TEnum { CLEAN_STOP(0), SAFE_MODE(1), NORMAL(2); private final int value; private MasterGoalState(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 MasterGoalState findByValue(int value) { switch (value) { case 0: return CLEAN_STOP; case 1: return SAFE_MODE; case 2: return NORMAL; default: return null; } } }
Return empty string instead.
import org.apache.accumulo.core.security.tokens.AccumuloToken; import org.apache.accumulo.core.security.tokens.InstanceTokenWrapper; import org.apache.accumulo.core.security.tokens.UserPassToken; /** * @deprecated since 1.5, use {@link #getConnector(AccumuloToken)} */ return getConnector(new UserPassToken(user, pass)); /** * @deprecated since 1.5, use {@link #getConnector(AccumuloToken)} */ return getConnector(new UserPassToken(user, pass)); /** * @deprecated since 1.5, use {@link #getConnector(AccumuloToken)} */ /** * @deprecated since 1.5, use {@link #getConnector(AccumuloToken)} */ return getConnector(UserPassToken.convertAuthInfo(auth)); } @SuppressWarnings("deprecation") public Connector getConnector(AccumuloToken<?,?> token) throws AccumuloException, AccumuloSecurityException { return new ConnectorImpl(this, token); } @Override public Connector getConnector(InstanceTokenWrapper token) throws AccumuloException, AccumuloSecurityException { return getConnector(token.getToken());
Immediately return this expression instead of assigning it to the temporary variable "ret".
public class ZooUtil extends org.apache.accumulo.fate.zookeeper.ZooUtil {
Remove this call to "exit" or ensure it is really required.
public long isReady(long tid, Master master) throws Exception { if (!master.hasCycled(creationTime)) { Scanner scanner = master.getConnector().createScanner(Constants.METADATA_TABLE_NAME, Constants.NO_AUTHS); MetaDataTableScanner.configureScanner(scanner, master); TabletState state = locationState.getState(master.onlineTabletServers()); public Repo<Master> call(long tid, Master master) throws Exception { master.clearMigrations(tableId); Connector conn = master.getConnector(); Tables.clearCache(master.getInstance());
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.