auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void sendEvents() throws MalformedURLException { URL url = new URL(cleanupUrl(managementCenterUrl) + "events.do"); OutputStream outputStream = null; OutputStreamWriter writer = null; try { HttpURLConnection connection = openJsonConnection(url); outputStream = connection.getOutputStream(); writer = new OutputStreamWriter(outputStream, "UTF-8"); ArrayList<Event> eventList = new ArrayList<Event>(); events.drainTo(eventList); String groupName = instance.getConfig().getGroupConfig().getName(); String address = instance.node.address.getHost() + ":" + instance.node.address.getPort(); JsonObject batch = !eventList.isEmpty() ? new EventBatch(groupName, address, eventList).toJson() : null; if (batch != null) { batch.writeTo(writer); writer.flush(); outputStream.flush(); boolean success = post(connection); if (eventSendFailed && success) { logger.info("Sent events to Management Center successfully."); eventSendFailed = false; } } } catch (Exception e) { if (!eventSendFailed) { eventSendFailed = true; log("Failed to send events to Management Center.", e); } } finally { closeResource(writer); closeResource(outputStream); } }

Target:
private void sendEvents() throws MalformedURLException { ArrayList<Event> eventList = new ArrayList<Event>(); if (events.drainTo(eventList) == 0) { return; } URL url = new URL(cleanupUrl(managementCenterUrl) + "events.do"); OutputStream outputStream = null; OutputStreamWriter writer = null; try { String groupName = instance.getConfig().getGroupConfig().getName(); String address = instance.node.address.getHost() + ":" + instance.node.address.getPort(); JsonObject batch = new EventBatch(groupName, address, eventList).toJson(); HttpURLConnection connection = openJsonConnection(url); outputStream = connection.getOutputStream(); writer = new OutputStreamWriter(outputStream, "UTF-8"); batch.writeTo(writer); writer.flush(); outputStream.flush(); boolean success = post(connection); if (eventSendFailed && success) { logger.info("Sent events to Management Center successfully."); eventSendFailed = false; } } catch (Exception e) { if (!eventSendFailed) { eventSendFailed = true; log("Failed to send events to Management Center.", e); } } finally { closeResource(writer); closeResource(outputStream); } }
Source:
public boolean hasNextFor(int consumer) { if (consumer >= numProducers) throw new ND4JIllegalStateException("Non-existent consumer was requested"); return asyncIterators.get(consumer).hasNext(); }

Target:
public boolean hasNextFor(int consumer) { if (consumer >= numProducers || consumer < 0) throw new ND4JIllegalStateException("Non-existent consumer was requested"); return asyncIterators.get(consumer).hasNext(); }
Source:
private RegistryAuth parseDockerConfig(final Path configPath, final String serverAddress) throws IOException { checkNotNull(configPath); final Map<String, RegistryAuth> configs = parseDockerConfig(configPath).configs(); if (isNullOrEmpty(serverAddress)) { if (configs.isEmpty()) { return RegistryAuth.builder().build(); } LOG.warn("Returning first entry from docker config file - use fromConfig(Path) instead, " + "this behavior is deprecated and will soon be removed"); return configs.values().iterator().next(); } if (configs.containsKey(serverAddress)) { return configs.get(serverAddress); } try { final URI serverAddressUri = new URI(serverAddress); if (serverAddressUri.getScheme() == null) { final String addrWithProto = "https://" + serverAddress; if (configs.containsKey(addrWithProto)) { return configs.get(addrWithProto); } } } catch (URISyntaxException e) { } throw new IllegalArgumentException( "serverAddress=" + serverAddress + " does not appear in config file at " + configPath); }

Target:
private RegistryAuth parseDockerConfig(final Path configPath, final String serverAddress) throws IOException { checkNotNull(configPath); final Map<String, RegistryAuth> configs = parseDockerConfig(configPath).configs(); if (isNullOrEmpty(serverAddress)) { if (configs.isEmpty()) { return RegistryAuth.builder().build(); } LOG.warn("Returning first entry from docker config file - use fromConfig(Path) instead, " + "this behavior is deprecated and will soon be removed"); return configs.values().iterator().next(); } if (configs.containsKey(serverAddress)) { return configs.get(serverAddress); } try { final URI serverAddressUri = new URI(serverAddress); if (serverAddressUri.getScheme() == null) { for (String proto : Arrays.asList("https://", "http://")) { final String addrWithProto = proto + serverAddress; if (configs.containsKey(addrWithProto)) { return configs.get(addrWithProto); } } } } catch (URISyntaxException e) { } throw new IllegalArgumentException( "serverAddress=" + serverAddress + " does not appear in config file at " + configPath); }
Source:
public ExecuteCliParsersJob(CliCommandLine commandLine) { super("Executing CLI parser"); setSystem(true); fCommandLine = commandLine; }

Target:
public ExecuteCliParsersJob(CliCommandLine commandLine) { super("Executing CLI parser"); fCommandLine = commandLine; }
Source:
private boolean iterateOverQuark(ITmfStateSystem stateSystem, int quark, String[] subAttributePath, IProgressMonitor monitor) { try { long curTime = stateSystem.getStartTime(); long limit = stateSystem.getCurrentEndTime(); while (curTime < limit) { if (monitor.isCanceled()) { return false; } int callStackQuark = stateSystem.getQuarkRelative(quark, subAttributePath); fCurrentQuarks = stateSystem.getSubAttributes(callStackQuark, false); if (fCurrentQuarks.isEmpty()) { return false; } final int depth = 0; int quarkParent = fCurrentQuarks.get(depth); ITmfStateInterval interval = stateSystem.querySingleState(curTime, quarkParent); ITmfStateValue stateValue = interval.getStateValue(); if (!stateValue.isNull()) { long intervalStart = interval.getStartTime(); long intervalEnd = interval.getEndTime(); switch (stateValue.getType()) { case LONG: fSymbol = stateValue.unboxLong(); break; case STRING: fSymbol = stateValue.unboxStr(); break; case INTEGER: fSymbol = stateValue.unboxInt(); break; case DOUBLE: case NULL: case CUSTOM: default: break; } CalledFunction segment = new CalledFunction(intervalStart, intervalEnd + 1, fSymbol, depth); fRootFunctions.add(segment); if (!findChildren(segment, depth, stateSystem, fCurrentQuarks.size() + fCurrentQuarks.get(depth), monitor)) { return false; } } curTime = interval.getEndTime() + 1; } } catch (AttributeNotFoundException | StateSystemDisposedException | TimeRangeException e) { Activator.getInstance().logError(Messages.QueringStateSystemError, e); return false; } return true; }

