auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code><START> private MavenExecutionResult readProjectWithDependencies(IProjectRegistry state, final IFile pomFile, <END> ResolverConfiguration resolverConfiguration, final IProgressMonitor monitor) { try { return execute(state, pomFile, resolverConfiguration, new ICallable<MavenExecutionResult>() { public MavenExecutionResult call(IMavenExecutionContext context, IProgressMonitor monitor) throws CoreException { ProjectBuildingRequest configuration = context.newProjectBuildingRequest(); configuration.setResolveDependencies(true); MavenExecutionResult res = getMaven().readMavenProjects(Collections.singleton(pomFile.getLocation().toFile()), configuration); return res; } }, monitor); } catch(CoreException ex) { DefaultMavenExecutionResult result = new DefaultMavenExecutionResult(); result.addException(ex); return result; } }</code><technical_language>unnecessary changes</technical_language>

Target:
private MavenExecutionResult readProjectWithDependencies(IProjectRegistry state, final IFile pomFile, ResolverConfiguration resolverConfiguration, final IProgressMonitor monitor) { try { return execute(state, pomFile, resolverConfiguration, (context, pm) -> { ProjectBuildingRequest configuration = context.newProjectBuildingRequest(); configuration.setResolveDependencies(true); return getMaven().readMavenProject(pomFile.getLocation().toFile(), configuration); }, monitor); } catch(CoreException ex) { DefaultMavenExecutionResult result = new DefaultMavenExecutionResult(); result.addException(ex); return result; } }
Source:
<code>public void testMVResolution() throws IOException, ProcCallException { final Client client = withViews( "CREATE VIEW v5_1 AS SELECT DISTINCT a1 distinct_a1, COUNT(b1) count_b1, SUM(a) sum_a, " + "COUNT(*) counts FROM t1 WHERE b >= 2 OR b1 IN (3,30,300) GROUP BY a1;", "CREATE VIEW v5_2 AS SELECT a a, COUNT(b1) count_b1, SUM(a) sum_a, " + "COUNT(*) counts FROM t1 WHERE b >= 2 AND b1 IN (3,30,300) GROUP BY a;", "CREATE VIEW v5_3 AS SELECT a1 a1, COUNT(b1) count_b1, SUM(a) sum_a, " + "COUNT(*) counts FROM t1 WHERE b >= 2 OR b1 IN (3,30,300) GROUP BY a1;", "CREATE VIEW v5_4 AS SELECT a1 a1, COUNT(b1) count_b1, SUM(a) sum_a, " + "COUNT(*) counts FROM t1 WHERE a >= 2 OR b1 IN (3,30,300) GROUP BY a1;"); String adHocQuery = "SELECT COUNT(b1) cb FROM t1 WHERE b >= 2 OR b1 in (3, 30, 300) GROUP BY a1"; String matchedQuery = "SELECT COUNT(b1) cb FROM t1 WHERE b >= 2 OR b1 in (3, 30, 300) GROUP BY a1"; assertTablesAreEqual("Exact match with view", <START> client.callProcedure("@AdHoc", adHocQuery + " order by cb").getResults()[0], <END> client.callProcedure("@AdHoc", matchedQuery + " order by cb").getResults()[0]); assertTrue(getQueryPlan('\n', client, adHocQuery).toLowerCase().contains("sequential scan of \"v5_3\"".toLowerCase())); cleanTableAndViews(client, "V5_1", "V5_2", "V5_3", "V5_4"); }</code><technical_language>I failed anticipate that; move edits string directly? easier track</technical_language>

Target:
public void testMVResolution() throws IOException, ProcCallException { final Client client = withViews( "CREATE VIEW v5_1 AS SELECT DISTINCT a1 distinct_a1, COUNT(b1) count_b1, SUM(a) sum_a, " + "COUNT(*) counts FROM t1 WHERE b >= 2 OR b1 IN (3,30,300) GROUP BY a1;", "CREATE VIEW v5_2 AS SELECT a a, COUNT(b1) count_b1, SUM(a) sum_a, " + "COUNT(*) counts FROM t1 WHERE b >= 2 AND b1 IN (3,30,300) GROUP BY a;", "CREATE VIEW v5_3 AS SELECT a1 a1, COUNT(b1) count_b1, SUM(a) sum_a, " + "COUNT(*) counts FROM t1 WHERE b >= 2 OR b1 IN (3,30,300) GROUP BY a1;", "CREATE VIEW v5_4 AS SELECT a1 a1, COUNT(b1) count_b1, SUM(a) sum_a, " + "COUNT(*) counts FROM t1 WHERE a >= 2 OR b1 IN (3,30,300) GROUP BY a1;"); assertTablesAreEqual("Exact match with view", client.callProcedure("@AdHoc", "SELECT COUNT(b1) cb FROM t1 WHERE b >= 2 OR b1 in (3, 30, 300) GROUP BY a1 order by cb").getResults()[0], client.callProcedure("@AdHoc", "SELECT count_b1 cb FROM v5_1 order by cb").getResults()[0]); assertTrue(getQueryPlan('\n', client, "SELECT COUNT(b1) cb FROM t1 WHERE b >= 2 OR b1 in (3, 30, 300) GROUP BY a1").toLowerCase().contains("sequential scan of \"v5_3\"".toLowerCase())); cleanTableAndViews(client, "V5_1", "V5_2", "V5_3", "V5_4"); }
Source:
<code>public void testGetMediaInformation() throws IOException { FFmpegProbeResult probeResult = ffprobe.probe(Samples.big_buck_bunny_720p_1mb); FFmpegFormat format = probeResult.getFormat(); String line1 = <START> String.format(Locale.US, "File: '%s' ; Format: '%s' ; Duration: %.3fs", format.filename, <END> format.format_long_name, format.duration); FFmpegStream stream = probeResult.getStreams().get(0); String line2 = String.format(Locale.US, "Codec: '%s' ; Width: %dpx ; Height: %dpx", stream.codec_long_name, stream.width, stream.height); assertThat( line1, is("File: 'src/test/resources/net/bramp/ffmpeg/samples/big_buck_bunny_720p_1mb.mp4' ; Format: 'QuickTime / MOV' ; Duration: 5.312s")); assertThat(line2, is("Codec: 'H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10' ; Width: 1280px ; Height: 720px")); }</code><technical_language>call Locale.setDefault test, avoid cluttering example</technical_language>

