auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private TrieNode findTrieNode(String path, boolean findLeafAlongPath) throws IllegalArgumentException { if (path.equals("/") || path.equals("")) { if (findLeafAlongPath && !_rootNode._isLeaf) { throw new IllegalArgumentException("no leaf node found along the path"); } return _rootNode; } if (path.substring(0, 1).equals("/")) { path = path.substring(1); } String[] splitPath = path.split("/", 0); TrieNode curNode = _rootNode; if (findLeafAlongPath && curNode._isLeaf) { return curNode; } Map<String, TrieNode> curChildren = curNode._children; for (String pathSection : splitPath) { curNode = curChildren.get(pathSection); if (curNode == null) { throw new IllegalArgumentException("the provided path is missing from the trie"); } if (findLeafAlongPath && curNode._isLeaf) { return curNode; } curChildren = curNode._children; } if (findLeafAlongPath) { throw new IllegalArgumentException("no leaf node found along the path"); } return curNode; }

Target:
private TrieNode findTrieNode(String path, boolean findLeafAlongPath) throws NoSuchElementException { if (path.equals(DELIMITER) || path.equals("")) { if (findLeafAlongPath && !_rootNode._isLeaf) { throw new NoSuchElementException("No leaf node found along the path. Path: " + path); } return _rootNode; } String[] splitPath; if (path.substring(0, 1).equals(DELIMITER)) { splitPath = path.substring(1).split(DELIMITER, 0); } else { splitPath = path.split(DELIMITER, 0); } TrieNode curNode = _rootNode; if (findLeafAlongPath && curNode._isLeaf) { return curNode; } Map<String, TrieNode> curChildren = curNode._children; for (String pathSection : splitPath) { curNode = curChildren.get(pathSection); if (curNode == null) { throw new NoSuchElementException( "The provided path is missing from the trie. Path: " + path); } if (findLeafAlongPath && curNode._isLeaf) { return curNode; } curChildren = curNode._children; } if (findLeafAlongPath) { throw new NoSuchElementException("No leaf node found along the path. Path: " + path); } return curNode; }
Source:
public List<Contentlet> filterRelatedContent(Contentlet contentlet, Relationship rel, User user, boolean respectFrontendRoles, Boolean pullByParent, int limit, int offset) throws DotDataException, DotSecurityException { if (!UtilMethods.isSet(contentlet.getIdentifier())) { return Collections.emptyList(); } final boolean isSameStructureRelationship = FactoryLocator.getRelationshipFactory() .sameParentAndChild(rel); if (isSameStructureRelationship) { if (pullByParent == null) { return (List<Contentlet>) CollectionsUtils .join(getRelatedChildren(contentlet, rel, user, respectFrontendRoles, limit, offset), getRelatedParents(contentlet, rel, user, respectFrontendRoles, limit, offset)).stream() .filter(Objects::nonNull) .collect(CollectionsUtils.toImmutableList()); } if (pullByParent) { return getRelatedChildren(contentlet, rel, user, respectFrontendRoles, limit, offset).stream() .filter(Objects::nonNull) .collect(CollectionsUtils.toImmutableList()); } else { return getRelatedParents(contentlet, rel, user, respectFrontendRoles, limit, offset) .stream().filter(Objects::nonNull) .collect(CollectionsUtils.toImmutableList()); } } else { if (rel.getChildStructureInode().equals(contentlet.getContentTypeId())) { return getRelatedParents(contentlet, rel, user, respectFrontendRoles, limit, offset); } else { return getRelatedChildren(contentlet, rel, user, respectFrontendRoles, limit, offset); } } }

Target:
List<Contentlet> filterRelatedContent(Contentlet contentlet, Relationship rel, User user, boolean respectFrontendRoles, Boolean pullByParent, int limit, int offset) throws DotDataException, DotSecurityException { if (!UtilMethods.isSet(contentlet.getIdentifier())) { return Collections.emptyList(); } final boolean isSameStructureRelationship = FactoryLocator.getRelationshipFactory() .sameParentAndChild(rel); if (isSameStructureRelationship) { if (pullByParent == null) { return (List<Contentlet>) CollectionsUtils .join(getRelatedChildren(contentlet, rel, user, respectFrontendRoles, limit, offset), getRelatedParents(contentlet, rel, user, respectFrontendRoles, limit, offset)).stream() .filter(Objects::nonNull) .collect(CollectionsUtils.toImmutableList()); } if (pullByParent) { return getRelatedChildren(contentlet, rel, user, respectFrontendRoles, limit, offset).stream() .filter(Objects::nonNull) .collect(CollectionsUtils.toImmutableList()); } else { return getRelatedParents(contentlet, rel, user, respectFrontendRoles, limit, offset) .stream().filter(Objects::nonNull) .collect(CollectionsUtils.toImmutableList()); } } else { if (rel.getChildStructureInode().equals(contentlet.getContentTypeId())) { return getRelatedParents(contentlet, rel, user, respectFrontendRoles, limit, offset); } else { return getRelatedChildren(contentlet, rel, user, respectFrontendRoles, limit, offset); } } }
Source:
public void init() { fridgeTemperature = new RangedIntBehaviorLogic((RangedIntBehavior) getPojo().getBehavior(BEHAVIOR_FRIDGE_TEMPERATURE)); freezerTemperature = new RangedIntBehaviorLogic((RangedIntBehavior) getPojo().getBehavior(BEHAVIOR_FREEZER_TEMPERATURE)); fridgeTemperature.addListener(new RangedIntBehaviorLogic.Listener() { @Override public void onLowerBoundValue(Config params, boolean fireCommand) { } @Override public void onUpperBoundValue(Config params, boolean fireCommand) { } @Override public void onRangeValue(int rangeValue, Config params, boolean fireCommand) { executeSetFridgeTemperature(rangeValue, params); } }); freezerTemperature.addListener(new RangedIntBehaviorLogic.Listener() { @Override public void onLowerBoundValue(Config params, boolean fireCommand) { } @Override public void onUpperBoundValue(Config params, boolean fireCommand) { } @Override public void onRangeValue(int rangeValue, Config params, boolean fireCommand) { executeSetFreezerTemperature(rangeValue, params); } }); registerBehavior(fridgeTemperature); registerBehavior(freezerTemperature); super.init(); }