Target:
private boolean iterateOverQuark(ITmfStateSystem stateSystem, int quark, String[] subAttributePath, IProgressMonitor monitor) { try { long curTime = stateSystem.getStartTime(); long limit = stateSystem.getCurrentEndTime(); while (curTime < limit) { if (monitor.isCanceled()) { return false; } int callStackQuark = stateSystem.getQuarkRelative(quark, subAttributePath); fCurrentQuarks = stateSystem.getSubAttributes(callStackQuark, false); if (fCurrentQuarks.isEmpty()) { return false; } final int depth = 0; int quarkParent = fCurrentQuarks.get(depth); ITmfStateInterval interval = stateSystem.querySingleState(curTime, quarkParent); ITmfStateValue stateValue = interval.getStateValue(); if (!stateValue.isNull()) { long intervalStart = interval.getStartTime(); long intervalEnd = interval.getEndTime(); CalledFunction segment = new CalledFunction(intervalStart, intervalEnd + 1, stateValue, depth); fRootFunctions.add(segment); if (!findChildren(segment, depth, stateSystem, fCurrentQuarks.size() + fCurrentQuarks.get(depth), monitor)) { return false; } } curTime = interval.getEndTime() + 1; } } catch (AttributeNotFoundException | StateSystemDisposedException | TimeRangeException e) { Activator.getInstance().logError(Messages.QueringStateSystemError, e); return false; } return true; }
Source:
public void queryIntentActivities_DisabledComponentImplicitIntent() throws Exception { Uri uri = Uri.parse("content://testhost1.com:1/testPath/test.jpeg"); Intent i = new Intent(Intent.ACTION_VIEW); i.addCategory(Intent.CATEGORY_DEFAULT); i.setDataAndType(uri, "image/jpeg"); ComponentName componentToDisable = new ComponentName(RuntimeEnvironment.application, "org.robolectric.shadows.TestActivity"); packageManager.setComponentEnabledSetting(componentToDisable, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP); List<ResolveInfo> resolveInfos = packageManager.queryIntentActivities(i, 0); assertThat(resolveInfos).isNotNull(); assertThat(resolveInfos).hasSize(0); }

Target:
public void queryIntentActivities_DisabledComponentImplicitIntent() throws Exception { Uri uri = Uri.parse("content://testhost1.com:1/testPath/test.jpeg"); Intent i = new Intent(Intent.ACTION_VIEW); i.addCategory(Intent.CATEGORY_DEFAULT); i.setDataAndType(uri, "image/jpeg"); ComponentName componentToDisable = new ComponentName(RuntimeEnvironment.application, "org.robolectric.shadows.TestActivity"); packageManager.setComponentEnabledSetting( componentToDisable, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP); List<ResolveInfo> resolveInfos = packageManager.queryIntentActivities(i, 0); assertThat(resolveInfos).isEmpty(); }
Source:
public Long execute(Context context) { KieSession ksession = ((RegistryContext) context).lookup(KieSession.class); ProcessInstance processInstance = ksession.getProcessInstance(processInstanceId); if (processInstance == null) { throw new ProcessInstanceNotFoundException("No process instance found with id " + processInstanceId); } CaseEventSupport caseEventSupport = getCaseEventSupport(context); caseEventSupport.fireBeforeDynamicProcessAdded(caseId, processInstanceId, processId, parameters); long subProcessInstanceId = DynamicUtils.addDynamicSubProcess(processInstance, ksession, processId, parameters); if (subProcessInstanceId < 0) { throw new ProcessDefinitionNotFoundException("No process definition found with id: " + processId); } caseEventSupport.fireAfterDynamicProcessAdded(caseId, processInstanceId, processId, parameters, subProcessInstanceId); return subProcessInstanceId; }

Target:
public Long execute(Context context) { KieSession ksession = ((RegistryContext) context).lookup(KieSession.class); ProcessInstance processInstance = ksession.getProcessInstance(processInstanceId); if (processInstance == null) { throw new ProcessInstanceNotFoundException("No process instance found with id " + processInstanceId); } try { CaseEventSupport caseEventSupport = getCaseEventSupport(context); caseEventSupport.fireBeforeDynamicProcessAdded(caseId, processInstanceId, processId, parameters); long subProcessInstanceId = DynamicUtils.addDynamicSubProcess(processInstance, ksession, processId, parameters); caseEventSupport.fireAfterDynamicProcessAdded(caseId, processInstanceId, processId, parameters, subProcessInstanceId); return subProcessInstanceId; } catch (IllegalArgumentException e) { throw new ProcessDefinitionNotFoundException(e.getMessage()); } }
Source:
protected void showPageRec(PageRec pageRec) { super.showPageRec(pageRec); if (pageRec.page == getDefaultPage()) { if (propertiesPage != null) { propertiesPage.selectionChanged(null, new StructuredSelection()); } } }

Target:
protected void showPageRec(PageRec pageRec) { super.showPageRec(pageRec); if (pageRec.page == getDefaultPage()) { if (propertiesPage != null) { propertiesPage.selectionChanged(null, StructuredSelection.EMPTY); } } }
Source:
public void setDocumentExpiration(String id, Date expiration) throws CouchbaseLiteException { synchronized (lock) { try { if(getC4Database().get(id, true) == null) return; if (expiration == null) { getC4Database().setExpiration(id, 0); } else { long timestamp = expiration.getTime(); getC4Database().setExpiration(id, timestamp); } scheduleDocumentExpiration(0); } catch (LiteCoreException e) { throw CBLStatus.convertException(e); } } }

Target:
public void setDocumentExpiration(String id, Date expiration) throws CouchbaseLiteException { synchronized (lock) { try { if (expiration == null) { getC4Database().setExpiration(id, 0); } else { long timestamp = expiration.getTime(); getC4Database().setExpiration(id, timestamp); } scheduleDocumentExpiration(0); } catch (LiteCoreException e) { throw CBLStatus.convertException(e); } } }
Source:
public void testStartEmptyCaseUsingLoggedInOwner() { assertNotNull(deploymentService); DeploymentUnit deploymentUnit = new KModuleDeploymentUnit(GROUP_ID, ARTIFACT_ID, VERSION); deploymentService.deploy(deploymentUnit); units.add(deploymentUnit); identityProvider.setName("mary"); String caseId = caseService.startCase(deploymentUnit.getIdentifier(), EMPTY_CASE_P_ID); assertNotNull(caseId); assertEquals(FIRST_CASE_ID, caseId); try { CaseInstance cInstance = caseService.getCaseInstance(caseId); assertNotNull(cInstance); assertEquals("mary", cInstance.getOwner()); assertEquals(deploymentUnit.getIdentifier(), cInstance.getDeploymentId()); caseService.cancelCase(caseId); try { caseService.getCaseInstance(caseId); fail("Case was aborted so it should not be found any more"); } catch (CaseNotFoundException e) { } caseId = null; } catch (Exception e) { logger.error("Unexpected error {}", e.getMessage(), e); fail("Unexpected exception " + e.getMessage()); } finally { if (caseId != null) { caseService.cancelCase(caseId); } } }

