auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void testMultipleBlockRemoveNotify() throws InterruptedException { final int numOfObserver = 3; final int numOfBlockPut = 10; final int numOfKeysPerBlock = 10; final int timeoutInMillisecond = 500; final int blockIdBase = 0x80; final CountDownLatch countDownLatch = new CountDownLatch(numOfObserver * numOfBlockPut); final MemoryStoreImpl memoryStoreImpl = (MemoryStoreImpl) memoryStore; for (int i = 0; i < numOfObserver; i++) { final MemoryStoreTestUtils.BlockRemoveListenerImpl listener = new MemoryStoreTestUtils.BlockRemoveListenerImpl(countDownLatch, numOfKeysPerBlock); memoryStore.registerBlockUpdateListener(listener); } <START> <END> for (int i = 0; i < numOfBlockPut; i++) { final int blockId = blockIdBase + i; final Map<Long, Object> data = new HashMap<>(); final long keyIdStart = (numOfKeysPerBlock * blockId); for (int j = 0; j < numOfKeysPerBlock; j++) { final long keyId = keyIdStart + j; data.put(keyId, new Long(keyId)); } memoryStoreImpl.putBlock(blockId, data); } for (int i = 0; i < numOfBlockPut; i++) { final int blockId = blockIdBase + i; memoryStoreImpl.removeBlock(blockId); } countDownLatch.await(timeoutInMillisecond, TimeUnit.MILLISECONDS); assertEquals(0, countDownLatch.getCount()); }</code><technical_language>Redundant blank line</technical_language>

Target:
public void testMultipleBlockRemoveNotify() throws InterruptedException { final int numOfObserver = 3; final int numOfBlockPut = 10; final int numOfKeysPerBlock = 10; final int timeoutMS = 500; final int blockIdBase = 0x80; final CountDownLatch countDownLatch = new CountDownLatch(numOfObserver * numOfBlockPut); final MemoryStoreImpl memoryStoreImpl = (MemoryStoreImpl) memoryStore; for (int i = 0; i < numOfObserver; i++) { final BlockUpdateListener listener = new MemoryStoreTestUtils.BlockUpdateListenerImpl(null, countDownLatch, numOfKeysPerBlock); memoryStore.registerBlockUpdateListener(listener); } for (int i = 0; i < numOfBlockPut; i++) { final int blockId = blockIdBase + i; final Map<Long, Object> data = new HashMap<>(); final long keyIdStart = (numOfKeysPerBlock * blockId); for (int keyOffset = 0; keyOffset < numOfKeysPerBlock; keyOffset++) { final long keyId = keyIdStart + keyOffset; data.put(keyId, keyId); } memoryStoreImpl.putBlock(blockId, data); } for (int i = 0; i < numOfBlockPut; i++) { final int blockId = blockIdBase + i; memoryStoreImpl.removeBlock(blockId); } assertTrue(countDownLatch.await(timeoutMS, TimeUnit.MILLISECONDS)); }
Source:
<code>public void stop() { <START> nettyServer.ifPresent(n -> n.stop()); <END> nettyServer = Optional.empty(); ip = Optional.empty(); port = Optional.empty(); }</code><technical_language>NettyJaxrsServer::stop</technical_language>

Target:
public void stop() { nettyServer.ifPresent(NettyJaxrsServer::stop); nettyServer = Optional.empty(); ip = Optional.empty(); port = Optional.empty(); }
Source:
<code>public void delete(int operatorId, long windowId) throws IOException { if (!getStore().isConnected()) { getStore().connect(); } try { store.remove(generateKey(operatorId, windowId)); logger.info("deleted object from store key region {}", generateKey(operatorId, windowId)); <START> } catch (Throwable t) { <END> logger.info("while deleting {}", operatorId, windowId, t); DTThrowable.rethrow(t); } }</code><technical_language>catch Throwable</technical_language>

Target:
public void delete(int operatorId, long windowId) throws IOException { if (!getStore().isConnected()) { getStore().connect(); } try { getStore().remove(generateKey(operatorId, windowId)); logger.debug("deleted object from store key region {}", generateKey(operatorId, windowId)); } catch (Exception ex) { throw new RuntimeException(ex); } }
Source:
<code>private void setupAsyncResponse(AsyncResponse asyncResponse, ListenableFuture<Response> future) { bindAsyncResponse(asyncResponse, future, executor) .withTimeout(ASYNC_TIMEOUT, () -> Response .status(Status.BAD_GATEWAY) .type(TEXT_PLAIN_TYPE) .entity("Request to remote Presto server timed out") <START> .build()); <END> }</code><technical_language>encrypt</technical_language>

Target:
private void setupAsyncResponse(AsyncResponse asyncResponse, ListenableFuture<Response> future) { bindAsyncResponse(asyncResponse, future, executor) .withTimeout(ASYNC_TIMEOUT, () -> Response .status(BAD_GATEWAY) .type(TEXT_PLAIN_TYPE) .entity("Request to remote Presto server timed out after" + ASYNC_TIMEOUT) .build()); }
Source:
<code>public Expression between(@NonNull Expression expression1, @NonNull Expression expression2) { <START> if(expression1 == null || expression2 == null) { <END> throw new IllegalArgumentException("expression is null"); } Expression aggr = new AggregateExpression(Arrays.asList(expression1, expression2)); return new BinaryExpression(this, aggr, BinaryExpression.OpType.Between); }</code><technical_language>2 if variable name in message accurate</technical_language>

