auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testPerformFailureSuccessIssueClosedWithComponents() throws Exception { JiraCreateIssueNotifier notifier = spy(new JiraCreateIssueNotifier(JIRA_PROJECT, "", "", "")); doReturn(site).when(notifier).getSiteForProject((AbstractProject) Mockito.any()); Issue issue = mock(Issue.class); Status status = new Status(null, null, "Closed", null, null); when(session.createIssue(Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyList(), Mockito.anyString())).thenReturn(issue); when(issue.getStatus()).thenReturn(status); when(session.getIssueByKey(Mockito.anyString())).thenReturn(issue); Assert.assertEquals(0, temporaryDirectory.list().length); when(previousBuild.getResult()).thenReturn(Result.SUCCESS); when(currentBuild.getResult()).thenReturn(Result.FAILURE); Assert.assertTrue(notifier.perform(currentBuild, launcher, buildListener)); Assert.assertEquals(1, temporaryDirectory.list().length); when(previousBuild.getResult()).thenReturn(Result.FAILURE); when(currentBuild.getResult()).thenReturn(Result.SUCCESS); Assert.assertTrue(notifier.perform(currentBuild, launcher, buildListener)); Assert.assertEquals(0, temporaryDirectory.list().length); }

Target:
public void testPerformFailureSuccessIssueClosedWithComponents() throws Exception { JiraCreateIssueNotifier notifier = spy(new JiraCreateIssueNotifier(JIRA_PROJECT, "", "", "")); doReturn(site).when(notifier).getSiteForProject((AbstractProject) Mockito.any()); Issue issue = mock(Issue.class); Status status = new Status(null, null, JiraCreateIssueNotifier.finishedStatuses.Closed.toString() , null, null); when(session.createIssue(Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyList(), Mockito.anyString())).thenReturn(issue); when(issue.getStatus()).thenReturn(status); when(session.getIssueByKey(Mockito.anyString())).thenReturn(issue); assertEquals(0, temporaryDirectory.list().length); when(previousBuild.getResult()).thenReturn(Result.SUCCESS); when(currentBuild.getResult()).thenReturn(Result.FAILURE); assertTrue(notifier.perform(currentBuild, launcher, buildListener)); assertEquals(1, temporaryDirectory.list().length); when(previousBuild.getResult()).thenReturn(Result.FAILURE); when(currentBuild.getResult()).thenReturn(Result.SUCCESS); assertTrue(notifier.perform(currentBuild, launcher, buildListener)); assertEquals(0, temporaryDirectory.list().length); }
Source:
public void shouldKeepStreamOpen() throws IOException, DoneException { DefaultLogCallback callback2 = new DefaultLogCallback(spec); callback.log(1, ts, "line 1"); callback2.log(1, ts, "line 2"); callback.log(1, ts, "line 3"); callback.close(); callback2.log(1, ts, "line 4"); callback2.close(); List<String> lines = Files.readAllLines(path); assertThat(lines, contains("callback-test> line 1", "callback-test> line 2", "callback-test> line 3", "callback-test> line 4")); }

Target:
public void shouldKeepStreamOpen() throws IOException, DoneException { DefaultLogCallback callback2 = new DefaultLogCallback(spec); callback2.open(); callback.log(1, ts, "line 1"); callback2.log(1, ts, "line 2"); callback.log(1, ts, "line 3"); callback.close(); callback2.log(1, ts, "line 4"); callback2.close(); List<String> lines = Arrays.asList(FileUtils.fileReadArray(file)); assertThat(lines, contains("callback-test> line 1", "callback-test> line 2", "callback-test> line 3", "callback-test> line 4")); }
Source:
private boolean isReviewFragmentActive() { Fragment currentFragment = this.getFragmentManager ().findFragmentById(R.id.dashboard_details_container); if (currentFragment instanceof ReviewFragment) { return true; } return false; }

Target:
private boolean isReviewFragmentActive() { return isFragmentActive(reviewFragment, R.id.dashboard_details_container); }
Source:
protected AnchorListItem getBulkRelease(final ExtendedPagedTable<TaskSummary> extendedPagedTable) { final AnchorListItem bulkAbortNavLink = GWT.create(AnchorListItem.class); bulkAbortNavLink.setText(constants.Bulk_Release()); bulkAbortNavLink.setIcon(IconType.UNLOCK); bulkAbortNavLink.setIconFixedWidth(true); bulkAbortNavLink.addClickHandler(event -> confirmPopup.show(constants.Release_Confirmation(), constants.Release(), constants.Release_tasks(), getReleaseCommand(extendedPagedTable)) ); return bulkAbortNavLink; }

Target:
protected AnchorListItem getBulkRelease(final ExtendedPagedTable<TaskSummary> extendedPagedTable) { final AnchorListItem bulkReleaseNavLink = GWT.create(AnchorListItem.class); bulkReleaseNavLink.setText(constants.Bulk_Release()); bulkReleaseNavLink.setIcon(IconType.UNLOCK); bulkReleaseNavLink.setIconFixedWidth(true); bulkReleaseNavLink.addClickHandler(event -> confirmPopup.show(constants.Release_tasks(), constants.Release(), constants.Release_Confirmation(), getReleaseCommand(extendedPagedTable)) ); return bulkReleaseNavLink; }
Source:
public void setup(TestContext context) throws Exception { this.context = context; if (writePercentage < 0) { throw new IllegalArgumentException("Write percentage can't be smaller than 0"); } if (writePercentage > 100) { throw new IllegalArgumentException("Write percentage can't be larger than 100"); } targetInstance = context.getTargetInstance(); warmupPartitions(log, targetInstance); values = new Object[valueCount]; Random random = new Random(); for (int k = 0; k < valueCount; k++) { if (useStringValue) { values[k] = makeString(valueLength); } else { values[k] = randomByteArray(random, valueLength); } } counters = new IAtomicReference[countersLength]; for (int k = 0; k < counters.length; k++) { String key; if(preventLocalCalls){ key = StringUtils.generateNotKeyOwnedBy(8, targetInstance); }else{ key = StringUtils.makeString(8); } IAtomicReference atomicReference = targetInstance.getAtomicReference(key); atomicReference.set(values[random.nextInt(values.length)]); counters[k] = atomicReference; } }

