auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static void setupCluster() throws Exception { File zkTmpDir = IOUtils.createTempDir("zookeeper", "distrlog"); TMP_DIRS.add(zkTmpDir); Pair<ZooKeeperServerShim, Integer> serverAndPort = LocalDLMEmulator.runZookeeperOnAnyPort(zkTmpDir); zks = serverAndPort.getLeft(); zkPort = serverAndPort.getRight(); <START> LOG.info("IKDEBUG num bookies is {}", numBookies); <END> bkutil = LocalDLMEmulator.newBuilder() .numBookies(numBookies) .zkHost("127.0.0.1") .zkPort(zkPort) .serverConf(DLMTestUtil.loadTestBkConf()) .shouldStartZK(false) .build(); bkutil.start(); zkServers = "127.0.0.1:" + zkPort; Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() { @Override public void uncaughtException(Thread t, Throwable e) { LOG.warn("Uncaught exception at Thread : ", t.getName(), e); } }); }</code><technical_language>Nit: remove Ivan Kelly's debug</technical_language>

Target:
public static void setupCluster() throws Exception { File zkTmpDir = IOUtils.createTempDir("zookeeper", "distrlog"); TMP_DIRS.add(zkTmpDir); Pair<ZooKeeperServerShim, Integer> serverAndPort = LocalDLMEmulator.runZookeeperOnAnyPort(zkTmpDir); zks = serverAndPort.getLeft(); zkPort = serverAndPort.getRight(); bkutil = LocalDLMEmulator.newBuilder() .numBookies(numBookies) .zkHost("127.0.0.1") .zkPort(zkPort) .serverConf(DLMTestUtil.loadTestBkConf()) .shouldStartZK(false) .build(); bkutil.start(); zkServers = "127.0.0.1:" + zkPort; Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() { @Override public void uncaughtException(Thread t, Throwable e) { LOG.warn("Uncaught exception at Thread : ", t.getName(), e); } }); }
Source:
<code>public void testAcquireWithDependencies() { Datastream stream = DatastreamTestUtils.createDatastream("dummy", "dummy", "dummy"); stream.getMetadata().put(DatastreamMetadataConstants.TASK_PREFIX, DatastreamTaskImpl.getTaskPrefix(stream)); DatastreamTaskImpl task = new DatastreamTaskImpl(Collections.singletonList(stream)); ZkAdapter mockZkAdapter = mock(ZkAdapter.class); task.setZkAdapter(mockZkAdapter); DatastreamTaskImpl task0 = new DatastreamTaskImpl(Collections.singletonList(stream)); <START> ZkAdapter mockZkAdapter2 = mock(ZkAdapter.class); <END> task0.setZkAdapter(mockZkAdapter2); when(mockZkAdapter2.checkIsTaskLocked(anyString(), anyString(), anyString())).thenReturn(true); task.addDependency(task0); task.acquire(Duration.ofMillis(60)); verify(mockZkAdapter, atLeastOnce()).waitForDependencies(any(DatastreamTaskImpl.class), any(Duration.class)); }</code><technical_language>nit: mockZkAdapter2 mockZkAdapter0</technical_language>

Target:
public void testAcquireWithDependencies() { Datastream stream = DatastreamTestUtils.createDatastream("dummy", "dummy", "dummy"); stream.getMetadata().put(DatastreamMetadataConstants.TASK_PREFIX, DatastreamTaskImpl.getTaskPrefix(stream)); DatastreamTaskImpl task = new DatastreamTaskImpl(Collections.singletonList(stream)); ZkAdapter mockZkAdapter = mock(ZkAdapter.class); task.setZkAdapter(mockZkAdapter); task.addDependency(createDependencyTask(stream, true)); task.acquire(Duration.ofMillis(60)); verify(mockZkAdapter, atLeastOnce()).waitForDependencies(any(DatastreamTaskImpl.class), any(Duration.class)); }
Source:
<code>void basicClear(RegionEventImpl regionEvent, boolean cacheWrite) { synchronized (clearLock) { final DistributedLockService lockService = getPartitionedRegionLockService(); try { lockService.lock("_clearOperation", -1, -1); } catch (IllegalStateException e) { <START> lockCheckReadiness(); <END> } try { if (cache.isCacheAtShutdownAll()) { throw cache.getCacheClosedException("Cache is shutting down"); } List<ClearPRMessage> clearMsgList = createClearPRMessages(); for (ClearPRMessage clearPRMessage : clearMsgList) { int bucketId = clearPRMessage.getBucketId(); checkReadiness(); long then = 0; try { sendClearMsgByBucket(bucketId, clearPRMessage); } catch (PartitionOfflineException poe) { logger.info("PR.sendClearMsgByBucket encountered PartitionOfflineException at bucket " + bucketId, poe); } catch (Exception e) { logger.info("PR.sendClearMsgByBucket encountered exception at bucket " + bucketId, e); } if (logger.isDebugEnabled()) { long now = System.currentTimeMillis(); if (now - then > 10000) { logger.debug("PR.sendClearMsgByBucket for bucket took ms", bucketId, (now - then)); } } } } finally { try { lockService.unlock("_clearOperation"); } catch (IllegalStateException e) { lockCheckReadiness(); } } regionEvent.setEventType(EnumListenerEvent.AFTER_REGION_CLEAR); notifyBridgeClients(regionEvent); } }</code><technical_language>possibly get lock, throw illegal state exception continue if lock</technical_language>

