auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void update() { if (model == null || model.getInputConfig() == null || model.getInputConfig().getInput() == null) { return; } DataHandle handle = model.getInputConfig().getInput().getHandle(); root.setRedraw(false); for (TableItem item : features.getItems()) { item.dispose(); } for (TableItem item : classes.getItems()) { item.dispose(); } for (int col = 0; col < handle.getNumColumns(); col++) { String attribute = handle.getAttributeName(col); Image image = controller.getResources().getImage(model.getInputDefinition().getAttributeType(attribute)); createTableItem(attribute, image, features, model.getSelectedFeatures()); createTableItem(attribute, image, classes, model.getSelectedClasses()); } root.setRedraw(true); SWTUtil.enable(root); }

Target:
private void update() { if (model == null || model.getInputConfig() == null || model.getInputConfig().getInput() == null) { return; } DataHandle handle = model.getInputConfig().getInput().getHandle(); root.setRedraw(false); for (TableItem item : features.getItems()) { item.dispose(); } for (TableItem item : classes.getItems()) { item.dispose(); } for (int col = 0; col < handle.getNumColumns(); col++) { String attribute = handle.getAttributeName(col); DataDefinition def = model.getOutputDefinition() == null ? model.getInputDefinition() : model.getOutputDefinition(); Image image = controller.getResources().getImage(def.getAttributeType(attribute)); TableItem itemF = new TableItem(features, SWT.NONE); itemF.setText(new String[] { "", attribute } ); itemF.setImage(0, image); itemF.setChecked(model.getSelectedFeatures().contains(attribute)); TableItem itemC = new TableItem(classes, SWT.NONE); itemC.setText(attribute); itemC.setChecked(model.getSelectedClasses().contains(attribute)); } root.setRedraw(true); SWTUtil.enable(root); }
Source:
public void testGroupLayerWithNotQueryableLayers() throws Exception { Catalog catalog = getCatalog(); CatalogFactory factory = catalog.getFactory(); WorkspaceInfo workspace = catalog.getWorkspaceByName(MockData.CITE_PREFIX); String groupLayer = "glqueryable"; LayerInfo buildingsLayer = ModificationProxy.unwrap(catalog.getLayerByName(getLayerId(MockData.BUILDINGS))); LayerInfo bridgesLayer = ModificationProxy.unwrap(catalog.getLayerByName(getLayerId(MockData.BRIDGES))); LayerInfo forestLayer = ModificationProxy.unwrap(catalog.getLayerByName(getLayerId(MockData.FORESTS))); buildingsLayer.setQueryable(false); bridgesLayer.setQueryable(false); forestLayer.setQueryable(true); LayerGroupInfo layerGroup = factory.createLayerGroup(); layerGroup.setName(groupLayer); layerGroup.setWorkspace(workspace); layerGroup.getLayers().add(buildingsLayer); layerGroup.getLayers().add(bridgesLayer); layerGroup.getLayers().add(forestLayer); new CatalogBuilder(catalog).calculateLayerGroupBounds(layerGroup); catalog.add(layerGroup); String name = MockData.CITE_PREFIX+":"+groupLayer; String request = "wms?bbox=-0.002,-0.002,0.002,0.002&styles=&format=jpeg" + "&info_format=text/plain&request=GetFeatureInfo&layers=" + name + "&query_layers=" + name + "&width=20&height=20&x=10&y=10"; String result = getAsString(request); assertNotNull(result); assertTrue(result.indexOf("Green Forest") > 0); buildingsLayer.setQueryable(true); bridgesLayer.setQueryable(true); catalog.remove(layerGroup); }

Target:
public void testGroupLayerWithNotQueryableLayers() throws Exception { Catalog catalog = getCatalog(); CatalogFactory factory = catalog.getFactory(); WorkspaceInfo workspace = catalog.getWorkspaceByName(MockData.CITE_PREFIX); String groupLayer = "glqueryable"; LayerInfo buildingsLayer = catalog.getLayerByName(getLayerId(MockData.BUILDINGS)); buildingsLayer.setQueryable(false); catalog.save(buildingsLayer); LayerInfo bridgesLayer = catalog.getLayerByName(getLayerId(MockData.BRIDGES)); bridgesLayer.setQueryable(false); catalog.save(bridgesLayer); LayerInfo forestLayer = catalog.getLayerByName(getLayerId(MockData.FORESTS)); forestLayer.setQueryable(true); catalog.save(forestLayer); LayerGroupInfo layerGroup = factory.createLayerGroup(); layerGroup.setName(groupLayer); layerGroup.setWorkspace(workspace); layerGroup.getLayers().add(buildingsLayer); layerGroup.getLayers().add(bridgesLayer); layerGroup.getLayers().add(forestLayer); new CatalogBuilder(catalog).calculateLayerGroupBounds(layerGroup); catalog.add(layerGroup); String name = MockData.CITE_PREFIX+":"+groupLayer; String request = "wms?bbox=-0.002,-0.002,0.002,0.002&styles=&format=jpeg" + "&info_format=text/plain&request=GetFeatureInfo&layers=" + name + "&query_layers=" + name + "&width=20&height=20&x=10&y=10"; String result = getAsString(request); assertNotNull(result); assertTrue(result.indexOf("Green Forest") > 0); buildingsLayer.setQueryable(true); catalog.save(buildingsLayer); bridgesLayer.setQueryable(true); catalog.save(bridgesLayer); catalog.remove(layerGroup); }
Source:
public void onDeleteMembers(Id me, Collection<AccountGroupMember> toBeRemoved) throws IOException { try { List<AccountGroupMemberAudit> auditUpdates = Lists.newLinkedList(); List<AccountGroupMemberAudit> auditInserts = Lists.newLinkedList(); ReviewDb reviewDB = db.get(); for (final AccountGroupMember m : toBeRemoved) { AccountGroupMemberAudit audit = null; for (AccountGroupMemberAudit a : reviewDB.accountGroupMembersAudit() .byGroupAccount(m.getAccountGroupId(), m.getAccountId())) { if (a.isActive()) { audit = a; break; } } if (audit != null) { audit.removed(me, TimeUtil.nowTs()); auditUpdates.add(audit); } else { audit = new AccountGroupMemberAudit(m, me, TimeUtil.nowTs()); audit.removedLegacy(); auditInserts.add(audit); } } reviewDB.accountGroupMembersAudit().update(auditUpdates); reviewDB.accountGroupMembersAudit().insert(auditInserts); } catch (OrmException e) { throw new IOException("Cannot log delete group member event", e); } }

