auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
JSONObject mesosMasterAddress() { try (CuratorFramework cf = zkClient()) { cf.start(); List<String> children = cf.getChildren().forPath("/mesos"); if (children.isEmpty()) { return null; } JSONObject cfData = null; for (String child : children) { if (child.contains("json.info")) { cfData = new JSONObject( new String(cf.getData().forPath("/mesos/" + child)) ); break; } } if (cfData == null) { LOGGER.error(" object is not available in /mesos znode data"); return null; } return cfData.getJSONObject("address"); } catch (Exception e) { LOGGER.error("Error while obtaining a mesos address from the curator framework: ", e.getLocalizedMessage()); return null; } }

Target:
String mesosMasterAddress() { try (CuratorFramework cf = zkClient()) { cf.start(); List<String> children = cf.getChildren().forPath("/mesos"); if (children.isEmpty()) { return null; } JSONObject cfData = null; for (String child : children) { if (child.startsWith("json.info")) { cfData = new JSONObject(new String(cf.getData().forPath("/mesos/" + child))); break; } } if (cfData != null) { JSONObject address = cfData.getJSONObject("address"); return String.format("%s:%d", address.getString("ip"), address.getInt("port")); } } catch (Exception e) { LOGGER.error("Error while obtaining a mesos address from the curator framework: ", e); } return null; }
Source:
public TokenizerClassNameToElasticsearchTypeNameTransformer(Class<?> factoryClass, String parameterName) { super(); this.factoryClass = factoryClass; this.parameterName = parameterName; }

Target:
public TokenizerClassNameToElasticsearchTypeNameTransformer(Class<?> factoryClass, String parameterName) { this.factoryClass = factoryClass; this.parameterName = parameterName; }
Source:
public void testCompanion() throws Exception { Path wd = Files.createTempDirectory(this.getClass().getName()); File outFile = wd.resolve("test.ome.tif").toFile(); File cFile = wd.resolve("test.companion.ome").toFile(); String companion = cFile.getAbsolutePath(); DynamicMetadataOptions options = new DynamicMetadataOptions(); options.set(OMETiffWriter.COMPANION_KEY, companion); int planeCount = WriterUtilities.SIZE_Z * WriterUtilities.SIZE_C * WriterUtilities.SIZE_T; OMETiffWriter cwriter = new OMETiffWriter(); cwriter.setMetadataOptions(options); cwriter.setMetadataRetrieve(metadata); cwriter.setId(outFile.getAbsolutePath()); cwriter.setSeries(0); byte[] img = new byte[WriterUtilities.SIZE_X * WriterUtilities.SIZE_Y]; Arrays.fill(img, (byte) 0); for (int i = 0; i < planeCount; i++) { cwriter.saveBytes(i, img); } cwriter.close(); assertTrue(cFile.exists()); OMETiffReader reader = new OMETiffReader(); reader.setId(companion); assertEquals(reader.getSizeX(), WriterUtilities.SIZE_X); assertEquals(reader.getSizeY(), WriterUtilities.SIZE_Y); assertEquals(reader.getSizeZ(), WriterUtilities.SIZE_Z); assertEquals(reader.getSizeC(), WriterUtilities.SIZE_C); assertEquals(reader.getSizeT(), WriterUtilities.SIZE_T); reader.close(); outFile.deleteOnExit(); cFile.deleteOnExit(); wd.toFile().deleteOnExit(); }

Target:
public void testCompanion() throws Exception { Path wd = Files.createTempDirectory(this.getClass().getName()); File outFile = wd.resolve("test.ome.tif").toFile(); File cFile = wd.resolve("test.companion.ome").toFile(); String companion = cFile.getAbsolutePath(); DynamicMetadataOptions options = new DynamicMetadataOptions(); options.set(OMETiffWriter.COMPANION_KEY, companion); int planeCount = WriterUtilities.SIZE_Z * WriterUtilities.SIZE_C * WriterUtilities.SIZE_T; OMETiffWriter cwriter = new OMETiffWriter(); cwriter.setMetadataOptions(options); cwriter.setMetadataRetrieve(metadata); cwriter.setId(outFile.getAbsolutePath()); cwriter.setSeries(0); byte[] img = new byte[WriterUtilities.SIZE_X * WriterUtilities.SIZE_Y]; for (int i = 0; i < planeCount; i++) { cwriter.saveBytes(i, img); } cwriter.close(); assertTrue(cFile.exists()); OMETiffReader reader = new OMETiffReader(); reader.setId(companion); assertEquals(reader.getSizeX(), WriterUtilities.SIZE_X); assertEquals(reader.getSizeY(), WriterUtilities.SIZE_Y); assertEquals(reader.getSizeZ(), WriterUtilities.SIZE_Z); assertEquals(reader.getSizeC(), WriterUtilities.SIZE_C); assertEquals(reader.getSizeT(), WriterUtilities.SIZE_T); reader.close(); outFile.deleteOnExit(); cFile.deleteOnExit(); wd.toFile().deleteOnExit(); }
Source:
public static void readLastMessages(String clientNamePrefix, Set<String> brokerSet, String topic, Map<Integer, Pair<byte[], byte[]>> lastMessages) { TopicMetadata tm = KafkaMetadataUtil.getTopicMetadata(brokerSet, topic); if (tm == null) { throw new RuntimeException("Failed to retrieve topic metadata"); } for (PartitionMetadata pm : tm.partitionsMetadata()) { SimpleConsumer consumer = null; try { String clientName = KafkaMetadataUtil.getClientName(clientNamePrefix, tm.topic(), pm.partitionId()); consumer = createSimpleConsumer(clientName, tm.topic(), pm); long readOffset = KafkaMetadataUtil.getLastOffset(consumer, tm.topic(), pm.partitionId(), kafka.api.OffsetRequest.LatestTime(), clientName); FetchRequest req = new FetchRequestBuilder().clientId(clientName) .addFetch(tm.topic(), pm.partitionId(), readOffset - 1, DEFAULT_FETCH_SIZE).build(); FetchResponse fetchResponse = consumer.fetch(req); if (fetchResponse.hasError()) { logger.error("Error fetching data Offset Data the Broker. Reason: " + fetchResponse.errorCode(topic, pm.partitionId())); return; } for (MessageAndOffset messageAndOffset : fetchResponse.messageSet(tm.topic(), pm.partitionId())) { lastMessages.put(pm.partitionId(), kafkaMessageToPair(messageAndOffset.message())); } } finally { if (consumer != null) { consumer.close(); } } } }