Target:
public Expression between(@NonNull Expression expression1, @NonNull Expression expression2) { if (expression1 == null || expression2 == null) { throw new IllegalArgumentException("expression1 or expression2 is null."); } Expression aggr = new AggregateExpression(Arrays.asList(expression1, expression2)); return new BinaryExpression(this, aggr, BinaryExpression.OpType.Between); }
Source:
<code><START> private boolean isVmNameUnique(ImportVmData data) { for (Object item : getItems()) { ImportVmData importVmData = (ImportVmData) item; if (data != importVmData && data.getVm().getName().equals(importVmData.getVm().getName())) { return false; } } return true; <END> }</code><technical_language>this written in : <LINK_0> return getEntities().getItems() .stream() .noneMatch(item -> data != (importVmData) item && data.getVm().getName().equals(((ImportVmData)item).getVm().getName());</technical_language>

Target:
private boolean isVmNameUnique(ImportVmData data) { return getItems().stream().noneMatch(item -> data != item && data.getVm().getName().equals(((ImportVmData) item).getVm().getName())); }
Source:
<code>public void doVersionUpgradeImport(ImportMigrationContext context) { final ImportMigrationConfigurationAdminContext adminContext = new ImportMigrationConfigurationAdminContext( context, this, configurationAdmin, getConfigurations(context), false); adminContext .memoryEntries() <START> .filter( <END> s -> (s.getFactoryPid() != null && s.getFactoryPid().equals(CONTENT_DIRECTORY_MONITOR_FPID)) || s.getPid().equals(URL_RESOURCE_READER_PID)) .forEach(ImportMigrationConfigurationAdminEntry::restore); }</code><technical_language>Time crate a private method receives entry returns true false put filter. This stream more readable</technical_language>

Target:
public void doVersionUpgradeImport(ImportMigrationContext context) { final ImportMigrationConfigurationAdminContext adminContext = new ImportMigrationConfigurationAdminContext( context, this, configurationAdmin, getConfigurations(context), false); adminContext .memoryEntries() .filter( s -> CONTENT_DIRECTORY_MONITOR_FPID.equals(s.getFactoryPid()) || s.getPid().equals(URL_RESOURCE_READER_PID)) .forEach(ImportMigrationConfigurationAdminEntry::restore); }
Source:
<code>public LandmarkStorage(GraphHopperStorage graph, Directory dir, int landmarks, final Weighting weighting, TraversalMode traversalMode) { this.graph = graph; this.minimumNodes = Math.min(graph.getNodes() / 2, 500_000); this.encoder = weighting.getFlagEncoder(); this.weighting = weighting; <START> this.lmSelectionWeighting = new ShortestWeighting(encoder) { <END> @Override public double calcWeight(EdgeIteratorState edge, boolean reverse, int prevOrNextEdgeId) { double res = weighting.calcWeight(edge, reverse, prevOrNextEdgeId); if (res >= Double.MAX_VALUE) return Double.POSITIVE_INFINITY; return edge.getDistance(); } }; this.traversalMode = TraversalMode.NODE_BASED; final String name = AbstractWeighting.weightingToFileName(weighting); this.landmarkWeightDA = dir.find("landmarks_" + name); this.landmarks = landmarks; this.LM_ROW_LENGTH = landmarks * 4; this.FROM_OFFSET = 0; this.TO_OFFSET = 2; this.landmarkIDs = new ArrayList<>(); this.subnetworkStorage = new SubnetworkStorage(dir, "landmarks_" + name); }</code><technical_language>sense optionally provide weighting for preparation. sense for cases shorter distance need weight</technical_language>

Target:
public LandmarkStorage(GraphHopperStorage graph, Directory dir, int landmarks, final Weighting weighting, TraversalMode traversalMode) { this.graph = graph; this.minimumNodes = Math.min(graph.getNodes() / 2, 500_000); this.encoder = weighting.getFlagEncoder(); this.weighting = weighting; this.lmSelectionWeighting = new ShortestWeighting(encoder) { @Override public double calcWeight(EdgeIteratorState edge, boolean reverse, int prevOrNextEdgeId) { double res = weighting.calcWeight(edge, reverse, prevOrNextEdgeId); if (res >= Double.MAX_VALUE) return Double.POSITIVE_INFINITY; return 1; } @Override public String toString() { return "LM_BFS|" + encoder; } }; this.traversalMode = TraversalMode.NODE_BASED; final String name = AbstractWeighting.weightingToFileName(weighting); this.landmarkWeightDA = dir.find("landmarks_" + name); this.landmarks = landmarks; this.LM_ROW_LENGTH = landmarks * 4; this.FROM_OFFSET = 0; this.TO_OFFSET = 2; this.landmarkIDs = new ArrayList<>(); this.subnetworkStorage = new SubnetworkStorage(dir, "landmarks_" + name); }
Source:
<code>public boolean onOptionsItemSelected(MenuItem item) { <START> Fragment currentFragment = getSupportFragmentManager().findFragmentByTag("currentContent"); <END> if (item.getItemId() == android.R.id.home && !(currentFragment instanceof ConnectFragment)) { toggle(); if(getSlidingMenu().isMenuShowing() && menu.isAdded()){ setTitle(((ITitleable)menu).getTitle()); } return true; } return false; }</code><technical_language>put string "currentContent" place reference in transitions</technical_language>

Target:
public boolean onOptionsItemSelected(MenuItem item) { Fragment currentFragment = getSupportFragmentManager().findFragmentByTag(Transitions.currentContent); if (item.getItemId() == android.R.id.home && !(currentFragment instanceof ConnectFragment)) { toggle(); if(getSlidingMenu().isMenuShowing() && menu.isAdded()){ setTitle(((ITitleable)menu).getTitle()); } return true; } return false; }
Source:
<code>private static byte[][] generateCache() { <START> return new byte[40][Fragment.MAX_LENGTH]; <END> }</code><technical_language>40</technical_language>

Target:
private static byte[][] generateCache() { return new byte[Chunk.MAX_SIZE/Fragment.MAX_LENGTH][Fragment.MAX_LENGTH]; }
Source:
<code>public void testScanningForPackfiles() throws Exception { ObjectId unknownID = ObjectId .fromString("c0ffee09d0b63d694bf49bc1e6847473f42d4a8c"); GC gc = new GC(db); gc.setExpireAgeMillis(0); gc.setPackExpireAgeMillis(0); try (FileRepository receivingDB = new FileRepository( db.getDirectory())) { FileBasedConfig cfg = receivingDB.getConfig(); cfg.setBoolean(ConfigConstants.CONFIG_CORE_SECTION, null, ConfigConstants.CONFIG_KEY_TRUSTFOLDERSTAT, true); cfg.save(); ObjectId id = commitFile("file.txt", "test", "master").getId(); gc.gc(); assertFalse(receivingDB.hasObject(unknownID)); assertTrue(receivingDB.getObjectDatabase().hasPackedObject(id)); File packsFolder = new File(receivingDB.getObjectsDirectory(), "pack"); File tmpFile = new File(packsFolder, "1.tmp"); RevCommit id2 = commitFile("file.txt", "test2", "master"); fsTick(null); assertTrue(tmpFile.createNewFile()); assertFalse(receivingDB.hasObject(unknownID)); gc.gc(); Thread.sleep(2600); assertFalse(receivingDB.hasObject(unknownID)); assertTrue(receivingDB.hasObject(id2)); <START> } catch (IOException e) { <END> e.printStackTrace(); } }</code><technical_language>I need handle exceptions in this test</technical_language>

Target:
public void testScanningForPackfiles() throws Exception { ObjectId unknownID = ObjectId .fromString("c0ffee09d0b63d694bf49bc1e6847473f42d4a8c"); GC gc = new GC(db); gc.setExpireAgeMillis(0); gc.setPackExpireAgeMillis(0); try (FileRepository receivingDB = new FileRepository( db.getDirectory())) { FileBasedConfig cfg = receivingDB.getConfig(); cfg.setBoolean(ConfigConstants.CONFIG_CORE_SECTION, null, ConfigConstants.CONFIG_KEY_TRUSTFOLDERSTAT, true); cfg.save(); ObjectId id = commitFile("file.txt", "test", "master").getId(); gc.gc(); assertFalse(receivingDB.hasObject(unknownID)); assertTrue(receivingDB.getObjectDatabase().hasPackedObject(id)); File packsFolder = new File(receivingDB.getObjectsDirectory(), "pack"); File tmpFile = new File(packsFolder, "1.tmp"); RevCommit id2 = commitFile("file.txt", "test2", "master"); fsTick(null); assertTrue(tmpFile.createNewFile()); assertFalse(receivingDB.hasObject(unknownID)); gc.gc(); Thread.sleep(2600); File[] ret = packsFolder.listFiles(new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.endsWith(".pack"); } }); assertTrue(ret.length == 1); Assume.assumeTrue(tmpFile.lastModified() == ret[0].lastModified()); assertFalse(receivingDB.hasObject(unknownID)); assertTrue(receivingDB.hasObject(id2)); } }
Source:
<code>private List<IResource> computeRelated(List<? extends IResource> selection) { if (selection.contains(ResourcesPlugin.getWorkspace().getRoot())) { return new ArrayList<>(); } DisjointSet<IProject> set = buildConnectedComponents(ResourcesPlugin.getWorkspace().getRoot().getProjects()); for (IResource resource : selection) { <START> set.removeSet(resource); <END> } List<IResource> projects = new ArrayList<>(); set.toList(projects); return projects; }</code><technical_language>this sense if selection consists of files folders. bug, want is: 1) project = resource.getProject() 2) if project != null set.removeProject()</technical_language>

