auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private static Request parse(final InputStream input) throws IOException { <START> final List<String> head = new LinkedList<String>(); <END> final ByteArrayOutputStream baos = new ByteArrayOutputStream(); while (true) { final int data = input.read(); if (data < 0) { break; } if (data == '\r') { if (input.read() != '\n') { throw new HttpException( HttpURLConnection.HTTP_BAD_REQUEST, String.format( "there is no LF after CR in header, line #%d: \"%s\"", head.size() + 1, new String(baos.toByteArray()) ) ); } if (baos.size() == 0) { break; } final String header = new String(baos.toByteArray()); checkAndAddHeader(head, header); baos.reset(); continue; } if ((data > 0x7f || data < 0x20) && data != '\t') { throw new HttpException( HttpURLConnection.HTTP_BAD_REQUEST, String.format( "illegal character 0x%02X in HTTP header line #%d: \"%s\"", data, head.size() + 1, new String(baos.toByteArray()) ) ); } baos.write(data); } return new Request() { @Override public Iterable<String> head() { return head; } @Override public InputStream body() { return input; } }; }</code><technical_language>@lautarobock this changed List? I List specific operations</technical_language>

Target:
private static Request parse(final InputStream input) throws IOException { final List<String> head = new LinkedList<String>(); final ByteArrayOutputStream baos = new ByteArrayOutputStream(); Opt<Integer> data = new Opt.Empty<Integer>(); while (true) { data = data(input, data); if (data.get() < 0) { break; } if (data.get() == '\r') { if (input.read() != '\n') { throw new HttpException( HttpURLConnection.HTTP_BAD_REQUEST, String.format( "there is no LF after CR in header, line #%d: \"%s\"", head.size() + 1, new String(baos.toByteArray()) ) ); } if (baos.size() == 0) { break; } data = new Opt.Single<Integer>(input.read()); if (data.get() != ' ' && data.get() != '\t') { head.add(new String(baos.toByteArray())); baos.reset(); } continue; } if ((data.get() > 0x7f || data.get() < 0x20) && data.get() != '\t') { throw new HttpException( HttpURLConnection.HTTP_BAD_REQUEST, String.format( "illegal character 0x%02X in HTTP header line #%d: \"%s\"", data.get(), head.size() + 1, new String(baos.toByteArray()) ) ); } baos.write(data.get()); data = new Opt.Empty<Integer>(); } return new Request() { @Override public Iterable<String> head() { return head; } @Override public InputStream body() { return input; } }; }
Source:
<code>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); <START> createClientSession(kcSession, realm.getClientByClientId("test-app"), sessions[0], "http://redirect", "state"); <END> 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; }</code><technical_language>I this class's test method check types of entities (user session, client session) : * transactions (InfinispanChangelogBasedTransaction) * committed cache (sessionCache, clientSessionCache). modified createSessions() created sessions committed cache. afraid affect other tests try check some entities transactions</technical_language>

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:
<code>private ValueHolder<V> getInternal(K key) throws StoreAccessException, TimeoutException { <START> ClusteredValueHolder<V> holder = null; <END> 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; }</code><technical_language>Code formatting</technical_language>

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:
<code>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; <START> addService(apexPluginDispatcher); <END> }</code><technical_language>is a working assumption plugin manager is dispatcher. combine ApexPluginManager implement dispatcher add a method in manager return a dispatcher. In current implementation of interface return itself. In future, if flexibility is needed separated bootstrapped well</technical_language>

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:
<code><START> public void testSimpleTrue() throws Exception { <END> 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); }</code><technical_language>this test rewritten</technical_language>

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:
<code>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"); <START> } catch (Exception e) { <END> 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; }</code><technical_language>try/catch for process flow is nice. check some condition? please catch exceptions (IOException here)</technical_language>

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:
<code>public void canBeSerializedAndDeserialize() throws Exception { <START> Lease lease = Lease.of(leaderTime, Duration.ZERO); <END> String serialized = objectMapper.writeValueAsString(lease); Lease deserialized = objectMapper.readValue(serialized, Lease.class); assertThat(deserialized).isEqualTo(lease); }</code><technical_language>re: serialization test; worth example string verify consistent serialization, recommend a non-zero duration (because zero frequently serialized a codepath other things)</technical_language>

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:
<code>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); <START> scrolled = false; <END> } return super.gtk_draw(widget, cairo); }</code><technical_language>paranoia: set false, *after* call GTK.gtk_widget_queue_draw(widget);</technical_language>

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:
<code><START> public SinglePortHostnameBuilder( <END> String externalAddress, String internalAddress, String wildcardHost) { this.externalAddress = externalAddress; this.internalAddress = internalAddress; this.wildcardHost = wildcardHost; }</code><technical_language>cover this class unit tests</technical_language>

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