Target:
public void testGetMediaInformation() throws IOException { FFmpegProbeResult probeResult = ffprobe.probe(Samples.big_buck_bunny_720p_1mb); FFmpegFormat format = probeResult.getFormat(); String line1 = String.format(locale, "File: '%s' ; Format: '%s' ; Duration: %.3fs", format.filename, format.format_long_name, format.duration); FFmpegStream stream = probeResult.getStreams().get(0); String line2 = String.format(locale, "Codec: '%s' ; Width: %dpx ; Height: %dpx", stream.codec_long_name, stream.width, stream.height); assertThat( line1, is("File: 'src/test/resources/net/bramp/ffmpeg/samples/big_buck_bunny_720p_1mb.mp4' ; Format: 'QuickTime / MOV' ; Duration: 5.312s")); assertThat(line2, is("Codec: 'H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10' ; Width: 1280px ; Height: 720px")); }
Source:
<code>public int getFolderUnreadCount(Context context, String folderName) throws MessagingException { if (!isAvailable(context)) { return 0; } int unreadMessageCount = 0; ContentResolver cr = context.getContentResolver(); Uri uri = Uri.withAppendedPath(EmailProvider.CONTENT_URI, "account/" + getUuid() + "/stats"); String[] projection = { StatsColumns.UNREAD_COUNT, }; LocalSearch search = new LocalSearch(); search.addAllowedFolder(folderName); StringBuilder query = new StringBuilder(); List<String> queryArgs = new ArrayList<>(); ConditionsTreeNode conditions = search.getConditions(); SqlQueryBuilder.buildWhereClause(this, conditions, query, queryArgs); String selection = query.toString(); String[] selectionArgs = queryArgs.toArray(new String[0]); Cursor cursor = cr.query(uri, projection, selection, selectionArgs, null); try { if (cursor != null && cursor.moveToFirst()) { <START> unreadMessageCount = cursor.getInt(0); <END> } } finally { Utility.closeQuietly(cursor); } return unreadMessageCount; }</code><technical_language>replace this block a function explains intent: buildUnreadQueryForFolder(folderName)</technical_language>

Target:
public int getFolderUnreadCount(Context context, String folderName) throws MessagingException { if (!isAvailable(context)) { return 0; } int unreadMessageCount = 0; Cursor cursor = loadUnreadCountForFolder(context, folderName); try { if (cursor != null && cursor.moveToFirst()) { unreadMessageCount = cursor.getInt(0); } } finally { Utility.closeQuietly(cursor); } return unreadMessageCount; }
Source:
<code>public DataTransactionResult remove(DataHolder dataHolder) { IMixinTileEntityShulkerBox box = (IMixinTileEntityShulkerBox) dataHolder; DyeColor color = (DyeColor) (Object) box.getColor(); box.setColor(null); <START> return DataTransactionResult.successRemove(new ImmutableSpongeValue<>(Keys.DYE_COLOR, DyeColors.PURPLE, color)); <END> }</code><technical_language>cached ImmutableDataCachingUtil</technical_language>

Target:
public DataTransactionResult remove(DataHolder dataHolder) { IMixinTileEntityShulkerBox box = (IMixinTileEntityShulkerBox) dataHolder; DyeColor color = (DyeColor) (Object) box.getColor(); box.setColor(null); if (color == null) { return DataTransactionResult.failNoData(); } return DataTransactionResult.successRemove(ImmutableSpongeValue.cachedOf(Keys.DYE_COLOR, DyeColors.PURPLE, color)); }
Source:
<code>public void delete(APIContext apiContext) throws PayPalRESTException { if (this.getId() == null) { throw new IllegalArgumentException("Id cannot be null"); } <START> apiContext.setRequestId(null); <END> Object[] parameters = new Object[] {this.getId()}; String pattern = "v1/payment-experience/web-profiles/{0}"; String resourcePath = RESTUtil.formatURIPath(pattern, parameters); String payLoad = ""; configureAndExecute(apiContext, HttpMethod.DELETE, resourcePath, payLoad, null); apiContext.setRequestId(null); }</code><technical_language>@jaypatel512 I discussed some of this day. I want line called. Request-ID is idempotency header. hurt set null force a regeneration a DELETE, matter anyway. mask request ID set true "masking"/"hiding" sending Request-ID header is ok for DELETEs. However, reset state of APIContext if reuses APIContext in multiple calls, this weird behavior. :( While working making APIContext more thread-safe, hoping majority of usages APIContext is a new is request. This is partially a legacy / compatibility thing</technical_language>

Target:
public void delete(APIContext apiContext) throws PayPalRESTException { if (this.getId() == null) { throw new IllegalArgumentException("Id cannot be null"); } Object[] parameters = new Object[] {this.getId()}; String pattern = "v1/payment-experience/web-profiles/{0}"; String resourcePath = RESTUtil.formatURIPath(pattern, parameters); String payLoad = ""; configureAndExecute(apiContext, HttpMethod.DELETE, resourcePath, payLoad, null); }
Source:
<code>public void testUncompress_withSymbolicLinks() throws IOException { File inputFile = null; try { inputFile = new File(inputUrl.toURI().getPath(), "tarLink.tar.gz"); } catch (URISyntaxException e) { e.printStackTrace(); } final File temporaryDirectory = Files.createTempDir(); temporaryDirectory.deleteOnExit(); final List<File> extractedFiles = extractor.uncompress(inputFile, temporaryDirectory, e -> {}); final File file1 = new File(temporaryDirectory, "file1.txt"); final File file2 = new File(temporaryDirectory, "file1_link.txt"); assertTrue(file1.exists()); assertTrue(file2.exists()); assertEquals("file1content", new String(FileUtils.readFileToByteArray(file1))); assertEquals("file1content", new String(FileUtils.readFileToByteArray(file2))); assertTrue(java.nio.file.Files.isSymbolicLink(Paths.get(file2.getPath()))); <START> } <END></code><technical_language>A public method throw more exception</technical_language>

Target:
public void testUncompress_withSymbolicLinks() throws IOException, URISyntaxException { File inputFile = new File(inputUrl.toURI().getPath(), "tarLink.tar.gz"); final File temporaryDirectory = Files.createTempDir(); temporaryDirectory.deleteOnExit(); final List<File> extractedFiles = extractor.uncompress(inputFile, temporaryDirectory, e -> {}); final File file1 = new File(temporaryDirectory, "file1.txt"); final File file2 = new File(temporaryDirectory, "file1_link.txt"); assertTrue(file1.exists()); assertTrue(file2.exists()); assertEquals("file1content", new String(FileUtils.readFileToByteArray(file1))); assertEquals("file1content", new String(FileUtils.readFileToByteArray(file2))); assertTrue(java.nio.file.Files.isSymbolicLink(Paths.get(file2.getPath()))); }
Source:
<code>public static void output(@AggregationState PrecisionRecallState state, BlockBuilder out) { Iterator<PrecisionRecallAggregation.BucketResult> resultsIterator = getResultsIterator(state); BlockBuilder entryBuilder = out.beginBlockEntry(); while (resultsIterator.hasNext()) { final BucketResult result = resultsIterator.next(); <START> final Double remainingTrueWeight = result.totalTrueWeight - result.runningTrueWeight; <END> final Double remainingFalseWeight = result.totalFalseWeight - result.runningFalseWeight; DoubleType.DOUBLE.writeDouble( entryBuilder, remainingTrueWeight / (remainingTrueWeight + remainingFalseWeight)); } out.closeEntry(); }</code><technical_language>small d doubles for simple calculations</technical_language>

Target:
public static void output(@AggregationState PrecisionRecallState state, BlockBuilder out) { Iterator<PrecisionRecallAggregation.BucketResult> resultsIterator = getResultsIterator(state); BlockBuilder entryBuilder = out.beginBlockEntry(); while (resultsIterator.hasNext()) { final BucketResult result = resultsIterator.next(); final double remainingTrueWeight = result.totalTrueWeight - result.runningTrueWeight; final double remainingFalseWeight = result.totalFalseWeight - result.runningFalseWeight; DoubleType.DOUBLE.writeDouble( entryBuilder, remainingTrueWeight / (remainingTrueWeight + remainingFalseWeight)); } out.closeEntry(); }
Source:
<code>public boolean apply(Game game, Ability source) { AtTheBeginOfNextEndStepDelayedTriggeredAbility delayedLifeLost = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(new LoseLifeSourceControllerEffect(1)); game.addDelayedTriggeredAbility(delayedLifeLost, source); Effect effect = new ReturnToHandTargetEffect(); <START> effect.setText("return Brood of Cockroaches to your hand."); <END> effect.setTargetPointer(new FixedTarget(source.getSourceId(), source.getSourceObjectZoneChangeCounter())); DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect); game.addDelayedTriggeredAbility(delayedAbility, source); return true; }</code><technical_language>{this} instead of name of card work in this case</technical_language>

