auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private boolean executeWithoutTransaction() { boolean functionReturnValue = false; boolean exceptionOccurred = true; try { logRunningCommand(); if (hasTaskHandlers()) { getCurrentTaskHandler().execute(); } else { executeCommand(); } functionReturnValue = getSucceeded(); exceptionOccurred = false; } catch (VdcBLLException e) { <START> setCommandStatus(CommandStatus.FAILED); <END> log.error(String.format("Command %1$s throw Vdc Bll exception. With error message %2$s", getClass().getName(), e.getMessage())); if (log.isDebugEnabled()) { log.debug(String.format("Command %1$s throw Vdc Bll exception", getClass().getName()), e); } processExceptionToClient(new VdcFault(e, e.getVdsError().getCode())); } catch (RuntimeException e) { setCommandStatus(CommandStatus.FAILED); processExceptionToClient(new VdcFault(e, VdcBllErrors.ENGINE)); log.error(String.format("Command %1$s throw exception", getClass().getName()), e); } finally { if (exceptionOccurred || !getSucceeded()) { setSucceeded(false); compensate(); } else { cleanUpCompensationData(); } } return functionReturnValue; }</code><technical_language>status is exceptionOccurred? why? If this in "finally" section</technical_language>

Target:
private boolean executeWithoutTransaction() { boolean functionReturnValue = false; boolean exceptionOccurred = true; try { logRunningCommand(); if (hasTaskHandlers()) { getCurrentTaskHandler().execute(); } else { executeCommand(); } functionReturnValue = getSucceeded(); exceptionOccurred = false; } catch (VdcBLLException e) { log.error(String.format("Command %1$s throw Vdc Bll exception. With error message %2$s", getClass().getName(), e.getMessage())); if (log.isDebugEnabled()) { log.debug(String.format("Command %1$s throw Vdc Bll exception", getClass().getName()), e); } processExceptionToClient(new VdcFault(e, e.getVdsError().getCode())); } catch (RuntimeException e) { processExceptionToClient(new VdcFault(e, VdcBllErrors.ENGINE)); log.error(String.format("Command %1$s throw exception", getClass().getName()), e); } finally { if (exceptionOccurred || !getSucceeded()) { setCommandStatus(CommandStatus.FAILED); setSucceeded(false); compensate(); } else { cleanUpCompensationData(); } } return functionReturnValue; }
Source:
<code>public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list) { for (EnumPanelType panelType : EnumPanelType.values()) { list.add(new ItemStack(this, 1, panelType.ordinal())); <START> System.out.println((new ItemStack(this, 1, panelType.ordinal())) + "daad"); <END> } }</code><technical_language>PLz, remove this</technical_language>

Target:
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list) { for (EnumPanelType panelType : EnumPanelType.values()) { list.add(new ItemStack(this, 1, panelType.ordinal())); } }
Source:
<code><START> public void addDependencies(ChangeAttribute ca, Change change) { <END> ca.dependsOn = new ArrayList<DependencyAttribute>(); ca.neededBy = new ArrayList<DependencyAttribute>(); try { final ReviewDb db = schema.open(); try { final PatchSet.Id psId = change.currentPatchSetId(); for (PatchSetAncestor a : db.patchSetAncestors().ancestorsOf(psId)) { for (PatchSet p : db.patchSets().byRevision(a.getAncestorRevision())) { Change c = db.changes().get(p.getId().getParentKey()); ca.dependsOn.add(newDependsOn(c, p)); } } final RevId revId = db.patchSets().get(psId).getRevision(); for (PatchSetAncestor a : db.patchSetAncestors().descendantsOf(revId)) { final PatchSet p = db.patchSets().get(a.getPatchSet()); final Change c = db.changes().get(p.getId().getParentKey()); ca.neededBy.add(newNeededBy(c, p)); } } finally { db.close(); } } catch (OrmException e) { } if (ca.dependsOn.isEmpty()) { ca.dependsOn = null; } if (ca.neededBy.isEmpty()) { ca.neededBy = null; } }</code><technical_language>Similar code traverse dependencies is in ChangeDetailFactory soon in Rebase-feature (an upcoming patch set). thinking refactor out dependency related code place a bit more reusable. I imagine more features needs deal change dependencies. change in this patchset, observation :)</technical_language>

Target:
public void addDependencies(ChangeAttribute ca, Change change) { ca.dependsOn = new LinkedList<DependencyAttribute>(); ca.neededBy = new LinkedList<DependencyAttribute>(); try { final ReviewDb db = schema.open(); try { final PatchSet.Id psId = change.currentPatchSetId(); for (PatchSetAncestor a : db.patchSetAncestors().ancestorsOf(psId)) { for (PatchSet p : db.patchSets().byRevision(a.getAncestorRevision())) { Change c = db.changes().get(p.getId().getParentKey()); ca.dependsOn.add(newDependsOn(c, p)); } } final RevId revId = db.patchSets().get(psId).getRevision(); for (PatchSetAncestor a : db.patchSetAncestors().descendantsOf(revId)) { final PatchSet p = db.patchSets().get(a.getPatchSet()); final Change c = db.changes().get(p.getId().getParentKey()); ca.neededBy.add(newNeededBy(c, p)); } } finally { db.close(); } } catch (OrmException e) { } if (ca.dependsOn.isEmpty()) { ca.dependsOn = null; } if (ca.neededBy.isEmpty()) { ca.neededBy = null; } }
Source:
<code>public void testGetIdsListId(){ List<Long> result = mgr.getIdsListFromCmd(id1, idsEmptyList); <START> assertEquals(result, expectedListId); <END> }</code><technical_language>This is more a question of philosophy, assertEquals be: assertEquals(expected, actual). opposite. is coded is wrong, is normal (at I used)</technical_language>

Target:
public void testGetIdsListId(){ List<Long> result = mgr.getIdsListFromCmd(id1, idsEmptyList); assertEquals(expectedListId, result); }
Source:
<code>private void processConnectorConfigUpdates(Set<String> connectorConfigUpdates) { Set<String> localConnectors = assignment == null ? Collections.<String>emptySet() : new HashSet<>(assignment.connectors()); log.trace( "Processing connector config updates; " + "currently-owned connectors are {}, and to-be-updated connectors are {}", localConnectors, connectorConfigUpdates ); for (String connectorName : connectorConfigUpdates) { if (!localConnectors.contains(connectorName)) { log.trace( "Skipping config update for connector as it is not owned by this worker", connectorName ); continue; } boolean remains = configState.contains(connectorName); log.info("Handling connector-only config update by connector {}", remains ? "restarting" : "stopping", connectorName); worker.stopAndAwaitConnector(connectorName); if (remains) <START> startConnector(connectorName, (error, result) -> { }); <END> } }</code><technical_language>caller of this function need block starting connector, I log errors of callback. get swallowed</technical_language>

