auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public SchedulerAccount readAccount(final String username) { return executeReadOnlyTransaction(session -> { Query tasksQuery = session.getNamedQuery("readAccountTasks").setParameter("username", username); int taskCount; long taskDuration; Object[] taskResult = (Object[]) tasksQuery.uniqueResult(); taskCount = ((Number) taskResult[0]).intValue(); if (taskResult[1] != null) { taskDuration = ((Number) taskResult[1]).longValue(); } else { <START> taskDuration = 0; <END> } int jobCount; long jobDuration; Query jobQuery = session.getNamedQuery("readAccountJobs").setParameter("username", username); Object[] jobResult = (Object[]) jobQuery.uniqueResult(); jobCount = ((Number) jobResult[0]).intValue(); if (jobResult[1] != null) { jobDuration = ((Number) jobResult[1]).longValue(); } else { jobDuration = 0; } return new SchedulerAccount(username, taskCount, taskDuration, jobCount, jobDuration); }); }</code><technical_language>zero here, initialized zero top. do explicit top remove this else code path</technical_language>

Target:
public SchedulerAccount readAccount(final String username) { return executeReadOnlyTransaction(session -> { Query tasksQuery = session.getNamedQuery("readAccountTasks").setParameter("username", username); int taskCount; long taskDuration; Object[] taskResult = (Object[]) tasksQuery.uniqueResult(); taskCount = ((Number) taskResult[0]).intValue(); if (taskResult[1] != null) { taskDuration = ((Number) taskResult[1]).longValue(); } else { taskDuration = 0L; } int jobCount; long jobDuration; Query jobQuery = session.getNamedQuery("readAccountJobs").setParameter("username", username); Object[] jobResult = (Object[]) jobQuery.uniqueResult(); jobCount = ((Number) jobResult[0]).intValue(); if (jobResult[1] != null) { jobDuration = ((Number) jobResult[1]).longValue(); } else { jobDuration = 0L; } return new SchedulerAccount(username, taskCount, taskDuration, jobCount, jobDuration); }); }
Source:
<code>public static double stSphericalDistance(@SqlType(SPHERICAL_GEOGRAPHY_TYPE_NAME) Slice left, @SqlType(SPHERICAL_GEOGRAPHY_TYPE_NAME) Slice right) { OGCGeometry leftGeometry = deserialize(left); OGCGeometry rightGeometry = deserialize(right); if (leftGeometry.isEmpty()) { <START> throw new PrestoException(INVALID_FUNCTION_ARGUMENT, "Left-hand-side input value is empty"); <END> } if (rightGeometry.isEmpty()) { throw new PrestoException(INVALID_FUNCTION_ARGUMENT, "Right-hand-side input value is empty"); } validateSphericalType("ST_Distance", leftGeometry, EnumSet.of(POINT)); validateSphericalType("ST_Distance", rightGeometry, EnumSet.of(POINT)); Point leftPoint = (Point) leftGeometry.getEsriGeometry(); Point rightPoint = (Point) rightGeometry.getEsriGeometry(); return greatCircleDistance(leftPoint.getY(), leftPoint.getX(), rightPoint.getY(), rightPoint.getX()) * 1000; }</code><technical_language>I checked SQL/MM Part 3 spec ST_Distance return null if input is empty geometry. do that. <img width="837" alt="screen shot 2018-09-27 10 36 28 pm" src="<LINK_0>"></technical_language>

Target:
public static Double stSphericalDistance(@SqlType(SPHERICAL_GEOGRAPHY_TYPE_NAME) Slice left, @SqlType(SPHERICAL_GEOGRAPHY_TYPE_NAME) Slice right) { OGCGeometry leftGeometry = deserialize(left); OGCGeometry rightGeometry = deserialize(right); if (leftGeometry.isEmpty() || rightGeometry.isEmpty()) { return null; } validateSphericalType("ST_Distance", leftGeometry, EnumSet.of(POINT)); validateSphericalType("ST_Distance", rightGeometry, EnumSet.of(POINT)); Point leftPoint = (Point) leftGeometry.getEsriGeometry(); Point rightPoint = (Point) rightGeometry.getEsriGeometry(); return greatCircleDistance(leftPoint.getY(), leftPoint.getX(), rightPoint.getY(), rightPoint.getX()) * 1000; }
Source:
<code>public boolean isRead(Tip tip) { <START> return fReadList.contains(new Integer(tip.hashCode())); <END> }</code><technical_language>Integer.valueOf(...) instead</technical_language>

Target:
public boolean isRead(Tip tip) { return fReadList.contains(Integer.valueOf(tip.hashCode())); }
Source:
<code>public Set<KList> runRule(Set<KList> input) { Set<KList> result; if (this.label == null) { result = input; } else { result = new HashSet<>(); for (KList kl : input) { <START> result.add(new KList(Arrays.<Term>asList(new KApp(label, kl)))); <END> } } if (this instanceof ExitState) { return new HashSet<KList>(Arrays.asList(new KList(Arrays.asList((Term)new Ambiguity("K", new ArrayList<Term>(result)))))); } else { return result; } }</code><technical_language>add: public KList(Term... terms); a constructor, clean this line of code a bit</technical_language>

Target:
public Set<KList> runRule(Set<KList> input) { Set<KList> result; if (this.label == null) { result = input; } else { result = new HashSet<>(); for (KList kl : input) { result.add(new KList(Arrays.<Term>asList(new KApp(label, kl)))); } } if (this instanceof ExitState) { return new HashSet<KList>(Arrays.asList(new KList(Arrays.asList((Term)new Ambiguity(KSorts.K, new ArrayList<Term>(result)))))); } else { return result; } }
Source:
<code>public void configure(MetricRegistry metricRegistry, String name) { hijackJDKLogging(); final Logger root = configureLevels(); for (AppenderFactory output : appenders) { root.addAppender(output.build(root.getLoggerContext(), name, null)); } <START> printIfErrorsOccured(root.getLoggerContext()); <END> final MBeanServer server = ManagementFactory.getPlatformMBeanServer(); try { final ObjectName objectName = new ObjectName("io.dropwizard:type=Logging"); if (!server.isRegistered(objectName)) { server.registerMBean(new JMXConfigurator(root.getLoggerContext(), server, objectName), objectName); } } catch (MalformedObjectNameException | InstanceAlreadyExistsException | NotCompliantMBeanException | MBeanRegistrationException e) { throw new RuntimeException(e); } configureInstrumentation(root, metricRegistry); }</code><technical_language>more inclined logging error output stream. I more suitable for this kind of messages. redirect StatusPrinter System.err, bear in mind StatusPrinter for some reason is static, restore System.out using. making output stream a field of LoggingFactory? this: java @JsonIgnore private final PrintStream configurationErrorsStream; ... @VisibleForTesting LoggingFactory(LoggerContext loggerContext, PrintStream configurationErrorsStream) { this.loggerContext = checkNotNull(loggerContext); this.errorsStream = checkNotNull(configurationErrorsStream); } ... StatusPrinter.setPrintStream(configurationErrorsStream); try { printIfErrorsOccured(loggerContext); } finally { StatusPrinter.setPrintStream(System.out); } a benefit, pass a fake stream in test class in constructor</technical_language>