Target:
void basicClear(RegionEventImpl regionEvent, boolean cacheWrite) { final boolean isDebugEnabled = logger.isDebugEnabled(); synchronized (clearLock) { final DistributedLockService lockService = getPartitionedRegionLockService(); try { lockService.lock("_clearOperation" + this.getFullPath().replace('/', '_'), -1, -1); } catch (IllegalStateException e) { lockCheckReadiness(); throw e; } try { if (cache.isCacheAtShutdownAll()) { throw cache.getCacheClosedException("Cache is shutting down"); } List<ClearPRMessage> clearMsgList = createClearPRMessages(); for (ClearPRMessage clearPRMessage : clearMsgList) { int bucketId = clearPRMessage.getBucketId(); checkReadiness(); long sendMessagesStartTime = 0; if (isDebugEnabled) { sendMessagesStartTime = System.currentTimeMillis(); } try { sendClearMsgByBucket(bucketId, clearPRMessage); } catch (PartitionOfflineException poe) { logger.info("PR.sendClearMsgByBucket encountered PartitionOfflineException at bucket " + bucketId, poe); } catch (Exception e) { logger.info("PR.sendClearMsgByBucket encountered exception at bucket " + bucketId, e); } if (isDebugEnabled) { long now = System.currentTimeMillis(); logger.debug("PR.sendClearMsgByBucket for bucket took ms", bucketId, (now - sendMessagesStartTime)); } } } finally { try { lockService.unlock("_clearOperation" + this.getFullPath().replace('/', '_')); } catch (IllegalStateException e) { lockCheckReadiness(); } } regionEvent.setEventType(EnumListenerEvent.AFTER_REGION_CLEAR); boolean hasListener = hasListener(); if (hasListener) { dispatchListenerEvent(EnumListenerEvent.AFTER_REGION_CLEAR, regionEvent); } notifyBridgeClients(regionEvent); logger.info("Partitioned region finsihed clear operation.", this.getFullPath()); } }
Source:
<code>void recipeHeatFurnace() { addRecipe(findItemStack("Stone Heat Furnace"), "BBB", "BIB", "BiB", Character.valueOf('B'), new ItemStack(Blocks.stone), Character.valueOf('i'), findItemStack("Copper Thermal Cable"), Character.valueOf('I'), findItemStack("Combustion Chamber")); <START> addRecipe(findItemStack("Fuel Heat Furnace"), <END> "IcI", "I I", "IiI", Character.valueOf('c'), findItemStack("Cheap Chip"), Character.valueOf('I'), new ItemStack(Items.iron_ingot), Character.valueOf('i'), findItemStack("Copper Thermal Cable")); }</code><technical_language>liquid fuel, main cost is fuel default a realistic-ish simple recipe. said... Some sort of regulation for amount-of-fuel-accepted sense, need power, a motor fit. If sufficiently powerful (How 200V turbines of power?), a bit of electricity sense -- generally treating signals-level power free, nature a small peltier in anyway. Er, balancing, right. This depends powerful are, assuming this replace heat furnaces, suggest adding a cauldron in middle swapping out of side iron ingots for a motor. add code need power; a big deal. If smallest fuel burner *doesn't* capacity replace fully-upgraded heat furnace -- should. generally easier get charcoal fuel, easier handle, players get some benefit liquid fuel path</technical_language>

Target:
void recipeHeatFurnace() { addRecipe(findItemStack("Stone Heat Furnace"), "BBB", "BIB", "BiB", Character.valueOf('B'), new ItemStack(Blocks.stone), Character.valueOf('i'), findItemStack("Copper Thermal Cable"), Character.valueOf('I'), findItemStack("Combustion Chamber")); addRecipe(findItemStack("Fuel Heat Furnace"), "IcI", "mCI", "IiI", Character.valueOf('c'), findItemStack("Cheap Chip"), Character.valueOf('m'), findItemStack("Electrical Motor"), Character.valueOf('C'), new ItemStack(Items.cauldron), Character.valueOf('I'), new ItemStack(Items.iron_ingot), Character.valueOf('i'), findItemStack("Copper Thermal Cable")); }
Source:
<code>void onSaveKeyPress(KeyPressEvent e) { if <START> (e.getCharCode() == <END> KeyCodes.KEY_ENTER) { e.stopPropagation(); } }</code><technical_language>this work Firefox too, this e.getNativeEvent().getKeyCode()</technical_language>

Target:
void onSaveKeyPress(KeyPressEvent e) { if (e.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER) { e.stopPropagation(); } }
Source:
<code>private void addOffers(Campaign campaign, int num, int market, int unitType, String faction, int quality, int priceTarget) { if (faction == null) { faction = RandomFactionGenerator.getInstance().getEmployer(); } if (faction == null) { faction = campaign.getFactionCode(); market = MARKET_EMPLOYER; } <START> UnitGeneratorParameters params = new UnitGeneratorParameters(); <END> params.faction = faction; params.year = campaign.getCalendar().get(Calendar.YEAR); params.unitType = unitType; params.quality = quality; for (int i = 0; i < num; i++) { params.weightClass = getRandomWeight(unitType, faction, campaign.getCampaignOptions().getRegionalMechVariations()); params.missionRoles.clear(); MechSummary ms; if (unitType == UnitType.TANK) { params.movementModes = IUnitGenerator.MIXED_TANK_VTOL; params.missionRoles.add(MissionRole.MIXED_ARTILLERY); ms = campaign.getUnitGenerator().generate(params); } else { params.movementModes.clear(); ms = campaign.getUnitGenerator().generate(params); } if (ms != null) { if (campaign.getCampaignOptions().limitByYear() && campaign.getCalendar().get(Calendar.YEAR) < ms.getYear()) { continue; } if ((campaign.getCampaignOptions().allowClanPurchases() && ms.isClan()) || (campaign.getCampaignOptions().allowISPurchases() && !ms.isClan())) { int pct = 100 - (Compute.d6(2) - priceTarget) * 5; offers.add(new MarketOffer(market, unitType, ms.getWeightClass(), ms, pct)); } } } }</code><technical_language>whitespace is a bit off</technical_language>

Target:
private void addOffers(Campaign campaign, int num, int market, int unitType, String faction, int quality, int priceTarget) { if (faction == null) { faction = RandomFactionGenerator.getInstance().getEmployer(); } if (faction == null) { faction = campaign.getFactionCode(); market = MARKET_EMPLOYER; } UnitGeneratorParameters params = new UnitGeneratorParameters(); params.setFaction(faction); params.setYear(campaign.getCalendar().get(Calendar.YEAR)); params.setUnitType(unitType); params.setQuality(quality); for (int i = 0; i < num; i++) { params.setWeightClass(getRandomWeight(unitType, faction, campaign.getCampaignOptions().getRegionalMechVariations())); params.clearMissionRoles(); MechSummary ms; if (unitType == UnitType.TANK) { params.setMovementModes(IUnitGenerator.MIXED_TANK_VTOL); params.addMissionRole(MissionRole.MIXED_ARTILLERY); ms = campaign.getUnitGenerator().generate(params); } else { params.clearMovementModes(); ms = campaign.getUnitGenerator().generate(params); } if (ms != null) { if (campaign.getCampaignOptions().limitByYear() && campaign.getCalendar().get(Calendar.YEAR) < ms.getYear()) { continue; } if ((campaign.getCampaignOptions().allowClanPurchases() && ms.isClan()) || (campaign.getCampaignOptions().allowISPurchases() && !ms.isClan())) { int pct = 100 - (Compute.d6(2) - priceTarget) * 5; offers.add(new MarketOffer(market, unitType, ms.getWeightClass(), ms, pct)); } } } }
Source:
<code>public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); selectionMap = new LinkedHashMap<String, PlayerSelectionOption>(); selectionMap.put("ContentTree for Channel", new PlayerSelectionOption(CHANNEL_CODE, "c0cTkxOqALQviQIGAHWY5hP0q9gU", "<LINK_0>", ChannelContentTreePlayerActivity.class) ); <START> selectionMap.put("ContentTree for Playlists", new PlayerSelectionOption(CHANNEL_CODE, "c0cTkxOqALQviQIGAHWY5hP0q9gU", "<LINK_0>", PlaylistListActivity.class) ); <END> setContentView(R.layout.list_activity_layout); selectionAdapter = new ArrayAdapter<String>(this, R.layout.list_activity_list_item); for(String key : selectionMap.keySet()) { selectionAdapter.add(key); } selectionAdapter.notifyDataSetChanged(); ListView selectionListView = (ListView) findViewById(R.id.mainActivityListView); selectionListView.setAdapter(selectionAdapter); selectionListView.setOnItemClickListener(this); }</code><technical_language>do CHANNEL_CODE all? I used. Pass PCODE instead</technical_language>