Target:
public static void readLastMessages(String clientNamePrefix, Set<String> brokerSet, String topic, Map<Integer, Pair<byte[], byte[]>> lastMessages) { TopicMetadata tm = KafkaMetadataUtil.getTopicMetadata(brokerSet, topic); if (tm == null) { throw new RuntimeException("Failed to retrieve topic metadata"); } for (PartitionMetadata pm : tm.partitionsMetadata()) { SimpleConsumer consumer = null; try { String clientName = KafkaMetadataUtil.getClientName(clientNamePrefix, tm.topic(), pm.partitionId()); consumer = getOrCreateSimpleConsumer(clientName, tm.topic(), pm); long readOffset = KafkaMetadataUtil.getLastOffset(consumer, tm.topic(), pm.partitionId(), kafka.api.OffsetRequest.LatestTime(), clientName); FetchRequest req = new FetchRequestBuilder().clientId(clientName) .addFetch(tm.topic(), pm.partitionId(), readOffset - 1, DEFAULT_FETCH_SIZE).build(); FetchResponse fetchResponse = consumer.fetch(req); if (fetchResponse.hasError()) { logger.error("Error fetching data Offset Data the Broker. Reason: " + fetchResponse.errorCode(topic, pm.partitionId())); return; } for (MessageAndOffset messageAndOffset : fetchResponse.messageSet(tm.topic(), pm.partitionId())) { lastMessages.put(pm.partitionId(), kafkaMessageToPair(messageAndOffset.message())); } } finally { if (consumer != null) { consumer.close(); } } } }
Source:
public static IntList fromTo(int from, int to) { return new RangeIntList(from, to); }

Target:
public static IntList fromTo(int from, int to) { Preconditions.checkArgument(from <= to); return new RangeIntList(from, to); }
Source:
static String render(Iterator<Token> tokens) { String renderedText = ""; while (tokens.hasNext()) { renderedText += tokens.next().tokenText(); } return renderedText; }

Target:
static String render(Iterator<Token> tokens) { StringBuilder renderedText = new StringBuilder(); while (tokens.hasNext()) { renderedText.append(tokens.next().tokenText()); } return renderedText.toString(); }
Source:
public String rejectArticle(@PathVariable long articleId, @RequestParam(value = "comment", required = false) String comment) { liCaiQuanArticleService.changeArticleStatus(articleId, ArticleStatus.TO_APPROVE); if (null != comment && !comment.equals("")) { liCaiQuanArticleService.rejectArticle(articleId, comment); } return ""; }

Target:
public BaseDto<BaseDataDto> rejectArticle(@PathVariable long articleId, @RequestParam(value = "comment", required = false) String comment) { liCaiQuanArticleService.rejectArticle(articleId, comment); return new BaseDto<>(); }
Source:
@Override public ReentrantReadWriteLockWithTracking.WriteLock writeLock() { return writeLock; }

Target:
@Override public ReentrantReadWriteLock.WriteLock writeLock() { return writeLock; }
Source:
public ListenableFuture<Response> handle(QosIoExceptionAwareCall call, QosIoException qosIoException) { return qosIoException.getQosException().accept(new QosException.Visitor<ListenableFuture<Response>>() { @Override public ListenableFuture<Response> visit(QosException.Throttle exception) { Optional<Duration> duration = exception.getRetryAfter(); if (duration.isPresent()) { return executorService.schedule( () -> call.clone().execute(), duration.get().toMillis(), TimeUnit.MILLISECONDS); } else { Optional<Duration> backoff = backoffStrategy.nextBackoff(); if (!backoff.isPresent()) { return Futures.immediateFailedFuture(qosIoException); } else { return executorService.schedule( () -> call.clone().execute(), backoff.get().toMillis(), TimeUnit.MILLISECONDS); } } } @Override public ListenableFuture<Response> visit(QosException.RetryOther exception) { return Futures.immediateFailedFuture(qosIoException); } @Override public ListenableFuture<Response> visit(QosException.Unavailable exception) { Optional<Duration> backoff = backoffStrategy.nextBackoff(); if (!backoff.isPresent()) { return Futures.immediateFailedFuture(qosIoException); } else { return executorService.schedule( () -> call.clone().execute(), backoff.get().toMillis(), TimeUnit.MILLISECONDS); } } }); }

Target:
public ListenableFuture<Response> handle(QosIoExceptionAwareCall call, QosIoException qosIoException) { return qosIoException.getQosException().accept(new QosException.Visitor<ListenableFuture<Response>>() { @Override public ListenableFuture<Response> visit(QosException.Throttle exception) { Optional<Duration> backoff = exception.getRetryAfter().isPresent() ? exception.getRetryAfter() : backoffStrategy.nextBackoff(); if (!backoff.isPresent()) { return Futures.immediateFailedFuture(qosIoException); } else { return executorService.schedule( () -> call.clone().execute(), backoff.get().toMillis(), TimeUnit.MILLISECONDS); } } @Override public ListenableFuture<Response> visit(QosException.RetryOther exception) { return Futures.immediateFailedFuture(qosIoException); } @Override public ListenableFuture<Response> visit(QosException.Unavailable exception) { Optional<Duration> backoff = backoffStrategy.nextBackoff(); if (!backoff.isPresent()) { return Futures.immediateFailedFuture(qosIoException); } else { return executorService.schedule( () -> call.clone().execute(), backoff.get().toMillis(), TimeUnit.MILLISECONDS); } } }); }
Source:
protected SPMAsyncTask concreteCreateTask (AsyncTaskCreationInfo asyncTaskCreationInfo, VdcActionType parentCommand) { VdcActionParametersBase parametersForTask = getParametersForTask(parentCommand, getParameters()); if (parametersForTask.getParametersCurrentUser() == null && getCurrentUser() != null) { parametersForTask.setParametersCurrentUser(getCurrentUser()); } AsyncTaskParameters p = new AsyncTaskParameters(asyncTaskCreationInfo, new AsyncTasks(parentCommand, AsyncTaskResultEnum.success, AsyncTaskStatusEnum.running, asyncTaskCreationInfo.getTaskID(), parametersForTask, getParameters(), asyncTaskCreationInfo.getStepId(), getCommandId(),asyncTaskCreationInfo.getStoragePoolID(), asyncTaskCreationInfo.getTaskType())); p.setEntityId(getParameters().getEntityId()); return AsyncTaskManager.getInstance().CreateTask(internalGetTaskType(), p); }