Target:
public void setup(TestContext context) throws Exception { this.context = context; if (writePercentage < 0) { throw new IllegalArgumentException("Write percentage can't be smaller than 0"); } if (writePercentage > 100) { throw new IllegalArgumentException("Write percentage can't be larger than 100"); } targetInstance = context.getTargetInstance(); warmupPartitions(log, targetInstance); values = new Object[valueCount]; Random random = new Random(); for (int k = 0; k < valueCount; k++) { if (useStringValue) { values[k] = makeString(valueLength); } else { values[k] = randomByteArray(random, valueLength); } } counters = new IAtomicReference[countersLength]; for (int k = 0; k < counters.length; k++) { String key = StringUtils.generateKey(8, preventLocalCalls, targetInstance); IAtomicReference atomicReference = targetInstance.getAtomicReference(key); atomicReference.set(values[random.nextInt(values.length)]); counters[k] = atomicReference; } }
Source:
public boolean addAcl(OzoneObj obj, OzoneAcl acl) throws IOException { validateOzoneObj(obj); String prefixPath = obj.getPath(); metadataManager.getLock().acquirePrefixLock(prefixPath); try { OmPrefixInfo prefixInfo = metadataManager.getPrefixTable().get(prefixPath); List<OzoneAcl> list = null; if (prefixInfo != null) { list = prefixInfo.getAcls(); if (list != null && list.contains(acl)) { LOG.debug("acl exist for prefix path {}", acl, prefixPath); return false; } } if (list == null) { list = new ArrayList<>(); } list.add(acl); OmPrefixInfo.Builder upiBuilder = OmPrefixInfo.newBuilder(); upiBuilder.setName(prefixPath).setAcls(list); if (prefixInfo != null && prefixInfo.getMetadata() != null) { upiBuilder.addAllMetadata(prefixInfo.getMetadata()); } prefixInfo = upiBuilder.build(); metadataManager.getPrefixTable().put(prefixPath, prefixInfo); prefixTree.insert(prefixPath, prefixInfo); } catch (IOException ex) { if (!(ex instanceof OMException)) { LOG.error("Add acl operation failed for prefix path:{} acl:{}", prefixPath, acl, ex); } throw ex; } finally { metadataManager.getLock().releasePrefixLock(prefixPath); } return true; }

Target:
public boolean addAcl(OzoneObj obj, OzoneAcl acl) throws IOException { validateOzoneObj(obj); String prefixPath = obj.getPath(); metadataManager.getLock().acquirePrefixLock(prefixPath); try { OmPrefixInfo prefixInfo = metadataManager.getPrefixTable().get(prefixPath); List<OzoneAcl> list = null; if (prefixInfo != null) { list = prefixInfo.getAcls(); } if (list == null) { list = new ArrayList<>(); list.add(acl); } else { boolean found = false; for (OzoneAcl a: list) { if (a.getName().equals(acl.getName()) && a.getType() == acl.getType()) { found = true; a.getAclBitSet().or(acl.getAclBitSet()); break; } } if (!found) { list.add(acl); } } OmPrefixInfo.Builder upiBuilder = OmPrefixInfo.newBuilder(); upiBuilder.setName(prefixPath).setAcls(list); if (prefixInfo != null && prefixInfo.getMetadata() != null) { upiBuilder.addAllMetadata(prefixInfo.getMetadata()); } prefixInfo = upiBuilder.build(); metadataManager.getPrefixTable().put(prefixPath, prefixInfo); prefixTree.insert(prefixPath, prefixInfo); } catch (IOException ex) { if (!(ex instanceof OMException)) { LOG.error("Add acl operation failed for prefix path:{} acl:{}", prefixPath, acl, ex); } throw ex; } finally { metadataManager.getLock().releasePrefixLock(prefixPath); } return true; }
Source:
protected boolean markRef(String refName) { if (refName == null) return false; RepositoryTreeNode node; try { if (refName.startsWith(Constants.R_HEADS)) { Ref ref = repo.findRef(refName); if (ref == null) return false; node = new RefNode(localBranches, repo, ref); } else if (refName.startsWith(Constants.R_REMOTES)) { Ref ref = repo.findRef(refName); if (ref == null) return false; node = new RefNode(remoteBranches, repo, ref); } else if (Constants.HEAD.equals(refName)) { Ref ref = repo.findRef(refName); if (ref == null) return false; node = new AdditionalRefNode(references, repo, ref); } else { String mappedRef = Activator.getDefault().getRepositoryUtil() .mapCommitToRef(repo, refName, false); if (mappedRef != null && mappedRef.startsWith(Constants.R_REMOTES)) { Ref ref = repo.findRef(mappedRef); if (ref == null) return false; node = new RefNode(remoteBranches, repo, ref); } else if (mappedRef != null && mappedRef.startsWith(Constants.R_TAGS)) { Ref ref = repo.findRef(mappedRef); if (ref == null) return false; node = new TagNode(tags, repo, ref); } else return false; } } catch (IOException e) { return false; } branchTree.setSelection(new StructuredSelection(node), true); return true; }

Target:
protected boolean markRef(String refName) { if (refName == null) return false; RepositoryTreeNode node; try { if (refName.startsWith(Constants.R_HEADS)) { Ref ref = repo.exactRef(refName); if (ref == null) return false; node = new RefNode(localBranches, repo, ref); } else if (refName.startsWith(Constants.R_REMOTES)) { Ref ref = repo.exactRef(refName); if (ref == null) return false; node = new RefNode(remoteBranches, repo, ref); } else if (Constants.HEAD.equals(refName)) { Ref ref = repo.exactRef(refName); if (ref == null) return false; node = new AdditionalRefNode(references, repo, ref); } else { String mappedRef = Activator.getDefault().getRepositoryUtil() .mapCommitToRef(repo, refName, false); if (mappedRef != null && mappedRef.startsWith(Constants.R_REMOTES)) { Ref ref = repo.exactRef(mappedRef); if (ref == null) return false; node = new RefNode(remoteBranches, repo, ref); } else if (mappedRef != null && mappedRef.startsWith(Constants.R_TAGS)) { Ref ref = repo.exactRef(mappedRef); if (ref == null) return false; node = new TagNode(tags, repo, ref); } else return false; } } catch (IOException e) { return false; } branchTree.setSelection(new StructuredSelection(node), true); return true; }
Source:
public synchronized void stop(final StopContext context) { NamingStore namingStore = namingStoreInjector.getOptionalValue(); if(namingStore!= null) { Queue managementQueue = ActiveMQJMSClient.createQueue("activemq.management"); final NamingContext storeBaseContext = new NamingContext(namingStore, null); try { QueueConnectionFactory cf = (QueueConnectionFactory) storeBaseContext.lookup(pcfInjector.getValue().getBindInfo().getAbsoluteJndiName()); try (QueueConnection connection = cf.createQueueConnection()) { QueueSession session = connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE); connection.start(); QueueRequestor requestor = new QueueRequestor(session, managementQueue); Message m = session.createMessage(); org.apache.activemq.artemis.api.jms.management.JMSManagementHelper.putOperationInvocation(m, ResourceNames.BROKER, "destroyQueue", JMS_QUEUE_PREFIX + queueName, true, true); Message reply = requestor.request(m); ROOT_LOGGER.debugf("Deleting queue %s returned %s", JMS_QUEUE_PREFIX + queueName, reply); boolean success = reply.getBooleanProperty("_AMQ_OperationSucceeded"); if(success) { ROOT_LOGGER.infof("Queue %s has been deleted", JMS_QUEUE_PREFIX + queueName); } else { ROOT_LOGGER.errorf("Deleting queue %s failed with error %s", queue, reply.getBody(String.class)); } } } catch (NamingException | JMSException ex) { throw new RuntimeException(ex); } finally { try { storeBaseContext.close(); } catch (NamingException ex) { throw new RuntimeException(ex); } } } queue = null; }

