auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public DruidQueryGeneratorContext withOutputColumns(List<VariableReferenceExpression> outputColumns) { LinkedHashMap<VariableReferenceExpression, Selection> newSelections = new LinkedHashMap<>(); outputColumns.forEach(o -> newSelections.put(o, requireNonNull(selections.get(o), "Cannot find the selection " + o + " in the original context " + this))); return new DruidQueryGeneratorContext(newSelections, from, filter); }

Target:
public DruidQueryGeneratorContext withOutputColumns(List<VariableReferenceExpression> outputColumns) { Map<VariableReferenceExpression, Selection> newSelections = new LinkedHashMap<>(); outputColumns.forEach(o -> newSelections.put(o, requireNonNull(selections.get(o), "Cannot find the selection " + o + " in the original context " + this))); return new DruidQueryGeneratorContext(newSelections, from, filter); }
Source:
private static Consumer<SetMultimap<LeadershipEvent, Client>> deregisterMetricsForPartitionedLeader( TimelockPaxosMetrics metrics) { return eventsToDeregister -> { Map<LeadershipEvent, Set<String>> eventsToClients = Multimaps.asMap(KeyedStream.stream(eventsToDeregister) .map(Client::value) .collectToSetMultimap()); eventsToClients.keySet().forEach(event -> metrics.asMetricsManager().deregisterTaggedMetrics( withTagIsCurrentSuspectedLeader(event.isCurrentSuspectedLeader()) .and(withClientTag(eventsToClients.get(event))))); }; }

Target:
private static Consumer<SetMultimap<LeadershipEvent, Client>> deregisterMetricsForPartitionedLeader( TimelockPaxosMetrics metrics) { return eventsToDeregister -> { Map<LeadershipEvent, Set<String>> eventsToClients = Multimaps.asMap(KeyedStream.stream(eventsToDeregister) .map(Client::value) .collectToSetMultimap()); eventsToClients.forEach((event, clients) -> metrics.asMetricsManager().deregisterTaggedMetrics( withTagIsCurrentSuspectedLeader(event.isCurrentSuspectedLeader()) .and(withClientTag(clients)))); }; }
Source:
public void testMultipleResponsesWithException() throws UnsupportedEncodingException { RetryingReadRowsOperation underTest = createOperation(mockFlatRowObserver); start(underTest); ByteString key1 = ByteString.copyFrom("SomeKey1", "UTF-8"); ByteString key2 = ByteString.copyFrom("SomeKey2", "UTF-8"); underTest.onMessage(buildResponse(key1)); underTest.onClose(Status.ABORTED, new Metadata()); Assert.assertFalse(underTest.getRowMerger().isComplete()); underTest.onMessage(buildResponse(key2)); verify(mockFlatRowObserver, times(2)).onNext(any(FlatRow.class)); checkRetryRequest(underTest, key2, 8); verify(mockClientCall, atLeast(2)).request(eq(1)); finishOK(underTest, 1); }

Target:
public void testMultipleResponsesWithException() throws UnsupportedEncodingException { RetryingReadRowsOperation underTest = createOperation(mockFlatRowObserver); start(underTest); ByteString key1 = ByteString.copyFrom("SomeKey1", "UTF-8"); ByteString key2 = ByteString.copyFrom("SomeKey2", "UTF-8"); underTest.onMessage(buildResponse(key1)); underTest.onClose(Status.ABORTED, new Metadata()); Assert.assertFalse(underTest.getRowMerger().isComplete()); underTest.onMessage(buildResponse(key2)); verify(mockFlatRowObserver, times(2)).onNext(any(FlatRow.class)); checkRetryRequest(underTest, key2, 8); verify(mockClientCall, times(4)).request(eq(1)); finishOK(underTest, 1); }
Source:
static ArrayList getNameSpaceArray(MetricKey metricKey) { MetricName metricName = metricKey.metricName(); try { return new ObjectMapper().readValue(metricName.getNamespace(), ArrayList.class); } catch (JsonProcessingException e) { e.printStackTrace(); throw new RuntimeException(String.format("Parse namespace[%s] error. ", metricName.getNamespace())); } }

Target:
static ArrayList getNameSpaceArray(MetricKey metricKey) { MetricName metricName = metricKey.metricName(); try { return new ObjectMapper().readValue(metricName.getNamespace(), ArrayList.class); } catch (JsonProcessingException e) { throw new RuntimeException( String.format("Parse namespace[%s] error. ", metricName.getNamespace()), e); } }
Source:
public Latch getLatch(int size, String latchId) { return null; }

Target:
public Latch getLatch(int size, String latchId) throws UnsupportedOperationException { return null; }
Source:
public RecoveryStrategy onException(final JobExecutor jobExecutor, final Exception exception, final String curQueue) { if (exception instanceof JedisConnectionException || exception instanceof JedisNoScriptException || (exception instanceof JedisDataException && exception.getMessage().equals("LOADING Redis is loading the dataset in memory"))) { return RECONNECT; } else if (exception instanceof JsonProcessingException || (exception instanceof InterruptedException && !jobExecutor.isShutdown())) { return PROCEED; } else { return TERMINATE; } }

Target:
public RecoveryStrategy onException(final JobExecutor jobExecutor, final Exception exception, final String curQueue) { final boolean isLoadingDataset = exception instanceof JedisDataException && exception.getMessage().equals("LOADING Redis is loading the dataset in memory"); if (exception instanceof JedisConnectionException || exception instanceof JedisNoScriptException || isLoadingDataset) { return RECONNECT; } else if (exception instanceof JsonProcessingException || (exception instanceof InterruptedException && !jobExecutor.isShutdown())) { return PROCEED; } else { return TERMINATE; } }
Source:
private String redirectToList() { String referrer = FacesContext.getCurrentInstance().getExternalContext().getRequestHeaderMap().get("referer"); String callerViewId = referrer.substring(referrer.lastIndexOf("/") + 1); if (!callerViewId.isEmpty() && callerViewId.contains("editDocket.jsf")) { return "/pages/projects.jsf?id=3&" + redirectParameter; } else { return "/pages/DocketList?" + redirectParameter; } }

Target:
private String redirectToList() { String referrer = FacesContext.getCurrentInstance().getExternalContext().getRequestHeaderMap().get("referer"); String callerViewId = referrer.substring(referrer.lastIndexOf("/") + 1); if (!callerViewId.isEmpty() && callerViewId.contains("editDocket.jsf")) { return "/pages/projects.jsf?id=" + projectForm.getActiveTabIndex() + "&" + REDIRECT_PARAMETER; } else { return "/pages/DocketList?" + REDIRECT_PARAMETER; } }
Source:
public void purge(Diagnosis diagnosis, RequestContext requestContext) throws ResponseException { Context.getDiagnosisService().purgeService(diagnosis); }