Target:
public boolean apply(Game game, Ability source) { AtTheBeginOfNextEndStepDelayedTriggeredAbility delayedLifeLost = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(new LoseLifeSourceControllerEffect(1)); game.addDelayedTriggeredAbility(delayedLifeLost, source); Effect effect = new ReturnToHandTargetEffect(); effect.setText("return {this} to your hand."); effect.setTargetPointer(new FixedTarget(source.getSourceId(), source.getSourceObjectZoneChangeCounter())); DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect); game.addDelayedTriggeredAbility(delayedAbility, source); return true; }
Source:
<code>public ServiceResponse delete(String url, String data) throws JAXBException, IOException, URISyntaxException, AuthenticationException { <START> <END> return Util.sendRequest(url, "delete"); }</code><technical_language>url changed. I fix in repo</technical_language>

Target:
public ServiceResponse delete(String url, String data) throws JAXBException, IOException, URISyntaxException, AuthenticationException { return Util.sendRequest(url + "/feed/" + Util.readDatasetName(data) + colo, "delete"); }
Source:
<code>public static ByteBuf encodeMetadata( ByteBufAllocator allocator, WellKnownAuthType authType, ByteBuf metadata) { if (authType == WellKnownAuthType.UNPARSEABLE_AUTH_TYPE || authType == WellKnownAuthType.UNKNOWN_RESERVED_AUTH_TYPE) { <START> metadata.release(); <END> throw new IllegalArgumentException("only allowed AuthType should be used"); } int capacity = AUTH_TYPE_ID_LENGTH; ByteBuf headerBuffer = allocator .buffer(capacity, capacity) .writeByte(authType.getIdentifier() | STREAM_METADATA_KNOWN_MASK); return TupleByteBuf.of(allocator, headerBuffer, metadata); }</code><technical_language>easiest leave release here, a bit weird for debugging etc, catching exception want try recover</technical_language>

Target:
public static ByteBuf encodeMetadata( ByteBufAllocator allocator, WellKnownAuthType authType, ByteBuf metadata) { if (authType == WellKnownAuthType.UNPARSEABLE_AUTH_TYPE || authType == WellKnownAuthType.UNKNOWN_RESERVED_AUTH_TYPE) { throw new IllegalArgumentException("only allowed AuthType should be used"); } int capacity = AUTH_TYPE_ID_LENGTH; ByteBuf headerBuffer = allocator .buffer(capacity, capacity) .writeByte(authType.getIdentifier() | STREAM_METADATA_KNOWN_MASK); return TupleByteBuf.of(allocator, headerBuffer, metadata); }
Source:
<code>public String getProvidedExtensionAsServer() { return EXTENSION_REGISTERED_NAME; <START> } <END></code><technical_language>148</technical_language>

Target:
public String getProvidedExtensionAsServer() { return EXTENSION_REGISTERED_NAME + "; " + SERVER_NO_CONTEXT_TAKEOVER + (clientNoContextTakeover ? "; " + CLIENT_NO_CONTEXT_TAKEOVER : ""); }
Source:
<code>public void accept(CsvFileSource annotation) { resources = annotation.resources(); charset = Charset.forName(annotation.encoding()); skipHeaderLines = annotation.skipHeaderLines(); <START> settings = new CsvParserSettings(); <END> settings.getFormat().setDelimiter(annotation.delimiter()); settings.getFormat().setLineSeparator(annotation.lineSeparator()); settings.getFormat().setQuote('"'); settings.getFormat().setQuoteEscape('"'); settings.setEmptyValue(""); settings.setAutoConfigurationEnabled(false); }</code><technical_language>a settings.setHeaderExtractionEnabled(true); option provided CsvParserSettings... I simple integer-based skip implementation more</technical_language>

Target:
public void accept(CsvFileSource annotation) { resources = annotation.resources(); charset = Charset.forName(annotation.encoding()); numLinesToSkip = annotation.numLinesToSkip(); settings = new CsvParserSettings(); settings.getFormat().setDelimiter(annotation.delimiter()); settings.getFormat().setLineSeparator(annotation.lineSeparator()); settings.getFormat().setQuote('"'); settings.getFormat().setQuoteEscape('"'); settings.setEmptyValue(""); settings.setAutoConfigurationEnabled(false); }
Source:
<code>private void setQcowCompat() { if (getDiskImage().getDiskStorageType() == DiskStorageType.IMAGE) { final DiskImage newDiskImage = getDiskImage(); <START> if (newDiskImage.getVolumeFormat().equals(VolumeFormat.COW)) { <END> try { setQcowCompat(newDiskImage.getImage(), newDiskImage.getStoragePoolId(), newDiskImage.getId(), newDiskImage.getImageId(), getParameters().getStorageDomainId(), null); imageDao.update(newDiskImage.getImage()); } catch (EngineException e) { log.error("Unable to update the image info for image '{}' (image group: '{}') on domain '{}'", newDiskImage.getImageId(), newDiskImage.getId(), getParameters().getStorageDomainId()); } } } }</code><technical_language>1.can conditions in setQcowCompat() avoid repeating them? 2. if - in in condition &&</technical_language>

