auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private static UserSessionModel[] createSessions(KeycloakSession session) { RealmModel realm = session.realms().getRealmByName("test"); UserSessionModel[] sessions = new UserSessionModel[3]; KeycloakModelUtils.runJobInTransaction(session.getKeycloakSessionFactory(), (KeycloakSession kcSession) -> { sessions[0] = kcSession.sessions().createUserSession(realm, kcSession.users().getUserByUsername("user1", realm), "user1", "127.0.0.1", "form", true, null, null); createClientSession(kcSession, realm.getClientByClientId("test-app"), sessions[0], "http://redirect", "state"); createClientSession(kcSession, realm.getClientByClientId("third-party"), sessions[0], "http://redirect", "state"); sessions[1] = kcSession.sessions().createUserSession(realm, kcSession.users().getUserByUsername("user1", realm), "user1", "127.0.0.2", "form", true, null, null); createClientSession(kcSession, realm.getClientByClientId("test-app"), sessions[1], "http://redirect", "state"); sessions[2] = kcSession.sessions().createUserSession(realm, kcSession.users().getUserByUsername("user2", realm), "user2", "127.0.0.3", "form", true, null, null); createClientSession(kcSession, realm.getClientByClientId("test-app"), sessions[2], "http://redirect", "state"); }); return sessions; }

Target:
private static UserSessionModel[] createSessions(KeycloakSession session) { RealmModel realm = session.realms().getRealmByName("test"); UserSessionModel[] sessions = new UserSessionModel[3]; sessions[0] = session.sessions().createUserSession(realm, session.users().getUserByUsername("user1", realm), "user1", "127.0.0.1", "form", true, null, null); createClientSession(session, realm.getClientByClientId("test-app"), sessions[0], "http://redirect", "state"); createClientSession(session, realm.getClientByClientId("third-party"), sessions[0], "http://redirect", "state"); sessions[1] = session.sessions().createUserSession(realm, session.users().getUserByUsername("user1", realm), "user1", "127.0.0.2", "form", true, null, null); createClientSession(session, realm.getClientByClientId("test-app"), sessions[1], "http://redirect", "state"); sessions[2] = session.sessions().createUserSession(realm, session.users().getUserByUsername("user2", realm), "user2", "127.0.0.3", "form", true, null, null); createClientSession(session, realm.getClientByClientId("test-app"), sessions[2], "http://redirect", "state"); return sessions; }
Source:
private ValueHolder<V> getInternal(K key) throws StoreAccessException, TimeoutException { ClusteredValueHolder<V> holder = null; try { Chain chain = storeProxy.get(extractLongKey(key)); if(!chain.isEmpty()) { long now= timeSource.getTimeMillis(); ResolvedChain<K, V> resolvedChain = resolver.resolve(chain, key, now); if (resolvedChain.isCompacted()) { Chain compactedChain = resolvedChain.getCompactedChain(); storeProxy.replaceAtHead(extractLongKey(key), chain, compactedChain); } Result<V> resolvedResult = resolvedChain.getResolvedResult(key); if (resolvedResult != null) { V value = resolvedResult.getValue(); holder = new ClusteredValueHolder<V>(value, resolvedChain.getExpirationTime()); } } } catch (RuntimeException re) { handleRuntimeException(re); } return holder; }

Target:
private ValueHolder<V> getInternal(K key) throws StoreAccessException, TimeoutException { ClusteredValueHolder<V> holder = null; try { Chain chain = storeProxy.get(extractLongKey(key)); if(!chain.isEmpty()) { ResolvedChain<K, V> resolvedChain = resolver.resolve(chain, key, timeSource.getTimeMillis()); if (resolvedChain.isCompacted()) { Chain compactedChain = resolvedChain.getCompactedChain(); storeProxy.replaceAtHead(extractLongKey(key), chain, compactedChain); } Result<V> resolvedResult = resolvedChain.getResolvedResult(key); if (resolvedResult != null) { V value = resolvedResult.getValue(); holder = new ClusteredValueHolder<V>(value, resolvedChain.getExpirationTime()); } } } catch (RuntimeException re) { handleRuntimeException(re); } return holder; }
Source:
private void initApexPluginDispatcher() { PluginLocator<ApexPlugin> locator = new ChainedPluginLocator<>(new ServiceLoaderBasedPluginLocator<>(ApexPlugin.class), new PropertyBasedPluginLocator<>(ApexPlugin.class, PLUGINS_CONF_KEY)); apexPluginDispatcher = new PerPluginExecutorApexPluginManager(locator, appContext, dnmgr, stats); dnmgr.apexPluginDispatcher = apexPluginDispatcher; addService(apexPluginDispatcher); }

Target:
private void initApexPluginDispatcher() { PluginLocator<DAGExecutionPlugin> locator = new ChainedPluginLocator<>(new ServiceLoaderBasedPluginLocator<>(DAGExecutionPlugin.class), new PropertyBasedPluginLocator<>(DAGExecutionPlugin.class, PLUGINS_CONF_KEY)); apexPluginDispatcher = new DefaultApexPluginDispatcher(locator, appContext, dnmgr, stats); dnmgr.apexPluginDispatcher = apexPluginDispatcher; addService(apexPluginDispatcher); }
Source:
public void testSimpleTrue() throws Exception { String promelaString = "" + "never { \n" + "T0_init:\n" + " if\n" + " :: ((!(px0)) && (!(px1))) -> goto accept_all\n" + " :: ((px0) || (px1)) -> goto T0_init\n" + " fi;\n" + "accept_all:\n" + " skip\n" + "}" + ""; PromelaBuchi automaton = PromelaBuchiParser.parse(new ByteArrayInputStream(promelaString.getBytes("UTF-8"))); PushdownSystem<String,String> pds = PushdownSystem.of(""+ "<x0, p> => <x0>;\n" + "<x0, p> => <x1, p p>;\n" + "<x1, p> => <x1, p p>;\n" + "<x1, p> => <x0>;\n" + "<x0, p>"); ConcreteEvaluator<String,String> evaluator = ConcreteEvaluator.of("" + "<x0, p> |= px0;\n" + "<x1, p> |= px1;"); BuchiPushdownSystem<String, String> bps = new BuchiPushdownSystem<>(pds, automaton, evaluator); System.err.print(bps.toString()); BuchiPushdownSystemTools<String, String> bpsTool = new BuchiPushdownSystemTools<>(bps); System.err.println("\n------------------------"); PAutomaton<PAutomatonState<Pair<String, BuchiState>, String>, String> post = bpsTool.getPostStar(); System.err.println("\n------------------------"); System.err.println(post.toString()); TarjanSCC counterExampleGraph = bpsTool.getCounterExample(); Assert.assertNull("Property must hold => no counterexample", counterExampleGraph); }