Target:
public void onDeleteMembers(Id me, Collection<AccountGroupMember> toBeRemoved) throws IOException { try { List<AccountGroupMemberAudit> auditUpdates = Lists.newLinkedList(); List<AccountGroupMemberAudit> auditInserts = Lists.newLinkedList(); ReviewDb reviewDB = db.get(); for (AccountGroupMember m : toBeRemoved) { AccountGroupMemberAudit audit = null; for (AccountGroupMemberAudit a : reviewDB.accountGroupMembersAudit() .byGroupAccount(m.getAccountGroupId(), m.getAccountId())) { if (a.isActive()) { audit = a; break; } } if (audit != null) { audit.removed(me, TimeUtil.nowTs()); auditUpdates.add(audit); } else { audit = new AccountGroupMemberAudit(m, me, TimeUtil.nowTs()); audit.removedLegacy(); auditInserts.add(audit); } } reviewDB.accountGroupMembersAudit().update(auditUpdates); reviewDB.accountGroupMembersAudit().insert(auditInserts); } catch (OrmException e) { throw new IOException("Cannot log delete group member event", e); } }
Source:
public void createCacheStorageTest() { CacheStorageImpl cache = new CacheStorageImpl(); final Map<Identifier, OperatorState> queryState1= new HashMap<>(); final Map<Identifier, OperatorState> queryState2= new HashMap<>(); queryState1.put(oid1, value1); queryState2.put(oid1, value2); Assert.assertEquals(true, cache.create(qid1, queryState1)); Assert.assertEquals(false, cache.create(qid1, queryState2)); Assert.assertEquals(true, cache.create(qid2, queryState1)); }

Target:
public void createCacheStorageTest() { final CacheStorage cache = new CacheStorageImpl(); final Map<Identifier, OperatorState> queryState1 = new HashMap<>(); final Map<Identifier, OperatorState> queryState2 = new HashMap<>(); queryState1.put(oid1, value1); queryState2.put(oid1, value2); Assert.assertTrue(cache.create(qid1, queryState1)); Assert.assertFalse(cache.create(qid1, queryState2)); Assert.assertTrue(cache.create(qid2, queryState1)); }
Source:
private Element timeZone() { return textElement(BlogConstants.TIMEZONE, entity.getTimeZone()); }

Target:
private Element timeZone() { return textElement(TIMEZONE, entity.getTimeZone()); }
Source:
public boolean addDependencies(List<DynamicPomDependency> deps, Path pomPath) { if (deps.isEmpty()) { return false; } try { org.uberfire.java.nio.file.Path filePath = Paths.get(pomPath.toURI()); Model model = getPOMModel(filePath); Set keys = getKeysFromDeps(model.getDependencies()); for (DynamicPomDependency dep : deps) { Dependency pomDep = getMavenDependency(dep); if (!keys.contains(getKeyFromDep(dep))) { model.getDependencies().add(pomDep); } } writePOMModelOnFS(filePath, model); } catch (Exception ex) { logger.error(ex.getMessage(), ex); return false; } return true; }

Target:
public boolean addDependencies(List<DynamicPomDependency> deps, Path pomPath) { if (deps.isEmpty()) { return false; } boolean result = false; try { org.uberfire.java.nio.file.Path filePath = Paths.get(pomPath.toURI()); Model model = getPOMModel(filePath); Map<String, String> keys = getKeysFromDeps(model.getDependencies()); for (DynamicPomDependency dep : deps) { String keyDep = getKeyFromDep(dep); if (!keys.containsKey(keyDep)) { Dependency pomDep = getMavenDependency(dep); model.getDependencies().add(pomDep); result = true; } else { List<Dependency> modelDeps = model.getDependencies(); for (Dependency modelDep : modelDeps) { if (modelDep.getGroupId().equals(dep.getGroupID()) && modelDep.getArtifactId().equals(dep.getArtifactID()) && !modelDep.getVersion().equals(dep.getVersion())) { modelDep.setVersion(dep.getVersion()); result = true; } } } } if (result) { writePOMModelOnFS(filePath, model); } } catch (Exception ex) { logger.error(ex.getMessage(), ex); result = false; } return result; }
Source:
private FavouritePoint getPersonalPoint(PersonalFavouritePoint.PointType pointType) { FavouritePoint personalPoint = null; for (FavouritePoint fp : cachedPersonalFavoritePoints) { if (fp instanceof PersonalFavouritePoint) { if (((PersonalFavouritePoint) fp).getType() == pointType) { personalPoint = fp; } } } return personalPoint; }

Target:
private FavouritePoint getPersonalPoint(PersonalFavouritePoint.PointType pointType) { for (FavouritePoint fp : cachedPersonalFavoritePoints) { if (((PersonalFavouritePoint) fp).getType() == pointType) { return fp; } } return null; }
Source:
public RequestScopeAwareListeningExecutorService createChangeUpdateExecutor( @GerritServerConfig Config config) { ListeningExecutorService e; int poolSize = config.getInt("receive", null, "changeUpdateThreads", 1); if (poolSize <= 1) { e = MoreExecutors.sameThreadExecutor(); } else { e = MoreExecutors.listeningDecorator( MoreExecutors.getExitingExecutorService( new ThreadPoolExecutor(1, poolSize, 10, TimeUnit.MINUTES, new ArrayBlockingQueue<Runnable>(poolSize), new ThreadFactoryBuilder() .setNameFormat("ChangeUpdate-%d") .setDaemon(true) .build(), new ThreadPoolExecutor.CallerRunsPolicy()))); } return new RequestScopeAwareListeningExecutorService(e, poolSize > 1); }

Target:
public ListeningExecutorService createChangeUpdateExecutor(@GerritServerConfig Config config) { int poolSize = config.getInt("receive", null, "changeUpdateThreads", 1); if (poolSize <= 1) { return MoreExecutors.sameThreadExecutor(); } return MoreExecutors.listeningDecorator( MoreExecutors.getExitingExecutorService( new ThreadPoolExecutor(1, poolSize, 10, TimeUnit.MINUTES, new ArrayBlockingQueue<Runnable>(poolSize), new ThreadFactoryBuilder() .setNameFormat("ChangeUpdate-%d") .setDaemon(true) .build(), new ThreadPoolExecutor.CallerRunsPolicy()))); }
Source:
public void onCommand(ProtocolRead c) throws IOException, Exception { try { myPlant.sendCommandAsync(OWNUtilities.createFrame(c), 1); } catch (MalformedCommandOPEN ex) { logger.error("onCommand error : {}", ex.getMessage()); } }

Target:
public void onCommand(ProtocolRead c) throws IOException, Exception { try { myPlant.sendCommandAsync(OWNUtilities.createFrame(c), 1); } catch (MalformedCommandOPEN ex) { logger.warn("onCommand error : {}", ex.getMessage()); } }
Source:
public String toString(){ StringBuilder sbuilder = new StringBuilder(); sbuilder.append('{'); sbuilder.append(kmer + " " + et); sbuilder.append('}'); return sbuilder.toString(); }