Target:
public void purge(Diagnosis diagnosis, RequestContext requestContext) throws ResponseException { Context.getDiagnosisService().purgeDiagnosis(diagnosis); }
Source:
protected List<Workflow> githubWebhookDelete(String repository, String gitReference, String username, String installationId) { Optional<String> gitReferenceName = GitHelper.parseGitHubReference(gitReference); if (gitReferenceName.isEmpty()) { String msg = "Reference " + gitReference + " is not of the valid form"; LOG.error(msg); LambdaEvent lambdaEvent = createBasicEvent(repository, gitReference, username, installationId, LambdaEvent.LambdaEventType.DELETE); lambdaEvent.setMessage(msg); lambdaEvent.setSuccess(false); lambdaEventDAO.create(lambdaEvent); sessionFactory.getCurrentSession().getTransaction().commit(); throw new CustomWebApplicationException(msg, LAMBDA_FAILURE); } List<Workflow> workflows = workflowDAO.findAllByPath("github.com/" + repository, false).stream().filter(workflow -> Objects.equals(workflow.getMode(), DOCKSTORE_YML)).collect( Collectors.toList()); workflows.forEach(workflow -> workflow.getWorkflowVersions().removeIf(workflowVersion -> Objects.equals(workflowVersion.getName(), gitReferenceName.get()) && !workflowVersion.isFrozen())); LambdaEvent lambdaEvent = createBasicEvent(repository, gitReference, username, installationId, LambdaEvent.LambdaEventType.DELETE); lambdaEventDAO.create(lambdaEvent); return workflows; }

Target:
protected List<Workflow> githubWebhookDelete(String repository, String gitReference, String username, String installationId) { Optional<String> gitReferenceName = GitHelper.parseGitHubReference(gitReference); if (gitReferenceName.isEmpty()) { String msg = "Reference " + gitReference + " is not of the valid form"; LOG.error(msg); sessionFactory.getCurrentSession().clear(); LambdaEvent lambdaEvent = createBasicEvent(repository, gitReference, username, installationId, LambdaEvent.LambdaEventType.DELETE); lambdaEvent.setMessage(msg); lambdaEvent.setSuccess(false); lambdaEventDAO.create(lambdaEvent); sessionFactory.getCurrentSession().getTransaction().commit(); throw new CustomWebApplicationException(msg, LAMBDA_FAILURE); } List<Workflow> workflows = workflowDAO.findAllByPath("github.com/" + repository, false).stream().filter(workflow -> Objects.equals(workflow.getMode(), DOCKSTORE_YML)).collect( Collectors.toList()); workflows.forEach(workflow -> workflow.getWorkflowVersions().removeIf(workflowVersion -> Objects.equals(workflowVersion.getName(), gitReferenceName.get()) && !workflowVersion.isFrozen())); LambdaEvent lambdaEvent = createBasicEvent(repository, gitReference, username, installationId, LambdaEvent.LambdaEventType.DELETE); lambdaEventDAO.create(lambdaEvent); return workflows; }
Source:
public void testClear() { ServiceRegistration mockServiceRegistration1 = mock(ServiceRegistration.class); ServiceRegistration mockServiceRegistration2 = mock(ServiceRegistration.class); ServiceReference mockServiceReference1 = mock(ServiceReference.class); ServiceReference mockServiceReference2 = mock(ServiceReference.class); String featureA = "featureA"; String featureB = "featureB"; when(mockServiceRegistration1.getReference()).thenReturn(mockServiceReference1); when(mockServiceRegistration2.getReference()).thenReturn(mockServiceReference2); when(mockServiceReference1.getProperty(WfsMetacardTypeRegistryImpl.SOURCE_ID)) .thenReturn(TEST_SOURCE_ID); when(mockServiceReference2.getProperty(WfsMetacardTypeRegistryImpl.SOURCE_ID)) .thenReturn(TEST_SOURCE_ID_2); when(mockServiceReference1.getProperty(WfsMetacardTypeRegistryImpl.FEATURE_NAME)) .thenReturn("feature_a"); when(mockServiceReference2.getProperty(WfsMetacardTypeRegistryImpl.FEATURE_NAME)) .thenReturn("feature_b"); when(mockBundleContext.registerService( same(MetacardType.class), any(MetacardType.class), any(Dictionary.class))) .thenReturn(mockServiceRegistration1) .thenReturn(mockServiceRegistration2); wfsMetacardTypeRegistry = new WfsMetacardTypeRegistryImpl(mockBundleContext); wfsMetacardTypeRegistry.registerMetacardType(mockMetacardType, TEST_SOURCE_ID, featureA); wfsMetacardTypeRegistry.registerMetacardType(mockMetacardType, TEST_SOURCE_ID_2, featureB); wfsMetacardTypeRegistry.clear(TEST_SOURCE_ID); verify(mockBundleContext, times(2)) .registerService(same(MetacardType.class), same(mockMetacardType), any(Dictionary.class)); verify(mockServiceRegistration1, times(1)).unregister(); }

Target:
public void testClear() { ServiceRegistration mockServiceRegistration1 = mock(ServiceRegistration.class); ServiceRegistration mockServiceRegistration2 = mock(ServiceRegistration.class); ServiceReference mockServiceReference1 = mock(ServiceReference.class); ServiceReference mockServiceReference2 = mock(ServiceReference.class); String featureA = "featureA"; String featureB = "featureB"; when(mockServiceRegistration1.getReference()).thenReturn(mockServiceReference1); when(mockServiceRegistration2.getReference()).thenReturn(mockServiceReference2); when(mockServiceReference1.getProperty(WfsMetacardTypeRegistryImpl.SOURCE_ID)) .thenReturn(TEST_SOURCE_ID); when(mockServiceReference2.getProperty(WfsMetacardTypeRegistryImpl.SOURCE_ID)) .thenReturn(TEST_SOURCE_ID_2); when(mockBundleContext.registerService( same(MetacardType.class), any(MetacardType.class), any(Dictionary.class))) .thenReturn(mockServiceRegistration1) .thenReturn(mockServiceRegistration2); wfsMetacardTypeRegistry = new WfsMetacardTypeRegistryImpl(mockBundleContext); wfsMetacardTypeRegistry.registerMetacardType(mockMetacardType, TEST_SOURCE_ID, featureA); wfsMetacardTypeRegistry.registerMetacardType(mockMetacardType, TEST_SOURCE_ID_2, featureB); wfsMetacardTypeRegistry.clear(TEST_SOURCE_ID); verify(mockBundleContext, times(2)) .registerService(same(MetacardType.class), same(mockMetacardType), any(Dictionary.class)); verify(mockServiceRegistration1, times(1)).unregister(); }
Source:
public final void characters(final char[] ch, final int start, final int length) throws SAXException { final String text = StringUtils.trim(new String(ch, start, length)); if (isMessage == true) { content = StringUtils.join(content, text); return; } content = text; }

