auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static void beforeClass() throws Exception { PrintWriter writer = new PrintWriter(new File(PqsConfiguration.DEFAULT_PHOENIX_PQS_FILE_SINK_FILENAME)); writer.print(""); writer.close(); fileReader = new FileReader(PqsConfiguration.DEFAULT_PHOENIX_PQS_FILE_SINK_FILENAME); CONF = getTestClusterConfig(); assertTrue("no log message in the file ", checkIfTempFileIsEmpty()); CONF.setInt(QueryServices.QUERY_SERVER_HTTP_PORT_ATTRIB, 0); String url = getUrl(); AVATICA_SERVER = new QueryServerThread(new String[] { url }, CONF, QueryServerBasicsIT.class.getName()); AVATICA_SERVER.start(); AVATICA_SERVER.getQueryServer().awaitRunning(); final int port = AVATICA_SERVER.getQueryServer().getPort(); LOG.info("Avatica server started on port " + port); CONN_STRING = ThinClientUtil.getConnectionUrl("localhost", port); LOG.info("JDBC connection string is " + CONN_STRING); }

Target:
public static void beforeClass() throws Exception { CONF = getTestClusterConfig(); if (!testRootDir.exists()) { testRootDir.mkdir(); } Files.deleteIfExists(pqsSinkFile.toPath()); Files.createFile(pqsSinkFile.toPath()); CONF.set(PHOENIX_PQS_FILE_SINK_FILENAME, pqsSinkFile.getCanonicalPath()); CONF.setInt(PHOENIX_PQS_METRIC_REPORTING_INTERVAL_MS,2000); boolean noMetrics = checkFileContainsMetricsData(global) && checkFileContainsMetricsData(overAllReadRequestMetrics) && checkFileContainsMetricsData(requestReadMetrics) && checkFileContainsMetricsData(writeMetricsMut); assertFalse(" metrics file should have no metrics", noMetrics); CONF.setInt(QueryServices.QUERY_SERVER_HTTP_PORT_ATTRIB, 0); String url = getUrl(); AVATICA_SERVER = new QueryServerThread(new String[] { url }, CONF, QueryServerBasicsIT.class.getName()); AVATICA_SERVER.start(); AVATICA_SERVER.getQueryServer().awaitRunning(); final int port = AVATICA_SERVER.getQueryServer().getPort(); LOG.info("Avatica server started on port " + port); CONN_STRING = ThinClientUtil.getConnectionUrl("localhost", port); LOG.info("JDBC connection string is " + CONN_STRING); }
Source:
public RexNode eliminateCommonExprInCondition(RexNode node) { if (!(node instanceof RexCall)) { return node; } List<RexNode> operands = ((RexCall) node).getOperands(); List<RexNode> simplifiedChildren = operands.stream() .map(this::eliminateCommonExprInCondition) .collect(Collectors.toList()); switch (node.getKind()) { case AND: { List<List<RexNode>> disjunctions = simplifiedChildren.stream() .map(RelOptUtil::disjunctions) .collect(Collectors.toList()); List<RexNode> common = new ArrayList<>(disjunctions.get(0)); disjunctions.forEach(common::retainAll); if (common.isEmpty()) { return and(simplifiedChildren); } disjunctions.forEach(p -> p.removeAll(common)); if (disjunctions.stream().anyMatch(List::isEmpty)) { return or(common); } List<RexNode> splice = disjunctions.stream() .map(this::or) .collect(Collectors.toList()); return or(or(common), and(splice)); } case OR: { List<List<RexNode>> conjunctions = simplifiedChildren.stream() .map(RelOptUtil::conjunctions) .collect(Collectors.toList()); List<RexNode> common = new ArrayList<>(conjunctions.get(0)); conjunctions.forEach(common::retainAll); if (common.isEmpty()) { return or(simplifiedChildren); } conjunctions.forEach(p -> p.removeAll(common)); if (conjunctions.stream().anyMatch(List::isEmpty)) { return and(common); } List<RexNode> splice = conjunctions.stream() .map(this::and) .collect(Collectors.toList()); return and(and(common), or(splice)); } default: return node; } }

Target:
public RexNode eliminateCommonExprInCondition(RexNode node) { if (node.getKind() != SqlKind.AND && node.getKind() != SqlKind.OR) { return node; } List<RexNode> operands = ((RexCall) node).getOperands(); List<RexNode> simplifiedChildren = operands.stream() .map(this::eliminateCommonExprInCondition) .collect(Collectors.toList()); switch (node.getKind()) { case AND: { List<Set<RexNode>> disjunctions = simplifiedChildren.stream() .map(RelOptUtil::disjunctionSet) .collect(Collectors.toList()); Set<RexNode> common = new HashSet<>(disjunctions.get(0)); disjunctions.forEach(common::retainAll); if (common.isEmpty()) { return and(simplifiedChildren); } disjunctions.forEach(p -> p.removeAll(common)); if (disjunctions.stream().anyMatch(Collection::isEmpty)) { return or(common); } List<RexNode> splice = disjunctions.stream() .map(this::or) .collect(Collectors.toList()); return or(or(common), and(splice)); } case OR: { List<Set<RexNode>> conjunctions = simplifiedChildren.stream() .map(RelOptUtil::conjunctionSet) .collect(Collectors.toList()); Set<RexNode> common = new HashSet<>(conjunctions.get(0)); conjunctions.forEach(common::retainAll); if (common.isEmpty()) { return or(simplifiedChildren); } conjunctions.forEach(p -> p.removeAll(common)); if (conjunctions.stream().anyMatch(Collection::isEmpty)) { return and(common); } List<RexNode> splice = conjunctions.stream() .map(this::and) .collect(Collectors.toList()); return and(and(common), or(splice)); } default: return node; } }
Source:
public static long folderSize(File directory, final OnProgressUpdate<Long[]> updateState, Long[] spaces) { long length = 0; try { for (File file:directory.listFiles()) { if (file.isFile()) { spaces[2] += file.length(); length += file.length();} else length += folderSize(file, updateState, spaces); } } catch (Exception e) { e.printStackTrace(); } if(updateState != null) updateState.onUpdate(spaces); return length; }

Target:
public static long folderSize(File directory, final OnProgressUpdate<Long[]> updateState, Long[] spaces) { long length = 0; try { for (File file:directory.listFiles()) { if (file.isFile()) { spaces[2] += file.length(); length += file.length(); }else { length += folderSize(file, updateState, spaces); } } } catch (Exception e) { e.printStackTrace(); } if(updateState != null) updateState.onUpdate(spaces); return length; }
Source:
public boolean attemptLogin() { boolean validRepoId = RepoId.isWellFormedRepoIdString(owner + "/" + repo) && !username.isEmpty() && !password.isEmpty(); boolean loginSuccessful = login(username, password); if (validRepoId && loginSuccessful) { logic.prefs.setLastLoginCredentials(username, password); return true; } return false; }