Target:
public void configure(MetricRegistry metricRegistry, String name) { hijackJDKLogging(); final Logger root = configureLevels(); for (AppenderFactory output : appenders) { root.addAppender(output.build(loggerContext, name, null)); } StatusPrinter.setPrintStream(configurationErrorsStream); try { StatusPrinter.printIfErrorsOccured(loggerContext); }finally { StatusPrinter.setPrintStream(System.out); } final MBeanServer server = ManagementFactory.getPlatformMBeanServer(); try { final ObjectName objectName = new ObjectName("io.dropwizard:type=Logging"); if (!server.isRegistered(objectName)) { server.registerMBean(new JMXConfigurator(loggerContext, server, objectName), objectName); } } catch (MalformedObjectNameException | InstanceAlreadyExistsException | NotCompliantMBeanException | MBeanRegistrationException e) { throw new RuntimeException(e); } configureInstrumentation(root, metricRegistry); }
Source:
<code>public int compare(Task firstTask, Task secondTask) { if (Objects.isNull(firstTask) || Objects.isNull(secondTask)) { return 1; } if (Objects.isNull(firstTask.getTitle()) ? !Objects.isNull(secondTask.getTitle()) : !firstTask.getTitle().equals(secondTask.getTitle())) { return 1; } if (Objects.isNull(firstTask.getOrdering()) ? !Objects.isNull(secondTask.getOrdering()) : !firstTask.getOrdering().equals(secondTask.getOrdering())) { return 1; } <START> if (!firstTask.isTypeAutomatic() == secondTask.isTypeAutomatic()) { <END> return 1; } if (!firstTask.isTypeMetadata() == secondTask.isTypeMetadata()) { return 1; } if (!firstTask.isTypeImagesRead() == secondTask.isTypeImagesRead()) { return 1; } if (!firstTask.isTypeImagesWrite() == secondTask.isTypeImagesWrite()) { return 1; } if (!firstTask.isTypeExportDMS() == secondTask.isTypeExportDMS()) { return 1; } if (!firstTask.isTypeAcceptClose() == secondTask.isTypeAcceptClose()) { return 1; } if (!firstTask.isTypeCloseVerify() == secondTask.isTypeCloseVerify()) { return 1; } if (Objects.isNull(firstTask.getScriptPath()) ? !Objects.isNull(secondTask.getScriptPath()) : !firstTask.getScriptPath().equals(secondTask.getScriptPath())) { return 1; } if (!firstTask.isBatchStep() == secondTask.isBatchStep()) { return 1; } return 0; }</code><technical_language>suggestion if (firstTask.isTypeAutomatic() != secondTask.isTypeAutomatic()) {</technical_language>

Target:
public int compare(Task firstTask, Task secondTask) { if (Objects.isNull(firstTask) || Objects.isNull(secondTask)) { return 1; } if (Objects.isNull(firstTask.getTitle()) ? Objects.nonNull(secondTask.getTitle()) : !firstTask.getTitle().equals(secondTask.getTitle())) { return 1; } if (Objects.isNull(firstTask.getOrdering()) ? Objects.nonNull(secondTask.getOrdering()) : !firstTask.getOrdering().equals(secondTask.getOrdering())) { return 1; } if (firstTask.isTypeAutomatic() != secondTask.isTypeAutomatic()) { return 1; } if (firstTask.isTypeMetadata() != secondTask.isTypeMetadata()) { return 1; } if (firstTask.isTypeImagesRead() != secondTask.isTypeImagesRead()) { return 1; } if (firstTask.isTypeImagesWrite() != secondTask.isTypeImagesWrite()) { return 1; } if (firstTask.isTypeExportDMS() != secondTask.isTypeExportDMS()) { return 1; } if (firstTask.isTypeAcceptClose() != secondTask.isTypeAcceptClose()) { return 1; } if (firstTask.isTypeCloseVerify() != secondTask.isTypeCloseVerify()) { return 1; } if (Objects.isNull(firstTask.getScriptPath()) ? Objects.nonNull(secondTask.getScriptPath()) : !firstTask.getScriptPath().equals(secondTask.getScriptPath())) { return 1; } if (firstTask.isBatchStep() != secondTask.isBatchStep()) { return 1; } return 0; }
Source:
<code>public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { int lastVisibleItem = firstVisibleItem + visibleItemCount; <START> if (lastVisibleItem > 0 && getCards().size() > lastVisibleItem) { <END> String firstAns = getCards().get(firstVisibleItem).get("answer"); String lastAns = getCards().get(lastVisibleItem - 1).get("answer"); if (firstAns != null && firstAns.equals("") || lastAns != null && lastAns.equals("")) { showProgressBar(); long currentTime = SystemClock.elapsedRealtime (); if ((currentTime - mLastRenderStart > 300 || lastVisibleItem >= totalItemCount)) { mLastRenderStart = currentTime; DeckTask.cancelTask(DeckTask.TASK_TYPE_RENDER_BROWSER_QA); DeckTask.launchDeckTask(DeckTask.TASK_TYPE_RENDER_BROWSER_QA, mRenderQAHandler, new DeckTask.TaskData(new Object[]{getCards(), firstVisibleItem, visibleItemCount})); } } } }</code><technical_language>check explicitly firstVisibleItem lastVisibleItem - 1 in bounds</technical_language>

Target:
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { int lastVisibleItem = firstVisibleItem + visibleItemCount; int size = getCards().size(); if (size > 0 && firstVisibleItem < size && lastVisibleItem - 1 < size) { String firstAns = getCards().get(firstVisibleItem).get("answer"); String lastAns = getCards().get(lastVisibleItem - 1).get("answer"); if (firstAns != null && firstAns.equals("") || lastAns != null && lastAns.equals("")) { showProgressBar(); long currentTime = SystemClock.elapsedRealtime (); if ((currentTime - mLastRenderStart > 300 || lastVisibleItem >= totalItemCount)) { mLastRenderStart = currentTime; DeckTask.cancelTask(DeckTask.TASK_TYPE_RENDER_BROWSER_QA); DeckTask.launchDeckTask(DeckTask.TASK_TYPE_RENDER_BROWSER_QA, mRenderQAHandler, new DeckTask.TaskData(new Object[]{getCards(), firstVisibleItem, visibleItemCount})); } } } }
Source:
<code>public void readAllItemsByPageWithCosmosPagedIterableHandler() throws Exception { CosmosQueryRequestOptions cosmosQueryRequestOptions = new CosmosQueryRequestOptions(); CosmosPagedIterable<InternalObjectNode> cosmosPagedIterable = cosmosContainer.readAllItems(cosmosQueryRequestOptions, InternalObjectNode.class); AtomicInteger handleCount = new AtomicInteger(); cosmosPagedIterable = cosmosPagedIterable.handle(feedResponse -> { CosmosDiagnostics cosmosDiagnostics = feedResponse.getCosmosDiagnostics(); <START> logger.info("Cosmos Diagnostics : {}", cosmosDiagnostics); <END> if (cosmosDiagnostics != null) { handleCount.incrementAndGet(); } }); AtomicInteger itemCount = new AtomicInteger(); AtomicInteger feedResponseCount = new AtomicInteger(); cosmosPagedIterable.iterableByPage().forEach(feedResponse -> { feedResponseCount.incrementAndGet(); int size = feedResponse.getResults().size(); itemCount.addAndGet(size); }); assertThat(handleCount.get() >= 1).isTrue(); assertThat(handleCount.get()).isEqualTo(feedResponseCount.get()); assertThat(itemCount.get()).isEqualTo(NUM_OF_ITEMS); }</code><technical_language>loggger.info is noisy for test</technical_language>

Target:
public void readAllItemsByPageWithCosmosPagedIterableHandler() throws Exception { CosmosQueryRequestOptions cosmosQueryRequestOptions = new CosmosQueryRequestOptions(); CosmosPagedIterable<ObjectNode> cosmosPagedIterable = cosmosContainer.readAllItems(cosmosQueryRequestOptions, ObjectNode.class); AtomicInteger handleCount = new AtomicInteger(); cosmosPagedIterable = cosmosPagedIterable.handle(feedResponse -> { CosmosDiagnostics cosmosDiagnostics = feedResponse.getCosmosDiagnostics(); if (cosmosDiagnostics != null) { handleCount.incrementAndGet(); } }); AtomicInteger feedResponseCount = new AtomicInteger(); cosmosPagedIterable.iterableByPage().forEach(feedResponse -> { feedResponseCount.incrementAndGet(); }); assertThat(handleCount.get() >= 1).isTrue(); assertThat(handleCount.get()).isEqualTo(feedResponseCount.get()); }
Source:
<code>public void testJWTAuthShouldPassWithToken() throws Exception { String url = getContextBaseUrl() + "/users"; String basicAuth = "Basic YWRtaW46cGFzc3dvcmQ="; String body = given().header(HttpHeaders.AUTHORIZATION, basicAuth) .header(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON_VALUE) .when() .get(getContextBaseUrl() + "/login") .then() .statusCode(HttpStatus.OK.value()) .extract() .asString(); String tokenValue = getTokenValue(body); <START> given().header(HttpHeaders.AUTHORIZATION, tokenValue) <END> .header(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON_VALUE) .when() .get(url) .then() .statusCode(HttpStatus.OK.value()) .body(notNullValue()); }</code><technical_language>authentication header in this case Authorization: Bearer {token}, strange passes {token}. @adavid9 please check it</technical_language>

Target:
public void testJWTAuthShouldPassWithToken() throws Exception { String url = getContextBaseUrl() + "/users"; String basicAuth = "Basic YWRtaW46cGFzc3dvcmQ="; String body = given().header(HttpHeaders.AUTHORIZATION, basicAuth) .header(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON_VALUE) .when() .get(getContextBaseUrl() + "/login") .then() .statusCode(HttpStatus.OK.value()) .extract() .asString(); TestSecurityContextHolder.clearContext(); SecurityContextHolder.clearContext(); given().header(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON_VALUE) .when() .get(url) .then() .statusCode(HttpStatus.UNAUTHORIZED.value()) .body(notNullValue()); TestSecurityContextHolder.clearContext(); SecurityContextHolder.clearContext(); String tokenValue = getTokenValue(body); given().header(HttpHeaders.AUTHORIZATION, getAuthorizationHeader(tokenValue)) .header(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON_VALUE) .when() .get(url) .then() .statusCode(HttpStatus.OK.value()) .body(notNullValue()); }
Source:
<code>@Override public void cleanupCurrentSession() { <START> cleanup(); <END> }</code><technical_language>This performs a global cleanup. limit current session. If want limit current session list in "purgeSegment" call needs entries: SEGMENT session.getName()</technical_language>

Target:
@Override public void cleanupCurrentSession() { final IPentahoSession session = PentahoSessionHolder.getSession(); final List<String> key = Collections.unmodifiableList( Arrays.asList( SEGMENT, createKey( session.getName() ) ) ); final ICacheBackend backend = getBackend(); backend.purgeSegment( key, ( k, m ) -> true ); }
Source:
<code>private void mapLinesToOffsets() throws IOException { try (Scanner scanner = new Scanner(filePath)) { int currentGlobalOffset = 0; while (scanner.hasNextLine()) { lineToOffset.add(currentGlobalOffset); <START> currentGlobalOffset += scanner.nextLine().length(); <END> } } }</code><technical_language>this offset computation is wrong. scanner.nextLine() ignore new-line characters (which 1 2 depending usage of LF / CR). tests validate this</technical_language>

Target:
private void mapLinesToOffsets() throws IOException { try (Scanner scanner = new Scanner(filePath)) { int currentGlobalOffset = 0; while (scanner.hasNextLine()) { lineToOffset.add(currentGlobalOffset); currentGlobalOffset += getLineLengthWithLineSeparator(scanner); } } }
Source:
<code>public BuildImageCmdImpl withTag(String tag) { checkNotNull(tag, "Tag is null"); if (this.tags == null) { this.tags = new HashSet<>(4); } <START> this.tags.add(tag); <END> return this; }</code><technical_language>Check place Auth headers added</technical_language>

Target:
public BuildImageCmdImpl withTag(String tag) { checkNotNull(tag, "Tag is null"); this.tag = tag; return this; }
Source:
<code>public String docs() { List<ExceptionType> e = Arrays.asList(Exceptions.ExceptionType.values()); String Exceptions = "\nValid Exceptions: "; for (int i = 0; i < e.size(); i++) { String ExceptionType = e.get(i).getName(); if(i == e.size() - 1) { Exceptions = Exceptions + ExceptionType; } else { <START> Exceptions = Exceptions + ExceptionType + ", \n"; <END> } } return "nothing {exceptionType, msg} This function causes an exception to be thrown. If the exception type is null," + " it will be uncatchable. Otherwise, exceptionType may be any valid exception type." + Exceptions; }</code><technical_language>adding a new line for exception? variables typically start lowercased</technical_language>

Target:
public String docs() { List<ExceptionType> e = Arrays.asList(Exceptions.ExceptionType.values()); String exceptions = "\nValid Exceptions: "; for (int i = 0; i < e.size(); i++) { String exceptionType = e.get(i).getName(); if(i == e.size() - 1) { exceptions = exceptions + exceptionType; } else { exceptions = exceptions + exceptionType + ", "; } } return "nothing {exceptionType, msg} This function causes an exception to be thrown. If the exception type is null," + " it will be uncatchable. Otherwise, exceptionType may be any valid exception type." + exceptions; }
Source:
<code>public boolean equals(Object other) { if (! (other instanceof MaskedPasswordAlgorithmSpec)) return false; MaskedPasswordAlgorithmSpec otherSpec = (MaskedPasswordAlgorithmSpec) other; return otherSpec == this || Arrays.equals(initialKeyMaterial, otherSpec.initialKeyMaterial) && iterationCount == otherSpec.iterationCount && Arrays.equals(salt, otherSpec.salt) <START> && initializationVector == otherSpec.initializationVector; <END> }</code><technical_language>This Arrays.equals()</technical_language>

Target:
public boolean equals(Object other) { if (! (other instanceof MaskedPasswordAlgorithmSpec)) return false; MaskedPasswordAlgorithmSpec otherSpec = (MaskedPasswordAlgorithmSpec) other; return otherSpec == this || Arrays.equals(initialKeyMaterial, otherSpec.initialKeyMaterial) && iterationCount == otherSpec.iterationCount && Arrays.equals(salt, otherSpec.salt) && Arrays.equals(initializationVector, otherSpec.initializationVector); }
Source:
<code>public PagedFluxBase<SuggestResult, SuggestPagedResponse> suggest(String searchText, String suggesterName, SuggestOptions suggestOptions, RequestOptions requestOptions) { SuggestRequest suggestRequest = this.createSuggestRequest(searchText, suggesterName, SuggestOptionsHandler.ensureSuggestOptions(suggestOptions)); <START> return new PagedFluxBase<>( () -> withContext(context -> this.suggestFirst(requestOptions, suggestRequest, context)), nextLink -> Mono.empty()); <END> }</code><technical_language>this constructor takes a firstPageRetriever implicitly Mono.empty for next page value</technical_language>

Target:
public PagedFluxBase<SuggestResult, SuggestPagedResponse> suggest(String searchText, String suggesterName, SuggestOptions suggestOptions, RequestOptions requestOptions) { try { SuggestRequest suggestRequest = this.createSuggestRequest(searchText, suggesterName, SuggestOptionsHandler.ensureSuggestOptions(suggestOptions)); return new PagedFluxBase<>( () -> withContext(context -> this.suggestFirst(requestOptions, suggestRequest, context))); } catch (RuntimeException ex) { return new PagedFluxBase<>(() -> monoError(logger, ex)); } }
Source:
<code>protected void receivePacket(DhcpPacket packet) { if (!isValidPacket(packet)) return; if (packet instanceof DhcpOfferPacket) { mOffer = packet.toDhcpResults(); if (mOffer != null) { Log.d(TAG, "Got pending lease: " + mOffer); transitionTo(mDhcpRequestingState); } } else if (packet instanceof DhcpAckPacket) { if (!isDhcpRapidCommitEnabled() || !packet.mRapidCommit) return; <START> DhcpResults results <END> = packet.toDhcpResults(); if (results != null) { confirmDhcpLease(packet, results); transitionTo(mConfiguringInterfaceState); } } }</code><technical_language>final</technical_language>

Target:
protected void receivePacket(DhcpPacket packet) { if (!isValidPacket(packet)) return; if (packet instanceof DhcpOfferPacket) { mOffer = packet.toDhcpResults(); if (mOffer != null) { Log.d(TAG, "Got pending lease: " + mOffer); transitionTo(mDhcpRequestingState); } } else if (packet instanceof DhcpAckPacket) { if (!isDhcpRapidCommitEnabled() || !packet.mRapidCommit) return; final DhcpResults results = packet.toDhcpResults(); if (results != null) { confirmDhcpLease(packet, results); transitionTo(mConfiguringInterfaceState); } } }
Source:
<code>public void waitWorkflowsReady() { ListWorkflowInstanceResponse[] wfr = assertTimeoutPreemptively(ofSeconds(60), () -> { ListWorkflowInstanceResponse wf = null; while (true) { sleep(500); ListWorkflowInstanceResponse[] instances = fromClient(workflowInstanceResource, true) .query("type", DEMO_WORKFLOW_TYPE) .query("maxResults", WORKFLOWS + 1) .query("businessKey", UNIQUE_KEY) .query("status", finished) .query("include", "").get(ListWorkflowInstanceResponse[].class); if (instances.length == WORKFLOWS) { return instances; } } }); assertThat(wfr.length, is(WORKFLOWS)); <START> List<DateTime> startTimes = Stream.of(wfr).map(r -> r.started).sorted().collect(toList()); <END> }</code><technical_language>startTimes is used, this removed</technical_language>

Target:
public void waitWorkflowsReady() { ListWorkflowInstanceResponse[] wfr = assertTimeoutPreemptively(ofSeconds(60), () -> { ListWorkflowInstanceResponse wf = null; while (true) { sleep(500); ListWorkflowInstanceResponse[] instances = fromClient(workflowInstanceResource, true) .query("type", DEMO_WORKFLOW_TYPE) .query("maxResults", WORKFLOWS + 1) .query("businessKey", UNIQUE_KEY) .query("status", finished) .query("include", "").get(ListWorkflowInstanceResponse[].class); if (instances.length == WORKFLOWS) { return instances; } } }); assertThat(wfr.length, is(WORKFLOWS)); }
Source:
<code>protected void collectParameters(Consumer<Parameter<?, ?>> parameterCollector) { if (entityDescriptorParameter == null) { <START> entityDescriptorParameter = new ElasticEntityDescriptorParameter("ed", NLS.get("ReindexJobFactory.descriptorParameter")); <END> entityDescriptorParameter.markRequired(); } parameterCollector.accept(entityDescriptorParameter); }</code><technical_language>s.a</technical_language>

Target:
protected void collectParameters(Consumer<Parameter<?, ?>> parameterCollector) { parameterCollector.accept(entityDescriptorParameter); }
Source:
<code>public boolean step(IPointable result) throws SystemException { if (arrayArgsLength > 0) { while (indexArrayArgs < arrayArgsLength) { ap.getEntry(indexArrayArgs, tvp); abvs.reset(); try { <START> ab.reset(abvs); <END> ab.addItem(tvp); ab.finish(); } catch (IOException e) { throw new SystemException(ErrorCode.SYSE0001, e); } result.set(abvs.getByteArray(), abvs.getStartOffset(), abvs.getLength()); indexArrayArgs++; return true; } } return false; }</code><technical_language>I need wrap result in array. return individual value</technical_language>

Target:
public boolean step(IPointable result) { if (arOrObArgsLength > 0) { while (indexArrayArgs < arOrObArgsLength) { if (arg.getTag() == ValueTag.ARRAY_TAG) { ap.getEntry(indexArrayArgs, tvp); } else { tempTvp.getValue(sp); sp.getEntry(indexArrayArgs, tvp); } result.set(tvp.getByteArray(), tvp.getStartOffset(), tvp.getLength()); indexArrayArgs++; return true; } } return false; }
Source:
<code>public boolean tryTransfer(AddressedTuple addressedTuple, Queue<AddressedTuple> pendingEmits) { if (isDebug) { LOG.info("TRANSFERRING tuple {}", addressedTuple); } JCQueue localQueue = getLocalQueue(addressedTuple); if (localQueue!=null) { return tryTransferLocal(addressedTuple, localQueue, pendingEmits); } else { if (remotesBatchSz >= producerBatchSz) { if ( !workerData.tryFlushRemotes() ) { if (pendingEmits != null) { pendingEmits.add(addressedTuple); } return false; } <START> remotesBatchSz = 0; <END> } if (workerData.tryTransferRemote(addressedTuple, pendingEmits, serializer)) { ++remotesBatchSz; if (remotesBatchSz >= producerBatchSz) { workerData.tryFlushRemotes(); remotesBatchSz = 0; } return true; } return false; } }</code><technical_language>Do a race condition here? I this method called multiple threads, if worry remotesBatchSz staying consistent</technical_language>

Target:
public boolean tryTransfer(AddressedTuple addressedTuple, Queue<AddressedTuple> pendingEmits) { if (isDebug) { LOG.info("TRANSFERRING tuple {}", addressedTuple); } JCQueue localQueue = getLocalQueue(addressedTuple); if (localQueue!=null) { return tryTransferLocal(addressedTuple, localQueue, pendingEmits); } return workerData.tryTransferRemote(addressedTuple, pendingEmits, serializer); }
Source:
<code>public static Path createTempFile(String suffix) { try { <START> Path path = Files.createTempFile("jadx-tmp-", System.nanoTime() + '-' + suffix); <END> path.toFile().deleteOnExit(); return path; } catch (IOException e) { throw new JadxRuntimeException("Failed to create temp file with suffix: " + suffix); } }</code><technical_language>System.nanoTime() needed here, needed in previous version :)</technical_language>