Target:
public void testStartEmptyCaseUsingLoggedInOwner() { identityProvider.setName("mary"); String caseId = caseService.startCase(deploymentUnit.getIdentifier(), EMPTY_CASE_P_ID); assertNotNull(caseId); assertEquals(FIRST_CASE_ID, caseId); try { CaseInstance cInstance = caseService.getCaseInstance(caseId); assertNotNull(cInstance); assertEquals("mary", cInstance.getOwner()); assertEquals(deploymentUnit.getIdentifier(), cInstance.getDeploymentId()); caseService.cancelCase(caseId); try { caseService.getCaseInstance(caseId); fail("Case was aborted so it should not be found any more"); } catch (CaseNotFoundException e) { } caseId = null; } catch (Exception e) { logger.error("Unexpected error {}", e.getMessage(), e); fail("Unexpected exception " + e.getMessage()); } finally { if (caseId != null) { caseService.cancelCase(caseId); } } }
Source:
public synchronized String format(long value) { long date = value / 1000000; long sec = value / 1000000000; long ms = Math.abs(value % 1000000000 / 1000000); long cs = Math.abs(value % 1000000 / 1000); long ns = Math.abs(value % 1000); if (value < 0 && ms + cs + ns > 0 && !super.toPattern().contains(fOpenBracket + "T")) { date -= 1; long nanosec = 1000000000 - (1000000 * ms + 1000 * cs + ns); ms = nanosec / 1000000; cs = nanosec % 1000000 / 1000; ns = nanosec % 1000; } StringBuffer result = new StringBuffer(super.format(date)); result.append(fSubSecPattern); for (String pattern : fSupplPatterns) { int length = pattern.length(); StringBuffer fmt = new StringBuffer(length); for (int i = 0; i < length; i++) { fmt.append("0"); } DecimalFormat dfmt = new DecimalFormat(fmt.toString()); String fmtVal = ""; switch (pattern.charAt(0)) { case 'T': if (value < 0 && sec == 0) { result.insert(0, '-'); } fmtVal = dfmt.format(sec); break; case 'S': fmtVal = dfmt.format(ms); break; case 'C': fmtVal = dfmt.format(cs); break; case 'N': fmtVal = dfmt.format(ns); break; default: break; } String ph = new StringBuffer(fOpenBracket + pattern + fCloseBracket).toString(); int loc = result.indexOf(ph); result.replace(loc, loc + length + fOpenBracket.length() + fCloseBracket.length(), fmtVal); } return result.toString(); }

Target:
public synchronized String format(long value) { long date = value / 1000000; long sec = value / 1000000000; long ms = Math.abs((value % 1000000000) / 1000000); long cs = Math.abs((value % 1000000) / 1000); long ns = Math.abs(value % 1000); if (value < 0 && ms + cs + ns > 0 && !super.toPattern().contains(fOpenBracket + "T")) { date -= 1; long nanosec = 1000000000 - (1000000 * ms + 1000 * cs + ns); ms = nanosec / 1000000; cs = (nanosec % 1000000) / 1000; ns = nanosec % 1000; } StringBuffer result = new StringBuffer(super.format(date)); result.append(fSubSecPattern); for (String pattern : fSupplPatterns) { int length = pattern.length(); StringBuffer fmt = new StringBuffer(length); for (int i = 0; i < length; i++) { fmt.append("0"); } DecimalFormat dfmt = new DecimalFormat(fmt.toString()); String fmtVal = ""; switch (pattern.charAt(0)) { case 'T': if (value < 0 && sec == 0) { result.insert(0, '-'); } fmtVal = dfmt.format(sec); break; case 'S': fmtVal = dfmt.format(ms); break; case 'C': fmtVal = dfmt.format(cs); break; case 'N': fmtVal = dfmt.format(ns); break; default: break; } String ph = new StringBuffer(fOpenBracket + pattern + fCloseBracket).toString(); int loc = result.indexOf(ph); result.replace(loc, loc + length + fOpenBracket.length() + fCloseBracket.length(), fmtVal); } return result.toString(); }
Source:
public RowExpressionDomainTranslator(FunctionManager functionManager) { this.functionManager = functionManager; this.logicalRowExpressions = new LogicalRowExpressions(functionManager); this.functionResolution = new StandardFunctionResolution(functionManager); }

Target:
public RowExpressionDomainTranslator(FunctionManager functionManager) { this.functionManager = requireNonNull(functionManager, "functionManager is null"); this.logicalRowExpressions = new LogicalRowExpressions(functionManager); this.functionResolution = new StandardFunctionResolution(functionManager); }
Source:
public void testAddTransfer_Anon(){ Map<String, String> transferRequest = new HashMap<>(); transferRequest.put("ticketKey", ticket.getKey()); transferRequest.put("goalUsername", ticketReciever.getUsername()); given() .when() .content(transferRequest).contentType(ContentType.JSON) .post(TRANSFER_ENDPOINT) .then() .statusCode(HttpStatus.SC_FORBIDDEN); ticket = ticketRepository.findByKey(ticket.getKey()).orElse(null); if(ticket == null) Assert.fail("Could not refresh ticket"); Assert.assertTrue(ticket.isLockedForTransfer()); }

Target:
public void testAddTransfer_Anon(){ given(). when(). content(ticketReceiver.getUsername()).contentType(ContentType.TEXT). post(TRANSFER_ENDPOINT + "/" + ticket.getId()). then(). statusCode(HttpStatus.SC_FORBIDDEN); Assert.assertTrue(tttRepository.count() == 0); }
Source:
public void test(TestHarness th) { Object o = new ClassC(); Interface iface = (Interface)o; th.check(true); }