Target:
public String toString(){ StringBuilder sbuilder = new StringBuilder(); sbuilder.append('{'); sbuilder.append(kmer).append(" ").append(et); sbuilder.append('}'); return sbuilder.toString(); }
Source:
public void testFetchingShippingRatesWithNullCheckoutToken() throws InterruptedException { final CountDownLatch latch = new CountDownLatch(1); try { buyClient.getShippingRates(null, null); } catch (NullPointerException e) { latch.countDown(); return; } latch.await(); fail("Expected a NullPointerException"); }

Target:
public void testFetchingShippingRatesWithNullCheckoutToken() throws InterruptedException { try { buyClient.getShippingRates(null, null); } catch (NullPointerException e) { return; } fail("Expected a NullPointerException"); }
Source:
public List<ProxiedPlayer> matchPlayer(String partialName) { List<ProxiedPlayer> matched = new ArrayList<ProxiedPlayer>(); for (ProxiedPlayer iPlayer : this.getPlayers()) { String iterPlayerName = iPlayer.getName(); if (partialName.equalsIgnoreCase(iterPlayerName)) { matched.add(iPlayer); break; } if (iterPlayerName.toLowerCase().contains(partialName.toLowerCase())) { matched.add(iPlayer); } } return matched; }

Target:
public List<ProxiedPlayer> matchPlayer(String partialName) { List<ProxiedPlayer> matched = new ArrayList<ProxiedPlayer>(); for (ProxiedPlayer iPlayer : this.getPlayers()) { String iterPlayerName = iPlayer.getName(); if (partialName.equalsIgnoreCase(iterPlayerName)) { matched.add(iPlayer); break; } if (iterPlayerName.toLowerCase().startsWith(partialName.toLowerCase())) { matched.add(iPlayer); } } return matched; }
Source:
public boolean hasProperty(String name) { for (Property property : this.properties) { if (property.getName().equals(name)) { return true; } } return false; }

Target:
public boolean hasProperty(String name) { return this.properties.stream().filter(p -> p.getName().equals(name)).findFirst().isPresent(); }
Source:
private ObjectNode _createScopeMappingsNode() { ObjectMapper mapper = new ObjectMapper(); ObjectNode propertiesNode = mapper.createObjectNode(); propertiesNode.put(RecordType.SCOPE.getName(), _createFieldNode(FIELD_TYPE_TEXT)); propertiesNode.put("mts", _createFieldNodeNoAnalyzer(FIELD_TYPE_DATE)); ObjectNode typeNode = mapper.createObjectNode(); typeNode.put("properties", propertiesNode); ObjectNode mappingsNode = mapper.createObjectNode(); mappingsNode.put(SCOPE_TYPE_NAME, typeNode); return mappingsNode; }

Target:
private ObjectNode _createScopeMappingsNode() { ObjectMapper mapper = new ObjectMapper(); ObjectNode propertiesNode = mapper.createObjectNode(); propertiesNode.put(RecordType.SCOPE.getName(), _createFieldNode(FIELD_TYPE_TEXT)); propertiesNode.put("mts", _createFieldNodeNoAnalyzer(FIELD_TYPE_DATE)); propertiesNode.put("cts", _createFieldNodeNoAnalyzer(FIELD_TYPE_DATE)); ObjectNode typeNode = mapper.createObjectNode(); typeNode.put("properties", propertiesNode); ObjectNode mappingsNode = mapper.createObjectNode(); mappingsNode.put(SCOPE_TYPE_NAME, typeNode); return mappingsNode; }
Source:
private void writeElement(XMLWriter writer, AntTaskElement task) { assertTrue("Task " + task + " should have an even number of properties", (task.attributes.size() % 2) == 0); writer.start(task.name); for (Iterator<String> iter = task.attributes.iterator(); iter.hasNext();) writer.attribute(iter.next(), iter.next()); for (AntTaskElement antTaskElement : task.elements) writeElement(writer, antTaskElement); writer.end(); }

Target:
private void writeElement(XMLWriter writer, AntTaskElement task) { assertTrue("Task " + task + " should have an even number of properties", (task.attributes.size() % 2) == 0); writer.start(task.name); for (Iterator<String> iter = task.attributes.iterator(); iter.hasNext();) writer.attribute(iter.next(), iter.next()); for (AntTaskElement element : task.elements) writeElement(writer, element); writer.end(); }
Source:
private void encryptPlainSnapshots() throws Exception { Set<Long> snapshotIDs = getSnapshots(); if (snapshotIDs == null || snapshotIDs.isEmpty()) { return; } Long[] snapshots = snapshotIDs.toArray(new Long[] {}); for (Long snapshot : snapshots) { File fSnapshot = getSnapshotFile(snapshot); if (fSnapshot == null || !fSnapshot.exists()) { throw new KuraException(KuraErrorCode.CONFIGURATION_SNAPSHOT_NOT_FOUND, snapshot); } XmlComponentConfigurations xmlConfigs = null; FileReader fr = null; BufferedReader br = null; try { fr = new FileReader(fSnapshot); br = new BufferedReader(fr); String line = ""; StringBuilder entireFile = new StringBuilder(); while ((line = br.readLine()) != null) { entireFile.append(line); } xmlConfigs = XmlUtil.unmarshal(entireFile.toString(), XmlComponentConfigurations.class); } finally { if (br != null) { br.close(); } if (fr != null) { fr.close(); } } List<ComponentConfigurationImpl> configs = xmlConfigs.getConfigurations(); encryptConfigs(configs); writeSnapshot(snapshot, xmlConfigs); } }

Target:
private void encryptPlainSnapshots() throws Exception { Set<Long> snapshotIDs = getSnapshots(); if (snapshotIDs == null || snapshotIDs.isEmpty()) { return; } Long[] snapshots = snapshotIDs.toArray(new Long[] {}); for (Long snapshot : snapshots) { File fSnapshot = getSnapshotFile(snapshot); if (fSnapshot == null || !fSnapshot.exists()) { throw new KuraException(KuraErrorCode.CONFIGURATION_ERROR, snapshot); } XmlComponentConfigurations xmlConfigs = null; FileReader fr = null; BufferedReader br = null; try { fr = new FileReader(fSnapshot); br = new BufferedReader(fr); String line = ""; StringBuilder entireFile = new StringBuilder(); while ((line = br.readLine()) != null) { entireFile.append(line); } xmlConfigs = XmlUtil.unmarshal(entireFile.toString(), XmlComponentConfigurations.class); } finally { if (br != null) { br.close(); } if (fr != null) { fr.close(); } } List<ComponentConfigurationImpl> configs = xmlConfigs.getConfigurations(); encryptConfigs(configs); writeSnapshot(snapshot, xmlConfigs); } }
Source:
private void emitCollectionBinding(StringBuilder builder, CollectionBinding binding, int[] ids) { builder.append(" target.").append(binding.getName()).append(" = "); switch (binding.getKind()) { case ARRAY: builder.append("Finder.arrayOf("); break; case LIST: builder.append("Finder.listOf("); break; default: throw new IllegalStateException("Unknown kind: " + binding.getKind()); } for (int i = 0; i < ids.length; i++) { if (i > 0) { builder.append(','); } builder.append("\n "); if (!binding.getType().equals(VIEW_TYPE)) { builder.append("finder.cast("); } if (binding.isRequired()) { builder.append("finder.findRequiredView(source, ") .append(ids[i]) .append(", \"") .append(binding.getName()) .append("\")"); } else { builder.append("finder.findOptionalView(source, ") .append(ids[i]) .append(")"); } if (!binding.getType().equals(VIEW_TYPE)) { builder.append(", " + ids[i]); builder.append(", " + binding.getType() + ".class"); builder.append(")"); } } builder.append("\n );"); }