Target:
public void init() { fridgeTemperature = new RangedIntBehaviorLogic((RangedIntBehavior) getPojo().getBehavior(BEHAVIOR_FRIDGE_TEMPERATURE)); freezerTemperature = new RangedIntBehaviorLogic((RangedIntBehavior) getPojo().getBehavior(BEHAVIOR_FREEZER_TEMPERATURE)); fridgeTemperature.addListener(new RangedIntBehaviorLogic.Listener() { @Override public void onLowerBoundValue(Config params, boolean fireCommand) { executeSetFridgeTemperature(fridgeTemperature.getMin(), params); } @Override public void onUpperBoundValue(Config params, boolean fireCommand) { executeSetFridgeTemperature(fridgeTemperature.getMax(), params); } @Override public void onRangeValue(int rangeValue, Config params, boolean fireCommand) { executeSetFridgeTemperature(rangeValue, params); } }); freezerTemperature.addListener(new RangedIntBehaviorLogic.Listener() { @Override public void onLowerBoundValue(Config params, boolean fireCommand) { executeSetFreezerTemperature(freezerTemperature.getMin(), params); } @Override public void onUpperBoundValue(Config params, boolean fireCommand) { executeSetFreezerTemperature(freezerTemperature.getMax(), params); } @Override public void onRangeValue(int rangeValue, Config params, boolean fireCommand) { executeSetFreezerTemperature(rangeValue, params); } }); registerBehavior(fridgeTemperature); registerBehavior(freezerTemperature); super.init(); }
Source:
String buildEntryFlagName(@Nonnull final Flags flags) { final Flags.Flag[] sf = flags.getSystemFlags(); final String[] uf = flags.getUserFlags(); String s = "\"/flags/"; if (sf.length == 1) { s += ImapClientConstants.BACKSLASH; if (sf[0] == Flags.Flag.ANSWERED) { s += ANSWERED; } else if (sf[0] == Flags.Flag.DELETED) { s += DELETED; } else if (sf[0] == Flags.Flag.DRAFT) { s += DRAFT; } else if (sf[0] == Flags.Flag.FLAGGED) { s += FLAGGED; } else if (sf[0] == Flags.Flag.RECENT) { s += RECENT; } else if (sf[0] == Flags.Flag.SEEN) { s += SEEN; } } else { s += uf[0]; } s += ImapClientConstants.DQUOTA; return s; }

Target:
String buildEntryFlagName(@Nonnull final Flags flags) { final Flags.Flag[] sf = flags.getSystemFlags(); final String[] uf = flags.getUserFlags(); final StringBuilder s = new StringBuilder("\"/flags/"); if (sf.length == 1) { s.append(ImapClientConstants.BACKSLASH); if (sf[0] == Flags.Flag.ANSWERED) { s.append(ANSWERED); } else if (sf[0] == Flags.Flag.DELETED) { s.append(DELETED); } else if (sf[0] == Flags.Flag.DRAFT) { s.append(DRAFT); } else if (sf[0] == Flags.Flag.FLAGGED) { s.append(FLAGGED); } else if (sf[0] == Flags.Flag.RECENT) { s.append(RECENT); } else if (sf[0] == Flags.Flag.SEEN) { s.append(SEEN); } } else { s.append(uf[0]); } s.append(ImapClientConstants.DQUOTA); return s.toString(); }
Source:
private Requirement getRequirements(SqlQueryDescriptor queryDescriptor) { List<Requirement> requirements = newArrayList(); requirements.addAll(queryDescriptor.getTableDefinitionNames() .stream() .map(requiredTableName -> new ImmutableTableRequirement(tableDefinitionsRepository.getForName(requiredTableName), Optional.of(queryDescriptor.getDatabaseName()))) .collect(toList())); requirements.addAll(queryDescriptor.getMutableTableDescriptors() .stream() .map(descriptor -> MutableTableRequirement.builder(tableDefinitionsRepository.getForName(descriptor.tableDefinitionName)) .withName(descriptor.name) .withState(descriptor.state) .withTableManager(queryDescriptor.getDatabaseName()) .build()) .collect(toList())); requirements.addAll(queryDescriptor.getRequirementClassNames() .stream() .map(this::getRequirementsFromClass) .collect(toList())); return compose(requirements); }

Target:
private Requirement getRequirements(SqlQueryDescriptor queryDescriptor) { List<Requirement> requirements = newArrayList(); requirements.addAll(queryDescriptor.getTableDefinitionNames() .stream() .map(requiredTableName -> new ImmutableTableRequirement(tableDefinitionsRepository.getForName(requiredTableName), Optional.of(queryDescriptor.getDatabaseName()))) .collect(toList())); requirements.addAll(queryDescriptor.getMutableTableDescriptors() .stream() .map(descriptor -> MutableTableRequirement.builder(tableDefinitionsRepository.getForName(descriptor.tableDefinitionName)) .withName(descriptor.name) .withState(descriptor.state) .withDatabase(queryDescriptor.getDatabaseName()) .build()) .collect(toList())); requirements.addAll(queryDescriptor.getRequirementClassNames() .stream() .map(this::getRequirementsFromClass) .collect(toList())); return compose(requirements); }
Source:
public Set<String> allowedStripeIpAddresses(StripeGatewayConfig config) { ImmutableSet.Builder<String> allowedStripeIpAddresses = ImmutableSet.builder(); for (String cidr : config.getAllowedCidrs()) { SubnetUtils subnet = new SubnetUtils(cidr); subnet.setInclusiveHostCount(true); allowedStripeIpAddresses.addAll(List.of(subnet.getInfo().getAllAddresses())); } return allowedStripeIpAddresses.build(); }

Target:
public Set<String> allowedStripeIpAddresses(StripeGatewayConfig config) { return CidrUtils.getIpAddresses(config.getAllowedCidrs()); }
Source:
protected VDSCommandType getRevertVDSCommandType() { return VDSCommandType.DeleteImageGroup; }

Target:
protected VDSCommandType getRevertVDSCommandType() { return null; }
Source:
public void showProgress(final boolean show) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) { int shortAnimTime = getResources().getInteger(android.R.integer.config_shortAnimTime); mLoginFormView.setVisibility(show ? View.GONE : View.VISIBLE); mLoginFormView.animate().setDuration(shortAnimTime).alpha( show ? 0 : 1 ).setListener( new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { mLoginFormView.setVisibility(show ? View.GONE : View.VISIBLE); } } ); mProgressView.setVisibility(show ? View.VISIBLE : View.GONE); mProgressView.animate().setDuration(shortAnimTime).alpha( show ? 1 : 0 ).setListener( new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { mProgressView.setVisibility(show ? View.VISIBLE : View.GONE); } } ); } else { mProgressView.setVisibility(show ? View.VISIBLE : View.GONE); mLoginFormView.setVisibility(show ? View.GONE : View.VISIBLE); } }