Target:
public final void characters(final char[] ch, final int start, final int length) throws SAXException { final String text = StringUtils.trim(new String(ch, start, length)); content = isMessage ? StringUtils.join(content, text) : text; }
Source:
public void reportError(String containerId, int[] operators, String msg, LogFileInformation logFileInfo) throws IOException { EventGroupId groupId = getGroupIdForNewDeployRequest(containerId); if (operators == null || operators.length == 0) { dagManager.recordEventAsync(new ContainerErrorEvent(containerId, msg, logFileInfo, groupId)); } else { for (int operator : operators) { OperatorInfo operatorInfo = dagManager.getOperatorInfo(operator); if (operatorInfo != null) { dagManager.recordEventAsync( new OperatorErrorEvent(operatorInfo.name, operator, containerId, msg, logFileInfo, groupId)); } } } log(containerId, msg); }

Target:
public void reportError(String containerId, int[] operators, String msg, LogFileInformation logFileInfo) throws IOException { EventGroupId groupId = getGroupIdForNewGroupingRequest(containerId); if (operators == null || operators.length == 0) { dagManager.recordEventAsync(new ContainerErrorEvent(containerId, msg, logFileInfo, groupId)); } else { for (int operator : operators) { OperatorInfo operatorInfo = dagManager.getOperatorInfo(operator); if (operatorInfo != null) { dagManager.recordEventAsync( new OperatorErrorEvent(operatorInfo.name, operator, containerId, msg, logFileInfo, groupId)); } } } log(containerId, msg); }
Source:
public void onComment(String content, TagStack stack) { boolean ignoreElements = stack.shouldIgnoreElements(); if(!ignoreElements) { if (content.startsWith("startwikilink:")) { handleLinkCommentStart(XMLUtils.unescapeXMLComment(content), stack); } else if (content.startsWith("stopwikilink")) { handleLinkCommentStop(stack); } else if (content.startsWith("startimage:")) { handleImageCommentStart(XMLUtils.unescapeXMLComment(content), stack); } else if (content.startsWith("stopimage")) { handleImageCommentStop(stack); } else (content.startsWith("startmacro")) { super.onComment(XMLUtils.unescapeXMLComment(content), stack); } } else { super.onComment(content, stack); } }

Target:
public void onComment(String content, TagStack stack) { boolean ignoreElements = stack.shouldIgnoreElements(); if (!ignoreElements && content.startsWith("startwikilink:")) { handleLinkCommentStart(XMLUtils.unescapeXMLComment(content), stack); } else if (!ignoreElements && content.startsWith("stopwikilink")) { handleLinkCommentStop(stack); } else if (!ignoreElements && content.startsWith("startimage:")) { handleImageCommentStart(XMLUtils.unescapeXMLComment(content), stack); } else if (!ignoreElements && content.startsWith("stopimage")) { handleImageCommentStop(stack); } else if (!ignoreElements && content.startsWith("startmacro")) { super.onComment(XMLUtils.unescapeXMLComment(content), stack); } else { super.onComment(content, stack); } }
Source:
public void method_with_unknown_symbol_should_not_produce_ucfg() { CompilationUnitTree cut = getCompilationUnitTreeWithSemantics("class A {void foo(UnkownType t) {return t;}}"); UCFGJavaVisitor UCFGJavaVisitor = new UCFGJavaVisitor(tmp.getRoot()) { @Override protected void serializeUCFG(MethodTree tree, CFG cfg) { fail("should not serialize a UCFG of a method with unknown parameters"); } }; UCFGJavaVisitor.fileKey = FILE_KEY; UCFGJavaVisitor.visitCompilationUnit(cut); cut = getCompilationUnitTreeWithSemantics("class A {UnkownType foo(String t) {return t;}}"); UCFGJavaVisitor.visitCompilationUnit(cut); }

Target:
public void method_with_unknown_symbol_should_not_produce_ucfg() { UCFGJavaVisitor UCFGJavaVisitor = new UCFGJavaVisitor(tmp.getRoot()) { @Override protected void serializeUCFG(MethodTree tree, CFG cfg) { fail("should not serialize a UCFG of a method with unknown parameters"); } }; UCFGJavaVisitor.fileKey = FILE_KEY; CompilationUnitTree cut = getCompilationUnitTreeWithSemantics("class A {void foo(UnkownType t) {return t;}}"); UCFGJavaVisitor.visitCompilationUnit(cut); cut = getCompilationUnitTreeWithSemantics("class A {UnkownType foo(String t) {return t;}}"); UCFGJavaVisitor.visitCompilationUnit(cut); }
Source:
private static Envelope getEnvelope(OGCGeometry ogcGeometry) { com.esri.core.geometry.Envelope env = new com.esri.core.geometry.Envelope(); ogcGeometry.getEsriGeometry().queryEnvelope(env); return new Envelope(env.getXMin(), env.getXMax(), env.getYMin(), env.getYMax()); }

Target:
private static Envelope getEnvelope(OGCGeometry ogcGeometry) { com.esri.core.geometry.Envelope envelope = new com.esri.core.geometry.Envelope(); ogcGeometry.getEsriGeometry().queryEnvelope(envelope); return new Envelope(envelope.getXMin(), envelope.getXMax(), envelope.getYMin(), envelope.getYMax()); }
Source:
public void test401ShouldRetry4Times() { HttpCommand command = createMock(HttpCommand.class); HttpRequest request = createMock(HttpRequest.class); HttpResponse response = createMock(HttpResponse.class); @SuppressWarnings("unchecked") LoadingCache<Credentials, Access> cache = createMock(LoadingCache.class); expect(command.getCurrentRequest()).andReturn(request).anyTimes(); expect(request.getHeaders()).andStubReturn(null); cache.invalidateAll(); expectLastCall().anyTimes(); expect(response.getPayload()).andReturn(Payloads.newStringPayload("")).anyTimes(); expect(response.getStatusCode()).andReturn(401).anyTimes(); replay(command); replay(request); replay(response); replay(cache); RetryOnRenew retry = new RetryOnRenew(cache); for(int n=0; n<4; n++) assertTrue(retry.shouldRetryRequest(command, response)); assertFalse(retry.shouldRetryRequest(command, response)); verify(command); verify(response); verify(cache); }

