auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private static AbstractBeanDefinition throwAmbiguousCustomImplementationException(Collection<BeanDefinition> definitions) { List<String> implementationClassNames = new ArrayList<String>(); for (BeanDefinition bean : definitions) { implementationClassNames.add(bean.getBeanClassName()); } throw new IllegalStateException( String.format("Ambiguous custom implementations detected! Found %s but expected a single implementation!", StringUtils.collectionToCommaDelimitedString(implementationClassNames))); }

Target:
private static AbstractBeanDefinition throwAmbiguousCustomImplementationException( Collection<BeanDefinition> definitions) { List<String> implementationClassNames = new ArrayList<String>(); for (BeanDefinition bean : definitions) { implementationClassNames.add(bean.getBeanClassName()); } throw new IllegalStateException( String.format("Ambiguous custom implementations detected! Found %s but expected a single implementation!", definitions.stream() .map(BeanDefinition::getBeanClassName) .collect(Collectors.joining(", ")))); }
Source:
long getRetryDelayInMs() { int delayInMs = (int) Math.min(minSleepTime.toMillis() * Math.pow(scaleFactor, getAttempts() - 1), maxSleepTime.toMillis()); int jitter = ThreadLocalRandom.current().nextInt(Math.max(1, (int) (delayInMs * 0.1))); return delayInMs + jitter; }

Target:
long getRetryDelayInMs() { int delayInMs = (int) Math.min(minSleepTime.toMillis() * Math.pow(scaleFactor, attempts.get() - 1), maxSleepTime.toMillis()); int jitter = ThreadLocalRandom.current().nextInt(Math.max(1, (int) (delayInMs * 0.1))); return delayInMs + jitter; }
Source:
public void testReturnContainerCPULimitAndRequest() { float limit = Containers.getCpuLimit(container); float request = (Containers.getCpuRequest(container)); assertEquals(limit, CPU_LIMIT); assertEquals(request, CPU_REQUEST); }

Target:
public void testReturnContainerCPULimitAndRequest() { float limit = Containers.getCpuLimit(container); float request = Containers.getCpuRequest(container); assertEquals(limit, CPU_LIMIT); assertEquals(request, CPU_REQUEST); }
Source:
public Builder<T> withDeleteResolver(@NonNull DeleteResolver deleteResolver) { super.withDeleteResolver(deleteResolver); return this; }

Target:
public CompleteBuilder<T> withDeleteResolver(@NonNull DeleteResolver deleteResolver) { super.withDeleteResolver(deleteResolver); return this; }
Source:
public SourcePath getSwiftModuleOutputPath() { return ExplicitBuildTargetSourcePath.of(getBuildTarget(), Paths.get(outputPath.toString(), moduleName + ".swiftmodule")); }

Target:
public SourcePath getSwiftModuleOutputPath() { return ExplicitBuildTargetSourcePath.of(getBuildTarget(), modulePath); }
Source:
public void close() { closeQuietly(api); }

Target:
public void close() throws IOException { Closeables.close(api, true); }
Source:
protected void populateItemAccountingLines(Map parameterMap) { if (!(getDocument() instanceof PurchaseOrderAmendmentDocument)) { super.populateItemAccountingLines(parameterMap); return; } int itemCount = 0; for (PurApItem item : ((PurchasingAccountsPayableDocument) getDocument()).getItems()) { populateAccountingLine(item.getNewSourceLine(), KFSPropertyConstants.DOCUMENT + "." + KFSPropertyConstants.ITEM + "[" + itemCount + "]." + KFSPropertyConstants.NEW_SOURCE_LINE, parameterMap); int sourceLineCount = 0; for (PurApAccountingLine purApLine : item.getSourceAccountingLines()) { populateAccountingLine(purApLine, KFSPropertyConstants.DOCUMENT + "." + KFSPropertyConstants.ITEM + "[" + itemCount + "]." + KFSPropertyConstants.SOURCE_ACCOUNTING_LINE + "[" + sourceLineCount + "]", parameterMap); sourceLineCount += 1; } itemCount++; } }

Target:
protected void populateItemAccountingLines(Map parameterMap) { if (!(getDocument() instanceof PurchaseOrderAmendmentDocument)) { super.populateItemAccountingLines(parameterMap); return; } int itemCount = 0; for (PurApItem item : ((PurchasingAccountsPayableDocument) getDocument()).getItems()) { populateAccountingLine(item.getNewSourceLine(), KFSPropertyConstants.DOCUMENT + "." + KFSPropertyConstants.ITEM + "[" + itemCount + "]." + KFSPropertyConstants.NEW_SOURCE_LINE, parameterMap); int sourceLineCount = 0; for (PurApAccountingLine purApLine : item.getSourceAccountingLines()) { populateAccountingLine(purApLine, KFSPropertyConstants.DOCUMENT + "." + KFSPropertyConstants.ITEM + "[" + itemCount + "]." + KFSPropertyConstants.SOURCE_ACCOUNTING_LINE + "[" + sourceLineCount + "]", parameterMap); sourceLineCount += 1; } itemCount += 1; } }
Source:
protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException { final ServiceName serviceName = MessagingServices.getActiveMQServiceName(PathAddress.pathAddress(operation.get(ModelDescriptionConstants.OP_ADDR))); final ServiceName jmsServiceName = JMSServices.getJmsManagerBaseServiceName(serviceName); final PathAddress address = PathAddress.pathAddress(operation.require(OP_ADDR)); final String name = address.getLastElement().getValue(); ServiceController<?> service = context.getServiceRegistry(false).getService(jmsServiceName); JMSServerManager server = JMSServerManager.class.cast(service.getValue()); try { server.destroyQueue(name, true); } catch (Exception e) { throw new OperationFailedException(e); } context.removeService(JMSServices.getJmsQueueBaseServiceName(serviceName).append(name)); for (String entry : CommonAttributes.DESTINATION_ENTRIES.unwrap(context, model)) { final ContextNames.BindInfo bindInfo = ContextNames.bindInfoFor(entry); ServiceName binderServiceName = bindInfo.getBinderServiceName(); context.removeService(binderServiceName); } for (String legacyEntry: CommonAttributes.LEGACY_ENTRIES.unwrap(context, model)) { final ContextNames.BindInfo bindInfo = ContextNames.bindInfoFor(legacyEntry); ServiceName binderServiceName = bindInfo.getBinderServiceName(); context.removeService(binderServiceName); } }