Target:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); selectionMap = new LinkedHashMap<String, PlayerSelectionOption>(); selectionMap.put("ContentTree for Channel", new PlayerSelectionOption(CHANNEL_CODE, "c0cTkxOqALQviQIGAHWY5hP0q9gU", "<LINK_0>", ChannelContentTreePlayerActivity.class) ); selectionMap.put("Playlist API", new PlayerSelectionOption("", "", "<LINK_0>", PlaylistListActivity.class) ); setContentView(R.layout.list_activity_layout); selectionAdapter = new ArrayAdapter<String>(this, R.layout.list_activity_list_item); for(String key : selectionMap.keySet()) { selectionAdapter.add(key); } selectionAdapter.notifyDataSetChanged(); ListView selectionListView = (ListView) findViewById(R.id.mainActivityListView); selectionListView.setAdapter(selectionAdapter); selectionListView.setOnItemClickListener(this); }
Source:
<code>public static void setTooltipOnElement(String tooltip, Element element) { <START> if (tooltip!= null) { <END> element.setTitle(tooltip); } }</code><technical_language>want handle null tooltip well? if (tooltip != null) { element.setTitle(tooltip); } else { element.setTitle(""); }</technical_language>

Target:
public static void setTooltipOnElement(String tooltip, Element element) { if (tooltip!= null) { element.setTitle(tooltip); } else { element.setTitle(""); } }
Source:
<code>void onCommandUndoExecuted(final @Observes CanvasCommandUndoneEvent commandUndoExecutedEvent) { CanvasHandler canvasHandler = commandUndoExecutedEvent.getCanvasHandler(); if (getSession().getCanvasHandler().equals(canvasHandler)) { <START> checkNotNull("commandUndoExecutedEvent", <END> commandUndoExecutedEvent); if (null != commandUndoExecutedEvent.getCommand()) { redoCommandHandler.onUndoCommandExecuted(commandUndoExecutedEvent.getCommand()); } checkState(); } }</code><technical_language>This check is pointless, NPE thrown L#120</technical_language>

Target:
void onCommandUndoExecuted(final @Observes CanvasCommandUndoneEvent commandUndoExecutedEvent) { checkNotNull("commandUndoExecutedEvent", commandUndoExecutedEvent); CanvasHandler canvasHandler = commandUndoExecutedEvent.getCanvasHandler(); if (getSession().getCanvasHandler().equals(canvasHandler)) { if (null != commandUndoExecutedEvent.getCommand()) { redoCommandHandler.onUndoCommandExecuted(commandUndoExecutedEvent.getCommand()); } checkState(); } }
Source:
<code>public void showSurveysSyncSuccessfully() { btnCancel.setVisibility(View.INVISIBLE); dismissDialog(); <START> Toast.makeText(getActivity(), "Sucessfully Synced", Toast.LENGTH_SHORT).show(); <END> }</code><technical_language>dynamic string, please :)</technical_language>

Target:
public void showSurveysSyncSuccessfully() { btnCancel.setVisibility(View.INVISIBLE); dismissDialog(); Toast.makeText(getActivity(), R.string.sync_success, Toast.LENGTH_SHORT).show(); }
Source:
<code>public static boolean findFiles(ModContainer mod, String base, Function<Path, Boolean> preprocessor, BiFunction<Path, Path, Boolean> processor, boolean defaultUnfoundRoot) { FileSystem fs = null; try { File source = mod.getSource(); if ("minecraft".equals(mod.getModId())) { if (!DEBUG_LOAD_MINECRAFT) return true; try { URI tmp = CraftingManager.class.getResource("/assets/.mcassetsroot").toURI(); source = new File(tmp.resolve("..").getPath()); } catch (URISyntaxException e) { FMLLog.log.error("Error finding Minecraft jar: ", e); return false; } } Path root = null; if (source.isFile()) { try { fs = FileSystems.newFileSystem(source.toPath(), null); root = fs.getPath("/" + base); } catch (IOException e) { FMLLog.log.error("Error loading FileSystem from jar: ", e); return false; } } else if (source.isDirectory()) { root = source.toPath().resolve(base); } if (root == null || !Files.exists(root)) return defaultUnfoundRoot; if (preprocessor != null) { Boolean cont = preprocessor.apply(root); if (cont == null || !cont.booleanValue()) return false; } boolean success = true; if (processor != null) { Iterator<Path> itr = null; try { itr = Files.walk(root).iterator(); } catch (IOException e) { FMLLog.log.error("Error iterating filesystem for: {}", mod.getModId(), e); return false; } while (itr != null && itr.hasNext()) { Boolean ret = processor.apply(root, itr.next()); <START> success &= ret == null ? false : ret; <END> } } return success; } finally { IOUtils.closeQuietly(fs); } }</code><technical_language>ret == null ? false : ret replaced ret != null && ret, is a more consise</technical_language>