Target:
private void setQcowCompat() { if (getDiskImage().getDiskStorageType() == DiskStorageType.IMAGE && getDiskImage().getVolumeFormat().equals(VolumeFormat.COW)) { DiskImage newDiskImage = getDiskImage(); try { setQcowCompat(newDiskImage.getImage(), newDiskImage.getStoragePoolId(), newDiskImage.getId(), newDiskImage.getImageId(), getParameters().getStorageDomainId(), null); imageDao.update(newDiskImage.getImage()); } catch (EngineException e) { log.error("Unable to update the image info for image '{}' (image group: '{}') on domain '{}'", newDiskImage.getImageId(), newDiskImage.getId(), getParameters().getStorageDomainId()); } } }
Source:
<code>public void setPayloadFilter(String stringPattern, boolean isRegex, boolean isIgnoreCase,boolean isInverted) throws PatternSyntaxException { <START> if(stringPattern == null || stringPattern.length() == 0){ <END> this.payloadFilter = null; }else{ payloadFilter = new WebSocketMessagesPayloadFilter(stringPattern, isRegex, isIgnoreCase, isInverted); } }</code><technical_language>isEmpty, instead of length() == 0</technical_language>

Target:
public void setPayloadFilter(String stringPattern, boolean isRegex, boolean isIgnoreCase,boolean isInverted) throws PatternSyntaxException { if(stringPattern == null || stringPattern.isEmpty()){ payloadFilter = null; }else{ payloadFilter = new WebSocketMessagesPayloadFilter(stringPattern, isRegex, isIgnoreCase, isInverted); } }
Source:
<code>private void setFilters(final Map<ProgramFilters, Object> filters, final String crop, final String programName) { <START> List<CropType> croptypeList; <END> croptypeList = this.workbenchDataManager.getInstalledCropDatabses(); for (CropType cropType : croptypeList) { if (cropType.getCropName().equalsIgnoreCase(crop)) { filters.put(ProgramFilters.CROP_TYPE, cropType); } } if (!StringUtils.isBlank(programName)) { filters.put(ProgramFilters.PROGRAM_NAME, programName); } }</code><technical_language>rename cropTypeList</technical_language>

Target:
private void setFilters(final Map<ProgramFilters, Object> filters, final String crop, final String programName) { List<CropType> cropTypeList; cropTypeList = this.workbenchDataManager.getInstalledCropDatabses(); for (final CropType cropType : cropTypeList) { if (cropType.getCropName().equalsIgnoreCase(crop)) { filters.put(ProgramFilters.CROP_TYPE, cropType); } } if (!StringUtils.isBlank(programName)) { filters.put(ProgramFilters.PROGRAM_NAME, programName); } }
Source:
<code>public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException { try { IStatus status = Central.bndCall(() -> { BndEditModel model = new BndEditModel(project); model.load(); switch (pathtype) { case Constants.TESTPATH : model.addPath(bundle, Constants.TESTPATH); break; case Constants.BUILDPATH : default : model.addPath(bundle, Constants.BUILDPATH); break; } model.saveChanges(); Central.refreshFile(project.getPropertiesFile()); return Status.OK_STATUS; }); String[] determine = Descriptors.determine(fqn) .unwrap(); assert determine[0] != null : "We must have found a package"; <START> if (determine[1] == null) { context.getCompilationUnit() .createImport(fqn + ".*", null, monitor); } else { context.getCompilationUnit() .createImport(fqn, null, monitor); } return status; <END> } catch (Exception e) { throw new CoreException( new Status(IStatus.ERROR, Plugin.PLUGIN_ID, "Failed to add bundle to -buildpath", e)); } }</code><technical_language>This part of code is new support quick fixes of incomplete class definitions. original quick fix processor primarily supported case import statement existed, resolved bundle -buildpath. In cases, want create import statement again, do want add a ".*" import if explicitly imported class want. I need selective if/when call createImport(), depending problem fix</technical_language>

Target:
public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException { try { IStatus status = Central.bndCall(() -> { BndEditModel model = new BndEditModel(project); model.load(); switch (pathtype) { case Constants.TESTPATH : model.addPath(bundle, Constants.TESTPATH); break; case Constants.BUILDPATH : default : model.addPath(bundle, Constants.BUILDPATH); break; } model.saveChanges(); Central.refreshFile(project.getPropertiesFile()); return Status.OK_STATUS; }, monitor); String[] determine = Descriptors.determine(fqn) .unwrap(); assert determine[0] != null : "We must have found a package"; if (doImport) { if (determine[1] == null) { context.getCompilationUnit() .createImport(fqn + ".*", null, monitor); } else { context.getCompilationUnit() .createImport(fqn, null, monitor); } } return status; } catch (Exception e) { return new Status(IStatus.ERROR, Plugin.PLUGIN_ID, "Failed to add bundle " + bundle + " to " + pathtype, e); } }
Source:
<code>public void initialize(Context context) { <START> context.registerSyntaxNodeConsumer(Tree.Kind.FILE_INPUT, ctx -> this.ignoreList = new LinkedList<>()); <END> context.registerSyntaxNodeConsumer(Tree.Kind.IF_STMT, ctx -> { PyIfStatementTree ifStatement = (PyIfStatementTree) ctx.syntaxNode(); if (ignoreList.contains(ifStatement)) { return; } List<PyExpressionTree> conditions = getConditionsToCompare(ifStatement); findSameConditions(conditions, ctx); }); }</code><technical_language>linked list ? plain array list good</technical_language>