Target:
private void emitCollectionBinding(StringBuilder builder, CollectionBinding binding, int[] ids) { builder.append(" target.").append(binding.getName()).append(" = "); switch (binding.getKind()) { case ARRAY: builder.append("Finder.arrayOf("); break; case LIST: builder.append("Finder.listOf("); break; default: throw new IllegalStateException("Unknown kind: " + binding.getKind()); } for (int i = 0; i < ids.length; i++) { if (i > 0) { builder.append(','); } builder.append("\n "); if (binding.requiresCast()) { builder.append("finder.castView("); } if (binding.isRequired()) { builder.append("finder.findRequiredView(source, ") .append(ids[i]) .append(", \"") .append(binding.getName()) .append("\")"); } else { builder.append("finder.findOptionalView(source, ") .append(ids[i]) .append(")"); } if (binding.requiresCast()) { builder.append(", " + ids[i]); builder.append(", " + binding.getType() + ".class"); builder.append(")"); } } builder.append("\n );"); }
Source:
private <T> void cancelQuery(Query<T> query, String cancelUrl) { Runnable cancelRunnable = () -> { try { Future<StatusResponseHolder> responseFuture = httpClient.go( new Request(HttpMethod.DELETE, new URL(cancelUrl)) .setContent(objectMapper.writeValueAsBytes(query)) .setHeader(HttpHeaders.Names.CONTENT_TYPE, isSmile ? SmileMediaTypes.APPLICATION_JACKSON_SMILE : MediaType.APPLICATION_JSON), StatusResponseHandler.getInstance(), Duration.standardSeconds(1)); Runnable checkRunnable = () -> { try { if (!responseFuture.isDone()) { log.error("Error cancelling query[%s]: ", query); } StatusResponseHolder response = responseFuture.get(); if (response.getStatus().getCode() >= 500) { log.error("Error cancelling query[%s]: queriable node returned status[%d] [%s].", query, response.getStatus().getCode(), response.getStatus().getReasonPhrase()); } } catch (ExecutionException | InterruptedException e) { log.error("Error cancelling query[%s]: ", query); } }; queryCancellationExecutor.schedule(checkRunnable, 5, TimeUnit.SECONDS); } catch (IOException e) { log.error("Error cancelling query[%s]: ", query); } }; queryCancellationExecutor.submit(cancelRunnable); }

Target:
private <T> void cancelQuery(Query<T> query, String cancelUrl) { Runnable cancelRunnable = () -> { try { Future<StatusResponseHolder> responseFuture = httpClient.go( new Request(HttpMethod.DELETE, new URL(cancelUrl)) .setContent(objectMapper.writeValueAsBytes(query)) .setHeader(HttpHeaders.Names.CONTENT_TYPE, isSmile ? SmileMediaTypes.APPLICATION_JACKSON_SMILE : MediaType.APPLICATION_JSON), StatusResponseHandler.getInstance(), Duration.standardSeconds(1)); Runnable checkRunnable = () -> { try { if (!responseFuture.isDone()) { log.error("Error cancelling query[%s]", query); } StatusResponseHolder response = responseFuture.get(); if (response.getStatus().getCode() >= 500) { log.error("Error cancelling query[%s]: queriable node returned status[%d] [%s].", query, response.getStatus().getCode(), response.getStatus().getReasonPhrase()); } } catch (ExecutionException | InterruptedException e) { log.error(e, "Error cancelling query[%s]", query); } }; queryCancellationExecutor.schedule(checkRunnable, 5, TimeUnit.SECONDS); } catch (IOException e) { log.error(e, "Error cancelling query[%s]", query); } }; queryCancellationExecutor.submit(cancelRunnable); }
Source:
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) { Block block = world.getBlock(x, y, z); if (block == null) return null; if (block == this.dSlabs) block = this.slabs; int meta = world.getBlockMetadata(x, y, z) & 7; return new ItemStack(block, 1, meta); }

Target:
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) { AEBaseSlabBlock block = (AEBaseSlabBlock) world.getBlock(x, y, z); if (block == null) return null; if (block.field_150004_a) block = this.slabs; int meta = world.getBlockMetadata(x, y, z) & 7; return new ItemStack(block, 1, meta); }
Source:
protected void updateValues(AbsTmfStatisticsTree statsData, ITmfTrace trace, TmfTimeRange timeRange, boolean isGlobal) { ITmfStatistics stats = trace.getStatistics(); ITmfTimestamp start = timeRange.getStartTime().normalize(0, -9); ITmfTimestamp end = timeRange.getEndTime().normalize(0, -9); String name = trace.getName(); long globalTotal = stats.getEventsInRange(start, end); statsData.setTotal(name, isGlobal, globalTotal); Map<String, Long> map = stats.getEventTypesInRange(start, end); for (Map.Entry<String, Long> entry : map.entrySet()) { statsData.setTypeCount(name, entry.getKey(), isGlobal, entry.getValue()); } }

Target:
protected void updateValues(AbsTmfStatisticsTree statsData, ITmfTrace trace, TmfTimeRange timeRange, boolean isGlobal) { ITmfStatistics stats = trace.getStatistics(); ITmfTimestamp start = timeRange.getStartTime().normalize(0, TIME_SCALE); ITmfTimestamp end = timeRange.getEndTime().normalize(0, TIME_SCALE); String name = trace.getName(); long globalTotal = stats.getEventsInRange(start, end); statsData.setTotal(name, isGlobal, globalTotal); Map<String, Long> map = stats.getEventTypesInRange(start, end); for (Map.Entry<String, Long> entry : map.entrySet()) { statsData.setTypeCount(name, entry.getKey(), isGlobal, entry.getValue()); } }
Source:
private String getServiceHost(final ServiceParams serviceParams) throws MalformedURLException { final TermNode hostNode = serviceParams.get(ENDPOINT_KEY, null); if (hostNode == null) { throw new IllegalArgumentException("Service name (mwapi:endpoint) should be supplied"); } serviceParams.clear(ENDPOINT_KEY); if (!hostNode.isConstant()) { throw new IllegalArgumentException("Endpoint name should be a constant"); } final Value v = hostNode.getValue(); final String endpointHost; if (v instanceof URI) { endpointHost = new URL(v.stringValue()).getHost(); } else { endpointHost = v.stringValue(); } if (!config.validEndpoint(endpointHost)) { throw new IllegalArgumentException("Host " + endpointHost + " is not allowed"); } return endpointHost; }