Target:
protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException { final ServiceName serviceName = MessagingServices.getActiveMQServiceName(PathAddress.pathAddress(operation.get(ModelDescriptionConstants.OP_ADDR))); final ServiceName jmsServiceName = JMSServices.getJmsManagerBaseServiceName(serviceName); final PathAddress address = PathAddress.pathAddress(operation.require(OP_ADDR)); final String name = address.getLastElement().getValue(); ServiceController<?> service = context.getServiceRegistry(true).getService(jmsServiceName); JMSServerManager server = JMSServerManager.class.cast(service.getValue()); try { server.destroyQueue(JMS_QUEUE_PREFIX + name, true); } catch (Exception e) { throw new OperationFailedException(e); } context.removeService(JMSServices.getJmsQueueBaseServiceName(serviceName).append(name)); for (String entry : CommonAttributes.DESTINATION_ENTRIES.unwrap(context, model)) { final ContextNames.BindInfo bindInfo = ContextNames.bindInfoFor(entry); ServiceName binderServiceName = bindInfo.getBinderServiceName(); context.removeService(binderServiceName); } for (String legacyEntry: CommonAttributes.LEGACY_ENTRIES.unwrap(context, model)) { final ContextNames.BindInfo bindInfo = ContextNames.bindInfoFor(legacyEntry); ServiceName binderServiceName = bindInfo.getBinderServiceName(); context.removeService(binderServiceName); } }
Source:
private VariableTypeList filterDatasetVariables(final VariableTypeList variables, final boolean isMeasurementDataset) { final VariableTypeList newVariables = new VariableTypeList(); if (variables != null) { for (final DMSVariableType variable : variables.getVariableTypes()) { final boolean partOfHiddenDatasetColumns = DataSetBuilder.HIDDEN_DATASET_COLUMNS.contains(variable.getId()); final boolean isOccAndNurseryAndMeasurementDataset = variable.getId() == TermId.TRIAL_INSTANCE_FACTOR.getId() && isMeasurementDataset; final boolean isMeasurementDatasetAndIsTrialFactors = isMeasurementDataset && PhenotypicType.TRIAL_ENVIRONMENT == variable.getRole(); final boolean isTrialAndOcc = variable.getId() == TermId.TRIAL_INSTANCE_FACTOR.getId(); final boolean isTreatmentFactorDuplicate = variable.getVariableType() == null && !StringUtils.isEmpty(variable.getTreatmentLabel()); if (!partOfHiddenDatasetColumns && !isOccAndNurseryAndMeasurementDataset && !isMeasurementDatasetAndIsTrialFactors && !isTreatmentFactorDuplicate || isTrialAndOcc) { newVariables.add(variable); } } } return newVariables; }

Target:
protected VariableTypeList filterDatasetVariables(final VariableTypeList variables, final boolean isMeasurementDataset) { final VariableTypeList newVariables = new VariableTypeList(); if (variables != null) { for (final DMSVariableType variable : variables.getVariableTypes()) { final boolean partOfHiddenDatasetColumns = DataSetBuilder.HIDDEN_DATASET_COLUMNS.contains(variable.getId()); final boolean isOccAndNurseryAndMeasurementDataset = variable.getId() == TermId.TRIAL_INSTANCE_FACTOR.getId() && isMeasurementDataset; final boolean isMeasurementDatasetAndIsTrialFactors = isMeasurementDataset && PhenotypicType.TRIAL_ENVIRONMENT == variable.getRole(); final boolean isTrialAndOcc = variable.getId() == TermId.TRIAL_INSTANCE_FACTOR.getId(); final boolean isTreatmentFactorDuplicate = variable.getVariableType() == null && !StringUtils.isEmpty(variable.getTreatmentLabel()); if (!partOfHiddenDatasetColumns && !isOccAndNurseryAndMeasurementDataset && !isMeasurementDatasetAndIsTrialFactors && !isTreatmentFactorDuplicate || isTrialAndOcc) { newVariables.add(variable); } } } return newVariables; }
Source:
public boolean equals(Object other) { if (other == null) { return false; } if (this.getClass() != other.getClass()) { return false; } if (this == other) { return true; } if (!messageId.equals(other.toString())) { return false; } return true; }