Target:
public void initialize(Context context) { context.registerSyntaxNodeConsumer(Tree.Kind.FILE_INPUT, ctx -> this.ignoreList = new ArrayList<>()); context.registerSyntaxNodeConsumer(Tree.Kind.IF_STMT, ctx -> { PyIfStatementTree ifStatement = (PyIfStatementTree) ctx.syntaxNode(); if (ignoreList.contains(ifStatement)) { return; } List<PyExpressionTree> conditions = getConditionsToCompare(ifStatement); findSameConditions(conditions, ctx); }); }
Source:
<code>public void run() { try { startDiscovery(); <START> while (shouldRun) { <END> try { DiscoveryServiceEvent event = eventQueue.take(); processEvent(event); } catch (Exception e) { log.error("Caught an exception. Stop discovery service.", e); shouldRun = false; stopLogReplication(); if (e instanceof InterruptedException) { Thread.interrupted(); } } } } catch (LogReplicationDiscoveryServiceException e) { log.error("Exceptionally terminate Log Replication Discovery Service", e); discoveryCallback.completeExceptionally(e); } catch (Exception e) { log.error("Unhandled exception caught during log replication service discovery", e); } finally { if (runtime != null) { runtime.shutdown(); } } }</code><technical_language>This wrapped another function for clarity purposes</technical_language>

Target:
public void run() { try { startDiscovery(); while (shouldRun) { try { DiscoveryServiceEvent event = eventQueue.take(); processEvent(event); } catch (Exception e) { log.error("Caught an exception. Stop discovery service.", e); shouldRun = false; stopLogReplication(); if (e instanceof InterruptedException) { Thread.interrupted(); } } } } catch (LogReplicationDiscoveryServiceException e) { log.error("Exceptionally terminate Log Replication Discovery Service", e); serverCallback.completeExceptionally(e); } catch (Exception e) { log.error("Unhandled exception caught during log replication service discovery. Retry,", e); } finally { if (runtime != null) { runtime.shutdown(); } } }
Source:
<code>protected abstract void extractMemberMetadata(Member member, InternalCompletableFuture future, MetadataHolder metadataHolder) throws Exception; protected abstract InternalCompletableFuture fetchMetadataOf(Address address, List<String> names); private Map<Member, InternalCompletableFuture> fetchMembersMetadataFor(List<String> names) { Collection<Member> members = getDataMembers(); if (members.isEmpty()) { return Collections.emptyMap(); } Map<Member, InternalCompletableFuture> futureByMember = createHashMap(members.size()); for (Member member : members) { Address address = member.getAddress(); try { futureByMember.put(member, fetchMetadataOf(address, names)); } catch (Exception e) { if (logger.isWarningEnabled()) { logger.warning(format("Can't fetch invalidation meta-data of %s", member), e); } <START> } <END> } return futureByMember; }</code><technical_language>eliminate some logging noise logging HazelcastInstanceNotActiveException FINEST level? If a member is gone, do it. Also, sense previous abstraction (scanMembers) member-side implementation advantage of InvocationUtil#invokeOnStableClusterSerial get a clean run members cluster topology changes</technical_language>

Target:
protected abstract void extractMemberMetadata(Member member, InternalCompletableFuture future, MetadataHolder metadataHolder) throws Exception; protected abstract InternalCompletableFuture fetchMetadataOf(Address address, List<String> names); private Map<Member, InternalCompletableFuture> fetchMembersMetadataFor(List<String> names) { Collection<Member> members = getDataMembers(); if (members.isEmpty()) { return Collections.emptyMap(); } Map<Member, InternalCompletableFuture> futureByMember = createHashMap(members.size()); for (Member member : members) { Address address = member.getAddress(); try { futureByMember.put(member, fetchMetadataOf(address, names)); } catch (HazelcastInstanceNotActiveException e) { logger.finest(e); } catch (Exception e) { if (logger.isWarningEnabled()) { logger.warning(format("Can't fetch invalidation meta-data of %s", member), e); } } } return futureByMember; }
Source:
<code>public MyNakadiRuntimeException1() { <START> super(); <END> }</code><technical_language>I this called automatically</technical_language>

Target:
public MyNakadiRuntimeException1() { }
Source:
<code>protected void configure() { bind(Boolean.class).annotatedWith(Names.named("testing")).toInstance(true); bindListener(InstanceOfMatcher.createFor(WebApplication.class), new TypeListener() { @Override public <I> void hear(TypeLiteral<I> type, final TypeEncounter<I> encounter) { final Provider<Injector> injectorProvider = encounter.getProvider(Injector.class); encounter.register(new InjectionListener<Object>() { @Override public void afterInjection(Object injectee) { WebApplication app = (WebApplication)injectee; app.getComponentInstantiationListeners().add(new GuiceComponentInjector(app, injectorProvider.get())); } }); } }); bind(OrienteerTester.class).asEagerSingleton(); Provider<OrienteerTester> provider = binder().getProvider(OrienteerTester.class); bind(WicketTester.class).toProvider(provider); bind(WicketOrientDbTester.class).toProvider(provider); <START> <END> Multibinder<String> binder = Multibinder.newSetBinder(binder(), String.class, Names.named("orient.model.packages")); binder.addBinding().toInstance("org.orienteer.core.persist"); }</code><technical_language>orienteer-object test orienteer module</technical_language>

Target:
protected void configure() { bind(Boolean.class).annotatedWith(Names.named("testing")).toInstance(true); bindListener(InstanceOfMatcher.createFor(WebApplication.class), new TypeListener() { @Override public <I> void hear(TypeLiteral<I> type, final TypeEncounter<I> encounter) { final Provider<Injector> injectorProvider = encounter.getProvider(Injector.class); encounter.register((InjectionListener<Object>) injected -> { WebApplication app = (WebApplication) injected; app.getComponentInstantiationListeners().add(new GuiceComponentInjector(app, injectorProvider.get())); }); } }); bind(OrienteerTester.class).asEagerSingleton(); Provider<OrienteerTester> provider = binder().getProvider(OrienteerTester.class); bind(WicketTester.class).toProvider(provider); bind(WicketOrientDbTester.class).toProvider(provider); }
Source:
<code>public void testAnEnabledRoomIsAvailableInTheTablet() { HomeTabletPage homeTabletPage = new HomeTabletPage(); SettingsPage settingsPage = homeTabletPage.clickSettingsBtn(); homeTabletPage = settingsPage.selectRoom(roomName); SearchPage searchPage = homeTabletPage.clickSearchBtn() .clickCollapseAdvancedBtn() .setName(roomName); <START> Assert.assertTrue(searchPage.roomIsDiplayed(roomName)); <END> }</code><technical_language>name of method roomIsDisplayed isRoomDisplayed a verb. Please change</technical_language>