Target:
public static Path createTempFile(String suffix) { try { Path path = Files.createTempFile("jadx-tmp-", suffix); path.toFile().deleteOnExit(); return path; } catch (IOException e) { throw new JadxRuntimeException("Failed to create temp file with suffix: " + suffix); } }
Source:
<code>public static void handleApplicationInit(String applicationName) throws Exception { <START> if (firstCall.compareAndSet(true, false)) { <END> if (applicationName.equals(Base.ApplicationNames.OVIRT_ENGINE_AAA_EXTENSION_TOOL)) { if (System.getProperty("java.security.auth.login.config") == null) { InputStream stream = Utils.class.getResourceAsStream("/extensions-tester/jaas.conf"); File file = File.createTempFile("jaas", "conf"); Files.copy(stream, file.toPath(), StandardCopyOption.REPLACE_EXISTING); System.setProperty("java.security.auth.login.config", file.getAbsolutePath()); } Configuration.getConfiguration().refresh(); DirectoryManager.setObjectFactoryBuilder(new DirectoryContextFactoryBuilder()); } String engineEtc = System.getenv("ENGINE_ETC"); if (engineEtc == null) { engineEtc = "/etc/ovirt-engine"; } File krb5File = new File(engineEtc, "krb5.conf"); if (!krb5File.exists()) { throw new Exception(String.format("Failed loading kerberos settings from File %1$s.", krb5File.getAbsolutePath())); } else { System.setProperty("java.security.krb5.conf", krb5File.getAbsolutePath()); } Configuration.getConfiguration().refresh(); DirectoryManager.setObjectFactoryBuilder(new DirectoryContextFactoryBuilder()); } }</code><technical_language>synchronized</technical_language>