Target:
private List<IResource> computeRelated(List<? extends IResource> selection) { if (selection.contains(ResourcesPlugin.getWorkspace().getRoot())) { return new ArrayList<>(); } DisjointSet<IProject> set = buildConnectedComponents(ResourcesPlugin.getWorkspace().getRoot().getProjects()); for (IResource resource : selection) { IProject project = resource.getProject(); if (project != null) { set.removeSet(project); } } List<IResource> projects = new ArrayList<>(); set.toList(projects); return projects; }
Source:
<code>public String toString() { <START> return this.name; <END> }</code><technical_language>want similar id</technical_language>

Target:
public String toString() { return this.moduleId; }
Source:
<code>public AppsDataPair loadInBackground() { List<ApplicationInfo> apps = packageManager.getInstalledApplications( PackageManager.MATCH_UNINSTALLED_PACKAGES | PackageManager.MATCH_DISABLED_UNTIL_USED_COMPONENTS); if (apps == null) return new AppsDataPair(Collections.emptyList(), Collections.emptyList()); mApps = new AppsDataPair(new ArrayList<>(apps.size()), new ArrayList<>(apps.size())); for (ApplicationInfo object : apps) { <START> if (object.sourceDir != null) { <END> File sourceDir = new File(object.sourceDir); String label = object.loadLabel(packageManager).toString(); PackageInfo info; try { info = packageManager.getPackageInfo(object.packageName, 0); } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); info = null; } AppDataParcelable elem = new AppDataParcelable( label == null ? object.packageName : label, object.sourceDir, object.packageName, object.flags + "_" + (info != null ? info.versionName : ""), Formatter.formatFileSize(getContext(), sourceDir.length()), sourceDir.length(), sourceDir.lastModified(), null); mApps.first.add(elem); Collections.sort(mApps.first, new AppDataParcelable.AppDataSorter(sortBy, asc)); for (AppDataParcelable p : mApps.first) { mApps.second.add(p.path); } } else { Log.w(TAG, "App " + object.packageName + " has null sourceDir"); } } return mApps; }</code><technical_language>Invert if "if(object.sourceDir == null) { <log> continue;}" reduce indentation level</technical_language>

Target:
public AppsDataPair loadInBackground() { List<ApplicationInfo> apps = packageManager.getInstalledApplications( PackageManager.MATCH_UNINSTALLED_PACKAGES | PackageManager.MATCH_DISABLED_UNTIL_USED_COMPONENTS); if (apps == null) return new AppsDataPair(Collections.emptyList(), Collections.emptyList()); mApps = new AppsDataPair(new ArrayList<>(apps.size()), new ArrayList<>(apps.size())); for (ApplicationInfo object : apps) { if (object.sourceDir == null) { continue; } File sourceDir = new File(object.sourceDir); String label = object.loadLabel(packageManager).toString(); PackageInfo info; try { info = packageManager.getPackageInfo(object.packageName, 0); } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); info = null; } AppDataParcelable elem = new AppDataParcelable( label == null ? object.packageName : label, object.sourceDir, object.packageName, object.flags + "_" + (info != null ? info.versionName : ""), Formatter.formatFileSize(getContext(), sourceDir.length()), sourceDir.length(), sourceDir.lastModified(), null); mApps.first.add(elem); Collections.sort(mApps.first, new AppDataParcelable.AppDataSorter(sortBy, asc)); for (AppDataParcelable p : mApps.first) { mApps.second.add(p.path); } } return mApps; }
Source:
<code>private void applyModeCustomizations() { if (ApplicationModeHelper.getUiMode() == ApplicationMode.GlusterOnly) { optimizationTab.setVisible(false); resiliencePolicyTab.setVisible(false); clusterPolicyTab.setVisible(false); dataCenterPanel.addStyleName(style.generalTabTopDecoratorEmpty()); <START> cPUEditor.setVisible(false); <END> } }</code><technical_language>i CPU is visible in Cluster dialog</technical_language>