Target:
public boolean attemptLogin() { boolean isValidRepoId = RepoId.isValidRepoId(owner + "/" + repo) && !username.isEmpty() && !password.isEmpty(); boolean loginSuccessful = login(username, password); if (isValidRepoId && loginSuccessful) { logic.prefs.setLastLoginCredentials(username, password); return true; } return false; }
Source:
public void execute(CommandContext context) { Map<String, String> hostGroups = context.getAppConfig().getHostGroups(); AdminManager adminManager = context.getAdminManager(); HostManager mgr = new HostManager(context.getManageClient()); for (Map.Entry<String, String> entry : hostGroups.entrySet()) { String hostName = entry.getKey(); String groupName = entry.getValue(); ServerManager serverMgr = new ServerManager(context.getManageClient(), groupName); try { String serverResponse = serverMgr.getPropertiesAsJson(MANAGE_SERVER_NAME, "group-id="+groupName); System.out.println("serverResponse: " + serverResponse); } catch (Exception e) { if (e.getMessage().contains("404 Not Found")) { String manageServerPayload = format(MANAGE_SERVER_JSON_TEMPLATE, MANAGE_SERVER_NAME, groupName); serverMgr.save(manageServerPayload); } else { logger.error("Error checking for Manage server in target group: " + e.getMessage()); throw e; } } mgr.setHostToGroup(hostName, groupName); adminManager.waitForRestart(); } }

Target:
public void execute(CommandContext context) { context.getAdminManager().invokeActionRequiringRestart(() -> assignHostsToGroups(context)); }
Source:
public CompletableFuture<Void> visitPutKeyValueCommand(InvocationContext ctx, PutKeyValueCommand command) throws Throwable { ctx.onReturn(writeSkewReturnHandler); if (streamSummaryContainer.isEnabled() && ctx.isOriginLocal()) { streamSummaryContainer.addPut(command.getKey(), isRemote(command.getKey())); } return ctx.continueInvocation(); }

Target:
public CompletableFuture<Void> visitPutKeyValueCommand(InvocationContext ctx, PutKeyValueCommand command) throws Throwable { if (streamSummaryContainer.isEnabled() && ctx.isOriginLocal()) { streamSummaryContainer.addPut(command.getKey(), isRemote(command.getKey())); } return ctx.onReturn(writeSkewReturnHandler); }
Source:
public void run() { final long oldTimeStamp = lastMeasuredTimestamp; lastMeasuredTimestamp = System.currentTimeMillis(); final boolean clusterOverloaded = isClusterOverloaded(); final boolean clusterIdle = isClusterIdle(); if (clusterOverloaded) { overloadedTimeElapsed += lastMeasuredTimestamp - oldTimeStamp; if (overloadedTimeElapsed > scaleOutGracePeriod && taskStatsMap.getTaskList().size() < maxTaskNum) { overloadedTimeElapsed = 0; return; } } else { overloadedTimeElapsed = 0; } if (clusterIdle) { idleTimeElapsed += lastMeasuredTimestamp - oldTimeStamp; if (idleTimeElapsed > scaleInGracePeriod && taskStatsMap.getTaskList().size() > minTaskNum) { LOG.log(Level.INFO, "Start scaling-in..."); final String minimalLoadedTask = taskStatsMap.getMinimumLoadTask(); try { final boolean scaleInSuccess = scaleInManager.scaleIn(minimalLoadedTask); if (!scaleInSuccess) { throw new RuntimeException("Automatic scale-in failed! - Task cannot be found"); } } catch (final Exception e) { e.printStackTrace(); } idleTimeElapsed = 0; } } else { idleTimeElapsed = 0; } }

Target:
public void run() { final long oldTimeStamp = lastMeasuredTimestamp; lastMeasuredTimestamp = System.currentTimeMillis(); final boolean clusterOverloaded = isClusterOverloaded(); final boolean clusterIdle = isClusterIdle(); if (clusterOverloaded) { overloadedTimeElapsed += lastMeasuredTimestamp - oldTimeStamp; if (overloadedTimeElapsed > scaleOutGracePeriod && taskStatsMap.getTaskList().size() < maxTaskNum) { overloadedTimeElapsed = 0; return; } } else { overloadedTimeElapsed = 0; } if (clusterIdle) { idleTimeElapsed += lastMeasuredTimestamp - oldTimeStamp; if (idleTimeElapsed > scaleInGracePeriod && taskStatsMap.getTaskList().size() > minTaskNum) { LOG.log(Level.INFO, "Start scaling-in..."); try { final boolean scaleInSuccess = scaleInManager.scaleIn(); if (!scaleInSuccess) { throw new RuntimeException("Automatic scale-in failed! - Task cannot be found"); } } catch (final Exception e) { e.printStackTrace(); } idleTimeElapsed = 0; } } else { idleTimeElapsed = 0; } }
Source:
public String toString() { return "ChronicleLogTailer{" + "basePath='" + basePath + '\'' + ", id=" + id + ", closed=" + closed + '}'; }

Target:
public String toString() { return "ChronicleLogTailer{" + "basePath='" + basePath + '\'' + ", id=" + id + ", closed=" + closed + ", codec=" + codec + '}'; }
Source:
private EquivalenceUpdatingWorker equivUpdatingWorker() { return new EquivalenceUpdatingWorker( contentResolver, lookupStore, equivalenceResultStore, equivUpdater, Predicates.or(ImmutableList.<Predicate<? super Content>>of( sourceIsIn( BBC_REDUX, YOUVIEW, YOUVIEW_STAGE, YOUVIEW_BT, YOUVIEW_BT_STAGE, BETTY, BT_TVE_VOD, BT_VOD ), Predicates.and( Predicates.instanceOf(Container.class), sourceIsIn( BBC, C4_PMLSD, ITV, FIVE, BBC_REDUX, ITUNES, RADIO_TIMES, LOVEFILM, TALK_TALK, YOUVIEW, NETFLIX, BBC_NITRO ) ) )) ); }