Target:
public void test(TestHarness th) { Object o = new ClassC(); try { Interface iface = (Interface)o; th.check(true); } catch (ClassCastException e) { th.fail("Unexpected exception: " + e); } }
Source:
public static void main(final String[] args) throws IOException { FormRecognizerClient client = new FormRecognizerClientBuilder() .apiKey(new AzureKeyCredential("{api_key}")) .endpoint("https://{endpoint}.cognitiveservices.azure.com/") .buildClient(); File sourceFile = new File("../../test/resources/sample-files/layout1.jpg"); byte[] fileContent = Files.readAllBytes(sourceFile.toPath()); InputStream targetStream = new ByteArrayInputStream(fileContent); SyncPoller<OperationResult, IterableStream<FormPage>> recognizeLayoutPoller = client.beginRecognizeContent(targetStream, sourceFile.length(), FormContentType.IMAGE_JPEG); IterableStream<FormPage> layoutPageResults = recognizeLayoutPoller.getFinalResult(); layoutPageResults.forEach(formPage -> { System.out.println("----Recognizing content ----"); System.out.printf("Has width: %s and height: %s, measured with unit: %s%n", formPage.getWidth(), formPage.getHeight(), formPage.getUnit()); formPage.getTables().forEach(formTable -> { System.out.printf("Table has %s rows and %s columns.%n", formTable.getRowCount(), formTable.getColumnCount()); formTable.getCells().forEach(formTableCell -> { final StringBuilder boundingBoxStr = new StringBuilder(); if (formTableCell.getBoundingBox() != null) { formTableCell.getBoundingBox().getPoints().forEach(point -> boundingBoxStr.append(String.format("[%s, %s]", point.getX(), point.getY()))); } System.out.printf("Cell has text %s, within bounding box %s.%n", formTableCell.getText(), boundingBoxStr); }); System.out.println(); }); }); }

Target:
public static void main(final String[] args) throws IOException { FormRecognizerClient client = new FormRecognizerClientBuilder() .apiKey(new AzureKeyCredential("{api_key}")) .endpoint("https://{endpoint}.cognitiveservices.azure.com/") .buildClient(); File sourceFile = new File("/sample-forms/forms/layout1.jpg"); byte[] fileContent = Files.readAllBytes(sourceFile.toPath()); InputStream targetStream = new ByteArrayInputStream(fileContent); SyncPoller<OperationResult, IterableStream<FormPage>> recognizeLayoutPoller = client.beginRecognizeContent(targetStream, sourceFile.length(), FormContentType.IMAGE_JPEG); IterableStream<FormPage> layoutPageResults = recognizeLayoutPoller.getFinalResult(); layoutPageResults.forEach(formPage -> { System.out.println("----Recognizing content ----"); System.out.printf("Has width: %s and height: %s, measured with unit: %s%n", formPage.getWidth(), formPage.getHeight(), formPage.getUnit()); formPage.getTables().forEach(formTable -> { System.out.printf("Table has %s rows and %s columns.%n", formTable.getRowCount(), formTable.getColumnCount()); formTable.getCells().forEach(formTableCell -> { final StringBuilder boundingBoxStr = new StringBuilder(); if (formTableCell.getBoundingBox() != null) { formTableCell.getBoundingBox().getPoints().forEach(point -> boundingBoxStr.append(String.format("[%.2f, %.2f]", point.getX(), point.getY()))); } System.out.printf("Cell has text %s, within bounding box %s.%n", formTableCell.getText(), boundingBoxStr); }); System.out.println(); }); }); }
Source:
public void testCommandForInputMany() throws Exception { test.clearScreen(); test.waitForCompletion("mock-command-inputmany ", "mock", 5, TimeUnit.SECONDS); test.waitForCompletion("mock-command-inputmany --values ", "--v", 5, TimeUnit.SECONDS); Assert.assertEquals("mock-command-inputmany --values ", test.getBuffer()); test.clearScreen(); Result result = test.execute("mock-command-inputmany --values one", 5, TimeUnit.SECONDS); Assert.assertEquals("Command executed.", result.getMessage()); result = test.execute("mock-command-inputmany --values one two three", 5, TimeUnit.SECONDS); Assert.assertEquals("Command executed.", result.getMessage()); test.clearScreen(); test.waitForStdErrChanged("mock-command-inputmany --values\n", 5, TimeUnit.SECONDS); Assert.assertThat(test.getStdErr(), containsString("Must specify at least one value for --values before continuing.")); }

Target:
public void testCommandForInputMany() throws Exception { test.clearScreen(); test.waitForCompletion("mock-command-inputmany ", "mock", 5, TimeUnit.SECONDS); test.waitForCompletion("mock-command-inputmany --values ", "--v", 5, TimeUnit.SECONDS); Assert.assertEquals("mock-command-inputmany --values ", test.getBuffer()); test.clearScreen(); Result result = test.execute("mock-command-inputmany --values one", 5, TimeUnit.SECONDS); Assert.assertEquals("Command executed with input values : one ", result.getMessage()); result = test.execute("mock-command-inputmany --values one two three", 5, TimeUnit.SECONDS); Assert.assertEquals("Command executed with input values : one two three ", result.getMessage()); test.clearScreen(); test.waitForStdErrChanged("mock-command-inputmany --values\n", 5, TimeUnit.SECONDS); Assert.assertThat(test.getStdErr(), containsString("Must specify at least one value for --values before continuing.")); }
Source:
public DatasetStatus deleteDataset(final RelationKey relationKey) throws DbException, InterruptedException { try { Map<Integer, SubQueryPlan> workerPlans = new HashMap<>(); for (Integer workerId : getWorkersForRelation(relationKey, null)) { workerPlans.put(workerId, new SubQueryPlan(new DbDelete(EmptyRelation.of(catalog.getSchema(relationKey)), relationKey, null))); } ListenableFuture<Query> qf = queryManager.submitQuery("delete " + relationKey.toString(), "delete " + relationKey.toString(), "deleting from " + relationKey.toString(getDBMS()), new SubQueryPlan(new SinkRoot(new EOSSource())), workerPlans); try { qf.get(); } catch (ExecutionException e) { throw new DbException("Error executing query", e.getCause()); } } catch (CatalogException e) { throw new DbException(e); } try { catalog.deleteRelationFromCatalog(relationKey); } catch (CatalogException e) { throw new DbException(e); } return getDatasetStatus(relationKey); }

Target:
public DatasetStatus deleteDataset(final RelationKey relationKey) throws DbException, InterruptedException { try { catalog.markRelationDeleted(relationKey); } catch (CatalogException e) { throw new DbException(e); } try { Map<Integer, SubQueryPlan> workerPlans = new HashMap<>(); for (Integer workerId : getWorkersForRelation(relationKey, null)) { workerPlans.put(workerId, new SubQueryPlan(new DbDelete(EmptyRelation.of(catalog.getSchema(relationKey)), relationKey, null))); } ListenableFuture<Query> qf = queryManager.submitQuery("delete " + relationKey.toString(), "delete " + relationKey.toString(), "deleting from " + relationKey.toString(getDBMS()), new SubQueryPlan(new SinkRoot(new EOSSource())), workerPlans); try { qf.get(); } catch (ExecutionException e) { throw new DbException("Error executing query", e.getCause()); } } catch (CatalogException e) { throw new DbException(e); } try { catalog.deleteRelationFromCatalog(relationKey); } catch (CatalogException e) { throw new DbException(e); } return getDatasetStatus(relationKey); }
Source:
private static Session createRecoverableSession(Optional<SelectedRole> role) { return testSessionBuilder() .setIdentity(new Identity( "hive", Optional.empty(), role.map(selectedRole -> ImmutableMap.of("hive", selectedRole)) .orElse(ImmutableMap.of()))) .setSystemProperty(COLOCATED_JOIN, "true") .setSystemProperty(GROUPED_EXECUTION_FOR_AGGREGATION, "true") .setSystemProperty(DYNAMIC_SCHEDULE_FOR_GROUPED_EXECUTION, "true") .setSystemProperty(RECOVERABLE_GROUPED_EXECUTION, "true") .setCatalogSessionProperty(HIVE_CATALOG, USE_REWINDABLE_SPLIT_SOURCE, "true") .setCatalog(HIVE_CATALOG) .setSchema(TPCH_BUCKETED_SCHEMA) .build(); }

