Diff
stringlengths
10
2k
Message
stringlengths
28
159
package org.apache.accumulo.examples.wikisearch.iterator; import org.apache.accumulo.examples.wikisearch.parser.JexlOperatorConstants;
Rename "table" which hides the field declared at line 107.
if (!range.getStartKey().equals(range.getEndKey(), PartialKey.ROW)) { } else if (!range.getStartKey().equals(range.getEndKey(), PartialKey.ROW_COLFAM)) { } else if (!range.getStartKey().equals(range.getEndKey(), PartialKey.ROW_COLFAM_COLQUAL)) {
Replace all tab characters in this file by sequences of white-spaces.
import org.apache.accumulo.core.util.FastFormat;
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
public void merge(Text start, Text end) { boolean reAdd = false; if (splits.contains(start)) reAdd = true; splits.removeAll(splits.subSet(start, end)); if (reAdd) splits.add(start); }
1 duplicated blocks of code must be removed.
// we just made a lot of changes to the !METADATA table: flush them out try { AuthInfo creds = SecurityConstants.getSystemCredentials(); Connector connector = instance.getConnector(creds.getUser(), creds.getPassword()); connector.tableOperations().compact(Constants.METADATA_TABLE_NAME, null, null, true, true); } catch (Exception e) { log.warn(e, e); }
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
import java.util.ArrayList; public static Pair<SortedMap<KeyExtent,Text>,List<KeyExtent>> getMetadataLocationEntries(SortedMap<Key,Value> entries) { ArrayList<KeyExtent> locationless = new ArrayList<KeyExtent>(); if (prevRow != null) { if (location != null) results.put(ke, location); else locationless.add(ke); return new Pair<SortedMap<KeyExtent,Text>,List<KeyExtent>>(results, locationless);
Remove the redundant '!unknownSymbol!' thrown exception declaration(s).
import java.nio.charset.Charset; private static final Charset utf8 = Charset.forName("UTF8"); return new Value(Long.toString(min).getBytes(utf8));
Move this variable to comply with Java Code Conventions.
import org.apache.accumulo.core.security.Authorizations; Scanner scanner = master.getConnector().createScanner(Constants.METADATA_TABLE_NAME, Authorizations.EMPTY); BatchScanner bs = conn.createBatchScanner(Constants.METADATA_TABLE_NAME, Authorizations.EMPTY, 8);
Remove this unused method parameter "range".
@Test(timeout=15*1000)
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
Collection<Text> splits = getConnector().tableOperations().listSplits("bss"); splits = getConnector().tableOperations().listSplits("bss"); splits = getConnector().tableOperations().listSplits("bss");
Remove the redundant '!unknownSymbol!' thrown exception declaration(s).
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */
Replace all tab characters in this file by sequences of white-spaces.
public class BadIteratorMincIT extends SimpleMacIT { String tableName = makeTableName(); c.tableOperations().create(tableName); c.tableOperations().attachIterator(tableName, is, EnumSet.of(IteratorScope.minc)); BatchWriter bw = c.createBatchWriter(tableName, new BatchWriterConfig()); m.put(new Text("acf"), new Text(tableName), new Value("1".getBytes())); c.tableOperations().flush(tableName, null, null, false); FunctionalTestUtils.checkRFiles(c, tableName, 1, 1, 0, 0); Scanner scanner = c.createScanner(tableName, Authorizations.EMPTY); c.tableOperations().removeIterator(tableName, BadIterator.class.getSimpleName(), EnumSet.of(IteratorScope.minc)); FunctionalTestUtils.checkRFiles(c, tableName, 1, 1, 1, 1); c.tableOperations().attachIterator(tableName, is, EnumSet.of(IteratorScope.minc)); bw = c.createBatchWriter(tableName, new BatchWriterConfig()); m.put(new Text("acf"), new Text(tableName), new Value("1".getBytes())); c.tableOperations().flush(tableName, null, null, false); c.tableOperations().delete(tableName);
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
import jline.console.ConsoleReader; shell = new Shell(new ConsoleReader(new FileInputStream(FileDescriptor.in), output));
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
* Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** private static final long serialVersionUID = 1L;
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
import static org.junit.Assert.fail; import org.apache.accumulo.core.iterators.DebugIterator; @Test public void testIteratorConflict() { ScannerOptions options = new ScannerOptions(); options.addScanIterator(new IteratorSetting(1, "NAME", DebugIterator.class)); try { options.addScanIterator(new IteratorSetting(2, "NAME", DebugIterator.class)); fail(); } catch (IllegalArgumentException e) {} try { options.addScanIterator(new IteratorSetting(1, "NAME2", DebugIterator.class)); fail(); } catch (IllegalArgumentException e) {} }
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. */ @XmlElement private String id = null; @XmlElement private List<Field> field = new ArrayList<Field>(); public Document() { super(); } public Document(String id, List<Field> fields) { super(); this.id = id; this.field = fields; } public String getId() { return id; } public List<Field> getFields() { return field; } public void setId(String id) { this.id = id; } public void setFields(List<Field> fields) { this.field = fields; }
Immediately return this expression instead of assigning it to the temporary variable "r".
import org.apache.accumulo.cloudtrace.instrument.TraceRunnable;
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
import org.apache.accumulo.server.zookeeper.IZooReaderWriter; IZooReaderWriter zoo = ZooReaderWriter.getRetryingInstance(); IZooReaderWriter zoo = ZooReaderWriter.getRetryingInstance(); ZooReaderWriter.getRetryingInstance().putPersistentData(ZKUserPath + "/" + user + ZKUserTablePerms + "/" + table, Tool.convertTablePermissions(perms), ZooReaderWriter.getRetryingInstance().recursiveDelete(ZKUserPath + "/" + user, NodeMissingPolicy.FAIL); ZooReaderWriter.getRetryingInstance().putPrivatePersistentData(ZKUserPath + "/" + user, Tool.createPass(pass), NodeExistsPolicy.OVERWRITE); ZooReaderWriter.getRetryingInstance().putPersistentData(ZKUserPath + "/" + user + ZKUserAuths, Tool.convertAuthorizations(authorizations), ZooReaderWriter.getRetryingInstance().putPersistentData(ZKUserPath + "/" + user + ZKUserSysPerms, Tool.convertSystemPermissions(perms), ZooReaderWriter.getRetryingInstance().putPersistentData(ZKUserPath + "/" + user + ZKUserTablePerms + "/" + table, Tool.convertTablePermissions(tablePerms), ZooReaderWriter.getRetryingInstance().putPersistentData(ZKUserPath + "/" + user + ZKUserSysPerms, Tool.convertSystemPermissions(sysPerms), IZooReaderWriter zoo = ZooReaderWriter.getRetryingInstance(); IZooReaderWriter zoo = ZooReaderWriter.getRetryingInstance();
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
conn.tableOperations().offline(tableName, rand.nextBoolean()); conn.tableOperations().online(tableName, rand.nextBoolean());
Cast one of the operands of this multiplication operation to a "long".
/** * public interface InstanceOperations { public void setProperty(final String property, final String value) throws AccumuloException, AccumuloSecurityException; public void removeProperty(final String property) throws AccumuloException, AccumuloSecurityException; public Map<String,String> getSystemConfiguration() throws AccumuloException, AccumuloSecurityException; public Map<String,String> getSiteConfiguration() throws AccumuloException, AccumuloSecurityException; public List<String> getTabletServers(); public List<ActiveScan> getActiveScans(String tserver) throws AccumuloException, AccumuloSecurityException; public boolean testClassLoad(final String className, final String asTypeName) throws AccumuloException, AccumuloSecurityException;
Either log or rethrow this exception.
if (orFields) return matches(rowMatcher, key.getRowData()) || matches(colfMatcher, key.getColumnFamilyData()) || matches(colqMatcher, key.getColumnQualifierData()) || matches(valueMatcher, value.get(), 0, value.get().length); if (options.containsKey(ROW_REGEX)) Pattern.compile(options.get(ROW_REGEX)).matcher(""); if (options.containsKey(COLF_REGEX)) Pattern.compile(options.get(COLF_REGEX)).matcher(""); if (options.containsKey(COLQ_REGEX)) Pattern.compile(options.get(COLQ_REGEX)).matcher(""); if (options.containsKey(VALUE_REGEX)) Pattern.compile(options.get(VALUE_REGEX)).matcher("");
Remove this call to "exit" or ensure it is really required.
package org.apache.accumulo.wikisearch.iterator; import org.apache.accumulo.wikisearch.util.FieldIndexKeyParser;
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.
// Locked tablets put themselves in the run queue, so we can't lock them //synchronized (Tablet.this) { //}
This block of commented-out lines of code should be removed.
@Override @Deprecated
Remove this unused private "appendProp" method.
security.authenticateUser(credentials, credentials); @SuppressWarnings({"rawtypes", "unchecked"}) @Override public boolean checkTableClass(TInfo tinfo, TCredentials credentials, String tableName, String className, String interfaceMatch) throws TException, ThriftTableOperationException, ThriftSecurityException { security.authenticateUser(credentials, credentials); String tableId = checkTableId(tableName, null); ClassLoader loader = getClass().getClassLoader(); Class shouldMatch; try { shouldMatch = loader.loadClass(interfaceMatch); new ServerConfiguration(instance).getTableConfiguration(tableId); String context = new ServerConfiguration(instance).getTableConfiguration(tableId).get(Property.TABLE_CLASSPATH); ClassLoader currentLoader; if (context != null && !context.equals("")) { currentLoader = AccumuloVFSClassLoader.getContextManager().getClassLoader(context); } else { currentLoader = AccumuloVFSClassLoader.getClassLoader(); } Class test = currentLoader.loadClass(className).asSubclass(shouldMatch); test.newInstance(); return true; } catch (Exception e) { log.warn("Error checking object types", e); return false; } }
Either log or rethrow this exception.
List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(tableName.getBytes()), ByteBuffer.wrap(timeType.name().getBytes())); List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(tableName.getBytes()), start == null ? EMPTY : TextUtil.getByteBuffer(start), end == null ? EMPTY List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(tableName.getBytes()), start == null ? EMPTY : TextUtil.getByteBuffer(start), end == null ? EMPTY List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(tableName.getBytes())); List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(srcTableId.getBytes()), ByteBuffer.wrap(newTableName.getBytes())); List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(oldTableName.getBytes()), ByteBuffer.wrap(newTableName.getBytes())); List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(tableId.getBytes()), start == null ? EMPTY : TextUtil.getByteBuffer(start), end == null ? EMPTY List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(tableName.getBytes()), ByteBuffer.wrap(dir.getBytes()), ByteBuffer.wrap(failureDir.getBytes()), ByteBuffer.wrap((setTime + "").getBytes())); List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(tableName.getBytes())); List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(tableName.getBytes())); List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(tableName.getBytes()), ByteBuffer.wrap(importDir.getBytes())); List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(tableName.getBytes()), ByteBuffer.wrap(exportDir.getBytes()));
Remove this unused private "appendProp" method.
import org.apache.accumulo.core.security.thrift.AuthInfo; import org.apache.accumulo.core.security.thrift.Credential; import org.apache.accumulo.core.security.thrift.tokens.SecurityToken; public Connector getConnector(Credential auth) throws AccumuloException, AccumuloSecurityException { public Connector getConnector(AuthInfo auth) throws AccumuloException, AccumuloSecurityException { return getConnector(auth.user, auth.getPassword()); } @Override @Override public Connector getConnector(String principal, SecurityToken token) throws AccumuloException, AccumuloSecurityException { throw new UnsupportedOperationException(); }
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
import org.apache.accumulo.server.security.SystemCredentials; SetGoalState.main(new String[] {MasterGoalState.NORMAL.name()}); Process exec = Runtime.getRuntime().exec(new String[] {System.getenv().get("ACCUMULO_HOME") + "/bin/start-all.sh"}); MasterMonitorInfo masterStats = client.getMasterStats(Tracer.traceInfo(), SystemCredentials.get().getAsThrift());
Move this constructor to comply with Java Code Conventions.
protected ZooKeeper getSession(String keepers, int timeout, String scheme, byte[] auth) { return ZooSession.getSession(keepers, timeout, scheme, auth); return getSession(keepers, timeout, null, null);
Move this constructor to comply with Java Code Conventions.
import org.apache.accumulo.core.security.thrift.SecurityErrorCode;
1 duplicated blocks of code must be removed.
import java.io.IOException; import org.apache.accumulo.core.client.AccumuloException; import org.apache.accumulo.core.client.AccumuloSecurityException; import org.apache.accumulo.core.client.TableNotFoundException; private Option tableOpt, deleteOpt, setOpt, filterOpt, disablePaginationOpt; public int execute(String fullCommand, CommandLine cl, Shell shellState) throws AccumuloException, AccumuloSecurityException, TableNotFoundException, IOException, ClassNotFoundException { String tableName = cl.getOptionValue(tableOpt.getOpt()); if (tableName != null && !shellState.getConnector().tableOperations().exists(tableName)) throw new TableNotFoundException(null, tableName, null); tableOpt = new Option(Shell.tableOption, "table", true, "table to display/set/delete properties for"); tableOpt.setArgName("table"); o.addOption(tableOpt);
Remove the redundant '!unknownSymbol!' thrown exception declaration(s).
import org.apache.accumulo.server.cli.ClientOnDefaultTable; import org.apache.accumulo.core.cli.BatchWriterOpts; import com.beust.jcommander.Parameter; static class Opts extends ClientOnDefaultTable { @Parameter(names="--count", description="number of mutations to write", required=true) long count; Opts(String table) { super(table); } } public static void main(String[] args) throws Exception { Opts opts = new Opts(table_name); BatchWriterOpts bwOpts = new BatchWriterOpts(); opts.parseArgs(RandomWriter.class.getName(), args, bwOpts); log.info("starting at " + start + " for user " + opts.user); Connector connector = opts.getConnector(); BatchWriter bw = connector.createBatchWriter(opts.getTableName(), bwOpts.getBatchWriterConfig()); log.info("Writing " + opts.count + " mutations..."); bw.addMutations(new RandomMutationGenerator(opts.count)); } catch (Exception e) {
Remove this unused private "appendProp" method.
package org.apache.accumulo.server.monitor.util; import java.util.ArrayList; import java.util.Comparator; public class TableRow { private int size; private ArrayList<Object> row; TableRow(int size) { this.size = size; this.row = new ArrayList<Object>(size); } public boolean add(Object obj) { if (row.size() == size) throw new IllegalStateException("Row is full."); return row.add(obj); } Object get(int index) { return row.get(index); } int size() { return row.size(); } Object set(int i, Object value) { return row.set(i, value); } public static <T> Comparator<TableRow> getComparator(int index, Comparator<T> comp) { return new TableRowComparator<T>(index, comp); } private static class TableRowComparator<T> implements Comparator<TableRow> { private int index; private Comparator<T> comp; public TableRowComparator(int index, Comparator<T> comp) { this.index = index; this.comp = comp; } @SuppressWarnings("unchecked") @Override public int compare(TableRow o1, TableRow o2) { return comp.compare((T) o1.get(index), (T) o2.get(index)); } } }
Return empty string instead.
import java.nio.charset.Charset; private static final Charset utf8 = Charset.forName("UTF8"); zoo.putPersistentData(path + "/" + server, cause.getBytes(utf8), NodeExistsPolicy.SKIP);
Move this variable to comply with Java Code Conventions.
import org.apache.accumulo.core.iterators.user.LargeRowFilter;
Remove this unused private "match" method.
private String prefix; private static final Logger log = Logger.getLogger(DebugIterator.class); public DebugIterator() {} public DebugIterator deepCopy(IteratorEnvironment env) { return new DebugIterator(this, env); } private DebugIterator(DebugIterator other, IteratorEnvironment env) { setSource(other.getSource().deepCopy(env)); prefix = other.prefix; } public DebugIterator(String prefix, SortedKeyValueIterator<Key,Value> source) { this.prefix = prefix; this.setSource(source); } @Override public Key getTopKey() { Key wc = super.getTopKey(); log.debug(prefix + " getTopKey() --> " + wc); return wc; } @Override public Value getTopValue() { Value w = super.getTopValue(); log.debug(prefix + " getTopValue() --> " + w); return w; } @Override public boolean hasTop() { boolean b = super.hasTop(); log.debug(prefix + " hasTop() --> " + b); return b; } @Override public void seek(Range range, Collection<ByteSequence> columnFamilies, boolean inclusive) throws IOException { log.debug(prefix + " seek(" + range + ", " + columnFamilies + ", " + inclusive + ")"); super.seek(range, columnFamilies, inclusive); } @Override public void init(SortedKeyValueIterator<Key,Value> source, Map<String,String> options, IteratorEnvironment env) throws IOException { super.init(source, options, env); }
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
Scanner scanner = connector.createScanner(opts.getTableName(), labelAuths);
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
import org.apache.accumulo.core.cli.BatchWriterOpts; import org.apache.accumulo.core.cli.ScannerOpts; private static void readBack(Connector conn, Opts opts, ScannerOpts scanOpts) throws Exception { scanner.setBatchSize(scanOpts.scanBatchSize); BatchWriterOpts bwOpts = new BatchWriterOpts(); ScannerOpts scanOpts = new ScannerOpts(); opts.parseArgs(program, args, bwOpts, scanOpts); BatchWriter b = connector.createBatchWriter(opts.getTableName(), bwOpts.getBatchWriterConfig()); readBack(connector, opts, scanOpts);
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.
* 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 byte[] data; public ComparableBytes(byte[] b) { this.data = b; } public byte[] getBytes() { return data; } @Override public int getLength() { return data.length; }
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
Connector conn = WalkingSecurity.get(state).getSystemConnector(); String tableUserName = WalkingSecurity.get(state).getTabUserName(); boolean exists = WalkingSecurity.get(state).userExists(tableUserName); boolean hasPermission = WalkingSecurity.get(state).canDropUser(WalkingSecurity.get(state).getSysAuthInfo(), tableUserName); WalkingSecurity.get(state).dropUser(tableUserName); WalkingSecurity.get(state).dropUser(tableUserName);
Reduce this switch case number of lines from 44 to at most 5, for example by extracting code into methods.
package function; import org.apache.commons.lang.math.NumberUtils; import org.apache.log4j.Logger; public class QueryFunctions { protected static Logger log = Logger.getLogger(QueryFunctions.class); public static boolean between (String fieldValue, double left, double right) { try { Double value = Double.parseDouble(fieldValue); if (value >= left && value <= right) return true; return false; } catch (NumberFormatException nfe) { return false; } } public static boolean between (String fieldValue, long left, long right) { try { Long value = Long.parseLong(fieldValue); if (value >= left && value <= right) return true; return false; } catch (NumberFormatException nfe) { return false; } } public static Number abs (String fieldValue) { Number retval = null; try { Number value = NumberUtils.createNumber(fieldValue); if (null == value) retval = (Number) Integer.MIN_VALUE; else if (value instanceof Long) retval = Math.abs(value.longValue()); else if (value instanceof Double) retval = Math.abs(value.doubleValue()); else if (value instanceof Float) retval = Math.abs(value.floatValue()); else if (value instanceof Integer) retval = Math.abs(value.intValue()); } catch (NumberFormatException nfe) { return (Number) Integer.MIN_VALUE; } return retval; } }
Return empty string instead.
private Map<Text,TableCounts> last = new HashMap<Text,TableCounts>(); private Map<Text,TableCounts> next; private long startScan = 0; private long endScan = 0; public synchronized void begin() { next = new HashMap<Text,TableCounts>(); startScan = System.currentTimeMillis(); } public synchronized void update(Text tableId, TabletState state) { TableCounts counts = next.get(tableId); if (counts == null) { counts = new TableCounts(); next.put(tableId, counts); counts.counts[state.ordinal()]++; } public synchronized void end() { last = next; next = null; endScan = System.currentTimeMillis(); } public synchronized Map<Text,TableCounts> getLast() { return last; } public synchronized TableCounts getLast(Text tableId) { TableCounts result = last.get(tableId); if (result == null) return new TableCounts(); return result; } public synchronized long getScanTime() { if (endScan <= startScan) return System.currentTimeMillis() - startScan; return endScan - startScan; } public synchronized long lastScanFinished() { return endScan; }
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
private final List<SourceSwitchingIterator> copies;
Remove this unused private "appendProp" method.
import java.util.TreeSet; import org.apache.accumulo.core.client.BatchWriterConfig; BatchWriter bw = getConnector().createBatchWriter(table, new BatchWriterConfig());
Remove this unused method parameter "e".
package org.apache.accumulo.test.continuous;
Move the "org.apache.accumulo.test.randomwalk.unit.CreateTable" string literal on the left side of this string comparison.
/** * 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.start.classloader.vfs; import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileSystemException; import org.apache.commons.vfs2.FileSystemManager; import org.apache.commons.vfs2.impl.VFSClassLoader; /** * */ public class PostDelegatingVFSClassLoader extends VFSClassLoader { /** * @param files * @param manager * @param parent * @throws FileSystemException */ public PostDelegatingVFSClassLoader(FileObject[] files, FileSystemManager manager, ClassLoader parent) throws FileSystemException { super(files, manager, parent); } protected synchronized Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException { Class<?> c = findLoadedClass(name); if (c == null) { try { // try finding this class here instead of parent c = findClass(name); } catch (ClassNotFoundException e) { } } return super.loadClass(name, resolve); } }
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. */ @SuppressWarnings("all") public enum TableOperation implements org.apache.thrift.TEnum {
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.
private class IdleFileCloser implements Runnable {
Either log or rethrow this exception.
import org.apache.accumulo.fate.zookeeper.DistributedReadWriteLock; import org.apache.accumulo.fate.zookeeper.IZooReaderWriter; import org.apache.accumulo.fate.zookeeper.ZooReaderWriter.Mutator; import org.apache.accumulo.fate.zookeeper.ZooReservation;
Remove this call to "exit" or ensure it is really required.
import org.apache.accumulo.core.security.Credentials; private Credentials credentials; public TabletServerBatchReader(Instance instance, Credentials credentials, String table, Authorizations authorizations, int numQueryThreads) {
Immediately return this expression instead of assigning it to the temporary variable "onlineTabletsForTable".
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */
Replace all tab characters in this file by sequences of white-spaces.
static class TestOutputStream extends OutputStream { assertBadExit("", true); assertBadExit(expectString, stringPresent); shell.setLogErrorsToConsole(); void assertBadExit(String s, boolean stringPresent) { if (s.length() > 0) assertEquals(s + " present in " + output.get() + " was not " + stringPresent, stringPresent, output.get().contains(s)); exec("about arg", false, "java.lang.IllegalArgumentException: Expected 0 arguments"); exec("addsplits arg", false, "java.lang.IllegalStateException: Not in a table context"); exec("insert r f q v", false, "java.lang.IllegalStateException: Not in a table context"); exec("delete r f q", false, "java.lang.IllegalStateException: Not in a table context");
Either log or rethrow this exception.
import org.apache.accumulo.core.client.AccumuloSecurityException; } catch (AccumuloSecurityException e) { log.warn("Error generating system credentials");
Either log or rethrow this exception.
* @deprecated @since 1.5, use {@link #authenticateUser(AccumuloToken)} /** * Verify an AccumuloToken is valid * * @param token * the AccumuloToken to authenticate * @return true if the user asking is allowed to know and the specified user/password is valid, false otherwise * @throws AccumuloException * if a general error occurs * @throws AccumuloSecurityException * if the user does not have permission to ask * @since 1.5 */ public boolean authenticateUser(AccumuloToken<?,?> token) throws AccumuloException, AccumuloSecurityException;
Return empty string instead.
@Test(timeout = 4 * 60 * 1000) for (int test = 0; test < 10; test++) {
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. */ @Override public boolean accept(Key k, Value v) { ColumnVisibility label = new ColumnVisibility(k.getColumnVisibility()); return label.getExpression().length > 0; } @Override public void init(Map<String,String> options) { // No Options to set } @Override public IteratorOptions describeOptions() { return new IteratorOptions("nolabel", "NoLabelFilter hides entries without a visibility label", null, null); } @Override public boolean validateOptions(Map<String,String> options) { return true; }
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
@Override @Override @Override return getTableId().toString().equals(MetadataTable.ID) || isRootTablet(); return getTableId().toString().equals(RootTable.ID);
Reduce this switch case number of lines from 12 to at most 5, for example by extracting code into methods.
public int execute(final String fullCommand, final CommandLine cl, final Shell shellState) throws AccumuloException, AccumuloSecurityException, TableNotFoundException, final Mutation m = new Mutation(new Text(cl.getArgs()[0].getBytes(Shell.CHARSET))); final Text colf = new Text(cl.getArgs()[1].getBytes(Shell.CHARSET)); final Text colq = new Text(cl.getArgs()[2].getBytes(Shell.CHARSET)); final Value val = new Value(cl.getArgs()[3].getBytes(Shell.CHARSET)); final ColumnVisibility le = new ColumnVisibility(cl.getOptionValue(insertOptAuths.getOpt())); final BatchWriter bw = shellState.getConnector().createBatchWriter(shellState.getTableName(), m.estimatedMemoryUsed() + 0L, 0L, 1); final ArrayList<String> lines = new ArrayList<String>(); if (e.getAuthorizationFailures().isEmpty() == false) { } if (e.getConstraintViolationSummaries().isEmpty() == false) { } final Options o = new Options();
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
public List<KeyExtent> getAuthorizationFailures() {
Do not forget to remove this deprecated code someday.
import org.apache.accumulo.core.iterators.SortedKeyValueIterator;
2 duplicated blocks of code must be removed.
Assert.assertTrue((acl instanceof VFSClassLoader)); Assert.assertTrue((acl instanceof VFSClassLoader));
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
package org.apache.accumulo.test.randomwalk.image; import org.apache.accumulo.test.randomwalk.State; import org.apache.accumulo.test.randomwalk.Test;
Move the "org.apache.accumulo.test.randomwalk.unit.CreateTable" string literal on the left side of this string comparison.
/* * 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.
accumulo = new MiniAccumuloCluster(folder.getRoot(), "superSecret");
Move this constructor to comply with Java Code Conventions.
import org.apache.accumulo.core.security.tokens.UserPassToken; conn = inst.getConnector(new UserPassToken("user", "pass"));
Either log or rethrow this exception.
import org.apache.accumulo.fate.zookeeper.DistributedReadWriteLock; public class ZooQueueLock extends org.apache.accumulo.fate.zookeeper.ZooQueueLock { super(ZooReaderWriter.getRetryingInstance(), path, ephemeral);
Remove this call to "exit" or ensure it is really required.
org.apache.thrift.protocol.TMap _map96 = iprot.readMapBegin(); struct.properties = new HashMap<String,String>(2*_map96.size); for (int _i97 = 0; _i97 < _map96.size; ++_i97) String _key98; // required String _val99; // required _key98 = iprot.readString(); _val99 = iprot.readString(); struct.properties.put(_key98, _val99); for (Map.Entry<String, String> _iter100 : struct.properties.entrySet()) oprot.writeString(_iter100.getKey()); oprot.writeString(_iter100.getValue()); for (Map.Entry<String, String> _iter101 : struct.properties.entrySet()) oprot.writeString(_iter101.getKey()); oprot.writeString(_iter101.getValue()); org.apache.thrift.protocol.TMap _map102 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32()); struct.properties = new HashMap<String,String>(2*_map102.size); for (int _i103 = 0; _i103 < _map102.size; ++_i103) String _key104; // required String _val105; // required _key104 = iprot.readString(); _val105 = iprot.readString(); struct.properties.put(_key104, _val105);
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. */ MockAccumulo acu = null; Map<String,MockBatchWriter> bws = null; public MockMultiTableBatchWriter(MockAccumulo acu) { this.acu = acu; bws = new HashMap<String,MockBatchWriter>(); } @Override public BatchWriter getBatchWriter(String table) throws AccumuloException, AccumuloSecurityException, TableNotFoundException { if (!bws.containsKey(table)) { bws.put(table, new MockBatchWriter(acu, table)); } return bws.get(table); } @Override public void flush() throws MutationsRejectedException {} @Override public void close() throws MutationsRejectedException {} @Override public boolean isClosed() { throw new UnsupportedOperationException(); }
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. */
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
package org.apache.accumulo.core.client; import org.apache.accumulo.core.client.impl.Tables; public class TableOfflineException extends RuntimeException { private static final long serialVersionUID = 1L; private static String getTableName(Instance instance, String tableId) { if (tableId == null) return " <unknown table> "; try { String tableName = Tables.getTableName(instance, tableId); return tableName + " (" + tableId + ")"; } catch (TableNotFoundException e) { return " <unknown table> (" + tableId + ")"; } } public TableOfflineException(Instance instance, String tableId) { super("Table "+getTableName(instance, tableId)+" is offline"); } }
Return empty string instead.
import org.apache.accumulo.core.util.shell.Token; tableOpt = new Option(Shell.tableOption, "table", true, "table to revoke a table permission for");
2 duplicated blocks of code must be removed.
import org.apache.accumulo.server.security.SystemCredentials; MetadataTableUtil.moveMetaDeleteMarkers(instance, SystemCredentials.get().getAsThrift()); return instance.getConnector(SystemCredentials.get().getPrincipal(), SystemCredentials.get().getToken()); TCredentials systemAuths = SystemCredentials.get().getAsThrift();
Move this constructor to comply with Java Code Conventions.
* This lexicoder encodes/decodes a given String to/from bytes without further processing. It can be combined with other encoders like the * {@link ReverseLexicoder} to flip the default sort order.
Remove this unused import 'java.util.Date'.
RangeIterator iter = new RangeIterator(MapFileUtil.openMapFile(acuconf, fs, file, conf));
Use "Integer.toString" instead.
public int execute(final String fullCommand, final CommandLine cl, final Shell shellState) throws AccumuloException, AccumuloSecurityException, IOException { final String p = shellState.readMaskedLine("Enter password for user " + user + ": ", '*'); public void registerCompletion(final Token root, final Map<Command.CompletionSet,Set<String>> special) {
Remove the redundant '!unknownSymbol!' thrown exception declaration(s).
if (SecurityHelper.getSysPerm(state, SecurityHelper.getSysUserName(state), SystemPermission.CREATE_TABLE)) hasPermission = true; if (hasPermission) throw new AccumuloException("Got a security exception when I should have had permission.", ae); if (exists) return; else throw new AccumuloException("Test and Accumulo are out of sync"); } else throw new AccumuloException("Got unexpected error", ae); if (!exists) throw new TableExistsException(null, tableName, "Got a TableExistsException but it shouldn't have existed", tee); else return; if (!hasPermission) throw new AccumuloException("Didn't get Security Exception when we should have");
Remove this call to "exit" or ensure it is really required.
import org.apache.accumulo.core.security.thrift.tokens.PasswordToken; MockUser root = new MockUser("root", new PasswordToken().setPassword(new byte[0]), Constants.NO_AUTHS);
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 byte[] getData(String zPath, Stat stat) throws KeeperException, InterruptedException { public Stat getStatus(String zPath) throws KeeperException, InterruptedException { public Stat getStatus(String zPath, Watcher watcher) throws KeeperException, InterruptedException { public List<String> getChildren(String zPath) throws KeeperException, InterruptedException { public List<String> getChildren(String zPath, Watcher watcher) throws KeeperException, InterruptedException { public boolean exists(String zPath) throws KeeperException, InterruptedException { public boolean exists(String zPath, Watcher watcher) throws KeeperException, InterruptedException {
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
import jline.console.completer.Completer; public class ShellCompletor implements Completer {
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
import org.apache.accumulo.core.security.thrift.Credential; public void send(Credential credentials, String serverName, MasterClientService.Iface client) throws TException, ThriftSecurityException {
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
if (instances.containsKey(instanceName)) acu = instances.get(instanceName); else instances.put(instanceName, acu = new MockAccumulo()); if (conf == null) conf = AccumuloConfiguration.getDefaultConfiguration();
Remove this call to "exit" or ensure it is really required.
TableInfo _val3; // required
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
import com.beust.jcommander.IStringConverter; import com.beust.jcommander.Parameter; static public class Opts extends ContinuousQuery.Opts { class RandomAuthsConverter implements IStringConverter<RandomAuths> { @Override public RandomAuths convert(String value) { try { return new RandomAuths(value); } catch (IOException e) { throw new RuntimeException(e); } } } @Parameter(names="--authsFile", description="read the authorities to use from a file") RandomAuths randomAuths = new RandomAuths(); } RandomAuths() { auths = Collections.singletonList(Constants.NO_AUTHS); } try { String line; while ((line = in.readLine()) != null) { auths.add(new Authorizations(line.split(","))); } } finally { in.close(); Opts opts = new Opts(); opts.parseArgs(ContinuousWalk.class.getName(), args); Connector conn = opts.getConnector(); Scanner scanner = conn.createScanner(opts.tableName, opts.randomAuths.getAuths(r)); String row = findAStartRow(opts.min, opts.max, scanner, r); if (opts.sleepTime > 0) Thread.sleep(opts.sleepTime); if (opts.sleepTime > 0) Thread.sleep(opts.sleepTime);
Remove this call to "exit" or ensure it is really required.
package org.apache.accumulo.test.randomwalk.bulk; import org.apache.accumulo.test.randomwalk.State; import org.apache.accumulo.test.randomwalk.Test;
Move the "org.apache.accumulo.test.randomwalk.unit.CreateTable" string literal on the left side of this string comparison.
import org.apache.accumulo.core.util.MetadataTable; tablePerms.put(MetadataTable.ID, Collections.singleton(TablePermission.ALTER_TABLE));
Use "Long.toString" instead.
@Deprecated
Remove this unused method parameter "ex".
MetadataLocationObtainer(Instance instance) { public TabletLocations lookupTablet(TabletLocation src, Text row, Text stopRow, TabletLocator parent, TCredentials credentials) throws AccumuloSecurityException, public List<TabletLocation> lookupTablets(String tserver, Map<KeyExtent,List<Range>> tabletsRanges, TabletLocator parent, TCredentials credentials) throws AccumuloSecurityException,
Remove the redundant '!unknownSymbol!' thrown exception declaration(s).
final List<String> scans = new ArrayList<String>(); final String tserver = tsIter.next(); final List<ActiveScan> asl = instanceOps.getActiveScans(tserver); for (ActiveScan as : asl) { } if (scans.size() > 0) { } final String header = String.format(" %-21s| %-21s| %-9s| %-9s| %-7s| %-6s| %-8s| %-8s| %-10s| %-10s| %-10s | %s", "TABLET SERVER", "CLIENT", "AGE", "LAST", final String next = scansIter.next();
Remove the redundant '!unknownSymbol!' thrown exception declaration(s).
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;
Introduce a new variable instead of reusing the parameter "range".
getConnector().tableOperations().removeConstraint("ct", 1);
Either log or rethrow this exception.
log.info(String.format("%6.2f lookups/sec %6.2f secs%n", num / ((t2 - t1) / 1000.0), ((t2 - t1) / 1000.0))); log.info(String.format("num results : %,d%n", receiver.count));
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
String tablesDir = instance.getConfiguration().get(Property.INSTANCE_DFS_DIR) + "/tables";
Make the "audit" logger private static final and rename it to comply with the format "LOG(?:GER)?".
package org.apache.accumulo.test;
Move the "org.apache.accumulo.test.randomwalk.unit.CreateTable" string literal on the left side of this string comparison.
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ @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]*$'.
sb.append("\n<body ").append(getBodyAttributes()).append(">\n"); /** * Allow the concrete servlet implementation to provide attributes on the body HTML tag, * such as 'onload', which can be used to call Javascript methods on page load. * By default, nothing is specified. * @return */ protected String getBodyAttributes() { return ""; }
Rename this constant name to match the regular expression '^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$'.
import org.apache.accumulo.core.client.AccumuloException; import org.apache.accumulo.core.client.AccumuloSecurityException; import org.apache.accumulo.core.client.MultiTableBatchWriter; import org.apache.accumulo.core.client.MutationsRejectedException; MultiTableBatchWriter mtbw; try { mtbw = WikipediaConfiguration.getConnector(conf).createMultiTableBatchWriter(10000000, 1000, 10); } catch (AccumuloException e) { throw new RuntimeException(e); } catch (AccumuloSecurityException e) { throw new RuntimeException(e); } mtbw.getBatchWriter(indexTableNameFinal.toString()).addMutation(m); mtbw.getBatchWriter(reverseIndexTableNameFinal.toString()).addMutation(m); mtbw.getBatchWriter(metadataTableNameFinal.toString()).addMutation(m); try { mtbw.close(); } catch (MutationsRejectedException e) { throw new RuntimeException(e); }
Complete the task associated to this TODO comment.
* 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. */ List<String> tableNames = (List<String>) state.get("tables"); if (rand.nextBoolean()) changeSystemPermission(conn, rand, userName); else changeTablePermission(conn, rand, userName, tableName); private void changeTablePermission(Connector conn, Random rand, String userName, String tableName) throws AccumuloException, AccumuloSecurityException { if (conn.securityOperations().hasTablePermission(userName, tableName, p)) perms.add(p); private void changeSystemPermission(Connector conn, Random rand, String userName) throws AccumuloException, AccumuloSecurityException { if (conn.securityOperations().hasSystemPermission(userName, p)) perms.add(p); }
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.