Target:
private String getServiceHost(final ServiceParams serviceParams) throws MalformedURLException { final TermNode hostNode = serviceParams.get(ENDPOINT_KEY, null); Preconditions.checkNotNull(hostNode, "Service name (mwapi:endpoint) should be supplied"); Preconditions.checkArgument(hostNode.isConstant(), "Endpoint name should be a constant"); serviceParams.clear(ENDPOINT_KEY); final Value v = hostNode.getValue(); final String endpointHost; if (v instanceof URI) { endpointHost = new URL(v.stringValue()).getHost(); } else { endpointHost = v.stringValue(); } if (!config.validEndpoint(endpointHost)) { throw new IllegalArgumentException("Host " + endpointHost + " is not allowed"); } return endpointHost; }
Source:
private GitResourceVariantTreeProvider createTreeProvider() throws Exception { testRepo.appendContentAndCommit(iProject, file1, INITIAL_CONTENT_1, "first file - initial commit"); testRepo.appendContentAndCommit(iProject, file2, INITIAL_CONTENT_2, "second file - initial commit"); testRepo.createBranch(MASTER, BASE); testRepo.createAndCheckoutBranch(MASTER, BRANCH); setContentsAndCommit(testRepo, iFile2, BRANCH_CHANGES + INITIAL_CONTENT_2, "branch commit"); testRepo.checkoutBranch(MASTER); setContentsAndCommit(testRepo, iFile1, INITIAL_CONTENT_1 + MASTER_CHANGES, "master commit"); iProject.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor()); try (RevWalk walk = new RevWalk(repo)) { RevTree baseTree = walk.parseTree(repo.resolve(BASE)); RevTree sourceTree = walk.parseTree(repo.resolve(MASTER)); RevTree remoteTree = walk.parseTree(repo.resolve(BRANCH)); TreeWalk tw = new NameConflictTreeWalk(repo); tw.addTree(baseTree); tw.addTree(sourceTree); tw.addTree(remoteTree); return new TreeWalkResourceVariantTreeProvider(repo, tw, 0, 1, 2); } }

Target:
private GitResourceVariantTreeProvider createTreeProvider() throws Exception { testRepo.appendContentAndCommit(iProject, file1, INITIAL_CONTENT_1, "first file - initial commit"); testRepo.appendContentAndCommit(iProject, file2, INITIAL_CONTENT_2, "second file - initial commit"); testRepo.createBranch(MASTER, BASE); testRepo.createAndCheckoutBranch(MASTER, BRANCH); setContentsAndCommit(testRepo, iFile2, BRANCH_CHANGES + INITIAL_CONTENT_2, "branch commit"); testRepo.checkoutBranch(MASTER); setContentsAndCommit(testRepo, iFile1, INITIAL_CONTENT_1 + MASTER_CHANGES, "master commit"); iProject.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor()); try (RevWalk walk = new RevWalk(repo)) { RevTree baseTree = walk.parseTree(repo.resolve(BASE)); RevTree sourceTree = walk.parseTree(repo.resolve(MASTER)); RevTree remoteTree = walk.parseTree(repo.resolve(BRANCH)); TreeWalk tw = new TreeWalk(repo); tw.addTree(baseTree); tw.addTree(sourceTree); tw.addTree(remoteTree); return new TreeWalkResourceVariantTreeProvider(repo, tw, 0, 1, 2); } }
Source:
public void stop() { if (trace) { log.tracef("Stopping LocalTopologyManager on %s", transport.getAddress()); } running = false; for (LocalCacheStatus cache : runningCaches.values()) { cache.getTopologyUpdatesExecutor().shutdownNow(); } withinThreadExecutor.shutdown(); persistentUUIDManager.removePersistentAddressMapping(persistentUUID); }

Target:
public void stop() { if (trace) { log.tracef("Stopping LocalTopologyManager on %s", transport.getAddress()); } running = false; for (LocalCacheStatus cache : runningCaches.values()) { cache.getTopologyUpdatesExecutor().shutdownNow(); } withinThreadExecutor.shutdown(); }
Source:
private List<GlusterVolumeEntity> getEligibleVolumesList(Set<GlusterVolumeEntity> upVolumesWithSuggestedCapacityAndNotInMasterCluster, Set<GlusterVolumeEntity> existingSessionSlaveVolumes) { List<GlusterVolumeEntity> eligibleVolumes = new ArrayList<GlusterVolumeEntity>(); upVolumesWithSuggestedCapacityAndNotInMasterCluster.removeAll(existingSessionSlaveVolumes); eligibleVolumes.addAll(upVolumesWithSuggestedCapacityAndNotInMasterCluster); return eligibleVolumes; }

Target:
private Set<GlusterVolumeEntity> getEligibleVolumesList(Set<GlusterVolumeEntity> upVolumesWithSuggestedCapacityAndNotInMasterCluster, Set<GlusterVolumeEntity> existingSessionSlaveVolumes) { upVolumesWithSuggestedCapacityAndNotInMasterCluster.removeAll(existingSessionSlaveVolumes); return upVolumesWithSuggestedCapacityAndNotInMasterCluster; }
Source:
public void visitBinaryExpression(BinaryExpressionTree tree) { if (tree.is(CONDITIONAL_AND, CONDITIONAL_OR) && !ignored.contains(tree)) { List<SyntaxToken> flatOperators = new ArrayList<>(); flattenLogicalExpression(0, flatOperators, tree); increaseComplexityByOne(flatOperators.get(0)); for (int i = 1; i < flatOperators.size(); i++) { SyntaxToken previous = flatOperators.get(i - 1); SyntaxToken current = flatOperators.get(i); if (!sameOperators(previous, current)) { increaseComplexityByOne(current); } } } super.visitBinaryExpression(tree); }

Target:
public void visitBinaryExpression(BinaryExpressionTree tree) { if (tree.is(CONDITIONAL_AND, CONDITIONAL_OR) && !ignored.contains(tree)) { List<BinaryExpressionTree> flattenedLogicalExpressions = flattenLogicalExpression(tree).collect(Collectors.toList()); BinaryExpressionTree previous = null; for (BinaryExpressionTree current : flattenedLogicalExpressions) { if (previous == null || !previous.is(current.kind())) { increaseComplexityByOne(current.operatorToken()); } previous = current; } } super.visitBinaryExpression(tree); }
Source:
public String getSparkUIUrl() { if (sparkUrl != null) { return sparkUrl; } String sparkUrlProp = property.getProperty("zeppelin.spark.uiWebUrl", ""); if (!sparkUrlProp.isEmpty()) { return sparkUrlProp; } if (sparkVersion.newerThanEquals(SparkVersion.SPARK_2_0_0)) { Option<String> uiWebUrlOption = (Option<String>) Utils.invokeMethod(sc, "uiWebUrl"); if (uiWebUrlOption.isDefined()) { return uiWebUrlOption.get(); } } else { Option<SparkUI> sparkUIOption = (Option<SparkUI>) Utils.invokeMethod(sc, "ui"); if (sparkUIOption.isDefined()) { return (String) Utils.invokeMethod(sparkUIOption.get(), "appUIAddress"); } } return null; }