Target:
private static Session createRecoverableSession(Optional<SelectedRole> role) { return testSessionBuilder() .setIdentity(new Identity( "hive", Optional.empty(), role.map(selectedRole -> ImmutableMap.of("hive", selectedRole)) .orElse(ImmutableMap.of()))) .setSystemProperty(COLOCATED_JOIN, "true") .setSystemProperty(GROUPED_EXECUTION_FOR_AGGREGATION, "true") .setSystemProperty(DYNAMIC_SCHEDULE_FOR_GROUPED_EXECUTION, "true") .setSystemProperty(RECOVERABLE_GROUPED_EXECUTION, "true") .setCatalog(HIVE_CATALOG) .setSchema(TPCH_BUCKETED_SCHEMA) .build(); }
Source:
public boolean remove( final short internalAdapterId, String indexName ) { adapterCache.remove(internalAdapterId); if (!adapterCache.containsKey(internalAdapterId)) return false; AdapterToIndexMapping mapping = adapterCache.get(internalAdapterId); final String[] indexNames = mapping.getIndexNames(); boolean found = false; for (int i = 0; i < indexNames.length; i++) { if (indexNames[i].compareTo(indexName) == 0) { found = true; break; } } if (!found) { return false; } if (indexNames.length > 1) { String[] newIndices = new String[indexNames.length - 1]; int count = 0; for (int i = 0; i < indexNames.length; i++) { if (indexNames[i].compareTo(indexName) == 0) { continue; } else { newIndices[count] = indexNames[i]; count++; } } adapterCache.remove(internalAdapterId); adapterCache.put( mapping.getAdapterId(), new AdapterToIndexMapping( internalAdapterId, newIndices)); } else { adapterCache.remove(internalAdapterId); } return true; }

Target:
public boolean remove( final short internalAdapterId, String indexName ) { if (!adapterCache.containsKey(internalAdapterId)) { return false; } AdapterToIndexMapping mapping = adapterCache.get(internalAdapterId); final String[] indexNames = mapping.getIndexNames(); boolean found = false; for (int i = 0; i < indexNames.length; i++) { if (indexNames[i].compareTo(indexName) == 0) { found = true; break; } } if (!found) { return false; } if (indexNames.length > 1) { String[] newIndices = new String[indexNames.length - 1]; int count = 0; for (int i = 0; i < indexNames.length; i++) { if (indexNames[i].compareTo(indexName) == 0) { continue; } else { newIndices[count] = indexNames[i]; count++; } } adapterCache.remove(internalAdapterId); adapterCache.put( mapping.getAdapterId(), new AdapterToIndexMapping( internalAdapterId, newIndices)); } else { adapterCache.remove(internalAdapterId); } return true; }
Source:
public void locate() throws Exception { MultiBranchImpl stuff = r.createProject(MultiBranchImpl.class, "stuff"); stuff.getSourcesList().add(new BranchSource(new SingleSCMSource(null, "dev/flow", new NullSCM()))); stuff.scheduleBuild2(0).getFuture().get(); r.waitUntilNoActivity(); showComputation(stuff); FreeStyleProject master = r.jenkins.getItemByFullName("stuff/"+NameMangler.apply("dev/flow"), FreeStyleProject.class); assertNotNull(master); assertEquals(r.jenkins.getRootPath().child("workspace/stuff_"+ NameMangler.apply("dev/flow").replace('@','_')+"-HEAQQA3VKMJWWMJ2LGY5PBAKURNMTX2PMQ3FG7E2R5NWAUUN4SZQ"), r.jenkins.getWorkspaceFor(master)); DumbSlave slave = r.createOnlineSlave(); assertEquals(slave.getWorkspaceRoot().child("stuff_"+NameMangler.apply("dev/flow").replace('@', '_')+"-HEAQQA3VKMJWWMJ2LGY5PBAKURNMTX2PMQ3FG7E2R5NWAUUN4SZQ"), slave.getWorkspaceFor(master)); FreeStyleProject unrelated = r.createFreeStyleProject("100% crazy"); assertEquals(r.jenkins.getRootPath().child("workspace/100% crazy"), r.jenkins.getWorkspaceFor(unrelated)); }

Target:
public void locate() throws Exception { MultiBranchImpl stuff = r.createProject(MultiBranchImpl.class, "stuff"); stuff.getSourcesList().add(new BranchSource(new SingleSCMSource(null, "dev/flow", new NullSCM()))); stuff.scheduleBuild2(0).getFuture().get(); r.waitUntilNoActivity(); showComputation(stuff); FreeStyleProject master = r.jenkins.getItemByFullName("stuff/dev-flow.bn29c1", FreeStyleProject.class); assertNotNull(master); assertEquals(r.jenkins.getRootPath().child("workspace/stuff_dev-flow.bn29c1-7W3ZTDHY5QN5BTMYZEFLCFP56UUPM32ZI6RUODUT4HZONWY7MLFA"), r.jenkins.getWorkspaceFor(master)); DumbSlave slave = r.createOnlineSlave(); assertEquals(slave.getWorkspaceRoot().child("stuff_dev-flow.bn29c1-7W3ZTDHY5QN5BTMYZEFLCFP56UUPM32ZI6RUODUT4HZONWY7MLFA"), slave.getWorkspaceFor(master)); FreeStyleProject unrelated = r.createFreeStyleProject("100% crazy"); assertEquals(r.jenkins.getRootPath().child("workspace/100% crazy"), r.jenkins.getWorkspaceFor(unrelated)); }
Source:
public SelendroidConfiguration getSelendroidConfiguration() { return serverConfiguration; }