Target:
public static synchronized void handleApplicationInit(String applicationName) throws Exception { if (applicationName.equals(Base.ApplicationNames.OVIRT_ENGINE_AAA_EXTENSION_TOOL)) { if (System.getProperty("java.security.auth.login.config") == null) { InputStream stream = Utils.class.getResourceAsStream("/extensions-tester/jaas.conf"); File file = File.createTempFile("jaas", "conf"); file.deleteOnExit(); Files.copy(stream, file.toPath(), StandardCopyOption.REPLACE_EXISTING); System.setProperty("java.security.auth.login.config", file.getAbsolutePath()); } Configuration.getConfiguration().refresh(); DirectoryManager.setObjectFactoryBuilder(new DirectoryContextFactoryBuilder()); } String engineEtc = System.getenv("ENGINE_ETC"); if (engineEtc == null) { engineEtc = "/etc/ovirt-engine"; } File krb5File = new File(engineEtc, "krb5.conf"); if (!krb5File.exists()) { throw new Exception(String.format("Failed loading kerberos settings from File %1$s.", krb5File.getAbsolutePath())); } else { System.setProperty("java.security.krb5.conf", krb5File.getAbsolutePath()); } Configuration.getConfiguration().refresh(); DirectoryManager.setObjectFactoryBuilder(new DirectoryContextFactoryBuilder()); }
Source:
<code>public void testSigningOutWorks() { openSignOutDialog(); pressButton("Yes"); <START> <END> onView(withId(R.id.email)).check(matches(isDisplayed())); }</code><technical_language>button labels localized, R.string.yes R.string.no instead of string literals (otherwise tests fail in locales)</technical_language>