Target:
private void processConnectorConfigUpdates(Set<String> connectorConfigUpdates) { Set<String> localConnectors = assignment == null ? Collections.<String>emptySet() : new HashSet<>(assignment.connectors()); log.trace("Processing connector config updates; " + "currently-owned connectors are {}, and to-be-updated connectors are {}", localConnectors, connectorConfigUpdates); for (String connectorName : connectorConfigUpdates) { if (!localConnectors.contains(connectorName)) { log.trace("Skipping config update for connector as it is not owned by this worker", connectorName); continue; } boolean remains = configState.contains(connectorName); log.info("Handling connector-only config update by connector {}", remains ? "restarting" : "stopping", connectorName); worker.stopAndAwaitConnector(connectorName); if (remains) { startConnector(connectorName, (error, result) -> { if (error != null) { log.error("Failed to start connector '" + connectorName + "'", error); } }); } } }
Source:
<code>private <V> ListenableFuture<V> execute( Statement executableStatement, Executor executor, RowStreamAccumulator<V> rowStreamAccumulator) { return Futures.transformAsync( <START> AtlasFutures.tracingFuture(() -> session.executeAsync(executableStatement), "CqlClientImpl: execute"), <END> iterate(executor, rowStreamAccumulator), executor); }</code><technical_language>Btw, this is I suggested create a specialized Executor, need do this manually everywhere</technical_language>

Target:
private <V> ListenableFuture<V> execute( Statement executableStatement, Executor executor, RowStreamAccumulator<V> rowStreamAccumulator) { return Futures.transformAsync( session.executeAsync(executableStatement), iterate(executor, rowStreamAccumulator), executor); }
Source:
<code>public void testSomeUser() { List<Integer> lightData = Lists.newArrayList(); final URL userCSVFile = Resources.getResource("insights/bedlightduration/lightDataUser1.csv"); try { final String csvString = Resources.toString(userCSVFile, Charsets.UTF_8); final String[] lightDataStringList = csvString.replaceAll("\\s+","").split(","); for (String lightDataString : lightDataStringList) { lightData.add(Integer.parseInt(lightDataString)); } } catch (IOException ioexception) { <START> ioexception.printStackTrace(); <END> } List<Long> timeStamps = Lists.newArrayList(); final URL timeStampCSVFile = Resources.getResource("insights/bedlightduration/timeStampUser1.csv"); try { final String csvString = Resources.toString(timeStampCSVFile, Charsets.UTF_8); final String[] timeStampStringList = csvString.replaceAll("\\s+","").replaceAll("L","").split(","); for (String timeStampString : timeStampStringList) { timeStamps.add(Long.parseLong(timeStampString)); } } catch (IOException ioexception) { ioexception.printStackTrace(); } final List<DeviceData> deviceData = Lists.newArrayList(); for (int i = 0; i < lightData.size(); i++) { final int myHour = new DateTime(timeStamps.get(i), DateTimeZone.forOffsetMillis(-25200000)).getHourOfDay(); if (myHour > 21 || myHour < 4) { deviceData.add(createNewDeviceData(lightData.get(i), new DateTime(timeStamps.get(i)))); } } final int avgLightOn = BedLightDuration.getInsightsHelper(deviceData); assertThat(avgLightOn, is(26)); }</code><technical_language>test method throw IOException instead of try catch</technical_language>

Target:
public void testSomeUser() throws IOException{ final List<Integer> lightData = readLightData("insights/bedlightduration/lightDataUser1.csv"); final List<Long> timeStamps = readTimeStamps("insights/bedlightduration/timeStampUser1.csv"); final List<DeviceData> deviceData = Lists.newArrayList(); for (int i = 0; i < lightData.size(); i++) { final int myHour = new DateTime(timeStamps.get(i), DateTimeZone.forOffsetMillis(-25200000)).getHourOfDay(); if (myHour > 21 || myHour < 4) { deviceData.add(createNewDeviceData(lightData.get(i), new DateTime(timeStamps.get(i)))); } } final int avgLightOn = BedLightDuration.getInsightsHelper(deviceData); assertThat(avgLightOn, is(26)); }
Source:
<code>public Either<java.util.Set<ParseFailedException>, Term> apply(TermCons tc) { if (tc.production().items().last() instanceof NonTerminal) { <START> String msg = "Due to typing errors, Casting is too greedy. Use parentheses to set proper scope."; <END> KException kex = new KException(KException.ExceptionType.ERROR, KException.KExceptionGroup.CRITICAL, msg, null, null); return Left.apply(Sets.newHashSet(new PriorityException(kex))); } return Right.apply(tc); }</code><technical_language>this is a bad error wanted get rid of in new parser, remember? is here</technical_language>