Target:
private EquivalenceUpdatingWorker equivUpdatingWorker() { return new EquivalenceUpdatingWorker( contentResolver, lookupStore, equivalenceResultStore, equivUpdater, Predicates.or(ImmutableList.<Predicate<? super Content>>of( sourceIsIn( BBC_REDUX, YOUVIEW, YOUVIEW_STAGE, YOUVIEW_BT, YOUVIEW_BT_STAGE, BETTY, BT_TVE_VOD, BT_VOD, BBC_NITRO ), Predicates.and( Predicates.instanceOf(Container.class), sourceIsIn( BBC, C4_PMLSD, ITV, FIVE, BBC_REDUX, ITUNES, RADIO_TIMES, LOVEFILM, TALK_TALK, YOUVIEW, NETFLIX, BBC_NITRO ) ) )) ); }
Source:
public ServiceBusSenderAsyncClient buildAsyncClient() { final ServiceBusConnectionProcessor connectionProcessor = getOrCreateConnectionProcessor(messageSerializer); final MessagingEntityType entityType = validateEntityPaths(logger, connectionStringEntityName, topicName, queueName); if (!CoreUtils.isNullOrEmpty(viaQueueName) && !CoreUtils.isNullOrEmpty(topicName)) { throw logger.logExceptionAsError(new IllegalArgumentException(String.format( "(%s), Via queue feature work only with a queue.", viaQueueName))); } final String entityName; switch (entityType) { case QUEUE: entityName = queueName; break; case SUBSCRIPTION: entityName = topicName; break; case UNKNOWN: entityName = connectionStringEntityName; break; default: throw logger.logExceptionAsError( new IllegalArgumentException("Unknown entity type: " + entityType)); } return new ServiceBusSenderAsyncClient(entityName, viaQueueName, entityType, connectionProcessor, retryOptions, tracerProvider, messageSerializer, ServiceBusClientBuilder.this::onClientClose); }

Target:
public ServiceBusSenderAsyncClient buildAsyncClient() { final ServiceBusConnectionProcessor connectionProcessor = getOrCreateConnectionProcessor(messageSerializer); final MessagingEntityType entityType = validateEntityPaths(logger, connectionStringEntityName, topicName, queueName); if (!CoreUtils.isNullOrEmpty(viaQueueName) && entityType == MessagingEntityType.SUBSCRIPTION) { throw logger.logExceptionAsError(new IllegalStateException(String.format( "(%s), Via queue feature work only with a queue.", viaQueueName))); } final String entityName; switch (entityType) { case QUEUE: entityName = queueName; break; case SUBSCRIPTION: entityName = topicName; break; case UNKNOWN: entityName = connectionStringEntityName; break; default: throw logger.logExceptionAsError( new IllegalArgumentException("Unknown entity type: " + entityType)); } return new ServiceBusSenderAsyncClient(entityName, entityType, connectionProcessor, retryOptions, tracerProvider, messageSerializer, ServiceBusClientBuilder.this::onClientClose, viaQueueName); }
Source:
protected Constructor<A> getEntityConstructor() { if (this.entityConstructor == null) { final Constructor<A> result = getConstructor(entityClass, idClass); return result; } return this.entityConstructor; }

Target:
protected Constructor<A> getEntityConstructor() { if (this.entityConstructor == null) { final Constructor<A> result = getAggregateConstructor(); return result; } return this.entityConstructor; }
Source:
public void testConsumerConfig() { Properties props = new Properties(); props.put("consumer.someProperty", "someValue"); props.put("consumer.someProperty1", "someValue1"); props.put("consumer.someProperty2", "someValue2"); KafkaBasedConnectorConfig config = new KafkaBasedConnectorConfig(props); Properties actualProps = config.getConsumerProps(); Properties taskProps = new Properties(); taskProps.putAll(actualProps); Assert.assertNotNull(taskProps); Assert.assertEquals(taskProps.getProperty("someProperty"), "someValue"); Assert.assertEquals(taskProps.getProperty("someProperty1"), "someValue1"); Assert.assertEquals(taskProps.getProperty("someProperty2"), "someValue2"); }

Target:
public void testConsumerConfig() { Properties props = new Properties(); props.put("consumer.someProperty", "someValue"); props.put("consumer.someProperty1", "someValue1"); props.put("consumer.someProperty2", "someValue2"); KafkaBasedConnectorConfig config = new KafkaBasedConnectorConfig(props); Properties configProps = config.getConsumerProps(); Properties copiedProps = new Properties(); copiedProps.putAll(configProps); Assert.assertNotNull(copiedProps); Assert.assertEquals(copiedProps.getProperty("someProperty"), "someValue"); Assert.assertEquals(copiedProps.getProperty("someProperty1"), "someValue1"); Assert.assertEquals(copiedProps.getProperty("someProperty2"), "someValue2"); Properties taskProps = KafkaConnectorTask.getKafkaConsumerProperties(configProps, "groupId", KafkaConnectionString.valueOf("kafkassl://somewhere:777/topic")); Assert.assertEquals(taskProps.getProperty("someProperty"), "someValue"); Assert.assertEquals(taskProps.getProperty("someProperty1"), "someValue1"); Assert.assertEquals(taskProps.getProperty("someProperty2"), "someValue2"); }
Source:
protected ILogData removeFromQueue(NavigableSet<Long> queue) { boolean readNext; ILogData ld = null; Long currentRead; do { currentRead = queue.pollFirst(); if (currentRead == null) { return null; } try { ld = read(currentRead, queue); if (queue == getCurrentContext().readQueue) { if (ld.getType() == DataType.HOLE || (ld.containsStream(this.id) && ld.getType() == DataType.DATA)) { if (ld.isHole()) { ld = new LogData(DataType.DATA, SMREntry.getNOP(), ld.getMetadataMap()); } addToResolvedQueue(getCurrentContext(), currentRead); readNext = false; } else { log.trace("getNextEntry[{}]: the data for address does not belong to this stream. Skip.", this, currentRead); readNext = true; } } else { readNext = false; } } catch (TrimmedException te) { if (!getReadOptions().isIgnoreTrim()) { throw te; } log.debug("removeFromQueue[{}]: ignoring trimmed addresses {}", this, te.getTrimmedAddresses()); te.getTrimmedAddresses().forEach(address -> queue.remove(address)); readNext = true; } } while (readNext); return ld; }

Target:
protected ILogData removeFromQueue(NavigableSet<Long> queue) { boolean readNext; ILogData ld = null; Long currentRead; do { currentRead = queue.pollFirst(); if (currentRead == null) { return null; } try { ld = read(currentRead, queue); if (queue == getCurrentContext().readQueue) { if ((ld.containsStream(this.id) && ld.isData()) || (ld.isHole() && (ld.getBackpointerMap().isEmpty() || ld.containsStream(this.id))) ) { addToResolvedQueue(getCurrentContext(), currentRead); readNext = false; } else { log.trace("getNextEntry[{}]: the data for address does not belong to this stream. Skip.", this, currentRead); readNext = true; } } else { readNext = false; } } catch (TrimmedException te) { if (!getReadOptions().isIgnoreTrim()) { throw te; } log.debug("removeFromQueue[{}]: ignoring trimmed addresses {}", this, te.getTrimmedAddresses()); te.getTrimmedAddresses().forEach(address -> queue.remove(address)); readNext = true; } } while (readNext); return ld; }
Source:
private void validate() { ArgChecker.inOrderNotEqual(startDate, endDate, "startDate", "endDate"); if (indexInterpolated != null && indexInterpolated.equals(index)) { throw new IllegalArgumentException("Interpolation requires two different indices"); } }