Target:
public void testAnEnabledRoomIsAvailableInTheTablet() { HomeAdminPage homeAdminPage = new HomeAdminPage(); homeAdminPage.clickConferenceRoomsLink(); HomeTabletPage homeTabletPage = new HomeTabletPage(); SettingsPage settingsPage = homeTabletPage.clickSettingsBtn(); homeTabletPage = settingsPage.selectRoom(roomName); SearchPage searchPage = homeTabletPage.clickSearchBtn() .clickCollapseAdvancedBtn() .setName(roomName); Assert.assertTrue(searchPage.roomIsDiplayed(roomName)); }
Source:
<code>public void removeAll(Guid vmId) { List<VmNetworkInterface> interfaces = getVmNetworkInterfaceDao().getAllForVm(vmId); if (interfaces != null) { for (VmNetworkInterface iface : interfaces) { getMacPoolManager().freeMac(iface); <START> getVmNetworkInterfaceDao().remove(iface.getId()); <END> getVmNetworkStatisticsDao().remove(iface.getId()); } } }</code><technical_language>If iface nul in freeMac null here. I suggest move check remove freeMac</technical_language>

Target:
public void removeAll(Guid vmId) { List<VmNetworkInterface> interfaces = getVmNetworkInterfaceDao().getAllForVm(vmId); if (interfaces != null) { for (VmNetworkInterface iface : interfaces) { getMacPoolManager().freeMac(iface.getMacAddress()); getVmNetworkInterfaceDao().remove(iface.getId()); getVmNetworkStatisticsDao().remove(iface.getId()); } } }
Source:
<code>private void initNativeCore() { if (!"qnx".equals(System.getProperty("os.name"))) { OsmandSettings osmandSettings = app.getSettings(); if (osmandSettings.NATIVE_RENDERING_FAILED.get()) { osmandSettings.SAFE_MODE.set(true); <START> osmandSettings.PT_SAFE_MODE.set(true); <END> osmandSettings.NATIVE_RENDERING_FAILED.set(false); warnings.add(app.getString(R.string.native_library_not_supported)); } else { osmandSettings.SAFE_MODE.set(false); osmandSettings.PT_SAFE_MODE.set(false); osmandSettings.NATIVE_RENDERING_FAILED.set(true); startTask(app.getString(R.string.init_native_library), -1); RenderingRulesStorage storage = app.getRendererRegistry().getCurrentSelectedRenderer(); NativeOsmandLibrary lib = NativeOsmandLibrary.getLibrary(storage, app); boolean initialized = lib != null; osmandSettings.NATIVE_RENDERING_FAILED.set(false); if (!initialized) { LOG.info("Native library could not be loaded!"); } else { File ls = app.getAppPath("fonts"); lib.loadFontData(ls); } } app.getResourceManager().initMapBoundariesCacheNative(); } }</code><technical_language>needed</technical_language>

Target:
private void initNativeCore() { if (!"qnx".equals(System.getProperty("os.name"))) { OsmandSettings osmandSettings = app.getSettings(); if (osmandSettings.NATIVE_RENDERING_FAILED.get()) { osmandSettings.SAFE_MODE.set(true); osmandSettings.NATIVE_RENDERING_FAILED.set(false); warnings.add(app.getString(R.string.native_library_not_supported)); } else { osmandSettings.SAFE_MODE.set(false); osmandSettings.NATIVE_RENDERING_FAILED.set(true); startTask(app.getString(R.string.init_native_library), -1); RenderingRulesStorage storage = app.getRendererRegistry().getCurrentSelectedRenderer(); NativeOsmandLibrary lib = NativeOsmandLibrary.getLibrary(storage, app); boolean initialized = lib != null; osmandSettings.NATIVE_RENDERING_FAILED.set(false); if (!initialized) { LOG.info("Native library could not be loaded!"); } else { File ls = app.getAppPath("fonts"); lib.loadFontData(ls); } } app.getResourceManager().initMapBoundariesCacheNative(); } }
Source:
<code>public List<MetricFamilySamples> collect() { GaugeMetricFamily stateFamily = new GaugeMetricFamily( names.getStateMetricName(), "The state of the circuit breaker: 0 - CLOSED, 1 - OPEN, 2 - HALF_OPEN", LabelNames.NAME ); GaugeMetricFamily callsFamily = new GaugeMetricFamily( names.getCallsMetricName(), "The number of circuit breaker calls for corresponding kind", LabelNames.NAME_AND_KIND ); GaugeMetricFamily bufferedCallsFamily = new GaugeMetricFamily( names.getBufferedCallsMetricName(), "The number of circuit breaker buffered calls", LabelNames.NAME ); GaugeMetricFamily maxBufferedCallsFamily = new GaugeMetricFamily( names.getMaxBufferedCallsMetricName(), <START> "The number of circuit breaker max buffered calls", <END> LabelNames.NAME ); for (CircuitBreaker circuitBreaker : supplier.get()) { List<String> nameLabel = singletonList(circuitBreaker.getName()); stateFamily.addMetric(nameLabel, circuitBreaker.getState().getOrder()); Metrics metrics = circuitBreaker.getMetrics(); callsFamily.addMetric(asList(circuitBreaker.getName(), "successful"), metrics.getNumberOfSuccessfulCalls()); callsFamily.addMetric(asList(circuitBreaker.getName(), "failed"), metrics.getNumberOfFailedCalls()); callsFamily.addMetric(asList(circuitBreaker.getName(), "not_permitted"), metrics.getNumberOfNotPermittedCalls()); bufferedCallsFamily.addMetric(nameLabel, metrics.getNumberOfBufferedCalls()); maxBufferedCallsFamily.addMetric(nameLabel, metrics.getMaxNumberOfBufferedCalls()); } return asList(stateFamily, callsFamily, bufferedCallsFamily, maxBufferedCallsFamily); }</code><technical_language>better: maximum number of buffered calls</technical_language>

Target:
public List<MetricFamilySamples> collect() { GaugeMetricFamily stateFamily = new GaugeMetricFamily( names.getStateMetricName(), "The state of the circuit breaker: 0 - CLOSED, 1 - OPEN, 2 - HALF_OPEN", LabelNames.NAME ); GaugeMetricFamily callsFamily = new GaugeMetricFamily( names.getCallsMetricName(), "The number of calls for a corresponding kind", LabelNames.NAME_AND_KIND ); GaugeMetricFamily bufferedCallsFamily = new GaugeMetricFamily( names.getBufferedCallsMetricName(), "The number of buffered calls", LabelNames.NAME ); GaugeMetricFamily maxBufferedCallsFamily = new GaugeMetricFamily( names.getMaxBufferedCallsMetricName(), "The maximum number of buffered calls", LabelNames.NAME ); for (CircuitBreaker circuitBreaker : supplier.get()) { List<String> nameLabel = singletonList(circuitBreaker.getName()); stateFamily.addMetric(nameLabel, circuitBreaker.getState().getOrder()); Metrics metrics = circuitBreaker.getMetrics(); callsFamily.addMetric(asList(circuitBreaker.getName(), "successful"), metrics.getNumberOfSuccessfulCalls()); callsFamily.addMetric(asList(circuitBreaker.getName(), "failed"), metrics.getNumberOfFailedCalls()); callsFamily.addMetric(asList(circuitBreaker.getName(), "not_permitted"), metrics.getNumberOfNotPermittedCalls()); bufferedCallsFamily.addMetric(nameLabel, metrics.getNumberOfBufferedCalls()); maxBufferedCallsFamily.addMetric(nameLabel, metrics.getMaxNumberOfBufferedCalls()); } return asList(stateFamily, callsFamily, bufferedCallsFamily, maxBufferedCallsFamily); }
Source:
<code>protected GitCompareInput getCompareInput(ComparisonDataSource baseData, ComparisonDataSource remoteData, ComparisonDataSource ancestorData) { throw new UnsupportedOperationException( <START> "Compare editor for working tree files is should be opened directly from GitOpenInCompareAction"); END> }</code><technical_language>typo s/is should/should/</technical_language>