Target:
public Either<java.util.Set<ParseFailedException>, Term> apply(TermCons tc) { if (tc.production().items().last() instanceof NonTerminal) { String msg = parent.production().klabel().get() + " is not allowed to be an immediate child of cast." + " Use parentheses: (x):Sort to set the proper scope of the operations."; KException kex = new KException(KException.ExceptionType.ERROR, KException.KExceptionGroup.CRITICAL, msg, null, tc.location().get()); return Left.apply(Sets.newHashSet(new PriorityException(kex))); } return Right.apply(tc); }
Source:
<code>public Config hazelcastConfig() { final Config config = new Config() <START> .setInstanceName("hazelcast-instance") <END> .addMapConfig(newDefaultMapConfig(CacheName.User.USERS)) .addMapConfig(newDefaultMapConfig(CacheName.User.USER_DETAILS)) .addMapConfig(newDefaultMapConfig(CacheName.Repository.REMOTE_REPOSITORY_ALIVENESS)) .addMapConfig(newDefaultMapConfig(CacheName.Artifact.TAGS)); config.getGroupConfig().setName("strongbox").setPassword("password"); return config; }</code><technical_language>This strongbox. This leads thought Strongbox instance names (I've raised #693 for this). Cosmetic: please method invocation line new instance (and re-align rest of chained methods? in a places pull). Thanks</technical_language>

Target:
public Config hazelcastConfig() { final Config config = new Config().setInstanceName("strongbox") .addMapConfig(newDefaultMapConfig(CacheName.User.USERS)) .addMapConfig(newDefaultMapConfig(CacheName.User.USER_DETAILS)) .addMapConfig(newDefaultMapConfig(CacheName.Repository.REMOTE_REPOSITORY_ALIVENESS)) .addMapConfig(newDefaultMapConfig(CacheName.Artifact.TAGS)); config.getGroupConfig().setName("strongbox").setPassword("password"); return config; }
Source:
<code>private static void refreshBorderFigure(final BorderedStyle borderedStyle, final StyledFigure styledFigure) { LineBorder lineBorder = null; if (styledFigure.getBorder() instanceof LineBorder) { lineBorder = (LineBorder) styledFigure.getBorder(); } else { lineBorder = new LineBorder(); if (styledFigure instanceof Shape) { styledFigure.setBorder(null); <START> ((Shape) styledFigure).setOutline(false); <END> } else { styledFigure.setBorder(lineBorder); } } int borderSize = 0; if (borderedStyle.getBorderSize() != null) { borderSize = borderedStyle.getBorderSize().intValue(); } lineBorder.setWidth(borderSize); final RGBValues borderColor = borderedStyle.getBorderColor(); if (borderColor != null) { lineBorder.setColor(VisualBindingManager.getDefault().getColorFromRGBValues(borderColor)); } if (borderSize == 0) { if (!(styledFigure instanceof NoteFigure)) { styledFigure.setBorder(null); if (styledFigure instanceof Shape) { ((Shape) styledFigure).setOutline(false); } } else { if (styledFigure instanceof Shape) { ((Shape) styledFigure).setOutline(true); } } } }</code><technical_language>Remove this is handled l176</technical_language>

Target:
private static void refreshBorderFigure(final BorderedStyle borderedStyle, final StyledFigure styledFigure) { LineBorder lineBorder = null; if (styledFigure.getBorder() instanceof LineBorder) { lineBorder = (LineBorder) styledFigure.getBorder(); } else { lineBorder = new LineBorder(); if (styledFigure instanceof Shape) { styledFigure.setBorder(null); } else { styledFigure.setBorder(lineBorder); } } int borderSize = 0; if (borderedStyle.getBorderSize() != null) { borderSize = borderedStyle.getBorderSize().intValue(); } lineBorder.setWidth(borderSize); final RGBValues borderColor = borderedStyle.getBorderColor(); if (borderColor != null) { lineBorder.setColor(VisualBindingManager.getDefault().getColorFromRGBValues(borderColor)); } if (borderSize == 0) { if (!(styledFigure instanceof NoteFigure)) { styledFigure.setBorder(null); if (styledFigure instanceof Shape) { ((Shape) styledFigure).setOutline(false); } } } else if (styledFigure instanceof Shape) { ((Shape) styledFigure).setOutline(true); } }
Source:
<code>private void setQcowCompatByQemuImageInfo(Guid storagePoolId, Guid newImageGroupId, Guid newImageId, Guid newStorageDomainID) { Guid hostIdToExecuteQemuImageInfo = null; List<Pair<VM, VmDevice>> attachedVmsInfo = vmDao.getVmsWithPlugInfo(getDestinationDiskImage().getId()); for (Pair<VM, VmDevice> pair : attachedVmsInfo) { VM vm = pair.getFirst(); if (Boolean.TRUE.equals(pair.getSecond().isPlugged())) { if (vm.isStartingOrUp()) { hostIdToExecuteQemuImageInfo = vm.getRunOnVds(); break; } } } setQcowCompat(getDestinationDiskImage().getImage(), storagePoolId, newImageGroupId, newImageId, newStorageDomainID, hostIdToExecuteQemuImageInfo, <START> hostIdToExecuteQemuImageInfo == null); <END> }</code><technical_language>redundant? moved setQcowCompat method</technical_language>

Target:
private void setQcowCompatByQemuImageInfo(Guid storagePoolId, Guid newImageGroupId, Guid newImageId, Guid newStorageDomainID) { Guid hostIdToExecuteQemuImageInfo = null; List<Pair<VM, VmDevice>> attachedVmsInfo = vmDao.getVmsWithPlugInfo(getDestinationDiskImage().getId()); for (Pair<VM, VmDevice> pair : attachedVmsInfo) { VM vm = pair.getFirst(); if (Boolean.TRUE.equals(pair.getSecond().isPlugged())) { if (vm.isStartingOrUp()) { hostIdToExecuteQemuImageInfo = vm.getRunOnVds(); break; } } } setQcowCompat(getDestinationDiskImage().getImage(), storagePoolId, newImageGroupId, newImageId, newStorageDomainID, hostIdToExecuteQemuImageInfo); }
Source:
<code><START> public int getMinimumVerifiedValue(MemoryImprint memoryImprint, boolean onlyBuilt) { <END> Integer verified = Integer.MAX_VALUE; for (Entry entry : memoryImprint.getEntries()) { if (entry == null) { continue; } Run build = entry.getBuild(); if (build == null) { continue; } Result result = build.getResult(); if (onlyBuilt && result == Result.NOT_BUILT) { continue; } GerritTrigger trigger = GerritTrigger.getTrigger(entry.getProject()); if (shouldSkip(trigger.getSkipVote(), result)) { continue; } Integer verifiedObj = getVerifiedValue(result, trigger); if (verifiedObj != null) { verified = Math.min(verified, verifiedObj); } } return verified; }</code><technical_language>missed changing Integer</technical_language>

Target:
public Integer getMinimumVerifiedValue(MemoryImprint memoryImprint, boolean onlyBuilt) { Integer verified = Integer.MAX_VALUE; for (Entry entry : memoryImprint.getEntries()) { if (entry == null) { continue; } Run build = entry.getBuild(); if (build == null) { continue; } Result result = build.getResult(); if (onlyBuilt && result == Result.NOT_BUILT) { continue; } GerritTrigger trigger = GerritTrigger.getTrigger(entry.getProject()); if (shouldSkip(trigger.getSkipVote(), result)) { continue; } Integer verifiedObj = getVerifiedValue(result, trigger); if (verifiedObj != null) { verified = Math.min(verified, verifiedObj); } } if (verified == Integer.MAX_VALUE) { return null; } return verified; }
Source:
<code>public void addSecret(String secret) { ModelNode secretNode = get(SERVICE_ACCOUNT_SECRETS); <START> secretNode.add("name", secret); <END> }</code><technical_language>is a class called JbossDmrExtensions a number of getter setter helpers. I suggest set a null a node throws. Alternative is do null checks</technical_language>

Target:
public void addSecret(String secret) { ModelNode secretNodeName = get(SERVICE_ACCOUNT_SECRETS).add(); set(secretNodeName, NAME, secret); }
Source:
<code>public void stream() throws InterruptedException { try (Closeable ignore = ShutdownHooks.addHook(this::onNodeShutdown)) { streamInternal(new StartingState()); <START> } catch (IOException ex) { <END> log.error( "Failed to delete shutdown hook for subscription {}. This method should not throw any exception", getSubscription(), ex); } }</code><technical_language>final</technical_language>

Target:
public void stream() throws InterruptedException { try (Closeable ignore = ShutdownHooks.addHook(this::onNodeShutdown)) { streamInternal(new StartingState()); } catch (final IOException ex) { log.error( "Failed to delete shutdown hook for subscription {}. This method should not throw any exception", getSubscription(), ex); } }
Source:
<code>public void writeStringNoTag(final String value) throws IOException { writeRawVarint32(encodedLength(value)); <START> CharsetEncoder charsetEncoder = Charset.forName("UTF-8").newEncoder(); <END> CoderResult coderResult = charsetEncoder.encode(CharBuffer.wrap(value), buffer, true ); if (coderResult.isError() && !coderResult.isUnderflow()) { coderResult.throwException(); } }</code><technical_language>save a static field, instance field if this class is intrinsically thread-safe. Otherwise, "new" keyword in a "write" method is pretty hairy</technical_language>

Target:
public void writeStringNoTag(final String value) throws IOException { writeRawVarint32(encodedLength(value)); if (charsetEncoder == null ) { charsetEncoder = UTF8_CHARSET.newEncoder(); } try { final CharBuffer charBuffer = CharBuffer.wrap(value); CoderResult coderResult = charsetEncoder.encode(charBuffer, buffer, true ); if (coderResult.isError() && !coderResult.isUnderflow()) { coderResult.throwException(); } coderResult = charsetEncoder.flush(buffer); if (coderResult.isError() && !coderResult.isUnderflow()) { coderResult.throwException(); } } finally { charsetEncoder.reset(); } }
Source:
<code>private void processNewDelete(ScanResults results, IndexValue deleteValue, IndexValue originalPutValue) { <START> long operationTimeInMs = deleteValue.getOperationTimeInMs() == Utils.Infinite_Time ? index.getIndexSegments() <END> .floorEntry(deleteValue.getOffset()) .getValue() .getLastModifiedTimeMs() : deleteValue.getOperationTimeInMs(); results.updateLogSegmentBaseBucket(deleteValue.getOffset().getName(), deleteValue.getSize()); if (!isExpired(originalPutValue.getExpiresAtMs(), operationTimeInMs)) { handleContainerBucketUpdate(results, originalPutValue, operationTimeInMs, SUBTRACT); handleLogSegmentBucketUpdate(results, originalPutValue, operationTimeInMs, SUBTRACT); if (originalPutValue.getExpiresAtMs() != Utils.Infinite_Time) { handleContainerBucketUpdate(results, originalPutValue, originalPutValue.getExpiresAtMs(), ADD); handleLogSegmentBucketUpdate(results, originalPutValue, originalPutValue.getExpiresAtMs(), ADD); } } }</code><technical_language>sorry. Guess leave way. is more readable compared this</technical_language>

Target:
private void processNewDelete(ScanResults results, IndexValue deleteValue, IndexValue originalPutValue) { long operationTimeInMs = deleteValue.getOperationTimeInMs(); if (operationTimeInMs == Utils.Infinite_Time) { operationTimeInMs = index.getIndexSegments().floorEntry(deleteValue.getOffset()).getValue().getLastModifiedTimeMs(); } results.updateLogSegmentBaseBucket(deleteValue.getOffset().getName(), deleteValue.getSize()); if (!isExpired(originalPutValue.getExpiresAtMs(), operationTimeInMs)) { handleContainerBucketUpdate(results, originalPutValue, operationTimeInMs, SUBTRACT); handleLogSegmentBucketUpdate(results, originalPutValue, operationTimeInMs, SUBTRACT); if (originalPutValue.getExpiresAtMs() != Utils.Infinite_Time) { handleContainerBucketUpdate(results, originalPutValue, originalPutValue.getExpiresAtMs(), ADD); handleLogSegmentBucketUpdate(results, originalPutValue, originalPutValue.getExpiresAtMs(), ADD); } } }
Source:
<code><START> public byte[] getRawPath() { <END> return path; }</code><technical_language>I this is a problem. exposing raw byte array world prevent path modified externally. E.g. DirCacheEntry e=..... e.getRawPath()[0]='a' break a lot of stuff. getter methods return immutable objects String. accept this risk. solutions returning in getRawPath() a copy array. performant this solution</technical_language>

Target:
public byte[] getRawPath() { return path.clone(); }
Source:
<code>public static String getArtifactLabel(EObject object) { String artifactLabel = null; if (object instanceof ArtifactWrapper) { ArtifactWrapper wrapper = (ArtifactWrapper) object; Collection<ArtifactHandler> artifactHandlers = ExtensionPointHelper.getArtifactHandlers(); for (ArtifactHandler handler : artifactHandlers) { String handlerName = handler.toString().substring(0, handler.toString().indexOf('@')); if (handlerName.equals(wrapper.getArtifactHandler())) { Object originalObject = handler.resolveArtifact(object); if (originalObject != null) { String artifactName = handler.getDisplayName(originalObject); artifactLabel = artifactName.replaceAll(CHARACTERS_TO_BE_REMOVED, " "); } else { String label = EMFHelper.getIdentifier(object); artifactLabel = label.substring(0, label.indexOf(':')); artifactLabel = artifactLabel.replaceAll(CHARACTERS_TO_BE_REMOVED, " "); } } } } else { artifactLabel = EMFHelper.getIdentifier(object); artifactLabel = artifactLabel.replaceAll(CHARACTERS_TO_BE_REMOVED, " "); } <START> return artifactLabel; <END> }</code><technical_language>replacing characters returning label instead of times places</technical_language>

Target:
public static String getArtifactLabel(EObject object) { String artifactLabel = null; if (object instanceof ArtifactWrapper) { ArtifactWrapper wrapper = (ArtifactWrapper) object; Collection<ArtifactHandler> artifactHandlers = ExtensionPointHelper.getArtifactHandlers(); for (ArtifactHandler handler : artifactHandlers) { String handlerName = handler.toString().substring(0, handler.toString().indexOf('@')); if (handlerName.equals(wrapper.getArtifactHandler())) { Object originalObject = handler.resolveArtifact(object); if (originalObject != null) { artifactLabel = handler.getDisplayName(originalObject); } else { String label = EMFHelper.getIdentifier(object); artifactLabel = label.substring(0, label.indexOf(':')); } } } } else { artifactLabel = EMFHelper.getIdentifier(object); } return artifactLabel.replaceAll(CHARACTERS_TO_BE_REMOVED, " "); }
Source:
<code>private boolean isAnnotationPresent(AnnotatedType annotatedType, Set<Annotation> processedAnnotations) { if ( annotatedType instanceof AnnotatedParameterizedType ) { for ( AnnotatedType type : ( (AnnotatedParameterizedType) annotatedType ).getAnnotatedActualTypeArguments() ) { if ( isAnnotationPresent( type, processedAnnotations ) ) { return true; } } } <START> if ( isAnnotationPresentIn( annotatedType.getDeclaredAnnotations(), processedAnnotations ) ) { <END> return true; } return false; }</code><technical_language>I move this first</technical_language>

Target:
private boolean isAnnotationPresent(AnnotatedType annotatedType, Set<Annotation> processedAnnotations) { if ( isAnnotationPresentIn( annotatedType.getDeclaredAnnotations(), processedAnnotations ) ) { return true; } if ( annotatedType instanceof AnnotatedParameterizedType ) { for ( AnnotatedType type : ( (AnnotatedParameterizedType) annotatedType ).getAnnotatedActualTypeArguments() ) { if ( isAnnotationPresent( type, processedAnnotations ) ) { return true; } } } return false; }
Source:
<code>public void execute() { BibDatabaseContext database = stateManager.getActiveDatabase().orElseThrow(() -> new NullPointerException("Database null")); List<BibEntry> entries = stateManager.getSelectedEntries(); final NamedCompound nc = new NamedCompound(Localization.lang("Automatically set file links")); AutoSetFileLinksUtil util = new AutoSetFileLinksUtil( database, preferences.getFilePreferences(), preferences.getAutoLinkPreferences(), ExternalFileTypes.getInstance()); Task<List<BibEntry>> linkFilesTask = new Task<>() { @Override protected List<BibEntry> call() { return util.linkAssociatedFiles(entries, nc); } @Override protected void succeeded() { if (util.returnFileExceptions().isEmpty()) { if (!getValue().isEmpty()) { if (nc.hasEdits()) { nc.end(); undoManager.addEdit(nc); } dialogService.notify(Localization.lang("Finished automatically setting external links.")); } else { dialogService.notify(Localization.lang("Finished automatically setting external links.") + " " + Localization.lang("No files found.")); } } else { <START> dialogService.notify(Localization.lang("Problem finding files")); END> } } }; dialogService.showProgressDialog( Localization.lang("Automatically setting file links"), Localization.lang("Searching for files"), linkFilesTask); taskExecutor.execute(linkFilesTask); }</code><technical_language>need add another else case exceptions empty: Problem finding files. Errors occured log for details</technical_language>

Target:
public void execute() { final BibDatabaseContext database = stateManager.getActiveDatabase().orElseThrow(() -> new NullPointerException("Database null")); final List<BibEntry> entries = stateManager.getSelectedEntries(); final AutoSetFileLinksUtil util = new AutoSetFileLinksUtil( database, preferences.getFilePreferences(), preferences.getAutoLinkPreferences(), ExternalFileTypes.getInstance()); final NamedCompound nc = new NamedCompound(Localization.lang("Automatically set file links")); Task<AutoSetFileLinksUtil.LinkFilesResult> linkFilesTask = new Task<>() { @Override protected AutoSetFileLinksUtil.LinkFilesResult call() { return util.linkAssociatedFiles(entries, nc); } @Override protected void succeeded() { AutoSetFileLinksUtil.LinkFilesResult result = getValue(); if (!result.getFileExceptions().isEmpty()) { dialogService.showWarningDialogAndWait( Localization.lang("Automatically set file links"), Localization.lang("Problem finding files. See error log for details.")); return; } if (result.getChangedEntries().isEmpty()) { dialogService.showWarningDialogAndWait("Automatically set file links", Localization.lang("Finished automatically setting external links.") + "\n" + Localization.lang("No files found.")); return; } if (nc.hasEdits()) { nc.end(); undoManager.addEdit(nc); } dialogService.notify(Localization.lang("Finished automatically setting external links.") + " " + Localization.lang("Changed %0 entries.", String.valueOf(result.getChangedEntries().size()))); } }; dialogService.showProgressDialog( Localization.lang("Automatically setting file links"), Localization.lang("Searching for files"), linkFilesTask); taskExecutor.execute(linkFilesTask); }
Source:
<code>public String getShareReferrerUrl(String loginName) { if (Strings.isNullOrEmpty(loginName)) { return AppUrl.LOGIN.getPath(); } UserModel userModel = userMapper.findByLoginName(loginName); RedEnvelopSplitActivityDto redEnvelopSplitActivityDto = new RedEnvelopSplitActivityDto(String.format(REFERRER_TITLE, userModel.getUserName()), REFERRER_DESCRIPTION, domainName + "/activity/red-envelop-split/referrer"); logger.info(MessageFormat.format("[redEnvelopSplit] shard url:{0}", redEnvelopSplitActivityDto.getShareUrl())); String paramJson = ""; try { <START> paramJson = JsonConverter.writeValueAsString(redEnvelopSplitActivityDto); <END> } catch (JsonProcessingException e) { e.printStackTrace(); } String base64 = ""; try { base64 = Base64.getEncoder().encodeToString(paramJson.getBytes("utf-8")); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } return String.format(AppUrl.SHARE.getPath(), base64); }</code><technical_language>base64 = Base64.getEncoder().encodeToString(paramJson.getBytes("utf-8"));</technical_language>

Target:
public String getShareReferrerUrl(String loginName) { if (Strings.isNullOrEmpty(loginName)) { return AppUrl.LOGIN.getPath(); } UserModel userModel = userMapper.findByLoginName(loginName); RedEnvelopSplitActivityDto redEnvelopSplitActivityDto = new RedEnvelopSplitActivityDto(String.format(REFERRER_TITLE, userModel.getUserName() == null ? "" : userModel.getUserName()), REFERRER_DESCRIPTION, domainName + "/activity/red-envelop-split/referrer"); logger.info(MessageFormat.format("[redEnvelopSplit] shard url:{0}", redEnvelopSplitActivityDto.getShareUrl())); String paramJson = ""; String base64 = ""; try { paramJson = JsonConverter.writeValueAsString(redEnvelopSplitActivityDto); base64 = Base64.getEncoder().encodeToString(paramJson.getBytes("utf-8")); } catch (JsonProcessingException e) { logger.info(MessageFormat.format("[redEnvelopSplit] json converter fail, userName:{0}, shardUrl:{1}", userModel.getUserName(), redEnvelopSplitActivityDto.getShareUrl())); } catch (UnsupportedEncodingException e) { logger.info(MessageFormat.format("[redEnvelopSplit] base64 converter fail, json:{0}", paramJson)); } return String.format(AppUrl.SHARE.getPath(), base64); }
Source:
<code>private long latestRoundLearnedLocally() { <START> return getGreatestLearnedPaxosValue().map(PaxosValue::getRound).orElse(-1L); <END> }</code><technical_language>(as before, constants)</technical_language>

Target:
private long latestRoundLearnedLocally() { return getGreatestLearnedPaxosValue().map(PaxosValue::getRound).orElse(PaxosAcceptor.NO_LOG_ENTRY); }
Source:
<code>private void checkPlus(ExpressionTree leftOperand, ExpressionTree rightOperand, Type leftType, Type rightType, Tree operator) { if (leftType != Type.STRING && rightType != Type.STRING) { if (leftType == Type.NUMBER && BOOLEAN_DATE.contains(rightType)) { raiseIssue(rightOperand, leftOperand, operator); } if (rightType == Type.NUMBER && BOOLEAN_DATE.contains(leftType)) { <START> raiseIssue(leftOperand, leftOperand, operator); <END> } } }</code><technical_language>@vilchik-elena copy-paste issue</technical_language>

Target:
private void checkPlus(ExpressionTree leftOperand, ExpressionTree rightOperand, Type leftType, Type rightType, Tree operator) { if (leftType != Type.STRING && rightType != Type.STRING) { if (leftType == Type.NUMBER && BOOLEAN_DATE.contains(rightType)) { raiseIssue(rightOperand, leftOperand, operator); } if (rightType == Type.NUMBER && BOOLEAN_DATE.contains(leftType)) { raiseIssue(leftOperand, rightOperand, operator); } } }
Source:
<code>private void validateCallbackUrl(String callbackUrl) { try { new URL(callbackUrl); } catch (MalformedURLException e) { <START> throw new IllegalArgumentException("Callback URL must be valid if provided!"); <END> } }</code><technical_language>pass root creating new exception</technical_language>

Target:
private void validateCallbackUrl(String callbackUrl) { try { new URL(callbackUrl); } catch (MalformedURLException e) { throw new IllegalArgumentException("Callback URL must be valid if provided!", e); } }
Source:
<code>public RowIterator(GroupByQuery query, final Cursor cursor, ByteBuffer metricsBuffer, GroupByQueryConfig config) { this.query = query; this.cursor = cursor; this.metricsBuffer = metricsBuffer; this.config = config; unprocessedKeys = null; delegate = Iterators.emptyIterator(); dimensionSpecs = query.getDimensions(); dimensions = Lists.newArrayListWithExpectedSize(dimensionSpecs.size()); dimNames = Lists.newArrayListWithExpectedSize(dimensionSpecs.size()); for (int i = 0; i < dimensionSpecs.size(); ++i) { final DimensionSpec dimSpec = dimensionSpecs.get(i); <START> final String dimension = dimSpec.getDimension(); <END> final DimensionSelector selector = cursor.makeDimensionSelector( dimension, dimSpec.getExtractionFn() ); if (selector != null) { dimensions.add(selector); dimNames.add(dimSpec.getOutputName()); } } aggregatorSpecs = query.getAggregatorSpecs(); aggregators = new BufferAggregator[aggregatorSpecs.size()]; metricNames = new String[aggregatorSpecs.size()]; sizesRequired = new int[aggregatorSpecs.size()]; for (int i = 0; i < aggregatorSpecs.size(); ++i) { AggregatorFactory aggregatorSpec = aggregatorSpecs.get(i); aggregators[i] = aggregatorSpec.factorizeBuffered(cursor); metricNames[i] = aggregatorSpec.getName(); sizesRequired[i] = aggregatorSpec.getMaxIntermediateSize(); } }</code><technical_language>changes in this file warranted</technical_language>

Target:
public RowIterator(GroupByQuery query, final Cursor cursor, ByteBuffer metricsBuffer, GroupByQueryConfig config) { this.query = query; this.cursor = cursor; this.metricsBuffer = metricsBuffer; this.config = config; unprocessedKeys = null; delegate = Iterators.emptyIterator(); dimensionSpecs = query.getDimensions(); dimensions = Lists.newArrayListWithExpectedSize(dimensionSpecs.size()); dimNames = Lists.newArrayListWithExpectedSize(dimensionSpecs.size()); for (int i = 0; i < dimensionSpecs.size(); ++i) { final DimensionSpec dimSpec = dimensionSpecs.get(i); final DimensionSelector selector = cursor.makeDimensionSelector( dimSpec.getDimension(), dimSpec.getExtractionFn() ); if (selector != null) { dimensions.add(selector); dimNames.add(dimSpec.getOutputName()); } } aggregatorSpecs = query.getAggregatorSpecs(); aggregators = new BufferAggregator[aggregatorSpecs.size()]; metricNames = new String[aggregatorSpecs.size()]; sizesRequired = new int[aggregatorSpecs.size()]; for (int i = 0; i < aggregatorSpecs.size(); ++i) { AggregatorFactory aggregatorSpec = aggregatorSpecs.get(i); aggregators[i] = aggregatorSpec.factorizeBuffered(cursor); metricNames[i] = aggregatorSpec.getName(); sizesRequired[i] = aggregatorSpec.getMaxIntermediateSize(); } }
Source:
<code>private void showGutenbergInformativeDialog() { if (!mIsNewPost && !AppPrefs.isGutenbergInformativeDialogDisabled()) { <START> final PromoDialog asyncPromoDialog = new PromoDialog(); <END> asyncPromoDialog.initialize(TAG_GB_INFORMATIVE_DIALOG, getString(R.string.dialog_gutenberg_informative_title), mPost.isPage() ? getString(R.string.dialog_gutenberg_informative_description_page) : getString(R.string.dialog_gutenberg_informative_description_post), getString(org.wordpress.android.editor.R.string.dialog_button_ok)); asyncPromoDialog.show(getSupportFragmentManager(), TAG_GB_INFORMATIVE_DIALOG); AppPrefs.setGutenbergInformativeDialogDisabled(true); } }</code><technical_language>rename final PromoDialog asyncPromoDialog final PromoDialog gbInformativeDialog</technical_language>

Target:
private void showGutenbergInformativeDialog() { if (!mIsNewPost && !AppPrefs.isGutenbergInformativeDialogDisabled()) { final PromoDialog gbInformativeDialog = new PromoDialog(); gbInformativeDialog.initialize(TAG_GB_INFORMATIVE_DIALOG, getString(R.string.dialog_gutenberg_informative_title), mPost.isPage() ? getString(R.string.dialog_gutenberg_informative_description_page) : getString(R.string.dialog_gutenberg_informative_description_post), getString(org.wordpress.android.editor.R.string.dialog_button_ok)); gbInformativeDialog.show(getSupportFragmentManager(), TAG_GB_INFORMATIVE_DIALOG); AppPrefs.setGutenbergInformativeDialogDisabled(true); } }
Source:
<code>private boolean isCompatible(List<String> serverProtocols, List<String> clientProtocols) { return serverProtocols.contains(clientProtocols.get(0)) || <START> (clientProtocols.get(0).equals("TLSv1.3") && clientProtocols.contains("TLSv1.2")); <END> }</code><technical_language>check if clearer if like: clientProtocols.get(0).equals("TLSv1.3") && !Collections.disjoint(tlsServerProtocols, tlsClientProtocols) basically check client protocols broker protocols if client TLS 1.3. condition checks case client protocol is supported server (TLS 1.2)</technical_language>

Target:
private boolean isCompatible(List<String> serverProtocols, List<String> clientProtocols) { assertNotNull(serverProtocols); assertFalse(serverProtocols.isEmpty()); assertNotNull(clientProtocols); assertFalse(clientProtocols.isEmpty()); return serverProtocols.contains(clientProtocols.get(0)) || (clientProtocols.get(0).equals("TLSv1.3") && !Collections.disjoint(serverProtocols, clientProtocols)); }
Source:
<code>AbsoluteGraphQLError(ExecutionStrategyParameters executionStrategyParameters, GraphQLError relativeError) { requireNonNull(executionStrategyParameters); this.relativeError = requireNonNull(relativeError); this.absolutePath = Optional.ofNullable(relativeError.getPath()) .map(originalPath -> { List<Object> path = new ArrayList<>(); path.addAll(executionStrategyParameters.path().toList()); path.addAll(relativeError.getPath()); return path; }) .orElse(null); Optional<SourceLocation> baseLocation; if (!executionStrategyParameters.field().isEmpty()) { <START> baseLocation = Optional.of(executionStrategyParameters.field().get(0).getSourceLocation()); <END> } else { baseLocation = Optional.empty(); } this.locations = Optional.ofNullable( relativeError.getLocations()) .map(locations -> locations.stream() .map(l -> baseLocation .map(base -> new SourceLocation(base.getLine() + l.getLine(), base.getColumn() + l.getColumn())) .orElse(null)) .collect(Collectors.toList())) .orElse(null); }</code><technical_language>defnesive here. If SourceLocation bang of stupid Java 8 Optional.of ofNullable() please. I null but...</technical_language>

Target:
AbsoluteGraphQLError(ExecutionStrategyParameters executionStrategyParameters, GraphQLError relativeError) { assertNotNull(executionStrategyParameters); assertNotNull(relativeError); this.absolutePath = createAbsolutePath(executionStrategyParameters, relativeError); this.locations = createAbsoluteLocations(relativeError, executionStrategyParameters.field()); this.message = relativeError.getMessage(); this.errorType = relativeError.getErrorType(); }
Source:
<code>private byte[] encryptBytes(byte[] contentBytes, byte[] ivBytes, Key aesKey, byte[] aad) throws GeneralSecurityException { <START> Cipher cipher = Cipher.getInstance("AES/GCM/NoPadding"); <END> GCMParameterSpec gcmParams = new GCMParameterSpec(AUTH_TAG_SIZE_BYTE * 8, ivBytes); cipher.init(Cipher.ENCRYPT_MODE, aesKey, gcmParams); cipher.updateAAD(aad); byte[] cipherText = new byte[cipher.getOutputSize(contentBytes.length)]; cipher.doFinal(contentBytes, 0, contentBytes.length, cipherText); return cipherText; }</code><technical_language>if want Cipher.getInstance argument "BC" security provider for example in AesCbcHmacShaEncryptionProvider? AFAIK bigger probability avoid issues some stuff work expected JVM versions etc</technical_language>

Target:
private byte[] encryptBytes(byte[] contentBytes, byte[] ivBytes, Key aesKey, byte[] aad) throws GeneralSecurityException { Cipher cipher = Cipher.getInstance("AES/GCM/NoPadding", "BC"); GCMParameterSpec gcmParams = new GCMParameterSpec(AUTH_TAG_SIZE_BYTE * 8, ivBytes); cipher.init(Cipher.ENCRYPT_MODE, aesKey, gcmParams); cipher.updateAAD(aad); byte[] cipherText = new byte[cipher.getOutputSize(contentBytes.length)]; cipher.doFinal(contentBytes, 0, contentBytes.length, cipherText); return cipherText; }
Source:
<code>public Optional<List<String>> getAllTables(String databaseName) { try { <START> List<String> tblNames = new ArrayList<>(); <END> String nextToken = null; do { GetTablesResult result = glueClient.getTables(new GetTablesRequest() .withDatabaseName(databaseName) .withNextToken(nextToken)); result.getTableList().stream().forEach(tbl -> tblNames.add(tbl.getName())); nextToken = result.getNextToken(); } while (nextToken != null); return Optional.of(tblNames); } catch (EntityNotFoundException e) { return Optional.empty(); } catch (AmazonServiceException e) { throw new PrestoException(HIVE_METASTORE_ERROR, e); } }</code><technical_language>Nit: generally abbreviate variable names. Call this tableNames</technical_language>

Target:
public Optional<List<String>> getAllTables(String databaseName) { try { List<String> tableNames = new ArrayList<>(); String nextToken = null; do { GetTablesResult result = glueClient.getTables(new GetTablesRequest() .withDatabaseName(databaseName) .withNextToken(nextToken)); result.getTableList().stream().forEach(table -> tableNames.add(table.getName())); nextToken = result.getNextToken(); } while (nextToken != null); return Optional.of(tableNames); } catch (EntityNotFoundException e) { return Optional.empty(); } catch (AmazonServiceException e) { throw new PrestoException(HIVE_METASTORE_ERROR, e); } }
Source:
<code>public void getTextTest() throws Exception { <START> iface.go(testPage); <END> WebDriverElement spanByID = iface.getWebDriverElement(Strategy.ID, "writing"); Assert.assertEquals("Click button to hide me", spanByID.getText()); WebDriverElement paragraphByCLASS = iface.getWebDriverElement(Strategy.CLASS, "normal"); Assert.assertEquals("Click to make me blink", paragraphByCLASS.getText()); WebDriverElement inputByNAME = iface.getWebDriverElement(Strategy.NAME, "namedInput"); Assert.assertEquals("This is a named input", inputByNAME.getText()); WebDriverElement spanByXPATH = iface.getWebDriverElement(Strategy.XPATH, " Assert.assertEquals("Click button to hide me", spanByXPATH.getText()); }</code><technical_language>iface.go(testPage); is in beginning of single test methods waitForOnScreen(). put in setup() method remove a couple lines of code. If test requires a web page, call iface.go() again</technical_language>

Target:
public void getTextTest() throws Exception { iface.go(testPage); WebDriverElement span = $("#writingSpan"); Assert.assertEquals("Click button to hide me", span.getText()); WebDriverElement paragraph = $("#intervalPara"); Assert.assertEquals("Click to make me blink", paragraph.getText()); WebDriverElement input = iface.getWebDriverElement(Strategy.NAME, "namedInput"); Assert.assertEquals("This is named input 0", input.getText()); }
Source:
<code>public GitBasedRepository(String repositoryLocation) throws IOException, NoWorkTreeException, GitAPIException { super(repositoryLocation); FileRepositoryBuilder builder = new FileRepositoryBuilder(); <START> this.gitRepo = builder.setWorkTree(this.repositoryRoot.toFile()).setMustExist(true).build(); <END> if (!new File(this.determineRepositoryPath(repositoryLocation) + File.separator + ".git").exists()) { this.gitRepo.create(); } this.git = new Git(this.gitRepo); if (!this.git.status().call().isClean()) { this.addCommit(null); } }</code><technical_language>is true passed setMustExist? if repository exist? I thought false ensures method succeeds next lines generate repository</technical_language>

Target:
public GitBasedRepository(String repositoryLocation) throws IOException, NoWorkTreeException, GitAPIException { super(repositoryLocation); FileRepositoryBuilder builder = new FileRepositoryBuilder(); Repository gitRepo = builder.setWorkTree(this.repositoryRoot.toFile()).setMustExist(false).build(); if (!new File(this.determineRepositoryPath(repositoryLocation) + File.separator + ".git").exists()) { gitRepo.create(); } this.git = new Git(gitRepo); if (!this.git.status().call().isClean()) { this.addCommit("Files changed externally."); } }
Source:
<code>private boolean checkPgFilePermissions(String referencePermissionInput) throws IOException { if(checkIfOsIsPosixCompliant()){ return checkPgFilePermissionsForPosix(referencePermissionInput); } else { <START> System.out.println("Error reading permissions for '" + _pwdfile + "'. OS is not POSIX compliant"); <END> return false; } }</code><technical_language>slf4j log errors, println. add a static field member, like: private static final Logger LOGGER = LoggerFactory.getLogger("diskCacheV111.util.Pgpass");</technical_language>

Target:
private boolean checkPgFilePermissions(String referencePermissionInput) throws IOException { if(checkIfOsIsPosixCompliant()){ return checkPgFilePermissionsForPosix(referencePermissionInput); } else { LOGGER.warn("Error reading permissions for '{}'. OS is not POSIX compliant", _pwdfile); return false; } }
Source:
<code>private Properties getJavaProfileProperties(Bundle bundle, String path) { Properties profile = new Properties(); URL profileURL = bundle.getEntry(path); if (profileURL != null) { try (InputStream is = profileURL.openStream()) { profileURL = FileLocator.resolve(profileURL); if (is != null) { profile.load(is); fixJavaSE9ComplianceSourceTargetLevels(profile); } } catch (IOException e) { return null; } } else { if (getCompliance() == null) { return null; } profile.setProperty(JavaCore.COMPILER_COMPLIANCE, getCompliance()); profile.setProperty(JavaCore.COMPILER_SOURCE, getCompliance()); profile.setProperty(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, getCompliance()); profile.setProperty("org.eclipse.jdt.core.compiler.problem.assertIdentifier", "error"); profile.setProperty("org.eclipse.jdt.core.compiler.problem.enumIdentifier", "error"); profile.setProperty(Constants.FRAMEWORK_EXECUTIONENVIRONMENT, calculateVMExecutionEnvs(new Version(getCompliance()))); profile.setProperty(JavaCore.COMPILER_RELEASE, JavaCore.ENABLED); <START> profile.setProperty(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, <END> JavaCore.DISABLED); } return profile; }</code><technical_language>for compliance >=11 add severity level error default</technical_language>

Target:
private Properties getJavaProfileProperties(Bundle bundle, String path) { Properties profile = new Properties(); URL profileURL = bundle.getEntry(path); if (profileURL != null) { try (InputStream is = profileURL.openStream()) { profileURL = FileLocator.resolve(profileURL); if (is != null) { profile.load(is); fixJavaSE9ComplianceSourceTargetLevels(profile); } } catch (IOException e) { return null; } } else { String compliance = getCompliance(); if (compliance == null) { return null; } profile.setProperty(JavaCore.COMPILER_COMPLIANCE, compliance); profile.setProperty(JavaCore.COMPILER_SOURCE, compliance); profile.setProperty(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, compliance); profile.setProperty(JavaCore.COMPILER_PB_ASSERT_IDENTIFIER, JavaCore.ERROR); profile.setProperty(JavaCore.COMPILER_PB_ENUM_IDENTIFIER, JavaCore.ERROR); profile.setProperty(Constants.FRAMEWORK_EXECUTIONENVIRONMENT, calculateVMExecutionEnvs(new Version(compliance))); profile.setProperty(JavaCore.COMPILER_RELEASE, JavaCore.ENABLED); if (JavaCore.compareJavaVersions(compliance, JavaCore.VERSION_10) > 0) { profile.setProperty(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.DISABLED); profile.setProperty(JavaCore.COMPILER_PB_REPORT_PREVIEW_FEATURES, JavaCore.ERROR); } } return profile; }