Target:
public static boolean findFiles(ModContainer mod, String base, Function<Path, Boolean> preprocessor, BiFunction<Path, Path, Boolean> processor, boolean defaultUnfoundRoot) { return findFiles(mod, base, preprocessor, processor, defaultUnfoundRoot, false); }
Source:
<code>public Iterable<VMHardware> listHardwareProfiles() { final List<VMHardware> hwProfiles = Lists.newArrayList(); final List<String> locationIds = Lists.newArrayList(); Iterable<Location> locations = listLocations(); for (Location location : locations){ locationIds.add(location.name()); VMHardware hwProfile = new VMHardware(); hwProfile.name = "Standard_A5"; hwProfile.numberOfCores = 2; hwProfile.osDiskSizeInMB = 1047552; hwProfile.resourceDiskSizeInMB = 138240; hwProfile.memoryInMB = 14336; hwProfile.maxDataDiskCount = 4; hwProfile.location = "westus"; <START> hwProfiles.add(hwProfile); <END> } checkAndSetHwAvailability(hwProfiles, Sets.newHashSet(locationIds)); return hwProfiles; }</code><technical_language>need remove hardcoded hardware profiles merging. want restrict users this configuration</technical_language>

Target:
public Iterable<VMHardware> listHardwareProfiles() { final List<VMHardware> hwProfiles = Lists.newArrayList(); final List<String> locationIds = Lists.newArrayList(); Iterable<Location> locations = listLocations(); for (Location location : locations){ locationIds.add(location.name()); Iterable<VMSize> vmSizes = api.getVMSizeApi(location.name()).list(); for (VMSize vmSize : vmSizes){ VMHardware hwProfile = VMHardware.create( vmSize.name(), vmSize.numberOfCores(), vmSize.osDiskSizeInMB(), vmSize.resourceDiskSizeInMB(), vmSize.memoryInMB(), vmSize.maxDataDiskCount(), location.name(), false); hwProfiles.add(hwProfile); } } checkAndSetHwAvailability(hwProfiles, Sets.newHashSet(locationIds)); return hwProfiles; }
Source:
<code>public <T> T instanceFor(Class<T> type) { type = (Class<T>) Proxies.extractRawType(type); <START> logger.debug("asking cdi to get instance for {}", type); <END> Bean<?> bean = getBeanFrom(type); CreationalContext<?> ctx = beanManager.createCreationalContext(bean); return (T) beanManager.getReference(bean, type, ctx); }</code><technical_language>_extract method_ here, avoid duplicated code instanceFor canProvide methods (just type = extractRawType(type)) add this 2 lines getBeanFrom</technical_language>

Target:
public <T> T instanceFor(Class<T> type) { Bean<?> bean = getBeanFrom(type); CreationalContext<?> ctx = beanManager.createCreationalContext(bean); return (T) beanManager.getReference(bean, type, ctx); }
Source:
<code>public static Topology getTopology() { final StreamsBuilder streamsBuilder = new StreamsBuilder(); final KTable<Integer, Article> articles = streamsBuilder.table(ARTICLE_SOURCE, Consumed.with(intSerde, new Article.ArticleSerde())); final KTable<Integer, Comment> comments = streamsBuilder.table(COMMENT_SOURCE, Consumed.with(intSerde, new Comment.CommentSerde())); final KTable<Integer, Long> commentCounts = comments.groupBy((key, value) -> new KeyValue<>(value.getArticleId(), (short) 1), Grouped.with(Serdes.Integer(), Serdes.Short())) .count(); final ValueJoiner<Article, Long, AugmentedArticle> fkJoiner = (article, commentCount) -> new AugmentedArticle( article.getKey(), article.getTimestamp(), article.getText(), commentCount == null ? 0 : commentCount ); articles .leftJoin(commentCounts, fkJoiner, Materialized.with(null, new AugmentedArticle.AugmentedArticleSerde())) .toStream() .to(ARTICLE_RESULT_SINK); comments.join(articles, Comment::getArticleId, AugmentedComment.joiner(), Materialized.with(null, new AugmentedComment.AugmentedCommentSerde())) .toStream() .to(COMMENT_RESULT_SINK); <START> <END> return streamsBuilder.build(); }</code><technical_language>Nice projecting value</technical_language>

Target:
public static Topology getTopology() { final StreamsBuilder streamsBuilder = new StreamsBuilder(); final KTable<Integer, Article> articles = streamsBuilder.table(ARTICLE_SOURCE, Consumed.with(intSerde, new Article.ArticleSerde())); final KTable<Integer, Comment> comments = streamsBuilder.table(COMMENT_SOURCE, Consumed.with(intSerde, new Comment.CommentSerde())); final KTable<Integer, Long> commentCounts = comments.groupBy((key, value) -> new KeyValue<>(value.getArticleId(), (short) 1), Grouped.with(Serdes.Integer(), Serdes.Short())) .count(); articles .leftJoin(commentCounts, AugmentedArticle.joiner(), Materialized.with(null, new AugmentedArticle.AugmentedArticleSerde())) .toStream() .to(ARTICLE_RESULT_SINK); comments.join(articles, Comment::getArticleId, AugmentedComment.joiner(), Materialized.with(null, new AugmentedComment.AugmentedCommentSerde())) .toStream() .to(COMMENT_RESULT_SINK); return streamsBuilder.build(); }
Source:
<code>public void setDomains(ArrayList<VDSDomainsData> domains) { if (domains != null && this.domains == null) { <START> log.info("received first <END> domain report for host {}", cachedVds.getName()); } this.domains = domains; }</code><technical_language>Received? (Looks other log messages capitalized)</technical_language>

Target:
public void setDomains(ArrayList<VDSDomainsData> domains) { if (domains != null && this.domains == null) { log.info("Received first domain report for host {}", cachedVds.getName()); } this.domains = domains; }
Source:
<code>public CreateRequest processPreCreate(CreateRequest input) throws StopProcessingException { ddf.security.Subject subject = setSubjectOnRequestProperties(input); if (input.getMetacards() != null && subject != null) { input .getMetacards() .forEach( metacard -> { <START> String emailAddress = SubjectUtils.getEmailAddress(subject); <END> if ((metacard.getTags().isEmpty() || metacard.getTags().contains("resource")) && StringUtils.isNotBlank(emailAddress)) { metacard.setAttribute(new AttributeImpl(Metacard.POINT_OF_CONTACT, emailAddress)); } }); } return input; }</code><technical_language>Is a reason want unique identifier well</technical_language>

Target:
public CreateRequest processPreCreate(CreateRequest input) throws StopProcessingException { ddf.security.Subject subject = setSubjectOnRequestProperties(input); if (input.getMetacards() != null && subject != null) { input .getMetacards() .forEach( metacard -> { String id = subjectIdentity.getUniqueIdentifier(subject); if ((metacard.getTags().isEmpty() || metacard.getTags().contains("resource")) && StringUtils.isNotBlank(id)) { metacard.setAttribute(new AttributeImpl(Metacard.POINT_OF_CONTACT, id)); } }); } return input; }
Source:
<code><START> public static <T> Flowable<T> fromCompletionStage(@NonNull CompletionStage<T> stage) { <END> ObjectHelper.requireNonNull(stage, "stage is null"); return RxJavaPlugins.onAssembly(new FlowableFromCompletionStage<>(stage)); }</code><technical_language>+NonNull for return type</technical_language>