Target:
public void test401ShouldRetry4Times() { HttpCommand command = createMock(HttpCommand.class); HttpRequest request = createMock(HttpRequest.class); HttpResponse response = createMock(HttpResponse.class); @SuppressWarnings("unchecked") LoadingCache<Credentials, Access> cache = createMock(LoadingCache.class); expect(command.getCurrentRequest()).andReturn(request).anyTimes(); expect(request.getHeaders()).andStubReturn(null); cache.invalidateAll(); expectLastCall().anyTimes(); expect(response.getPayload()).andReturn(Payloads.newStringPayload("")).anyTimes(); expect(response.getStatusCode()).andReturn(401).anyTimes(); replay(command, request, response, cache); RetryOnRenew retry = new RetryOnRenew(cache); for(int n = 0; n < RetryOnRenew.AUTH_RETRIES; n++) assertTrue(retry.shouldRetryRequest(command, response), "Expected retry to succeed"); assertFalse(retry.shouldRetryRequest(command, response), "Expected retry to fail on attempt 5"); verify(command, response, cache); }
Source:
private VdcBllMessages networkInUseValidationMessage(int numberOfEntities) { boolean singular = numberOfEntities == 1; return singular ? VdcBllMessages.ACTION_TYPE_FAILED_NETWORK_IN_ONE_USE : VdcBllMessages.ACTION_TYPE_FAILED_NETWORK_IN_MANY_USES; }

Target:
private VdcBllMessages networkInUseValidationMessage(int numberOfEntities) { boolean singular = numberOfEntities == 1; if (singular) { return VdcBllMessages.ACTION_TYPE_FAILED_NETWORK_IN_ONE_USE; } else { return VdcBllMessages.ACTION_TYPE_FAILED_NETWORK_IN_MANY_USES; } }
Source:
private void save(String interpreterSettingName) throws IOException { InterpreterSetting interpreterSetting = interpreterSettingManager.getInterpreterSettingByName(interpreterSettingName); List<String> recoveryContent = new ArrayList<>(); for (ManagedInterpreterGroup interpreterGroup : interpreterSetting.getAllInterpreterGroups()) { RemoteInterpreterProcess interpreterProcess = interpreterGroup.getInterpreterProcess(); if (interpreterProcess != null) { recoveryContent.add(interpreterGroup.getId() + "\t" + interpreterProcess.getHost() + ":" + interpreterProcess.getPort()); } } LOGGER.debug("Updating recovery data for interpreterSetting: " + interpreterSettingName); LOGGER.debug("Recovery Data: " + StringUtils.join(recoveryContent, "\n")); Path recoveryFile = new Path(recoveryDir, interpreterSettingName + ".recovery"); fs.writeFile(StringUtils.join(recoveryContent, "\n"), recoveryFile, true); }

Target:
private void save(String interpreterSettingName) throws IOException { InterpreterSetting interpreterSetting = interpreterSettingManager.getInterpreterSettingByName(interpreterSettingName); List<String> recoveryContent = new ArrayList<>(); for (ManagedInterpreterGroup interpreterGroup : interpreterSetting.getAllInterpreterGroups()) { RemoteInterpreterProcess interpreterProcess = interpreterGroup.getInterpreterProcess(); if (interpreterProcess != null) { recoveryContent.add(interpreterGroup.getId() + "\t" + interpreterProcess.getHost() + ":" + interpreterProcess.getPort()); } } LOGGER.debug("Updating recovery data for interpreterSetting: " + interpreterSettingName); LOGGER.debug("Recovery Data: " + StringUtils.join(recoveryContent, System.lineSeparator())); Path recoveryFile = new Path(recoveryDir, interpreterSettingName + ".recovery"); fs.writeFile(StringUtils.join(recoveryContent, System.lineSeparator()), recoveryFile, true); }
Source:
private boolean resolveConflict(LedgerMetadata newMeta) { LedgerMetadata metadata = getLedgerMetadata(); testStubResolveConflict(); if (LOG.isDebugEnabled()) { LOG.debug("[EnsembleChange-L{}-{}] : resolving conflicts - local metadata = \n \n," + " zk metadata = \n \n", ledgerId, ensembleChangeIdx, metadata, newMeta); } if (metadata.getState() != newMeta.getState()) { if (LOG.isDebugEnabled()) { LOG.info("[EnsembleChange-L{}-{}] : resolving conflicts but state changed," + " local metadata = \n \n, zk metadata = \n \n", ledgerId, ensembleChangeIdx, metadata, newMeta); } return false; } int diff = newMeta.getEnsembles().size() - metadata.getEnsembles().size(); if (0 != diff) { if (LOG.isDebugEnabled()) { LOG.debug("[EnsembleChange-L{}-{}] : resolving conflicts but ensembles have differences," + " local metadata = \n \n, zk metadata = \n \n", ledgerId, ensembleChangeIdx, diff, metadata, newMeta); } if (-1 == diff) { return updateMetadataIfPossible(metadata, newMeta); } return false; } if (!areFailedBookiesReplaced(newMeta, ensembleInfo)) { return updateMetadataIfPossible(newMeta); } else { ensembleChangeCounter.inc(); int newBlockAddCompletions = blockAddCompletions.decrementAndGet(); unsetSuccessAndSendWriteRequest(ensembleInfo.replacedBookies); if (LOG.isDebugEnabled()) { LOG.info("[EnsembleChange-L{}-{}] : resolved conflicts, block add complectiosn => {}.", ledgerId, ensembleChangeIdx, curBlockAddCompletions, newBlockAddCompletions); } } return true; }