Target:
private void showProgress(final boolean show) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) { int shortAnimTime = getResources().getInteger(android.R.integer.config_shortAnimTime); loginFormView.setVisibility(show ? View.GONE : View.VISIBLE); loginFormView.animate().setDuration(shortAnimTime).alpha( show ? 0 : 1 ).setListener( new AnimatorListenerAdapter() { @Override public void onAnimationEnd(@NonNull Animator animation) { loginFormView.setVisibility(show ? View.GONE : View.VISIBLE); } } ); progressView.setVisibility(show ? View.VISIBLE : View.GONE); progressView.animate().setDuration(shortAnimTime).alpha( show ? 1 : 0 ).setListener( new AnimatorListenerAdapter() { @Override public void onAnimationEnd(@NonNull Animator animation) { progressView.setVisibility(show ? View.VISIBLE : View.GONE); } } ); } else { progressView.setVisibility(show ? View.VISIBLE : View.GONE); loginFormView.setVisibility(show ? View.GONE : View.VISIBLE); } }
Source:
public Step loadVariantsStep(StepBuilderFactory stepBuilderFactory, JobOptions jobOptions, SimpleCompletionPolicy chunkSizeCompletionPolicy) { logger.debug("Building '" + LOAD_VARIANTS_STEP + "'"); return stepBuilderFactory.get(LOAD_VARIANTS_STEP) .<Variant, Variant>chunk(chunkSizeCompletionPolicy) .reader(reader) .writer(variantWriter) .faultTolerant().skipLimit(50).skip(FlatFileParseException.class) .allowStartIfComplete(jobOptions.isAllowStartIfComplete()) .listener(new SkippedItemListener()) .listener(new StepProgressListener()) .listener(new VariantLoaderStatisticsListener()) .build(); }

Target:
public Step loadVariantsStep(StepBuilderFactory stepBuilderFactory, JobOptions jobOptions, SimpleCompletionPolicy chunkSizeCompletionPolicy) { logger.debug("Building '" + LOAD_VARIANTS_STEP + "'"); return stepBuilderFactory.get(LOAD_VARIANTS_STEP) .<Variant, Variant>chunk(chunkSizeCompletionPolicy) .reader(reader) .writer(variantWriter) .faultTolerant().skipLimit(50).skip(FlatFileParseException.class) .allowStartIfComplete(jobOptions.isAllowStartIfComplete()) .listener(new SkippedItemListener()) .listener(new StepProgressListener()) .listener(new VariantLoaderStepStatisticsListener()) .build(); }
Source:
public FetchCommand setRemoveDeletedRefs(boolean removeDeletedRefs) { this.removeDeletedRefs = removeDeletedRefs; return this; }

Target:
public FetchCommand setRemoveDeletedRefs(boolean removeDeletedRefs) { checkCallable(); this.removeDeletedRefs = removeDeletedRefs; return this; }
Source:
public static boolean isLastNParameter(String theParamName, FhirContext theContext) { if (theParamName == null) { return false; } if (theContext.getVersion().getVersion() == FhirVersionEnum.R5) { if (theParamName.equals(org.hl7.fhir.r5.model.Observation.SP_SUBJECT) || theParamName.equals(org.hl7.fhir.r5.model.Observation.SP_PATIENT) || theParamName.equals(org.hl7.fhir.r5.model.Observation.SP_CATEGORY) || theParamName.equals(org.hl7.fhir.r5.model.Observation.SP_CODE)) { return true; } else { return false; } } else if (theContext.getVersion().getVersion() == FhirVersionEnum.R4) { if (theParamName.equals(org.hl7.fhir.r4.model.Observation.SP_SUBJECT) || theParamName.equals(org.hl7.fhir.r4.model.Observation.SP_PATIENT) || theParamName.equals(org.hl7.fhir.r4.model.Observation.SP_CATEGORY) || theParamName.equals(org.hl7.fhir.r4.model.Observation.SP_CODE)) { return true; } else { return false; } } else if (theContext.getVersion().getVersion() == FhirVersionEnum.DSTU3) { if (theParamName.equals(org.hl7.fhir.dstu3.model.Observation.SP_SUBJECT) || theParamName.equals(org.hl7.fhir.dstu3.model.Observation.SP_PATIENT) || theParamName.equals(org.hl7.fhir.dstu3.model.Observation.SP_CATEGORY) || theParamName.equals(org.hl7.fhir.dstu3.model.Observation.SP_CODE)) { return true; } else { return false; } } else { throw new InvalidRequestException("$lastn operation is not implemented for FHIR Version " + theContext.getVersion().getVersion().getFhirVersionString()); } }

Target:
public static boolean isLastNParameter(String theParamName, FhirContext theContext) { if (theParamName == null) { return false; } FhirVersionEnum version = theContext.getVersion().getVersion(); if (isR5(version) && isLastNParameterR5(theParamName)) { return true; } else if (isR4(version) && isLastNParameterR4(theParamName)) { return true; } else if (isDstu3(version) && isLastNParameterDstu3(theParamName)) { return true; } else { return false; } }
Source:
private void discoverConfigsAndLoadBundles(CatalogContext catalogContext) { m_configsForProcessor.clear(); for (String configName : m_processorConfig.keySet()) { ImportConfiguration importConfig = m_processorConfig.get(configName); Properties properties = importConfig.getmoduleProperties(); String importBundleJar = properties.getProperty(ImportDataProcessor.IMPORT_MODULE); Preconditions.checkNotNull(importBundleJar, "Import source is undefined or custom export plugin class missing."); String procedure = properties.getProperty(ImportDataProcessor.IMPORT_PROCEDURE); Procedure catProc = catalogContext.procedures.get(procedure); if (catProc == null) { catProc = catalogContext.m_defaultProcs.checkForDefaultProcedure(procedure); } if (catProc == null) { importLog.info("Importer " + configName + " Procedure " + procedure + " is missing will disable this importer until the procedure becomes available."); continue; } if (loadImporterBundle(properties)) { m_configsForProcessor.put(configName, importConfig); } } if (!m_configsForProcessor.isEmpty()) { importLog.info("Loaded importer modules: " + m_loadedBundles.keySet() +", types: " + m_importersByType.keySet()); } }