Target:
private void validate() { ArgChecker.inOrderNotEqual(startDate, endDate, "startDate", "endDate"); if (index.equals(indexInterpolated)) { throw new IllegalArgumentException("Interpolation requires two different indices"); } }
Source:
public void calculate(float dataMin, float dataMax) { float min = dataMin; float max = dataMax; if( mCustomAxisMin ) { min = mAxisMinimum; } else if( mUseAutoScaleRestrictionMin ) { min = Math.min( min, mAutoScaleMinRestriction ); } if( mCustomAxisMax ) { max = mAxisMaximum; } else if( mUseAutoScaleRestrictionMax ) { max = Math.max( max, mAutoScaleMaxRestriction ); } float range = Math.abs(max - min); if (range == 0f) { max = max + 1f; min = min - 1f; } if (!mCustomAxisMin) { float bottomSpace = range / 100f * getSpaceBottom(); this.mAxisMinimum = (min - bottomSpace); } if (!mCustomAxisMax) { float topSpace = range / 100f * getSpaceTop(); this.mAxisMaximum = (max + topSpace); } this.mAxisRange = Math.abs(this.mAxisMaximum - this.mAxisMinimum); }

Target:
public void calculate(float dataMin, float dataMax) { float min = dataMin; float max = dataMax; if( mCustomAxisMin ) { if( mUseAutoScaleRestrictionMin ) { min = Math.min( dataMin, mAxisMinimum ); } else { min = mAxisMinimum; } } if( mCustomAxisMax ) { if( mUseAutoScaleRestrictionMax ) { max = Math.max( max, mAxisMaximum ); } else { max = mAxisMaximum; } } float range = Math.abs(max - min); if (range == 0f) { max = max + 1f; min = min - 1f; } if (!mCustomAxisMin) { float bottomSpace = range / 100f * getSpaceBottom(); this.mAxisMinimum = (min - bottomSpace); } if (!mCustomAxisMax) { float topSpace = range / 100f * getSpaceTop(); this.mAxisMaximum = (max + topSpace); } this.mAxisRange = Math.abs(this.mAxisMaximum - this.mAxisMinimum); }
Source:
public int hashCode() { if (path != null) { return path.hashCode(); } return super.hashCode(); }

Target:
public int hashCode() { if (path != null) return path.hashCode(); return super.hashCode(); }
Source:
public GatewayResponse<WorldpayOrderStatusResponse> authorise(CardAuthorisationGatewayRequest request) { GatewayResponse<WorldpayOrderStatusResponse> response = worldpayAuthoriseHandler.authorise(request); if (response.getBaseResponse().isPresent()) { var worldpayOrderResponse = response.getBaseResponse().get(); if (worldpayOrderResponse.getLastEvent().isPresent() && worldpayOrderResponse.getLastEvent().get().equals("REFUSED") && worldpayOrderResponse.getExemptionResponseResult().isPresent() && SOFT_DECLINE_EXEMPTION_RESPONSE_RESULTS.contains(worldpayOrderResponse.getExemptionResponseResult().get())) { var authorisationRequestSummary = generateAuthorisationRequestSummary(request.getCharge(), request.getAuthCardDetails()); Optional<String> transactionId = authorisationService.extractTransactionId(request.getCharge().getExternalId(), response); var logMessage = String.format(Locale.UK, "Authorisation%s for %s (%s %s) for %s (%s) - %s .'. %s -> %s", authorisationRequestSummaryStringifier.stringify(authorisationRequestSummary), request.getCharge().getExternalId(), request.getCharge().getPaymentGatewayName().getName(), transactionId.orElse("missing transaction ID"), request.getCharge().getGatewayAccount().getAnalyticsId(), request.getCharge().getGatewayAccount().getId(), response, ChargeStatus.fromString(request.getCharge().getStatus()), request.getCharge().getStatus()); var structuredLoggingArguments = ArrayUtils.addAll( request.getCharge().getStructuredLoggingArgs(), authorisationRequestSummaryStructuredLogging.createArgs(authorisationRequestSummary)); LOGGER.info(logMessage, structuredLoggingArguments); return worldpayAuthoriseHandler.authorise(request, true); } } return response; }

Target:
public GatewayResponse<WorldpayOrderStatusResponse> authorise(CardAuthorisationGatewayRequest request) { GatewayResponse<WorldpayOrderStatusResponse> response = worldpayAuthoriseHandler.authorise(request); if (response.getBaseResponse().map(WorldpayOrderStatusResponse::isSoftDecline).orElse(false)) { var authorisationRequestSummary = generateAuthorisationRequestSummary(request.getCharge(), request.getAuthCardDetails()); Optional<String> transactionId = authorisationService.extractTransactionId(request.getCharge().getExternalId(), response); var logMessage = String.format(Locale.UK, "Authorisation%s for %s (%s %s) for %s (%s) - %s .'. %s -> %s", authorisationRequestSummaryStringifier.stringify(authorisationRequestSummary), request.getCharge().getExternalId(), request.getCharge().getPaymentGatewayName().getName(), transactionId.orElse("missing transaction ID"), request.getCharge().getGatewayAccount().getAnalyticsId(), request.getCharge().getGatewayAccount().getId(), response, ChargeStatus.fromString(request.getCharge().getStatus()), request.getCharge().getStatus()); var structuredLoggingArguments = ArrayUtils.addAll( request.getCharge().getStructuredLoggingArgs(), authorisationRequestSummaryStructuredLogging.createArgs(authorisationRequestSummary)); LOGGER.info(logMessage, structuredLoggingArguments); return worldpayAuthoriseHandler.authorise(request, true); } return response; }
Source:
public void updateVisibility() { super.updateVisibility(); messageLabel.setVisible(false); subnetTab.setVisible(exportEditor.asCheckBox().getValue()); }