Target:
protected SPMAsyncTask concreteCreateTask (AsyncTaskCreationInfo asyncTaskCreationInfo, VdcActionType parentCommand) { VdcActionParametersBase parentParameters = getParametersForTask(parentCommand, getParameters()); if (parentParameters.getParametersCurrentUser() == null && getCurrentUser() != null) { parentParameters.setParametersCurrentUser(getCurrentUser()); } AsyncTaskParameters p = new AsyncTaskParameters(asyncTaskCreationInfo, new AsyncTasks(parentCommand, AsyncTaskResultEnum.success, AsyncTaskStatusEnum.running, asyncTaskCreationInfo.getTaskID(), parentParameters, getParameters(), asyncTaskCreationInfo.getStepId(), getCommandId(),asyncTaskCreationInfo.getStoragePoolID(), asyncTaskCreationInfo.getTaskType())); p.setEntityId(getParameters().getEntityId()); return AsyncTaskManager.getInstance().CreateTask(internalGetTaskType(), p); }
Source:
public void testK1UseCase() throws IOException { final Resource left = input.getK1Left(); final Resource origin = input.getK1Origin(); final Resource right = input.getK1Right(); final IComparisonScope scope = new DefaultComparisonScope(left, right, origin); final Comparison comparison = EMFCompare.builder().build().compare(scope); final List<Diff> differences = comparison.getDifferences(); final List<Conflict> conflicts = comparison.getConflicts(); assertEquals(6, differences.size()); assertEquals(2, conflicts.size()); Iterable<Conflict> realConflicts = Iterables.filter(conflicts, containsConflictOfTypes(REAL)); Iterable<Conflict> pseudoConflicts = Iterables.filter(conflicts, containsConflictOfTypes(PSEUDO)); assertEquals(1, Iterables.size(realConflicts)); assertEquals(1, Iterables.size(pseudoConflicts)); }

Target:
public void testK1UseCase() throws IOException { final Resource left = input.getK1Left(); final Resource origin = input.getK1Origin(); final Resource right = input.getK1Right(); final IComparisonScope scope = new DefaultComparisonScope(left, right, origin); final Comparison comparison = EMFCompare.builder().build().compare(scope); final List<Diff> differences = comparison.getDifferences(); final List<Conflict> conflicts = comparison.getConflicts(); assertEquals(6, differences.size()); assertEquals(2, conflicts.size()); Iterable<Conflict> realConflicts = filter(conflicts, containsConflictOfTypes(REAL)); Iterable<Conflict> pseudoConflicts = filter(conflicts, containsConflictOfTypes(PSEUDO)); assertEquals(1, size(realConflicts)); assertEquals(1, size(pseudoConflicts)); }
Source:
public void sweepDeletesAllButLatestWithSingleDeleteAllTimestamps() { long numWrites = 1000L; for (long i = 1; i <= numWrites; i++) { sweepQueue.enqueue(writeToDefaultCell(TABLE_CONSERVATIVE, i), i); } sweepQueue.sweepNextBatch(ShardAndStrategy.conservative(CONS_SHARD)); assertSentinel(TABLE_CONSERVATIVE, numWrites); assertValue(TABLE_CONSERVATIVE, numWrites + 1, numWrites); verify(kvs).deleteAllTimestamps(eq(TABLE_CONSERVATIVE), anyMap()); }

Target:
public void sweepDeletesAllButLatestWithSingleDeleteAllTimestamps() { long numWrites = 1000L; for (long i = 1; i <= numWrites; i++) { enqueueWrite(TABLE_CONSERVATIVE, i); } sweepQueue.sweepNextBatch(ShardAndStrategy.conservative(CONS_SHARD)); assertReadAtTimestampReturnsSentinel(TABLE_CONSERVATIVE, numWrites); assertReadAtTimestampReturnsValue(TABLE_CONSERVATIVE, numWrites + 1, numWrites); verify(kvs, times(1)).deleteAllTimestamps(eq(TABLE_CONSERVATIVE), anyMap()); }
Source:
public void in_stringNotNull() { populateNoPrimaryKeyNullTypesRows(); try { realm.where(NoPrimaryKeyNullTypes.class).in(NoPrimaryKeyNullTypes.FIELD_STRING_NOT_NULL, (String[]) null).findAll(); fail(); } catch (IllegalArgumentException ignored) { } try { realm.where(NoPrimaryKeyNullTypes.class).in(NoPrimaryKeyNullTypes.FIELD_STRING_NOT_NULL, new String[]{}).findAll(); fail(); } catch (IllegalArgumentException ignored) { } RealmResults<NoPrimaryKeyNullTypes> resultList = realm.where(NoPrimaryKeyNullTypes.class).in(NoPrimaryKeyNullTypes.FIELD_STRING_NOT_NULL, new String[]{"test data 14"}).findAll(); assertEquals(1, resultList.size()); resultList = realm.where(NoPrimaryKeyNullTypes.class).in(NoPrimaryKeyNullTypes.FIELD_STRING_NOT_NULL, new String[]{"test data 14", "test data 118", "test data 31", "test data 199"}).findAll(); assertEquals(4, resultList.size()); resultList = realm.where(NoPrimaryKeyNullTypes.class).in(NoPrimaryKeyNullTypes.FIELD_STRING_NOT_NULL, new String[]{"TEST data 14", "test data 118", "test data 31", "test DATA 199"}, Case.INSENSITIVE).findAll(); assertEquals(4, resultList.size()); resultList = realm.where(NoPrimaryKeyNullTypes.class).not().in(NoPrimaryKeyNullTypes.FIELD_STRING_NOT_NULL, new String[]{"TEST data 14", "test data 118", "test data 31", "test DATA 199"}, Case.INSENSITIVE).findAll(); assertEquals(196, resultList.size()); resultList = realm.where(NoPrimaryKeyNullTypes.class).not().in(NoPrimaryKeyNullTypes.FIELD_STRING_NOT_NULL, new String[]{"TEST data 14", "test data 118", "test data 31", "test DATA 199"}, Case.INSENSITIVE).findAll(); assertEquals(196, resultList.size( )); try { realm.where(NoPrimaryKeyNullTypes.class).not().in(NoPrimaryKeyNullTypes.FIELD_STRING_NOT_NULL, new String[]{"TEST data 14", "test data 118", null, "test DATA 199"}, Case.INSENSITIVE).findAll(); fail(); } catch (IllegalArgumentException ignored) { } }

Target:
public void in_stringNotNull() { doTestForInString(NoPrimaryKeyNullTypes.FIELD_STRING_NOT_NULL); try { realm.where(NoPrimaryKeyNullTypes.class).not().in(NoPrimaryKeyNullTypes.FIELD_STRING_NOT_NULL, new String[]{"TEST data 14", "test data 118", null, "test DATA 199"}, Case.INSENSITIVE).findAll(); fail(); } catch (IllegalArgumentException ignored) { } }
Source:
public WorkunitInfo getWUInfo(String wuid, boolean unarchive) throws Exception { WorkunitInfo workunit = null; if (wsWorkunitsServiceSoapProxy == null) throw new Exception("wsWorkunitsServiceSoapProxy not available"); else { WUInfoRequestWrapper wuinfodetailsparams = new WUInfoRequestWrapper(); wuinfodetailsparams.setIncludeApplicationValues(false); wuinfodetailsparams.setIncludeDebugValues(false); wuinfodetailsparams.setIncludeExceptions(true); wuinfodetailsparams.setIncludeGraphs(false); wuinfodetailsparams.setIncludeResults(true); wuinfodetailsparams.setWuid(wuid); WUInfoResponseWrapper wuInfoResponse = soapWrapper.WUInfo(wuinfodetailsparams); ArrayOfEspException exceptions = wuInfoResponse.getRawArrayOfEspExceptions(); if (exceptions == null && wuInfoResponse.getWorkunit() != null) { if (unarchive && wuInfoResponse.getWorkunit().getArchived()) { doWorkunitAction(wuid, ECLWUActions.Restore); return getWUInfo(wuid); } workunit = wuInfoResponse.getWorkunit(); workunit.setOriginalEclWatchUrl(getEclWatchUrl()); } else { throwWsWUExceptions(exceptions, "Could not fetch WU Info"); } } return workunit; }