Target:
private void discoverConfigsAndLoadBundles(CatalogContext catalogContext) { m_configsForProcessor.clear(); for (String configName : m_processorConfig.keySet()) { ImportConfiguration importConfig = m_processorConfig.get(configName); Properties properties = importConfig.getmoduleProperties(); String importBundleJar = properties.getProperty(ImportDataProcessor.IMPORT_MODULE); Preconditions.checkNotNull(importBundleJar, "Import source is undefined or custom import plugin class missing."); String procedure = properties.getProperty(ImportDataProcessor.IMPORT_PROCEDURE); Procedure catProc = catalogContext.procedures.get(procedure); if (catProc == null) { catProc = catalogContext.m_defaultProcs.checkForDefaultProcedure(procedure); } if (catProc == null) { importLog.info("Importer " + configName + " Procedure " + procedure + " is missing will disable this importer until the procedure becomes available."); continue; } if (loadImporterBundle(properties)) { m_configsForProcessor.put(configName, importConfig); } } if (!m_configsForProcessor.isEmpty()) { importLog.info("Loaded importer modules: " + m_loadedBundles.keySet() +", types: " + m_importersByType.keySet()); } }
Source:
public static String getLineSeparatorForFile(String filepath, Charset charset) throws IOException { final String result; if (new FileText(new File(filepath), charset.name()) .getFullText().chars().anyMatch(character -> character == '\r')) { result = "\r\n"; } else { result = "\n"; } return result; }

Target:
public static String getLineSeparatorForFile(String filepath, Charset charset) throws IOException { final boolean[] crFound = {false}; new FileText(new File(filepath), charset.name()) .getFullText() .chars() .peek(character -> { if (character == '\r') { crFound[0] = true; } }) .filter(character -> character == '\n') .findFirst(); final String result; if (crFound[0]) { result = CRLF; } else { result = "\n"; } return result; }
Source:
public <S extends ArtifactEntry> S save(S entity, boolean updateLastVersion) { entity.setArtifactCoordinates(entity.getArtifactCoordinates()); ArtifactCoordinates coordinates = entity.getArtifactCoordinates(); if (coordinates == null) { return super.save(entity); } if (updateLastVersion) { updateLastVersionTag(entity); } return super.save(entity); }

Target:
public <S extends ArtifactEntry> S save(S entity, boolean updateLastVersion) { entity.setArtifactCoordinates(entity.getArtifactCoordinates()); if(artifactEntryIsSavedForTheFirstTime(entity)) { entity.setCreated(new Date()); } ArtifactCoordinates coordinates = entity.getArtifactCoordinates(); if (coordinates == null) { return super.save(entity); } if (updateLastVersion) { updateLastVersionTag(entity); } return super.save(entity); }
Source:
private static String makeId(String id, IndexIngestionSpec ingestionSchema) { return id != null ? id : String.format("index_%s_%s", makeDataSource(ingestionSchema), new DateTime().toString()); }

Target:
private static String makeId(String id, IndexIngestionSpec ingestionSchema) { return id != null ? id : String.format("index_%s_%s", makeDataSource(ingestionSchema), new DateTime()); }
Source:
public void testLock() throws Exception { RedisLockRegistry registry = new RedisLockRegistry(this.getConnectionFactoryForTest(), this.registryKey); for (int i = 0; i < 10; i++) { Lock lock = registry.obtain("foo"); lock.lock(); try { assertEquals(1, TestUtils.getPropertyValue(registry, "locks", Map.class).size()); } finally { lock.unlock(); } } Thread.sleep(10); registry.expireUnusedOlderThan(0); assertEquals(0, TestUtils.getPropertyValue(registry, "locks", Map.class).size()); }

Target:
public void testLock() throws Exception { RedisLockRegistry registry = new RedisLockRegistry(this.getConnectionFactoryForTest(), this.registryKey); for (int i = 0; i < 10; i++) { Lock lock = registry.obtain("foo"); lock.lock(); try { assertEquals(1, TestUtils.getPropertyValue(registry, "locks", Map.class).size()); } finally { lock.unlock(); } } registry.expireUnusedOlderThan(-1000); assertEquals(0, TestUtils.getPropertyValue(registry, "locks", Map.class).size()); }
Source:
private static void putAdapterPerf(HBaseRequestAdapter adapter, Put put) { System.out.println("Size: " + adapter.adapt(put).toProto(requestContext).getSerializedSize()); System.gc(); { long start = System.nanoTime(); for (int i = 0; i < count; i++) { adapter.adapt(put); } long time = System.nanoTime() - start; System.out.println( String.format("adapted: %,d rows merged in %,d ms. %,d nanos per row.", count, time / 1000000, time / count)); } System.gc(); { long start = System.nanoTime(); for (int i = 0; i < count; i++) { RowMutation adapted = adapter.adapt(put); BigtableGrpc.getMutateRowMethod().streamRequest(adapted.toProto(requestContext)); } long time = System.nanoTime() - start; System.out.println( String.format("adapted, streamRequest: %,d rows merged in %,d ms. %,d nanos per row.", count, time / 1000000, time / count)); } System.gc(); { long start = System.nanoTime(); for (int i = 0; i < count; i++) { RowMutation adapted = adapter.adapt(put); adapted.toProto(requestContext).getSerializedSize(); BigtableGrpc.getMutateRowMethod().streamRequest(adapted.toProto(requestContext)); } long time = System.nanoTime() - start; System.out.println(String.format( "adapted, getSerializedSize, streamRequest: %,d rows merged in %,d ms. %,d nanos per row.", count, time / 1000000, time / count)); } }

Target:
private static void putAdapterPerf(HBaseRequestAdapter adapter, Put put) { System.out.println("Size: " + adapter.adapt(put).toProto(requestContext).getSerializedSize()); System.gc(); { long start = System.nanoTime(); for (int i = 0; i < count; i++) { adapter.adapt(put); } long time = System.nanoTime() - start; System.out.println( String.format("adapted: %,d rows merged in %,d ms. %,d nanos per row.", count, time / 1000000, time / count)); } System.gc(); { long start = System.nanoTime(); for (int i = 0; i < count; i++) { RowMutation adapted = adapter.adapt(put); BigtableGrpc.getMutateRowMethod().streamRequest(adapted.toProto(requestContext)); } long time = System.nanoTime() - start; System.out.println( String.format("adapted, streamRequest: %,d rows merged in %,d ms. %,d nanos per row.", count, time / 1000000, time / count)); } System.gc(); { long start = System.nanoTime(); for (int i = 0; i < count; i++) { MutateRowRequest adapted = adapter.adapt(put).toProto(requestContext); adapted.getSerializedSize(); BigtableGrpc.getMutateRowMethod().streamRequest(adapted); } long time = System.nanoTime() - start; System.out.println(String.format( "adapted, getSerializedSize, streamRequest: %,d rows merged in %,d ms. %,d nanos per row.", count, time / 1000000, time / count)); } }
Source:
public synchronized void flush() { try { buffer.put(FLUSH_LOG); synchronized (o){ o.wait(); } } catch (InterruptedException e) { log.error(e.getMessage(), e); } }