Target:
public void updateVisibility() { super.updateVisibility(); messageLabel.setVisible(false); }
Source:
protected boolean canAddVm(ArrayList<String> reasons, Collection<StorageDomain> destStorages) { VmStatic vmStaticFromParams = getParameters().getVmStaticData(); boolean canAddVm = canAddVm(reasons, vmStaticFromParams.getName(), getStoragePoolId(), vmStaticFromParams.getPriority()); if (canAddVm) { List<ValidationError> validationErrors = validateCustomProperties(vmStaticFromParams); if (!validationErrors.isEmpty()) { VmPropertiesUtils.getInstance().handleCustomPropertiesError(validationErrors, reasons); return false; } } if (shouldCheckSpaceInStorageDomains()) { if (!getStoragePoolId().equals(getStoragePoolIdFromSourceImageContainer())) { reasons.add(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_POOL_NOT_MATCH.toString()); return false; } for (StorageDomain domain : destStorages) { StorageDomainValidator storageDomainValidator = new StorageDomainValidator(domain); if (!validate(storageDomainValidator.isDomainExistAndActive())) { return false; } } if (!validateSpaceRequirements()) { return false; } } return isDedicatedVdsOnSameCluster(vmStaticFromParams); }

Target:
protected boolean canAddVm(ArrayList<String> reasons, Collection<StorageDomain> destStorages) { VmStatic vmStaticFromParams = getParameters().getVmStaticData(); if (!canAddVm(reasons, vmStaticFromParams.getName(), getStoragePoolId(), vmStaticFromParams.getPriority())) { return false; } List<ValidationError> validationErrors = validateCustomProperties(vmStaticFromParams); if (!validationErrors.isEmpty()) { VmPropertiesUtils.getInstance().handleCustomPropertiesError(validationErrors, reasons); return false; } if (shouldCheckSpaceInStorageDomains()) { if (!getStoragePoolId().equals(getStoragePoolIdFromSourceImageContainer())) { reasons.add(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_POOL_NOT_MATCH.toString()); return false; } for (StorageDomain domain : destStorages) { StorageDomainValidator storageDomainValidator = new StorageDomainValidator(domain); if (!validate(storageDomainValidator.isDomainExistAndActive())) { return false; } } if (!validateSpaceRequirements()) { return false; } } return isDedicatedVdsOnSameCluster(vmStaticFromParams); }
Source:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } ServerTemplateSelected that = (ServerTemplateSelected) o; return serverTemplate.getId().equals(that.serverTemplate.getId()); }

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof ServerTemplateSelected)) { return false; } ServerTemplateSelected that = (ServerTemplateSelected) o; if (getServerTemplate() == null && that.getServerTemplate() == null) { return true; } if (getServerTemplate() != null && that.getServerTemplate() == null) { return false; } if (getServerTemplate() == null && that.getServerTemplate() != null) { return false; } return getServerTemplate().getId().equals(that.getServerTemplate().getId()); }
Source:
public SqmMultiTableMutationStrategy getFallbackSqmMutationStrategy( EntityMappingType rootEntityDescriptor, RuntimeModelCreationContext runtimeModelCreationContext) { return new LocalTemporaryTableStrategy( new IdTable( rootEntityDescriptor, name -> "temp." + name ), () -> new PhysicalIdTableExporter() { @Override protected String getCreateOptions() { return "ignore rollback"; } }, AfterUseAction.DROP, null, runtimeModelCreationContext.getSessionFactory() ); }

Target:
public SqmMultiTableMutationStrategy getFallbackSqmMutationStrategy( EntityMappingType rootEntityDescriptor, RuntimeModelCreationContext runtimeModelCreationContext) { return new LocalTemporaryTableStrategy( new IdTable( rootEntityDescriptor, name -> "temp." + name ), () -> new TempIdTableExporter( true, this::getTypeName ) { @Override protected String getCreateOptions() { return "ignore rollback"; } }, AfterUseAction.DROP, null, runtimeModelCreationContext.getSessionFactory() ); }
Source:
private String buildMessageForCompositeName(String clusterName, String serviceName) { return String.format("cluster name <%s>, name <%s>", clusterName, serviceName); }

Target:
private String buildMessageForCompositeName(String clusterName, String serviceName) { return String.format("cluster name <%s>, service name <%s>", clusterName, serviceName); }
Source:
public void setup() { metacard1 = new MetacardImpl(); results = new ArrayList<>(); results.add(new ResultImpl(metacard1)); catalogFramework = mock(CatalogFramework.class); helper = mock(AdminSourceHelper.class); poller = new AdminPollerServiceBeanTest().new MockedAdminPoller(null, null); poller.setOperationActionProviders(new ArrayList<>()); poller.setReportActionProviders(new ArrayList<>()); poller.setCatalogFramework(catalogFramework); }

Target:
public void setup() { metacard1 = new MetacardImpl(); results = new ArrayList<>(); results.add(new ResultImpl(metacard1)); catalogFramework = mock(CatalogFramework.class); helper = mock(AdminSourceHelper.class); poller = new AdminPollerServiceBeanTest().new MockedAdminPoller(null, null, catalogFramework); poller.setOperationActionProviders(new ArrayList<>()); poller.setReportActionProviders(new ArrayList<>()); }
Source:
private void addToBackupList(String latestFilename, BigInteger maxNumBackup) { int noOfBackups = (null != maxNumBackup ? maxNumBackup.intValue() : 0); String filenameToDelete = null; if (backupFileList.size() >= noOfBackups) { filenameToDelete = backupFileList.remove(0); } backupFileList.add(latestFilename); if (filenameToDelete != null) { try { File fileToDelete = new File(filenameToDelete); if (fileToDelete.exists()) { fileToDelete.delete(); } } catch (Exception e) { LOG.warn("Failed to delete backup file {}: {}", filenameToDelete, e.getLocalizedMessage()); LOG.trace("Deletion exception: {}", e.getLocalizedMessage(), e); } } }

Target:
private void addToBackupList(String latestFilename, BigInteger maxNumBackup) { int noOfBackups = maxNumBackup.intValue(); String filenameToDelete = null; if (backupFileList.size() >= noOfBackups) { filenameToDelete = backupFileList.remove(0); } backupFileList.add(latestFilename); if (filenameToDelete != null) { try { File fileToDelete = new File(filenameToDelete); if (fileToDelete.exists()) { fileToDelete.delete(); } } catch (Exception e) { LOG.warn("Failed to delete backup file {}: {}", filenameToDelete, e.getLocalizedMessage()); } } }
Source:
void write(ByteBuffer buf) throws Exception { int toRead = buf.remaining(); if (writableChannel == null || toRead + readSoFar > size) { throw new IllegalStateException("Cannot push data"); } if (beBad) { Exception exception = new Exception("Channel encountered an error"); returnedFuture.done(null, exception); callback.onCompletion(null, exception); return; } writableChannel.write(buf, null).get(); readSoFar += toRead; if (readSoFar == size) { if (sendZeroSizedLastChunk) { sendZeroAndWait(); } returnedFuture.done(size, null); callback.onCompletion(size, null); } else { if (sendZeroSizedLastChunk) { if (random.nextInt(2) % 2 == 0) { sendZeroAndWait(); } } } }