Target:
private void applyModeCustomizations() { if (ApplicationModeHelper.getUiMode() == ApplicationMode.GlusterOnly) { optimizationTab.setVisible(false); resiliencePolicyTab.setVisible(false); clusterPolicyTab.setVisible(false); dataCenterPanel.addStyleName(style.generalTabTopDecoratorEmpty()); } }
Source:
<code>public void testAddObectSpecificData() throws UnsupportedEncodingException { itemEventProcessor.configurationService = configurationService; <START> when(configurationService.getProperty(any(String.class))).thenReturn("demo.dspace.org"); <END> when(item.getHandle()).thenReturn("123456789/1"); String result = itemEventProcessor.addObjectSpecificData("existing-string", item); assertThat(result, is("existing-string&svc_dat=demo.dspace.org%2Fhandle%2F123456789%2F1&rft_dat=Investigation")); }</code><technical_language>Again, need mock configurations</technical_language>

Target:
public void testAddObectSpecificData() throws UnsupportedEncodingException { itemEventProcessor.configurationService = configurationService; when(item.getHandle()).thenReturn("123456789/1"); String result = itemEventProcessor.addObjectSpecificData("existing-string", item); assertThat(result, is("existing-string&svc_dat=" + encodedUrl + "%2Fhandle%2F123456789%2F1&rft_dat=Investigation")); }
Source:
<code>public synchronized void trimCache(CorfuPayloadMsg<Long> msg, ChannelHandlerContext ctx, IServerRouter r) { log.info("trimCache: Starting cache eviction"); if (trimMark < msg.getPayload()) { trimMark = msg.getPayload(); } <START> cache.invalidateUpTo(trimMark); <END> r.sendResponse(ctx, msg, CorfuMsgType.ACK.msg()); }</code><technical_language>If trim mark change do iterate cache</technical_language>

Target:
public synchronized void trimCache(CorfuPayloadMsg<Long> msg, ChannelHandlerContext ctx, IServerRouter r) { log.info("trimCache: Starting cache eviction"); if (trimMark < msg.getPayload()) { trimMark = msg.getPayload(); cache.invalidateUpTo(trimMark); } r.sendResponse(ctx, msg, CorfuMsgType.ACK.msg()); }
Source:
<code>public void dispose() { if (ksession != null) { abortProcessInstances(ksession); ksession.dispose(); ksession = null; } <START> if (ksession2 != null) { ksession2.dispose(); ksession2 = null; } <END> }</code><technical_language>Same, removed</technical_language>

Target:
public void dispose() { if (ksession != null) { abortProcessInstances(ksession); ksession.dispose(); ksession = null; } }
Source:
<code>public Void call() throws Exception { StoredConfig cfg = null; <START> if (repository == null) <END> cfg = loadUserConfig(); else cfg = repository.getConfig(); cfg.setBoolean(ConfigConstants.CONFIG_FILTER_SECTION, Constants.LFS, ConfigConstants.CONFIG_KEY_USEJGITBUILTIN, true); cfg.setBoolean(ConfigConstants.CONFIG_FILTER_SECTION, Constants.LFS, ConfigConstants.CONFIG_KEY_REQUIRED, true); cfg.save(); ProcessBuilder builder = FS.DETECTED.runInShell("git", repository == null ? ARGS_USER : ARGS_LOCAL); if (repository != null) { builder.directory(repository.isBare() ? repository.getDirectory() : repository.getWorkTree()); } FS.DETECTED.runProcess(builder, null, null, (String) null); return null; }</code><technical_language>style nit: one-line if-blocks parentheses</technical_language>

Target:
public Void call() throws Exception { StoredConfig cfg = null; if (repository == null) { cfg = loadUserConfig(); } else { cfg = repository.getConfig(); } cfg.setBoolean(ConfigConstants.CONFIG_FILTER_SECTION, Constants.LFS, ConfigConstants.CONFIG_KEY_USEJGITBUILTIN, true); cfg.setBoolean(ConfigConstants.CONFIG_FILTER_SECTION, Constants.LFS, ConfigConstants.CONFIG_KEY_REQUIRED, true); cfg.save(); ProcessBuilder builder = FS.DETECTED.runInShell("git", repository == null ? ARGS_USER : ARGS_LOCAL); if (repository != null) { builder.directory(repository.isBare() ? repository.getDirectory() : repository.getWorkTree()); } FS.DETECTED.runProcess(builder, null, null, (String) null); return null; }
Source:
<code>private FilterPredicate buildFilter(Expression e) { if (e instanceof BinaryExpression) { Expression lhs = ((BinaryExpression) e).getLhs(); Expression rhs = ((BinaryExpression) e).getRhs(); switch (e.getOpType()) { <START> case OP_EQ: return eq(getColumn((Column) lhs), getValue(rhs)); <END> case OP_GT: return gt(getColumn((Column) lhs), getValue(rhs)); case OP_GE: return gtEq(getColumn((Column) lhs), getValue(rhs)); case OP_LT: return lt(getColumn((Column) lhs), getValue(rhs)); case OP_LE: return ltEq(getColumn((Column) lhs), getValue(rhs)); case OP_AND: return and(buildFilter(lhs), buildFilter(rhs)); case OP_OR: return or(buildFilter(lhs), buildFilter(rhs)); } } return null; }</code><technical_language>if column is right left? "4 = i" work well. Pig normalize</technical_language>