Target:
public void testSimpleTrue() throws Exception { String promelaString = "" + "never { \n" + "T0_init:\n" + " if\n" + " :: ((!(px0)) && (!(px1))) -> goto accept_all\n" + " :: ((px0) || (px1)) -> goto T0_init\n" + " fi;\n" + "accept_all:\n" + " skip\n" + "}" + ""; PromelaBuchi automaton = PromelaBuchiParser.parse(new ByteArrayInputStream(promelaString.getBytes("UTF-8"))); PushdownSystem<String,String> pds = PushdownSystem.of(""+ "<x0, p> => <x0>;\n" + "<x0, p> => <x1, p p>;\n" + "<x1, p> => <x1, p p>;\n" + "<x1, p> => <x0>;\n" + "<x0, p>"); ConcreteEvaluator<String,String> evaluator = ConcreteEvaluator.of("" + "<x0, p> |= px0;\n" + "<x1, p> |= px1;"); BuchiPushdownSystem<String, String> bps = new BuchiPushdownSystem<>(pds, automaton, evaluator); System.err.print(bps.toString()); BuchiPushdownSystemTools<String, String> bpsTool = new BuchiPushdownSystemTools<>(bps); System.err.println("\n------------------------"); PAutomaton<PAutomatonState<Pair<String, BuchiState>, String>, String> post = bpsTool.getPostStar(); System.err.println("\n------------------------"); System.err.println(post.toString()); TarjanSCC counterExampleGraph = bpsTool.getCounterExampleGraph(); Assert.assertNull("Property must hold => no counterexample", counterExampleGraph); }
Source:
public DiscoveryResult createResult(ServiceInfo info) { DiscoveryResult result = null; ThingUID uid = getThingUID(info); if (uid != null) { InetAddress[] addrs = info.getInetAddresses(); Map<String, Object> properties = new HashMap<>(2); String label = "Bose SoundTouch"; try { if (BST_10_THING_TYPE_UID.equals(uid.getThingTypeUID())) { try { String group = DiscoveryUtil .executeUrl("http://" + addrs[0].getHostAddress() + ":8090/getGroup"); label = DiscoveryUtil.getContentOfFirstElement(group, "name"); } catch (Exception e) { logger.debug("Can't obtain label for group. Will use the default one"); label = ""; } } if (label == null || label.isEmpty()) { label = info.getName(); } } catch (Exception e) { } if (addrs.length > 1) { logger.warn("Bose SoundTouch device ({}) reports multiple addresses - using the first one: {}", info.getName(), label, Arrays.toString(addrs)); } properties.put(BoseSoundTouchConfiguration.HOST, addrs[0].getHostAddress()); if (getMacAddress(info) != null) { properties.put(BoseSoundTouchConfiguration.MAC_ADDRESS, new String(getMacAddress(info))); } return DiscoveryResultBuilder.create(uid).withProperties(properties).withLabel(label).withTTL(600).build(); } return result; }

Target:
public DiscoveryResult createResult(ServiceInfo info) { DiscoveryResult result = null; ThingUID uid = getThingUID(info); if (uid != null) { InetAddress[] addrs = info.getInetAddresses(); Map<String, Object> properties = new HashMap<>(2); String label = null; if (BST_10_THING_TYPE_UID.equals(uid.getThingTypeUID())) { try { String group = DiscoveryUtil .executeUrl("http://" + addrs[0].getHostAddress() + ":8090/getGroup"); label = DiscoveryUtil.getContentOfFirstElement(group, "name"); } catch (IOException e) { logger.debug("Can't obtain label for group. Will use the default one"); } } if (label == null || label.isEmpty()) { label = info.getName(); } if (label == null || label.isEmpty()) { label = "Bose SoundTouch"; } if (addrs.length > 1) { logger.warn("Bose SoundTouch device ({}) reports multiple addresses - using the first one: {}", info.getName(), label, Arrays.toString(addrs)); } properties.put(BoseSoundTouchConfiguration.HOST, addrs[0].getHostAddress()); if (getMacAddress(info) != null) { properties.put(BoseSoundTouchConfiguration.MAC_ADDRESS, new String(getMacAddress(info))); } return DiscoveryResultBuilder.create(uid).withProperties(properties).withLabel(label).withTTL(600).build(); } return result; }
Source:
public void canBeSerializedAndDeserialize() throws Exception { Lease lease = Lease.of(leaderTime, Duration.ZERO); String serialized = objectMapper.writeValueAsString(lease); Lease deserialized = objectMapper.readValue(serialized, Lease.class); assertThat(deserialized).isEqualTo(lease); }

Target:
public void canBeSerializedAndDeserialize() throws Exception { Lease deserialized = objectMapper.readValue(SERIALIZED_LEASE, Lease.class); String serialized = objectMapper.writeValueAsString(deserialized); assertThat(serialized).isEqualTo(SERIALIZED_LEASE); }
Source:
long gtk_draw (long widget, long cairo) { if (GTK.GTK_VERSION >= OS.VERSION(3, 14, 0)) { long context = GTK.gtk_widget_get_style_context(widget); GtkAllocation allocation = new GtkAllocation(); GTK.gtk_widget_get_allocation (widget, allocation); int width = (state & ZERO_WIDTH) != 0 ? 0 : allocation.width; int height = (state & ZERO_HEIGHT) != 0 ? 0 : allocation.height; GTK.gtk_render_background(context, cairo, 0, 0, width, height); if (GTK.GTK_VERSION >= OS.VERSION(3, 20, 0)) { if (widget == fixClipHandle) fixClippings(); } } if (scrolled && widget == topHandle()) { GTK.gtk_widget_queue_draw(widget); scrolled = false; } return super.gtk_draw(widget, cairo); }

Target:
long gtk_draw (long widget, long cairo) { if (GTK.GTK_VERSION >= OS.VERSION(3, 14, 0)) { long context = GTK.gtk_widget_get_style_context(widget); GtkAllocation allocation = new GtkAllocation(); GTK.gtk_widget_get_allocation (widget, allocation); int width = (state & ZERO_WIDTH) != 0 ? 0 : allocation.width; int height = (state & ZERO_HEIGHT) != 0 ? 0 : allocation.height; GTK.gtk_render_background(context, cairo, 0, 0, width, height); if (GTK.GTK_VERSION >= OS.VERSION(3, 20, 0)) { if (widget == fixClipHandle) fixClippings(); } } if (scrolled && widget == topHandle()) { scrolled = false; GTK.gtk_widget_queue_draw(widget); } return super.gtk_draw(widget, cairo); }
Source:
public SinglePortHostnameBuilder( String externalAddress, String internalAddress, String wildcardHost) { this.externalAddress = externalAddress; this.internalAddress = internalAddress; this.wildcardHost = wildcardHost; }