Target:
void write(ByteBuffer buf) throws Exception { int toRead = buf.remaining(); if (writableChannel == null || toRead + readSoFar > size) { throw new IllegalStateException("Cannot push data"); } if (beBad) { Exception exception = new Exception("Channel encountered an error"); returnedFuture.done(null, exception); callback.onCompletion(null, exception); return; } writableChannel.write(buf, null).get(); readSoFar += toRead; if (readSoFar == size) { if (sendZeroSizedBuffers) { sendZeroAndWait(); } returnedFuture.done(size, null); callback.onCompletion(size, null); } else { if (sendZeroSizedBuffers && random.nextInt(2) % 2 == 0) { sendZeroAndWait(); } } }
Source:
private WorkingSetDescriptor getSelectedWorkingSet() { IStructuredSelection selection = typesListViewer.getStructuredSelection(); WorkingSetDescriptor descriptor = null; if (!selection.isEmpty()) { descriptor = (WorkingSetDescriptor) selection.getFirstElement(); } return descriptor; }

Target:
private WorkingSetDescriptor getSelectedWorkingSet() { return (WorkingSetDescriptor) typesListViewer.getStructuredSelection().getFirstElement(); }
Source:
public void shouldThrowExceptionOnNullTransformFunction() { final Option<Integer> option = Option.some(1); option.transform(null); }

Target:
public void shouldThrowExceptionOnNullTransformFunction() { Option.some(1).transform(null); }
Source:
public IPath getAbsolutePath() { final File repoDir; if (db.isBare()) repoDir = db.getDirectory(); else repoDir = db.getWorkTree(); return new Path(repoDir.getAbsolutePath() + File.separatorChar + path); }

Target:
public IPath getAbsolutePath() { return new Path(db.getWorkTree().getAbsolutePath() + File.separatorChar + path); }
Source:
public DroolsCorrelationEngine(final String name, final MetricRegistry metricRegistry) { super(); this.m_name = name; final Gauge<Integer> size = () -> { return getMemorySize(); }; metricRegistry.register(MetricRegistry.name(name, "working-memory-size"), size); m_eventsMeter = metricRegistry.meter(MetricRegistry.name(name, "events")); }

Target:
public DroolsCorrelationEngine(final String name, final MetricRegistry metricRegistry) { this.m_name = name; final Gauge<Long> factCount = () -> { return getWorkingMemory().getFactCount(); }; metricRegistry.register(MetricRegistry.name(name, "fact-count"), factCount); final Gauge<Integer> pendingTasksCount = () -> { return getPendingTasksCount(); }; metricRegistry.register(MetricRegistry.name(name, "pending-tasks-count"), pendingTasksCount); m_eventsMeter = metricRegistry.meter(MetricRegistry.name(name, "events")); }
Source:
public Builder addField(FieldSpec fieldSpec) { checkState(kind != Kind.ANNOTATION, "%s %s cannot have fields", kind, name); if (kind == Kind.INTERFACE) { requireExactlyOneOf(EnumSet.of(Modifier.PUBLIC, Modifier.PRIVATE), fieldSpec.modifiers); if (kind == Kind.INTERFACE) { Set<Modifier> check = EnumSet.of(Modifier.STATIC, Modifier.FINAL); checkState(fieldSpec.modifiers.containsAll(check), "%s %s.%s requires modifiers %s", kind, name, fieldSpec.name, check); } } fieldSpecs.add(fieldSpec); return this; }

Target:
public Builder addField(FieldSpec fieldSpec) { checkState(kind != Kind.ANNOTATION, "%s %s cannot have fields", kind, name); if (kind == Kind.INTERFACE) { requireExactlyOneOf(EnumSet.of(Modifier.PUBLIC, Modifier.PRIVATE), fieldSpec.modifiers); Set<Modifier> check = EnumSet.of(Modifier.STATIC, Modifier.FINAL); checkState(fieldSpec.modifiers.containsAll(check), "%s %s.%s requires modifiers %s", kind, name, fieldSpec.name, check); } fieldSpecs.add(fieldSpec); return this; }
Source:
I0ItecIZkStateListenerHelixImpl(IZkStateListener listener) { this.listener = listener; }

Target:
I0ItecIZkStateListenerHelixImpl(IZkStateListener listener) { _listener = listener; }
Source:
private void processPendingChannelFlags() { if (!pendingFlagChannels.isEmpty()) { for (int fd = 0; (fd = pendingFlagChannels.nextSetBit(fd)) >= 0; pendingFlagChannels.clear(fd)) { AbstractEpollChannel ch = channels.get(fd); if (ch != null) { try { ch.modifyEvents(); } catch (IOException e) { ch.pipeline().fireExceptionCaught(e); ch.close(ch.voidPromise()); } } } } }

Target:
private void processPendingChannelFlags() { if (!pendingFlagChannels.isEmpty()) { for (int fd = 0; (fd = pendingFlagChannels.nextSetBit(fd)) >= 0; pendingFlagChannels.clear(fd)) { AbstractEpollChannel ch = channels.get(fd); if (ch != null) { try { ch.modifyEvents(); } catch (IOException e) { ch.pipeline().fireExceptionCaught(e); ch.close(); } } } } }
Source:
protected void patch(Context context, HttpServletRequest request, String apiCategory, String model, UUID id, Patch patch) throws AuthorizeException, SQLException { final Group group = dsoService.find(context, id); if (group != null && isPatchUnprocessable(context, group)) { throw new UnprocessableEntityException("This group cannot be patched."); } patchDSpaceObject(apiCategory, model, id, patch); }

Target:
protected void patch(Context context, HttpServletRequest request, String apiCategory, String model, UUID id, Patch patch) throws AuthorizeException, SQLException { patchDSpaceObject(apiCategory, model, id, patch); }
Source:
AdapterPatientDiscoveryProxyWebServiceHelper() { }

Target:
private AdapterPatientDiscoveryProxyWebServiceHelper() { }
Source:
public String generate() { ThreadLocalRandom random = ThreadLocalRandom.current(); char[] chars = new char[32]; Random64Generator.long2hex(chars, 0, random.nextLong()); Random64Generator.long2hex(chars, 16, random.nextLong()); return new String(chars); }

Target:
public String generate() { ThreadLocalRandom random = ThreadLocalRandom.current(); char[] chars = new char[32]; Chars.toLowerHex(random.nextLong(), chars, 0); Chars.toLowerHex(random.nextLong(), chars, 16); return new String(chars); }
Source:
private void deleteIndexes(List<Index> indexes) { LOG.trace("Deleting index(es) '{}' ...", toString(indexes)); String[] indexNames = toIndexNames(indexes); DeleteIndexRequestBuilder deleteIndexRequest = client.admin().indices().prepareDelete(indexNames); DeleteIndexResponse deleteIndexResponse; try { deleteIndexResponse = deleteIndexRequest.get(); } catch (ResourceNotFoundException e) { LOG.debug("", e); throw new UnknownIndexException(toString(indexes)); } catch (ElasticsearchException e) { LOG.error("", e); throw new IndexException(format("Error deleting index(es) '%s'.", toString(indexes))); } if (!deleteIndexResponse.isAcknowledged()) { throw new IndexException(format("Error deleting index(es) '%s'", toString(indexes))); } LOG.debug("Deleted index(es) '{}'.", toString(indexes)); }