Target:
private boolean resolveConflict(LedgerMetadata newMeta) { LedgerMetadata metadata = getLedgerMetadata(); if (testStubResolveConflict()) { LOG.info("Invoked the Stub - Checkout the test case for the expected behavior"); } if (LOG.isDebugEnabled()) { LOG.debug("[EnsembleChange-L{}-{}] : resolving conflicts - local metadata = \n \n," + " zk metadata = \n \n", ledgerId, ensembleChangeIdx, metadata, newMeta); } if (metadata.getState() != newMeta.getState()) { if (LOG.isDebugEnabled()) { LOG.info("[EnsembleChange-L{}-{}] : resolving conflicts but state changed," + " local metadata = \n \n, zk metadata = \n \n", ledgerId, ensembleChangeIdx, metadata, newMeta); } return false; } int diff = newMeta.getEnsembles().size() - metadata.getEnsembles().size(); if (0 != diff) { if (LOG.isDebugEnabled()) { LOG.debug("[EnsembleChange-L{}-{}] : resolving conflicts but ensembles have differences," + " local metadata = \n \n, zk metadata = \n \n", ledgerId, ensembleChangeIdx, diff, metadata, newMeta); } if (-1 == diff) { return updateMetadataIfPossible(metadata, newMeta); } return false; } if (!areFailedBookiesReplaced(newMeta, ensembleInfo)) { return updateMetadataIfPossible(metadata, newMeta); } else { ensembleChangeCounter.inc(); int newBlockAddCompletions = blockAddCompletions.decrementAndGet(); unsetSuccessAndSendWriteRequest(ensembleInfo.replacedBookies); if (LOG.isDebugEnabled()) { LOG.info("[EnsembleChange-L{}-{}] : resolved conflicts, block add complectiosn => {}.", ledgerId, ensembleChangeIdx, curBlockAddCompletions, newBlockAddCompletions); } } return true; }
Source:
public void notifyHasMessage(final Mailbox mailbox, final MessageSelector kind) { if (kind instanceof DifferentialTimestamp) { final DifferentialTimestamp timestamp = (DifferentialTimestamp) kind; if (Options.MONITOR_VIOLATION_OF_DIFFERENTIAL_DATAFLOW_TIMESTAMPS && this.currentlyDeliveredTimestamp != null) { final DifferentialTimestamp first = (DifferentialTimestamp) this.currentlyDeliveredTimestamp; if (timestamp.compareTo(first) < 0) { final Logger logger = this.representative.getContainer().getNetwork().getEngine().getLogger(); logger.error( "[INTERNAL ERROR] Violation of differential dataflow communication schema! The communication component with representative " + this.representative + " observed decreasing timestamp during message delivery!"); } } Set<Mailbox> mailboxes = this.mailboxQueue.get(timestamp); if (mailboxes == null) { mailboxes = new TreeSet<Mailbox>(new Comparator<Mailbox>() { @Override public int compare(final Mailbox left, final Mailbox right) { return left.getReceiver().toString().compareTo(right.getReceiver().toString()); }; }); this.mailboxQueue.put(timestamp, mailboxes); } mailboxes.add(mailbox); if (!this.isEnqueued && !this.currentlyDelivering) { this.tracker.activateUnenqueued(this); } } else { throw new IllegalArgumentException(UNSUPPORTED_MESSAGE_KIND + kind); } }

Target:
public void notifyHasMessage(final Mailbox mailbox, final MessageSelector kind) { if (kind instanceof DifferentialTimestamp) { final DifferentialTimestamp timestamp = (DifferentialTimestamp) kind; if (Options.MONITOR_VIOLATION_OF_DIFFERENTIAL_DATAFLOW_TIMESTAMPS && this.currentlyDeliveredTimestamp != null) { final DifferentialTimestamp first = (DifferentialTimestamp) this.currentlyDeliveredTimestamp; if (timestamp.compareTo(first) < 0) { final Logger logger = this.representative.getContainer().getNetwork().getEngine().getLogger(); logger.error( "[INTERNAL ERROR] Violation of differential dataflow communication schema! The communication component with representative " + this.representative + " observed decreasing timestamp during message delivery!"); } } Set<Mailbox> mailboxes = this.mailboxQueue.get(timestamp); if (mailboxes == null) { mailboxes = new HashSet<Mailbox>(); this.mailboxQueue.put(timestamp, mailboxes); } mailboxes.add(mailbox); if (!this.isEnqueued && !this.currentlyDelivering) { this.tracker.activateUnenqueued(this); } } else { throw new IllegalArgumentException(UNSUPPORTED_MESSAGE_KIND + kind); } }
Source:
public void factoryWithDirectUrlWithSpecificBranch() { String repositoryName = testAuxiliaryRepo.getName(); final String wsTheiaIdeTerminalTitle = "theia-ide terminal 0"; List<String> expectedItemsAfterCloning = Arrays.asList("my-lib", "my-webapp", "my-lib/src", "pom.xml"); testFactoryWithSpecificBranch.authenticateAndOpen(); theiaIde.switchToIdeFrame(); theiaIde.waitTheiaIde(); theiaIde.waitLoaderInvisibility(); theiaIde.waitNotificationDisappearance("Che Workspace: Finished cloning projects."); theiaIde.waitNotificationDisappearance( "Che Workspace: Finished cloning projects.", UPDATING_PROJECT_TIMEOUT_SEC); theiaProjectTree.waitFilesTab(); theiaProjectTree.clickOnFilesTab(); theiaProjectTree.waitItem(repositoryName); theiaProjectTree.expandItem(repositoryName); theiaProjectTree.expandItem(repositoryName + "/my-lib"); theiaProjectTree.waitItem(repositoryName + "/my-lib/src"); expectedItemsAfterCloning.forEach( name -> { theiaProjectTree.waitItem(repositoryName + "/" + name); }); assertEquals(theiaIde.getBranchName(), SECOND_BRANCH_NAME); }

Target:
public void factoryWithDirectUrlWithSpecificBranch() { String repositoryName = testAuxiliaryRepo.getName(); final String wsTheiaIdeTerminalTitle = "theia-ide terminal 0"; List<String> expectedItemsAfterCloning = Arrays.asList("my-lib", "my-webapp", "my-lib/src", "pom.xml"); testFactoryWithSpecificBranch.authenticateAndOpen(); theiaIde.switchToIdeFrame(); theiaIde.waitTheiaIde(); theiaIde.waitLoaderInvisibility(); theiaIde.waitNotificationDisappearance( "Che Workspace: Finished cloning projects.", UPDATING_PROJECT_TIMEOUT_SEC); theiaProjectTree.waitFilesTab(); theiaProjectTree.clickOnFilesTab(); theiaProjectTree.waitItem(repositoryName); theiaProjectTree.expandItem(repositoryName); theiaProjectTree.expandItem(repositoryName + "/my-lib"); theiaProjectTree.waitItem(repositoryName + "/my-lib/src"); expectedItemsAfterCloning.forEach( name -> { theiaProjectTree.waitItem(repositoryName + "/" + name); }); assertEquals(theiaIde.getBranchName(), SECOND_BRANCH_NAME); }
Source:
String getSQLCommand() { if (command == null) { try (Connection connection = dataSource.getConnection()) { final DatabaseMetaData metaData = connection.getMetaData(); TableLocation functionLocation = TableLocation.parse(functionName); ResultSet functionData = metaData.getProcedureColumns( functionLocation.getCatalog(), functionLocation.getSchema(), functionLocation.getTable(), null); try { StringBuilder sb = new StringBuilder(); Map<Integer, Signature> signatureMap; if (JDBCUtilities.isH2DataBase(metaData)) { signatureMap = getH2SignatureMap(functionData); } else { signatureMap = getPostGRESignatureMap(functionData); } buildString(sb, signatureMap); command = sb.toString(); } finally { functionData.close(); } } catch (SQLException ex) { LOGGER.warn("Could not read function command"); } } return command; }