Target:
public synchronized void stop(final StopContext context) { if(sessionFactory != null) { sessionFactory.close(); } }
Source:
public void finish() { if (state == State.NEEDS_INPUT) { state = State.HAS_OUTPUT; mergedPages = unspill(); } }

Target:
public void finish() { if (state == State.NEEDS_INPUT) { state = State.HAS_OUTPUT; WorkProcessor<Page> resultPages = getSortedPages( new SimplePageWithPositionComparator(sourceTypes, sortChannels, sortOrder)); sortedPages = resultPages.iterator(); } }
Source:
public static IIrsServer createIrsServer(VdsProtocol vdsProtocol, Version version, String hostname, int port, int clientTimeOut, int connectionTimeOut, int clientRetries, int heartbeat) { IIrsServer irsServer = null; if (VdsProtocol.STOMP == vdsProtocol) { String eventQueue = null; if (FeatureSupported.events(version)) { eventQueue = Config.<String> getValue(ConfigValues.EventQueueName); } irsServer = new JsonRpcIIrsServer(JsonRpcUtils.createStompClient(hostname, port, connectionTimeOut, clientTimeOut, clientRetries, heartbeat, Config.<Boolean> getValue(ConfigValues.EncryptHostCommunication), Config.<String> getValue(ConfigValues.VdsmSSLProtocol), Config.<Integer> getValue(ConfigValues.EventProcessingPoolSize), Config.<String> getValue(ConfigValues.IrsRequestQueueName), Config.<String> getValue(ConfigValues.IrsResponseQueueName), eventQueue)); } else if (VdsProtocol.XML == vdsProtocol){ Pair<IrsServerConnector, HttpClient> returnValue = XmlRpcUtils.getConnection(hostname, port, clientTimeOut, connectionTimeOut, clientRetries, Config.<Integer> getValue(ConfigValues.IrsMaxConnectionsPerHost), Config.<Integer> getValue(ConfigValues.MaxTotalConnections), IrsServerConnector.class, Config.<Boolean> getValue(ConfigValues.EncryptHostCommunication)); irsServer = new IrsServerWrapper(returnValue.getFirst(), returnValue.getSecond()); } return irsServer; }

Target:
public static IIrsServer createIrsServer(VdsProtocol vdsProtocol, Version version, String hostname, int port, int clientTimeOut, int connectionTimeOut, int clientRetries, int heartbeat) { IIrsServer irsServer = null; if (VdsProtocol.STOMP == vdsProtocol) { String eventQueue = getEventsQueue(version); irsServer = new JsonRpcIIrsServer(JsonRpcUtils.createStompClient(hostname, port, connectionTimeOut, clientTimeOut, clientRetries, heartbeat, Config.<Boolean> getValue(ConfigValues.EncryptHostCommunication), Config.<String> getValue(ConfigValues.VdsmSSLProtocol), Config.<Integer> getValue(ConfigValues.EventProcessingPoolSize), Config.<String> getValue(ConfigValues.IrsRequestQueueName), Config.<String> getValue(ConfigValues.IrsResponseQueueName), eventQueue)); } else if (VdsProtocol.XML == vdsProtocol){ Pair<IrsServerConnector, HttpClient> returnValue = XmlRpcUtils.getConnection(hostname, port, clientTimeOut, connectionTimeOut, clientRetries, Config.<Integer> getValue(ConfigValues.IrsMaxConnectionsPerHost), Config.<Integer> getValue(ConfigValues.MaxTotalConnections), IrsServerConnector.class, Config.<Boolean> getValue(ConfigValues.EncryptHostCommunication)); irsServer = new IrsServerWrapper(returnValue.getFirst(), returnValue.getSecond()); } return irsServer; }
Source:
public BodyParser bodyHandler(final Consumer<String> bodyHandler) { return new BodyParser(tagName, bodyHandler); }

Target:
public void bodyHandler(final Consumer<String> bodyHandler) { this.bodyHandler = bodyHandler; }
Source:
public void write(RawMessage rawMessage) { if (gateway.getAuthorizedUser() != null && gateway.getAuthorizedUser().length() > 0) { _logger.info("Send data: {}, {}", this.gateway, rawMessage); @SuppressWarnings("unchecked") List<String> data = (List<String>) rawMessage.getData(); MESSAGE_TYPE type = MESSAGE_TYPE.fromString(data.get(2)); if (data.size() == 4) { if (type == MESSAGE_TYPE.C_SET) { MESSAGE_TYPE_SET_REQ subType = MESSAGE_TYPE_SET_REQ.fromString(data.get(3)); State state = getHueUpdateState(subType, data); if (state != null) philipsHueClient.lights().updateState(data.get(0), state); } else if (type == MESSAGE_TYPE.C_INTERNAL) { switch (MESSAGE_TYPE_INTERNAL.fromString(data.get(3))) { case I_PRESENTATION: if (!isOnRequestUpdate()) { setOnRequestUpdate(true); } break; default: break; } } } else { _logger.error("data array size should be exactly 4, data:{}", data); } } else { _logger.warn("Private key not set for this {}", gateway); } }