Target:
public synchronized void flush() { try { synchronized (lock){ buffer.put(FLUSH_LOG); lock.wait(); } } catch (InterruptedException e) { log.error("Failed during flushing", e); Thread.currentThread().interrupt(); } }
Source:
public <T> T getBitmapResult(final BitmapIndexSelector selector, final BitmapResultFactory<T> bitmapResultFactory) { if (requiredBindings.isEmpty()) { if (expr.eval(ExprUtils.nilBindings()).asBoolean()) { return bitmapResultFactory.wrapAllTrue(Filters.allTrue(selector)); } else { return bitmapResultFactory.wrapAllFalse(Filters.allFalse(selector)); } } else { final String column = Iterables.getOnlyElement(requiredBindings); return Filters.matchPredicate( column, selector, bitmapResultFactory, str -> expr.eval(name -> str).asBoolean() ); } }

Target:
public <T> T getBitmapResult(final BitmapIndexSelector selector, final BitmapResultFactory<T> bitmapResultFactory) { if (requiredBindings.isEmpty()) { if (expr.eval(ExprUtils.nilBindings()).asBoolean()) { return bitmapResultFactory.wrapAllTrue(Filters.allTrue(selector)); } else { return bitmapResultFactory.wrapAllFalse(Filters.allFalse(selector)); } } else { final String column = Iterables.getOnlyElement(requiredBindings); return Filters.matchPredicate( column, selector, bitmapResultFactory, value -> expr.eval(identifierName -> { assert column.equals(identifierName); return value; }).asBoolean() ); } }
Source:
public Response<TreeSet<String>> apply(ChangeResource req, Input input) throws AuthException, OrmException, IOException, BadRequestException { if (input == null || (input.add == null && input.remove == null)) { throw new BadRequestException("Hashtags are required"); } ChangeControl control = req.getControl(); if (!control.canEditHashtags()) { throw new AuthException("Editing hashtags not permitted"); } ChangeUpdate update = updateFactory.create(control); ChangeNotes notes = control.getNotes().load(); Set<String> existingHashtags = notes.getHashtags(); Set<String> updatedHashtags = new HashSet<>(); Set<String> toAdd = new HashSet<>(extractTags(input.add)); Set<String> toRemove = new HashSet<>(extractTags(input.remove)); if (existingHashtags != null && !existingHashtags.isEmpty()) { updatedHashtags.addAll(existingHashtags); toAdd.removeAll(existingHashtags); toRemove.retainAll(existingHashtags); } if (toAdd.size() > 0 || toRemove.size() > 0) { updatedHashtags.addAll(toAdd); updatedHashtags.removeAll(toRemove); update.setHashtags(updatedHashtags); update.commit(); indexer.index(dbProvider.get(), update.getChange()); } return Response.ok(new TreeSet<String>(updatedHashtags)); }

Target:
public Response<? extends Set<String>> apply(ChangeResource req, Input input) throws AuthException, OrmException, IOException, BadRequestException { if (input == null || (input.add == null && input.remove == null)) { throw new BadRequestException("Hashtags are required"); } ChangeControl control = req.getControl(); if (!control.canEditHashtags()) { throw new AuthException("Editing hashtags not permitted"); } ChangeUpdate update = updateFactory.create(control); ChangeNotes notes = control.getNotes().load(); Set<String> existingHashtags = notes.getHashtags(); Set<String> updatedHashtags = new HashSet<>(); Set<String> toAdd = new HashSet<>(extractTags(input.add)); Set<String> toRemove = new HashSet<>(extractTags(input.remove)); if (existingHashtags != null && !existingHashtags.isEmpty()) { updatedHashtags.addAll(existingHashtags); toAdd.removeAll(existingHashtags); toRemove.retainAll(existingHashtags); } if (toAdd.size() > 0 || toRemove.size() > 0) { updatedHashtags.addAll(toAdd); updatedHashtags.removeAll(toRemove); update.setHashtags(updatedHashtags); update.commit(); indexer.index(dbProvider.get(), update.getChange()); } return Response.ok(new TreeSet<String>(updatedHashtags)); }
Source:
public void onEvent(Event e) { if (e.getUei().equals(EventConstants.RELOAD_DAEMON_CONFIG_UEI)) { final String daemonName = getDaemonNameFromReloadDaemonEvent(e); if (daemonName != null && daemonName.equals(getName())) { doAddAndRemoveEngines(); return; } } if (e.getUei().equals(EventConstants.RELOAD_DAEMON_CONFIG_FAILED_UEI)) { final String daemonName = getDaemonNameFromReloadDaemonEvent(e); if (daemonName.startsWith(getName() + '-')) { Matcher m = Pattern.compile(getName() + "-(.+)$").matcher(daemonName); if (m.find()) { final String engineName = m.group(1); LOG.warn("An error was detected while reloading engine {}, this engine will be removed. Fix the error and try again.", engineName); m_correlator.removeCorrelationEngine(engineName); for (PluginConfiguration p : m_pluginConfigurations) { final RuleSet set = p.getRuleSets().stream().filter(r -> r.getName().equals(engineName)).findFirst().orElse(null); if (set != null) { p.getRuleSets().remove(set); } } } } } }