Target:
String getSQLCommand() { if (command == null) { try (Connection connection = dataSource.getConnection()) { final DatabaseMetaData metaData = connection.getMetaData(); ResultSet functionData = getFunctionData(metaData); try { StringBuilder sb = new StringBuilder(); Map<Integer, Signature> signatureMap; if (JDBCUtilities.isH2DataBase(metaData)) { signatureMap = getH2SignatureMap(functionData); } else { signatureMap = getPostGRESignatureMap(functionData); } buildString(sb, signatureMap); command = sb.toString(); } finally { functionData.close(); } } catch (SQLException ex) { LOGGER.warn("Could not read function command"); } } return command; }
Source:
public ValueMatcher makeValueMatcher(String dimension, final DruidPredicateFactory predicateFactory) { if (dimension.equals(Column.TIME_COLUMN_NAME) || availableMetrics.contains(dimension)) { if (getTypeForDimension(dimension) == ValueType.LONG) { return makeLongValueMatcher(dimension, predicateFactory.makeLongPredicate()); } } final DimensionQueryHelper queryHelper = DimensionHandlerUtils.makeBaseQueryHelper( dimension, cursor.getColumnCapabilities(dimension), Lists.<String>newArrayList(storageAdapter.getAvailableDimensions()) ); return queryHelper.getValueMatcher(cursor, predicateFactory); }

Target:
public ValueMatcher makeValueMatcher(String dimension, final DruidPredicateFactory predicateFactory) { if (dimension.equals(Column.TIME_COLUMN_NAME) || availableMetrics.contains(dimension)) { if (getTypeForDimension(dimension) == ValueType.LONG) { return makeLongValueMatcher(dimension, predicateFactory.makeLongPredicate()); } } ColumnSelectorPlus<ValueMatcherColumnSelectorStrategy>[] selector = DimensionHandlerUtils.createColumnSelectorPluses( STRATEGY_FACTORY, ImmutableList.<DimensionSpec>of(DefaultDimensionSpec.of(dimension)), cursor ); final ValueMatcherColumnSelectorStrategy strategy = selector[0].getColumnSelectorStrategy(); return strategy.getValueMatcher(dimension, cursor, predicateFactory); }
Source:
protected Object extractBlobContent(DocumentModel doc, TemplateInput param) throws ValueNotFound { Object propValue = getDocPropertyValue(doc, param.getSource()); if (propValue != null && propValue instanceof Blob) { Blob blobValue = (Blob) propValue; handleBlobField(param.getName(), blobValue); try { return blobValue.getString(); } catch (IOException e) { log.warn("Unable to handle binding for param " + param.getName(), e); return ""; } } return extractDefaultValue(doc, param); }

Target:
protected Object extractBlobContent(DocumentModel doc, TemplateInput param) throws ValueNotFound { Object propValue = getDocPropertyValue(doc, param.getSource()); if (propValue instanceof Blob) { Blob blobValue = (Blob) propValue; handleBlobField(param.getName(), blobValue); try { return blobValue.getString(); } catch (IOException e) { log.warn("Unable to handle binding for param " + param.getName(), e); return ""; } } return extractDefaultValue(doc, param); }
Source:
public void performAction(HttpMessage httpMessage) { File file = getOutputFile(); if (file == null) { return; } byte[] bytes = new byte[0]; byte[] bytesHeader = null; byte[] bytesBody = null; switch (messageComponent) { case REQUEST_HEADER: bytes = httpMessage.getRequestHeader().toString().getBytes(); break; case REQUEST_BODY: bytes = httpMessage.getRequestBody().getBytes(); break; case REQUEST: bytesHeader = httpMessage.getRequestHeader().toString().getBytes(); bytesBody = httpMessage.getRequestBody().getBytes(); bytes = new byte[bytesHeader.length + bytesBody.length]; System.arraycopy(bytesHeader, 0, bytes, 0, bytesHeader.length); System.arraycopy(bytesBody, 0, bytes, bytesHeader.length, bytesBody.length); break; case RESPONSE_HEADER: bytes = httpMessage.getResponseHeader().toString().getBytes(); break; case RESPONSE_BODY: bytes = httpMessage.getResponseBody().getBytes(); break; case RESPONSE: bytesHeader = httpMessage.getResponseHeader().toString().getBytes(); bytesBody = httpMessage.getResponseBody().getBytes(); bytes = new byte[bytesHeader.length + bytesBody.length]; System.arraycopy(bytesHeader, 0, bytes, 0, bytesHeader.length); System.arraycopy(bytesBody, 0, bytes, bytesHeader.length, bytesBody.length); break; } writeToFile(file, bytesHeader, bytesBody); }

Target:
public void performAction(HttpMessage httpMessage) { File file = getOutputFile(); if (file == null) { return; } byte[] bytesHeader = null; byte[] bytesBody = null; switch (messageComponent) { case REQUEST_HEADER: bytesHeader = httpMessage.getRequestHeader().toString().getBytes(); break; case REQUEST_BODY: bytesBody = httpMessage.getRequestBody().getBytes(); break; case REQUEST: bytesHeader = httpMessage.getRequestHeader().toString().getBytes(); bytesBody = httpMessage.getRequestBody().getBytes(); break; case RESPONSE_HEADER: bytesHeader = httpMessage.getResponseHeader().toString().getBytes(); break; case RESPONSE_BODY: bytesBody = httpMessage.getResponseBody().getBytes(); break; case RESPONSE: bytesHeader = httpMessage.getResponseHeader().toString().getBytes(); bytesBody = httpMessage.getResponseBody().getBytes(); break; } writeToFile(file, bytesHeader, bytesBody); }
Source:
private DataStore pickDataStoreFromVolumes(List<VolumeVO> volumes) { DataStore dataStore = null; for (Volume vol : volumes) { switch (vol.getState()) { case Migrating: case Expunging: case Expunged: case Destroy: case Destroying: case UploadOp: case Uploaded: case NotUploaded: case UploadInProgress: case UploadError: case UploadAbandoned: default: break; case Allocated: case Creating: case Ready: case Snapshotting: case RevertSnapshotting: case Resizing: case Copying: case Attaching: dataStore = _dataStoreMgr.getDataStore(vol.getPoolId(), DataStoreRole.Primary); if (dataStore != null) { return dataStore; } break; } } return dataStore; }