Target:
public void write(RawMessage rawMessage) { if (gateway.getAuthorizedUser() != null && gateway.getAuthorizedUser().length() > 0) { _logger.debug("Send data: {}, {}", this.gateway, rawMessage); @SuppressWarnings("unchecked") List<String> data = (List<String>) rawMessage.getData(); if (data.size() == 4) { MESSAGE_TYPE type = MESSAGE_TYPE.fromString(data.get(0)); String subTypeString = data.get(1); String sensorId = data.get(2); String payload = data.get(3); if (type == MESSAGE_TYPE.C_SET) { MESSAGE_TYPE_SET_REQ subType = MESSAGE_TYPE_SET_REQ.fromString(subTypeString); try { State state = getHueUpdateState(subType, sensorId, payload); if (state != null) { ClientResponse<String> updateState = philipsHueClient.lights().updateState( sensorId, state); if (updateState != null && !updateState.isSuccess()) { _logger.debug("Error while updating hue lights: {}, ", updateState, rawMessage); } } else _logger.warn(" Unable to update ", rawMessage); } catch (Exception ex) { _logger.error("Exception, ", ex); } } else if (type == MESSAGE_TYPE.C_INTERNAL) { MESSAGE_TYPE_INTERNAL subType = MESSAGE_TYPE_INTERNAL.fromString(subTypeString); switch (subType) { case I_PRESENTATION: setOnRequestUpdate(true); break; default: _logger.error(" Not supported internal message: ", subType); break; } } } else { _logger.error("data array size should be exactly 4, data:{}", data); } } else { _logger.warn("Private key not set for this {}", gateway); } }
Source:
public ReferencedEnvelope getLatLonBounds(ReferencedEnvelope nativeBounds, CoordinateReferenceSystem declaredCRS) throws IOException { if (nativeBounds != null && declaredCRS != null) { if (nativeBounds.isEmpty()) { return new ReferencedEnvelope(nativeBounds, DefaultGeographicCRS.WGS84); } if (!CRS.equalsIgnoreMetadata(DefaultGeographicCRS.WGS84, declaredCRS)) { try { ReferencedEnvelope bounds = new ReferencedEnvelope(nativeBounds, declaredCRS); return bounds.transform(DefaultGeographicCRS.WGS84, true); } catch (Exception e) { throw (IOException) new IOException("transform error").initCause(e); } } else { return new ReferencedEnvelope(nativeBounds, DefaultGeographicCRS.WGS84); } } return null; }

Target:
public ReferencedEnvelope getLatLonBounds(ReferencedEnvelope nativeBounds, CoordinateReferenceSystem declaredCRS) throws IOException { if (nativeBounds != null && declaredCRS != null) { if (!CRS.equalsIgnoreMetadata(DefaultGeographicCRS.WGS84, declaredCRS)) { try { ReferencedEnvelope bounds = new ReferencedEnvelope(nativeBounds, declaredCRS); return bounds.transform(DefaultGeographicCRS.WGS84, true); } catch (Exception e) { throw (IOException) new IOException("transform error").initCause(e); } } else { return new ReferencedEnvelope(nativeBounds, DefaultGeographicCRS.WGS84); } } return null; }
Source:
public static Range minimizeEndKeyTimeStamp(Range range) { Range seekRange = range; if (range.getEndKey() != null) { Key seekKey = new Key(seekRange.getEndKey()); if (range.getEndKey().getTimestamp() != Long.MIN_VALUE) { seekKey = new Key(seekRange.getEndKey()); seekKey.setTimestamp(Long.MIN_VALUE); seekRange = new Range(range.getStartKey(), range.isStartKeyInclusive(), seekKey, true); } else if (!range.isEndKeyInclusive()) { seekRange = new Range(range.getStartKey(), range.isStartKeyInclusive(), seekKey, true); } } return seekRange; }

Target:
public static Range minimizeEndKeyTimeStamp(Range range) { Range seekRange = range; if (range.getEndKey() != null) { Key seekKey = seekRange.getEndKey(); if (range.getEndKey().getTimestamp() != Long.MIN_VALUE) { seekKey = new Key(seekRange.getEndKey()); seekKey.setTimestamp(Long.MIN_VALUE); seekRange = new Range(range.getStartKey(), range.isStartKeyInclusive(), seekKey, true); } else if (!range.isEndKeyInclusive()) { seekRange = new Range(range.getStartKey(), range.isStartKeyInclusive(), seekKey, true); } } return seekRange; }
Source:
HttpServer.Method convertMethod(HttpServerRequest request) { switch (request.method()) { case GET: return HttpServer.Method.GET; case POST: return HttpServer.Method.POST; case DELETE: return HttpServer.Method.DELETE; case PUT: return HttpServer.Method.PUT; default: return HttpServer.Method.GET; } }

Target:
HttpServer.Method convertMethod(HttpServerRequest request) { switch (request.method()) { case POST: return HttpServer.Method.POST; case DELETE: return HttpServer.Method.DELETE; case PUT: return HttpServer.Method.PUT; default: return HttpServer.Method.GET; } }
Source:
public void optimizeStatement() throws StandardException { if (sparkExplainKind != SparkExplainKind.NONE) { getCompilerContext().setDataSetProcessorType(DataSetProcessorType.FORCED_SPARK); } node.optimizeStatement(); if (!showNoStatsObjects) return; HashSet<String> noStatsColumnSet = new HashSet<>(); CollectNodesVisitor cnv = new CollectNodesVisitor(FromBaseTable.class); node.accept(cnv); List<FromBaseTable> baseTableNodes = cnv.getList(); for (FromBaseTable t : baseTableNodes) { String tableName = t.getExposedName(); if (!t.useRealTableStats()) { noStatsTables.add(new SQLVarchar(tableName)); } else if (!t.getNoStatsColumnIds().isEmpty()) { TableDescriptor td = t.getTableDescriptor(); for (int columnId : t.getNoStatsColumnIds()) { noStatsColumnSet.add(tableName + "." + td.getColumnDescriptor(columnId).getColumnName()); } } } cnv = new CollectNodesVisitor(BinaryRelationalOperatorNode.class); node.accept(cnv); List<BinaryRelationalOperatorNode> binaryOpNodes = cnv.getList(); for (BinaryRelationalOperatorNode bop : binaryOpNodes) { noStatsColumnSet.addAll(bop.getNoStatsColumns()); } cnv = new CollectNodesVisitor(GroupByNode.class); node.accept(cnv); List<GroupByNode> groupByNodes = cnv.getList(); for (GroupByNode gbn : groupByNodes) { noStatsColumnSet.addAll(gbn.getNoStatsColumns()); } for (String columnName : noStatsColumnSet) { noStatsColumns.add(new SQLVarchar(columnName)); } }

Target:
public void optimizeStatement() throws StandardException { if (sparkExplainKind != SparkExplainKind.NONE) { getCompilerContext().setDataSetProcessorType(DataSetProcessorType.FORCED_SPARK); } node.optimizeStatement(); if (showNoStatsObjects) { collectNoStatsTablesAndColumns(); } }
Source:
public void setPattern(String pattern){ if( pattern == null){ patternTextField.setText(""); }else{ patternTextField.setText(pattern); } }

Target:
public void setPattern(String pattern){ patternTextField.setText(pattern); }
Source:
public ScrollResult scroll(String scrollId, Function<O, String> idExtractor) { CursorResult<C, O> cursorResult = cursorResults.get(scrollId); if (cursorResult == null) { throw new NuxeoException("Unknown or timed out scrollId"); } else if (isScrollTimedOut(scrollId, cursorResult)) { throw new NuxeoException("Timed out scrollId"); } cursorResult.touch(); List<String> ids = new ArrayList<>(cursorResult.getBatchSize()); List<O> results = new ArrayList<>(cursorResult.getBatchSize()); synchronized (cursorResult) { if (!cursorResult.hasNext()) { unregisterCursor(scrollId); return emptyResult(); } while (ids.size() < cursorResult.getBatchSize()) { if (!cursorResult.hasNext()) { cursorResult.close(); break; } else { O obj = cursorResult.next(); results.add(obj); String id = idExtractor.apply(obj); if (id == null) { log.error("Got a document without id: " + obj); } else { ids.add(id); } } } } return new ScrollResultImpl<>(scrollId, ids, results); }