Target:
private void deleteIndexes(List<Index> indexes) { if (LOG.isTraceEnabled()) { LOG.trace("Deleting index(es) '{}' ...", toString(indexes)); } String[] indexNames = toIndexNames(indexes); DeleteIndexRequestBuilder deleteIndexRequest = client.admin().indices().prepareDelete(indexNames); DeleteIndexResponse deleteIndexResponse; try { deleteIndexResponse = deleteIndexRequest.get(); } catch (ResourceNotFoundException e) { LOG.debug("", e); throw new UnknownIndexException(toString(indexes)); } catch (ElasticsearchException e) { LOG.error("", e); throw new IndexException(format("Error deleting index(es) '%s'.", toString(indexes))); } if (!deleteIndexResponse.isAcknowledged()) { throw new IndexException(format("Error deleting index(es) '%s'", toString(indexes))); } if (LOG.isDebugEnabled()) { LOG.debug("Deleted index(es) '{}'.", toString(indexes)); } }
Source:
public ReviewResult call() throws NoSuchChangeException, OrmException { final ReviewResult result = new ReviewResult(); final Change.Id changeId = patchSetId.getParentKey(); result.setChangeId(changeId); final ChangeControl control = changeControlFactory.validateFor(changeId); final PatchSet patch = db.patchSets().get(patchSetId); if (patch == null) { throw new NoSuchChangeException(changeId); } if (!patch.isDraft()) { result.addError(new ReviewResult.Error( ReviewResult.Error.Type.NOT_A_DRAFT)); return result; } if (!control.canPublish(db)) { result.addError(new ReviewResult.Error( ReviewResult.Error.Type.PUBLISH_NOT_PERMITTED)); } else { db.patchSets().atomicUpdate(patchSetId, new AtomicUpdate<PatchSet>() { @Override public PatchSet update(PatchSet patchset) { if (patchset.isDraft()) { patchset.setDraft(false); } return null; } }); final Change change = db.changes().get(changeId); if (change.getStatus() == Change.Status.DRAFT) { final Change updatedChange = db.changes().atomicUpdate(changeId, new AtomicUpdate<Change>() { @Override public Change update(Change change) { if (change.getStatus() == Change.Status.DRAFT) { change.setStatus(Change.Status.NEW); ChangeUtil.updated(change); return change; } else { return null; } } }); if ((updatedChange != null) && (updatedChange.getStatus() == Change.Status.NEW)) { hooks.doDraftPublishedHook(updatedChange, patch, db); } } } return result; }

Target:
public ReviewResult call() throws NoSuchChangeException, OrmException { final ReviewResult result = new ReviewResult(); final Change.Id changeId = patchSetId.getParentKey(); result.setChangeId(changeId); final ChangeControl control = changeControlFactory.validateFor(changeId); final PatchSet patch = db.patchSets().get(patchSetId); if (patch == null) { throw new NoSuchChangeException(changeId); } if (!patch.isDraft()) { result.addError(new ReviewResult.Error( ReviewResult.Error.Type.NOT_A_DRAFT)); return result; } if (!control.canPublish(db)) { result.addError(new ReviewResult.Error( ReviewResult.Error.Type.PUBLISH_NOT_PERMITTED)); } else { boolean published = false; final PatchSet updatedPatch = db.patchSets().atomicUpdate(patchSetId, new AtomicUpdate<PatchSet>() { @Override public PatchSet update(PatchSet patchset) { if (patchset.isDraft()) { patchset.setDraft(false); return patchset; } return null; } }); if ((updatedPatch != null) && (!updatedPatch.isDraft())) { published = true; } final Change change = db.changes().get(changeId); if (change.getStatus() == Change.Status.DRAFT) { final Change updatedChange = db.changes().atomicUpdate(changeId, new AtomicUpdate<Change>() { @Override public Change update(Change change) { if (change.getStatus() == Change.Status.DRAFT) { change.setStatus(Change.Status.NEW); ChangeUtil.updated(change); return change; } else { return null; } } }); if ((updatedChange != null) && (updatedChange.getStatus() == Change.Status.NEW)) { published = true; } } if (published) { hooks.doDraftPublishedHook(change, patch, db); } } return result; }
Source:
public void execute(Context context, ContentProviderClient contentProviderClient, RowDataSnapshot<TaskContract.Instances> rowSnapshot, Uri taskUri) { AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context); final ComponentName componentName = new ComponentName(context, TaskListWidgetProvider.class); final int[] appWidgetIds = appWidgetManager.getAppWidgetIds(componentName); appWidgetManager.notifyAppWidgetViewDataChanged(appWidgetIds, R.id.task_list_widget_lv); }

Target:
public void execute(Context context, ContentProviderClient contentProviderClient, RowDataSnapshot<TaskContract.Instances> rowSnapshot, Uri taskUri) { AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context); notifyTaskListDataChanged(appWidgetManager, new ComponentName(context, TaskListWidgetProvider.class)); notifyTaskListDataChanged(appWidgetManager, new ComponentName(context, TaskListWidgetProviderLarge.class)); }
Source:
public Response setDynamicConfigs(final CoordinatorDynamicConfig.Builder dynamicConfigBuilder, @HeaderParam(AuditManager.X_DRUID_AUTHOR) @DefaultValue("") final String author, @HeaderParam(AuditManager.X_DRUID_COMMENT) @DefaultValue("") final String comment, @Context HttpServletRequest req ) { try { CoordinatorDynamicConfig current = manager.watch( CoordinatorDynamicConfig.CONFIG_KEY, CoordinatorDynamicConfig.class ).get(); final SetResult setResult = manager.set( CoordinatorDynamicConfig.CONFIG_KEY, current == null ? dynamicConfigBuilder.build() : dynamicConfigBuilder.build(current), new AuditInfo(author, comment, req.getRemoteAddr()) ); if (setResult.isOk()) { return Response.ok().build(); } else { return Response.status(Response.Status.BAD_REQUEST) .entity(ImmutableMap.of("error", setResult.getException())) .build(); } } catch (IllegalArgumentException e) { return Response.status(Response.Status.BAD_REQUEST) .entity(ImmutableMap.<String, Object>of("error", e.getMessage())) .build(); } }