Target:
public SinglePortHostnameBuilder( String externalAddress, String internalAddress, String wildcardHost) { this.wildcardDomain = externalAddress != null ? getWildcardDomain(externalAddress, wildcardHost) : getWildcardDomain(internalAddress, wildcardHost); }
Source:
public void startHtlElement(List<Expression> expressions, TagNode node) { if (isANewTest(node) && isRepeatedCondition(expressions)) { createViolation(node.getStartLinePosition(), RULE_MESSAGE); } conditions.addAll(expressions.stream().map(Expression::getRawText).collect(Collectors.toSet())); super.startHtlElement(expressions, node); }

Target:
public void startHtlElement(List<Expression> expressions, TagNode node) { if (!isConditionReusedCorrectly(expressions, node)) { createViolation(node.getStartLinePosition(), RULE_MESSAGE); } updateConditionSets(expressions, node); }
Source:
protected DragSource createDragSource(Control control) { if (isDragEnabled()) { return new DragSource(control, DND.DROP_COPY | DND.DROP_MOVE); } else { return null; } }

Target:
protected DragSource createDragSource(Control control) { if (isDragEnabled()) { return new DragSource(control, DND.DROP_COPY | DND.DROP_MOVE); } return null; }
Source:
public void InteractiveMaps_001_CreateCustomMapNewImageUpload() { WikiBasePageObject base = new WikiBasePageObject(driver); base.logInCookie(credentials.userName, credentials.password, wikiURL); InteractiveMapsPageObject specialMap = base.openSpecialInteractiveMaps(wikiURL); CreateAMapComponentObject map = specialMap.clickCreateAMap(); CreateACustomMapComponentObject customMap = map.clickCustomMap(); TemplateComponentObject template = customMap.selectFileToUpload(PageContent.file); template.verifyTemplateImagePreview(); template.typeMapName(InteractiveMapsContent.mapName); templateName = base.getTimeStamp(); template.typeTemplateName(templateName); CreatePinTypesComponentObject pinDialog = template.clickNext(); pinDialog.typePinTypeTitle(InteractiveMapsContent.pinTypeName,0); InteractiveMapPageObject createdMap = pinDialog.clickSave(); createdMap.verifyCreatedMapTitle(InteractiveMapsContent.mapName); createdMap.verifyMapOpened(); createdMap.verifyCreatedPins(InteractiveMapsContent.pinTypeName); }

Target:
public void InteractiveMaps_001_CreateCustomMapNewImageUpload() { WikiBasePageObject base = new WikiBasePageObject(driver); base.logInCookie(credentials.userName, credentials.password, wikiURL); InteractiveMapsPageObject specialMap = base.openSpecialInteractiveMaps(wikiURL); CreateAMapComponentObject map = specialMap.clickCreateAMap(); CreateACustomMapComponentObject customMap = map.clickCustomMap(); TemplateComponentObject template = customMap.selectFileToUpload(PageContent.file); template.verifyTemplateImagePreview(); template.typeMapName(InteractiveMapsContent.mapName); InteractiveMapsContent.templateName = base.getTimeStamp(); template.typeTemplateName(InteractiveMapsContent.templateName); CreatePinTypesComponentObject pinDialog = template.clickNext(); pinDialog.typePinTypeTitle(InteractiveMapsContent.pinTypeName, InteractiveMapsContent.pinTypeIndex); InteractiveMapPageObject createdMap = pinDialog.clickSave(); createdMap.verifyCreatedMapTitle(InteractiveMapsContent.mapName); createdMap.verifyMapOpened(); createdMap.verifyCreatedPinTypesForNewMap(); }
Source:
private void fill(MToolBar container, IContributionManager manager) { ToolBarManagerRenderer renderer = (ToolBarManagerRenderer) rendererFactory.getRenderer( container, null); for (IContributionItem item : manager.getItems()) { if (item == null) { continue; } MToolBarElement toolItem = renderer.getToolElement(item); if (item instanceof IToolBarContributionItem) { IToolBarManager manager2 = ((IToolBarContributionItem) item).getToolBarManager(); fill(container, manager2); } else if (item instanceof IContributionManager) { fill(container, (IContributionManager) item); } else if (item instanceof CommandContributionItem && toolItem == null) { CommandContributionItem cci = (CommandContributionItem) item; toolItem = MenuHelper.createToolItem(application, cci); manager.remove(item); if (toolItem != null) { container.getChildren().add(toolItem); } } else { if (toolItem == null) { toolItem = MenuFactoryImpl.eINSTANCE.createOpaqueToolItem(); toolItem.setElementId(item.getId()); renderer.linkModelToContribution(toolItem, item); } if (item instanceof AbstractGroupMarker && container.getWidget() instanceof Control && !((Control) container.getWidget()).isDisposed()) { toolItem.setVisible(isChildVisible(item)); container.getChildren().remove(toolItem); } container.getChildren().add(toolItem); } } }

Target:
private void fill(MToolBar container, IContributionManager manager) { ToolBarManagerRenderer renderer = (ToolBarManagerRenderer) rendererFactory.getRenderer( container, null); for (IContributionItem item : manager.getItems()) { if (item == null) { continue; } MToolBarElement toolItem = renderer.getToolElement(item); if (item instanceof IToolBarContributionItem) { IToolBarManager manager2 = ((IToolBarContributionItem) item).getToolBarManager(); fill(container, manager2); } else if (item instanceof IContributionManager) { fill(container, (IContributionManager) item); } else if (item instanceof CommandContributionItem && toolItem == null) { CommandContributionItem cci = (CommandContributionItem) item; toolItem = MenuHelper.createToolItem(application, cci); manager.remove(item); if (toolItem != null) { container.getChildren().add(toolItem); } } else { if (toolItem == null) { toolItem = MenuFactoryImpl.eINSTANCE.createOpaqueToolItem(); toolItem.setElementId(item.getId()); renderer.linkModelToContribution(toolItem, item); container.getChildren().add(toolItem); } if (item instanceof AbstractGroupMarker) { toolItem.setVisible(isChildVisible(item)); } } } }
Source:
public Object execute(Object[] parameters) { ParametersParameterAccessor accessor = new ParametersParameterAccessor(queryMethod.getParameters(), parameters); StringQuery stringQuery = createQuery(accessor); Class<?> clazz = queryMethod.getEntityInformation().getJavaType(); IndexCoordinates index = elasticsearchOperations.getIndexCoordinatesFor(clazz); Object result = null; if (queryMethod.isPageQuery()) { stringQuery.setPageable(accessor.getPageable()); result = elasticsearchOperations.queryForPage(stringQuery, clazz, index); } else if (queryMethod.isCollectionQuery()) { if (accessor.getPageable().isPaged()) { stringQuery.setPageable(accessor.getPageable()); } result = elasticsearchOperations.queryForList(stringQuery, clazz, index); } else { result = elasticsearchOperations.queryForObject(stringQuery, clazz, index); } return SearchHitSupport.unwrapSearchHits(result); }