Target:
public void testSigningOutWorks() throws Exception { openSignOutDialog(); pressButton(R.string.yes); onView(withId(R.id.email)).check(matches(isDisplayed())); }
Source:
<code>private Map<String, Object> createInfo() { if (FeatureSupported.isDomainXMLSupported(vm.getClusterCompatibilityVersion())) { String engineXml = generateDomainXml(); if (getParameters().getMemoryDumpImage() == null) { return Collections.singletonMap(VdsProperties.engineXml, engineXml); } else { Map<String, Object> createInfo = new HashMap<>(); createInfo.put(VdsProperties.engineXml, engineXml); DiskImage memoryDump = getParameters().getMemoryDumpImage(); Map<String, String> memoryDumpPDIV = PDIVMapBuilder.create().setPoolId(memoryDump.getStoragePoolId()) .setDomainId(memoryDump.getStorageIds().get(0)).setVolumeId(memoryDump.getId()) .setVolumeId(memoryDump.getImageId()).build(); DiskImage memoryConf = <START> getParameters().getMemoryDumpImage(); <END> Map<String, String> memoryConfPDIV = PDIVMapBuilder.create().setPoolId(memoryConf.getStoragePoolId()) .setDomainId(memoryConf.getStorageIds().get(0)).setVolumeId(memoryConf.getId()) .setVolumeId(memoryConf.getImageId()).build(); createInfo.put("memoryDumpVolume", memoryDumpPDIV); createInfo.put("memoryConfVolume", memoryConfPDIV); return createInfo; } } else { Map<String, Object> createInfo = new HashMap<>(); VmInfoBuilder builder = createBuilder(createInfo); buildVmData(builder); log.info("VM {}", createInfo); return createInfo; } }</code><technical_language>>getMemoryConfImage</technical_language>