Target:
public Response setDynamicConfigs( final CoordinatorDynamicConfig.Builder dynamicConfigBuilder, @HeaderParam(AuditManager.X_DRUID_AUTHOR) @DefaultValue("") final String author, @HeaderParam(AuditManager.X_DRUID_COMMENT) @DefaultValue("") final String comment, @Context HttpServletRequest req ) { try { CoordinatorDynamicConfig current = CoordinatorDynamicConfig.current(manager); final SetResult setResult = manager.set( CoordinatorDynamicConfig.CONFIG_KEY, dynamicConfigBuilder.build(current), new AuditInfo(author, comment, req.getRemoteAddr()) ); if (setResult.isOk()) { return Response.ok().build(); } else { return Response.status(Response.Status.BAD_REQUEST) .entity(ServletResourceUtils.sanitizeException(setResult.getException())) .build(); } } catch (IllegalArgumentException e) { return Response.status(Response.Status.BAD_REQUEST) .entity(ServletResourceUtils.sanitizeException(e)) .build(); } }
Source:
public void encodes() throws IOException { final Identity identity = new Identity.Simple("urn:test:3"); MatcherAssert.assertThat( new String(new CcBase64(new CcPlain()).encode(identity)), Matchers.equalTo("dXJuJTNBdGVzdCUzQTM=") ); }

Target:
public void encodes() throws IOException { MatcherAssert.assertThat( new String( new CcBase64(new CcPlain()).encode( new Identity.Simple("urn:test:3") ) ), Matchers.equalTo("dXJuJTNBdGVzdCUzQTM=") ); }
Source:
public List<DetailedQcStatus> getDetailedQcStatuses() throws IOException { List<DetailedQcStatus> list = new ArrayList<>(detailedQcStatusService.getAll()); Collections.sort(list, new Comparator<DetailedQcStatus>() { @Override public int compare(DetailedQcStatus o1, DetailedQcStatus o2) { return o1.getId().compareTo(o2.getId()); } }); return list; }

Target:
public List<DetailedQcStatus> getDetailedQcStatuses() throws IOException { List<DetailedQcStatus> list = new ArrayList<>(detailedQcStatusService.getAll()); Collections.sort(list, new Comparator<DetailedQcStatus>() { @Override public int compare(DetailedQcStatus o1, DetailedQcStatus o2) { if (o1.getStatus() == null) { return (o2.getStatus() == null ? 0 : -1); } else if (o2.getStatus() == null) { return 1; } else { return o1.getStatus().compareTo(o2.getStatus()); } } }); return list; }
Source:
public void testGetTenantIDFunction() { String[] invalidUrls = new String[] { null, "", "jdbc:phoenix", "jdbc:phoenix;test=true", "jdbc:phoenix:localhost", "localhost:123:/foo-bar", "localhost:123:/foo-bar;TenantId", "localhost:123:/foo-bar;TenantId=" }; for (int i = 0; i < invalidUrls.length; i++) { try { assertEquals( ConnectionInfo.getTenantID(invalidUrls[i]), null); } catch (AssertionError e) { throw new AssertionError("For \"" + invalidUrls[i] + "\": " + e.getMessage()); } } String[] validUrls = new String[] { null, "TenantId=1", "jdbc:phoenix;TenantId=1", "jdbc:phoenix;test=true;TenantId=1", "jdbc:phoenix:localhost;TenantId=1", "localhost:123:/foo-bar;TenantId=1" }; for (int i = 0; i < validUrls.length; i++) { try { assertEquals( ConnectionInfo.getTenantID(validUrls[i]), null); } catch (AssertionError e) { throw new AssertionError("For \"" + invalidUrls[i] + "\": " + e.getMessage()); } } }

Target:
public void testGetTenantIDFunction() { String[] invalidUrls = new String[] { null, "", "jdbc:phoenix", "jdbc:phoenix;test=true", "jdbc:phoenix:localhost", "localhost:123:/foo-bar", "localhost:123:/foo-bar;TenantId", "localhost:123:/foo-bar;TenantId=" }; for (int i = 0; i < invalidUrls.length; i++) { assertEquals(null, PhoenixEmbeddedDriver.getTenantIDParser(invalidUrls[i])); } String[] validUrls = new String[] { "TenantId=1", "jdbc:phoenix;TenantId=1", "jdbc:phoenix;test=true;TenantId=1", "jdbc:phoenix:localhost;TenantId=1", "localhost:123:/foo-bar;TenantId=1" }; for (int i = 0; i < validUrls.length; i++) { assertEquals("1", PhoenixEmbeddedDriver.getTenantIDParser(validUrls[i])); } assertEquals("TenantId=", PhoenixEmbeddedDriver.getTenantIDParser("TenantId=TenantId=")); assertEquals("XY", PhoenixEmbeddedDriver.getTenantIDParser("TenantIdXY")); }
Source:
public NIOServerCnxnFactory() { String serverCnxnClassName = System.getProperty(ServerCnxnFactory.ZOOKEEPER_SERVER_CNXN); if ( serverCnxnClassName != null ) { try { Class<? extends NIOServerCnxn> serverCnxnClass = Class.forName(serverCnxnClassName).asSubclass(NIOServerCnxn.class); serverCnxnClassCtr = serverCnxnClass.getConstructor(ZooKeeperServer.class, SocketChannel.class, SelectionKey.class, NIOServerCnxnFactory.class, SelectorThread.class); } catch (ClassNotFoundException e) { LOG.debug("Can not find class for . Using NIOServerCnxn", serverCnxnClassName); } catch (NoSuchMethodException e) { LOG.debug("Can not find constructor for . Using NIOServerCnxn", serverCnxnClassName); } catch (Throwable t) { LOG.debug("Unexpected Exception for dealing with ", serverCnxnClassName); } } }

Target:
public NIOServerCnxnFactory() { String serverCnxnClassName = System.getProperty(ServerCnxnFactory.ZOOKEEPER_SERVER_CNXN, "org.apache.zookeeper.server.NIOServerCnxn"); try { Class<? extends NIOServerCnxn> serverCnxnClass = Class.forName(serverCnxnClassName).asSubclass(NIOServerCnxn.class); serverCnxnClassCtr = serverCnxnClass.getConstructor(ZooKeeperServer.class, SocketChannel.class, SelectionKey.class, NIOServerCnxnFactory.class, SelectorThread.class); } catch (Throwable t) { throw new RuntimeException("Exception when trying to get constructor for " + serverCnxnClassName, t); } }
Source:
public GetTaskListCommandParameters(Guid vdsId) { super(vdsId); storagePoolId = null; compatbilityVersion = null; }

Target:
public GetTaskListCommandParameters(Guid vdsId) { super(vdsId); }