Target:
public Object execute(Object[] parameters) { ParametersParameterAccessor accessor = new ParametersParameterAccessor(queryMethod.getParameters(), parameters); StringQuery stringQuery = createQuery(accessor); Class<?> clazz = queryMethod.getEntityInformation().getJavaType(); IndexCoordinates index = elasticsearchOperations.getIndexCoordinatesFor(clazz); Object result = null; if (queryMethod.isPageQuery()) { stringQuery.setPageable(accessor.getPageable()); result = elasticsearchOperations.searchForPage(stringQuery, clazz, index); } else if (queryMethod.isCollectionQuery()) { if (accessor.getPageable().isPaged()) { stringQuery.setPageable(accessor.getPageable()); } result = elasticsearchOperations.search(stringQuery, clazz, index); } else { result = elasticsearchOperations.searchOne(stringQuery, clazz, index); } return SearchHitSupport.unwrapSearchHits(result); }
Source:
public void testBackButtonPressed() { myTestActivity.dispatchKeyEvent(new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_BACK)); assertTrue(!myTestActivity.getRootPageFragment().isAdded()); }

Target:
public void testBackButtonPressed() { myTestActivity.dispatchKeyEvent(new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_BACK)); assertFalse(myTestActivity.getRootPageFragment().isAdded()); }
Source:
private CharSequence createBase64EncodedImage(PackageResourceReference imageReference) throws ResourceStreamNotFoundException, IOException { IResourceStream resourceStream = imageReference.getResource().getResourceStream(); byte[] bytes = new byte[(int)resourceStream.length().bytes()]; DataInputStream dataInputStream = new DataInputStream(resourceStream.getInputStream()); dataInputStream.readFully(bytes); String base64EncodedImage = Base64.encodeBase64String(bytes); return "data:" + resourceStream.getContentType() + ";base64," + base64EncodedImage.replaceAll("\\s", ""); }

Target:
private CharSequence createBase64EncodedImage(PackageResourceReference imageReference) throws ResourceStreamNotFoundException, IOException { IResourceStream resourceStream = imageReference.getResource().getResourceStream(); InputStream inputStream = resourceStream.getInputStream(); try { byte[] bytes = IOUtils.toByteArray(inputStream); String base64EncodedImage = Base64.encodeBase64String(bytes); return "data:" + resourceStream.getContentType() + ";base64," + base64EncodedImage.replaceAll("\\s", ""); } finally { IOUtils.closeQuietly(inputStream); } }
Source:
public void instrumentTaggedAsyncFunctionWithExtraTags() throws InterruptedException, ExecutionException { Map<String, String> extraTags = ImmutableMap.of("key", "value"); AsyncTestService asyncTestService = AtlasDbMetrics.instrumentWithTaggedMetrics( taggedMetrics, AsyncTestService.class, this.asyncTestService, $ -> extraTags); String asyncPingMetricName = MetricRegistry.name(AsyncTestService.class, "asyncPing"); List<ListenableFuture<String>> futures = IntStream.range(0, 10) .mapToObj($ -> asyncTestService.asyncPing()) .collect(Collectors.toList()); Instant now = Instant.now(); MetricName metricName = MetricName.builder().safeName(asyncPingMetricName).safeTags(extraTags).build(); ListenableFuture<Boolean> done = Futures.whenAllSucceed(futures).call(() -> { Awaitility.await() .atMost(ASYNC_DURATION_TTL.toMillis(), TimeUnit.MILLISECONDS) .until(() -> taggedMetrics.timer(metricName).getSnapshot().size() > 0); return true; }, MoreExecutors.directExecutor()); assertThat(done.get()).isEqualTo(true); assertThat(Instant.now()) .as("in the event of scheduling issues, and despite having 10 concurrent futures, we complete " + "everything with 2*ttl") .isBefore(now.plus(ASYNC_DURATION_TTL.plus(ASYNC_DURATION_TTL))); Snapshot snapshot = taggedMetrics.timer(metricName).getSnapshot(); assertThat(Duration.ofNanos(snapshot.getMin())).isGreaterThan(ASYNC_DURATION_TTL); assertThat(snapshot.size()).isEqualTo(10); }

Target:
public void instrumentTaggedAsyncFunctionWithExtraTags() { Map<String, String> extraTags = ImmutableMap.of("key", "value"); AsyncTestService asyncTestService = AtlasDbMetrics.instrumentWithTaggedMetrics( taggedMetrics, AsyncTestService.class, this.asyncTestService, $ -> extraTags); List<ListenableFuture<String>> futures = fireOffTenAsyncPings(asyncTestService); Instant now = Instant.now(); MetricName metricName = MetricName.builder() .safeName(ASYNC_PING_METRIC_NAME) .safeTags(extraTags) .build(); awaitMetricsToBeReported(futures, metricName); assertThat(Instant.now()) .as("in the event of scheduling issues, and despite having 10 concurrent futures, we complete " + "everything with 2*ttl") .isBefore(now.plus(ASYNC_DURATION_TTL.plus(ASYNC_DURATION_TTL))); assertAllAsyncPingMetricsAreAccuratelyRecorded(futures, metricName); }
Source:
private List<ReportMetadataInfo> generateReportsFromReportsResponse(List<ReportMetadataJson> reportResponses) { if (reportResponses == null) { return Collections.emptyList(); } List<ReportMetadataInfo> reportsInfoList = new ArrayList<>(); for (ReportMetadataJson reportResponse : reportResponses) { reportsInfoList.add(populateReportMetadataInfo(reportResponse)); } return reportsInfoList; }