Target:
public String getSparkUIUrl() { if (sparkUrl != null) { return sparkUrl; } String sparkUrlProp = property.getProperty("zeppelin.spark.uiWebUrl", ""); if (!StringUtils.isBlank(sparkUrlProp)) { return sparkUrlProp; } if (sparkVersion.newerThanEquals(SparkVersion.SPARK_2_0_0)) { Option<String> uiWebUrlOption = (Option<String>) Utils.invokeMethod(sc, "uiWebUrl"); if (uiWebUrlOption.isDefined()) { return uiWebUrlOption.get(); } } else { Option<SparkUI> sparkUIOption = (Option<SparkUI>) Utils.invokeMethod(sc, "ui"); if (sparkUIOption.isDefined()) { return (String) Utils.invokeMethod(sparkUIOption.get(), "appUIAddress"); } } return null; }
Source:
public long getUpTimeSeconds() { return (System.currentTimeMillis() - started) / 1000; }

Target:
public long getUpTimeSeconds() { return TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis() - started); }
Source:
private void chooseNames() { names.clearAnimation(); textToSpeechManager.stopSpeaking(); if (listState.getNumNames() > 0) { List<String> chosenNames = listState.chooseNames(settings); chosenNamesText = NameUtils.flattenListToString(chosenNames, settings); names.setAlpha(0.0f); names.setText(chosenNamesText); if (isMediaVolumeMuted()) { handleNamesAnimations(300); } else { playSound(); } } else { UIUtils.showLongToast(R.string.no_names_left, this); } }

Target:
private void chooseNames() { names.clearAnimation(); textToSpeechManager.stopSpeaking(); if (listState.getNumNames() > 0) { List<String> chosenNames = listState.chooseNames(settings); chosenNamesText = NameUtils.flattenListToString(chosenNames, settings); names.setAlpha(0.0f); names.setText(chosenNamesText); if (((AudioManager) getSystemService(Context.AUDIO_SERVICE)).getStreamVolume(AudioManager.STREAM_MUSIC) == 0) { playNamesAnimation(getResources().getInteger(R.integer.default_anim_length)); } else { playSound(); } } else { UIUtils.showLongToast(R.string.no_names_left, this); } }
Source:
public CryptographyAsyncClient buildAsyncClient() { Configuration buildConfiguration = (configuration == null) ? ConfigurationManager.getConfiguration().clone() : configuration; if (jsonWebKey == null && Strings.isNullOrEmpty(keyId)) { throw new IllegalStateException("Json Web Key or jsonWebKey identifier are required to create cryptography client"); } if (pipeline != null) { if(jsonWebKey != null) { return new CryptographyAsyncClient(jsonWebKey, pipeline); } else { return new CryptographyAsyncClient(keyId, pipeline); } } if (credential == null) { throw new IllegalStateException(KeyVaultErrorCodeStrings.getErrorString(KeyVaultErrorCodeStrings.CREDENTIAL_REQUIRED)); } final List<HttpPipelinePolicy> policies = new ArrayList<>(); policies.add(new UserAgentPolicy(AzureKeyVaultConfiguration.SDK_NAME, AzureKeyVaultConfiguration.SDK_VERSION, buildConfiguration)); policies.add(retryPolicy); policies.add(new KeyVaultCredentialPolicy(credential)); policies.addAll(this.policies); policies.add(new HttpLoggingPolicy(httpLogDetailLevel)); HttpPipeline pipeline = HttpPipeline.builder() .policies(policies.toArray(new HttpPipelinePolicy[0])) .httpClient(httpClient) .build(); if(jsonWebKey != null) { return new CryptographyAsyncClient(jsonWebKey, pipeline); } else { return new CryptographyAsyncClient(keyId, pipeline); } }

Target:
public CryptographyAsyncClient buildAsyncClient() { Configuration buildConfiguration = (configuration == null) ? ConfigurationManager.getConfiguration().clone() : configuration; if (jsonWebKey == null && Strings.isNullOrEmpty(keyId)) { throw new IllegalStateException("Json Web Key or jsonWebKey identifier are required to create cryptography client"); } if (pipeline != null) { if (jsonWebKey != null) { return new CryptographyAsyncClient(jsonWebKey, pipeline); } else { return new CryptographyAsyncClient(keyId, pipeline); } } if (credential == null) { throw new IllegalStateException("Key Vault credentials " + "are required to build the Cryptography async client"); } final List<HttpPipelinePolicy> policies = new ArrayList<>(); policies.add(new UserAgentPolicy(AzureKeyVaultConfiguration.SDK_NAME, AzureKeyVaultConfiguration.SDK_VERSION, buildConfiguration)); HttpPolicyProviders.addBeforeRetryPolicies(policies); policies.add(retryPolicy); policies.add(new KeyVaultCredentialPolicy(credential)); policies.addAll(this.policies); HttpPolicyProviders.addAfterRetryPolicies(policies); policies.add(new HttpLoggingPolicy(httpLogDetailLevel)); HttpPipeline pipeline = new HttpPipelineBuilder() .policies(policies.toArray(new HttpPipelinePolicy[0])) .httpClient(httpClient) .build(); if (jsonWebKey != null) { return new CryptographyAsyncClient(jsonWebKey, pipeline); } else { return new CryptographyAsyncClient(keyId, pipeline); } }
Source:
private static PredicateLeaf.Type toOrcType(DataType type) { LogicalTypeRoot ltype = type.getLogicalType().getTypeRoot(); switch (ltype){ case TINYINT: case SMALLINT: case INTEGER: case BIGINT: return PredicateLeaf.Type.LONG; case FLOAT: case DOUBLE: return PredicateLeaf.Type.FLOAT; case BOOLEAN: return PredicateLeaf.Type.BOOLEAN; case VARCHAR: return PredicateLeaf.Type.STRING; case TIMESTAMP_WITHOUT_TIME_ZONE: case TIMESTAMP_WITH_LOCAL_TIME_ZONE: case TIMESTAMP_WITH_TIME_ZONE: return PredicateLeaf.Type.TIMESTAMP; case DATE: return PredicateLeaf.Type.DATE; case BINARY: return PredicateLeaf.Type.DECIMAL; default: return null; } }