Target:
protected GitCompareInput getCompareInput(ComparisonDataSource baseData, ComparisonDataSource remoteData, ComparisonDataSource ancestorData) { throw new UnsupportedOperationException( "Compare editor for working tree files should be opened directly from GitOpenInCompareAction"); }
Source:
<code><START> private boolean updateRelevantVms() { List<VM> vms = getVmsDiskPluggedTo(); boolean updateAllVmsSucceeded = true; if (vms.isEmpty()) { updateAllVmsSucceeded = extendDiskSize(null); } else { for (VM vm : vms) { updateAllVmsSucceeded = extendDiskSize(vm); } } return updateAllVmsSucceeded; } <END></code><technical_language>consider: private boolean updateRelevantVms() { List<VM> vms = getVmsDiskPluggedTo(); if (vms.isEmpty()) { return extendDiskSize(null); } else { return vms.stream().allMatch(vm -> extendDiskSize(vm)); } }</technical_language>

Target:
private boolean updateRelevantVms() { List<VM> vms = getVmsDiskPluggedTo(); if (vms.isEmpty()) { return extendDiskSize(null); } return vms.stream().allMatch(this::extendDiskSize); }
Source:
<code>public synchronized HttpSession getOrCreateSession(HttpServletRequest httpRequest) { HttpSession session = httpRequest.getSession(true); if (session.getAttribute(SecurityConstants.SECURITY_TOKEN_KEY) == null) { <START> session.setMaxInactiveInterval(expirationTime * 60); <END> session.setAttribute(SecurityConstants.SECURITY_TOKEN_KEY, new SecurityTokenHolder()); SecurityLogger.audit( "Creating a new session with id for client {}.", Hashing.sha256().hashString(session.getId(), StandardCharsets.UTF_8).toString(), httpRequest.getRemoteAddr()); } return session; }</code><technical_language>While more verbose (and do in code live), more clear/correct do this is session.setMaxInactiveInterval(TimeUnit.MINUTES.toSeconds(expirationTime));</technical_language>

Target:
public synchronized HttpSession getOrCreateSession(HttpServletRequest httpRequest) { HttpSession session = httpRequest.getSession(true); if (session.getAttribute(SecurityConstants.SECURITY_TOKEN_KEY) == null) { session.setMaxInactiveInterval(Math.toIntExact(TimeUnit.MINUTES.toSeconds(expirationTime))); session.setAttribute(SecurityConstants.SECURITY_TOKEN_KEY, new SecurityTokenHolder()); SecurityLogger.audit( "Creating a new session with id for client {}.", Hashing.sha256().hashString(session.getId(), StandardCharsets.UTF_8).toString(), httpRequest.getRemoteAddr()); } return session; }
Source:
<code>private void process(final DuplicateSet set) { if (nextSetsIterator.hasNext()) { throw new PicardException("nextSetsIterator is expected to be empty, but already contains data."); } final UmiGraph umiGraph = new UmiGraph(set, umiTag, inferredUmiTag, allowMissingUmis); List<DuplicateSet> duplicateSets = umiGraph.joinUmisIntoDuplicateSets(maxEditDistanceToJoin); for (DuplicateSet ds : duplicateSets) { List<SAMRecord> records = ds.getRecords(); SAMRecord representativeRead = ds.getRepresentative(); String inferredUmi = representativeRead.getStringAttribute(inferredUmiTag); for (SAMRecord rec : records) { String currentUmi = rec.getStringAttribute(umiTag); if (currentUmi != null) { if (!haveWeSeenFirstRead) { metrics.UMI_LENGTH = currentUmi.length(); haveWeSeenFirstRead = true; } metrics.OBSERVED_BASE_ERRORS += hammingDistance(currentUmi, inferredUmi); observedBaseErrors += metrics.UMI_LENGTH; observedUmis.increment(currentUmi); inferredUmis.increment(inferredUmi); } } duplicateSetsWithUmi++; } duplicateSetsWithoutUmi++; double Z = 0; for (int k = 0; k <= maxEditDistanceToJoin; k++) { if (metrics.UMI_LENGTH > 0) { <START> Z = Z + LongMath.binomial(metrics.UMI_LENGTH, k) * Math.pow(3.0, k); <END> } } expectedCollisions = expectedCollisions + (1 - Math.pow(1 - Z / Math.pow(4, metrics.UMI_LENGTH), duplicateSets.size() - 1)) * duplicateSets.size(); nextSetsIterator = duplicateSets.iterator(); }</code><technical_language>Z again..please a variable is more meaningful</technical_language>

Target:
private void process(final DuplicateSet set) { if (nextSetsIterator.hasNext()) { throw new PicardException("nextSetsIterator is expected to be empty, but already contains data."); } final UmiGraph umiGraph = new UmiGraph(set, umiTag, inferredUmiTag, allowMissingUmis); List<DuplicateSet> duplicateSets = umiGraph.joinUmisIntoDuplicateSets(maxEditDistanceToJoin); for (DuplicateSet ds : duplicateSets) { List<SAMRecord> records = ds.getRecords(); SAMRecord representativeRead = ds.getRepresentative(); String inferredUmi = representativeRead.getStringAttribute(inferredUmiTag); for (SAMRecord rec : records) { String currentUmi = rec.getStringAttribute(umiTag); if (currentUmi != null) { if (!haveWeSeenFirstRead) { metrics.MEAN_UMI_LENGTH = currentUmi.length(); haveWeSeenFirstRead = true; } else { if (metrics.MEAN_UMI_LENGTH != currentUmi.length()) { throw new PicardException("UMIs of differing lengths were found."); } } metrics.OBSERVED_BASE_ERRORS += hammingDistance(currentUmi, inferredUmi); observedUmiBases += currentUmi.length(); metrics.addUmiObservation(currentUmi, inferredUmi); } } } metrics.DUPLICATE_SETS_WITH_UMI += duplicateSets.size(); metrics.DUPLICATE_SETS_IGNORING_UMI++; nextSetsIterator = duplicateSets.iterator(); }
Source:
<code>public static String keyspaceForApplication( UUID applicationId ) { <START> if ( USE_VIRTUAL_KEYSPACES ) { <END> return getApplicationKeyspace(); } else { return "Application_" + applicationId.toString().replace( '-', '_' ); } }</code><technical_language>change this code, virtual keyspaces, other scheme valid longer</technical_language>