Target:
protected SelendroidConfiguration getSelendroidConfiguration() { return serverConfiguration; }
Source:
public void pointRead(Blackhole blackhole) throws IOException { Table table = connection.getTable(jobConfig.tableName); String rowPrefix = getRowPrefix(jobConfig.cellsPerRow, jobConfig.cellSize); Result result = table.get(new Get(Bytes.toBytes(rowPrefix + String.format(SUFFIX_FMT, 1)))); for (Cell cell : result.listCells()) { blackhole.consume(cell); } }

Target:
public void pointRead(Blackhole blackhole) throws IOException { byte[] rowKey = Bytes.toBytes(READ_ROW_PREFIX + String.format("%010d", getRandomInt(10_000))); Result result = table.get(new Get(rowKey)); for (Cell cell : result.listCells()) { blackhole.consume(cell); } }
Source:
public SecretSeries map(Record r) { Gson gson = new Gson(); Type optionsType = new TypeToken<HashMap<String, String>>() {}.getType(); return new SecretSeries( r.getValue(SECRETS.ID), r.getValue(SECRETS.NAME), r.getValue(SECRETS.DESCRIPTION), r.getValue(SECRETS.CREATEDAT), r.getValue(SECRETS.CREATEDBY), r.getValue(SECRETS.UPDATEDAT), r.getValue(SECRETS.UPDATEDBY), r.getValue(SECRETS.TYPE), gson.fromJson(r.getValue(SECRETS.OPTIONS), optionsType)); }

Target:
public SecretSeries map(Record r) { return new SecretSeries( r.getValue(SECRETS.ID), r.getValue(SECRETS.NAME), r.getValue(SECRETS.DESCRIPTION), r.getValue(SECRETS.CREATEDAT), r.getValue(SECRETS.CREATEDBY), r.getValue(SECRETS.UPDATEDAT), r.getValue(SECRETS.UPDATEDBY), r.getValue(SECRETS.TYPE), tryToReadMapValue(r, SECRETS.OPTIONS)); }
Source:
public void creatingUserThenDeletingRemovesExternalIdAssignment() throws Exception { String externalId = BridgeUtils.generateGuid(); participant = new StudyParticipant.Builder().copyOf(participant).withExternalId(externalId).build(); ExternalIdentifier idForTest = ExternalIdentifier.create(study.getStudyIdentifier(), externalId); idForTest.setSubstudyId(substudy.getId()); externalIdService.createExternalId(idForTest, false); try { study.setExternalIdValidationEnabled(true); session = userAdminService.createUser(study, participant, null, true, true); DynamoExternalIdentifier identifier = getDynamoExternalIdentifier(session, externalId); assertEquals(session.getHealthCode(), identifier.getHealthCode()); userAdminService.deleteUser(study, session.getId()); identifier = getDynamoExternalIdentifier(session, externalId); assertNull(identifier.getHealthCode()); Account account = Account.create(); account.setId(BridgeUtils.generateGuid()); account.setStudyId(session.getStudyIdentifier().getIdentifier()); account.setHealthCode(session.getHealthCode()); ExternalIdentifier extIdObj = externalIdService.beginAssignExternalId(account, externalId); externalIdService.commitAssignExternalId(extIdObj); } finally { session = null; study.setExternalIdValidationEnabled(false); externalIdService.deleteExternalIdPermanently(study, idForTest); } }

Target:
public void creatingUserThenDeletingRemovesExternalIdAssignment() throws Exception { String externalId = BridgeUtils.generateGuid(); participant = new StudyParticipant.Builder().copyOf(participant).withExternalId(externalId).build(); ExternalIdentifier idForTest = ExternalIdentifier.create(study.getStudyIdentifier(), externalId); idForTest.setSubstudyId(substudy.getId()); externalIdService.createExternalId(idForTest, false); try { study.setExternalIdValidationEnabled(true); session = userAdminService.createUser(study, participant, null, true, true); DynamoExternalIdentifier identifier = getDynamoExternalIdentifier(session, externalId); assertEquals(session.getHealthCode(), identifier.getHealthCode()); userAdminService.deleteUser(study, session.getId()); identifier = getDynamoExternalIdentifier(session, externalId); assertNull(identifier.getHealthCode()); Account account = Account.create(); account.setId(BridgeUtils.generateGuid()); account.setStudyId(session.getStudyIdentifier().getIdentifier()); account.setHealthCode(BridgeUtils.generateGuid()); ExternalIdentifier extIdObj = setupExternalId(account, externalId); externalIdService.commitAssignExternalId(extIdObj); } finally { session = null; study.setExternalIdValidationEnabled(false); externalIdService.deleteExternalIdPermanently(study, idForTest); } }
Source:
private String makeLabel(final String convert) { if (listBox.isMultipleSelect()) { return Arrays.stream(convert.split(",")) .map(s -> getLabel(s)) .collect(Collectors.joining(",")); } else { return getLabel(convert); } }

Target:
private String makeLabel(final String convert) { if (listBox.isMultipleSelect()) { String[] array = ListSplitter.splitPreserveQuotes("\"", true, convert); return Arrays.stream(array) .map(s -> getLabel(s)) .collect(Collectors.joining(",")); } else { return getLabel(convert); } }
Source:
public static void validate(Map<String, String> props) { final boolean hasTopicsConfig = hasTopicsConfig(props); final boolean hasTopicsRegexConfig = hasTopicsRegexConfig(props); final boolean hasDlqTopicConfig = hasDlqTopicConfig(props); if (hasTopicsConfig && hasTopicsRegexConfig) { throw new ConfigException(SinkTask.TOPICS_CONFIG + " and " + SinkTask.TOPICS_REGEX_CONFIG + " are mutually exclusive options, but both are set."); } if (!hasTopicsConfig && !hasTopicsRegexConfig) { throw new ConfigException("Must configure one of " + SinkTask.TOPICS_CONFIG + " or " + SinkTask.TOPICS_REGEX_CONFIG); } if (hasDlqTopicConfig) { String dlqTopic = props.get(DLQ_TOPIC_NAME_CONFIG).trim(); if (hasTopicsConfig) { String[] topics = props.get(SinkTask.TOPICS_CONFIG).split(","); Arrays.setAll(topics, i -> topics[i].trim()); if (Arrays.asList(topics).contains(dlqTopic)) { throw new ConfigException(DLQ_TOPIC_NAME_CONFIG + " has a topic name which is already in " + SinkTask.TOPICS_CONFIG); } } if (hasTopicsRegexConfig) { String topicsRegexStr = props.get(SinkTask.TOPICS_REGEX_CONFIG); Pattern pattern = Pattern.compile(topicsRegexStr); if (pattern.matcher(dlqTopic).matches()) { throw new ConfigException(DLQ_TOPIC_NAME_CONFIG + " has a topic name which matches in " + SinkTask.TOPICS_REGEX_CONFIG); } } } }