Target:
private List<ReportMetadataInfo> generateReportsFromReportsResponse(List<ReportMetadataJson> reportResponses) { List<ReportMetadataInfo> reportsInfoList = Collections.emptyList(); if (reportResponses != null) { reportsInfoList = new ArrayList<>(); for (ReportMetadataJson reportResponse : reportResponses) { reportsInfoList.add(populateReportMetadataInfo(reportResponse)); } } return reportsInfoList; }
Source:
public void close() { File dir = new File("."); for (int i = 0; i < dir.list().length; i++) { File f = dir.listFiles()[i]; if (f.getAbsolutePath().contains(".class")) { f.delete(); } } }

Target:
public void close() { File dir = new File("."); for (int i = 0; i < dir.list().length; i++) { File f = dir.listFiles()[i]; if (f.getAbsolutePath().endsWith(".class")) { f.delete(); } } }
Source:
public DubboAppender() { super(); setFile("dubbo.log"); }

Target:
public DubboAppender() { super(); setFile(DEFAULT_FILE_NAME); }
Source:
protected void onPostExecute(Boolean result) { if(requestCode == FileDisplayActivity.REQUEST_CODE__SELECT_FILES_FROM_FILE_SYSTEM) { mCurrentDialog.dismiss(); mCurrentDialog = null; } if (result) { Intent data = new Intent(); if(requestCode == FileDisplayActivity.REQUEST_CODE__UPLOAD_FROM_CAMERA){ data.putExtra(EXTRA_CHOSEN_FILES,new String[]{ capturedImagePath}); } else { data.putExtra(EXTRA_CHOSEN_FILES, mFileListFragment.getCheckedFilePaths()); } SharedPreferences.Editor appPreferencesEditor = PreferenceManager .getDefaultSharedPreferences(getApplicationContext()).edit(); if(requestCode == FileDisplayActivity.REQUEST_CODE__UPLOAD_FROM_CAMERA){ setResult(RESULT_OK_AND_MOVE, data); appPreferencesEditor.putInt("prefs_uploader_behaviour", FileUploader.LOCAL_BEHAVIOUR_MOVE); } else { if (mRadioBtnMoveFiles.isChecked()) { setResult(RESULT_OK_AND_MOVE, data); appPreferencesEditor.putInt("prefs_uploader_behaviour", FileUploader.LOCAL_BEHAVIOUR_MOVE); } else { setResult(RESULT_OK, data); appPreferencesEditor.putInt("prefs_uploader_behaviour", FileUploader.LOCAL_BEHAVIOUR_COPY); } } appPreferencesEditor.apply(); finish(); } else { String[] args = {getString(R.string.app_name)}; ConfirmationDialogFragment dialog = ConfirmationDialogFragment.newInstance( R.string.upload_query_move_foreign_files, args, 0, R.string.common_yes, -1, R.string.common_no ); dialog.setOnConfirmationListener(UploadFilesActivity.this); dialog.show(getSupportFragmentManager(), QUERY_TO_MOVE_DIALOG_TAG); } }

Target:
protected void onPostExecute(Boolean result) { if(requestCode == FileDisplayActivity.REQUEST_CODE__SELECT_FILES_FROM_FILE_SYSTEM) { mCurrentDialog.dismiss(); mCurrentDialog = null; } if (result) { Intent data = new Intent(); SharedPreferences.Editor appPreferencesEditor = PreferenceManager .getDefaultSharedPreferences(getApplicationContext()).edit(); if(requestCode == FileDisplayActivity.REQUEST_CODE__UPLOAD_FROM_CAMERA){ data.putExtra(EXTRA_CHOSEN_FILES,new String[]{ capturedImagePath}); setResult(RESULT_OK_AND_MOVE, data); } else { data.putExtra(EXTRA_CHOSEN_FILES, mFileListFragment.getCheckedFilePaths()); if (mRadioBtnMoveFiles.isChecked()) { setResult(RESULT_OK_AND_MOVE, data); appPreferencesEditor.putInt("prefs_uploader_behaviour", FileUploader.LOCAL_BEHAVIOUR_MOVE); } else { setResult(RESULT_OK, data); appPreferencesEditor.putInt("prefs_uploader_behaviour", FileUploader.LOCAL_BEHAVIOUR_COPY); } } appPreferencesEditor.apply(); finish(); } else { String[] args = {getString(R.string.app_name)}; ConfirmationDialogFragment dialog = ConfirmationDialogFragment.newInstance( R.string.upload_query_move_foreign_files, args, 0, R.string.common_yes, -1, R.string.common_no ); dialog.setOnConfirmationListener(UploadFilesActivity.this); dialog.show(getSupportFragmentManager(), QUERY_TO_MOVE_DIALOG_TAG); } }
Source:
public FireBlast(final Location location, final Vector direction, final Player player, final int damage, final List<Block> safeBlocks) { super(player); if (location.getBlock().isLiquid()) { return; } this.setFields(); this.safeBlocks = safeBlocks; this.location = location.clone(); this.origin = location.clone(); this.direction = direction.clone().normalize(); int damageMod = 0; int rangeMod = 0; damageMod = (int) (this.getDayFactor(damage) - damage); rangeMod = (int) (this.getDayFactor(this.range) - this.range); damageMod = (int) (bPlayer.canUseSubElement(SubElement.BLUE_FIRE) ? (BlueFireAbility.getDamageFactor() * damage - damage) + damageMod : damageMod); rangeMod = (int) (bPlayer.canUseSubElement(SubElement.BLUE_FIRE) ? (BlueFireAbility.getRangeFactor() * range - range) + rangeMod : rangeMod); this.range += rangeMod; this.damage += damageMod; this.start(); }

Target:
public FireBlast(final Location location, final Vector direction, final Player player, final int damage, final List<Block> safeBlocks) { super(player); if (location.getBlock().isLiquid()) { return; } this.setFields(); this.safeBlocks = safeBlocks; this.location = location.clone(); this.origin = location.clone(); this.direction = direction.clone().normalize(); this.applyModifiers(); this.start(); }
Source:
public Job pop() throws IOException { final List<Job> jobs = this.pop(1); return (null != jobs) && (jobs.size() > 0) ? jobs.get(0) : null; }

Target:
public Job pop() throws IOException { final List<Job> jobs = this.pop(1); return (null != jobs) && (!jobs.isEmpty()) ? jobs.get(0) : null; }
Source:
public static int getUniqueNotificationId() { if (uniqueNotificationIdCounter == null) { uniqueNotificationIdCounter = new AtomicInteger(0); } return uniqueNotificationIdCounter.incrementAndGet(); }