Target:
public WorkunitInfo getWUInfo(String wuid, boolean unarchive) throws Exception { WorkunitInfo workunit = null; getSoapProxy(); WUInfoRequestWrapper wuinfodetailsparams = new WUInfoRequestWrapper(); wuinfodetailsparams.setIncludeApplicationValues(false); wuinfodetailsparams.setIncludeDebugValues(false); wuinfodetailsparams.setIncludeExceptions(true); wuinfodetailsparams.setIncludeGraphs(false); wuinfodetailsparams.setIncludeResults(true); wuinfodetailsparams.setWuid(wuid); WUInfoResponseWrapper wuInfoResponse = soapWrapper.WUInfo(wuinfodetailsparams); ArrayOfEspException exceptions = wuInfoResponse.getRawArrayOfEspExceptions(); if (exceptions == null && wuInfoResponse.getWorkunit() != null) { if (unarchive && wuInfoResponse.getWorkunit().getArchived()) { doWorkunitAction(wuid, ECLWUActions.Restore); return getWUInfo(wuid); } workunit = wuInfoResponse.getWorkunit(); workunit.setOriginalEclWatchUrl(getEclWatchUrl()); } else { throwWsWUExceptions(exceptions, "Could not fetch WU Info"); } return workunit; }
Source:
public void setLinkForeground (Color color) { checkWidget(); if (color != null && color.isDisposed ()) error(SWT.ERROR_INVALID_ARGUMENT); linkColor = color; if (getEnabled()) { styleLinkParts(); redraw(); } }

Target:
public void setLinkForeground (Color color) { checkWidget(); if (color != null) { if (color.isDisposed ()) error(SWT.ERROR_INVALID_ARGUMENT); if (color.equals(linkColor)) return; } else if (linkColor == null) return; linkColor = color; if (getEnabled()) { styleLinkParts(); redraw(); } }
Source:
public List<LambdaEvent> getLambdaEventsByOrganization(@ApiParam(hidden = true) @Parameter(hidden = true, name = "user", in = ParameterIn.HEADER) @Auth User user, @ApiParam(value = "organization", required = true) @PathParam("organization") String organization, @ApiParam(value = PAGINATION_OFFSET_TEXT) @QueryParam("offset") @DefaultValue("0") String offset, @ApiParam(value = PAGINATION_LIMIT_TEXT, allowableValues = "range[1,100]", defaultValue = PAGINATION_LIMIT) @DefaultValue(PAGINATION_LIMIT) @QueryParam("limit") Integer limit) { List<Workflow> workflows = workflowDAO.findMyEntries(user.getId()); boolean canAccessOrganization = workflows.stream().anyMatch(workflow -> Objects.equals(workflow.getOrganization(), organization) && Objects.equals(workflow.getSourceControl(), SourceControl.GITHUB)); if (!canAccessOrganization) { throw new CustomWebApplicationException("You do not have access to the GitHub organization '" + organization + "'", HttpStatus.SC_BAD_REQUEST); } return lambdaEventDAO.findByOrganization(organization, offset, limit); }

Target:
public List<LambdaEvent> getLambdaEventsByOrganization(@ApiParam(hidden = true) @Parameter(hidden = true, name = "user", in = ParameterIn.HEADER) @Auth User user, @ApiParam(value = "organization", required = true) @PathParam("organization") String organization, @ApiParam(value = PAGINATION_OFFSET_TEXT) @QueryParam("offset") @DefaultValue("0") String offset, @ApiParam(value = PAGINATION_LIMIT_TEXT, allowableValues = "range[1,100]", defaultValue = PAGINATION_LIMIT) @DefaultValue(PAGINATION_LIMIT) @QueryParam("limit") Integer limit) { User authUser = userDAO.findById(user.getId()); List<Token> githubToken = tokenDAO.findGithubByUserId(authUser.getId()); if (githubToken.size() == 0) { throw new CustomWebApplicationException("You do not have GitHub connected to your account.", HttpStatus.SC_BAD_REQUEST); } GitHubSourceCodeRepo sourceCodeRepoInterface = (GitHubSourceCodeRepo)SourceCodeRepoFactory.createSourceCodeRepo(githubToken.get(0), client); Set<String> organizations = sourceCodeRepoInterface.getMyOrganizations(); if (!organizations.contains(organization)) { throw new CustomWebApplicationException("You do not have access to the GitHub organization '" + organization + "'", HttpStatus.SC_UNAUTHORIZED); } return lambdaEventDAO.findByOrganization(organization, offset, limit); }
Source:
static TransactionManager createTransactionManager(TestableTimelockCluster cluster) { List<String> serverUris = cluster.servers().stream() .map(server -> server.serverHolder().getTimelockUri()) .collect(Collectors.toList()); AtlasDbConfig config = ImmutableAtlasDbConfig.builder() .namespace(AGENT) .keyValueService(new InMemoryAtlasDbConfig()) .timelock(ImmutableTimeLockClientConfig.builder() .serversList(ImmutableServerListConfig.builder() .servers(serverUris) .sslConfiguration(SslConfiguration.of(Paths.get("var/security/trustStore.jks"))) .build()) .build()) .build(); return TransactionManagers.builder() .config(config) .userAgent(AGENT) .globalMetricsRegistry(new MetricRegistry()) .globalTaggedMetricRegistry(DefaultTaggedMetricRegistry.getDefault()) .build() .serializable(); }

Target:
static TransactionManager createTransactionManager(TestableTimelockCluster cluster) { return createTransactionManager(cluster, UUID.randomUUID().toString()); }
Source:
public S3RecordReader createRecordReader() { S3RecordReader s3RecordReader = new S3RecordReader(); s3RecordReader.setBucketName(S3BlockReader.extractBucket(getFiles())); s3RecordReader.setAccessKey(S3BlockReader.extractAccessKey(getFiles())); s3RecordReader.setSecretAccessKey(S3BlockReader.extractSecretAccessKey(getFiles())); s3RecordReader.setEndPoint(s3EndPoint); s3RecordReader.setMode(this.getMode()); s3RecordReader.setRecordLength(this.getRecordLength()); if (overflowBlockSize != 0) { s3RecordReader.setOverflowBufferSize(overflowBlockSize); ; } return s3RecordReader; }