Target:
private FilterPredicate buildFilter(Expression e) { if (e instanceof BinaryExpression) { Expression lhs = ((BinaryExpression) e).getLhs(); Expression rhs = ((BinaryExpression) e).getRhs(); OpType op = e.getOpType(); FilterPredicate lfp; FilterPredicate rfp; switch (op) { case OP_AND: lfp = buildFilter(lhs); rfp = buildFilter(rhs); if (lfp == null || rfp == null) { return null; } return and(lfp, rfp); case OP_OR: lfp = buildFilter(lhs); rfp = buildFilter(rhs); if (lfp == null || rfp == null) { return null; } return or(lfp, rfp); } if (lhs instanceof Column && rhs instanceof Const) { return buildFilter(op, (Column) lhs, (Const) rhs); } else if (lhs instanceof Const && rhs instanceof Column) { return buildFilter(op, (Column) rhs, (Const) lhs); } } return null; }
Source:
<code>public boolean matches(RelOptRuleCall call) { Filter filter = call.rel(0); if (filter.getCondition() == null) { return false; } TableSourceTable tableSourceTable = call.rel(1).getTable().unwrap(TableSourceTable.class); if (tableSourceTable == null){ return false; } DynamicTableSource dynamicTableSource = tableSourceTable.tableSource(); if (!(dynamicTableSource instanceof SupportsPartitionPushDown)) { return false; } Optional<List<Map<String, String>>> partitions = ((SupportsPartitionPushDown) dynamicTableSource).listPartitions(); return partitions.isPresent() && !partitions.get().isEmpty() <START> && !Arrays.stream(tableSourceTable.extraDigests()).anyMatch(digest -> digest.startsWith("source: [partitions=")); <END> }</code><technical_language>!Arrays.stream(tableSourceTable.extraDigests()).anyMatch(digest -> digest.startsWith("source: [partitions=")) simplified Arrays.stream(tableSourceTable.extraDigests()).noneMatch(digest -> digest.startsWith("source: [partitions="))</technical_language>

Target:
public boolean matches(RelOptRuleCall call) { Filter filter = call.rel(0); if (filter.getCondition() == null) { return false; } TableSourceTable tableSourceTable = call.rel(1).getTable().unwrap(TableSourceTable.class); if (tableSourceTable == null) { return false; } DynamicTableSource dynamicTableSource = tableSourceTable.tableSource(); if (!(dynamicTableSource instanceof SupportsPartitionPushDown)) { return false; } CatalogTable catalogTable = tableSourceTable.catalogTable(); if (!catalogTable.isPartitioned() || catalogTable.getPartitionKeys().isEmpty()) { return false; } return Arrays.stream(tableSourceTable.extraDigests()).noneMatch(digest -> digest.startsWith("partitions=[")); }
Source:
<code>public void initialize() { logger.debug("Initializing WemoBridgeHandler"); Configuration configuration = getConfig(); if (configuration.get(UDN) != null) { logger.trace("Initializing WemoBridgeHandler for UDN '{}'", configuration.get(UDN)); super.initialize(); for (Thing thing : getThing().getThings()) { ThingHandler handler = thing.getHandler(); if (handler != null) { <START> handler.initialize(); <END> } } } else { logger.debug("Cannot initalize WemoBridgeHandler. UDN not set."); } }</code><technical_language>this BAAAAD - imho, a handler call initialize() other handlers - this is framework takes care of</technical_language>

Target:
public void initialize() { logger.debug("Initializing WemoBridgeHandler"); Configuration configuration = getConfig(); if (configuration.get(UDN) != null) { logger.trace("Initializing WemoBridgeHandler for UDN '{}'", configuration.get(UDN)); super.initialize(); Bridge bridge = this.getThing(); for (Thing thing : bridge.getThings()) { ((WemoLightHandler) thing.getHandler()).bridgeHandlerInitialized(this, bridge); } } else { logger.debug("Cannot initalize WemoBridgeHandler. UDN not set."); } }
Source:
<code>public void testBuildPartionPriorityKey(){ List<String> pKeys = new ArrayList<>(); RowMap rowMap = new RowMap("insert", "MyDatabase", "MyTable", TIMESTAMP_MILLISECONDS, pKeys, POSITION); rowMap.putData("last_name", "bar"); rowMap.putData("salary", "4000"); rowMap.putData("department", "science"); List<String> partitionColumns = Arrays.asList("subject_id", "sharding_value","id"); String partitionKey = rowMap.buildPartionPriorityKey(partitionColumns); <START> Assert.assertEquals("9001", partitionKey); <END> }</code><technical_language>i merged master. I fixed a problem test suite scripts passing failing tests</technical_language>

Target:
public void testBuildPartionPriorityKey(){ List<String> pKeys = new ArrayList<>(); RowMap rowMap = new RowMap("insert", "MyDatabase", "MyTable", TIMESTAMP_MILLISECONDS, pKeys, POSITION); rowMap.putData("last_name", "bar"); rowMap.putData("salary", "4000"); rowMap.putData("department", "science"); List<String> partitionColumns = Arrays.asList("subject_id", "sharding_value","id"); String partitionKey = rowMap.buildPartitionPriorityKey(partitionColumns); Assert.assertEquals("9001", partitionKey); }
Source:
<code>public void setFormattedResponseData(String data) throws Exception { if(data!=null && !data.equals("") && <START> responseContentType!= null && responseContentType.toLowerCase().indexOf("application/json")!=-1){ <END> ObjectMapper objectMapper = new ObjectMapper(); ObjectWriter writer = objectMapper.defaultPrettyPrintingWriter(); Object json = objectMapper.readValue(data, Object.class); this.formattedResponseData = writer.withView(ViewFilters.Default.class).writeValueAsString(json); } else{ this.formattedResponseData = data; } }</code><technical_language>Formatting note - space & operators consistent</technical_language>

Target:
public void setFormattedResponseData(String data) throws Exception { this.formattedResponseData = data; if(data!=null && !data.equals("") && responseContentType != null && responseContentType.toLowerCase().indexOf("application/json") != -1){ try { ObjectMapper objectMapper = new ObjectMapper(); ObjectWriter writer = objectMapper.defaultPrettyPrintingWriter(); Object json = objectMapper.readValue(data, Object.class); this.formattedResponseData = writer.withView(ViewFilters.Default.class).writeValueAsString(json); } catch (JsonParseException jpe) { } } }
Source:
<code>protected int run() throws Exception { Jenkins jenkins = Jenkins.get(); jenkins.checkPermission(Jenkins.ADMINISTER); PluginManager manager = jenkins.getPluginManager(); <START> List<PluginWrapper> pluginsToEnable = pluginNames.stream() <END> .flatMap(pluginName -> getPluginsToEnable(manager, pluginName)) .collect(toList()); for (PluginWrapper plugin : pluginsToEnable) { stdout.println(String.format("Enabling plugin `%s' (%s)", plugin.getShortName(), plugin.getVersion())); plugin.enable(); } if (restart) { jenkins.safeRestart(); } return 0; }</code><technical_language>a set? plugins plugin a dependency</technical_language>