Target:
public boolean equals(Object other) { if (other == null) { return false; } if (this.getClass() != other.getClass()) { return false; } if (this == other) { return true; } return messageId.equals(other.toString()); }
Source:
private WebElement getProjectExplorerItem(String path) { String locator = " return redrawUiElementsWait.until( ExpectedConditions.visibilityOfElementLocated(By.xpath(String.format(locator, path)))); }

Target:
private WebElement getProjectExplorerItem(String path) { return redrawUiElementsWait.until( ExpectedConditions.visibilityOfElementLocated( By.xpath(String.format(" }
Source:
public String next() { String result; try { result = ReplChangeManager.encodeFileUri(files.get(i), chksums != null ? chksums.get(i) : null, null); } catch (IOException e) { result = files.get(i); } i++; return result; }

Target:
public String next() { String result; try { result = ReplChangeManager.encodeFileUri(files.get(i), chksums != null ? chksums.get(i) : null, null); } catch (IOException e) { LOG.error("Encoding file URI failed with error " + e.getMessage()); throw new RuntimeException(e.getMessage()); } i++; return result; }
Source:
public void visitNode(Tree tree) { ClassTree classTree = (ClassTree)tree; if (isSerializable(classTree) && !SerializableContract.hasSpecialHandlingSerializationMethods(classTree)) { classTree.members().stream() .filter(member -> member.is(Tree.Kind.VARIABLE)) .filter(member -> !isStatic((VariableTree) member)) .filter(member -> !isTransient((VariableTree) member)) .filter(member -> isSerializableAndValueBased(((VariableTree) member).type().symbolType())) .forEach(member -> context.reportIssue( this, ((VariableTree) member).simpleName(), "Make this value-based field transient so it is not included in the serialization of this class.")); } }

Target:
public void visitNode(Tree tree) { ClassTree classTree = (ClassTree) tree; if (classTree.is(Tree.Kind.ANNOTATION_TYPE)) { classTree.members().stream() .map(member -> (MethodTree) member) .filter(meth -> isReturnTypeValueBased(meth)) .forEach(meth -> reportIssue(meth.simpleName(), MESSAGE)); } else if (isSerializable(classTree) && !SerializableContract.hasSpecialHandlingSerializationMethods(classTree)) { classTree.members().stream() .filter(ValueBasedObjectsShouldNotBeSerializedCheck::isVariable) .map(member -> (VariableTree) member) .filter(var -> !isStatic(var)) .filter(var -> !isTransient(var)) .filter(var -> isVarSerializableAndValueBased(var)) .forEach(var -> reportIssue(var.simpleName(), MESSAGE)); } }
Source:
public Map<Integer, String> retrieveStockIds(List<Integer> gIds) { Map<Integer, String> gIdStockIdMap = new HashMap<>(); String sql = "SELECT a.gid,group_concat(inventory_id SEPARATOR ', ') " + "FROM listdata a " + "inner join ims_lot b ON a.gid = b.eid " + "INNER JOIN ims_transaction c ON b.lotid = c.lotid and a.lrecid = c.recordid " + "WHERE a.gid in (:gIds) GROUP BY a.gid"; Query query = this.getSession().createSQLQuery(sql).setParameterList("gIds", gIds); List<Object[]> result = query.list(); for (Object[] row : result) { Integer lrecid = (Integer) row[0]; String stockIds = (String) row[1]; gIdStockIdMap.put(lrecid, stockIds); } return gIdStockIdMap; }

Target:
public Map<Integer, String> retrieveStockIds(List<Integer> gIds) { Map<Integer, String> gIdStockIdMap = new HashMap<>(); String sql = "SELECT a.gid,group_concat(inventory_id SEPARATOR ', ') " + "FROM listdata a " + "inner join ims_lot b ON a.gid = b.eid " + "INNER JOIN ims_transaction c ON b.lotid = c.lotid and a.lrecid = c.recordid " + "WHERE a.gid in (:gIds) GROUP BY a.gid"; Query query = this.getSession().createSQLQuery(sql).setParameterList("gIds", gIds); List<Object[]> result = query.list(); for (Object[] row : result) { Integer gid = (Integer) row[0]; String stockIds = (String) row[1]; gIdStockIdMap.put(gid, stockIds); } return gIdStockIdMap; }
Source:
public Object call(final List<String> keys, final List<String> args) throws IOException { final Jedis jedis = this.jedisPool.getResource(); try { return jedis.evalsha(SafeEncoder.encode(this.sha1(jedis)), keys, args); } finally { this.jedisPool.returnResource(jedis); } }

Target:
public Object call(final List<String> keys, final List<String> args) throws IOException { final Jedis jedis = this.jedisPool.getResource(); try { return jedis.evalsha(this.calculateSha1(jedis), keys, args); } finally { this.jedisPool.returnResource(jedis); } }
Source:
public String getSketchValue() { return Base64.encodeBase64String(sketchValue.getSketch().toByteArray()); }

Target:
public SketchHolder getSketchValue() { return sketchValue; }
Source:
public long getTokenExpiration(final String token) throws UnknownTokenException { long expiration = 0; try { validateToken(token); } catch (final UnknownTokenException e) { if (permissiveFailureEnabled && StringUtils .containsIgnoreCase(e.toString(), "Unknown token")) { return getJWTTokenExpiration(token); } else { throw e; } } try { char[] expStr = aliasService.getPasswordFromAliasForCluster(AliasService.NO_CLUSTER_NAME, token); if (expStr != null) { expiration = Long.parseLong(new String(expStr)); } } catch (Exception e) { log.errorAccessingTokenState(TokenUtils.getTokenDisplayText(token), e); } return expiration; }

Target:
public long getTokenExpiration(final String token) throws UnknownTokenException { long expiration = 0; try { validateToken(token); } catch (final UnknownTokenException e) { if (permissiveValidationEnabled && getJWTTokenExpiration(token).isPresent()) { return getJWTTokenExpiration(token).getAsLong(); } else { throw e; } } try { char[] expStr = aliasService.getPasswordFromAliasForCluster(AliasService.NO_CLUSTER_NAME, token); if (expStr != null) { expiration = Long.parseLong(new String(expStr)); } } catch (Exception e) { log.errorAccessingTokenState(TokenUtils.getTokenDisplayText(token), e); } return expiration; }
Source:
public String getFunctionName() { return "junitResults"; }

Target:
public String getFunctionName() { return "junit"; }
Source:
private Mono<Void> onConnect(WebsocketSession session) { LOGGER.info("Session connected: " + session); session .receive() .map(messageCodec::decode) .doOnNext(message -> metrics.markRequest()) .map(this::checkSid) .flatMap(msg -> handleCancel(session, msg)) .map(msg -> checkSidNonce(session, (GatewayMessage) msg)) .map(this::checkQualifier) .subscribe( request -> handleMessage(session, request), th -> { LOGGER.error("Exception occurred: {}, session={}", th, session.id()); if (th instanceof WebsocketRequestException) { WebsocketRequestException ex = (WebsocketRequestException) th; handleError(session, ex.releaseRequest().request().streamId(), th); } }); return session.onClose(() -> LOGGER.info("Session disconnected: " + session)); }

Target:
private Mono<Void> onConnect(WebsocketSession session) { LOGGER.info("Session connected: " + session); session .receive() .subscribe( byteBuf -> Mono.fromCallable(() -> messageCodec.decode(byteBuf)) .doOnNext(message -> metrics.markRequest()) .map(this::checkSid) .flatMap(msg -> handleCancel(session, msg)) .map(msg -> checkSidNonce(session, (GatewayMessage) msg)) .map(this::checkQualifier) .subscribe( request -> handleMessage(session, request), th -> { LOGGER.error("Exception occurred: {}, session={}", th, session.id()); if (th instanceof WebsocketRequestException) { WebsocketRequestException ex = (WebsocketRequestException) th; handleError(session, ex.releaseRequest().request().streamId(), th); } }), th -> LOGGER.error("Exception occurred on receiving from session {}", session, th)); return session.onClose(() -> LOGGER.info("Session disconnected: " + session)); }
Source:
static ParseEventuallyQueue getEventuallyQueue() { Context context = ParsePlugins.Android.get().applicationContext(); synchronized (MUTEX) { boolean isLocalDatastoreEnabled = Parse.isLocalDatastoreEnabled(); if (eventuallyQueue == null || (isLocalDatastoreEnabled && eventuallyQueue instanceof ParseCommandCache) || (!isLocalDatastoreEnabled && eventuallyQueue instanceof ParsePinningEventuallyQueue)) { checkContext(); eventuallyQueue = isLocalDatastoreEnabled ? new ParsePinningEventuallyQueue(context, ParsePlugins.get().restClient()) : new ParseCommandCache(context, ParsePlugins.get().restClient()); if (isLocalDatastoreEnabled && ParseCommandCache.getPendingCount() > 0) { new ParseCommandCache(context, ParsePlugins.get().restClient()); } } return eventuallyQueue; } }

Target:
static ParseEventuallyQueue getEventuallyQueue() { Context context = ParsePlugins.Android.get().applicationContext(); synchronized (MUTEX) { boolean isLocalDatastoreEnabled = Parse.isLocalDatastoreEnabled(); if (eventuallyQueue == null || (isLocalDatastoreEnabled && eventuallyQueue instanceof ParseCommandCache) || (!isLocalDatastoreEnabled && eventuallyQueue instanceof ParsePinningEventuallyQueue)) { checkContext(); ParseHttpClient httpClient = ParsePlugins.get().restClient(); eventuallyQueue = isLocalDatastoreEnabled ? new ParsePinningEventuallyQueue(context, httpClient) : new ParseCommandCache(context, httpClient); if (isLocalDatastoreEnabled && ParseCommandCache.getPendingCount() > 0) { new ParseCommandCache(context, httpClient); } } return eventuallyQueue; } }
Source:
public List<Predicate<ItemStackSnapshot>> getIngredientPredicates() { return recipeItems.stream() .map(ItemStackUtil::snapshotOf) .map(MatchCraftingVanillaItemStack::new) .collect(Collectors.toList()); }

Target:
public List<Predicate<ItemStackSnapshot>> getIngredientPredicates() { return this.recipeItems.stream() .map(ItemStackUtil::snapshotOf) .map(MatchCraftingVanillaItemStack::new) .collect(Collectors.toList()); }
Source:
public AccessTokenDto(AccessToken accessToken, String name) { super(accessToken.getToken(), accessToken.getType(), accessToken.getInitialValidSeconds(), accessToken.getValidUntil(), accessToken.getCreationTimestamp()); this.name = name; }

Target:
AccessTokenDto(AccessToken accessToken, String name) { super(accessToken.getToken(), accessToken.getType(), accessToken.getInitialValidSeconds(), accessToken.getValidUntil(), accessToken.getCreationTimestamp()); this.name = name; }
Source:
public void testPBEDetect() { int cipherJVMCount = 0; Set<String> keyFactories = new HashSet<String>(); Provider[] providers = Security.getProviders(); for (Provider p : providers) { for (Provider.Service service : p.getServices()) { if (service.getType().equals("SecretKeyFactory") && service.getAlgorithm().indexOf(' ') == -1) { keyFactories.add(service.getAlgorithm()); } } } for (Provider p : providers) { for (Provider.Service service : p.getServices()) { if (service.getType().equals("Cipher") && service.getAlgorithm().startsWith("PBE") && keyFactories.contains(service.getAlgorithm())) { cipherJVMCount++; } } } JavaEncryption encryption = new JavaEncryption(); HashMap detectedCiphers = encryption.detect(); assertEquals(cipherJVMCount, detectedCiphers.size()); }

Target:
public void testPBEDetect() { int cipherJVMCount = 0; Set<String> keyFactories = new HashSet<>(); Provider[] providers = Security.getProviders(); for (Provider p : providers) { for (Provider.Service service : p.getServices()) { if (service.getType().equals("SecretKeyFactory") && service.getAlgorithm().indexOf(' ') == -1) { keyFactories.add(service.getAlgorithm()); } } } for (Provider p : providers) { for (Provider.Service service : p.getServices()) { if (service.getType().equals("Cipher") && service.getAlgorithm().startsWith("PBE") && keyFactories.contains(service.getAlgorithm())) { cipherJVMCount++; } } } JavaEncryption encryption = new JavaEncryption(); HashMap detectedCiphers = encryption.detect(); assertTrue(detectedCiphers.size() > 0); assertEquals(cipherJVMCount, detectedCiphers.size()); }
Source:
public ResponseEntity validate(@RequestBody Map<String, String> params) { try { BaseCallbackRequestModel model = umpUtils.parseParamsToModel(params, BaseCallbackRequestModel.class); if (model.isSuccess()){ return ResponseEntity.ok().build(); } } catch (VerifyException | IOException ignored) { } return ResponseEntity.status(-1).build(); }

Target:
public ResponseEntity validate(@RequestBody Map<String, String> params) { try { BaseCallbackRequestModel model = umpUtils.parseParamsToModel(params, BaseCallbackRequestModel.class); if (model.isSuccess()){ return ResponseEntity.ok().build(); } } catch (VerifyException | IOException ignored) { } return ResponseEntity.badRequest().build(); }
Source:
public List<ResponseInfo> sendAndPoll(List<RequestInfo> requestsToSend, Set<Integer> requestsToDrop, int pollTimeoutMs) { if (closed || !selector.isOpen()) { throw new IllegalStateException("The NetworkClient is closed."); } long startTime = time.milliseconds(); List<ResponseInfo> responseInfoList = new ArrayList<>(); try { for (RequestInfo requestInfo : requestsToSend) { pendingRequests.add(new RequestMetadata(requestInfo)); } List<NetworkSend> sends = prepareSends(requestsToDrop, responseInfoList); replenishConnections(); dropInFlightRequests(requestsToDrop); selector.poll(pollTimeoutMs, sends); handleSelectorEvents(responseInfoList); } catch (Exception e) { logger.error("Received an unexpected error during sendAndPoll(): ", e); networkMetrics.networkClientException.inc(); } finally { numPendingRequests.set(pendingRequests.size()); networkMetrics.networkClientSendAndPollTime.update(time.milliseconds() - startTime, TimeUnit.MILLISECONDS); } return responseInfoList; }

Target:
public List<ResponseInfo> sendAndPoll(List<RequestInfo> requestsToSend, Set<Integer> requestsToDrop, int pollTimeoutMs) { if (closed || !selector.isOpen()) { throw new IllegalStateException("The NetworkClient is closed."); } long startTime = time.milliseconds(); List<ResponseInfo> responseInfoList = new ArrayList<>(); try { for (RequestInfo requestInfo : requestsToSend) { pendingRequests.add(new RequestMetadata(requestInfo)); } List<NetworkSend> sends = prepareSends(requestsToDrop, responseInfoList); replenishConnections(); for (Integer correlationId : requestsToDrop) { String connectionId = correlationIdInFlightToConnectionId.get(correlationId); if (connectionId != null) { selector.close(connectionId); } } selector.poll(pollTimeoutMs, sends); handleSelectorEvents(responseInfoList); } catch (Exception e) { logger.error("Received an unexpected error during sendAndPoll(): ", e); networkMetrics.networkClientException.inc(); } finally { numPendingRequests.set(pendingRequests.size()); networkMetrics.networkClientSendAndPollTime.update(time.milliseconds() - startTime, TimeUnit.MILLISECONDS); } return responseInfoList; }
Source:
public IProject[] getProjects() { IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); if (!object.isContainer()) { IFile file = root.getFileForLocation(object.getLocation()); return new IProject[] {file.getProject()}; } else { if (object instanceof GitModelTree) { IContainer container = root.getContainerForLocation(object.getLocation()); return new IProject[] {container.getProject()}; } else if (object instanceof HasProjects) return ((HasProjects) object).getProjects(); else return null; } }

Target:
public IProject[] getProjects() { IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); if (!object.isContainer()) { IFile file = root.getFileForLocation(object.getLocation()); return new IProject[] {file.getProject()}; } else { if (object instanceof GitModelTree) { IContainer container = root.getContainerForLocation(object.getLocation()); return new IProject[] {container.getProject()}; } else if (object instanceof GitModelWithProjects) return ((GitModelWithProjects) object).getProjects(); else return null; } }
Source:
public void endFormat(WikiFormat format) { if ((!format.getStyles().isEmpty()) || (!format.getParams().isEmpty())) { this.lastEndFormat = format; } }

Target:
public void endFormat(WikiFormat format) { if (!format.getStyles().isEmpty() || !format.getParams().isEmpty()) { this.lastEndFormat = format; } }
Source:
public byte[] openBytes(int no, byte[] buf, int x, int y, int w, int h) throws FormatException, IOException { FormatTools.checkPlaneParameters(this, no, buf.length, x, y, w, h); int vffIndex = no % vffs.length; RandomAccessInputStream vff = new RandomAccessInputStream(vffs[vffIndex]); try { if (headerSize[vffIndex] == 0) { skipHeader(vff); headerSize[vffIndex] = vff.getFilePointer(); } long planeSize = (long) FormatTools.getPlaneSize(this); vff.seek(headerSize[vffIndex] + planeSize * (no / vffs.length)); readPlane(vff, x, y, w, h, buf); byte[] row = new byte[(int) (w * (planeSize / (getSizeX() * getSizeY())))]; for (int yy=0; yy<h/2; yy++) { int topOffset = buf.length - (yy + 1) * row.length; int bottomOffset = yy * row.length; System.arraycopy(buf, bottomOffset, row, 0, row.length); System.arraycopy(buf, topOffset, buf, bottomOffset, row.length); System.arraycopy(row, 0, buf, topOffset, row.length); } return buf; } finally { vff.close(); } }

Target:
public byte[] openBytes(int no, byte[] buf, int x, int y, int w, int h) throws FormatException, IOException { FormatTools.checkPlaneParameters(this, no, buf.length, x, y, w, h); int vffIndex = no % vffs.length; try (RandomAccessInputStream vff = new RandomAccessInputStream(vffs[vffIndex])) { if (headerSize[vffIndex] == 0) { skipHeader(vff); headerSize[vffIndex] = vff.getFilePointer(); } long planeSize = (long) FormatTools.getPlaneSize(this); vff.seek(headerSize[vffIndex] + planeSize * (no / vffs.length)); readPlane(vff, x, y, w, h, buf); byte[] row = new byte[(int) (w * (planeSize / (getSizeX() * getSizeY())))]; for (int yy=0; yy<h/2; yy++) { int topOffset = buf.length - (yy + 1) * row.length; int bottomOffset = yy * row.length; System.arraycopy(buf, bottomOffset, row, 0, row.length); System.arraycopy(buf, topOffset, buf, bottomOffset, row.length); System.arraycopy(row, 0, buf, topOffset, row.length); } return buf; } }
Source:
private ZapMenuItem getMenuImportUrlGraphQl() { if (menuImportUrlGraphQl == null) { menuImportUrlGraphQl = new ZapMenuItem("graphql.topmenu.import.importremotegraphql"); menuImportUrlGraphQl.setToolTipText( Constant.messages.getString( "graphql.topmenu.import.importremotegraphql.tooltip")); final ExtensionGraphQl shadowCopy = this; menuImportUrlGraphQl.addActionListener( e -> View.getSingleton() .showMessageDialog( Constant.messages.getString( "graphql.importfromdialog.message"))); } return menuImportUrlGraphQl; }

Target:
private ZapMenuItem getMenuImportUrlGraphQl() { if (menuImportUrlGraphQl == null) { menuImportUrlGraphQl = new ZapMenuItem("graphql.topmenu.import.importremotegraphql"); menuImportUrlGraphQl.setToolTipText( Constant.messages.getString( "graphql.topmenu.import.importremotegraphql.tooltip")); menuImportUrlGraphQl.addActionListener( e -> View.getSingleton() .showMessageDialog( Constant.messages.getString( "graphql.importfromdialog.message"))); } return menuImportUrlGraphQl; }
Source:
public boolean isSupported(Node node) { this.file = this.getAbstractFileFromNode(node); EamDb eamDb = null; try { eamDb = EamDb.getInstance(); } catch (EamDbException ex) { LOGGER.log(Level.WARNING, "Non-critical failure: EamDb threw an exception while while testing existance.", ex); } if(eamDb == null){ return this.file != null && this.file.getSize() > 0; } else{ return this.file != null && this.file.getSize() > 0 && !getCorrelationAttributesFromNode(node).isEmpty(); } }

Target:
public boolean isSupported(Node node) { this.file = this.getAbstractFileFromNode(node); if(EamDb.isEnabled()){ return this.file != null && this.file.getSize() > 0 && !getCorrelationAttributesFromNode(node).isEmpty(); } else{ return this.file != null && this.file.getSize() > 0; } }
Source:
public JSLibModel getWorkingCopy() { if(workingCopy == null) { synchronized (this) { workingCopy = createCopy(getPreferenceModel()); } } return workingCopy; }

Target:
public synchronized JSLibModel getWorkingCopy() { if(workingCopy == null) { workingCopy = createCopy(getPreferenceModel()); } return workingCopy; }
Source:
private static LockAndTimestampServices getLockAndTimestampServices( MetricsManager metricsManager, Supplier<ServerListConfig> timelockServerListConfig, String userAgent) { LockService lockService = new ServiceCreator<>(metricsManager, LockService.class, userAgent) .applyDynamic(timelockServerListConfig); TimelockServerInterface rawTimelockService = new ServiceCreator<>(metricsManager, TimelockServerInterface.class, userAgent).applyDynamic(timelockServerListConfig); TimelockService timelockService = LeasingTimelockClient.create(rawTimelockService); TimestampManagementService timestampManagementService = new ServiceCreator<>(metricsManager, TimestampManagementService.class, userAgent) .applyDynamic(timelockServerListConfig); return ImmutableLockAndTimestampServices.builder() .lock(lockService) .timestamp(new TimelockTimestampServiceAdapter(timelockService)) .timestampManagement(timestampManagementService) .timelock(timelockService) .build(); }

Target:
private static LockAndTimestampServices getLockAndTimestampServices( MetricsManager metricsManager, Supplier<ServerListConfig> timelockServerListConfig, String userAgent) { LockService lockService = new ServiceCreator<>(metricsManager, LockService.class, userAgent) .applyDynamic(timelockServerListConfig); TimelockRpcClient timelockRpcClient = new ServiceCreator<>(metricsManager, TimelockRpcClient.class, userAgent).applyDynamic(timelockServerListConfig); TimelockService timelockService = LeasingTimelockClient.create(timelockRpcClient); TimestampManagementService timestampManagementService = new ServiceCreator<>(metricsManager, TimestampManagementService.class, userAgent) .applyDynamic(timelockServerListConfig); return ImmutableLockAndTimestampServices.builder() .lock(lockService) .timestamp(new TimelockTimestampServiceAdapter(timelockService)) .timestampManagement(timestampManagementService) .timelock(timelockService) .build(); }
Source:
public JaxbList<String> getConnectionIDs() { JaxbList<String> connections = new JaxbList<>(); try { connections.setList( service.getConnections().stream().map( x -> x.getName() ).collect( toList() ) ); } catch ( ConnectionServiceException e ) { logger.error( "Error " + e.getMessage() ); throw new WebApplicationException( Response.Status.INTERNAL_SERVER_ERROR ); } return connections; }

Target:
public JaxbList<String> getConnectionIDs() { List<String> connectionNames; try { connectionNames = service.getConnections().stream() .map( connection -> connection.getName() ) .collect( toList() ); } catch ( ConnectionServiceException e ) { logger.error( "Error " + e.getMessage() ); throw new WebApplicationException( Response.Status.INTERNAL_SERVER_ERROR ); } return new JaxbList<>( connectionNames ); }
Source:
public void closesAllParts() throws Exception { final String body = "RqMtFakeTest.closesAllParts"; final RqMultipart request = new RqMtFake( new RqFake(), new RqWithHeaders( new RqFake("", "", body), new FormattedText( "Content-Length: %s", body.getBytes().length ).asString(), "Content-Disposition: form-data; name=\"name\"" ), new RqWithHeaders( new RqFake("", "", body), "Content-Length: 0", "Content-Disposition: form-data; name=\"content\"; filename=\"a.bin\"" ) ); final String exmessage = "An IOException was expected since the Stream is closed"; final String name = "name"; final String content = "content"; final RqMtBase multi = new RqMtBase(request); multi.part(name).iterator().next().body().read(); multi.part(content).iterator().next().body().read(); multi.body().close(); MatcherAssert.assertThat( multi.part(name).iterator().next(), Matchers.notNullValue() ); try { multi.part(name).iterator().next().body().read(); Assert.fail(exmessage); } catch (final IOException ex) { MatcherAssert.assertThat( ex, new IsInstanceOf(ClosedChannelException.class) ); } MatcherAssert.assertThat( multi.part(content).iterator().next(), Matchers.notNullValue() ); try { multi.part(content).iterator().next().body().read(); Assert.fail(exmessage); } catch (final IOException ex) { MatcherAssert.assertThat( ex, new IsInstanceOf(ClosedChannelException.class) ); } }

Target:
public void closesAllParts() throws Exception { final String body = "RqMtFakeTest.closesAllParts"; final RqMultipart request = new RqMtFake( new RqFake(), new RqWithHeaders( new RqFake("", "", body), new FormattedText( RqMtFakeTest.CONTENT_LENGTH, body.getBytes().length ).asString(), new FormattedText( RqMtFakeTest.CONTENT_DISP, "name=\"name\"" ).asString() ), new RqWithHeaders( new RqFake("", "", body), new FormattedText( RqMtFakeTest.CONTENT_LENGTH, 0 ).asString(), new FormattedText( RqMtFakeTest.CONTENT_DISP, "name=\"content\"; filename=\"a.bin\"" ).asString() ) ); final String exmessage = "An IOException was expected since the Stream is closed"; final String name = "name"; final String content = "content"; final RqMtBase multi = new RqMtBase(request); multi.part(name).iterator().next().body().read(); multi.part(content).iterator().next().body().read(); multi.body().close(); MatcherAssert.assertThat( multi.part(name).iterator().next(), Matchers.notNullValue() ); try { multi.part(name).iterator().next().body().read(); Assert.fail(exmessage); } catch (final IOException ex) { MatcherAssert.assertThat( ex, new IsInstanceOf(ClosedChannelException.class) ); } MatcherAssert.assertThat( multi.part(content).iterator().next(), Matchers.notNullValue() ); try { multi.part(content).iterator().next().body().read(); Assert.fail(exmessage); } catch (final IOException ex) { MatcherAssert.assertThat( ex, new IsInstanceOf(ClosedChannelException.class) ); } }
Source:
private static int runCheckstyle(CliOptions cliOptions) throws CheckstyleException, FileNotFoundException { final Properties props; if (cliOptions.propertiesLocation == null) { props = System.getProperties(); } else { props = loadProperties(new File(cliOptions.propertiesLocation)); } final Configuration config = ConfigurationLoader.loadConfiguration( cliOptions.configLocation, new PropertiesExpander(props), cliOptions.omitIgnoredModules); final AuditListener listener = createListener(cliOptions.format, cliOptions.outputLocation); final int errorCounter; final ClassLoader moduleClassLoader = Checker.class.getClassLoader(); final RootModule rootModule = getRootModule(config.getName(), moduleClassLoader); try { rootModule.setModuleClassLoader(moduleClassLoader); rootModule.configure(config); rootModule.addListener(listener); errorCounter = rootModule.process(cliOptions.files); } finally { rootModule.destroy(); } return errorCounter; }

Target:
private static int runCheckstyle(CliOptions cliOptions) throws CheckstyleException, FileNotFoundException { final Properties props; if (cliOptions.propertiesLocation == null) { props = System.getProperties(); } else { props = loadProperties(new File(cliOptions.propertiesLocation)); } final Configuration config = ConfigurationLoader.loadConfiguration( cliOptions.configLocation, new PropertiesExpander(props), !cliOptions.executeIgnoredModules); final AuditListener listener = createListener(cliOptions.format, cliOptions.outputLocation); final int errorCounter; final ClassLoader moduleClassLoader = Checker.class.getClassLoader(); final RootModule rootModule = getRootModule(config.getName(), moduleClassLoader); try { rootModule.setModuleClassLoader(moduleClassLoader); rootModule.configure(config); rootModule.addListener(listener); errorCounter = rootModule.process(cliOptions.files); } finally { rootModule.destroy(); } return errorCounter; }
Source:
protected void markImagesIllegalIfNotInDb(VM vm) { List<DiskImage> imagesInDb = getDiskImageDao().getAllSnapshotsForVmSnapshot(getParameters().getSnapshotId()); Map<Guid, DiskImage> imagesInDbMap = ImagesHandler.getDiskImagesByIdMap(imagesInDb); for (DiskImage fromConfigImg : vm.getImages()) { if (!imagesInDbMap.containsKey(fromConfigImg.getId())) { log.info(String.format("Image %1$s of Disk %2$s cannot be found in database. This image will be returned as ILLEGAL from the query", fromConfigImg.getId(), fromConfigImg.getDisk().getId())); fromConfigImg.setimageStatus(ImageStatus.ILLEGAL); } } }

Target:
protected void markImagesIllegalIfNotInDb(VM vm) { List<DiskImage> imagesInDb = getDiskImageDao().getAllSnapshotsForVmSnapshot(getParameters().getSnapshotId()); Map<Guid, DiskImage> imagesInDbMap = ImagesHandler.getDiskImagesByIdMap(imagesInDb); for (DiskImage fromConfigImg : vm.getImages()) { if (!imagesInDbMap.containsKey(fromConfigImg.getId())) { log.debugFormat("Image {0} of Disk {1} cannot be found in database. This image will be returned as ILLEGAL from the query", fromConfigImg.getId(), fromConfigImg.getDisk().getId()); fromConfigImg.setimageStatus(ImageStatus.ILLEGAL); } } }
Source:
public MysqlTableReader(MysqlSource source, String username, String password, TableInfoProvider tableInfoProvider, int bufSize) throws SQLException { _bufSize = bufSize; _source = source; _username = username; _password = password; _columnInfo = tableInfoProvider.getColumnList(source.getDatabaseName(), source.getTableName()); _conn = MysqlQueryUtils.initMysqlConn(source.getHostName(), source.getPort(), username, password); _conn.setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED); _stmt = _conn.createStatement(); String fullyQualifiedTableName = String.format("%s.%s", source.getDatabaseName(), source.getTableName()); _stmt.executeUpdate(new SqlStringBuilder().append("HANDLER ") .append(fullyQualifiedTableName) .append(" OPEN AS ") .appendIdent(source.getTableName(), "Iterator") .toString()); _rs = _stmt.executeQuery(new SqlStringBuilder().append("HANDLER ") .appendIdent(source.getTableName(), "Iterator") .append(" READ `PRIMARY` FIRST LIMIT ") .append(_bufSize) .toString()); _next = false; _closed = false; _needToClose = false; }

Target:
public MysqlTableReader(MysqlSource source, String username, String password, TableInfoProvider tableInfoProvider, int bufSize) throws SQLException { _bufSize = bufSize; _source = source; _username = username; _password = password; _columnInfo = tableInfoProvider.getColumnList(source.getDatabaseName(), source.getTableName()); _conn = MysqlQueryUtils.initMysqlConn(source.getHostName(), source.getPort(), username, password); _conn.setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED); _stmt = _conn.createStatement(); String fullyQualifiedTableName = String.format("%s.%s", source.getDatabaseName(), source.getTableName()); _stmt.executeUpdate(new SqlStringBuilder().append("HANDLER ") .append(fullyQualifiedTableName) .append(" OPEN AS ") .appendIdent(source.getTableName(), "Iterator") .toString()); _rs = _stmt.executeQuery(new SqlStringBuilder().append("HANDLER ") .appendIdent(source.getTableName(), "Iterator") .append(" READ `PRIMARY` FIRST LIMIT ") .append(_bufSize) .toString()); _next = false; _closed = false; _isEof = false; }
Source:
private Set<String> getSchemaSQLServerNames(DatabaseMetaData metaData) throws SQLException { Set<String> schemas = new HashSet<>(); ResultSet rs = metaData.getTables(_catalogName, null, null, JdbcUtils.getTableTypesAsStrings(_tableTypes)); while (rs.next()) { schemas.add(rs.getString("TABLE_SCHEM")); } if(rs != null){ rs.close(); } return schemas; }

Target:
private Set<String> getSchemaSQLServerNames(DatabaseMetaData metaData) throws SQLException { Set<String> schemas = new HashSet<>(); ResultSet rs = null; try { rs = metaData.getTables(_catalogName, null, null, JdbcUtils.getTableTypesAsStrings(_tableTypes)); while (rs.next()) { schemas.add(rs.getString("TABLE_SCHEM")); } }finally { FileHelper.safeClose(rs); } return schemas; }
Source:
protected List<String> doTokenize(String line) { Assert.state(null != delimiter && 0 != delimiter.length()); List<String> tokens = new ArrayList<String>(); char[] chars = line.toCharArray(); boolean inQuoted = false; int lastCut = 0; int length = chars.length; int fieldCount = 0; int endIndexLastDelimiter = -1; for (int i = 0; i < length; i++) { char currentChar = chars[i]; boolean isEnd = (i == (length - 1)); boolean isDelimiter = isDelimiter(chars, i, delimiter, endIndexLastDelimiter); if ((isDelimiter && !inQuoted) || isEnd) { endIndexLastDelimiter = i; int endPosition = (isEnd ? (length - lastCut) : (i - lastCut)); if (isEnd && isDelimiter) { endPosition = endPosition - delimiter.length(); } else if (!isEnd){ endPosition = (endPosition - delimiter.length()) + 1; } if (includedFields == null || includedFields.contains(fieldCount)) { String value = maybeStripQuotes(new String(chars, lastCut, endPosition)); tokens.add(value); } fieldCount++; if (isEnd && (isDelimiter)) { if (includedFields == null || includedFields.contains(fieldCount)) { tokens.add(""); } fieldCount++; } lastCut = i + 1; } else if (isQuoteCharacter(currentChar)) { inQuoted = !inQuoted; } } return tokens; }

Target:
protected List<String> doTokenize(String line) { List<String> tokens = new ArrayList<String>(); char[] chars = line.toCharArray(); boolean inQuoted = false; int lastCut = 0; int length = chars.length; int fieldCount = 0; int endIndexLastDelimiter = -1; for (int i = 0; i < length; i++) { char currentChar = chars[i]; boolean isEnd = (i == (length - 1)); boolean isDelimiter = isDelimiter(chars, i, delimiter, endIndexLastDelimiter); if ((isDelimiter && !inQuoted) || isEnd) { endIndexLastDelimiter = i; int endPosition = (isEnd ? (length - lastCut) : (i - lastCut)); if (isEnd && isDelimiter) { endPosition = endPosition - delimiter.length(); } else if (!isEnd){ endPosition = (endPosition - delimiter.length()) + 1; } if (includedFields == null || includedFields.contains(fieldCount)) { String value = maybeStripQuotes(new String(chars, lastCut, endPosition)); tokens.add(value); } fieldCount++; if (isEnd && (isDelimiter)) { if (includedFields == null || includedFields.contains(fieldCount)) { tokens.add(""); } fieldCount++; } lastCut = i + 1; } else if (isQuoteCharacter(currentChar)) { inQuoted = !inQuoted; } } return tokens; }
Source:
protected void updateProductContentMappings(ProductData pdata) { if (pdata == null) { throw new IllegalArgumentException("pdata is null"); } if (pdata.getId() == null || pdata.getId().matches("\\A\\s*\\z")) { throw new IllegalArgumentException("product lacks identifying information: " + pdata); } Set<String> cids = new HashSet<>(); if (pdata.getProductContent() != null) { for (ProductContentData pcdata : pdata.getProductContent()) { if (pcdata != null) { ContentData cdata = pcdata.getContent(); if (cdata != null && cdata.getId() != null) { cids.add(cdata.getId()); } } } } for (String cid : cids) { if (!this.contentMap.containsKey(cid)) { throw new IllegalStateException("unknown/unexpected content id: " + cid); } if (!this.contentProductMap.containsKey(cid)) { throw new IllegalStateException("content=>product map lacks table for content: " + cid); } } for (Map.Entry<String, Set<String>> entry : this.contentProductMap.entrySet()) { String cid = entry.getKey(); Set<String> pids = entry.getValue(); if (cids.contains(cid)) { pids.add(pdata.getId()); } else { pids.remove(pdata.getId()); } } }

Target:
protected void updateProductContentMappings(ProductData pdata) { if (pdata == null) { throw new IllegalArgumentException("pdata is null"); } if (StringUtils.isBlank(pdata.getId())) { throw new IllegalArgumentException("product lacks identifying information: " + pdata); } Set<String> cids = new HashSet<>(); if (pdata.getProductContent() != null) { for (ProductContentData pcdata : pdata.getProductContent()) { if (pcdata != null) { ContentData cdata = pcdata.getContent(); if (cdata != null && cdata.getId() != null) { cids.add(cdata.getId()); } } } } for (String cid : cids) { if (!this.contentMap.containsKey(cid)) { throw new IllegalStateException("unknown/unexpected content id: " + cid); } if (!this.contentProductMap.containsKey(cid)) { throw new IllegalStateException("content=>product map lacks table for content: " + cid); } } for (Map.Entry<String, Set<String>> entry : this.contentProductMap.entrySet()) { String cid = entry.getKey(); Set<String> pids = entry.getValue(); if (cids.contains(cid)) { pids.add(pdata.getId()); } else { pids.remove(pdata.getId()); } } }
Source:
protected void close() { try { m_sout.flush(); m_sout.close(); } catch (IOException ex) { } }

Target:
protected void close() { try { m_sout.close(); } catch (IOException ex) { } }
Source:
PaxosLeaderElectionService(PaxosProposer proposer, PaxosLearner knowledge, Map<PingableLeader, HostAndPort> otherPotentialLeadersToHosts, List<PaxosAcceptor> acceptors, List<PaxosLearner> learners, Function<String, ExecutorService> executorServiceFactory, long updatePollingWaitInMs, long randomWaitBeforeProposingLeadership, long noQuorumMaxDelay, long leaderPingResponseWaitMs, PaxosLeaderElectionEventRecorder eventRecorder, Supplier<Boolean> onlyLogOnQuorumFailure) { this.proposer = proposer; this.knowledge = knowledge; this.otherPotentialLeadersToHosts = Collections.unmodifiableMap(otherPotentialLeadersToHosts); this.acceptors = ImmutableList.copyOf(acceptors); this.learners = ImmutableList.copyOf(learners); this.leaderPingExecutors = createLeaderPingExecutors(otherPotentialLeadersToHosts, executorServiceFactory); this.knowledgeUpdatingExecutors = createKnowledgeUpdateExecutors(learners, executorServiceFactory); this.updatePollingRateInMs = updatePollingWaitInMs; this.randomWaitBeforeProposingLeadership = randomWaitBeforeProposingLeadership; this.noQuorumMaxDelay = noQuorumMaxDelay; this.leaderPingResponseWaitMs = leaderPingResponseWaitMs; lock = new ReentrantLock(); this.eventRecorder = eventRecorder; this.latestRoundVerifier = new CoalescingPaxosLatestRoundVerifier( new PaxosLatestRoundVerifierImpl( acceptors, proposer.getQuorumSize(), createLatestRoundVerifierExecutors(acceptors, executorServiceFactory), onlyLogOnQuorumFailure)); }

Target:
PaxosLeaderElectionService(PaxosProposer proposer, PaxosLearner knowledge, Map<PingableLeader, HostAndPort> otherPotentialLeadersToHosts, List<PaxosAcceptor> acceptors, List<PaxosLearner> learners, Function<String, ExecutorService> executorServiceFactory, long updatePollingWaitInMs, long randomWaitBeforeProposingLeadership, long noQuorumMaxDelay, long leaderPingResponseWaitMs, PaxosLeaderElectionEventRecorder eventRecorder, Supplier<Boolean> onlyLogOnQuorumFailure) { this.proposer = proposer; this.knowledge = knowledge; this.otherPotentialLeadersToHosts = Collections.unmodifiableMap(otherPotentialLeadersToHosts); this.acceptors = ImmutableList.copyOf(acceptors); this.learners = ImmutableList.copyOf(learners); this.leaderPingExecutors = createLeaderPingExecutors(otherPotentialLeadersToHosts, executorServiceFactory); this.knowledgeUpdatingExecutors = createKnowledgeUpdateExecutors(learners, executorServiceFactory); this.updatePollingRateInMs = updatePollingWaitInMs; this.randomWaitBeforeProposingLeadership = randomWaitBeforeProposingLeadership; this.noQuorumMaxDelay = noQuorumMaxDelay; this.leaderPingResponseWaitMs = leaderPingResponseWaitMs; this.eventRecorder = eventRecorder; this.latestRoundVerifier = new CoalescingPaxosLatestRoundVerifier( new PaxosLatestRoundVerifierImpl( acceptors, proposer.getQuorumSize(), createLatestRoundVerifierExecutors(acceptors, executorServiceFactory), onlyLogOnQuorumFailure)); }