Target:
public S3RecordReader createRecordReader() { S3RecordReader s3RecordReader = new S3RecordReader(); s3RecordReader.setBucketName(S3BlockReader.extractBucket(getFiles())); s3RecordReader.setAccessKey(S3BlockReader.extractAccessKey(getFiles())); s3RecordReader.setSecretAccessKey(S3BlockReader.extractSecretAccessKey(getFiles())); s3RecordReader.setEndPoint(s3EndPoint); s3RecordReader.setMode(this.getMode()); s3RecordReader.setRecordLength(this.getRecordLength()); if (overflowBlockSize != 0) { s3RecordReader.setOverflowBufferSize(overflowBlockSize); } return s3RecordReader; }
Source:
public PartitionState getPartitionState() { long currentSealedStateChangeCounter = clusterManagerCallback.getSealedStateChangeCounter(); if (currentSealedStateChangeCounter > lastUpdatedSealedStateChangeCounter.get()) { lastUpdatedSealedStateChangeCounter.set(currentSealedStateChangeCounter); boolean isSealed = false; for (AmbryReplica replica : clusterManagerCallback.getReplicaIdsForPartition(this)) { if (replica.isSealed()) { isSealed = true; break; } } state = isSealed ? PartitionState.READ_ONLY : PartitionState.READ_WRITE; } return state; }

Target:
public PartitionState getPartitionState() { long currentCounterValue = clusterManagerCallback.getSealedStateChangeCounter(); if (currentCounterValue > lastUpdatedSealedStateChangeCounter && stateChangeLock.tryLock()) { try { lastUpdatedSealedStateChangeCounter = currentCounterValue; boolean isSealed = false; for (AmbryReplica replica : clusterManagerCallback.getReplicaIdsForPartition(this)) { if (replica.isSealed()) { isSealed = true; break; } } state = isSealed ? PartitionState.READ_ONLY : PartitionState.READ_WRITE; } finally { stateChangeLock.unlock(); } } return state; }
Source:
public void onNext(final AllocatedEvaluator allocatedEvaluator) { final int number = numAllocatedEvaluators.getAndIncrement(); final Configuration taskConf; final String taskId; final String endPointId; final Configuration iterationConf = Tang.Factory.getTang().newConfigurationBuilder() .bindNamedParameter(MessageExchangeParameters.TotalIterationNum.class, Integer.toString(numTotalIterations)) .build(); if (number < totalNumSenders) { endPointId = SENDER_PREFIX + number; taskId = endPointId + "-TASK"; taskConf = Configurations.merge(TaskConfiguration.CONF .set(TaskConfiguration.IDENTIFIER, taskId) .set(TaskConfiguration.TASK, SenderTask.class) .build(), iterationConf); } else if (number < totalNumSenders + totalNumReceivers) { endPointId = RECEIVER_PREFIX + (number - totalNumSenders); taskId = endPointId + "-TASK"; taskConf = Configurations.merge(TaskConfiguration.CONF .set(TaskConfiguration.IDENTIFIER, taskId) .set(TaskConfiguration.TASK, ReceiverTask.class) .build(), iterationConf); } else { throw new RuntimeException("Too many allocated evaluators"); } allocatedEvaluator.submitContextAndServiceAndTask( getContextConfiguration(endPointId), getServiceConfiguration(), taskConf ); }

Target:
public void onNext(final AllocatedEvaluator allocatedEvaluator) { final int number = numAllocatedEvaluators.getAndIncrement(); final Configuration taskConf; final String taskId; final String endPointId; final Configuration iterationConf = Tang.Factory.getTang().newConfigurationBuilder() .bindNamedParameter(MessageExchangeParameters.TotalIterationNum.class, Integer.toString(numTotalIterations)) .build(); if (number < totalNumSenders) { endPointId = SENDER_PREFIX + number; taskId = endPointId + TASK_POSTFIX; taskConf = Configurations.merge(TaskConfiguration.CONF .set(TaskConfiguration.IDENTIFIER, taskId) .set(TaskConfiguration.TASK, SenderTask.class) .build(), iterationConf); } else if (number < totalNumSenders + totalNumReceivers) { endPointId = RECEIVER_PREFIX + (number - totalNumSenders); taskId = endPointId + TASK_POSTFIX; taskConf = Configurations.merge(TaskConfiguration.CONF .set(TaskConfiguration.IDENTIFIER, taskId) .set(TaskConfiguration.TASK, ReceiverTask.class) .build(), iterationConf); } else { throw new RuntimeException("Too many allocated evaluators"); } allocatedEvaluator.submitContextAndServiceAndTask( getContextConfiguration(endPointId), getServiceConfiguration(), taskConf ); }
Source:
public void unknownUserID() throws Exception { this.exception.expect(AuthenticationException.class); this.exception .expectMessage(containsString("You have not supplied an unknown user ID.")); this.client.country(InetAddress.getByName("2.2.3.1")); }

Target:
public void unknownUserID() throws Exception { this.exception.expect(AuthenticationException.class); this.exception .expectMessage(containsString("You have supplied an unknown user ID.")); this.client.country(InetAddress.getByName("2.2.3.1")); }
Source:
public void testToXml() throws OseeCoreException { ITestUnitStore testUnitStore = new MockTestUnitStore(); TestUnitCache tc = new TestUnitCache(testUnitStore); HashMap<Integer, String> entries = new HashMap<Integer, String>(); for (int i = 0; i < 10; i++) { entries.put(i, "test" + Integer.toString(i)); tc.put(testUnitStore.getNextTestUnitId(), "test" + Integer.toString(i)); } CoverageItem ci = createCoverageItem(tc); tc.addTestUnit(ci, "test2"); tc.addTestUnit(ci, "test1"); tc.addTestUnit(ci, "test10"); String expected = "1;2;10"; String actual = tc.toXml(ci); Assert.assertTrue(expected.equals(actual)); }

Target:
public void testToXml() throws OseeCoreException { HashMap<Integer, String> entries = new HashMap<Integer, String>(); for (int i = 0; i < 10; i++) { entries.put(i, "test" + Integer.toString(i)); tc.put(testUnitStore.getNextTestUnitId(), "test" + Integer.toString(i)); } CoverageItem ci = createCoverageItem(tc); tc.addTestUnit(ci, "test2"); tc.addTestUnit(ci, "test1"); tc.addTestUnit(ci, "test10"); String expected = "1;2;10"; String actual = tc.toXml(ci); Assert.assertEquals(expected, actual); }
Source:
protected void buildVmVideoCards() { createInfo.add(VdsProperties.display, vm.getdisplay_type().toString()); createInfo.add(VdsProperties.num_of_monitors, (new Integer(vm.getnum_of_monitors())).toString()); }

