Diff
stringlengths
10
2k
Message
stringlengths
28
159
import org.apache.accumulo.core.security.thrift.ThriftSecurityException; import org.apache.accumulo.server.security.SecurityOperation; import org.apache.accumulo.server.security.SecurityOperationImpl; SecurityOperation security = SecurityOperationImpl.getInstance(); security.grantTablePermission(SecurityConstants.getSystemCredentials(), tableInfo.user, tableInfo.tableId, permission); } catch (ThriftSecurityException e) { throw e; SecurityOperationImpl.getInstance().deleteTable(SecurityConstants.getSystemCredentials(), tableInfo.tableId);
Remove this unused method parameter "ex".
throw new AccumuloException("Got data I should not be capable of seeing: " + k + " table " + tableName); throw new AccumuloException("Was able to read when I shouldn't have had the perm with connection user " + conn.whoami() + " table " + tableName); throw new AccumuloException("Accumulo and test suite out of sync: table " + tableName, tnfe); throw new AccumuloException("Table read permission out of sync with Accumulo: table " + tableName, ae); throw new AccumuloException("Table read permission out of sync with Accumulo: table " + tableName, re.getCause()); throw new AccumuloException("Table didn't exist when it should have: " + tableName); throw new AccumuloException("Table didn't exist when it should have: " + tableName); throw new AccumuloException("Bulk Import failed when it should have worked: " + tableName); throw new AccumuloException("Bulk Import succeeded when it should have failed: " + dir + " table " + tableName);
Move this constructor to comply with Java Code Conventions.
conn.securityOperations().createUser(userName, (userName + "pass").getBytes());
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */
Replace all tab characters in this file by sequences of white-spaces.
import org.apache.accumulo.core.client.security.tokens.PasswordToken; return instance.getConnector("user", new PasswordToken("pass")).tableOperations(); Connector c = instance.getConnector("user", new PasswordToken("pass"));
Rename "connector" which hides the field declared at line 67.
Option startRowOpt = OptUtil.startRowOpt(); startRowOpt.setDescription("begin row (NOT inclusive)"); o.addOption(startRowOpt);
1 duplicated blocks of code must be removed.
shellState.getReader().println(max.toString());
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
/** * A utility for merging visibilities into the form {@code (VIS1)|(VIS2)|...|(VISN)}. Used by the {@link ChunkCombiner}. */
1 duplicated blocks of code must be removed.
fs.mkdirs(new Path(ServerConstants.getDataVersionLocation(), "" + ServerConstants.DATA_VERSION)); String initRootTabFile = ServerConstants.getRootTabletDir() + "/00000_00000."
Make the "audit" logger private static final and rename it to comply with the format "LOG(?:GER)?".
public TimedOutException(String msg) { super(msg); this.timedoutServers = Collections.emptySet(); }
Move this constructor to comply with Java Code Conventions.
public static boolean attempt(IZooReaderWriter zk, String path, String reservationID, String debugInfo) throws KeeperException, InterruptedException { public static void release(IZooReaderWriter zk, String path, String reservationID) throws KeeperException, InterruptedException {
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
import org.apache.accumulo.core.util.ContextFactory; JobContext job = ContextFactory.createJobContext(); JobContext job = ContextFactory.createJobContext(); JobContext job = ContextFactory.createJobContext(); JobContext job = ContextFactory.createJobContext(); JobContext job = ContextFactory.createJobContext(); JobContext job = ContextFactory.createJobContext(); JobContext job = ContextFactory.createJobContext(); TaskAttemptContext tac = ContextFactory.createTaskAttemptContext(job); RecordReader<Key,Value> reader = input.createRecordReader(split, tac); Mapper<Key,Value,Key,Value>.Context context = ContextFactory.createMapContext(mapper, tac, reader, null, split); JobContext job = ContextFactory.createJobContext(); TaskAttemptContext tac = ContextFactory.createTaskAttemptContext(job); Mapper<Key,Value,Key,Value>.Context context = ContextFactory.createMapContext(mapper, tac, rr, null, ris); rr.initialize(ris, tac); mapper.map(rr.getCurrentKey(), rr.getCurrentValue(), (TestMapper.Context) context);
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
import org.apache.accumulo.cloudtrace.instrument.CountSampler; import org.apache.accumulo.cloudtrace.instrument.Sampler; import org.apache.accumulo.cloudtrace.instrument.Span; import org.apache.accumulo.cloudtrace.instrument.Trace; import org.apache.accumulo.cloudtrace.instrument.thrift.TraceWrap; import org.apache.accumulo.cloudtrace.thrift.TInfo;
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
+ (prop.getRawDefaultValue().isEmpty() ? "&nbsp;" : prop.getRawDefaultValue().replaceAll(" ", "&nbsp;")) + "</pre></td>");
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. */
Replace all tab characters in this file by sequences of white-spaces.
try { ((AgeOffFilter) a).validateOptions(EMPTY_OPTS); assertTrue(false); } catch (IllegalArgumentException e) {} try { a.validateOptions(EMPTY_OPTS); assertTrue(false); } catch (IllegalArgumentException e) {}
Remove the literal "false" boolean value.
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */
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 SpanStruct(long traceId, long spanId, long parentId, long start, long stop, String description, Map<String,String> data) { public Map<String,String> data; public long millis() { return stop - start; } public Map<Long,List<SpanStruct>> traces = new HashMap<Long,List<SpanStruct>>(); public void span(long traceId, long spanId, long parentId, long start, long stop, String description, Map<String,String> data) { if (!traces.containsKey(traceId)) traces.put(traceId, new ArrayList<SpanStruct>()); public void flush() {} TestService.Iface client = new TestService.Client(new TBinaryProtocol(clientTransport), new TBinaryProtocol(clientTransport)); String traces[] = {"my test", "checkTrace", "client:checkTrace", "start"};
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
assertTrue(rei.validateOptions(is.getOptions())); assertTrue(rei.validateOptions(is.getOptions())); assertTrue(rei.validateOptions(is.getOptions())); assertTrue(rei.validateOptions(is.getOptions()));
Rename "hasStart" which hides the field declared at line 53.
import java.util.Map.Entry; import org.apache.accumulo.core.client.Scanner; import org.apache.accumulo.core.data.Key; import org.apache.accumulo.core.data.Value; import org.apache.accumulo.core.security.Authorizations; import org.apache.accumulo.core.util.RootTable; import org.apache.accumulo.server.fs.FileRef; Scanner scanner = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY); scanner.setRange(RootTable.KEYSPACE); scanner.fetchColumnFamily(MetadataTable.DATAFILE_COLUMN_FAMILY); for (Entry<Key,Value> entry : scanner) { FileRef ref = new FileRef(master.getFileSystem(), entry.getKey()); bw.addMutation(MetadataTable.createDeleteMutation(MetadataTable.ID, ref.path().toString()));
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 static final String AUTHS = "auths"; private static final String FILTER_INVALID_ONLY = "filterInvalid"; String auths = options.get(AUTHS); Authorizations authObj = auths == null || auths.isEmpty() ? new Authorizations() : new Authorizations(auths.getBytes(Constants.UTF8)); this.ve = new VisibilityEvaluator(authObj); this.cache = new LRUMap(1000); this.tmpVis = new Text(); Boolean b = (Boolean) cache.get(testVis); if (b != null) return b;
This block of commented-out lines of code should be removed.
public List<TKeyExtent> bulkImport(TInfo tinfo, AuthInfo credentials, long tid, Map<TKeyExtent,Map<String,MapFileInfo>> files, boolean setTime) throws ThriftSecurityException { List<TKeyExtent> failures = new ArrayList<TKeyExtent>(); for (Entry<TKeyExtent,Map<String,MapFileInfo>> entry : files.entrySet()) { TKeyExtent tke = entry.getKey(); Map<String,MapFileInfo> fileMap = entry.getValue(); Tablet importTablet = onlineTablets.get(new KeyExtent(tke)); if (importTablet == null) { failures.add(tke); } else { try { importTablet.importMapFiles(tid, fileMap, setTime); } catch (IOException ioe) { log.info("files " + fileMap.keySet() + " not imported to " + new KeyExtent(tke) + ": " + ioe.getMessage()); failures.add(tke); } } } return failures;
Either log or rethrow this exception.
import org.apache.accumulo.core.security.thrift.ThriftSecurityException;
1 duplicated blocks of code must be removed.
import org.apache.accumulo.core.client.security.tokens.PasswordToken;
1 duplicated blocks of code must be removed.
if (tables == null) return null; if (servers == null) return null; if (instance != null && instance.endsWith("]")) instance = instance.substring(0, instance.length() - 1); if (merges == null) return null; if (onlineTables == null || current == null) return; if (!shouldBeOnline) return; if (shouldBeOnline) return; if (onlineTables != null) cfg.addOption(TABLES_OPTION, StringUtil.join(onlineTables, ","));
Remove this call to "exit" or ensure it is really required.
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */
Replace all tab characters in this file by sequences of white-spaces.
import org.apache.accumulo.core.security.thrift.tokens.PasswordToken; AccumuloInputFormat.setConnectorInfo(job, user, new PasswordToken().setPassword(pass.getBytes(Charset.forName("UTF-8"))));
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.
* 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. */ /** * Deliver Span information periodically to a destination. * <li>Send host and service information with the span. * <li>Cache Destination objects by some key that can be extracted from the span. * <li>Can be used to queue spans up for delivery over RPC, or for saving into a file. public abstract class AsyncSpanReceiver<SpanKey,Destination> implements SpanReceiver { private static final Logger log = Logger.getLogger(AsyncSpanReceiver.class); private final Map<SpanKey,Destination> clients = new HashMap<SpanKey,Destination>(); protected abstract SpanKey getSpanKey(Map<String,String> data); public void span(long traceId, long spanId, long parentId, long start, long stop, String description, Map<String,String> data) { if (dest != null) {
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
try { sendSpans(); } catch (Exception ex) { log.warn("Exception sending spans to destination", ex); }
Either log or rethrow this exception.
@Override public void close() throws AccumuloException { // NOOP }
Move this variable to comply with Java Code Conventions.
import org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException;
1 duplicated blocks of code must be removed.
import org.apache.accumulo.core.conf.Property; void wroteNothing() { void errorOccured(Exception e) { wroteNothing(); } if (timeoutTracker.getTimeOut() < instance.getConfiguration().getTimeInMillis(Property.GENERAL_RPC_TIMEOUT)) long totalCommitted = 0; totalCommitted += numCommitted; if (failures.keySet().containsAll(tabMuts.keySet()) && totalCommitted == 0) { // nothing was successfully written timeoutTracker.wroteNothing(); } else { // successfully wrote something to tablet server timeoutTracker.madeProgress(); }
Remove this unused method parameter "e".
* 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. */ FILE_READ, FILE_WRITE, TABLET_LOAD
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
shellState.getConnector().securityOperations().createUser(user, password.getBytes(), authorizations);
Remove this unused method parameter "ex".
import org.apache.accumulo.core.util.RootTable; TabletLocatorImpl.addRange(binnedRanges, rootTabletLocation, RootTable.ROOT_TABLET_EXTENT, range); if (!RootTable.ROOT_TABLET_EXTENT.contains(row)) { return new TabletLocation(RootTable.ROOT_TABLET_EXTENT, location);
Use "Long.toString" instead.
import org.apache.accumulo.cloudtrace.instrument.CountSampler; import org.apache.accumulo.cloudtrace.instrument.Sampler; import org.apache.accumulo.cloudtrace.instrument.Span; import org.apache.accumulo.cloudtrace.instrument.Trace; import org.apache.accumulo.cloudtrace.instrument.thrift.TraceWrap; import org.apache.accumulo.cloudtrace.thrift.TInfo;
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
package org.apache.accumulo.test.randomwalk.concurrent; import java.util.Collection; import java.util.List; import java.util.Properties; import java.util.Random; import org.apache.accumulo.core.client.AccumuloSecurityException; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.TableNotFoundException; import org.apache.accumulo.test.randomwalk.State; import org.apache.accumulo.test.randomwalk.Test; import org.apache.hadoop.io.Text; public class ListSplits extends Test { @Override public void visit(State state, Properties props) throws Exception { Connector conn = state.getConnector(); Random rand = (Random) state.get("rand"); @SuppressWarnings("unchecked") List<String> tableNames = (List<String>) state.get("tables"); String tableName = tableNames.get(rand.nextInt(tableNames.size())); try { Collection<Text> splits = conn.tableOperations().listSplits(tableName); log.debug("Table " + tableName + " had " + splits.size() + " splits"); } catch (TableNotFoundException e) { log.debug("listSplits " + tableName + " failed, doesnt exist"); } catch (AccumuloSecurityException ase) { log.debug("listSplits " + tableName + " failed, " + ase.getMessage()); } } }
Remove the redundant '!unknownSymbol!' thrown exception declaration(s).
private String lastReserved = ""; List<String> txdirs = new ArrayList<String>(zk.getChildren(path)); Collections.sort(txdirs); synchronized (this) { if (txdirs.size() > 0 && txdirs.get(txdirs.size() - 1).compareTo(lastReserved) <= 0) lastReserved = ""; } // this check makes reserve pick up where it left off, so that it cycles through all as it is repeatedly called.... failing to do so can lead to // starvation where fate ops that sort higher and hold a lock are never reserved. if (txdir.compareTo(lastReserved) <= 0) continue; if (!reserved.contains(tid)) { lastReserved = txdir; }
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
* <p> * <p> * <p> * <p> * <p>
1 duplicated blocks of code must be removed.
* @since 1.5.0 * @since 1.5.0 * @since 1.5.0 * @since 1.5.0 * @since 1.5.0 * @since 1.5.0 * @since 1.5.0 * @since 1.5.0 * @since 1.5.0
Move this constructor to comply with Java Code Conventions.
* Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ private static Random rand = new SecureRandom(); @Override public String description() { return "The first rule of Accumulus is: \"You don't talk about Accumulus.\""; } @Override public int execute(String fullCommand, CommandLine cl, Shell shellState) throws Exception { if (rand.nextInt(10) == 0) { shellState.getReader().beep(); shellState.getReader().printNewline(); shellState.getReader().printString("Sortacus lives!\n"); shellState.getReader().printNewline(); } else throw new ShellCommandException(ErrorCode.UNRECOGNIZED_COMMAND, getName()); return 0; } @Override public int numArgs() { return Shell.NO_FIXED_ARG_LENGTH_CHECK; } @Override public String getName() { return "\0\0\0\0"; }
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
if (!(c instanceof HiddenCommand)) output.add(String.format("%-" + i + "s - %s", c.getName(), c.description()));
Remove this call to "exit" or ensure it is really required.
// Configure logging DOMConfigurator.configureAndWatch(auditConfig, 5000); log.info(application + " starting"); String key = entry.getKey(); log.info(key + " = " + (Property.isSensitive(key) ? "<hidden>" : entry.getValue())); DistributedFileSystem dfs = (DistributedFileSystem) fs;
Make the "log" logger private static final and rename it to comply with the format "LOG(?:GER)?".
@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]*$'.
package org.apache.accumulo.examples.wikisearch.query; import org.apache.accumulo.examples.wikisearch.sample.Results;
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
import org.apache.accumulo.core.security.tokens.AccumuloToken; import org.apache.accumulo.core.security.tokens.UserPassToken; private AccumuloToken<?,?> credentials; this.credentials = updateUser(user, pass); Command[] userCommands = {new AddAuthsCommand(), new CreateUserCommand(), new DeleteUserCommand(), new DropUserCommand(), new GetAuthsCommand(), new PasswdCommand(), new SetAuthsCommand(), new UsersCommand()}; authFailed = !connector.securityOperations().authenticateUser(credentials); public AccumuloToken<?,?> updateUser(String user, byte[] pass) throws AccumuloException, AccumuloSecurityException { AccumuloToken<?,?> token; try { String tokenClass = instance.getSecurityTokenClass(); System.out.println(tokenClass); if (tokenClass.equals(UserPassToken.class.getCanonicalName())) { token = new UserPassToken(user, pass); // } else if (tokenClass.equals(KerberosToken.class.getCanonicalName())) { // token = new KerberosToken(user, new String(pass).toCharArray(), "accumulo"); } else throw new RuntimeException("CLI can't handle alternative tokens... yet"); } catch (AccumuloException e) { throw new RuntimeException(e); // } catch (GeneralSecurityException e) { // throw new RuntimeException(e); } connector = instance.getConnector(token); credentials = token; if (!connector.securityOperations().authenticateUser(token)) throw new RuntimeException("Unable to authenticate user " + token.getPrincipal()); return token; } public AccumuloToken<?,?> getCredentials() {
Remove this call to "exit" or ensure it is really required.
import org.apache.accumulo.core.security.tokens.UserPassToken; final boolean valid = shellState.getConnector().securityOperations().authenticateUser(new UserPassToken(user, password));
Either log or rethrow this exception.
* @deprecated since 1.4, replaced by {@link org.apache.accumulo.core.iterators.user.RegExFilter}
Either log or rethrow this exception.
conn = inst.getConnector("user", "pass");
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
@SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum {
300 duplicated blocks of code must be removed.
* Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ public class SystemPropUtil { public static boolean setSystemProperty(String property, String value) throws KeeperException, InterruptedException { Property p = Property.getPropertyByKey(property); if ((p != null && !p.getType().isValidFormat(value)) || !Property.isValidZooPropertyKey(property)) return false; // create the zk node for this property and set it's data to the specified value String zPath = ZooUtil.getRoot(HdfsZooInstance.getInstance()) + Constants.ZCONFIG + "/" + property; ZooReaderWriter.getInstance().putPersistentData(zPath, value.getBytes(), NodeExistsPolicy.OVERWRITE); return true; } public static void removeSystemProperty(String property) throws InterruptedException, KeeperException { String zPath = ZooUtil.getRoot(HdfsZooInstance.getInstance()) + Constants.ZCONFIG + "/" + property; ZooReaderWriter.getInstance().recursiveDelete(zPath, NodeMissingPolicy.FAIL); }
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
if (key != null) assertTrue(key.compareTo(entry.getKey()) < 0); if (c.tableOperations().exists("test")) c.tableOperations().delete("test");
Remove this call to "exit" or ensure it is really required.
import org.apache.accumulo.core.security.thrift.TCredentials; import org.apache.accumulo.core.security.tokens.AuthenticationToken; * @throws AccumuloSecurityException public static void setConnectorInfo(Job job, String principal, AuthenticationToken token) throws AccumuloSecurityException { * @see #setConnectorInfo(Job, String, AuthenticationToken) * @see #setConnectorInfo(Job, String, AuthenticationToken) scanner = new OfflineScanner(instance, new TCredentials(principal, tokenClass, ByteBuffer.wrap(token), instance.getInstanceID()), Tables.getTableId( instance, getInputTableName(attempt)), authorizations); InputConfigurator.setConnectorInfo(CLASS, conf, user, new PasswordToken(passwd));
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
import org.apache.accumulo.core.conf.AccumuloConfiguration; final long maxFrameSize = AccumuloConfiguration.getMemoryInBytes(properties.getProperty("maxFrameSize", "16M")); if (maxFrameSize > Integer.MAX_VALUE) throw new RuntimeException(maxFrameSize + " is larger than MAX_INT"); args.transportFactory(new TFramedTransport.Factory((int)maxFrameSize));
This block of commented-out lines of code should be removed.
import java.util.Arrays; import org.apache.accumulo.server.cli.ClientOpts; import com.beust.jcommander.Parameter; static class Opts extends ClientOpts { @Parameter(names="--old", description="old zookeeper password", password=true, hidden=true) String oldPass; @Parameter(names="--new", description="new zookeeper password", password=true, hidden=true) String newPass; } Opts opts = new Opts(); List<String> argsList = Arrays.asList(args); argsList.add("--old"); argsList.add("--new"); opts.parseArgs(ChangeSecret.class.getName(), argsList.toArray(new String[0])); Instance inst = opts.getInstance(); if (!verifyAccumuloIsDown(inst, opts.oldPass)) String instanceId = rewriteZooKeeperInstance(inst, opts.oldPass, opts.newPass); if (opts.oldPass != null) { deleteInstance(inst, opts.oldPass);
Remove this call to "exit" or ensure it is really required.
@SuppressWarnings("all") public enum TableOperation implements org.apache.thrift.TEnum {
300 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.
* 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. */ /** * @param args */ public static void main(String[] args) throws Exception { String tserverPath = ZooUtil.getRoot(HdfsZooInstance.getInstance()) + Constants.ZTSERVERS; if (args.length == 1 && args[0].equals("-list")) { ZooReaderWriter zoo = ZooReaderWriter.getInstance(); List<String> tabletServers = zoo.getChildren(tserverPath); for (String tabletServer : tabletServers) { byte[] lockData = ZooLock.getLockData(tserverPath + "/" + tabletServer); String holder = null; if (lockData != null) { holder = new String(lockData); } System.out.printf("%32s %16s\n", tabletServer, holder); } } else if (args.length == 2 && args[0].equals("-delete")) { ZooLock.deleteLock(tserverPath + "/" + args[1]); } else { System.out.println("Usage : " + TabletServerLocks.class.getName() + " -list|-delete <tserver lock>"); } }
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 static final Logger log = Logger.getLogger(IndexedDocIteratorTest.class);
Rename the "log" logger to comply with the format "LOG(?:GER)?".
public MockTabletLocator() {} @Override public TabletLocation locateTablet(Text row, boolean skipRow, boolean retry) throws AccumuloException, AccumuloSecurityException, TableNotFoundException { throw new UnsupportedOperationException(); } @Override public void binMutations(List<Mutation> mutations, Map<String,TabletServerMutations> binnedMutations, List<Mutation> failures) throws AccumuloException, AccumuloSecurityException, TableNotFoundException { TabletServerMutations tsm = new TabletServerMutations(); for (Mutation m : mutations) tsm.addMutation(new KeyExtent(), m); binnedMutations.put("", tsm); } @Override public List<Range> binRanges(List<Range> ranges, Map<String,Map<KeyExtent,List<Range>>> binnedRanges) throws AccumuloException, AccumuloSecurityException, TableNotFoundException { binnedRanges.put("", Collections.singletonMap(new KeyExtent(new Text(), null, null), ranges)); return Collections.emptyList(); } @Override public void invalidateCache(KeyExtent failedExtent) {} @Override public void invalidateCache(Collection<KeyExtent> keySet) {} @Override public void invalidateCache() {} @Override public void invalidateCache(String server) {}
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.
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */
Replace all tab characters in this file by sequences of white-spaces.
if (serverSideIteratorList.size() == 0) serverSideIteratorList = new ArrayList<IterInfo>(); if (ii.iterName.equals(si.getName())) throw new RuntimeException("Iterator name is already in use " + si.getName()); if (serverSideIteratorOptions.size() == 0) serverSideIteratorOptions = new HashMap<String,Map<String,String>>(); if (serverSideIteratorOptions.size() == 0) serverSideIteratorOptions = new HashMap<String,Map<String,String>>(); if (regexIterName != null) throw new RuntimeException("regex already setup"); if (regexIterName == null) setupDefaultRegex(); if (regexIterName == null) setupDefaultRegex(); if (regexIterName == null) setupDefaultRegex(); if (regexIterName == null) setupDefaultRegex();
Remove this call to "exit" or ensure it is really required.
if (!entry.getValue()) count++; if (count > 0) log.warn("Did not find " + count + " rows"); if (seed == null) r = new Random(); else r = new Random(Long.parseLong(seed)); if (seed == null) r = new Random(); else r = new Random(Long.parseLong(seed));
Remove this call to "exit" or ensure it is really required.
package org.apache.accumulo.fate;
Remove this call to "exit" or ensure it is really required.
public int execute(final String fullCommand, final CommandLine cl, final Shell shellState) throws AccumuloException, AccumuloSecurityException, IOException { final String user = cl.getOptionValue(userOpt.getOpt(), shellState.getConnector().whoami()); final Options o = new Options();
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.
/* * 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.
* <p> * <p> * <p> * <p> * <p>
3 duplicated blocks of code must be removed.
INVALID_TOKEN(11), AUTHENTICATOR_FAILED(12), AUTHORIZOR_FAILED(13), PERMISSIONHANDLER_FAILED(14), TOKEN_EXPIRED(15); case 12: return AUTHENTICATOR_FAILED; case 13: return AUTHORIZOR_FAILED; case 14: return PERMISSIONHANDLER_FAILED; case 15: return TOKEN_EXPIRED;
Remove this call to "exit" or ensure it is really required.
/** * Retrieves file data based on the SHA1 hash of the file. Used by the {@link org.apache.accumulo.examples.simple.dirlist.Viewer}. See README.dirlist for * instructions. */
Replace this use of System.out or System.err by a logger.
import static org.junit.Assert.assertTrue; import java.util.HashMap; import java.util.Map; import org.apache.accumulo.core.conf.Property; import org.apache.accumulo.core.constraints.DefaultKeySizeConstraint; } catch (AccumuloSecurityException e) {} @Test public void createTable() throws TableExistsException, AccumuloException, AccumuloSecurityException, TableNotFoundException { connector.tableOperations().create("table1"); Iterable<Map.Entry<String,String>> itrProps = connector.tableOperations().getProperties("table1"); Map<String,String> props = propsToMap(itrProps); assertEquals(DefaultKeySizeConstraint.class.getName(), props.get(Property.TABLE_CONSTRAINT_PREFIX.toString() + "1")); connector.tableOperations().delete("table1"); } private Map<String,String> propsToMap(Iterable<Map.Entry<String,String>> props) { Map<String,String> map = new HashMap<String,String>(); for (Map.Entry<String,String> prop : props) { map.put(prop.getKey(), prop.getValue()); } return map; }
Add a default case to this switch.
import org.apache.accumulo.core.security.tokens.UserPassToken; Connector conn = instance.getConnector(new UserPassToken("", ""));
Immediately return this expression instead of assigning it to the temporary variable "ret".
import org.apache.accumulo.core.cli.BatchWriterOpts; import org.apache.accumulo.core.client.Connector; import org.junit.Test; public class FateStarvationIT extends MacTest { @Test(timeout=60*1000) Connector c = getConnector(); c.tableOperations().create("test_ingest"); c.tableOperations().addSplits("test_ingest", TestIngest.getSplitPoints(0, 100000, 50)); TestIngest.Opts opts = new TestIngest.Opts(); opts.random = 89; opts.timestamp = 7; opts.dataSize = 50; opts.rows = 100000; opts.cols = 1; TestIngest.ingest(c, opts, new BatchWriterOpts()); c.tableOperations().flush("test_ingest", null, null, true); c.tableOperations().compact("test_ingest", splits.get(idx1), splits.get(idx2), false, false); c.tableOperations().offline("test_ingest");
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
import org.apache.accumulo.core.metadata.MetadataTable; final TabletLocator locator = TabletLocator.getLocator(instance, new Text(tableId));
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
package org.apache.accumulo.core.client.mapreduce; import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Map.Entry; import org.apache.accumulo.core.client.RowIterator; import org.apache.accumulo.core.data.Key; import org.apache.accumulo.core.data.Value; import org.apache.hadoop.io.Text; import org.apache.hadoop.mapreduce.InputSplit; import org.apache.hadoop.mapreduce.RecordReader; import org.apache.hadoop.mapreduce.TaskAttemptContext; public class AccumuloRowInputFormat extends InputFormatBase<Text, List<Entry<Key, Value>>> { @Override public RecordReader<Text, List<Entry<Key, Value>>> createRecordReader( InputSplit split, TaskAttemptContext context) throws IOException, InterruptedException { return new RecordReaderBase<Text, List<Entry<Key, Value>>>() { RowIterator rowIterator; @Override public void initialize(InputSplit inSplit, TaskAttemptContext attempt) throws IOException { super.initialize(inSplit, attempt); rowIterator = new RowIterator(scannerIterator); currentK = new Text(); currentV = new ArrayList<Entry<Key,Value>>(); } @Override public boolean nextKeyValue() throws IOException, InterruptedException { if (!rowIterator.hasNext()) return false; currentV = rowIterator.next(); numKeysRead += currentV.size(); currentK = new Text(currentV.get(0).getKey().getRow()); currentKey = currentV.get(currentV.size()-1).getKey(); return true; } }; } }
Return empty string instead.
package org.apache.accumulo.test.randomwalk.concurrent; 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.
throw new org.apache.accumulo.core.client.AccumuloSecurityException("", org.apache.accumulo.core.client.impl.thrift.SecurityErrorCode.INVALID_INSTANCEID);
Remove this hard-coded password.
if (tableId == null) throw new TableNotFoundException(tableId, tableName, null); if (Tables.getTableState(instance, tableId) == TableState.OFFLINE) throw new TableOfflineException(instance, tableId);
Remove this call to "exit" or ensure it is really required.
import org.apache.accumulo.core.security.tokens.SecurityToken;
Replace all tab characters in this file by sequences of white-spaces.
// TODO share code w/ tablet - ACCUMULO-1303 // TODO need to close files - ACCUMULO-1303
Make the "log" logger private static final and rename it to comply with the format "LOG(?:GER)?".
tableOpt = new Option(Shell.tableOption, "table", true, "table to grant a table permission for"); tablePatternOpt = new Option("p", "pattern", true, "regex pattern of tables to grant permissions for"); }
Replace all tab characters in this file by sequences of white-spaces.
TimestampFilter.setRange(is, "19990101010011GMT+01:00", "19990101010031GMT+01:00"); a.init(new SortedMapIterator(tm), is.getProperties(), null); a.seek(new Range(), EMPTY_COL_FAMS, false); assertEquals(size(a), 21); TimestampFilter.setRange(is, baseTime + 11000, baseTime + 31000);
Remove the literal "true" boolean value.
import org.apache.accumulo.core.metadata.RootTable; import org.apache.accumulo.core.metadata.schema.MetadataSchema; MetaDataTableScanner rootScanner = new MetaDataTableScanner(instance, SecurityConstants.getSystemCredentials(), MetadataSchema.TabletsSection.getRange()); MetaDataTableScanner metaScanner = new MetaDataTableScanner(instance, SecurityConstants.getSystemCredentials(), MetadataSchema.TabletsSection.getRange()); Iterator<TabletLocationState> scanner = new IteratorChain(rootScanner, metaScanner); if (state != null && state != TabletState.HOSTED && TableManager.getInstance().getTableState(locationState.extent.getTableId().toString()) != TableState.OFFLINE)
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
tableOpt = new Option(Shell.tableOption, "table", true, "table to fetch locality groups from");
Replace all tab characters in this file by sequences of white-spaces.
/** * @param prevExtent */ public boolean isPreviousExtent(KeyExtent prevExtent) { if (prevExtent == null) return getPrevEndRow() == null; if (!prevExtent.getTableId().equals(getTableId())) throw new IllegalArgumentException("Cannot compare accross tables " + prevExtent + " " + this); if (prevExtent.getEndRow() == null) return false; if (getPrevEndRow() == null) return false; return prevExtent.getEndRow().equals(getPrevEndRow()); }
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.
static AtomicLong seekCount = new AtomicLong(0); result.lookups = seekCount.get();
Move this variable to comply with Java Code Conventions.
* Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ @Override protected void setUpIterator(int prio, String name, String term, BatchScanner scanner) throws IOException { if (prio < 0) throw new IllegalArgumentException("Priority < 0 " + prio); IteratorSetting si = new IteratorSetting(prio, name, RegExIterator.class); RegExIterator.setRegexs(si, term, term, term, term, true); scanner.addScanIterator(si); } @Override public String description() { return "searches each row, column family, column qualifier and value, in parallel, on the server side (using a java Matcher, so put .* before and after your term if you're not matching the whole element)"; } @Override public String usage() { return getName() + " <regex>{ <regex>}"; }
Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
import org.apache.accumulo.core.cli.ClientOnRequiredTable; import com.beust.jcommander.Parameter; static class Opts extends ClientOnRequiredTable { @Parameter(names="--input", description="input directory") String inputDirectory; public int run(String[] args) throws Exception { Opts opts = new Opts(); opts.parseArgs(WordCount.class.getName(), args); TextInputFormat.setInputPaths(job, new Path(opts.inputDirectory)); opts.setAccumuloConfigs(job);
Remove this call to "exit" or ensure it is really required.
/** snappy codec **/ public static final String COMPRESSION_SNAPPY = "snappy"; * <li>"snappy" - Snappy compression
Immediately return this expression instead of assigning it to the temporary variable "bos2".
// ----------------------------------------------------- String multiByteText = new String("\u6d67" + "\u6F68" + "\u7067"); String multiByteRegex = new String(".*" + "\u6F68" + ".*"); Key k4 = new Key("boo4".getBytes(), "hoo".getBytes(), "20080203".getBytes(), "".getBytes(), 1l); Value inVal = new Value(multiByteText.getBytes("UTF-8")); tm.put(k4, inVal); is.clearOptions(); RegExFilter.setRegexs(is, null, null, null, multiByteRegex, true); rei.init(new SortedMapIterator(tm), is.getProperties(), new DefaultIteratorEnvironment()); rei.seek(new Range(), EMPTY_COL_FAMS, false); assertTrue(rei.hasTop()); Value outValue = rei.getTopValue(); String outVal = new String(outValue.get(), "UTF-8"); assertTrue(outVal.equals(multiByteText));
Either log or rethrow this exception.
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.accumulo.core.client.lexicoder; public class LongLexicoderTest extends LexicoderTest { public void testSortOrder() { assertSortOrder(new LongLexicoder(), Long.MIN_VALUE, 0xff1234567890abcdl, 0xffff1234567890abl, 0xffffff567890abcdl, 0xffffffff7890abcdl, 0xffffffffff90abcdl, 0xffffffffffffabcdl, 0xffffffffffffffcdl, -1l, 0l, 0x01l, 0x1234l, 0x123456l, 0x12345678l, 0x1234567890l, 0x1234567890abl, 0x1234567890abcdl, 0x1234567890abcdefl, Long.MAX_VALUE); } }
Rename this generic name to match the regular expression '^[A-Z]$'.
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */
Replace all tab characters in this file by sequences of white-spaces.
package org.apache.accumulo.examples.simple.shard;
Rename "table" which hides the field declared at line 107.
import java.util.LinkedHashMap; /** * The OptionDescriber interface allows you to set up iterator properties interactively in the accumulo shell. If your iterator and/or filter must implement * this interface for the interactive part. The alternative would be to manually set configuration options with the config -t tableName property=value. If you * go the manual route, be careful to use the correct structure for the property and to set all the properties required for the iterator. * OptionDescribers will need to implement two methods: describeOptions() which returns an instance of IteratorOptions and validateOptions(Map<String,String> * options) which is intended to throw an exception or return false if the options are not acceptable. /** * IteratorOptions requires the following: * * @param name * is the distinguishing name for the iterator or filter * @param description * is a description of the iterator or filter * @param namedOptions * is a map from specifically named options to their descriptions (null if unused) e.g., the AgeOffFilter requires a parameter called "ttl", so its * namedOptions = Collections.singletonMap("ttl", "time to live (milliseconds)") * @param unnamedOptionDescriptions * is a list of descriptions of additional options that don't have fixed names (null if unused). The descriptions are intended to describe a * category, and the user will provide parameter names and values in that category; e.g., the FilteringIterator needs a list of Filters intended to * be named by their priority numbers, so its unnamedOptionDescriptions = * Collections.singletonList("<filterPriorityNumber> <ageoff|regex|filterClass>")
Remove the literal "true" boolean value.
if (!scanColumns) return true; if (columnFamilies.contains(key.getColumnFamilyData())) return true;
Remove this call to "exit" or ensure it is really required.