Target:
public static <T> Flowable<@NonNull T> fromCompletionStage(@NonNull CompletionStage<T> stage) { ObjectHelper.requireNonNull(stage, "stage is null"); return RxJavaPlugins.onAssembly(new FlowableFromCompletionStage<>(stage)); }
Source:
<code>public Date fromString(String value) { if (!StringUtils.isBlank(value)) { if (DateFormat.NOW.equals(value)) { return new Date(); } if (this.formats != null && this.formats.length > 0) { for (String format : this.formats) { try { SimpleDateFormat formatter = new SimpleDateFormat(format); return formatter.parse(value); } catch (ParseException exception) { } } String message = "Unable to parse date parameter: " + value; throw new RuntimeException(message); } else { try { return DatatypeConverter.parseDateTime(value).getTime(); } catch (IllegalArgumentException exception) { String message = "Unable to parse date parameter; must use ISO 8601 format: " + value; <START> throw new RuntimeException(message); <END> } } } return null; }</code><technical_language>loop include ISO 8601? If not, get if other candidates</technical_language>

Target:
public Date fromString(String value) { if (!StringUtils.isBlank(value)) { if (DateFormat.NOW.equals(value)) { return new Date(); } if (this.formats != null && this.formats.length > 0) { for (String format : this.formats) { log.debug("Attempting to parse date \"{}\" using format: {}", value, format); try { SimpleDateFormat formatter = new SimpleDateFormat(format); return formatter.parse(value); } catch (ParseException exception) { log.debug("Unable to parse date \"{}\" with format {}", value, format, exception); } } log.debug("Unable to parse date: {}", value); throw new RuntimeException(I18n.marktr("Unable to parse date parameter")); } else { try { log.debug("Attempting to parse date \"{}\" using ISO8601 date converter", value); return DatatypeConverter.parseDateTime(value).getTime(); } catch (IllegalArgumentException exception) { log.debug("Unable to parse date \"{}\" using ISO8601 date converter", value, exception); throw new RuntimeException(I18n.marktr("Unable to parse date parameter")); } } } return null; }
Source:
<code>public Collection<ConfiguredBundle<T>> getConfiguredBundles() { <START> return new ArrayList<>(); <END> }</code><technical_language>return Collections.emptyList();</technical_language>

Target:
public Iterable<ConfiguredBundle<T>> getConfiguredBundles() { return Collections.emptyList(); }
Source:
<code>public void emptyValueListOnColumnShouldNotCountAsAnEnum() throws Exception { analyzerProvider.getFactTypes().add(new FactTypes.FactType("Data", <START> new HashSet<FactTypes.Field>() {{ <END> add(new FactTypes.Field("totalAmount", org.drools.verifier.core.index.model.DataType.TYPE_NUMERIC_FLOAT)); }})); final String xml = loadResource("DROOLS-5059.gdst"); final Analyzer analyzer = analyzerProvider.makeAnalyser(GuidedDTXMLPersistence.getInstance() .unmarshal(xml)); analyzer.resetChecks(); analyzer.analyze(); Set<Issue> analysisReport = analyzerProvider.getAnalysisReport(); assertOnlyContains(analysisReport, CheckType.MISSING_RANGE); }</code><technical_language>please <LINK_0> ? builders created eliminate double brace static field initialization - is marked bad pattern sonar</technical_language>

Target:
public void emptyValueListOnColumnShouldNotCountAsAnEnum() throws Exception { analyzerProvider.getFactTypes() .add(new FactTypes.FactType("Data", new Sets.Builder<FactTypes.Field>() .add(new FactTypes.Field("totalAmount", org.drools.verifier.core.index.model.DataType.TYPE_NUMERIC_FLOAT)) .build())); final String xml = loadResource("DROOLS-5059.gdst"); final Analyzer analyzer = analyzerProvider.makeAnalyser(GuidedDTXMLPersistence.getInstance() .unmarshal(xml)); analyzer.resetChecks(); analyzer.analyze(); Set<Issue> analysisReport = analyzerProvider.getAnalysisReport(); assertOnlyContains(analysisReport, CheckType.MISSING_RANGE); }
Source:
<code>private static void generateConstructor( ClassDefinition classDefinition, FieldDefinition sessionField, CachedInstanceBinder cachedInstanceBinder, PreGeneratedExpressions preGeneratedExpressions) { Parameter sessionParameter = arg("session", ConnectorSession.class); MethodDefinition constructorDefinition = classDefinition.declareConstructor(a(PUBLIC), sessionParameter); BytecodeBlock body = constructorDefinition.getBody(); Variable thisVariable = constructorDefinition.getThis(); body.comment("super();") .append(thisVariable) .invokeConstructor(Object.class); body.append(thisVariable.setField(sessionField, sessionParameter)); cachedInstanceBinder.generateInitializations(thisVariable, body); preGeneratedExpressions.getLambdaFieldMap().values().forEach( lambdaExpressionField -> lambdaExpressionField.generateInitialization(thisVariable, body) <START> ); <END> body.ret(); }</code><technical_language>for-loop. easier read here</technical_language>

Target:
private static void generateConstructor( ClassDefinition classDefinition, FieldDefinition sessionField, CachedInstanceBinder cachedInstanceBinder, PreGeneratedExpressions preGeneratedExpressions) { Parameter sessionParameter = arg("session", ConnectorSession.class); MethodDefinition constructorDefinition = classDefinition.declareConstructor(a(PUBLIC), sessionParameter); BytecodeBlock body = constructorDefinition.getBody(); Variable thisVariable = constructorDefinition.getThis(); body.comment("super();") .append(thisVariable) .invokeConstructor(Object.class); body.append(thisVariable.setField(sessionField, sessionParameter)); cachedInstanceBinder.generateInitializations(thisVariable, body); for (LambdaExpressionField field : preGeneratedExpressions.getLambdaFieldMap().values()) { field.generateInitialization(thisVariable, body); } body.ret(); }
Source:
<code>private void waitForSubscribers() throws InterruptedException { while ( !publishProcessor.hasSubscribers() ) { Thread.sleep( 100 ); <START> logChannel.logDebug( getString( PKG, "BlockingQueueStream.WaitForSubscribers" ) ); <END> } }</code><technical_language>potentially flood logging if debug logging enabled</technical_language>