Target:
private DataStore pickDataStoreFromVolumes(List<VolumeVO> volumes) { DataStore dataStore = null; for (Volume vol : volumes) { if (doesVolumeStateCheckout(vol)) { dataStore = _dataStoreMgr.getDataStore(vol.getPoolId(), DataStoreRole.Primary); if (dataStore != null) { return dataStore; } } } return dataStore; }
Source:
protected HttpRequestBase createHttpRequestBase() { String bugUrl = getUrlSuffix(); LoginToken token = ((BugzillaRestHttpClient) getClient()).getLoginToken(); HttpPost request = new HttpPost(baseUrl() + bugUrl); request.setHeader(CONTENT_TYPE, APPLICATION_JSON); request.setHeader(ACCEPT, APPLICATION_JSON); try { String gsonString = "{\"Bugzilla_token\":\"" + token.getToken() + "\"" + getGSonFieldsForNew(taskData) + "}"; StringEntity requestEntity = new StringEntity(gsonString); request.setEntity(requestEntity); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } return request; }

Target:
protected HttpRequestBase createHttpRequestBase() throws IOException { String bugUrl = getUrlSuffix(); LoginToken token = ((BugzillaRestHttpClient) getClient()).getLoginToken(); HttpPost request = new HttpPost(baseUrl() + bugUrl); request.setHeader(CONTENT_TYPE, APPLICATION_JSON); request.setHeader(ACCEPT, APPLICATION_JSON); try { Gson gson = new GsonBuilder().registerTypeAdapter(TaskData.class, new TaskAttributeTypeAdapter(token)) .create(); StringEntity requestEntity = new StringEntity(gson.toJson(taskData)); request.setEntity(requestEntity); } catch (UnsupportedEncodingException e) { throw new IOException("could not build REST String", e); } return request; }
Source:
public ControlEditor (Composite parent) { this.parent = parent; controlListener = e -> layout (); for (int element : EVENTS) { parent.addListener (element, controlListener); } scrollbarListener = e -> scroll (e); ScrollBar hBar = parent.getHorizontalBar (); if (hBar != null) hBar.addListener (SWT.Selection, scrollbarListener); ScrollBar vBar = parent.getVerticalBar (); if (vBar != null) vBar.addListener (SWT.Selection, scrollbarListener); }

Target:
public ControlEditor (Composite parent) { this.parent = parent; controlListener = e -> layout (); for (int event : EVENTS) { parent.addListener (event, controlListener); } scrollbarListener = e -> scroll (e); ScrollBar hBar = parent.getHorizontalBar (); if (hBar != null) hBar.addListener (SWT.Selection, scrollbarListener); ScrollBar vBar = parent.getVerticalBar (); if (vBar != null) vBar.addListener (SWT.Selection, scrollbarListener); }
Source:
protected void amendDiskImage() { VdcReturnValueBase ret = runInternalAction(VdcActionType.AmendImageGroupVolumes, amendImageGroupVolumesCommandParameters()); if (!ret.getSucceeded()) { propagateInternalCommandFailure(ret); getReturnValue().setFault(ret.getFault()); } setSucceeded(ret.getSucceeded()); }

Target:
protected void amendDiskImage() { VdcReturnValueBase ret = runInternalActionWithTasksContext(VdcActionType.AmendImageGroupVolumes, amendImageGroupVolumesCommandParameters()); if (!ret.getSucceeded()) { propagateInternalCommandFailure(ret); getReturnValue().setFault(ret.getFault()); } setSucceeded(ret.getSucceeded()); }
Source:
private void removeNetworks() { final List<Network> networks = getNetworkDAO().getAllForDataCenter(getStoragePoolId()); for (Network network : networks) { if (network.isExternal()) { for (VmNic nic : getVmNicDao().getAllForNetwork(network.getId())) { ExternalNetworkManager externalNetworkManager = new ExternalNetworkManager(nic, network); externalNetworkManager.deallocateIfExternal(); } } } TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { for (final Network net : networks) { List<VnicProfile> profiles = getDbFacade().getVnicProfileDao().getAllForNetwork(net.getId()); for (VnicProfile vnicProfile : profiles) { getCompensationContext().snapshotEntity(vnicProfile); getDbFacade().getVnicProfileDao().remove(vnicProfile.getId()); } getCompensationContext().snapshotEntity(net); getNetworkDAO().remove(net.getId()); } getCompensationContext().stateChanged(); return null; } }); }

Target:
private void removeNetworks() { final List<Network> networks = getNetworkDAO().getAllForDataCenter(getStoragePoolId()); for (Network network : networks) { if (network.isExternal()) { for (VmNic nic : getVmNicDao().getAllForNetwork(network.getId())) { new ExternalNetworkManager(nic, network).deallocateIfExternal(); } } } TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { for (final Network net : networks) { List<VnicProfile> profiles = getDbFacade().getVnicProfileDao().getAllForNetwork(net.getId()); for (VnicProfile vnicProfile : profiles) { getCompensationContext().snapshotEntity(vnicProfile); getDbFacade().getVnicProfileDao().remove(vnicProfile.getId()); } getCompensationContext().snapshotEntity(net); getNetworkDAO().remove(net.getId()); } getCompensationContext().stateChanged(); return null; } }); }
Source:
public ExtensionEntity getExtensionByUrn(String urn, boolean caseInsensitive) { CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery<ExtensionEntity> cq = cb.createQuery(ExtensionEntity.class); Root<ExtensionEntity> extension = cq.from(ExtensionEntity.class); Predicate predicate; if (caseInsensitive) { predicate = cb.equal(cb.lower(extension.get(ExtensionEntity_.urn)), urn.toLowerCase(Locale.ENGLISH)); } else { predicate = cb.equal(extension.get(ExtensionEntity_.urn), urn); } cq.select(extension).where(predicate); TypedQuery<ExtensionEntity> query = em.createQuery(cq); ExtensionEntity singleExtension; try { singleExtension = query.getSingleResult(); } catch (NoResultException e) { String message = String.format("Extension with urn %s not found", urn); LOGGER.warn(message); throw new NoSuchElementException(message); } return singleExtension; }