Target:
private static PredicateLeaf.Type toOrcType(DataType type) { LogicalTypeRoot ltype = type.getLogicalType().getTypeRoot(); switch (ltype) { case TINYINT: case SMALLINT: case INTEGER: case BIGINT: return PredicateLeaf.Type.LONG; case FLOAT: case DOUBLE: return PredicateLeaf.Type.FLOAT; case BOOLEAN: return PredicateLeaf.Type.BOOLEAN; case CHAR: case VARCHAR: return PredicateLeaf.Type.STRING; case TIMESTAMP_WITHOUT_TIME_ZONE: return PredicateLeaf.Type.TIMESTAMP; case DATE: return PredicateLeaf.Type.DATE; case DECIMAL: return PredicateLeaf.Type.DECIMAL; default: return null; } }
Source:
public ResponseEntity<?> addProfile(@AuthenticationPrincipal User user, @Validated @RequestBody ProfileDTO input) { if (checkAllowedToEditProfile(user, input)) { User changedUser = userService.addProfile(user.getId(), input); return createResponseEntity(HttpStatus.OK, "Profile successfully changed", changedUser.getProfile()); } else { return createResponseEntity(HttpStatus.BAD_REQUEST, "Unable to change date during event", user.getProfile()); } }

Target:
public ResponseEntity<?> addProfile(@AuthenticationPrincipal User user, @Validated @RequestBody ProfileDTO input) { if (allowedToEditProfile(user, input)) { User changedUser = userService.addProfile(user.getId(), input); return createResponseEntity(HttpStatus.OK, "Profile successfully changed", changedUser.getProfile()); } else { return createResponseEntity(HttpStatus.BAD_REQUEST, "Not permitted to change date during event", user.getProfile()); } }
Source:
private void testTransformers(ModelTestControllerVersion controllerVersion, ModelVersion agroalVersion, String xmlResource) throws Exception { KernelServicesBuilder builder = createKernelServicesBuilder(createAdditionalInitialization()); builder.createLegacyKernelServicesBuilder(createAdditionalInitialization(), controllerVersion, agroalVersion) .addMavenResourceURL(getExtensionMavenGAV(controllerVersion)) .skipReverseControllerCheck() .dontPersistXml(); KernelServices mainServices = builder.build(); assertTrue(mainServices.isSuccessfulBoot()); assertTrue(mainServices.getLegacyServices(agroalVersion).isSuccessfulBoot()); List<ModelNode> ops = builder.parseXmlResource(xmlResource); System.out.println("ops = " + ops); PathAddress subsystemAddress = PathAddress.pathAddress(SUBSYSTEM, AgroalExtension.SUBSYSTEM_NAME); ModelTestUtils.checkFailedTransformedBootOperations(mainServices, agroalVersion, ops, new FailedOperationTransformationConfig() .addFailedAttribute(subsystemAddress, new FailedOperationTransformationConfig.NewAttributesConfig( XADataSourceDefinition.RECOVERY_USERNAME_ATTRIBUTE, XADataSourceDefinition.RECOVERY_PASSWORD_ATTRIBUTE, XADataSourceDefinition.RECOVERY_AUTHENTICATION_CONTEXT, XADataSourceDefinition.RECOVERY_CREDENTIAL_REFERENCE)) .addFailedAttribute(subsystemAddress, new CorrectToFalse( XADataSourceDefinition.RECOVERY)) ); }

Target:
private void testTransformers(ModelTestControllerVersion controllerVersion, ModelVersion agroalVersion, String xmlResource) throws Exception { KernelServicesBuilder builder = createKernelServicesBuilder(createAdditionalInitialization()); builder.createLegacyKernelServicesBuilder(createAdditionalInitialization(), controllerVersion, agroalVersion) .addMavenResourceURL(getExtensionMavenGAV(controllerVersion)) .skipReverseControllerCheck() .dontPersistXml(); KernelServices mainServices = builder.build(); assertTrue(mainServices.isSuccessfulBoot()); assertTrue(mainServices.getLegacyServices(agroalVersion).isSuccessfulBoot()); List<ModelNode> ops = builder.parseXmlResource(xmlResource); System.out.println("ops = " + ops); PathAddress subsystemAddress = PathAddress.pathAddress(SUBSYSTEM, AgroalExtension.SUBSYSTEM_NAME); ModelTestUtils.checkFailedTransformedBootOperations(mainServices, agroalVersion, ops, new FailedOperationTransformationConfig() .addFailedAttribute(subsystemAddress.append("xa-datasource"), new DiscardedAttribute( XADataSourceDefinition.RECOVERY_USERNAME_ATTRIBUTE, XADataSourceDefinition.RECOVERY_PASSWORD_ATTRIBUTE, XADataSourceDefinition.RECOVERY_AUTHENTICATION_CONTEXT, XADataSourceDefinition.RECOVERY_CREDENTIAL_REFERENCE)) .addFailedAttribute(subsystemAddress.append("xa-datasource"), new CorrectToFalse( XADataSourceDefinition.RECOVERY)) ); }
Source:
public boolean canTakeStack(EntityPlayer playerIn) { boolean result = net.minecraftforge.event.ForgeEventFactory.onCanTakeItem(playerIn, this.getStack()); return result && !this.getItemHandler().extractItem(index, 1, true).isEmpty(); }

Target:
public boolean canTakeStack(EntityPlayer playerIn) { boolean vanillaResult = !this.getItemHandler().extractItem(index, 1, true).isEmpty(); return net.minecraftforge.event.ForgeEventFactory.onCanTakeItem(this.getStack(), this, this.inventory, playerIn, vanillaResult); }
Source:
private String addSiblingTag(String parentAlias, DetailedSample sample) throws IOException { SampleClass sc = sample.getSampleClass(); if (sc == null || sc.getSuffix() == null) { throw new InvalidParameterException("Unexpected null SampleClass or suffix"); } final String suffix; if (SampleTissueProcessing.CATEGORY_NAME.equals(sc.getSampleCategory()) && SampleTissuePiece.SUBCATEGORY_NAME.equals(sc.getSampleSubcategory())) { suffix = ((SampleTissuePiece) sample).getTissuePieceType().getAbbreviation(); } else { suffix = sc.getSuffix(); } String partialAlias = parentAlias + SEPARATOR + suffix; if (sample.getSiblingNumber() == null) { if (siblingNumberGenerator == null) { throw new IllegalStateException("No SiblingNumberGenerator configured"); } sample.setSiblingNumber(siblingNumberGenerator.getNextSiblingNumber(SampleImpl.class, partialAlias)); } String siblingNum = sample.getSiblingNumber().toString(); if (isTissueProcessingSample(sample)) { while (siblingNum.length() < 2) siblingNum = "0" + siblingNum; } return partialAlias + siblingNum; }