Target:
private void waitForSubscribers() throws InterruptedException { logChannel.logDebug( getString( PKG, "BlockingQueueStream.WaitForSubscribers" ) ); while ( !publishProcessor.hasSubscribers() ) { Thread.sleep( 100 ); } logChannel.logDebug( getString( PKG, "BlockingQueueStream.HasSubscribers" ) ); }
Source:
<code>void waitForAppToFinish() { workers.shutdown(); try { boolean finishedInTime = workers. awaitTermination(durationMs + APPLICATION_TIMEOUT_IN_MS, TimeUnit.MILLISECONDS); if (!finishedInTime) { log.error("not finished in time."); System.exit(1); } } catch (InterruptedException e) { log.error(String.valueOf(e)); throw new UnrecoverableCorfuInterruptedError(e); } finally { <START> System.exit(0); <END> } }</code><technical_language>Please System.exit() exclude main method</technical_language>

Target:
void waitForAppToFinish() { workers.shutdown(); try { boolean finishedInTime = workers. awaitTermination(DURATION_IN_MS + APPLICATION_TIMEOUT_IN_MS, TimeUnit.MILLISECONDS); if (!finishedInTime) { log.error("not finished in time."); System.exit(0); } } catch (InterruptedException e) { log.error(String.valueOf(e)); throw new UnrecoverableCorfuInterruptedError(e); } finally { System.exit(1); } }
Source:
<code>protected IResourceVariant fetchVariant(IResource resource, int depth, IProgressMonitor monitor) throws TeamException { SubMonitor subMonitor = SubMonitor.convert(monitor); <START> if (resource == null || isNonWorksapce(resource)) { <END> subMonitor.done(); return null; } subMonitor.beginTask(NLS.bind( CoreText.GitResourceVariantTree_fetchingVariant, resource.getName()), IProgressMonitor.UNKNOWN); try { return fetchVariant(resource); } finally { subMonitor.done(); } }</code><technical_language>typo: s/isNonWorksapce/isNonWorkspace/</technical_language>

Target:
protected IResourceVariant fetchVariant(IResource resource, int depth, IProgressMonitor monitor) throws TeamException { SubMonitor subMonitor = SubMonitor.convert(monitor); if (resource == null || isNonWorkspace(resource)) { subMonitor.done(); return null; } subMonitor.beginTask(NLS.bind( CoreText.GitResourceVariantTree_fetchingVariant, resource.getName()), IProgressMonitor.UNKNOWN); try { return fetchVariant(resource); } finally { subMonitor.done(); } }
Source:
<code>private void storeFirmware(final SmartMeter smartMeteringDevice, final List<FirmwareVersion> firmwareVersions, final String organisationIdentification) throws FunctionalException { if (firmwareVersions.size() != 3) { LOGGER.error("Firmware can not be determined because to few module firmware versions were returned."); throw new FunctionalException(FunctionalExceptionType.UNKNOWN_FIRMWARE, ComponentType.DOMAIN_SMART_METERING); } String comm = "", ma = "", func = ""; for (FirmwareVersion firmwareVersion : firmwareVersions) { switch (firmwareVersion.getType()) { case COMMUNICATION: comm = firmwareVersion.getVersion(); break; case MODULE_ACTIVE: ma = firmwareVersion.getVersion(); break; case ACTIVE_FIRMWARE: func = firmwareVersion.getVersion(); break; default: } } List<Firmware> firmwares = this.firmwareRepository .findByModuleVersionCommAndModuleVersionMaAndModuleVersionFunc(comm, ma, func); if (firmwares.size() != 1) { <START> LOGGER.error("Non existing combination of firmware modules returned by device."); <END> throw new FunctionalException(FunctionalExceptionType.UNKNOWN_FIRMWARE, ComponentType.DOMAIN_SMART_METERING); } smartMeteringDevice.setFirmware(firmwares.get(0), organisationIdentification); smartMeterRepository.save(smartMeteringDevice); }</code><technical_language>"Non existing" sounds a bit strange, apparently combination exists a device. "Non registered" more appropriate. For error message helpful if list of firmware versions included</technical_language>

Target:
private void storeFirmware(final SmartMeter smartMeteringDevice, final List<FirmwareVersion> firmwareVersions, final String organisationIdentification) throws FunctionalException { if (firmwareVersions.size() != 3) { LOGGER.error( "Firmware can not be determined because 3 module firmware versions are expected, but were returned.", firmwareVersions.size()); throw new FunctionalException(FunctionalExceptionType.UNKNOWN_FIRMWARE, ComponentType.DOMAIN_SMART_METERING); } String comm = "", ma = "", func = ""; for (FirmwareVersion firmwareVersion : firmwareVersions) { switch (firmwareVersion.getType()) { case COMMUNICATION: comm = firmwareVersion.getVersion(); break; case MODULE_ACTIVE: ma = firmwareVersion.getVersion(); break; case ACTIVE_FIRMWARE: func = firmwareVersion.getVersion(); break; default: LOGGER.error("Cannot handle firmware version type: {}", firmwareVersion.getType().name()); throw new FunctionalException(FunctionalExceptionType.UNKNOWN_FIRMWARE, ComponentType.DOMAIN_SMART_METERING); } } List<Firmware> firmwares = this.firmwareRepository .findByModuleVersionCommAndModuleVersionMaAndModuleVersionFunc(comm, ma, func); if (firmwares.size() != 1) { LOGGER.error( "Non registered combination of firmware modules returned by device: Communication Module Active - {}, Module Active - {}, Active - {}.", comm, ma, func); throw new FunctionalException(FunctionalExceptionType.UNKNOWN_FIRMWARE, ComponentType.DOMAIN_SMART_METERING); } smartMeteringDevice.setFirmware(firmwares.get(0), organisationIdentification); smartMeterRepository.save(smartMeteringDevice); }
Source:
<code>private SolrClient getClient(SolrContainer container) { if (client == null) { <START> client = new Http2SolrClient.Builder("http://localhost:" + container.getSolrPort() + "/solr").build(); <END> } return client; }</code><technical_language>localhost issue</technical_language>