Target:
public int getUniqueNotificationId() { return uniqueNotificationIdCounter.incrementAndGet(); }
Source:
private int validated(final int idx) { if (idx < 0) { throw new IllegalArgumentException("Index must be >= 0"); } if (idx >= this.all.size()) { throw new IllegalArgumentException( String.format( "Trying to return index %s from a list of %s passes", idx, this.all.size() ) ); } return idx; }

Target:
private int validated(final int idx) { if (idx < 0) { throw new IllegalArgumentException( String.format("Index %d must be >= 0.", idx) ); } if (idx >= this.all.size()) { throw new IllegalArgumentException( String.format( "Trying to return index %d from a list of %d passes", idx, this.all.size() ) ); } return idx; }
Source:
public double adjustmentToForwardRate( CmsPeriod cmsPeriod, RatesProvider provider, SabrParametersSwaptionVolatilities swaptionVolatilities) { CmsPeriod coupon = cmsPeriod.toBuilder().floorlet(null).caplet(null).build(); double adjustedForwardRate = adjustedForwardRate(coupon, provider, swaptionVolatilities); double forward = swapPricer.parRate(coupon.getUnderlyingSwap(), provider); return adjustedForwardRate - forward; }

Target:
public double adjustmentToForwardRate( CmsPeriod cmsPeriod, RatesProvider provider, SabrParametersSwaptionVolatilities swaptionVolatilities) { CmsPeriod coupon = cmsPeriod.toCouponEquivalent(); double adjustedForwardRate = adjustedForwardRate(coupon, provider, swaptionVolatilities); double forward = swapPricer.parRate(coupon.getUnderlyingSwap(), provider); return adjustedForwardRate - forward; }
Source:
public boolean equals(@Nullable Object obj) { if (!(obj instanceof DataDrivenValuePool)) { return false; } return true; }

Target:
public boolean equals(@Nullable Object obj) { return (obj == INSTANCE); }
Source:
private void removeBricks() { if (getSelectedItems() == null || getSelectedItems().isEmpty()) { return; } if (getWindow() != null) { return; } ConfirmationModel model = new ConfirmationModel(); setWindow(model); model.setTitle(ConstantsManager.getInstance().getConstants().removeBricksTitle()); model.setHashName("remove_bricks"); model.setMessage(ConstantsManager.getInstance().getConstants().removeBricksMessage()); if (getSelectedItems() == null) { return; } java.util.ArrayList<String> list = new java.util.ArrayList<String>(); for (GlusterBrickEntity item : Linq.<GlusterBrickEntity> Cast(getSelectedItems())) { list.add(item.getQualifiedName()); } model.setItems(list); UICommand command1 = new UICommand("OnRemove", this); command1.setTitle(ConstantsManager.getInstance().getConstants().ok()); command1.setIsDefault(true); model.getCommands().add(command1); UICommand command2 = new UICommand("Cancel", this); command2.setTitle(ConstantsManager.getInstance().getConstants().cancel()); command2.setIsCancel(true); model.getCommands().add(command2); }

Target:
private void removeBricks() { if (getSelectedItems() == null || getSelectedItems().isEmpty()) { return; } if (getWindow() != null) { return; } ConfirmationModel model = new ConfirmationModel(); setWindow(model); model.setTitle(ConstantsManager.getInstance().getConstants().removeBricksTitle()); model.setHashName("remove_bricks"); model.setMessage(ConstantsManager.getInstance().getConstants().removeBricksMessage()); java.util.ArrayList<String> list = new java.util.ArrayList<String>(); for (GlusterBrickEntity item : Linq.<GlusterBrickEntity> Cast(getSelectedItems())) { list.add(item.getQualifiedName()); } model.setItems(list); UICommand command1 = new UICommand("OnRemove", this); command1.setTitle(ConstantsManager.getInstance().getConstants().ok()); command1.setIsDefault(true); model.getCommands().add(command1); UICommand command2 = new UICommand("Cancel", this); command2.setTitle(ConstantsManager.getInstance().getConstants().cancel()); command2.setIsCancel(true); model.getCommands().add(command2); }
Source:
protected Set<Value.Immutable<?>> api$getVanillaValues() { final Set<Value.Immutable<?>> vanillaValues = super.api$getVanillaValues(); vanillaValues.add(this.castingTime().asImmutable()); if (this.activeSpell == SpellcastingIllagerEntity.SpellType.NONE) { this.currentSpell().map(Value::asImmutable).ifPresent(vanillaValues::add); } return vanillaValues; }

Target:
protected Set<Value.Immutable<?>> api$getVanillaValues() { final Set<Value.Immutable<?>> values = super.api$getVanillaValues(); values.add(this.castingTime().asImmutable()); this.currentSpell().map(Value::asImmutable).ifPresent(values::add); return values; }
Source:
public void onAttach(@NonNull Context context) { super.onAttach(context); viewModel = ViewModelProviders.of(requireActivity(), viewModelFactory).get(FormSaveViewModel.class); title = viewModel.getFormName(); if (title == null) { title = context.getString(R.string.no_form_loaded); } List<IconMenuItem> items; if ((boolean) AdminSharedPreferences.getInstance().get(AdminKeys.KEY_SAVE_MID)) { items = ImmutableList.of(new IconMenuItem(R.drawable.ic_save, R.string.keep_changes), new IconMenuItem(R.drawable.ic_delete, R.string.do_not_save)); } else { items = ImmutableList.of(new IconMenuItem(R.drawable.ic_delete, R.string.do_not_save)); } listView = DialogUtils.createActionListView(context); final IconMenuListAdapter adapter = new IconMenuListAdapter(context, items); listView.setAdapter(adapter); listView.setOnItemClickListener((parent, view, position, id) -> { IconMenuItem item = (IconMenuItem) adapter.getItem(position); if (item.getTextResId() == R.string.keep_changes) { viewModel.saveForm(getActivity().getIntent().getData(), InstancesDaoHelper.isInstanceComplete(false), null, true); } else { ExternalDataManager manager = Collect.getInstance().getExternalDataManager(); if (manager != null) { manager.close(); } if (viewModel.getAuditEventLogger() != null) { viewModel.getAuditEventLogger().logEvent(AuditEvent.AuditEventType.FORM_EXIT, true, System.currentTimeMillis()); } viewModel.removeTempInstance(); MediaManager.INSTANCE.revertChanges(); String action = getActivity().getIntent().getAction(); if (Intent.ACTION_PICK.equals(action) || Intent.ACTION_EDIT.equals(action)) { Uri uri = InstancesDaoHelper.getLastInstanceUri(viewModel.getAbsoluteInstancePath()); if (uri != null) { getActivity().setResult(RESULT_OK, new Intent().setData(uri)); } } getActivity().finish(); } if (getDialog() != null) { getDialog().dismiss(); } }); }