Target:
private Map<String, Object> createInfo() { if (FeatureSupported.isDomainXMLSupported(vm.getClusterCompatibilityVersion())) { String engineXml = generateDomainXml(); if (getParameters().getMemoryDumpImage() == null) { return Collections.singletonMap(VdsProperties.engineXml, engineXml); } else { Map<String, Object> createInfo = new HashMap<>(4); createInfo.put(VdsProperties.engineXml, engineXml); DiskImage memoryDump = getParameters().getMemoryDumpImage(); Map<String, String> memoryDumpPDIV = PDIVMapBuilder.create() .setPoolId(memoryDump.getStoragePoolId()) .setDomainId(memoryDump.getStorageIds().get(0)) .setVolumeId(memoryDump.getId()) .setVolumeId(memoryDump.getImageId()).build(); DiskImage memoryConf = getParameters().getMemoryConfImage(); Map<String, String> memoryConfPDIV = PDIVMapBuilder.create() .setPoolId(memoryConf.getStoragePoolId()) .setDomainId(memoryConf.getStorageIds().get(0)) .setVolumeId(memoryConf.getId()) .setVolumeId(memoryConf.getImageId()).build(); createInfo.put("memoryDumpVolume", memoryDumpPDIV); createInfo.put("memoryConfVolume", memoryConfPDIV); return createInfo; } } else { Map<String, Object> createInfo = new HashMap<>(); VmInfoBuilder builder = createBuilder(createInfo); buildVmData(builder); log.info("VM {}", createInfo); return createInfo; } }
Source:
<code>public void parserNoteText(String text){ <START> this.mNoteText = text; <END> this.setImportance(getTagValue("Importance")); this.setEstimation(getTagValue("Estimation")); this.setValue(getTagValue("Value")); this.setHowToDemo(getTagValue("HowToDemo")); this.setNotes(getTagValue("Notes")); }</code><technical_language>remove "this."</technical_language>

Target:
public void parserNoteText(String text){ mNoteText = text; setImportance(getTagValue("Importance")); setEstimation(getTagValue("Estimation")); setValue(getTagValue("Value")); setHowToDemo(getTagValue("HowToDemo")); setNotes(getTagValue("Notes")); }
Source:
<code><START> private Object[] getQueryTreeStrings() <END> throws SemanticException { List<String> qstrs = new ArrayList<String>(); qstrs.add(select); qstrs.add(from); if (!StringUtils.isBlank(where)) { qstrs.add(where); } if (!StringUtils.isBlank(groupby)) { qstrs.add(groupby); } if (!StringUtils.isBlank(having)) { qstrs.add(having); } if (!StringUtils.isBlank(orderby)) { qstrs.add(orderby); } if (limit != null) { qstrs.add(String.valueOf(limit)); } return qstrs.toArray(new String[0]); }</code><technical_language>return type String[] Or, return list. convert array</technical_language>

Target:
private String[] getQueryTreeStrings() throws SemanticException { List<String> qstrs = new ArrayList<String>(); qstrs.add(select); qstrs.add(from); if (!StringUtils.isBlank(where)) { qstrs.add(where); } if (!StringUtils.isBlank(groupby)) { qstrs.add(groupby); } if (!StringUtils.isBlank(having)) { qstrs.add(having); } if (!StringUtils.isBlank(orderby)) { qstrs.add(orderby); } if (limit != null) { qstrs.add(String.valueOf(limit)); } return qstrs.toArray(new String[0]); }
Source:
<code>public void testGetClusterStatus() throws IOException { <START> AbstractBigtableConnection connectionMock; <END> BigtableAdmin bigtableAdmin; connectionMock = mock(AbstractBigtableConnection.class); BigtableApi bigtableApi = mock(BigtableApi.class); Mockito.doReturn(bigtableApi).when(connectionMock).getBigtableApi(); bigtableAdmin = new BigtableAdmin(connectionMock); ClusterStatus status = bigtableAdmin.getClusterStatus(); assertNotNull(status); assertEquals("hbaseVersion", status.getHBaseVersion()); assertEquals("clusterid", status.getClusterId()); assertTrue(status.getServersName().isEmpty()); assertTrue(status.getDeadServerNames().isEmpty()); assertNull(status.getMaster()); assertTrue(status.getBackupMasterNames().isEmpty()); assertTrue(status.getRegionStatesInTransition().isEmpty()); assertEquals(0, status.getMasterCoprocessors().length); assertFalse(status.getBalancerOn()); assertEquals(-1, status.getMasterInfoPort()); }</code><technical_language>I inline declarations</technical_language>