Target:
protected int run() throws Exception { Jenkins jenkins = Jenkins.get(); jenkins.checkPermission(Jenkins.ADMINISTER); PluginManager manager = jenkins.getPluginManager(); for (String pluginName : pluginNames) { enablePlugin(manager, pluginName); } if (restart) { jenkins.safeRestart(); } return 0; }
Source:
<code>private void verifyAmazonUnitShownAboveFooter() { <START> waitForElementByElementLocatedBy(slotAboveFooterEcommerce); <END> Assertion.assertTrue(checkIfElementOnPage(slotAboveFooterEcommerce)); PageObjectLogging .log("verifyAmazonUnitShownAboveFooter", "Amazon unit is visible above footer", true); }</code><technical_language>Ecommerce unit AmazonVideo unit</technical_language>

Target:
private void verifyAmazonUnitShownAboveFooter() { waitForElementByElementLocatedBy(slotAboveFooterAmazon); Assertion.assertTrue(checkIfElementOnPage(slotAboveFooterAmazon)); PageObjectLogging .log("verifyAmazonUnitShownAboveFooter", "Amazon unit is visible above footer", true); }
Source:
<code><START> public boolean equals(Object obj) { <END> if (obj == null || obj.getClass() != getClass()) { return false; } HostLocation location = (HostLocation) obj; return location.getDataCenter().equals(this.dataCenter) && location.getRack().equals(this.rack) && location.getPhysicalHost().equals(this.physicalHost); }</code><technical_language>time I generated .equals in IntelliJ, a short circuit checked for instance equality quickly return true</technical_language>

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || obj.getClass() != getClass()) { return false; } HostLocation location = (HostLocation) obj; return location.getDataCenter().equals(this.dataCenter) && location.getRack().equals(this.rack) && location.getPhysicalHost().equals(this.physicalHost); }
Source:
<code>public BoundingBox getBoundingBox() { double width = 0; String[] lines = textSupplier.get().split("\\r?\\n"); <START> for (int i = 1; i < lines.length; i++) { <END> double w = getBoundingBoxForString(lines[i]).getWidth(); width = Math.max(width, w); } double height = getBoundingBoxForString(textSupplier.get()).getHeight(); height = height * lines.length; return new BoundingBox().addX(0).addX(width).addY(0).addY(height); }</code><technical_language>width of line? i initialised 0</technical_language>

Target:
public BoundingBox getBoundingBox() { double width = 0; final String text = textSupplier.get(); if (text == null || text.isEmpty()) { return new BoundingBox(); } final String[] lines = text.split("\\r?\\n"); for (String line : lines) { double w = getBoundingBoxForString(line).getWidth(); width = Math.max(width, w); } double height = getBoundingBoxForString(text).getHeight(); height = height * lines.length; return new BoundingBox().addX(0).addX(width).addY(0).addY(height); }
Source:
<code>static ConstitutionalTribunalJudgment createSimpleCtJudgment(){ ConstitutionalTribunalJudgment judgment = new ConstitutionalTribunalJudgment(); judgment.addCourtCase(new CourtCase(RandomStringUtils.randomAlphanumeric(10))); <START> judgment.getSourceInfo().setSourceCode(SourceCode.SUPREME_COURT); <END> judgment.getSourceInfo().setSourceJudgmentId(RandomStringUtils.randomAlphabetic(20)); return judgment; }</code><technical_language>if add enum SourceCode.CONSTITUTIONAL_TRIBUNAL in here</technical_language>

Target:
static ConstitutionalTribunalJudgment createSimpleCtJudgment(){ ConstitutionalTribunalJudgment judgment = new ConstitutionalTribunalJudgment(); judgment.addCourtCase(new CourtCase(RandomStringUtils.randomAlphanumeric(10))); judgment.getSourceInfo().setSourceCode(SourceCode.CONSTITUTIONAL_TRIBUNAL); judgment.getSourceInfo().setSourceJudgmentId(RandomStringUtils.randomAlphabetic(20)); return judgment; }
Source:
<code>public AddQuotaCommand(T parameters) { super(parameters); <START> setStoragePoolId(parameters.getStoragePoolId()); <END> }</code><technical_language>storage pool set quota object, i a reason send separately, apply for update remove</technical_language>

Target:
public AddQuotaCommand(T parameters) { super(parameters); }
Source:
<code><START> public SqlNode getExpr() { <END> return expr; }</code><technical_language>return Optional<SqlNode> consistent other nullable methods</technical_language>

Target:
public Optional<SqlNode> getExpr() { return Optional.ofNullable(expr); }
Source:
<code>public void pruningStrategyShouldBeDynamic() throws IOException { <START> CheckPointer checkPointer = db.getDependencyResolver().resolveDependency( CheckPointer.class ); <END> Config config = db.getDependencyResolver().resolveDependency( Config.class ); FileSystemAbstraction fs = db.getDependencyResolver().resolveDependency( FileSystemAbstraction.class ); LogFiles logFiles = LogFilesBuilder.builder( db.getStoreDir(), fs ) .withLogVersionRepository( new SimpleLogVersionRepository() ) .withLastCommittedTransactionIdSupplier( () -> 1 ) .withTransactionIdStore( new SimpleTransactionIdStore() ).build(); writeTransactionsAndRotateTwice(); checkPointer.forceCheckPoint( triggerInfo ); assertThat( countTransactionLogs( logFiles ), is( 3 ) ); config.updateDynamicSetting( keep_logical_logs.name(), "false", "test" ); checkPointer.forceCheckPoint( triggerInfo ); assertThat( countTransactionLogs( logFiles ), is( 2 ) ); }</code><technical_language>extract a helper method get T 'DependencyResolver' readability characters</technical_language>