Target:
public static void validate(Map<String, String> props) { final boolean hasTopicsConfig = hasTopicsConfig(props); final boolean hasTopicsRegexConfig = hasTopicsRegexConfig(props); final boolean hasDlqTopicConfig = hasDlqTopicConfig(props); if (hasTopicsConfig && hasTopicsRegexConfig) { throw new ConfigException(SinkTask.TOPICS_CONFIG + " and " + SinkTask.TOPICS_REGEX_CONFIG + " are mutually exclusive options, but both are set."); } if (!hasTopicsConfig && !hasTopicsRegexConfig) { throw new ConfigException("Must configure one of " + SinkTask.TOPICS_CONFIG + " or " + SinkTask.TOPICS_REGEX_CONFIG); } if (hasDlqTopicConfig) { String dlqTopic = props.get(DLQ_TOPIC_NAME_CONFIG).trim(); if (hasTopicsConfig) { List<String> topics = parseTopicsList(props); if (topics.contains(dlqTopic)) { throw new ConfigException(String.format("The DLQ topic '%s' may not be included in the list of " + "topics ('%s=%s') consumed by the connector", dlqTopic, SinkTask.TOPICS_REGEX_CONFIG, topics)); } } if (hasTopicsRegexConfig) { String topicsRegexStr = props.get(SinkTask.TOPICS_REGEX_CONFIG); Pattern pattern = Pattern.compile(topicsRegexStr); if (pattern.matcher(dlqTopic).matches()) { throw new ConfigException(String.format("The DLQ topic '%s' may not be included in the regex matching the " + "topics ('%s=%s') consumed by the connector", dlqTopic, SinkTask.TOPICS_REGEX_CONFIG, topicsRegexStr)); } } } }
Source:
public void visitNode(Tree tree) { MethodTree method = (MethodTree) tree; boolean isPublic = method.modifiers().modifiers().contains(Modifier.PUBLIC) || method.symbol().owner().isInterface(); if (!isPublic && hasTransactionalAnnotation(method)) { addIssue(method, "Make this method \"public\" or remove the \"@Transactional\" annotation"); } }

Target:
public void visitNode(Tree tree) { MethodTree method = (MethodTree) tree; boolean isPublic = method.modifiers().contains(Modifier.PUBLIC); if (hasSemantic()) { isPublic = method.symbol().isPublic(); } if (!isPublic && hasTransactionalAnnotation(method)) { addIssue(method, "Make this method \"public\" or remove the \"@Transactional\" annotation"); } }
Source:
private void startSubscription() { LOG.info("{}: Consumer subscribes to {}", this, topicPartitionsToSSP.keySet()); try { synchronized (kafkaConsumer) { kafkaConsumer.assign(topicPartitionsToSSP.keySet()); } } catch (Exception e) { throw new SamzaException("Consumer subscription failed for " + this, e); } }

Target:
private void startSubscription() { LOG.info("{}: Consumer subscribes to {}", this, topicPartitionsToOffset.keySet()); try { synchronized (kafkaConsumer) { kafkaConsumer.assign(topicPartitionsToOffset.keySet()); } } catch (Exception e) { throw new SamzaException("Consumer subscription failed for " + this, e); } }
Source:
private SearchResult search(boolean enableScrolling) { Search.Builder builder = new Search.Builder( payloadAsString ); builder.addIndex( indexNames ); if ( enableScrolling ) { builder.setParameter( Parameters.SCROLL, getScrollTimeout() ); builder.setParameter( Parameters.SIZE, getScrollFetchSize() ); } else { builder.setParameter( "from", firstResult ); builder.setParameter( Parameters.SIZE, maxResults != null ? maxResults : MAX_RESULT_WINDOW_SIZE - firstResult ); } if ( sort != null ) { validateSortFields( extendedIntegrator, getQueriedEntityTypes() ); for ( SortField sortField : sort.getSort() ) { builder.addSort( ToElasticsearch.fromLuceneSortField( sortField ) ); } } Search search = builder.build(); if ( QUERY_LOG.isDebugEnabled() ) { try ( ServiceReference<GsonService> gsonService = extendedIntegrator.getServiceManager().requestReference( GsonService.class ) ) { Gson gson = gsonService.get().getGson(); QUERY_LOG.executingElasticsearchQuery( search.getURI(), search.getData( gson ) ); } } try ( ServiceReference<JestClient> client = getExtendedSearchIntegrator().getServiceManager().requestReference( JestClient.class ) ) { return client.get().executeRequest( search ); } }

Target:
private SearchResult search(boolean enableScrolling) { Search.Builder builder = new Search.Builder( payloadAsString ); builder.addIndex( indexNames ); if ( enableScrolling ) { builder.setParameter( Parameters.SCROLL, getScrollTimeout() ); builder.setParameter( Parameters.SIZE, getScrollFetchSize() ); } else { builder.setParameter( "from", firstResult ); builder.setParameter( Parameters.SIZE, maxResults != null ? maxResults : MAX_RESULT_WINDOW_SIZE - firstResult ); } if ( sort != null ) { validateSortFields( extendedIntegrator, getQueriedEntityTypes() ); for ( SortField sortField : sort.getSort() ) { builder.addSort( ToElasticsearch.fromLuceneSortField( sortField ) ); } } Search search = builder.build(); if ( QUERY_LOG.isDebugEnabled() ) { try ( ServiceReference<GsonService> gsonService = extendedIntegrator.getServiceManager().requestReference( GsonService.class ) ) { QUERY_LOG.executingElasticsearchQuery( search.getURI(), getPrettyPrintedData( gsonService.get(), search) ); } } try ( ServiceReference<JestClient> client = getExtendedSearchIntegrator().getServiceManager().requestReference( JestClient.class ) ) { return client.get().executeRequest( search ); } }
Source:
protected void endSuccessfully() { setVmTemplateId(getParameters().getVmTemplateId()); setVmId(((CreateImageTemplateParameters)getParameters().getImagesParameters().get(0)).getVmId()); for (VdcActionParametersBase p : getParameters().getImagesParameters()) { Backend.getInstance().EndAction(VdcActionType.CreateImageTemplate, p); } if (reloadVmTemplateFromDB() != null) { endDefaultOperations(); } setSucceeded(true); }

Target:
protected void endSuccessfully() { setVmTemplateId(getParameters().getVmTemplateId()); setVmId(getVmIdFromImageParameters()); for (VdcActionParametersBase p : getParameters().getImagesParameters()) { Backend.getInstance().EndAction(VdcActionType.CreateImageTemplate, p); } if (reloadVmTemplateFromDB() != null) { endDefaultOperations(); } setSucceeded(true); }
Source:
public void initialise() { for (EntityRef entity : entityManager.getEntitiesWith(ScoreComponent.class)) { scoreEntity = entity; score = scoreEntity.getComponent(ScoreComponent.class); } if (!scoreEntity.equals(EntityRef.NULL)) { scoreArea = find("scoreArea", UIText.class); scoreArea.bindText(new ReadOnlyBinding<String>() { @Override public String get() { return String.valueOf(score.blackScore); } }); } }