Target:
public void onAttach(@NonNull Context context) { super.onAttach(context); DaggerUtils.getComponent(context).inject(this); viewModel = new ViewModelProvider(requireActivity(), new FormSaveViewModel.Factory(analytics)) .get(FormSaveViewModel.class); }
Source:
public static Optional<String> reverseLookup(final InetAddress inetAddress) { checkSystemProperties(); if (!DnsUtils.enable) { return Optional.empty(); } final Lookup lookup = new Lookup(ReverseMap.fromAddress(inetAddress), Type.PTR); lookup.setResolver(resolver); final Record records[] = lookup.run(); if (lookup.getResult() == Lookup.SUCCESSFUL) { final PTRRecord ptrRecord = (PTRRecord) Arrays.stream(records) .filter(PTRRecord.class::isInstance) .findFirst() .orElseGet(null); if (ptrRecord != null && ptrRecord.getTarget() != null) { final String hostname = ptrRecord.getTarget().toString(); return Optional.of(hostname.substring(0, hostname.length() - 1)); } } return Optional.empty(); }

Target:
public static Optional<String> reverseLookup(final InetAddress inetAddress) { checkSystemProperties(); if (!DnsUtils.enable) { return Optional.empty(); } final Lookup lookup = new Lookup(ReverseMap.fromAddress(inetAddress), Type.PTR); lookup.setResolver(resolver); lookup.setCache(cache); final Record records[] = lookup.run(); if (lookup.getResult() == Lookup.SUCCESSFUL) { return Arrays.stream(records) .filter(PTRRecord.class::isInstance) .reduce((first, other) -> { LOG.warn("Reverse lookup of hostname got multiple results: {}", inetAddress); return first; }) .map(rr -> ((PTRRecord) rr).getTarget().toString()) .map(hostname -> hostname.substring(0, hostname.length() - 1)); } else { LOG.warn("Reverse lookup of hostname failed: {}", inetAddress); } return Optional.empty(); }
Source:
public void clearSanStorageModel() { if (getStorageDomain() == null) { this.setItems(null); } }

Target:
public void clearSanStorageModel() { if (getStorageDomain() == null) { setItems(null); } }
Source:
private static void testStartMaturityForSavingAccount() throws MambuApiException { methodName = new Object() {}.getClass().getEnclosingMethod().getName(); System.out.println("\nIn " + methodName); String accountId = NEW_ACCOUNT_ID; SavingsType savingAccountType = demoSavingsProduct.getProductType(); SavingsService savingService = MambuAPIFactory.getSavingsService(); AccountState accountState = savingService.getSavingsAccount(accountId).getAccountState(); if ((SavingsType.FIXED_DEPOSIT.equals(savingAccountType) || (SavingsType.SAVINGS_PLAN.equals(savingAccountType))) && (AccountState.ACTIVE.equals(accountState) || AccountState.DORMANT.equals(accountState))) { SavingsService service = MambuAPIFactory.getSavingsService(); Calendar now = Calendar.getInstance(); now.add(Calendar.DAY_OF_WEEK, 1); String notes = "Notes created through API=" + System.currentTimeMillis(); SavingsAccount updatedAccount = service.startMaturity(accountId, now.getTime(), notes); System.out.println("Started maturity for saving account, ID=" + updatedAccount.getId() + "\tName= " + updatedAccount.getName() + "\tCurrency=" + updatedAccount.getCurrencyCode() + "\tHolder Key=" + updatedAccount.getAccountHolderKey()); } else { System.out.println("WARNING: The test " + methodName + " wasn`t run due to account conditions."); } }

Target:
private static void testStartMaturityForSavingAccount() throws MambuApiException { methodName = new Object() {}.getClass().getEnclosingMethod().getName(); System.out.println("\nIn " + methodName); String accountId = NEW_ACCOUNT_ID; SavingsType savingAccountType = demoSavingsProduct.getProductType(); SavingsService savingService = MambuAPIFactory.getSavingsService(); AccountState accountState = savingService.getSavingsAccount(accountId).getAccountState(); if ((SavingsType.FIXED_DEPOSIT.equals(savingAccountType) || (SavingsType.SAVINGS_PLAN.equals(savingAccountType))) && (AccountState.ACTIVE.equals(accountState) || AccountState.DORMANT.equals(accountState))) { Calendar now = Calendar.getInstance(); now.add(Calendar.DAY_OF_WEEK, 1); String notes = "Notes created through API=" + System.currentTimeMillis(); SavingsAccount updatedAccount = savingService.startMaturity(accountId, now.getTime(), notes); System.out.println("Started maturity for saving account, ID=" + updatedAccount.getId() + "\tName= " + updatedAccount.getName() + "\tCurrency=" + updatedAccount.getCurrencyCode() + "\tHolder Key=" + updatedAccount.getAccountHolderKey()); } else { System.out.println("WARNING: The test " + methodName + " wasn`t run due to account conditions."); } }
Source:
public Response delete(@ApiParam(value = "Plan Id to update") @PathParam("id") Long id) throws PlanNotFoundException { planService.delete(id); return Response.ok().build(); }

Target:
public Response delete(@ApiParam(value = "Plan Id to update") @PathParam("id") Long id) throws PlanNotFoundException { return Response.ok(planService.delete(id)).build(); }
Source:
protected int getDataProviderSize() { if (fetchDisabled) { throw new IllegalStateException( "Data Communicator cannot get the items count from Data " + "Provider when the fetch is disabled. Please " + "enable it by calling " + "'dataCommunicator.setFetchDisabled(false)'"); } assert definedSize : "This method should never be called when using undefined size"; if (countCallback != null) { return countCallback.count(new Query(getFilter())); } else { return getDataProvider().size(new Query(getFilter())); } }

Target:
protected int getDataProviderSize() { assert definedSize : "This method should never be called when using undefined size"; if (countCallback != null) { return countCallback.count(new Query(getFilter())); } else { return getDataProvider().size(new Query(getFilter())); } }
Source:
public void setProjectProgress(int projectId, int progress) { final String whereClause = String.format("%s=?", ProjectContract.ProjectEntry._ID); String projectIdString = String.valueOf(projectId); SQLiteDatabase db = getReadableDatabase(); ContentValues contentValues = new ContentValues(); contentValues.put(ProjectContract.ProjectEntry.PROJECT_PROGRESS, progress); db.update(ProjectContract.ProjectEntry.TABLE_PROJECT, contentValues, whereClause, new String[]{projectIdString}); db.close(); }