Target:
public static String keyspaceForApplication( UUID applicationId ) { return getApplicationKeyspace(); }
Source:
<code>public void testWithParams(String host, String redirectUrl, String opHost) { ClientInterface client = Tester.newClient(host); final RegisterSiteResponse site = RegisterSiteTest.registerSite(client, opHost, redirectUrl); final GetAuthorizationUrlParams commandParams = new GetAuthorizationUrlParams(); commandParams.setOxdId(site.getOxdId()); Map<String, String> params = new HashMap<>(); params.put("max_age", "70"); params.put("is_valid", "true"); commandParams.setParams(params); final GetAuthorizationUrlResponse resp = client.getAuthorizationUrl(Tester.getAuthorization(), commandParams); assertNotNull(resp); <START> notEmpty(resp.getAuthorizationUrl()); <END> }</code><technical_language>add assert &max_age=70 is_valid=true</technical_language>

Target:
public void testWithParams(String host, String redirectUrl, String opHost) throws IOException { ClientInterface client = Tester.newClient(host); final RegisterSiteResponse site = RegisterSiteTest.registerSite(client, opHost, redirectUrl); final GetAuthorizationUrlParams commandParams = new GetAuthorizationUrlParams(); commandParams.setOxdId(site.getOxdId()); Map<String, String> params = new HashMap<>(); params.put("max_age", "70"); params.put("is_valid", "true"); commandParams.setParams(params); final GetAuthorizationUrlResponse resp = client.getAuthorizationUrl(Tester.getAuthorization(), commandParams); notEmpty(resp.getAuthorizationUrl()); Map<String, String> parameters = CoreUtils.splitQuery(resp.getAuthorizationUrl()); Assert.assertTrue(StringUtils.isNotBlank(parameters.get("max_age"))); assertEquals(parameters.get("max_age"), "70"); Assert.assertTrue(StringUtils.isNotBlank(parameters.get("is_valid"))); assertEquals(parameters.get("is_valid"), "true"); assertNotNull(resp); }
Source:
<code>public void invalidStoragePool() { StorageDomain sd = new StorageDomain(); Guid storagePoolId = Guid.newGuid(); sd.setStoragePoolId(storagePoolId); <START> when(storageDomainDao.getAllForStorageDomain(any(Guid.class))).thenReturn(Collections.singletonList(sd)); <END> when(storagePoolDao.get(storagePoolId)).thenReturn(null); assertFalse(cmd.validate()); }</code><technical_language>This is redundant in Mockito 2</technical_language>

Target:
public void invalidStoragePool() { StorageDomain sd = new StorageDomain(); Guid storagePoolId = Guid.newGuid(); sd.setStoragePoolId(storagePoolId); when(storageDomainDao.getAllForStorageDomain(any())).thenReturn(Collections.singletonList(sd)); assertFalse(cmd.validate()); }
Source:
<code>protected void saveWidgetValues() { IDialogSettings settings = getDialogSettings(); settings.put(STORE_ID_FILE_EXTENSION, getFileExtension(fileName)); settings.put(STORE_ID_INTERNAL_EXTERNAL, !internalButton.getSelection()); settings.put(STORE_ID_DESCR, selectedEditor.getId()); String editorId = selectedEditor.getId(); settings.put(STORE_ID_DESCR, editorId); if (rememberEditorButton == null || rememberTypeButton == null || (!rememberEditorButton.getSelection() && !rememberTypeButton.getSelection())) { <START> return; <END> } EditorRegistry reg = (EditorRegistry) WorkbenchPlugin.getDefault().getEditorRegistry(); if (rememberEditorButton.getSelection()) { updateFileMappings(reg, true); reg.setDefaultEditor(fileName, selectedEditor); } if (rememberTypeButton.getSelection()) { updateFileMappings(reg, false); reg.setDefaultEditor("*." + getFileType(), selectedEditor); } List<IFileEditorMapping> newMappings = new ArrayList<>(); newMappings.addAll(Arrays.asList(reg.getFileEditorMappings())); reg.setFileEditorMappings(newMappings.toArray(new FileEditorMapping[newMappings.size()])); reg.saveAssociations(); }</code><technical_language>If rememberEditorButton is selected remember type button exist (case of files extension "Dockerfile"), this return do want store association. advice be: boolean associateEditor = false; EditorRegistry reg = ... if (rememberEditorButton != null && rememberEditorButton.getSelection()) { ... associateEditor = true; } if (rememberTypeButton != null && rememberTypeButton.getSelection()) { ... associateEditor = true; } if (associateEditor) { ... set mappings... }</technical_language>

Target:
protected void saveWidgetValues() { IDialogSettings settings = getDialogSettings(); settings.put(STORE_ID_FILE_EXTENSION, getFileExtension(fileName)); settings.put(STORE_ID_INTERNAL_EXTERNAL, !internalButton.getSelection()); settings.put(STORE_ID_DESCR, selectedEditor.getId()); String editorId = selectedEditor.getId(); settings.put(STORE_ID_DESCR, editorId); boolean associateEditor = false; EditorRegistry reg = (EditorRegistry) WorkbenchPlugin.getDefault().getEditorRegistry(); if (rememberEditorButton != null && rememberEditorButton.getSelection()) { updateFileMappings(reg, true); reg.setDefaultEditor(fileName, selectedEditor); associateEditor = true; } if (rememberTypeButton != null && rememberTypeButton.getSelection()) { updateFileMappings(reg, false); reg.setDefaultEditor("*." + getFileType(), selectedEditor); associateEditor = true; } if (associateEditor) { List<IFileEditorMapping> newMappings = new ArrayList<>(); newMappings.addAll(Arrays.asList(reg.getFileEditorMappings())); reg.setFileEditorMappings(newMappings.toArray(new FileEditorMapping[newMappings.size()])); reg.saveAssociations(); } }