Target:
protected void buildVmVideoCards() { createInfo.add(VdsProperties.display, vm.getdisplay_type().toString()); createInfo.add(VdsProperties.num_of_monitors, String.valueOf(vm.getnum_of_monitors())); }
Source:
public PalantirContent setAndVerifyPlayerPosition(double lat, double lng, double zoom, boolean centerMap) { waitForElementVisibleByElement(mapFrame); driver.switchTo().activeElement(); JavascriptExecutor jsexec = (JavascriptExecutor) driver; driver.manage().timeouts().setScriptTimeout(20, TimeUnit.SECONDS); Object res = jsexec.executeAsyncScript( PalantirContent.PONTO_SETPLAYER, lat, lng, zoom, centerMap ); PalantirContent handle = new PalantirContent(); try { JSONObject json = new JSONObject(res.toString()); handle.success = json.getString(PalantirContent.PONTO_MSG_SUCCESS); handle.responseCode = json.getString(PalantirContent.PONTO_MSG_RESPONSECODE); handle.message = json.getString(PalantirContent.PONTO_MSG_MESSAGE); PageObjectLogging.log( "setAndVerifyPlayerPosition", handle.message, true, driver ); }catch (JSONException e) { PageObjectLogging.log( "setAndVerifyPlayerPosition", "Position was not set", false, driver ); } return handle; }

Target:
public PalantirContent setAndVerifyPlayerPosition(double lat, double lng, double zoom, boolean centerMap) { waitForElementVisibleByElement(mapFrame); JavascriptExecutor jsexec = (JavascriptExecutor) driver; driver.manage().timeouts().setScriptTimeout(20, TimeUnit.SECONDS); Object res = jsexec.executeAsyncScript( PalantirContent.PONTO_SETPLAYER, lat, lng, zoom, centerMap ); return getResponse(res, "setAndVerifyPlayerPosition"); }
Source:
if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) { if (OS.WIN32_VERSION < OS.VERSION(10, 0)){ OS.SetProcessDPIAware(); } else { long hResult = OS.SetProcessDpiAwareness(2); if (hResult == SWT.E_ACCESSDENIED) System.out.println("The DPI awareness is already set.."); } }

Target:
if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) { { long hResult1; int[] value1 = new int[1]; hResult1 = OS.GetProcessDpiAwareness(-1, value1); DPIUtil.BEFORE = value1[0]; int value = 2; long hResult = OS.SetProcessDpiAwareness(value); DPIUtil.RESULT = hResult; int[] value2 = new int[1]; hResult1 = OS.GetProcessDpiAwareness(-1, value2); DPIUtil.AFTER = value2[0]; if (hResult == SWT.E_ACCESSDENIED) System.out.println("The DPI awareness is already set.."); else System.err.println("hResult: " + hResult); } }
Source:
public AmbientOcclusionNode(Context context) { displayResolutionDependentFBOs = context.get(DisplayResolutionDependentFBOs.class); RenderingConfig renderingConfig = context.get(Config.class).getRendering(); renderingConfig.subscribe(RenderingConfig.SSAO, this); requiresCondition(renderingConfig::isSsao); addDesiredStateChange(new EnableMaterial(SSAO_MATERIAL)); ssaoMaterial = getMaterial(SSAO_MATERIAL); requiresFBO(new FBOConfig(SSAO_FBO, FULL_SCALE, FBO.Type.DEFAULT), displayResolutionDependentFBOs); addDesiredStateChange(new BindFBO(SSAO_FBO, displayResolutionDependentFBOs)); addDesiredStateChange(new SetViewportToSizeOf(SSAO_FBO, displayResolutionDependentFBOs)); update(); displayResolutionDependentFBOs.subscribe(this); }

Target:
public AmbientOcclusionNode(Context context) { super(context); RenderingConfig renderingConfig = context.get(Config.class).getRendering(); renderingConfig.subscribe(RenderingConfig.SSAO, this); requiresCondition(renderingConfig::isSsao); addDesiredStateChange(new EnableMaterial(SSAO_MATERIAL)); ssaoMaterial = getMaterial(SSAO_MATERIAL); displayResolutionDependentFBOs = context.get(DisplayResolutionDependentFBOs.class); requiresFBO(new FBOConfig(SSAO_FBO, FULL_SCALE, FBO.Type.DEFAULT), displayResolutionDependentFBOs); addDesiredStateChange(new BindFBO(SSAO_FBO, displayResolutionDependentFBOs)); addDesiredStateChange(new SetViewportToSizeOf(SSAO_FBO, displayResolutionDependentFBOs)); update(); displayResolutionDependentFBOs.subscribe(this); }
Source:
private static Boolean getBooleanValue(String value) { return !Strings.isNullOrEmpty(value); }

Target:
private static Boolean getBooleanValue(String value) { if (value != null) { return value.equalsIgnoreCase(YES); } return null; }
Source:
protected FenceOperationResult changeStatus(FenceActionType fenceAction) { FenceAgentExecutor agentExecutor = createAgentExecutor(); FenceOperationResult statusResult = null; int fenceRetries = -1; do { FenceOperationResult result = agentExecutor.fence(fenceAction, fenceAgent); if (result.getStatus() == Status.SKIPPED_ALREADY_IN_STATUS) { return new FenceOperationResult( Status.SKIPPED_ALREADY_IN_STATUS, fenceAction == FenceActionType.START ? PowerStatus.ON : PowerStatus.OFF); } else if (result.getStatus() == Status.SKIPPED_DUE_TO_POLICY) { return result; } if (result.getStatus() == Status.SUCCESS) { statusResult = waitForStatus(fenceAction); if (isRequestedStatusAchieved(statusResult)) { return statusResult; } } fenceRetries++; } while (fenceRetries < allowedFenceActionRetries); return new FenceOperationResult( Status.ERROR, statusResult == null ? PowerStatus.UNKNOWN : statusResult.getPowerStatus(), "Allowed retries to verify host power status exceeded"); }