Target:
public void setProjectProgress(int projectId, int progress) { final String whereClause = String.format("%s=?", ProjectContract.ProjectEntry._ID); String projectIdString = String.valueOf(projectId); SQLiteDatabase db = getReadableDatabase(); ContentValues contentValues = new ContentValues(); contentValues.put(ProjectContract.ProjectEntry.PROJECT_PROGRESS, progress); db.update(ProjectContract.ProjectEntry.TABLE_PROJECT, contentValues, whereClause, new String[]{projectIdString}); }
Source:
public void addTreatment(String experimentName, String treatmentName, String description) { resource( ENDPOINT_TREATMENTS, ImmutableMap.of( PARAM_EXPERIMENT_NAME, experimentName ) ).put(Entity.entity(new TreatmentDto(treatmentName, description), MediaType.APPLICATION_JSON_TYPE)); }

Target:
public void addTreatment(String experimentName, String treatmentName, String description) { resource( ENDPOINT_TREATMENTS, ImmutableMap.of( PARAM_EXPERIMENT_NAME, experimentName ) ).put(Entity.json(new TreatmentDto(treatmentName, description))); }
Source:
public Histogram<HKEY> getHistogram(final int index) { if (histograms.size() > 0 && index < this.histograms.size()) return this.histograms.get(index); else return null; }

Target:
public Histogram<HKEY> getHistogram(final int index) { try { return this.histograms.get(index); } catch (final ArrayIndexOutOfBoundsException excep) { throw new SAMException("Index is out of bounds: " + index); } }
Source:
public StateChange getDefaultInstance() { return new SetViewportToSizeOf(new ResourceUrn("engine:sceneOpaque"), CoreRegistry.get(DisplayResolutionDependentFBOs.class)); }

Target:
public StateChange getDefaultInstance() { if (defaultInstance == null) { defaultInstance = new SetViewportToSizeOf(READONLY_GBUFFER, CoreRegistry.get(DisplayResolutionDependentFBOs.class)); } return defaultInstance; }
Source:
public boolean filter(ScriptDTO script) { boolean result = true; if (!containCommercialApplications.getValue()) { result &= script.isFree(); } if (containRequiresPatchApplications.getValue()) { result &= !script.isRequiresPatch(); } if (!containTestingApplications.getValue()) { result &= CollectionUtils.isEmpty(script.getTestingOperatingSystems()); } if (!containAllOSCompatibleApplications.getValue()) { result &= script.getCompatibleOperatingSystems() .contains(operatingSystemFetcher.fetchCurrentOperationSystem()); } return result; }

Target:
public boolean filter(ScriptDTO script) { boolean result = true; if (!containCommercialApplications.getValue()) { result &= script.isFree(); } if (containRequiresPatchApplications.getValue()) { result &= !script.isRequiresPatch(); } if (!containTestingApplications.getValue()) { result &= CollectionUtils.isEmpty(script.getTestingOperatingSystems()); } if (!containAllOSCompatibleApplications.getValue()) { result &= !CollectionUtils.isEmpty(script.getCompatibleOperatingSystems()) && script .getCompatibleOperatingSystems().contains(operatingSystemFetcher.fetchCurrentOperationSystem()); } return result; }
Source:
public String createLoadBalancer(String name){ CreateLoadBalancerRequest lbRequest = new CreateLoadBalancerRequest(); lbRequest.setLoadBalancerName(name); lbRequest.withAvailabilityZones(elbAzs.split(",")); List<Listener> listeners = new ArrayList(); listeners.add(new Listener(elbProtocol, elbPortIn, elbPortOut)); lbRequest.setListeners(listeners); CreateLoadBalancerResult lbResult=elb.createLoadBalancer(lbRequest); lbResult.getDNSName(); appendText(lbResult.getDNSName() + "\n", elbFile); return lbRequest.getLoadBalancerName(); }

Target:
public String createLoadBalancer(String name){ CreateLoadBalancerRequest lbRequest = new CreateLoadBalancerRequest(); lbRequest.setLoadBalancerName(name); lbRequest.withAvailabilityZones(elbAvailabilityZones.split(",")); List<Listener> listeners = new ArrayList(); listeners.add(new Listener(elbProtocol, elbPortIn, elbPortOut)); lbRequest.setListeners(listeners); CreateLoadBalancerResult lbResult=elb.createLoadBalancer(lbRequest); lbResult.getDNSName(); appendText(lbResult.getDNSName() + "\n", elbFile); return lbRequest.getLoadBalancerName(); }
Source:
public SignatureKeyPairImpl create(SignatureKeyPairImpl keyPair) throws ConflictException, ServerException { requireNonNull(keyPair, "Required non-null key pair"); try { doCreate(keyPair); } catch (org.eclipse.che.core.db.jpa.IntegrityConstraintViolationException x) { throw new ConflictException( format( "Workspace with id '%s' referenced by signature key pair doesn't exist", keyPair.getWorkspaceId())); } catch (DuplicateKeyException dkEx) { throw new ConflictException( format("Signature key pair for workspace '%s' already exists", keyPair.getWorkspaceId())); } catch (RuntimeException ex) { throw new ServerException(ex.getMessage(), ex); } return new SignatureKeyPairImpl(keyPair); }

Target:
public SignatureKeyPairImpl create(SignatureKeyPairImpl keyPair) throws ConflictException, ServerException { requireNonNull(keyPair, "Required non-null key pair"); try { doCreate(keyPair); } catch (IntegrityConstraintViolationException x) { throw new ConflictException( format( "Unable to create signature key pair because referenced workspace with id '%s' doesn't exist", keyPair.getWorkspaceId())); } catch (DuplicateKeyException dkEx) { throw new ConflictException( format("Signature key pair for workspace '%s' already exists", keyPair.getWorkspaceId())); } catch (RuntimeException ex) { throw new ServerException(ex.getMessage(), ex); } return new SignatureKeyPairImpl(keyPair); }
Source:
void start() { if (!started) { log.info("Starting prefetching thread."); executorService.execute(new DefaultGetRecordsCacheDaemon()); } started = true; }

Target:
public void start() { if (!started) { log.info("Starting prefetching thread."); executorService.execute(new DefaultGetRecordsCacheDaemon()); } started = true; }