Target:
private SolrClient getClient(SolrContainer container) { if (client == null) { client = new Http2SolrClient.Builder("http://" + container.getContainerIpAddress() + ":" + container.getSolrPort() + "/solr").build(); } return client; }
Source:
<code>@Override public Optionality getDistinctOptionality() { final Optionality optionality; switch (kind) { case BIT_AND: case BIT_OR: optionality = Optionality.IGNORED; break; default: optionality = Optionality.OPTIONAL; <START> } <END> return optionality; }</code><technical_language>add BIT_XOR default</technical_language>

Target:
@Override public Optionality getDistinctOptionality() { final Optionality optionality; switch (kind) { case BIT_AND: case BIT_OR: optionality = Optionality.IGNORED; break; case BIT_XOR: optionality = Optionality.OPTIONAL; break; default: optionality = Optionality.OPTIONAL; } return optionality; }
Source:
<code>protected static ServerJMSMessage processMessageAnnotations(ServerJMSMessage jms, MessageAnnotations annotations) throws Exception { if (annotations != null && annotations.getValue() != null) { for (Map.Entry<?, ?> entry : annotations.getValue().entrySet()) { String key = entry.getKey().toString(); if ("x-opt-delivery-time".equals(key) && entry.getValue() != null) { long deliveryTime = ((Number) entry.getValue()).longValue(); jms.setLongProperty(HDR_SCHEDULED_DELIVERY_TIME.toString(), deliveryTime); } else if ("x-opt-delivery-delay".equals(key) && entry.getValue() != null) { long delay = ((Number) entry.getValue()).longValue(); if (delay > 0) { jms.setLongProperty(HDR_SCHEDULED_DELIVERY_TIME.toString(), System.currentTimeMillis() + delay); } <START> } else if (AMQPMessageSupport.INGRESS_TIMESTAMP.toString().equals(key) && entry.getValue() != null) { jms.setLongProperty(HDR_INGRESS_TIMESTAMP.toString(), ((Number) entry.getValue()).longValue()); <END> } try { setProperty(jms, JMS_AMQP_MESSAGE_ANNOTATION_PREFIX + key, entry.getValue()); } catch (ActiveMQPropertyConversionException e) { encodeUnsupportedMessagePropertyType(jms, JMS_AMQP_ENCODED_MESSAGE_ANNOTATION_PREFIX + key, entry.getValue()); } } } return jms; }</code><technical_language>I defining a string constant (then in definition of a Symbol constant if needed elsewhere) nicer calling toString() Symbol constant place. existing issue for surrounding bits diff context shows, suggesting fix here, worth changing for this if agree building in more examples of it</technical_language>

Target:
protected static ServerJMSMessage processMessageAnnotations(ServerJMSMessage jms, MessageAnnotations annotations) throws Exception { if (annotations != null && annotations.getValue() != null) { for (Map.Entry<?, ?> entry : annotations.getValue().entrySet()) { String key = entry.getKey().toString(); if ("x-opt-delivery-time".equals(key) && entry.getValue() != null) { long deliveryTime = ((Number) entry.getValue()).longValue(); jms.setLongProperty(HDR_SCHEDULED_DELIVERY_TIME.toString(), deliveryTime); } else if ("x-opt-delivery-delay".equals(key) && entry.getValue() != null) { long delay = ((Number) entry.getValue()).longValue(); if (delay > 0) { jms.setLongProperty(HDR_SCHEDULED_DELIVERY_TIME.toString(), System.currentTimeMillis() + delay); } } else if (AMQPMessageSupport.HDR_INGRESS_TIME.equals(key) && entry.getValue() != null) { jms.setLongProperty(HDR_INGRESS_TIME.toString(), ((Number) entry.getValue()).longValue()); } try { setProperty(jms, JMS_AMQP_MESSAGE_ANNOTATION_PREFIX + key, entry.getValue()); } catch (ActiveMQPropertyConversionException e) { encodeUnsupportedMessagePropertyType(jms, JMS_AMQP_ENCODED_MESSAGE_ANNOTATION_PREFIX + key, entry.getValue()); } } } return jms; }
Source:
<code>private SecondaryAction getSecondaryAction() { if (!userCanPublishPosts()) { return SecondaryAction.NONE; } switch (PostStatus.fromPost(mPost)) { case DRAFT: return SecondaryAction.SAVE; case PENDING: case SCHEDULED: return SecondaryAction.PUBLISH_NOW; case PRIVATE: case PUBLISHED: return SecondaryAction.NONE; case TRASHED: case UNKNOWN: return SecondaryAction.SAVE_AS_DRAFT; } <START> return SecondaryAction.NONE; <END> }</code><technical_language>I this line is technically unreachable, right? want follow fail fast principle throw exception here. Imagine forgets "return" keyword. This code continue work app in undefined state. Wdyt</technical_language>

Target:
private SecondaryAction getSecondaryAction() { if (!userCanPublishPosts()) { switch (PostStatus.fromPost(mPost)) { case SCHEDULED: case DRAFT: case PENDING: case PRIVATE: case PUBLISHED: case UNKNOWN: return SecondaryAction.NONE; case TRASHED: return SecondaryAction.SAVE_AS_DRAFT; } } switch (PostStatus.fromPost(mPost)) { case DRAFT: return SecondaryAction.SAVE; case PENDING: case SCHEDULED: return SecondaryAction.PUBLISH_NOW; case PRIVATE: case PUBLISHED: return SecondaryAction.NONE; case TRASHED: case UNKNOWN: return SecondaryAction.SAVE_AS_DRAFT; } throw new IllegalStateException( "Switch in getSecondaryAction is missing a required case or the case is missing \"return\" keyword "); }
Source:
<code>public void visitMemberSelectExpression(MemberSelectExpressionTree tree) { if (tree.expression().is(Tree.Kind.IDENTIFIER)) { IdentifierTree identifier = (IdentifierTree) tree.expression(); <START> final Symbol owner = identifier.symbol().owner(); <END> if (owner != null && owner.isMethodSymbol()) { return; } } if (tree.expression().symbolType().isSubtypeOf("java.lang.Class")) { return; } super.visitMemberSelectExpression(tree); }</code><technical_language>remove final modifier</technical_language>