Target:
protected FenceOperationResult changeStatus(FenceActionType fenceAction) { FenceAgentExecutor agentExecutor = createAgentExecutor(); FenceOperationResult statusResult = null; int fenceRetries = -1; do { FenceOperationResult result = agentExecutor.fence(fenceAction, fenceAgent); if (result.getStatus() == Status.SKIPPED_ALREADY_IN_STATUS) { return new FenceOperationResult( Status.SUCCESS, fenceAction == FenceActionType.START ? PowerStatus.ON : PowerStatus.OFF); } else if (result.getStatus() == Status.SKIPPED_DUE_TO_POLICY) { return result; } if (result.getStatus() == Status.SUCCESS) { statusResult = waitForStatus(fenceAction); if (isRequestedStatusAchieved(statusResult)) { return statusResult; } } fenceRetries++; } while (fenceRetries < allowedFenceActionRetries); return new FenceOperationResult( Status.ERROR, statusResult == null ? PowerStatus.UNKNOWN : statusResult.getPowerStatus(), "Allowed retries to verify host power status exceeded"); }
Source:
protected void reportError(String message, Exception ex, Object... args) { if (ex == null) { Activator.getDefault().getReportService().report(new AbstractReport(message, args)); } else { Activator.getDefault().getReportService().report(new AbstractReport(ex, message, args)); } showErrorMessageDialog(message); }

Target:
protected void reportError(String message, Exception ex, Object... args) { if (ex == null) { reportService.report(new AbstractReport(message, args)); } else { reportService.report(new AbstractReport(ex, message, args)); } showErrorMessageDialog(message); }
Source:
public static Map<Item, Integer> getBurnTimes() { return burnTimes != null ? burnTimes : (burnTimes = Maps.newLinkedHashMap()); }

Target:
private static Map<Item, Integer> getBurnTimes() { return burnTimes != null ? burnTimes : (burnTimes = Collections.unmodifiableMap(TileEntityFurnace.getBurnTimes())); }
Source:
public void openItemByPath(String path) { Actions action = actionsFactory.createAction(seleniumWebDriver); waitItem(path); selectItem(path); waitItemIsSelected(path); try { getProjectExplorerItem(path).click(); waitItemIsSelected(path); action.moveToElement(getProjectExplorerItem(path)).perform(); action.doubleClick().perform(); } catch (StaleElementReferenceException ex) { LOG.error(ex.getLocalizedMessage(), ex); clickOnRefreshTreeButton(); waitItem(path); getProjectExplorerItem(path).click(); waitItemIsSelected(path); action.moveToElement(getProjectExplorerItem(path)).perform(); action.doubleClick().perform(); } loader.waitOnClosed(); }

Target:
public void openItemByPath(String path) { Actions action = actionsFactory.createAction(seleniumWebDriver); waitItem(path); selectItem(path); waitItemIsSelected(path); try { getProjectExplorerItem(path).click(); waitItemIsSelected(path); action.moveToElement(getProjectExplorerItem(path)).perform(); action.doubleClick().perform(); } catch (StaleElementReferenceException ex) { LOG.warn(ex.getLocalizedMessage(), ex); clickOnRefreshTreeButton(); waitItem(path); getProjectExplorerItem(path).click(); waitItemIsSelected(path); action.moveToElement(getProjectExplorerItem(path)).perform(); action.doubleClick().perform(); } loader.waitOnClosed(); }
Source:
protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException { String fullName = aliases.getOrDefault(name, name); PluginClassLoader pluginLoader = pluginClassLoader(fullName); if (pluginLoader != null) { log.trace("Retrieving loaded class '{}' from '{}'", fullName, pluginLoader); ClassLoader oldClassloader = Plugins.compareAndSwapLoaders(pluginLoader); try { Class<?> clazz = pluginLoader.loadClass(fullName, resolve); Plugins.compareAndSwapLoaders(oldClassloader); return clazz; } catch (Throwable t) { Plugins.compareAndSwapLoaders(oldClassloader); throw t; } } return super.loadClass(fullName, resolve); }

Target:
protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException { String fullName = aliases.containsKey(name) ? aliases.get(name) : name; PluginClassLoader pluginLoader = pluginClassLoader(fullName); if (pluginLoader != null) { log.trace("Retrieving loaded class '{}' from '{}'", fullName, pluginLoader); return pluginLoader.loadClass(fullName, resolve); } return super.loadClass(fullName, resolve); }
Source:
public static JoystickControl getJoystickButtonFromControllerButton(ControllerButton controllerButton) { switch (controllerButton) { case A: return JoystickControl.A; case B: return JoystickControl.B; case X: return JoystickControl.X; case Y: return JoystickControl.Y; case BACK: return JoystickControl.BACK; case GUIDE: return JoystickControl.GUIDE; case START: return JoystickControl.START; case LEFTSTICK: return JoystickControl.LEFT_STICK; case RIGHTSTICK: return JoystickControl.RIGHT_STICK; case LEFTBUMPER: return JoystickControl.LEFT_BUMPER; case RIGHTBUMPER: return JoystickControl.RIGHT_BUMPER; case DPAD_UP: return JoystickControl.DPAD_UP; case DPAD_DOWN: return JoystickControl.DPAD_DOWN; case DPAD_LEFT: return JoystickControl.DPAD_LEFT; case DPAD_RIGHT: return JoystickControl.DPAD_RIGHT; default: throw new IllegalArgumentException("Unknown button type: " + controllerButton); } }