Target:
private String addSiblingTag(String parentAlias, DetailedSample sample) throws IOException { SampleClass sc = sample.getSampleClass(); if (sc == null) { throw new InvalidParameterException("Unexpected null SampleClass"); } final String suffix; if (SampleTissueProcessing.CATEGORY_NAME.equals(sc.getSampleCategory()) && SampleTissuePiece.SUBCATEGORY_NAME.equals(sc.getSampleSubcategory())) { suffix = ((SampleTissuePiece) sample).getTissuePieceType().getAbbreviation(); } else { suffix = sc.getSuffix(); } if (suffix == null) { throw new InvalidParameterException("Unexpected null suffix"); } String partialAlias = parentAlias + SEPARATOR + suffix; if (sample.getSiblingNumber() == null) { if (siblingNumberGenerator == null) { throw new IllegalStateException("No SiblingNumberGenerator configured"); } sample.setSiblingNumber(siblingNumberGenerator.getNextSiblingNumber(SampleImpl.class, partialAlias)); } String siblingNum = sample.getSiblingNumber().toString(); if (isTissueProcessingSample(sample)) { while (siblingNum.length() < 2) siblingNum = "0" + siblingNum; } return partialAlias + siblingNum; }
Source:
public void onNewImageFromCamera() { if (navigator.isSdkAboveOrEqualM() && !navigator.doIHavePermission(Manifest.permission.WRITE_EXTERNAL_STORAGE)) { navigator.askForPermission(new String[] {Manifest.permission.WRITE_EXTERNAL_STORAGE}, PERMISSION_EXTERNAL_STORAGE_NEW_IMAGE_CAMERA); } else { interactor.createFile(this, CREATE_FILE_TAKE_PHOTO, null); } }

Target:
public void onNewImageFromCamera() { interactor.createFile(this, CREATE_FILE_TAKE_PHOTO, null); }
Source:
public void moveShareableDiskToGlusterDomain() { initializeCommand(ImageOperation.Move); initShareableDiskImage(); initGlusterDomain(); assertFalse(command.canDoAction()); }

Target:
public void moveShareableDiskToGlusterDomain() { initializeCommand(ImageOperation.Move); initSrcStorageDomain(); initShareableDiskImage(); initGlusterDomain(); assertFalse(command.canDoAction()); assertTrue(command.getReturnValue() .getCanDoActionMessages() .contains(VdcBllMessages.ACTION_TYPE_FAILED_CANT_MOVE_SHAREABLE_DISK_TO_GLUSTERFS.toString())); }
Source:
private boolean hasJdtCoreSettingsChange(SimpleLookupTable deltas) { Object resourceDelta = deltas.get(this.currentProject); if (resourceDelta instanceof IResourceDelta) { IResourceDelta delta = (IResourceDelta) resourceDelta; class CheckForJdtCoreSettingsFileChange implements IResourceDeltaVisitor { boolean hasJdtCoreSettingsChange = false; @Override public boolean visit(IResourceDelta childDelta) throws CoreException { IResource resource = childDelta.getResource(); IPath resourcePath = resource.getProjectRelativePath(); String resourceFilename = resourcePath.lastSegment(); if ("org.eclipse.jdt.core.prefs".equals(resourceFilename)) { this.hasJdtCoreSettingsChange = true; return false; } return true; } } try { CheckForJdtCoreSettingsFileChange visitor = new CheckForJdtCoreSettingsFileChange(); delta.accept(visitor); return visitor.hasJdtCoreSettingsChange; } catch (CoreException e) { Util.log(e, "Failed to check whether deltas contain JDT preference changes"); } } return false; }

Target:
private boolean hasJdtCoreSettingsChange(SimpleLookupTable deltas) { Object resourceDelta = deltas.get(this.currentProject); if (resourceDelta instanceof IResourceDelta) { IResourceDelta delta = (IResourceDelta) resourceDelta; class CheckForJdtCoreSettingsFileChange implements IResourceDeltaVisitor { boolean hasJdtCoreSettingsChange = false; @Override public boolean visit(IResourceDelta childDelta) throws CoreException { IResource resource = childDelta.getResource(); boolean isJdtCoreSettingsResource = isJdtCoreSettingsResource(resource); if (isJdtCoreSettingsResource) { this.hasJdtCoreSettingsChange = true; return false; } return true; } } try { CheckForJdtCoreSettingsFileChange visitor = new CheckForJdtCoreSettingsFileChange(); delta.accept(visitor); return visitor.hasJdtCoreSettingsChange; } catch (CoreException e) { Util.log(e, "Failed to check whether deltas contain JDT preference changes"); } } return false; }
Source:
public void incrementAttribute(long t, int attributeQuark) throws StateValueTypeException, TimeRangeException, AttributeNotFoundException { try { ITmfStateValue stateValue = queryOngoingState(attributeQuark); int prevValue = 0; if (!stateValue.isNull()) { prevValue = stateValue.unboxInt(); } modifyAttribute(t, TmfStateValue.newValueInt(prevValue + 1), attributeQuark); } catch (TimeRangeException e) { throw new TimeRangeException(getSSID() + ' ' + e.getMessage(), e); } catch (AttributeNotFoundException e) { throw new AttributeNotFoundException(getSSID() + ' ' + e.getMessage(), e); } }

Target:
public void incrementAttribute(long t, int attributeQuark) throws StateValueTypeException, TimeRangeException, AttributeNotFoundException { ITmfStateValue stateValue = queryOngoingState(attributeQuark); int prevValue = 0; if (!stateValue.isNull()) { prevValue = stateValue.unboxInt(); } modifyAttribute(t, TmfStateValue.newValueInt(prevValue + 1), attributeQuark); }
Source:
private void removeFromHistoryAndAnnotationModel( final Collection<ContributionAnnotationHistory> histories) { final Set<IAnnotationModel> annotationModels = new HashSet<>(); final Set<User> users = new HashSet<>(); for (final ContributionAnnotationHistory history : histories) { List<ContributionAnnotation> allAnnotationsInHistory = history.clear(); for (ContributionAnnotation annotation : allAnnotationsInHistory) { annotationModels.add(annotation.getModel()); users.add(annotation.getSource()); } } for (final IAnnotationModel annotationModel : annotationModels) annotationModelHelper.removeAnnotationsFromModel( annotationModel, (a) -> a instanceof ContributionAnnotation && users.contains(((ContributionAnnotation) (a)).getSource())); }

Target:
private void removeFromHistoryAndAnnotationModel( final Collection<ContributionAnnotationHistory> histories) { final Set<IAnnotationModel> annotationModels = new HashSet<>(); final Set<User> users = new HashSet<>(); for (final ContributionAnnotationHistory history : histories) { final List<ContributionAnnotation> allAnnotationsInHistory = history.clear(); for (final ContributionAnnotation annotation : allAnnotationsInHistory) { annotationModels.add(annotation.getModel()); users.add(annotation.getSource()); } } for (final IAnnotationModel annotationModel : annotationModels) annotationModelHelper.removeAnnotationsFromModel( annotationModel, (a) -> a instanceof ContributionAnnotation && users.contains(((ContributionAnnotation) (a)).getSource())); }
Source:
private void on(EventDispatchedToSubscriber event) { getBuilder().addEvents(event.getPayload()); }

Target:
private void on(EventDispatchedToSubscriber event) { updateLastEventTime(event.getPayload() .getWhenDispatched()); }