Target:
public void initialise() { }
Source:
public void testWrongSelectionBug534319singleThread() throws Exception { waitForNonConsoleJobs(); int iterations = 5; final String typeName = "Bug534319singleThread"; final String breakpointMethodName = "breakpointMethod"; doTestWrongSelectionBug534319(iterations, typeName, breakpointMethodName); }

Target:
public void testWrongSelectionBug534319singleThread() throws Exception { int iterations = 5; final String typeName = "Bug534319singleThread"; final String breakpointMethodName = "breakpointMethod"; doTestWrongSelectionBug534319(iterations, typeName, breakpointMethodName); }
Source:
public ExpandDims(SameDiff sameDiff, SDVariable[] args, int axis) { super(null, sameDiff, args); if(axis == Integer.MAX_VALUE){ throw new IllegalArgumentException("Cannot perform ExpandDims with axis == Integer.MAX_VALUE"); } this.axis = axis; addIArgument(this.axis); }

Target:
public ExpandDims(SameDiff sameDiff, SDVariable[] args, int axis) { super(null, sameDiff, args); if(axis == Integer.MAX_VALUE){ throw new ND4JIllegalArgumentException("Cannot perform ExpandDims with axis == Integer.MAX_VALUE"); } this.axis = axis; addIArgument(this.axis); }
Source:
public void addUser(RoleUser user) { throw new RuntimeException("PluginRoleConfig does not support adding users, should be added through RoleConfigService"); }

Target:
public void addUser(RoleUser user) { throw new UnsupportedOperationException("PluginRoleConfig does not support adding users, should be added through PluginRoleService"); }
Source:
public void handleStateChanged(Watcher.Event.KeeperState state) { switch (state) { case Expired: LOG.warn("Got " + state.toString() + " event for processor=" + processorId + ". Stopping the container and unregister the processor node."); zkUtils.incGeneration(); zkUtils.unregister(); if (leaderElector.amILeader()) { leaderElector.resignLeadership(); } LOG.info("Cancelling all scheduled actions in session expiration for processorId: {}.", processorId); debounceTimer.cancelAllScheduledActions(); debounceTimer.scheduleAfterDebounceTime(ZK_SESSION_ERROR, 0, () -> { if (coordinatorListener != null) { coordinatorListener.onJobModelExpired(); } }); return; case Disconnected: LOG.warn("Got " + state.toString() + " event for processor=" + processorId + ". Scheduling a coordinator stop."); debounceTimer.scheduleAfterDebounceTime(ZK_SESSION_ERROR, new ZkConfig(config).getZkSessionTimeoutMs(), () -> stop()); return; case AuthFailed: case NoSyncConnected: case Unknown: LOG.warn("Got unexpected failure event " + state.toString() + " for processor=" + processorId + ". Stopping the job coordinator."); debounceTimer.scheduleAfterDebounceTime(ZK_SESSION_ERROR, 0, () -> stop()); return; case SyncConnected: LOG.info("Got syncconnected event for processor=" + processorId + "."); debounceTimer.cancelAction(ZK_SESSION_ERROR); return; default: LOG.info("Got ZK event " + state.toString() + " for processor=" + processorId + ". Continue"); return; } }

Target:
public void handleStateChanged(Watcher.Event.KeeperState state) { switch (state) { case Expired: LOG.warn("Got " + state.toString() + " event for processor=" + processorId + ". Stopping the container and unregister the processor node."); zkUtils.incGeneration(); zkUtils.unregister(); if (leaderElector.amILeader()) { leaderElector.resignLeadership(); } LOG.info("Cancelling all scheduled actions in session expiration for processorId: {}.", processorId); debounceTimer.cancelAllScheduledActions(); debounceTimer.scheduleAfterDebounceTime(ZK_SESSION_EXPIRED, 0, () -> { if (coordinatorListener != null) { coordinatorListener.onJobModelExpired(); } }); return; case Disconnected: LOG.warn("Got " + state.toString() + " event for processor=" + processorId + ". Scheduling a coordinator stop."); debounceTimer.scheduleAfterDebounceTime(ZK_SESSION_ERROR, new ZkConfig(config).getZkSessionTimeoutMs(), () -> stop()); return; case AuthFailed: case NoSyncConnected: case Unknown: LOG.warn("Got unexpected failure event " + state.toString() + " for processor=" + processorId + ". Stopping the job coordinator."); debounceTimer.scheduleAfterDebounceTime(ZK_SESSION_ERROR, 0, () -> stop()); return; case SyncConnected: LOG.info("Got syncconnected event for processor=" + processorId + "."); debounceTimer.cancelAction(ZK_SESSION_ERROR); return; default: LOG.info("Got ZK event " + state.toString() + " for processor=" + processorId + ". Continue"); return; } }
Source:
private RegistryFetch getLatestFullFetch() { if (fullFetchWithDeltaView.get() == null) { Eureka2FullFetchWithDeltaView newView = new Eureka2FullFetchWithDeltaView( registry.forInterest(Interests.forFullRegistry()), refreshIntervalMs, scheduler ); if (!fullFetchWithDeltaView.compareAndSet(null, newView)) { newView.close(); } } return fullFetchWithDeltaView.get().latestCopy().timeout(queryTimeoutMs, TimeUnit.MILLISECONDS).take(1).toBlocking().first(); }

Target:
private Observable<RegistryFetch> getLatestFullFetch() { if (fullFetchWithDeltaView.get() == null) { synchronized (fullFetchWithDeltaView) { if (fullFetchWithDeltaView.get() == null) { Eureka2FullFetchWithDeltaView newView = new Eureka2FullFetchWithDeltaView( registry.forInterest(Interests.forFullRegistry()), refreshIntervalMs, scheduler ); fullFetchWithDeltaView.set(newView); } } } return fullFetchWithDeltaView.get().latestCopy(); }
Source:
public Provider getProvider() { if (ec2 != null) { return ec2; } else if (gce != null) { return gce; } else if (vagrant != null) { return vagrant; } else if(occi != null){ return occi; } else { return baremetal; } }

Target:
public Provider getProvider() { if (ec2 != null) { return ec2; } else if (gce != null) { return gce; } else if (vagrant != null) { return vagrant; } else if(nova != null) { return nova; } else if(occi != null) { return occi; } else { return baremetal; } }