Target:
public void onEvent(Event e) { if (e.getUei().equals(EventConstants.RELOAD_DAEMON_CONFIG_UEI)) { final String daemonName = getDaemonNameFromReloadDaemonEvent(e); if (daemonName != null && daemonName.equals(getName())) { doAddAndRemoveEngines(); return; } } if (e.getUei().equals(EventConstants.RELOAD_DAEMON_CONFIG_FAILED_UEI)) { final String daemonName = getDaemonNameFromReloadDaemonEvent(e); Matcher m = Pattern.compile(getName() + "-(.+)$").matcher(daemonName); if (m.find()) { final String engineName = m.group(1); LOG.warn("An error was detected while reloading engine {}, this engine will be removed. Fix the error and try again.", engineName); m_correlator.removeCorrelationEngine(engineName); for (PluginConfiguration p : m_pluginConfigurations) { final RuleSet set = p.getRuleSets().stream().filter(r -> r.getName().equals(engineName)).findFirst().orElse(null); if (set != null) { p.getRuleSets().remove(set); } } } } }
Source:
private void getSearchItems() { ArrayList<Suggestion> suggestions = new ArrayList<>(); Query<Preferences> query = mBucketPreferences.query(); try (ObjectCursor<Preferences> cursor = query.execute()) { while (cursor.moveToNext()) { List<String> recents = cursor.getObject().getRecentSearches(); for (String recent : recents) { suggestions.add(new Suggestion(recent, HISTORY)); } } } mSuggestionAdapter.updateItems(suggestions); }

Target:
private void getSearchItems() { Preferences preferences = getPreferences(); if (preferences != null) { ArrayList<Suggestion> suggestions = new ArrayList<>(); for (String recent : preferences.getRecentSearches()) { suggestions.add(new Suggestion(recent, HISTORY)); } mSuggestionAdapter.updateItems(suggestions); } else { Log.e("getSearchItems", "Could not get preferences entity"); } }
Source:
private void collect(IClassInfo ci, Set<Class> collector) { if (ci.hasAnnotation(IgnoreBean.class)) { if (LOG.isDebugEnabled()) { LOG.debug("Skipping bean candidate '{}' because it is annotated with '{}'.", ci.name(), IgnoreBean.class.getSimpleName()); } return; } if (!ci.isInstanciable()) { if (LOG.isDebugEnabled()) { LOG.debug("Skipping bean candidate '{}' because it is not instanciable.", ci.name()); } return; } if (!(ci.hasNoArgsConstructor() || ci.hasInjectableConstructor())) { if (LOG.isDebugEnabled()) { LOG.debug("Skipping bean candidate '{0}' because it has no empty or injectable constructor().", ci.name()); } return; } try { collector.add(ci.resolveClass()); } catch (Exception ex) { LOG.warn("Could not resolve class [{}]", ci.name(), ex); } }

Target:
private void collect(IClassInfo ci, Set<Class> collector) { if (ci.hasAnnotation(IgnoreBean.class)) { if (LOG.isDebugEnabled()) { LOG.debug("Skipping bean candidate '{}' because it is annotated with '{}'.", ci.name(), IgnoreBean.class.getSimpleName()); } return; } if (!ci.isInstanciable()) { if (LOG.isDebugEnabled()) { LOG.debug("Skipping bean candidate '{}' because it is not instanciable.", ci.name()); } return; } if (!(ci.hasNoArgsConstructor() || ci.hasInjectableConstructor())) { if (LOG.isDebugEnabled()) { LOG.debug("Skipping bean candidate '{}' because it has no empty or injectable constructor().", ci.name()); } return; } try { collector.add(ci.resolveClass()); } catch (Exception ex) { LOG.warn("Could not resolve class [{}]", ci.name(), ex); } }
Source:
public Key(ManagedBean mbean, String name) { checkNotNull(mbean, "Managd bean"); this.type = checkNotNull(mbean.getType(), "Managed bean type"); this.name = checkNotNull(name, "Name"); }

Target:
public Key(ManagedBean mbean, String name) { this(checkNotNull(mbean, "mbean").getType(), name); }
Source:
private void onShutDown() { try { partitionMonitor.ifPresent(StreamPartitionCountMonitor::stop); inputStreamRegexMonitor.ifPresent(StreamRegexMonitor::stop); systemAdmins.stop(); containerProcessManager.stop(); coordinatorStreamStore.close(); } catch (Throwable e) { LOG.error("Exception while stopping task manager {}", e); } LOG.info("Stopped task manager"); if (jmxServer != null) { try { jmxServer.stop(); LOG.info("Stopped Jmx Server"); } catch (Throwable e) { LOG.error("Exception while stopping jmx server {}", e); } } }

Target:
private void onShutDown() { try { partitionMonitor.ifPresent(StreamPartitionCountMonitor::stop); inputStreamRegexMonitor.ifPresent(StreamRegexMonitor::stop); systemAdmins.stop(); containerProcessManager.stop(); coordinatorStreamStore.close(); } catch (Throwable e) { LOG.error("Exception while stopping cluster based job coordinator", e); } LOG.info("Stopped cluster based job coordinator"); if (jmxServer != null) { try { jmxServer.stop(); LOG.info("Stopped Jmx Server"); } catch (Throwable e) { LOG.error("Exception while stopping jmx server", e); } } }
Source:
public ModuleMetadata findOne(String metadataPath) { ModuleMetadata metadata = null; try { byte[] data = zkConnection.getClient().getData().forPath(metadataPath); if (data != null) { Map<String, String> metadataMap = mapBytesUtility.toMap(data); String moduleId = getModuleId(metadataPath); String containerId = getContainerId(metadataPath); Map<String, String> resolvedProperties = resolveModuleOptionValues(metadataMap); String moduleDeploymentsPath = metadataPath.substring(0, metadataPath.lastIndexOf("/")); Map<String, String> deploymentProps = mapBytesUtility.toMap(zkConnection.getClient().getData().forPath( moduleDeploymentsPath)); String deploymentProperties = (deploymentProps.isEmpty()) ? "" : MapUtils.toProperties(deploymentProps).toString(); String moduleProperties = (resolvedProperties.isEmpty()) ? "" : MapUtils.toProperties(resolvedProperties).toString(); metadata = new ModuleMetadata(moduleId, containerId, moduleProperties, deploymentProperties); } } catch (Exception e) { ZooKeeperUtils.wrapAndThrowIgnoring(e, NoNodeException.class); } return metadata; }

Target:
public ModuleMetadata findOne(String metadataPath) { ModuleMetadata metadata = null; try { byte[] data = zkConnection.getClient().getData().forPath(metadataPath); if (data != null) { Map<String, String> metadataMap = mapBytesUtility.toMap(data); String moduleId = getModuleId(metadataPath); String containerId = getContainerId(metadataPath); metadata = new ModuleMetadata(moduleId, containerId, getResolvedModuleOptions(metadataMap), getDeploymentProperties(metadataPath)); } } catch (Exception e) { ZooKeeperUtils.wrapAndThrowIgnoring(e, NoNodeException.class); } return metadata; }
Source:
public void testRestServerState() { Assert.assertFalse("Service should be down by default ", serverState.isServiceUp()); serverState.markServiceUp(); Assert.assertTrue("Service is expected to be up ", serverState.isServiceUp()); serverState.markServiceDown(); Assert.assertFalse("Service is expected to be down ", serverState.isServiceUp()); }