Target:
public ScrollResult scroll(String scrollId, Function<O, String> idExtractor) { return scroll(scrollId, false, idExtractor); }
Source:
public MultipartUpload initiateMultipartUpload(String container, BlobMetadata blobMetadata) { Long contentLength = blobMetadata.getContentMetadata().getContentLength(); String uploadId = String.format("%s/slo/%.6f/%s", blobMetadata.getName(), System.currentTimeMillis() / 1000.0, contentLength == null ? 0 : contentLength); return MultipartUpload.create(container, blobMetadata.getName(), uploadId, blobMetadata); }

Target:
public MultipartUpload initiateMultipartUpload(String container, BlobMetadata blobMetadata) { return initiateMultipartUpload(container, blobMetadata, 0); }
Source:
private CompletableFuture<Void> removeJob(JobID jobId, boolean cleanupHA) { DispatcherJob job = runningJobs.remove(jobId); final CompletableFuture<Void> jobManagerRunnerTerminationFuture; if (job != null) { jobManagerRunnerTerminationFuture = job.closeAsync(); } else { jobManagerRunnerTerminationFuture = CompletableFuture.completedFuture(null); } return jobManagerRunnerTerminationFuture.thenRunAsync( () -> cleanUpJobData(jobId, cleanupHA), getRpcService().getExecutor()); }

Target:
private CompletableFuture<Void> removeJob(JobID jobId, boolean cleanupHA) { DispatcherJob job = runningJobs.remove(jobId); final CompletableFuture<Void> dispatcherJobTerminationFuture; if (job != null) { dispatcherJobTerminationFuture = job.closeAsync(); } else { dispatcherJobTerminationFuture = CompletableFuture.completedFuture(null); } return dispatcherJobTerminationFuture.thenRunAsync( () -> cleanUpJobData(jobId, cleanupHA), getRpcService().getExecutor()); }
Source:
FetchV0Request(@NonNull Set<ObjectId> wantIds, int depth, @NonNull Set<ObjectId> clientShallowCommits, long filterBlobLimit, @NonNull Set<String> clientCapabilities) { super(wantIds, depth, clientShallowCommits, filterBlobLimit, clientCapabilities, 0, new ArrayList<String>()); }

Target:
FetchV0Request(@NonNull Set<ObjectId> wantIds, int depth, @NonNull Set<ObjectId> clientShallowCommits, long filterBlobLimit, @NonNull Set<String> clientCapabilities) { super(wantIds, depth, clientShallowCommits, filterBlobLimit, clientCapabilities, 0, Collections.emptyList()); }
Source:
private List<PropertyLink> createLinks(String identifier, BioentityPropertyName propertyName, Collection<String> propertyValues, Species species) { List<PropertyLink> links = bioEntityPropertyService.mapToLinkText(propertyName, propertyValues).entrySet().stream() .map( linkWithText -> createLink( linkWithText.getValue(), identifier, propertyName, linkWithText.getKey(), species, bioEntityPropertyService.assessRelevance(propertyName, linkWithText.getKey()) ) ).collect(Collectors.toList()); links.sort((PropertyLink p1, PropertyLink p2) -> p2.getRelevance() - p1.getRelevance()); return links; }

Target:
private List<PropertyLink> createLinks(String identifier, BioentityPropertyName propertyName, Collection<String> propertyValues, Species species) { List<PropertyLink> links = bioEntityPropertyService.mapToLinkText(propertyName, propertyValues).entrySet().stream() .map( linkWithText -> createLink( linkWithText.getValue(), identifier, propertyName, linkWithText.getKey(), species, bioEntityPropertyService.assessRelevance(propertyName, linkWithText.getKey()) ) ) .sorted(Comparator.comparing(PropertyLink::getRelevance).reversed()) .collect(Collectors.toList()); return links; }
Source:
public int visit(IASTName name) { if (!constructorsStack.empty()) { if (name.getParent() instanceof IASTFieldReference) { IASTFieldReference ref = (IASTFieldReference) name.getParent(); if (!referencesThis(ref.getFieldOwner())) return PROCESS_CONTINUE; } Set<IField> actualConstructorFields = constructorsStack.peek(); if (!actualConstructorFields.isEmpty()) { IBinding binding = name.resolveBinding(); if (binding != null && !(binding instanceof IProblemBinding)) { IField equivalentFieldBinding = getContainedEquivalentBinding(actualConstructorFields, binding, name.getTranslationUnit().getIndex()); if (equivalentFieldBinding != null) { Optional<Integer> res = CPPVariableReadWriteFlags.getReadWriteFlags(name); if (!res.isPresent() || (res.get() & PDOMName.WRITE_ACCESS) != 0) { actualConstructorFields.remove(equivalentFieldBinding); } } } } } return PROCESS_CONTINUE; }

Target:
public int visit(IASTName name) { if (!constructorsStack.empty()) { if (name.getParent() instanceof IASTFieldReference) { IASTFieldReference ref = (IASTFieldReference) name.getParent(); if (!referencesThis(ref.getFieldOwner())) return PROCESS_CONTINUE; } Set<IField> actualConstructorFields = constructorsStack.peek(); if (!actualConstructorFields.isEmpty()) { IBinding binding = name.resolveBinding(); if (binding != null && !(binding instanceof IProblemBinding)) { IField equivalentFieldBinding = getContainedEquivalentBinding(actualConstructorFields, binding, name.getTranslationUnit().getIndex()); if (equivalentFieldBinding != null) { Optional<Integer> res = CPPVariableReadWriteFlags.getReadWriteFlags(name); if (CPPVariableReadWriteFlags.mayBeWriteAccess(res)) { actualConstructorFields.remove(equivalentFieldBinding); } } } } } return PROCESS_CONTINUE; }
Source:
private int getCountOfTenants() throws UserStoreException { String sqlStmt = TenantConstants.LIST_TENANTS_COUNT_SQL; int tenantCount = 0; try (Connection dbConnection = getDBConnection(); PreparedStatement prepStmt = dbConnection.prepareStatement(sqlStmt)) { try (ResultSet rs = prepStmt.executeQuery()) { if (rs.next()) { tenantCount = Integer.parseInt(rs.getString(1)); } } } catch (SQLException e) { throw new UserStoreException("Error occurred while retrieving tenant count"); } return tenantCount; }