Target:
public void testGetClusterStatus() throws IOException { AbstractBigtableConnection connectionMock = mock(AbstractBigtableConnection.class); BigtableApi bigtableApi = mock(BigtableApi.class); Mockito.doReturn(bigtableApi).when(connectionMock).getBigtableApi(); BigtableAdmin bigtableAdmin = new BigtableAdmin(connectionMock); ClusterStatus status = bigtableAdmin.getClusterStatus(); assertNotNull(status); assertEquals("hbaseVersion", status.getHBaseVersion()); assertEquals("clusterid", status.getClusterId()); assertTrue(status.getServersName().isEmpty()); assertTrue(status.getDeadServerNames().isEmpty()); assertNull(status.getMaster()); assertTrue(status.getBackupMasterNames().isEmpty()); assertTrue(status.getRegionStatesInTransition().isEmpty()); assertEquals(0, status.getMasterCoprocessors().length); assertFalse(status.getBalancerOn()); assertEquals(-1, status.getMasterInfoPort()); }
Source:
<code>public List<AutoCloseable> start(Params params) { Configuration config = new FluoConfiguration(params.getConfiguration()).getReporterConfiguration("csv"); String dir = config.getString("dir", ""); if (!config.getBoolean("enable", false) || dir.isEmpty()) { return Collections.emptyList(); } TimeUnit rateUnit = TimeUnit.valueOf(config.getString("rateUnit", "seconds").toUpperCase()); TimeUnit durationUnit = TimeUnit.valueOf(config.getString("durationUnit", "milliseconds").toUpperCase()); CsvReporter reporter = CsvReporter.forRegistry(params.getMetricRegistry()).convertDurationsTo(durationUnit) .convertRatesTo(rateUnit).build(new File(dir)); reporter.start(config.getInt("frequency", 60), TimeUnit.SECONDS); <START> log.info("Reporting metrics as csv"); <END> return Collections.singletonList((AutoCloseable) reporter); }</code><technical_language>add dir log message</technical_language>

Target:
public List<AutoCloseable> start(Params params) { Configuration config = new FluoConfiguration(params.getConfiguration()).getReporterConfiguration("csv"); String dir = config.getString("dir", ""); if (!config.getBoolean("enable", false) || dir.isEmpty()) { return Collections.emptyList(); } TimeUnit rateUnit = TimeUnit.valueOf(config.getString("rateUnit", "seconds").toUpperCase()); TimeUnit durationUnit = TimeUnit.valueOf(config.getString("durationUnit", "milliseconds").toUpperCase()); CsvReporter reporter = CsvReporter.forRegistry(params.getMetricRegistry()).convertDurationsTo(durationUnit) .convertRatesTo(rateUnit).build(new File(dir)); reporter.start(config.getInt("frequency", 60), TimeUnit.SECONDS); log.info("Reporting metrics as csv to directory {}", dir); return Collections.singletonList((AutoCloseable) reporter); }
Source:
<code><START> private void produceValueRange(final int key, final int start, final int endExclusive) throws ExecutionException, InterruptedException { <END> final Properties producerProps = new Properties(); producerProps.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, cluster.bootstrapServers()); producerProps.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, IntegerSerializer.class); producerProps.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, IntegerSerializer.class); IntegrationTestUtils.produceKeyValuesSynchronously( INPUT_TOPIC_NAME, IntStream.range(start, endExclusive) .mapToObj(i -> KeyValue.pair(key, i)) .collect(Collectors.toList()), producerProps, mockTime); }</code><technical_language>nit: simplify throws Exception -- in test, intent catch test fail</technical_language>

Target:
private void produceValueRange(final int key, final int start, final int endExclusive) throws Exception { final Properties producerProps = new Properties(); producerProps.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, cluster.bootstrapServers()); producerProps.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, IntegerSerializer.class); producerProps.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, IntegerSerializer.class); IntegrationTestUtils.produceKeyValuesSynchronously( INPUT_TOPIC_NAME, IntStream.range(start, endExclusive) .mapToObj(i -> KeyValue.pair(key, i)) .collect(Collectors.toList()), producerProps, mockTime); }
Source:
<code>public File export(final List<LocationDto> locations, final List<VariableDetails> units) { try { final File temporaryFolder = Files.createTempDir(); <START> final String sanitizedFileName = "template_import_lots.xls"; <END> final String fileNameFullPath = temporaryFolder.getAbsolutePath() + File.separator + sanitizedFileName; return lotExcelTemplateGenerator.generateTemplateFile(fileNameFullPath, locations, units); } catch (final IOException e) { final BindingResult errors = new MapBindingResult(new HashMap<String, String>(), Integer.class.getName()); errors.reject("cannot.exportAsXLS.lot.template", ""); throw new ResourceNotFoundException(errors.getAllErrors().get(0)); } }</code><technical_language>a constant</technical_language>

Target:
public File export(final List<LocationDto> locations, final List<VariableDetails> units) { try { final File temporaryFolder = Files.createTempDir(); final String fileNameFullPath = temporaryFolder.getAbsolutePath() + File.separator + LotExcelTemplateExportServiceImpl.FILE_NAME; return lotExcelTemplateGenerator.generateTemplateFile(fileNameFullPath, locations, units); } catch (final IOException e) { final BindingResult errors = new MapBindingResult(new HashMap<String, String>(), Integer.class.getName()); errors.reject("cannot.exportAsXLS.lot.template", ""); throw new ResourceNotFoundException(errors.getAllErrors().get(0)); } }
Source:
<code>private void put(byte b[], int length) { buffer.writeVLong(length); buffer.add(b, 0, length); <START> estimatedSize += length + SERIALIZATION_OVERHEAD; <END> }</code><technical_language>this double count some data</technical_language>

Target:
private void put(byte b[], int length) { buffer.writeVLong(length); buffer.add(b, 0, length); }
Source:
<code><START> public boolean equals(Object other) <END> { if (!(other instanceof ChessCoordinates)) return false; ChessCoordinates otherCoordinates = (ChessCoordinates) other; return otherCoordinates.boardIndex == boardIndex && otherCoordinates.row == row && otherCoordinates.column == column; }</code><technical_language>ChessCoordinates equals method...are updated branch latest code? guess this compile</technical_language>

Target:
public boolean equals(Object other) { if (!(other instanceof ChessCoordinates)) return false; ChessCoordinates otherCoordinates = (ChessCoordinates) other; return Objects.equal(row, otherCoordinates.row) && Objects.equal(column, otherCoordinates.column) && Objects.equal(boardIndex, otherCoordinates.boardIndex); }
Source:
<code>protected boolean isSplitable(JobContext context, Path filename) { try { FileSystem fs = filename.getFileSystem( context.getConfiguration() ); return fs.exists( filename.suffix( LzoIndex.LZO_INDEX_SUFFIX ) ); } catch (IOException e) { <START> return false; <END> } }</code><technical_language>guess rethrow here.. RTE</technical_language>