Target:
public ExtensionEntity getExtensionByUrn(String urn, boolean caseInsensitive) { CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery<ExtensionEntity> cq = cb.createQuery(ExtensionEntity.class); Root<ExtensionEntity> extension = cq.from(ExtensionEntity.class); Predicate predicate; if (caseInsensitive) { predicate = cb.equal(cb.lower(extension.get(ExtensionEntity_.urn)), urn.toLowerCase(Locale.ENGLISH)); } else { predicate = cb.equal(extension.get(ExtensionEntity_.urn), urn); } cq.select(extension).where(predicate); TypedQuery<ExtensionEntity> query = em.createQuery(cq); ExtensionEntity singleExtension; try { singleExtension = query.getSingleResult(); } catch (NoResultException e) { String message = String.format("Extension with urn '%s' not found", urn); LOGGER.warn(message); throw new NoSuchElementException(message); } return singleExtension; }
Source:
public void addNode(RepositoryTreeNode<?> treeNode, Object timeCarrier) { if (isFiltering()) { if (maxCount > 0) { int time = Integer.MIN_VALUE; if (timeCarrier instanceof RevCommit) { time = ((RevCommit) timeCarrier).getCommitTime(); } if (time >= thresholdTime) { TimedNode node = new TimedNode(treeNode, time); nodes.add(node); while (nodes.size() > maxCount) { nodes.poll(); } if (nodes.size() == maxCount) { thresholdTime = nodes.peek().time; } } } } else { allNodes.add(treeNode); } }

Target:
public void addNode(RepositoryTreeNode<?> treeNode, Object timeCarrier) { if (isFiltering()) { if (maxCount > 0) { int time = Integer.MIN_VALUE; if (timeCarrier instanceof RevCommit) { time = ((RevCommit) timeCarrier).getCommitTime(); } if (time >= thresholdTime) { TimedNode node = new TimedNode(treeNode, time); nodes.add(node); if (nodes.size() > maxCount) { nodes.poll(); thresholdTime = nodes.peek().time; } } } } else { allNodes.add(treeNode); } }
Source:
private void calculateData() { initCalculations(); calculateBacklogCount(); calculateActionsCreated(); featureSums.clear(); ResultSet<ArtifactReadable> actions = sprint.getRelated(AtsRelationTypes.AgileSprintToItem_AtsItem); for (ArtifactReadable item : actions) { if (includeInCount(item)) { ++numActionsCompleted; int points = Integer.parseInt(item.getSoleAttributeValue(AtsAttributeTypes.Points)); if (item.getSoleAttributeValue(AtsAttributeTypes.UnplannedWork, false)) { walkupCompleted += points; } else { workCompleted += points; } updateFeatureGroupSum(item, featureSums, points); } } }

Target:
private void calculateData() { initCalculations(); calculateBacklogCount(); calculateActionsCreated(); featureSums.clear(); ResultSet<ArtifactReadable> actions = sprint.getRelated(AtsRelationTypes.AgileSprintToItem_AtsItem); for (ArtifactReadable item : actions) { if (includeInCount(item)) { ++numActionsCompleted; double points = getPointsFromAction(item); if (item.getSoleAttributeValue(AtsAttributeTypes.UnplannedWork, false)) { walkupCompleted += points; } else { workCompleted += points; } updateFeatureGroupSum(item, featureSums, points); } } }
Source:
public void reset(ByteBuffer input) { this.input = input; isRead = false; }

Target:
public ByteBuffer reset(ByteBuffer input) { ByteBuffer old = this.input; this.input = input; isRead = false; return old; }
Source:
public AmazonS3 awsS3Client(AWSCredentialsProvider awsCredentialsProvider, S3Properties s3Properties) { ClientConfiguration clientConfiguration = new ClientConfiguration(); if (s3Properties.getProxyProtocol() != null) { if (s3Properties.getProxyProtocol().equalsIgnoreCase("HTTPS")) { clientConfiguration.setProtocol(Protocol.HTTPS); } else { clientConfiguration.setProtocol(Protocol.HTTP); } Optional.ofNullable(s3Properties.getProxyHost()) .ifPresent(clientConfiguration::setProxyHost); Optional.ofNullable(s3Properties.getProxyPort()) .map(Integer::parseInt) .ifPresent(clientConfiguration::setProxyPort); } AmazonS3Client client = new AmazonS3Client(awsCredentialsProvider, clientConfiguration); if (s3Properties.getEndpoint() != null && !s3Properties.getEndpoint().equals("")) { client.setEndpoint(s3Properties.getEndpoint()); client.setS3ClientOptions(S3ClientOptions.builder().setPathStyleAccess(true).build()); } else { Optional.ofNullable(s3Properties.getRegion()) .map(Regions::fromName) .map(Region::getRegion) .ifPresent(client::setRegion); } return client; }

Target:
public AmazonS3 awsS3Client(AWSCredentialsProvider awsCredentialsProvider, S3Properties s3Properties) { ClientConfiguration clientConfiguration = new ClientConfiguration(); if (s3Properties.getProxyProtocol() != null) { if (s3Properties.getProxyProtocol().equalsIgnoreCase("HTTPS")) { clientConfiguration.setProtocol(Protocol.HTTPS); } else { clientConfiguration.setProtocol(Protocol.HTTP); } Optional.ofNullable(s3Properties.getProxyHost()) .ifPresent(clientConfiguration::setProxyHost); Optional.ofNullable(s3Properties.getProxyPort()) .map(Integer::parseInt) .ifPresent(clientConfiguration::setProxyPort); } AmazonS3Client client = new AmazonS3Client(awsCredentialsProvider, clientConfiguration); if (!StringUtils.isEmpty(s3Properties.getEndpoint())) { client.setEndpoint(s3Properties.getEndpoint()); client.setS3ClientOptions(S3ClientOptions.builder().setPathStyleAccess(true).build()); } else { Optional.ofNullable(s3Properties.getRegion()) .map(Regions::fromName) .map(Region::getRegion) .ifPresent(client::setRegion); } return client; }
Source:
public List<ObjectIdentity> findChildren(ObjectIdentity parentIdentity) { Object[] args = { "" + parentIdentity.getIdentifier(), parentIdentity.getType() }; List<ObjectIdentity> objects = jdbcTemplate.query(findChildrenSql, args, new RowMapper<ObjectIdentity>() { public ObjectIdentity mapRow(ResultSet rs, int rowNum) throws SQLException { String javaType = rs.getString("class"); Serializable identifier = (Serializable) rs.getObject("obj_id"); identifier = aclClassIdUtils.identifierFrom(identifier, rs); return new ObjectIdentityImpl(javaType, identifier); } }); if (objects.size() == 0) { return null; } return objects; }

Target:
public List<ObjectIdentity> findChildren(ObjectIdentity parentIdentity) { Object[] args = { parentIdentity.getIdentifier().toString(), parentIdentity.getType() }; List<ObjectIdentity> objects = jdbcOperations.query(findChildrenSql, args, new RowMapper<ObjectIdentity>() { public ObjectIdentity mapRow(ResultSet rs, int rowNum) throws SQLException { String javaType = rs.getString("class"); Serializable identifier = (Serializable) rs.getObject("obj_id"); identifier = aclClassIdUtils.identifierFrom(identifier, rs); return new ObjectIdentityImpl(javaType, identifier); } }); if (objects.size() == 0) { return null; } return objects; }