Target:
public void startHtlElement(List<Expression> expressions, TagNode node) { if (!isConditionReusedCorrectly(expressions, node)) { createViolation(node.getStartLinePosition(), RULE_MESSAGE); } updateConditionSets(expressions, node); }
Source:
<code>protected DragSource createDragSource(Control control) { if (isDragEnabled()) { return new DragSource(control, DND.DROP_COPY | DND.DROP_MOVE); } else { <START> return null; <END> } }</code><technical_language>omit explicit else-case "return null" instead</technical_language>

Target:
protected DragSource createDragSource(Control control) { if (isDragEnabled()) { return new DragSource(control, DND.DROP_COPY | DND.DROP_MOVE); } return null; }
Source:
<code>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(); <START> pinDialog.typePinTypeTitle(InteractiveMapsContent.pinTypeName,0); <END> InteractiveMapPageObject createdMap = pinDialog.clickSave(); createdMap.verifyCreatedMapTitle(InteractiveMapsContent.mapName); createdMap.verifyMapOpened(); createdMap.verifyCreatedPins(InteractiveMapsContent.pinTypeName); }</code><technical_language>move 0 private constant in lines, easier change in future if needed</technical_language>

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:
<code>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 <START> && !((Control) container.getWidget()).isDisposed()) { <END> toolItem.setVisible(isChildVisible(item)); container.getChildren().remove(toolItem); } container.getChildren().add(toolItem); } } }</code><technical_language>do need check for widget setting model element's visibiliyt</technical_language>

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:
<code>public Object execute(Object[] parameters) { ParametersParameterAccessor accessor = new ParametersParameterAccessor(queryMethod.getParameters(), parameters); <START> StringQuery stringQuery = createQuery(accessor); <END> 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); }</code><technical_language>do reducing this PR introducing new SearchHit/SearchHits/ types only? I agree method changes a fit for a separate PR</technical_language>

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:
<code>public void testBackButtonPressed() { myTestActivity.dispatchKeyEvent(new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_BACK)); <START> assertTrue(!myTestActivity.getRootPageFragment().isAdded()); <END> }</code><technical_language>assertFalse perhaps</technical_language>

Target:
public void testBackButtonPressed() { myTestActivity.dispatchKeyEvent(new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_BACK)); assertFalse(myTestActivity.getRootPageFragment().isAdded()); }
Source:
<code>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()); <START> dataInputStream.readFully(bytes); <END> String base64EncodedImage = Base64.encodeBase64String(bytes); return "data:" + resourceStream.getContentType() + ";base64," + base64EncodedImage.replaceAll("\\s", ""); }</code><technical_language>org.apache.wicket.util.io.IOUtils#toByteArray(java.io.InputStream) instead</technical_language>

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:
<code><START> public void instrumentTaggedAsyncFunctionWithExtraTags() throws InterruptedException, ExecutionException { <END> 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); }</code><technical_language>Copied code - a common method factored out</technical_language>

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:
<code>private List<ReportMetadataInfo> generateReportsFromReportsResponse(List<ReportMetadataJson> reportResponses) { if (reportResponses == null) { <START> return Collections.emptyList(); <END> } List<ReportMetadataInfo> reportsInfoList = new ArrayList<>(); for (ReportMetadataJson reportResponse : reportResponses) { reportsInfoList.add(populateReportMetadataInfo(reportResponse)); } return reportsInfoList; }</code><technical_language>is more readable return statement in method</technical_language>

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:
<code>public void close() { File dir = new File("."); for (int i = 0; i < dir.list().length; i++) { File f = dir.listFiles()[i]; <START> if (f.getAbsolutePath().contains(".class")) { <END> f.delete(); } } }</code><technical_language>endsWith instead? .class in part of string</technical_language>

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:
<code>public DubboAppender() { super(); <START> setFile("dubbo.log"); <END> }</code><technical_language>read this constant some config</technical_language>