Target:
public void testRestServerState() { Assert.assertEquals("Health check Uri mismatch ", healthCheckUri, serverState.getHealthCheckUri()); Assert.assertFalse("Service should be down by default ", serverState.isServiceUp()); serverState.markServiceUp(); Assert.assertTrue("Service is expected to be up ", serverState.isServiceUp()); serverState.markServiceDown(); Assert.assertFalse("Service is expected to be down ", serverState.isServiceUp()); }
Source:
private void queryServer(String query) { KeybaseKeyServer server = new KeybaseKeyServer(); try { ArrayList<ImportKeysListEntry> searchResult = server.search(query); mEntryList.clear(); mEntryList.addAll(searchResult); mEntryListWrapper = new AsyncTaskResultWrapper<ArrayList<ImportKeysListEntry>>(mEntryList, null); } catch (KeyServer.InsufficientQuery e) { Log.e(Constants.TAG, "InsufficientQuery", e); mEntryListWrapper = new AsyncTaskResultWrapper<ArrayList<ImportKeysListEntry>>(mEntryList, e); } catch (KeyServer.QueryException e) { Log.e(Constants.TAG, "QueryException", e); mEntryListWrapper = new AsyncTaskResultWrapper<ArrayList<ImportKeysListEntry>>(mEntryList, e); } catch (KeyServer.TooManyResponses e) { Log.e(Constants.TAG, "TooManyResponses", e); mEntryListWrapper = new AsyncTaskResultWrapper<ArrayList<ImportKeysListEntry>>(mEntryList, e); } }

Target:
private void queryServer(String query) { KeybaseKeyServer server = new KeybaseKeyServer(); try { ArrayList<ImportKeysListEntry> searchResult = server.search(query); mEntryList.clear(); mEntryList.addAll(searchResult); mEntryListWrapper = new AsyncTaskResultWrapper<ArrayList<ImportKeysListEntry>>(mEntryList, null); } catch (KeyServer.InsufficientQuery e) { mEntryListWrapper = new AsyncTaskResultWrapper<ArrayList<ImportKeysListEntry>>(mEntryList, e); } catch (KeyServer.QueryException e) { mEntryListWrapper = new AsyncTaskResultWrapper<ArrayList<ImportKeysListEntry>>(mEntryList, e); } catch (KeyServer.TooManyResponses e) { mEntryListWrapper = new AsyncTaskResultWrapper<ArrayList<ImportKeysListEntry>>(mEntryList, e); } }
Source:
public QuerySensitiveTreeElementWrapper(QuerySensitiveTreeElement<T> wrapped, QueryContext context) { this.wrapped = wrapped; this.context = context; }

Target:
private QuerySensitiveTreeElementWrapper(QuerySensitiveTreeElement<T> wrapped, QueryContext context) { this.wrapped = wrapped; this.context = context; }
Source:
public ChassisIdle(Chassis chassis) { this.selfChassis = chassis; Motor[] motors = chassis.getMotors(); for (Motor motor : motors) { addCommands(new MotorIdle(motor)); } }

Target:
public ChassisIdle(Chassis chassis) { this("ChassisIdle", chassis); }
Source:
protected String createJobName(String cmd, InterpreterContext context) { String pTitle = context.getParagraphTitle(); if (!StringUtils.isEmpty(pTitle)) { return pTitle; } else { String[] lines = cmd.split("\n"); return lines[lines.length - 1]; } }

Target:
protected String createJobName(String cmd, InterpreterContext context) { String pTitle = context.getParagraphTitle(); if (!StringUtils.isBlank(pTitle)) { return pTitle; } else { String[] lines = cmd.split("\n"); for (int i = lines.length - 1; i >= 0; --i) { if (!StringUtils.isBlank(lines[i])) { return lines[i]; } } return "empty_job"; } }
Source:
public <T extends DiscoverySelector> List<T> getSelectorsByType(Class<T> selectorType) { info(() -> "Getting selectors from sub-request for: " + selectorType); return Stream.concat(request.getSelectorsByType(selectorType) .stream() .filter(selector -> !(selector instanceof ClassSelector || selector instanceof MethodSelector || selector instanceof BundleSelector)), selectors.stream() .filter(selector -> selectorType.isInstance(selector) && !(selector instanceof BundleSelector))) .map(selectorType::cast) .collect(toList()); }

Target:
public <T extends DiscoverySelector> List<T> getSelectorsByType(Class<T> selectorType) { info(() -> "Getting selectors from sub-request for: " + selectorType); return Stream.concat( request.getSelectorsByType(selectorType) .stream() .filter(selector -> !(selector instanceof ClassSelector || selector instanceof MethodSelector || selector instanceof BundleSelector)), selectors.stream() .filter(selectorType::isInstance)) .map(selectorType::cast) .collect(toList()); }
Source:
@Override public ResultSet getTables(String catalog, String schemaPtrn, String tblNamePtrn, String[] tblTypes) throws SQLException { conn.ensureNotClosed(); final List<JdbcColumnMeta> meta = Arrays.asList( new JdbcColumnMeta(null, null, "TABLE_CAT", String.class), new JdbcColumnMeta(null, null, "TABLE_SCHEM", String.class), new JdbcColumnMeta(null, null, "TABLE_NAME", String.class), new JdbcColumnMeta(null, null, "TABLE_TYPE", String.class), new JdbcColumnMeta(null, null, "REMARKS", String.class), new JdbcColumnMeta(null, null, "TYPE_CAT", String.class), new JdbcColumnMeta(null, null, "TYPE_SCHEM", String.class), new JdbcColumnMeta(null, null, "TYPE_NAME", String.class), new JdbcColumnMeta(null, null, "SELF_REFERENCING_COL_NAME", String.class), new JdbcColumnMeta(null, null, "REF_GENERATION", String.class)); boolean tblTypeMatch = false; if (tblTypes == null) tblTypeMatch = true; else { for (String type : tblTypes) { if (TYPE_TABLE.equals(type) || TYPE_VIEW.equals(type)) { tblTypeMatch = true; break; } } } if (!isValidCatalog(catalog) || !tblTypeMatch) return new JdbcThinResultSet(Collections.<List<Object>>emptyList(), meta); JdbcMetaTablesResult res = conn.sendRequest(new JdbcMetaTablesRequest(schemaPtrn, tblNamePtrn, tblTypes)). response(); List<List<Object>> rows = new LinkedList<>(); for (JdbcTableMeta tblMeta : res.meta()) rows.add(tableRow(tblMeta)); return new JdbcThinResultSet(rows, meta); }