Target:
public static JoystickControl getJoystickButtonFromControllerButton(ControllerButton controllerButton) { switch (controllerButton) { case A: return JoystickControl.A; case B: return JoystickControl.B; case X: return JoystickControl.X; case Y: return JoystickControl.Y; case BACK: return JoystickControl.BACK; case GUIDE: return JoystickControl.SELECT; case START: return JoystickControl.START; case LEFTSTICK: return JoystickControl.L3; case RIGHTSTICK: return JoystickControl.R3; case LEFTBUMPER: return JoystickControl.L; case RIGHTBUMPER: return JoystickControl.R; case DPAD_UP: return JoystickControl.DPAD_UP; case DPAD_DOWN: return JoystickControl.DPAD_DOWN; case DPAD_LEFT: return JoystickControl.DPAD_LEFT; case DPAD_RIGHT: return JoystickControl.DPAD_RIGHT; default: throw new IllegalArgumentException("Unknown button type: " + controllerButton); } }
Source:
protected void parseTransformer(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { String jsonSerializer = element.getAttribute("json-serializer"); if (StringUtils.hasText(jsonSerializer)) { builder.addConstructorArgReference(jsonSerializer); } if (element.hasAttribute("content-type")){ builder.addPropertyValue("contentType", element.getAttribute("content-type")); } }

Target:
protected void parseTransformer(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { String objectMapper = element.getAttribute("object-mapper"); if (StringUtils.hasText(objectMapper)) { builder.addConstructorArgReference(objectMapper); } if (element.hasAttribute("content-type")){ builder.addPropertyValue("contentType", element.getAttribute("content-type")); } }
Source:
public void setLogLikelihoods(final double[] ll) { ValidationUtils.validateArg(ll.length == NUM_GENOTYPES, () -> "logLikelihood must have length 3, found " + ll.length); double max = MathUtil.max(ll); final double[] maxRemoved = MathUtil.sum(ll, -max); double sum = MathUtil.sum(MathUtil.getProbabilityFromLog(maxRemoved)); System.arraycopy(MathUtil.sum(maxRemoved, -Math.log10(sum)), 0, loglikelihoods, 0, NUM_GENOTYPES); likelihoodsNeedUpdating = true; updateDependentValues(); }

Target:
public void setLogLikelihoods(final double[] ll) { ValidationUtils.validateArg(ll.length == NUM_GENOTYPES, () -> String.format("logLikelihood must have length %d, found %d", NUM_GENOTYPES, ll.length)); final double[] maxRemoved = MathUtil.subtractMax(ll); double sum = MathUtil.sum(MathUtil.getProbabilityFromLog(maxRemoved)); System.arraycopy(MathUtil.sum(maxRemoved, -Math.log10(sum)), 0, loglikelihoods, 0, NUM_GENOTYPES); likelihoodsNeedUpdating = true; updateDependentValues(); }
Source:
private void updateGpuEnabledHostsDetails(List<HostVO> hosts) { List<HostVO> gpuEnabledHosts = new ArrayList<HostVO>(); if (hostIds != null) { for (HostVO host : hosts) { if (hostIds.contains(host.getId())) { gpuEnabledHosts.add(host); } } } else { gpuEnabledHosts = hosts; } for (HostVO host : gpuEnabledHosts) { HashMap<String, HashMap<String, VgpuTypesInfo>> groupDetails = _resourceMgr.getGPUStatistics(host); if (groupDetails != null) { _resourceMgr.updateGPUDetails(host.getId(), groupDetails); } } hostIds = _hostGpuGroupsDao.listHostIds(); }

Target:
private void updateGpuEnabledHostsDetails(List<HostVO> hosts) { List<HostVO> gpuEnabledHosts = new ArrayList<HostVO>(); List<Long> hostIds = _hostGpuGroupsDao.listHostIds(); if (CollectionUtils.isEmpty(hostIds)) { return; } for (HostVO host : hosts) { if (hostIds.contains(host.getId())) { gpuEnabledHosts.add(host); } } for (HostVO host : gpuEnabledHosts) { HashMap<String, HashMap<String, VgpuTypesInfo>> groupDetails = _resourceMgr.getGPUStatistics(host); if (MapUtils.isEmpty(groupDetails)) { _resourceMgr.updateGPUDetails(host.getId(), groupDetails); } } }
Source:
public SimpleSearcher(String indexDir, Analyzer analyzer) throws IOException { Path indexPath = Paths.get(indexDir); if (!Files.exists(indexPath) || !Files.isDirectory(indexPath) || !Files.isReadable(indexPath)) { throw new IllegalArgumentException(indexDir + " does not exist or is not a directory."); } this.reader = DirectoryReader.open(FSDirectory.open(indexPath)); this.similarity = new BM25Similarity(0.9f, 0.4f); this.analyzer = analyzer; this.searchtweets = false; this.isRerank = false; cascade = new RerankerCascade("default"); cascade.add(new ScoreTiesAdjusterReranker()); }

Target:
public SimpleSearcher(String indexDir, Analyzer analyzer) throws IOException { Path indexPath = Paths.get(indexDir); if (!Files.exists(indexPath) || !Files.isDirectory(indexPath) || !Files.isReadable(indexPath)) { throw new IllegalArgumentException(indexDir + " does not exist or is not a directory."); } this.reader = DirectoryReader.open(FSDirectory.open(indexPath)); this.similarity = new BM25Similarity(0.9f, 0.4f); this.analyzer = analyzer; this.searchtweets = false; this.isRerank = false; cascade = new RerankerCascade(); cascade.add(new ScoreTiesAdjusterReranker()); }
Source:
public void prepareRun(BatchSourceContext context) throws Exception { Job job = JobUtils.createInstance(); Configuration conf = job.getConfiguration(); if (StringUtils.isNotEmpty(config.pattern)) { conf.set(XMLInputFormat.XML_INPUTFORMAT_PATTERN, config.pattern); } XMLInputFormat.addInputPaths(job, config.path); conf.set(XMLInputFormat.XML_INPUTFORMAT_REPROCESSING_REQUIRED, this.config.reprocessingRequired); setFileTrackingInfo(context, conf); if (StringUtils.isNotEmpty(this.config.actionAfterProcess)) { conf.set(XMLInputFormat.XML_INPUTFORMAT_FILE_ACTION, this.config.actionAfterProcess); } if (StringUtils.isNotEmpty(this.config.targetFolder)) { conf.set(XMLInputFormat.XML_INPUTFORMAT_TARGET_FOLDER, this.config.targetFolder); } conf.set(XMLInputFormat.XML_INPUTFORMAT_NODE_PATH, this.config.nodePath); conf.set(XMLInputFormat.XML_INPUT_NAME_CONFIG, config.path); XMLInputFormat.setInputPathFilter(job, BatchXMLFileFilter.class); context.setInput(Input.of(config.referenceName, new SourceInputFormatProvider(XMLInputFormat.class, conf))); }

Target:
public void prepareRun(BatchSourceContext context) throws Exception { Job job = JobUtils.createInstance(); Configuration conf = job.getConfiguration(); conf.set(XMLInputFormat.XML_INPUTFORMAT_PATH_NAME, config.path); conf.set(XMLInputFormat.XML_INPUTFORMAT_NODE_PATH, config.nodePath); if (StringUtils.isNotEmpty(config.pattern)) { conf.set(XMLInputFormat.XML_INPUTFORMAT_PATTERN, config.pattern); } conf.set(XMLInputFormat.XML_INPUTFORMAT_FILE_ACTION, config.actionAfterProcess); if (StringUtils.isNotEmpty(config.targetFolder)) { conf.set(XMLInputFormat.XML_INPUTFORMAT_TARGET_FOLDER, config.targetFolder); } setFileTrackingInfo(context, conf); fileSystem = FileSystem.get(conf); long startTime = context.getLogicalStartTime(); String tempDirectory = config.tableName + startTime; tempDirectoryPath = new Path(config.temporaryFolder, tempDirectory); fileSystem.mkdirs(tempDirectoryPath); fileSystem.deleteOnExit(tempDirectoryPath); conf.set(XMLInputFormat.XML_INPUTFORMAT_PROCESSED_DATA_TEMP_FOLDER, tempDirectoryPath.toUri().toString()); XMLInputFormat.setInputPathFilter(job, BatchXMLFileFilter.class); XMLInputFormat.addInputPath(job, new Path(config.path)); context.setInput(Input.of(config.referenceName, new SourceInputFormatProvider(XMLInputFormat.class, conf))); }
Source:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } VdcParametersMap otherParamsMap = (VdcParametersMap) obj; return paramsMap.equals(otherParamsMap.paramsMap); }

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } return paramsMap.equals(((VdcParametersMap) obj).paramsMap); }