Target:
public void visitMemberSelectExpression(MemberSelectExpressionTree tree) { if (tree.expression().is(Tree.Kind.IDENTIFIER)) { IdentifierTree identifier = (IdentifierTree) tree.expression(); Symbol owner = identifier.symbol().owner(); if (owner != null && owner.isMethodSymbol()) { return; } } if (tree.expression().symbolType().isSubtypeOf("java.lang.Class")) { return; } super.visitMemberSelectExpression(tree); }
Source:
<code>public static Distribution fromValue(String value) { <START> return tryFind(asList(Distribution.values()), hasValue(value)).or(UNRECOGNIZED); <END> }</code><technical_language>a static variable for asList(Distribution.values()</technical_language>

Target:
public static Distribution fromValue(String value) { return tryFind(values, hasValue(value)).or(UNRECOGNIZED); }
Source:
<code>private List<SymbolInformationDto> symbol(ExtendedWorkspaceSymbolParams workspaceSymbolParams) { List<SymbolInformationDto> result = new ArrayList<>(); List<InitializedLanguageServer> servers; try { servers = registry .getApplicableLanguageServers(prefixURI(workspaceSymbolParams.getFileUri())) .stream() .flatMap(Collection::stream) .collect(Collectors.toList()); OperationUtil.doInParallel( servers, new LSOperation<InitializedLanguageServer, List<? extends SymbolInformation>>() { @Override public boolean canDo(InitializedLanguageServer element) { return truish( element.getInitializeResult().getCapabilities().getWorkspaceSymbolProvider()); } @Override public CompletableFuture<List<? extends SymbolInformation>> start( InitializedLanguageServer element) { return element.getServer().getWorkspaceService().symbol(workspaceSymbolParams); } @Override public boolean handleResult( InitializedLanguageServer element, List<? extends SymbolInformation> locations) { locations.forEach( o -> { <START> o.getLocation().setUri(removeFilePrefix(o.getLocation().getUri())); <END> result.add(new SymbolInformationDto(o)); }); return true; } }, 10000); return result; } catch (LanguageServerException e) { LOG.error("error getting symbol", e); throw new JsonRpcException(-27000, e.getMessage()); } }</code><technical_language>setUri method suppose set uri set relative path</technical_language>

Target:
private List<SymbolInformationDto> symbol(ExtendedWorkspaceSymbolParams workspaceSymbolParams) { List<SymbolInformationDto> result = new ArrayList<>(); List<InitializedLanguageServer> servers; try { servers = registry .getApplicableLanguageServers(prefixURI(workspaceSymbolParams.getFileUri())) .stream() .flatMap(Collection::stream) .collect(Collectors.toList()); OperationUtil.doInParallel( servers, new LSOperation<InitializedLanguageServer, List<? extends SymbolInformation>>() { @Override public boolean canDo(InitializedLanguageServer element) { return truish( element.getInitializeResult().getCapabilities().getWorkspaceSymbolProvider()); } @Override public CompletableFuture<List<? extends SymbolInformation>> start( InitializedLanguageServer element) { return element.getServer().getWorkspaceService().symbol(workspaceSymbolParams); } @Override public boolean handleResult( InitializedLanguageServer element, List<? extends SymbolInformation> locations) { locations.forEach( o -> { o.getLocation().setUri(removePrefixUri(o.getLocation().getUri())); result.add(new SymbolInformationDto(o)); }); return true; } }, 10000); return result; } catch (LanguageServerException e) { LOG.error("error getting symbol", e); throw new JsonRpcException(-27000, e.getMessage()); } }
Source:
<code>public static Configuration getLoginConfiguration() { Configuration configuration = null; try { configuration = Configuration.getConfiguration(); } catch (SecurityException e) { <START> if (SystemUtils.IS_JAVA_1_6 && !IBM_JDK) { <END> LOGGER.debug("Unable to load default login configuration", e); } else { throw e; } } return configuration; }</code><technical_language>this changed JDK 8 more</technical_language>

Target:
public static Configuration getLoginConfiguration() { return Configuration.getConfiguration(); }
Source:
<code>private static IProject createExistingProject(final ProjectRecord record, final boolean open, IProgressMonitor monitor) throws CoreException { String projectName = record.getProjectName(); final IWorkspace workspace = ResourcesPlugin.getWorkspace(); final IProject project = workspace.getRoot().getProject(projectName); if (project.exists()) { if (open && !project.isOpen()) { SubMonitor progress = SubMonitor.convert(monitor, 2); IPath location = project.getFile( IProjectDescription.DESCRIPTION_FILE_NAME) .getLocation(); if (location != null && location.toFile().equals( record.getProjectSystemFile())) { project.open(progress.newChild(1)); project.refreshLocal(IResource.DEPTH_INFINITE, progress.newChild(1)); } } return null; } if (record.getProjectDescription() == null) { record.setProjectDescription(workspace .newProjectDescription(projectName)); IPath locationPath = new Path(record.getProjectSystemFile() .getAbsolutePath()); if (Platform.getLocation().isPrefixOf(locationPath)) record.getProjectDescription().setLocation(null); else record.getProjectDescription().setLocation(locationPath); } else { record.getProjectDescription().setName(projectName); } SubMonitor progress = SubMonitor.convert(monitor, 8); progress.setTaskName( <START> UIText.WizardProjectsImportPage_CreateProjectsTask); <END> project.create(record.getProjectDescription(), progress.newChild(3)); project.open(IResource.BACKGROUND_REFRESH, progress.newChild(5)); return project; }</code><technical_language>I simply SubMonitor.convert(monitor, UIText.WizardProjectsImportPage_CreateProjectsTask, 8); here</technical_language>

Target:
private static IProject createExistingProject(final ProjectRecord record, final boolean open, IProgressMonitor monitor) throws CoreException { String projectName = record.getProjectName(); final IWorkspace workspace = ResourcesPlugin.getWorkspace(); final IProject project = workspace.getRoot().getProject(projectName); if (project.exists()) { if (open && !project.isOpen()) { SubMonitor progress = SubMonitor.convert(monitor, 2); IPath location = project.getFile( IProjectDescription.DESCRIPTION_FILE_NAME) .getLocation(); if (location != null && location.toFile().equals( record.getProjectSystemFile())) { project.open(progress.newChild(1)); project.refreshLocal(IResource.DEPTH_INFINITE, progress.newChild(1)); } } return null; } if (record.getProjectDescription() == null) { record.setProjectDescription(workspace .newProjectDescription(projectName)); IPath locationPath = new Path(record.getProjectSystemFile() .getAbsolutePath()); if (Platform.getLocation().isPrefixOf(locationPath)) record.getProjectDescription().setLocation(null); else record.getProjectDescription().setLocation(locationPath); } else { record.getProjectDescription().setName(projectName); } SubMonitor progress = SubMonitor.convert(monitor, UIText.WizardProjectsImportPage_CreateProjectsTask, 8); project.create(record.getProjectDescription(), progress.newChild(3)); project.open(IResource.BACKGROUND_REFRESH, progress.newChild(5)); return project; }