Target:
public void pruningStrategyShouldBeDynamic() throws IOException { CheckPointer checkPointer = getInstanceFromDb( CheckPointer.class ); Config config = getInstanceFromDb( Config.class ); FileSystemAbstraction fs = getInstanceFromDb( FileSystemAbstraction.class ); LogFiles logFiles = LogFilesBuilder.builder( db.getStoreDir(), fs ) .withLogVersionRepository( new SimpleLogVersionRepository() ) .withLastCommittedTransactionIdSupplier( () -> 1 ) .withTransactionIdStore( new SimpleTransactionIdStore() ).build(); writeTransactionsAndRotateTwice(); checkPointer.forceCheckPoint( triggerInfo ); assertThat( countTransactionLogs( logFiles ), is( 3 ) ); config.updateDynamicSetting( keep_logical_logs.name(), "false", "test" ); checkPointer.forceCheckPoint( triggerInfo ); assertThat( countTransactionLogs( logFiles ), is( 2 ) ); }
Source:
<code><START> private void connect() { <END> logger.debug("Connecting to LIRC"); try { if (connector != null) { connector.disconnect(); } if (configuration.getHost() != null && connector == null) { connector = new LIRCConnector(); } if (connector != null) { connector.connect(configuration); connector.addEventListener(eventListener); updateStatus(ThingStatus.ONLINE); startDeviceDiscovery(); } } catch (UnknownHostException e) { logger.error("Connection to LIRC failed: unknown host"); } catch (IOException e) { logger.error("Connection to LIRC failed", e); } }</code><technical_language>please reduce excessive of blank lines</technical_language>

Target:
private void connect() { logger.debug("Connecting to LIRC"); try { if (connector != null) { connector.disconnect(); } if (configuration.getHost() != null && connector == null) { connector = new LIRCConnector(); } if (connector != null) { connector.connect(configuration); connector.addEventListener(eventListener); updateStatus(ThingStatus.ONLINE); startDeviceDiscovery(); } } catch (UnknownHostException e) { logger.error("Connection to LIRC failed: unknown host"); updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, "Unknown Host"); } catch (IOException e) { logger.error("Connection to LIRC failed", e); updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, e.getMessage()); } }
Source:
<code>boolean remove(JobTreeElement jte) { boolean fire = false; boolean removed = false; synchronized (keptjobinfos) { if (keptjobinfos.remove(jte)) { removed = true; finishedTime.remove(jte); disposeAction(jte); <START> JobTreeElement jtes[] = keptjobinfos <END> .toArray(new JobTreeElement[keptjobinfos.size()]); for (JobTreeElement jte2 : jtes) { JobTreeElement parent = (JobTreeElement) jte2 .getParent(); if (parent != null) { if (parent == jte || parent.getParent() == jte) { if (keptjobinfos.remove(jte2)) { disposeAction(jte2); } finishedTime.remove(jte2); } } } fire = true; } } if (fire) { Object l[] = getListeners(); for (Object element : l) { KeptJobsListener jv = (KeptJobsListener) element; jv.removed(jte); } } return removed; }</code><technical_language>name</technical_language>

Target:
boolean remove(JobTreeElement jte) { boolean fire = false; boolean removed = false; synchronized (keptjobinfos) { if (keptjobinfos.remove(jte)) { removed = true; finishedTime.remove(jte); disposeAction(jte); JobTreeElement jobTreeElements[] = keptjobinfos .toArray(new JobTreeElement[keptjobinfos.size()]); for (JobTreeElement jobTreeElement : jobTreeElements) { JobTreeElement parent = (JobTreeElement) jobTreeElement .getParent(); if (parent != null) { if (parent == jte || parent.getParent() == jte) { if (keptjobinfos.remove(jobTreeElement)) { disposeAction(jobTreeElement); } finishedTime.remove(jobTreeElement); } } } fire = true; } } if (fire) { Object l[] = getListeners(); for (Object element : l) { KeptJobsListener jv = (KeptJobsListener) element; jv.removed(jte); } } return removed; }
Source:
<code><START> public void setKey(@Nullable Object key) { <END> Validate.notNull(key, "key cannot be null"); _key = key; }</code><technical_language>decorate Nullable while null is allowed in line</technical_language>