Target:
private int getCountOfTenants() throws UserStoreException { String sqlStmt = TenantConstants.LIST_TENANTS_COUNT_SQL; int tenantCount = 0; try (Connection dbConnection = getDBConnection(); PreparedStatement prepStmt = dbConnection.prepareStatement(sqlStmt)) { try (ResultSet rs = prepStmt.executeQuery()) { if (rs.next()) { tenantCount = Integer.parseInt(rs.getString(1)); } } } catch (SQLException e) { throw new UserStoreException("Error occurred while retrieving tenant count.", e); } return tenantCount; }
Source:
public void blackHoleConnectorUsage() { assertThatQueryReturnsValue("CREATE TABLE nation as SELECT * FROM tpch.tiny.nation", 25L); queryRunner.execute("CREATE SCHEMA blackhole.test"); assertThatQueryReturnsValue("CREATE TABLE test.nation as SELECT * FROM tpch.tiny.nation", 25L); List<QualifiedObjectName> tableNames = listBlackHoleTables(); assertTrue(tableNames.size() == 1, "Expected only one table."); assertTrue(tableNames.get(0).getObjectName().equals("nation"), "Expected 'nation' table."); assertThatQueryReturnsValue("INSERT INTO nation SELECT * FROM tpch.tiny.nation", 25L); assertThatQueryReturnsValue("INSERT INTO nation SELECT * FROM tpch.tiny.nation", 25L); assertThatQueryReturnsValue("SELECT count(*) FROM nation", 0L); assertThatQueryReturnsValue("DROP TABLE nation", true); assertThatQueryReturnsValue("DROP TABLE test.nation", true); }

Target:
public void blackHoleConnectorUsage() { assertThatQueryReturnsValue("CREATE TABLE nation as SELECT * FROM tpch.tiny.nation", 25L); List<QualifiedObjectName> tableNames = listBlackHoleTables(); assertTrue(tableNames.size() == 1, "Expected only one table."); assertTrue(tableNames.get(0).getObjectName().equals("nation"), "Expected 'nation' table."); assertThatQueryReturnsValue("INSERT INTO nation SELECT * FROM tpch.tiny.nation", 25L); assertThatQueryReturnsValue("INSERT INTO nation SELECT * FROM tpch.tiny.nation", 25L); assertThatQueryReturnsValue("SELECT count(*) FROM nation", 0L); assertThatQueryReturnsValue("DROP TABLE nation", true); }
Source:
public TranslatedExpression<T> translate(FunctionMetadata functionMetadata, RowExpression original) { return translate(functionMetadata, original, emptyList()); }

Target:
public TranslatedExpression<T> translate(FunctionMetadata functionMetadata, RowExpression original) throws Throwable { return translate(functionMetadata, original, ImmutableList.of()); }
Source:
protected void executeQueryCommand() { getQueryReturnValue().setSucceeded(false); String path = Config.resolveCACertificatePath(); if (FileUtil.fileExists(path)) { try { getQueryReturnValue().setReturnValue(FileUtil.readAllText(path)); } catch (IOException e) { getQueryReturnValue().setSucceeded(false); return; } getQueryReturnValue().setSucceeded(true); } }

Target:
protected void executeQueryCommand() { getQueryReturnValue().setSucceeded(false); String path = Config.resolveCACertificatePath(); if (FileUtil.fileExists(path)) { try { getQueryReturnValue().setReturnValue(FileUtil.readAllText(path)); } catch (IOException e) { getQueryReturnValue().setExceptionString(e.getMessage()); return; } getQueryReturnValue().setSucceeded(true); } }
Source:
public boolean isInEmergencySmsMode() { long lastSmsTimeMs = mTimeLastEmergencySmsSentMs; if (lastSmsTimeMs == -1) { return false; } CarrierConfigManager configManager = (CarrierConfigManager) getContext().getSystemService(Context.CARRIER_CONFIG_SERVICE); PersistableBundle b = configManager.getConfigForSubId(getSubId()); if (b == null) { return false; } int eSmsTimerMs = b.getInt(CarrierConfigManager.KEY_EMERGENCY_SMS_MODE_TIMER_MS_INT, 0); if (eSmsTimerMs == 0) { return false; } if (eSmsTimerMs > EMERGENCY_SMS_TIMER_MAX_MS) { eSmsTimerMs = EMERGENCY_SMS_TIMER_MAX_MS; } boolean isInEmergencySmsMode = SystemClock.elapsedRealtime() <= (lastSmsTimeMs + eSmsTimerMs); if (!isInEmergencySmsMode) { mTimeLastEmergencySmsSentMs = -1; } return isInEmergencySmsMode; }

Target:
public boolean isInEmergencySmsMode() { long lastSmsTimeMs = mTimeLastEmergencySmsSentMs; if (lastSmsTimeMs == EMERGENCY_SMS_NO_TIME_RECORDED) { return false; } CarrierConfigManager configManager = (CarrierConfigManager) getContext().getSystemService(Context.CARRIER_CONFIG_SERVICE); PersistableBundle b = configManager.getConfigForSubId(getSubId()); if (b == null) { return false; } int eSmsTimerMs = b.getInt(CarrierConfigManager.KEY_EMERGENCY_SMS_MODE_TIMER_MS_INT, 0); if (eSmsTimerMs == 0) { return false; } if (eSmsTimerMs > EMERGENCY_SMS_TIMER_MAX_MS) { eSmsTimerMs = EMERGENCY_SMS_TIMER_MAX_MS; } boolean isInEmergencySmsMode = SystemClock.elapsedRealtime() <= (lastSmsTimeMs + eSmsTimerMs); if (!isInEmergencySmsMode) { mTimeLastEmergencySmsSentMs = EMERGENCY_SMS_NO_TIME_RECORDED; } else { Rlog.i(LOG_TAG, "isInEmergencySmsMode: queried while emergency SMS mode is active."); } return isInEmergencySmsMode; }
Source:
protected ICommand getBeforeSetCommand(final SetRequest request) { ICommand gmfCommand = super.getBeforeSetCommand(request); if (request.getValue() instanceof ArrayList && request.getElementToEdit() instanceof AttributeOwner && request.getFeature().getName().equals("ownedAttribute")) { ArrayList<?> newPropertyList = (ArrayList<?>) request.getValue(); EList<Property> oldPropertyList = ((AttributeOwner) request.getElementToEdit()).getOwnedAttributes(); for (Object object : newPropertyList) { if (object instanceof Property && !oldPropertyList.contains(object) && (((Property) object).eContainer() instanceof Association)) { return UnexecutableCommand.INSTANCE; } } } return gmfCommand; }