Target:
@Override public ResultSet getTables(String catalog, String schemaPtrn, String tblNamePtrn, String[] tblTypes) throws SQLException { conn.ensureNotClosed(); final List<JdbcColumnMeta> meta = asList( new JdbcColumnMeta(null, null, "TABLE_CAT", String.class), new JdbcColumnMeta(null, null, "TABLE_SCHEM", String.class), new JdbcColumnMeta(null, null, "TABLE_NAME", String.class), new JdbcColumnMeta(null, null, "TABLE_TYPE", String.class), new JdbcColumnMeta(null, null, "REMARKS", String.class), new JdbcColumnMeta(null, null, "TYPE_CAT", String.class), new JdbcColumnMeta(null, null, "TYPE_SCHEM", String.class), new JdbcColumnMeta(null, null, "TYPE_NAME", String.class), new JdbcColumnMeta(null, null, "SELF_REFERENCING_COL_NAME", String.class), new JdbcColumnMeta(null, null, "REF_GENERATION", String.class)); boolean tblTypeMatch = false; if (tblTypes == null) tblTypeMatch = true; else { for (String type : tblTypes) { if (TYPE_TABLE.equals(type) || TYPE_VIEW.equals(type)) { tblTypeMatch = true; break; } } } if (!isValidCatalog(catalog) || !tblTypeMatch) return new JdbcThinResultSet(Collections.<List<Object>>emptyList(), meta); JdbcMetaTablesResult res = conn.sendRequest(new JdbcMetaTablesRequest(schemaPtrn, tblNamePtrn, tblTypes)) .response(); List<List<Object>> rows = new LinkedList<>(); for (JdbcTableMeta tblMeta : res.meta()) rows.add(tableRow(tblMeta)); return new JdbcThinResultSet(rows, meta); }
Source:
public TimeLockServices createTimeLockServices( String client, Supplier<ManagedTimestampService> rawTimestampServiceSupplier, Supplier<RemoteLockService> rawLockServiceSupplier) { AsyncOrLegacyTimelockService asyncOrLegacyTimelockService; AsyncTimelockService asyncTimelockService = instrumentInLeadershipProxy( AsyncTimelockService.class, () -> AsyncTimeLockServicesCreator.createRawAsyncTimelockService(client, rawTimestampServiceSupplier), client); asyncOrLegacyTimelockService = AsyncOrLegacyTimelockService.createFromAsyncTimelock( new AsyncTimelockResource(asyncTimelockService)); Supplier<RemoteLockService> lockServiceSupplier = asyncLockConfiguration.disableLegacySafetyChecksWarningPotentialDataCorruption() ? rawLockServiceSupplier : JavaSuppliers.compose(NonTransactionalLockService::new, rawLockServiceSupplier); return TimeLockServices.create( asyncTimelockService, instrumentInLeadershipProxy(RemoteLockService.class, lockServiceSupplier, client), asyncOrLegacyTimelockService, asyncTimelockService); }

Target:
public TimeLockServices createTimeLockServices( String client, Supplier<ManagedTimestampService> rawTimestampServiceSupplier, Supplier<RemoteLockService> rawLockServiceSupplier) { AsyncOrLegacyTimelockService asyncOrLegacyTimelockService; AsyncTimelockService asyncTimelockService = instrumentInLeadershipProxy( AsyncTimelockService.class, () -> AsyncTimeLockServicesCreator.createRawAsyncTimelockService(client, rawTimestampServiceSupplier), client); asyncOrLegacyTimelockService = AsyncOrLegacyTimelockService.createFromAsyncTimelock( new AsyncTimelockResource(asyncTimelockService)); RemoteLockService remoteLockService = instrumentInLeadershipProxy( RemoteLockService.class, asyncLockConfiguration.disableLegacySafetyChecksWarningPotentialDataCorruption() ? rawLockServiceSupplier : JavaSuppliers.compose(NonTransactionalLockService::new, rawLockServiceSupplier), client); return TimeLockServices.create( asyncTimelockService, remoteLockService, asyncOrLegacyTimelockService, asyncTimelockService); }
Source:
protected void handleStartupFailure(BackOffExecution backOffExecution) throws Exception { long recoveryInterval = backOffExecution.nextBackOff(); if (BackOffExecution.STOP == recoveryInterval) { stop(); return; } try { if (logger.isDebugEnabled()) { logger.debug("Recovering consumer in " + recoveryInterval + " ms."); } long timeout = System.currentTimeMillis() + recoveryInterval; while (isActive() && System.currentTimeMillis() < timeout) { Thread.sleep(200); } } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new IllegalStateException("Unrecoverable interruption on consumer restart"); } }

Target:
protected void handleStartupFailure(BackOffExecution backOffExecution) throws Exception { long recoveryInterval = backOffExecution.nextBackOff(); if (BackOffExecution.STOP == recoveryInterval) { synchronized (this) { if (isActive()) { logger.warn("stopping container - restart recovery attempts exhausted"); stop(); } } return; } try { if (logger.isDebugEnabled() && isActive()) { logger.debug("Recovering consumer in " + recoveryInterval + " ms."); } long timeout = System.currentTimeMillis() + recoveryInterval; while (isActive() && System.currentTimeMillis() < timeout) { Thread.sleep(200); } } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new IllegalStateException("Unrecoverable interruption on consumer restart"); } }
Source:
public void testSaneClientAuthenticationWithMissingFileDoesNotFail() { String filepath = "NON_EXISTENT_PATH_" + UUID.randomUUID().toString(); SaneClientAuthentication sca = new SaneClientAuthentication(filepath); sca.getCredentialForResource(null); }

Target:
public void testSaneClientAuthenticationWithMissingFileDoesNotFail() { String filepath = "NON_EXISTENT_PATH_" + UUID.randomUUID().toString(); SaneClientAuthentication sca = new SaneClientAuthentication(filepath); sca.getCredentialForResource(""); }