Target:
public void setKey(@Nullable Object key) { _key = key; }
Source:
<code>public void shouldShowAllMusicsAsXML() throws Exception { when(dao.listAll()).thenReturn(Arrays.asList(music)); controller.showAllMusicsAsXML(); assertThat(result.serializedResult(), is("<list>\n" + " <musicBuilder>\n" + " <id>1</id>\n" + " <title>Some Music</title>\n" + " <description>Some description</description>\n" + " <type>ROCK</type>\n" + " </musicBuilder>\n" + <START> "</list>")); <END> }</code><technical_language>weird indent. put is(... next line more readable</technical_language>

Target:
public void shouldShowAllMusicsAsXML() throws Exception { when(dao.listAll()).thenReturn(Arrays.asList(music)); controller.showAllMusicsAsXML(); assertThat(result.serializedResult(), is("<list>\n" + " <music>\n" + " <id>1</id>\n" + " <title>Some Music</title>\n" + " <description>Some description</description>\n" + " <type>ROCK</type>\n" + " </music>\n" + "</list>")); }
Source:
<code>private static String firstInvalidSegment(String[] value) { if (value == null) { return null; } for (String <START> element : <END> value) { if (!validSegment(element)) { return element; } } return null; }</code><technical_language>rename segment</technical_language>

Target:
private static String firstInvalidSegment(String[] value) { if (value == null) { return null; } for (String segment : value) { if (!validSegment(segment)) { return segment; } } return null; }
Source:
<code>void tryCleanup() { if (!staging.isPresent()) { return; } String bucket = staging.get().getBucket(); ListObjectsRequest req = new ListObjectsRequest() .withBucketName(bucket) .withPrefix(staging.get().getKey()); do { ObjectListing res = s3.listObjects(req); String[] keys = res.getObjectSummaries().stream() .map(S3ObjectSummary::getKey) .toArray(String[]::new); for (String key : keys) { logger.info("Removing s3://{}/{}", bucket, key); } <START> s3.deleteObjects(new DeleteObjectsRequest(bucket).withKeys(keys)); <END> req.setMarker(res.getMarker()); } while (req.getMarker() != null); }</code><technical_language>s3.deleteObjects() throws exception, continue delete rest of files? Hmm, infinite loop... leave is</technical_language>

Target:
void tryCleanup() { if (!staging.isPresent()) { return; } String bucket = staging.get().getBucket(); ListObjectsRequest req = new ListObjectsRequest() .withBucketName(bucket) .withPrefix(staging.get().getKey()); do { ObjectListing res = s3.listObjects(req); String[] keys = res.getObjectSummaries().stream() .map(S3ObjectSummary::getKey) .toArray(String[]::new); for (String key : keys) { logger.info("Removing s3://{}/{}", bucket, key); } try { RetryExecutor.retryExecutor() .withRetryLimit(3) .withInitialRetryWait(100) .retryIf(e -> !(e instanceof AmazonServiceException) || !Aws.isDeterministicException((AmazonServiceException) e)) .run(() -> s3.deleteObjects(new DeleteObjectsRequest(bucket).withKeys(keys))); } catch (RetryExecutor.RetryGiveupException e) { logger.info("Failed to delete staging files in {}", staging.get(), e.getCause()); } req.setMarker(res.getMarker()); } while (req.getMarker() != null); }
Source:
<code>void initTable() { getTable().enableColumnResizing(); AbstractTextColumn<StorageDomainDR> sessionColumn = new AbstractTextColumn<StorageDomainDR>() { @Override public String getValue(StorageDomainDR storageDomainDR) { GlusterGeoRepSession session = getDetailModel().getGeoRepSessionsMap().get(storageDomainDR.getGeoRepSessionId()); if (session == null) { return storageDomainDR.getGeoRepSessionId().toString(); } else { <START> return session.getSlaveHostName() + "::" + session.getSlaveVolumeName(); END> } } }; getTable().addColumn(sessionColumn, constants.geoRepSlaveVolume(), "300px"); AbstractTextColumn<StorageDomainDR> scheduleColumn = new AbstractTextColumn<StorageDomainDR>() { @Override public String getValue(StorageDomainDR storageDomainDR) { StorageSyncSchedule schedule = new StorageSyncSchedule(storageDomainDR.getScheduleCronExpression()); return schedule.toString(); } }; getTable().addColumn(scheduleColumn, constants.scheduleLabel(), "300px"); getTable().addActionButton(new WebAdminButtonDefinition<StorageDomainDR>(constants.newDRSetup()) { @Override protected UICommand resolveCommand() { return getDetailModel().getNewCommand(); } }); }</code><technical_language>reuse extracted ApplicationMessage :)</technical_language>

Target:
void initTable() { getTable().enableColumnResizing(); AbstractTextColumn<StorageDomainDR> sessionColumn = new AbstractTextColumn<StorageDomainDR>() { @Override public String getValue(StorageDomainDR storageDomainDR) { GlusterGeoRepSession session = getDetailModel().getGeoRepSessionsMap().get(storageDomainDR.getGeoRepSessionId()); if (session == null) { return storageDomainDR.getGeoRepSessionId().toString(); } else { return messages.geoRepRemoteSessionName(session.getSlaveHostName(), session.getSlaveVolumeName()); } } }; getTable().addColumn(sessionColumn, constants.geoRepSlaveVolume(), "300px"); AbstractTextColumn<StorageDomainDR> scheduleColumn = new AbstractTextColumn<StorageDomainDR>() { @Override public String getValue(StorageDomainDR storageDomainDR) { StorageSyncSchedule schedule = new StorageSyncSchedule(storageDomainDR.getScheduleCronExpression()); return schedule.toString(); } }; getTable().addColumn(scheduleColumn, constants.scheduleLabel(), "300px"); getTable().addActionButton(new WebAdminButtonDefinition<StorageDomainDR>(constants.newDRSetup()) { @Override protected UICommand resolveCommand() { return getDetailModel().getNewCommand(); } }); }
Source:
<code>public Map<String, String> toMap(Optional<ObjectMapper> mapper) { Map<String, String> map = <START> mapper.orElseGet(() -> new ObjectMapper()).convertValue(this, new TypeReference<Map<String, String>>(){}); <END> if ( !Boolean.parseBoolean(map.get("keyStore")) ) { map.remove("keyStore"); } return map; }</code><technical_language>suggestion mapper.orElseGet(ObjectMapper::new).convertValue(this, new TypeReference<Map<String, String>>(){});</technical_language>

Target:
public Map<String, String> toMap(Optional<ObjectMapper> mapper) { Map<String, String> map = mapper.orElseGet(ObjectMapper::new).convertValue(this, new TypeReference<Map<String, String>>(){}); if ( !Boolean.parseBoolean(map.get("keyStore")) ) { map.remove("keyStore"); } return map; }
Source:
<code>public String toString() { return new ToStringBuilder(this) <START> .append("endKey", endKey) <END> .append("timestamp", timestamp) .toString(); }</code><technical_language>I i mentioned this earlier -- please ShortPrefixToStringStyle</technical_language>

Target:
public String toString() { return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) .append("endKey", endKey) .append("timestamp", timestamp) .toString(); }
Source:
<code>public <I,O> boolean andThenFunction(IntegrationFlowBuilder flowBuilder, MessageChannel outputChannel) { if (StringUtils.hasText(this.functionProperties.getName())) { FunctionInvoker<I,O> functionInvoker = new FunctionInvoker<>(this.functionProperties.getName(), this.functionCatalog, this.functionInspector, this.messageConverterFactory); <START> subscribeToInput(functionInvoker, flowBuilder.toReactivePublisher(), message -> outputChannel.send(message)); <END> return true; } return false; }</code><technical_language>Nit-pick: method reference instead: outputChannel::send. this is IDEA suggests me. No</technical_language>

Target:
public <I,O> boolean andThenFunction(IntegrationFlowBuilder flowBuilder, MessageChannel outputChannel) { if (StringUtils.hasText(this.functionProperties.getName())) { FunctionInvoker<I,O> functionInvoker = new FunctionInvoker<>(this.functionProperties.getName(), this.functionCatalog, this.functionInspector, this.messageConverterFactory); subscribeToInput(functionInvoker, flowBuilder.toReactivePublisher(), outputChannel::send); return true; } return false; }