Target:
protected ICommand getBeforeSetCommand(final SetRequest request) { ICommand gmfCommand = super.getBeforeSetCommand(request); if (request.getValue() instanceof ArrayList && request.getElementToEdit() instanceof AttributeOwner && request.getFeature().equals(UMLPackage.eINSTANCE.getStructuredClassifier_OwnedAttribute())) { ArrayList<?> newPropertyList = (ArrayList<?>) request.getValue(); EList<Property> oldPropertyList = ((AttributeOwner) request.getElementToEdit()).getOwnedAttributes(); for (Object object : newPropertyList) { if (object instanceof Property && !oldPropertyList.contains(object) && (((Property) object).eContainer() instanceof Association)) { return UnexecutableCommand.INSTANCE; } } } return gmfCommand; }
Source:
protected SeekableStreamIndexTaskIOConfig createTaskIoConfig( int groupId, Map<String, String> startPartitions, Map<String, String> endPartitions, String baseSequenceName, DateTime minimumMessageTime, DateTime maximumMessageTime, Set<String> exclusiveStartSequenceNumberPartitions, SeekableStreamSupervisorIOConfig ioConfigg ) { KinesisSupervisorIOConfig ioConfig = (KinesisSupervisorIOConfig) ioConfigg; return new KinesisIndexTaskIOConfig( groupId, baseSequenceName, new SeekableStreamPartitions<>(ioConfig.getStream(), startPartitions), new SeekableStreamPartitions<>(ioConfig.getStream(), endPartitions), true, true, minimumMessageTime, maximumMessageTime, ioConfig.getEndpoint(), ioConfig.getRecordsPerFetch(), ioConfig.getFetchDelayMillis(), exclusiveStartSequenceNumberPartitions, ioConfig.getAwsAssumedRoleArn(), ioConfig.getAwsExternalId(), ioConfig.isDeaggregate() ); }

Target:
protected SeekableStreamIndexTaskIOConfig createTaskIoConfig( int groupId, Map<String, String> startPartitions, Map<String, String> endPartitions, String baseSequenceName, DateTime minimumMessageTime, DateTime maximumMessageTime, Set<String> exclusiveStartSequenceNumberPartitions, SeekableStreamSupervisorIOConfig ioConfigg ) { KinesisSupervisorIOConfig ioConfig = (KinesisSupervisorIOConfig) ioConfigg; return new KinesisIndexTaskIOConfig( groupId, baseSequenceName, new SeekableStreamPartitions<>(ioConfig.getStream(), startPartitions), new SeekableStreamPartitions<>(ioConfig.getStream(), endPartitions), true, minimumMessageTime, maximumMessageTime, ioConfig.getEndpoint(), ioConfig.getRecordsPerFetch(), ioConfig.getFetchDelayMillis(), exclusiveStartSequenceNumberPartitions, ioConfig.getAwsAssumedRoleArn(), ioConfig.getAwsExternalId(), ioConfig.isDeaggregate() ); }
Source:
void enableButtonMenu() { getSubMenu().setVisible(true); }

Target:
void enableButtonMenu() { getAddColumn().setEnabled(true); getEditColumns().setEnabled(true); }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_toolbar_container); showBackButton(); try { centerId = getIntent().getExtras().getInt(Constants.CENTER_ID); } catch (NullPointerException e) { Log.e(LOG_TAG, "No intent received for centerId"); } if (centerId != 0) { replaceFragment(GroupListFragment.newInstance(centerId), true, R.id.container); } else { replaceFragment(new CenterListFragment(), false, R.id.container); } }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_toolbar_container); showBackButton(); Bundle bundle = getIntent().getExtras(); if (bundle != null) { int centerId = bundle.getInt(Constants.CENTER_ID); replaceFragment(GroupListFragment.newInstance(centerId), true, R.id.container); } else { replaceFragment(new CenterListFragment(), false, R.id.container); } }
Source:
protected void onDraw(Canvas canvas) { canvas.drawColor(0x40FFFFFF); super.onDraw(canvas); }

Target:
protected void onDraw(Canvas canvas) { canvas.drawColor(INSPECT_OVERLAY_COLOR); super.onDraw(canvas); }
Source:
public BoltResultHandle executeQuery( BoltQuerySource querySource, LoginContext loginContext, String statement, MapValue params, ThrowingAction<KernelException> onFail ) { InternalTransaction internalTransaction = queryService.beginTransaction( implicit, loginContext ); ClientConnectionInfo sourceDetails = new BoltConnectionInfo( querySource.principalName, querySource.clientName, querySource.connectionDescriptor.clientAddress(), querySource.connectionDescriptor.serverAddress() ); TransactionalContext transactionalContext = contextFactory.newContext( sourceDetails, internalTransaction, statement, params ); return new BoltResultHandle() { @Override public BoltResult start() throws KernelException { try { QueryResult run = ((ExecutionResult) queryExecutionEngine.executeQuery( statement, params, transactionalContext )) .queryResult(); return new CypherAdapterStream( run, clock ); } catch ( KernelException e ) { transactionalContext.close( false ); onFail.apply(); throw new QueryExecutionKernelException( e ); } catch ( Throwable e ) { transactionalContext.close( false ); onFail.apply(); throw e; } } @Override public void close( boolean success ) { transactionalContext.close( success ); } @Override public void terminate() { transactionalContext.terminate(); } }; }

Target:
public BoltResultHandle executeQuery( BoltQuerySource querySource, LoginContext loginContext, String statement, MapValue params, ThrowingAction<KernelException> onFail ) { InternalTransaction internalTransaction = queryService.beginTransaction( implicit, loginContext ); ClientConnectionInfo sourceDetails = new BoltConnectionInfo( querySource.principalName, querySource.clientName, querySource.connectionDescriptor.clientAddress(), querySource.connectionDescriptor.serverAddress() ); TransactionalContext transactionalContext = contextFactory.newContext( sourceDetails, internalTransaction, statement, params ); return new BoltResultHandle() { @Override public BoltResult start() throws KernelException { try { QueryResult run = ((ExecutionResult) queryExecutionEngine.executeQuery( statement, params, transactionalContext )) .queryResult(); return new CypherAdapterStream( run, clock ); } catch ( KernelException e ) { close( false ); onFail.apply(); throw new QueryExecutionKernelException( e ); } catch ( Throwable e ) { close( false ); onFail.apply(); throw e; } } @Override public void close( boolean success ) { transactionalContext.close( success ); } @Override public void terminate() { transactionalContext.terminate(); } }; }
Source:
public boolean isUnderLimit(CurrencyType type, Double amount) { Player player = this.getPlayer(); if (player == null) return true; if (amount == 0) return true; CurrencyLimit limit = Jobs.getGCManager().getLimit(type); if (!limit.isEnabled()) return true; PaymentData data = getPaymentLimit(); Integer value = this.limits.get(type); if (data.IsReachedLimit(type, value == null ? 0 : value)) { if (player.isOnline() && !data.isInformed() && !data.isReseted()) { if(Jobs.getGCManager().useMaxPaymentCurve) { player.sendMessage(Jobs.getLanguage().getMessage("command.limit.output.reached" + type.getName().toLowerCase() + "limit")); player.sendMessage(Jobs.getLanguage().getMessage("command.limit.output.reached" + type.getName().toLowerCase() + "limit2")); player.sendMessage(Jobs.getLanguage().getMessage("command.limit.output.reached" + type.getName().toLowerCase() + "limit3")); }else { player.sendMessage(Jobs.getLanguage().getMessage("command.limit.output.reached" + type.getName().toLowerCase() + "limit")); player.sendMessage(Jobs.getLanguage().getMessage("command.limit.output.reached" + type.getName().toLowerCase() + "limit2")); data.setInformed(); } data.setInformed(); } if (data.IsAnnounceTime(limit.getAnnouncementDelay()) && player.isOnline()) { Jobs.getActionBar().send(player, Jobs.getLanguage().getMessage("command.limit.output." + type.getName().toLowerCase() + "time", "%time%", TimeManage.to24hourShort(data.GetLeftTime(type)))); } if (data.isReseted()) data.setReseted(false); return false; } data.AddAmount(type, amount); return true; }