Target:
public DubboAppender() { super(); setFile(DEFAULT_FILE_NAME); }
Source:
<code>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(); <START> } else { <END> 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); } }</code><technical_language>condition if(requestCode == FileDisplayActivity.REQUEST_CODE__UPLOAD_FROM_CAMERA){ set params, is unify code</technical_language>

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:
<code>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(); <START> 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; <END> this.start(); }</code><technical_language>simply times damage range blue fire multiplier, 1 if blue fire? This more pointlessly complex</technical_language>

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:
<code>public Job pop() throws IOException { final List<Job> jobs = this.pop(1); <START> return (null != jobs) && (jobs.size() > 0) ? jobs.get(0) : null; <END> }</code><technical_language>isEmpty well</technical_language>

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

Target:
public int getUniqueNotificationId() { return uniqueNotificationIdCounter.incrementAndGet(); }
Source:
<code>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( <START> "Trying to return index %s from a list of %s passes", <END> idx, this.all.size() ) ); } return idx; }</code><technical_language>@xupyprmv %d printing numbers</technical_language>

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:
<code>public double adjustmentToForwardRate( CmsPeriod cmsPeriod, RatesProvider provider, SabrParametersSwaptionVolatilities swaptionVolatilities) { <START> CmsPeriod coupon = cmsPeriod.toBuilder().floorlet(null).caplet(null).build(); <END> double adjustedForwardRate = adjustedForwardRate(coupon, provider, swaptionVolatilities); double forward = swapPricer.parRate(coupon.getUnderlyingSwap(), provider); return adjustedForwardRate - forward; }</code><technical_language>Suggest adding a method CmsPeriod do this, hide of nulls. toCouponEquivalent()</technical_language>

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:
<code><START> public boolean equals(@Nullable Object obj) { <END> if (!(obj instanceof DataDrivenValuePool)) { return false; } return true; }</code><technical_language>is this a singleton? if so, one</technical_language>

Target:
public boolean equals(@Nullable Object obj) { return (obj == INSTANCE); }
Source:
<code>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; <START> } <END> 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); }</code><technical_language>duplicated (see line 138)</technical_language>

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:
<code>protected Set<Value.Immutable<?>> api$getVanillaValues() { final Set<Value.Immutable<?>> vanillaValues = super.api$getVanillaValues(); vanillaValues.add(this.castingTime().asImmutable()); <START> if (this.activeSpell == SpellcastingIllagerEntity.SpellType.NONE) { <END> this.currentSpell().map(Value::asImmutable).ifPresent(vanillaValues::add); } return vanillaValues; }</code><technical_language>Providers filter SpellType.NONE, call api method for current spell ifPresent if is empty not</technical_language>

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:
<code>public void onAttach(@NonNull Context context) { super.onAttach(context); viewModel = ViewModelProviders.of(requireActivity(), viewModelFactory).get(FormSaveViewModel.class); <START> title = viewModel.getFormName(); <END> 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(); } }); }</code><technical_language>this view initialization in onCreateDialog instead of need title listView fields</technical_language>

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:
<code>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) <START> .findFirst() <END> .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(); }</code><technical_language>check records length log a WARN INFO if more record returned? This need implement logging flood control</technical_language>

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:
<code>public void clearSanStorageModel() { <START> if (getStorageDomain() == null) { <END> this.setItems(null); } }</code><technical_language>want for edit? i.e. do a similar issue in vms->disk->edit</technical_language>

Target:
public void clearSanStorageModel() { if (getStorageDomain() == null) { setItems(null); } }
Source:
<code>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))) { <START> SavingsService service = MambuAPIFactory.getSavingsService(); <END> 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."); } }</code><technical_language>instance of SavingsService line 208. instead of creating a brand new one</technical_language>

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:
<code>public Response delete(@ApiParam(value = "Plan Id to update") @PathParam("id") Long id) throws PlanNotFoundException { planService.delete(id); <START> return Response.ok().build(); <END> }</code><technical_language>good consistent MigrationResource return deleted entity in a response well</technical_language>

Target:
public Response delete(@ApiParam(value = "Plan Id to update") @PathParam("id") Long id) throws PlanNotFoundException { return Response.ok(planService.delete(id)).build(); }
Source:
<code>protected int getDataProviderSize() { <START> if (fetchDisabled) { <END> 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())); } }</code><technical_language>Again, weird for a data view API user work for another component, for another</technical_language>

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())); } }