Target:
protected boolean isSplitable(JobContext context, Path filename) { try { FileSystem fs = filename.getFileSystem( context.getConfiguration() ); return fs.exists( filename.suffix( LzoIndex.LZO_INDEX_SUFFIX ) ); } catch (IOException e) { throw new RuntimeException(e); } }
Source:
<code>protected synchronized Map<String,SortedMap<TServerInstance,TabletServerStatus>> splitCurrentByRegex(SortedMap<TServerInstance,TabletServerStatus> current) { if ((System.currentTimeMillis() - lastPoolRecheck) > poolRecheckMillis) { Map<String,SortedMap<TServerInstance,TabletServerStatus>> newPools = new HashMap<String,SortedMap<TServerInstance,TabletServerStatus>>(); for (Entry<TServerInstance,TabletServerStatus> e : current.entrySet()) { String tableName = getPoolNameForHost(e.getKey().host()); if (!newPools.containsKey(tableName)) { <START> newPools.put(tableName, new TreeMap<TServerInstance,TabletServerStatus>()); <END> } newPools.get(tableName).put(e.getKey(), e.getValue()); } boolean error = false; for (SortedMap<TServerInstance,TabletServerStatus> s1 : newPools.values()) { for (SortedMap<TServerInstance,TabletServerStatus> s2 : newPools.values()) { if (s1 == s2) { continue; } if (!Collections.disjoint(s1.keySet(), s2.keySet())) { LOG.error("Pools are not disjoint: {}, there is a problem with your regular expressions. Putting all servers in default pool", newPools); error = true; } } } if (error) { newPools.clear(); newPools.put(DEFAULT_POOL, new TreeMap<TServerInstance,TabletServerStatus>()); for (Entry<TServerInstance,TabletServerStatus> e : current.entrySet()) { newPools.get(DEFAULT_POOL).put(e.getKey(), e.getValue()); } } pools = newPools; this.lastPoolRecheck = System.currentTimeMillis(); } return pools; }</code><technical_language>Is a need ensure TreeMap objects create comparator current (see SortedMap.comparator())? If incoming map sorted based natural ordering, this a problem</technical_language>

Target:
protected synchronized Map<String,SortedMap<TServerInstance,TabletServerStatus>> splitCurrentByRegex(SortedMap<TServerInstance,TabletServerStatus> current) { if ((System.currentTimeMillis() - lastPoolRecheck) > poolRecheckMillis) { LOG.debug("Performing pool recheck - regrouping tablet servers based on regular expressions"); Map<String,SortedMap<TServerInstance,TabletServerStatus>> newPools = new HashMap<String,SortedMap<TServerInstance,TabletServerStatus>>(); for (Entry<TServerInstance,TabletServerStatus> e : current.entrySet()) { List<String> poolNames = getPoolNamesForHost(e.getKey().host()); for (String pool : poolNames) { SortedMap<TServerInstance,TabletServerStatus> np = newPools.get(pool); if (null == np) { np = new TreeMap<TServerInstance,TabletServerStatus>(current.comparator()); newPools.put(pool, np); } np.put(e.getKey(), e.getValue()); } } pools = newPools; this.lastPoolRecheck = System.currentTimeMillis(); } return pools; }
Source:
<code>public void cleanup() { org.jboss.reddeer.common.util.Display.syncExec(new Runnable() { @Override public void run() { for (Shell shell : org.jboss.reddeer.common.util.Display.getDisplay().getShells()) { if (shell.getText().equals(title)) { shell.dispose(); break; } } <START> new WaitWhile(new ShellWithTextIsAvailable(title)); <END> } }); }</code><technical_language>waiting UI thread. done this fix it, it</technical_language>

Target:
public void cleanup() { org.jboss.reddeer.common.util.Display.syncExec(new Runnable() { @Override public void run() { for (Shell shell : org.jboss.reddeer.common.util.Display.getDisplay().getShells()) { if (shell.getText().equals(title)) { shell.dispose(); break; } } } }); new WaitWhile(new ShellWithTextIsAvailable(title)); }
Source:
<code>public List<JobId> getJobsToRemove(final long time) { List<JobId> jobIdsList = executeReadOnlyTransaction(session -> { <START> List<JobId> jobsToRemove = new ArrayList<JobId>(); <END> Query query = session.createSQLQuery("select ID from JOB_DATA where " + "SCHEDULED_TIME_FOR_REMOVAL <> 0 and " + "SCHEDULED_TIME_FOR_REMOVAL < :timeLimit") .setParameter("timeLimit", time); Iterator jobIdIterator = query.list().iterator(); while (jobIdIterator.hasNext()) { jobsToRemove.add(JobIdImpl.makeJobId((jobIdIterator.next()).toString())); } return jobsToRemove; }); return jobIdsList; }</code><technical_language>sql query is a bit hidden here. A new file HolderClass Constant query accessible a nice move</technical_language>

Target:
public List<JobId> getJobsToRemove(final long time) { return executeReadOnlyTransaction(session -> { Query query = session.createSQLQuery("select ID from JOB_DATA where " + "SCHEDULED_TIME_FOR_REMOVAL <> 0 and " + "SCHEDULED_TIME_FOR_REMOVAL < :timeLimit") .setParameter("timeLimit", time); return ((List<Long>) query.list()).stream() .map(Object::toString) .map(JobIdImpl::makeJobId) .collect(Collectors.toList()); }); }
Source:
<code>public SslCertificateType getDefault() { <START> return SslCertificateType.CLOUD_PROVIDER_OWNED; <END> }</code><technical_language>this is a safe default for unknown DB values. a choice</technical_language>

Target:
public SslCertificateType getDefault() { return SslCertificateType.NONE; }
Source:
<code>public ClientOutputStream(Client c) { this.c = c; c.addCloseListener(new CloseListener() { @Override public void onClose(Client client) { isClosed = true; <START> synchronized(this) { <END> try { this.notifyAll(); } catch(Throwable t) { ExceptionUtils.handleException(t); } } } }); lastWriteFuture = c.lastWriteFuture(); }</code><technical_language>dont need sync notify all, this removed</technical_language>

Target:
public ClientOutputStream(Client c) { this.c = c; c.addCloseListener(new CloseListener() { @Override public void onClose(Client client) { isClosed = true; } }); lastWriteFuture = c.lastWriteFuture(); }