Target:
public boolean isUnderLimit(CurrencyType type, Double amount) { Player player = this.getPlayer(); if (player == null) return true; if (amount == 0) return true; CurrencyLimit limit = Jobs.getGCManager().getLimit(type); if (!limit.isEnabled()) return true; PaymentData data = getPaymentLimit(); Integer value = this.limits.get(type); if (data.IsReachedLimit(type, value == null ? 0 : value)) { if (player.isOnline() && !data.isInformed() && !data.isReseted()) { if(Jobs.getGCManager().useMaxPaymentCurve) { player.sendMessage(Jobs.getLanguage().getMessage("command.limit.output.reached" + type.getName().toLowerCase() + "limit")); player.sendMessage(Jobs.getLanguage().getMessage("command.limit.output.reached" + type.getName().toLowerCase() + "limit2")); player.sendMessage(Jobs.getLanguage().getMessage("command.limit.output.reached" + type.getName().toLowerCase() + "limit3")); }else { player.sendMessage(Jobs.getLanguage().getMessage("command.limit.output.reached" + type.getName().toLowerCase() + "limit")); player.sendMessage(Jobs.getLanguage().getMessage("command.limit.output.reached" + type.getName().toLowerCase() + "limit2")); } data.setInformed(); } if (data.IsAnnounceTime(limit.getAnnouncementDelay()) && player.isOnline()) { Jobs.getActionBar().send(player, Jobs.getLanguage().getMessage("command.limit.output." + type.getName().toLowerCase() + "time", "%time%", TimeManage.to24hourShort(data.GetLeftTime(type)))); } if (data.isReseted()) data.setReseted(false); return false; } data.AddAmount(type, amount); return true; }
Source:
private void executeDiskExtend() { switch (getOldDisk().getDiskStorageType()) { case IMAGE: extendDiskImageSize(); break; case CINDER: extendCinderDiskSize(); break; } }

Target:
private void executeDiskExtend() { switch (getOldDisk().getDiskStorageType()) { case IMAGE: extendDiskImageSize(); break; case CINDER: extendCinderDiskSize(); break; case MANAGED_BLOCK_STORAGE: extendManagedBlockDiskSize(); break; } }
Source:
public Map<String, String> getColors() { Map<String, String> colors = new HashMap<>(); boolean even = true; int hue = 60; final List<String> revisions = getRevisions() .stream() .sorted(Comparator.comparingInt(this::getFileVersion).reversed()) .collect(Collectors.toList()); for (String revision : revisions) { colors.put(revision, String.format("hsl(%d, %d%%, %d%%)", hue, 90 - (even ? 0 : 10), 80 - (even ? 0 : 10))); hue += 360 / getRevisions().size(); hue %= 360; even = !even; } return colors; }

Target:
public Map<String, String> getColors() { return colors.get(); }
Source:
private void fetchMessages() { Set<SystemStreamPartition> SSPsToFetch = new HashSet<>(); for (SystemStreamPartition ssp : nextOffsets.keySet()) { if (sink.needsMoreMessages(ssp)) { SSPsToFetch.add(ssp); } } LOG.debug("pollConsumer {}", SSPsToFetch.size()); if (!SSPsToFetch.isEmpty()) { kafkaConsumerMetrics.incClientReads(metricName); Map<SystemStreamPartition, List<IncomingMessageEnvelope>> response; LOG.debug("pollConsumer from following SSPs: {}; total#={}", SSPsToFetch, SSPsToFetch.size()); response = pollConsumer(SSPsToFetch, 500); for (Map.Entry<SystemStreamPartition, List<IncomingMessageEnvelope>> e : response.entrySet()) { List<IncomingMessageEnvelope> envelopes = e.getValue(); if (envelopes != null) { moveMessagesToTheirQueue(e.getKey(), envelopes); } } populateCurrentLags(SSPsToFetch); } else { LOG.debug("No topic/partitions need to be fetched for consumer right now. Sleeping {}ms.", kafkaConsumer, SLEEP_MS_WHILE_NO_TOPIC_PARTITION); kafkaConsumerMetrics.incClientSkippedFetchRequests(metricName); try { Thread.sleep(SLEEP_MS_WHILE_NO_TOPIC_PARTITION); } catch (InterruptedException e) { LOG.warn("Sleep in fetchMessages was interrupted"); } } refreshLatencyMetrics(); }

Target:
private void fetchMessages() { Set<SystemStreamPartition> sspsToFetch = new HashSet<>(); for (SystemStreamPartition ssp : nextOffsets.keySet()) { if (sink.needsMoreMessages(ssp)) { sspsToFetch.add(ssp); } } LOG.debug("pollConsumer for SSPs: {}", sspsToFetch.size(), sspsToFetch); if (!sspsToFetch.isEmpty()) { kafkaConsumerMetrics.incClientReads(metricName); Map<SystemStreamPartition, List<IncomingMessageEnvelope>> response; response = pollConsumer(sspsToFetch, 500L); for (Map.Entry<SystemStreamPartition, List<IncomingMessageEnvelope>> e : response.entrySet()) { List<IncomingMessageEnvelope> envelopes = e.getValue(); if (envelopes != null) { moveMessagesToTheirQueue(e.getKey(), envelopes); } } populateCurrentLags(sspsToFetch); } else { LOG.debug("No topic/partitions need to be fetched for system right now. Sleeping {}ms.", systemName, SLEEP_MS_WHILE_NO_TOPIC_PARTITION); kafkaConsumerMetrics.incClientSkippedFetchRequests(metricName); try { Thread.sleep(SLEEP_MS_WHILE_NO_TOPIC_PARTITION); } catch (InterruptedException e) { LOG.warn("Sleep in fetchMessages was interrupted"); } } refreshLagMetrics(); }