auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public boolean canPayFor(IAcquisitionWork acquisition) { if( (acquisition instanceof UnitOrder && getCampaignOptions().payForUnits()) ||(acquisition instanceof Part && getCampaignOptions().payForParts()) ) { <START> return !(getFunds() < acquisition.getBuyCost()); <END> } return true; }</code><technical_language>This easier read as: return getFunds() >= acquisition.getBuyCost();</technical_language>

Target:
public boolean canPayFor(IAcquisitionWork acquisition) { if( (acquisition instanceof UnitOrder && getCampaignOptions().payForUnits()) ||(acquisition instanceof Part && getCampaignOptions().payForParts()) ) { return (getFunds() >= acquisition.getBuyCost()); } return true; }
Source:
<code>public void testCustomFixedPartDocumentHistoryPageProvider() { assertNotNull(pageProviderService.getPageProviderDefinition("FIXED_PART_DOCUMENT_HISTORY_PROVIDER")); DocumentModel searchDoc = session.createDocumentModel("BasicAuditSearch"); searchDoc.setPathInfo("/", "auditsearch"); searchDoc = session.createDocument(searchDoc); <START> PageProvider<LogEntry> pageProvider; <END> searchDoc.setPropertyValue("basicauditsearch:eventIds", null); searchDoc.setPropertyValue("basicauditsearch:eventCategories", null); searchDoc.setPropertyValue("basicauditsearch:startDate", null); searchDoc.setPropertyValue("basicauditsearch:endDate", null); pageProvider = getPageProvider("FIXED_PART_DOCUMENT_HISTORY_PROVIDER", 30, 0, doc); pageProvider.setSearchDocumentModel(searchDoc); assertEquals(1,pageProvider.getCurrentPage().size()); pageProvider = getPageProvider("FIXED_PART_DOCUMENT_HISTORY_PROVIDER", 30, 0, proxy); pageProvider.setSearchDocumentModel(searchDoc); assertEquals(0,pageProvider.getCurrentPage().size()); }</code><technical_language>Move pageProvider assignation</technical_language>

Target:
public void testCustomFixedPartDocumentHistoryPageProvider() { assertNotNull(pageProviderService.getPageProviderDefinition("FIXED_PART_DOCUMENT_HISTORY_PROVIDER")); DocumentModel searchDoc = session.createDocumentModel("BasicAuditSearch"); searchDoc.setPathInfo("/", "auditsearch"); searchDoc = session.createDocument(searchDoc); searchDoc.setPropertyValue("basicauditsearch:eventIds", null); searchDoc.setPropertyValue("basicauditsearch:eventCategories", null); searchDoc.setPropertyValue("basicauditsearch:startDate", null); searchDoc.setPropertyValue("basicauditsearch:endDate", null); PageProvider<LogEntry> pageProvider = getPageProvider("FIXED_PART_DOCUMENT_HISTORY_PROVIDER", 30, 0, doc); pageProvider.setSearchDocumentModel(searchDoc); assertEquals(1, pageProvider.getCurrentPage().size()); pageProvider = getPageProvider("FIXED_PART_DOCUMENT_HISTORY_PROVIDER", 30, 0, proxy); pageProvider.setSearchDocumentModel(searchDoc); assertTrue(pageProvider.getCurrentPage().isEmpty()); }
Source:
<code><START> public void testFail() throws IOException { <END> final List<Pass> list = new ArrayList<Pass>(2); list.add(new PsFake(true)); list.add(new PsFake(false)); final Opt<Identity> identity = new PsAll(list, 1).enter(new RqFake()); MatcherAssert.assertThat( identity.has(), Matchers.is(false) ); }</code><technical_language>@lautarobock too, declare throws Exception</technical_language>

Target:
public void testFail() throws Exception { final List<Pass> list = new ArrayList<Pass>(2); list.add(new PsFake(true)); list.add(new PsFake(false)); final Opt<Identity> identity = new PsAll(list, 1).enter(new RqFake()); MatcherAssert.assertThat( identity.has(), Matchers.is(false) ); }
Source:
<code>private <T extends Enum<T>> Set<String> getRecommendationByBlacklist(Class<T> enumClass, boolean emptyServiceListBlacklisted, <START> List<String> entitlements) { <END> Map<String, Set<String>> componentsByHostGroup = getNonGatewayComponentsByHostGroup(); Set<String> recos = new HashSet<>(); for (Entry<String, Set<String>> hostGroupServices : componentsByHostGroup.entrySet()) { if (emptyServiceListBlacklisted && hostGroupServices.getValue().isEmpty()) { continue; } boolean foundBlackListItem = false; for (String service : hostGroupServices.getValue()) { com.google.common.base.Optional<T> enumValue = Enums.getIfPresent(enumClass, service); if (enumValue.isPresent()) { if (EntitledForServiceScale.class.isAssignableFrom(enumClass)) { Entitlement entitledFor = ((EntitledForServiceScale) enumValue.get()).getEntitledFor(); if (!entitlements.contains(entitledFor.name())) { foundBlackListItem = true; break; } } else { foundBlackListItem = true; break; } } } if (!foundBlackListItem) { recos.add(hostGroupServices.getKey()); } } return recos; }</code><technical_language>I add some logs able identify entitlements for enum parameterezied</technical_language>

Target:
private <T extends Enum<T>> Set<String> getRecommendationByBlacklist(Class<T> enumClass, boolean emptyServiceListBlacklisted, List<String> entitlements) { LOGGER.info("Get recommendation by blacklisted with entitlements {}.", enumClass, entitlements); Map<String, Set<String>> componentsByHostGroup = getNonGatewayComponentsByHostGroup(); Set<String> recos = new HashSet<>(); for (Entry<String, Set<String>> hostGroupServices : componentsByHostGroup.entrySet()) { if (emptyServiceListBlacklisted && hostGroupServices.getValue().isEmpty()) { continue; } boolean foundBlackListItem = false; for (String service : hostGroupServices.getValue()) { com.google.common.base.Optional<T> enumValue = Enums.getIfPresent(enumClass, service); if (enumValue.isPresent()) { if (EntitledForServiceScale.class.isAssignableFrom(enumClass)) { Entitlement entitledFor = ((EntitledForServiceScale) enumValue.get()).getEntitledFor(); if (!entitlements.contains(entitledFor.name())) { foundBlackListItem = true; break; } } else { foundBlackListItem = true; break; } } } if (!foundBlackListItem) { recos.add(hostGroupServices.getKey()); } } return recos; }
Source:
<code>private void updateButtonsEnablement() { fDeclareFinalCheckbox.setEnabled(getPromoteTempRefactoring().canEnableSettingFinal()); fDeclareStaticCheckbox.setEnabled(getPromoteTempRefactoring().canEnableSettingStatic()); for (Button <START> fInitializeInRadioButton : <END> fInitializeInRadioButtons) { fInitializeInRadioButton.setEnabled(canEnable(getDataAsInt(fInitializeInRadioButton))); } }</code><technical_language>rename initializeInRadioButton</technical_language>

Target:
private void updateButtonsEnablement() { fDeclareFinalCheckbox.setEnabled(getPromoteTempRefactoring().canEnableSettingFinal()); fDeclareStaticCheckbox.setEnabled(getPromoteTempRefactoring().canEnableSettingStatic()); for (Button initializeInRadioButton : fInitializeInRadioButtons) { initializeInRadioButton.setEnabled(canEnable(getDataAsInt(initializeInRadioButton))); } }
Source:
<code>private void checkForQuotaInDC(storage_pool storage_pool, final ICommandTarget commandTarget) { GetQuotaByStoragePoolIdQueryParameters parameters = new GetQuotaByStoragePoolIdQueryParameters(); <START> parameters.setRefresh(getIsQueryFirstTime()); <END> parameters.setStoragePoolId(storage_pool.getId()); Frontend.RunQuery(VdcQueryType.GetQuotaByStoragePoolId, parameters, new AsyncQuery( quotaListModel, new INewAsyncCallback() { @Override public void OnSuccess(Object model, Object returnValue) { if (((ArrayList<Quota>) ((VdcQueryReturnValue) returnValue).getReturnValue()).size() == 0) { promptNoQuotaInDCMessage(); } else { OnSaveInternal(); } } })); }</code><technical_language>remove line</technical_language>

Target:
private void checkForQuotaInDC(storage_pool storage_pool, final ICommandTarget commandTarget) { GetQuotaByStoragePoolIdQueryParameters parameters = new GetQuotaByStoragePoolIdQueryParameters(storage_pool.getId()); Frontend.RunQuery(VdcQueryType.GetQuotaByStoragePoolId, parameters, new AsyncQuery( quotaListModel, new INewAsyncCallback() { @Override public void OnSuccess(Object model, Object returnValue) { if (((ArrayList<Quota>) ((VdcQueryReturnValue) returnValue).getReturnValue()).size() == 0) { promptNoQuotaInDCMessage(); } else { OnSaveInternal(); } } })); }
Source:
<code>public void test_logsCoverageZip() throws DeviceNotAvailableException, IOException { doReturn( new StringJoiner("\n") .add("/data/misc/gcov/path/to/coverage.gcda") .add("/data/misc/gcov/path/to/.hidden/coverage2.gcda") .toString()) .when(mMockDevice) .executeShellCommand(anyString()); doAnswer( inv -> { File destFile = (File) inv.getArgument(1); try (OutputStream out = new FileOutputStream(destFile)) { COVERAGE_MEASUREMENT.writeTo(out); } return true; }) .when(mMockDevice) .pullFile(anyString(), any()); mCodeCoverageListener.testRunStarted(RUN_NAME, TEST_COUNT); Map<String, String> metric = new HashMap<>(); mCodeCoverageListener.testRunEnded(ELAPSED_TIME, TfMetricProtoUtil.upgradeConvert(metric)); List<ByteString> logs = mFakeListener.getLogs(); assertThat(logs).hasSize(1); File outputZip = folder.newFile("coverage.zip"); try (OutputStream out = new FileOutputStream(outputZip)) { logs.get(0).writeTo(out); } URI uri = URI.create(String.format("jar:file:%s", outputZip)); try (FileSystem filesystem = FileSystems.newFileSystem(uri, new HashMap<>())) { Path path1 = filesystem.getPath("/path/to/coverage.gcda"); assertThat(ByteString.readFrom(Files.newInputStream(path1))) .isEqualTo(COVERAGE_MEASUREMENT); Path path2 = filesystem.getPath("/path/to/.hidden/coverage2.gcda"); assertThat(ByteString.readFrom(Files.newInputStream(path2))) <START> .isEqualTo(COVERAGE_MEASUREMENT); <END> } }</code><technical_language>nit: want give measurement a distinct value</technical_language>

Target:
public void test_logsCoverageZip() throws DeviceNotAvailableException, IOException { doReturn( new StringJoiner("\n") .add("/data/misc/gcov/path/to/coverage.gcda") .add("/data/misc/gcov/path/to/.hidden/coverage2.gcda") .toString()) .when(mMockDevice) .executeShellCommand(anyString()); doAnswer( inv -> { File destFile = (File) inv.getArgument(1); try (OutputStream out = new FileOutputStream(destFile)) { out.write(destFile.getName().getBytes(StandardCharsets.UTF_8)); } return true; }) .when(mMockDevice) .pullFile(anyString(), any()); mCodeCoverageListener.testRunStarted(RUN_NAME, TEST_COUNT); Map<String, String> metric = new HashMap<>(); mCodeCoverageListener.testRunEnded(ELAPSED_TIME, TfMetricProtoUtil.upgradeConvert(metric)); List<ByteString> logs = mFakeListener.getLogs(); assertThat(logs).hasSize(1); File outputZip = folder.newFile("coverage.zip"); try (OutputStream out = new FileOutputStream(outputZip)) { logs.get(0).writeTo(out); } URI uri = URI.create(String.format("jar:file:%s", outputZip)); try (FileSystem filesystem = FileSystems.newFileSystem(uri, new HashMap<>())) { Path path1 = filesystem.getPath("/path/to/coverage.gcda"); assertThat(ByteString.readFrom(Files.newInputStream(path1))) .isEqualTo(ByteString.copyFromUtf8("coverage.gcda")); Path path2 = filesystem.getPath("/path/to/.hidden/coverage2.gcda"); assertThat(ByteString.readFrom(Files.newInputStream(path2))) .isEqualTo(ByteString.copyFromUtf8("coverage2.gcda")); } }
Source:
<code>private Node getOrCreateSequence(RowKey rowKey, final int initialValue) { String updateSequenceQuery = getQuery( rowKey ); <START> Map<String, Object> parameters = new HashMap<String, Object>(); <END> parameters.put( "initialValue", initialValue ); parameters.put( "sequenceName", sequenceName( rowKey ) ); ExecutionEngine engine = new ExecutionEngine( neo4jDb ); ExecutionResult result = engine.execute( updateSequenceQuery, parameters ); ResourceIterator<Node> column = result.columnAs( "n" ); Node node = null; if ( column.hasNext() ) { node = column.next(); } column.close(); return node; }</code><technical_language>new HashMap<String, Object>( 2 ); newHashMap( 2 );</technical_language>

Target:
private Node getOrCreateSequence(RowKey rowKey, final int initialValue) { String updateSequenceQuery = getQuery( rowKey ); Map<String, Object> parameters = new HashMap<String, Object>( 2 ); parameters.put( "initialValue", initialValue ); parameters.put( "sequenceName", sequenceName( rowKey ) ); ExecutionResult result = engine.execute( updateSequenceQuery, parameters ); ResourceIterator<Node> column = result.columnAs( "n" ); Node node = null; if ( column.hasNext() ) { node = column.next(); } column.close(); return node; }
Source:
<code>private CassandraNode buildCassandraNode(Protos.Offer offer, boolean seed, String replacementForIp) { CassandraNode.Builder builder = CassandraNode.newBuilder() .setHostname(offer.getHostname()) .setTargetRunState(CassandraNode.TargetRunState.RUN) .addDataVolumes( DataVolume.newBuilder() .setPath(configuration.getDefaultConfigRole().getPreDefinedDataDirectory()) .build() <START> ) <END> .setSeed(seed); if (replacementForIp != null) { builder.setReplacementForIp(replacementForIp); } try { InetAddress ia = InetAddress.getByName(offer.getHostname()); int jmxPort = getPortMapping(PORT_JMX); if (ia.isLoopbackAddress()) { try (ServerSocket serverSocket = new ServerSocket(0)) { jmxPort = serverSocket.getLocalPort(); } catch (IOException e) { throw new RuntimeException(e); } } return builder.setIp(ia.getHostAddress()) .setJmxConnect(JmxConnect.newBuilder() .setIp("127.0.0.1") .setJmxPort(jmxPort) ) .build(); } catch (UnknownHostException e) { throw new RuntimeException(e); } }</code><technical_language>add directory configured env option CASSANDRA_DATA_DIRECTORY CassandraNode.dataVolumes. omit this for some problems non-ephemeral data directories provided mesos itself</technical_language>

Target:
private CassandraNode buildCassandraNode(Protos.Offer offer, boolean seed, String replacementForIp) { CassandraNode.Builder builder = CassandraNode.newBuilder() .setHostname(offer.getHostname()) .setTargetRunState(CassandraNode.TargetRunState.RUN) .addDataVolumes( DataVolume.newBuilder() .setPath(configuration.getDefaultConfigRole().getPreDefinedDataDirectory()) ) .setSeed(seed); if (replacementForIp != null) { builder.setReplacementForIp(replacementForIp); } try { InetAddress ia = InetAddress.getByName(offer.getHostname()); int jmxPort = getPortMapping(PORT_JMX); if (ia.isLoopbackAddress()) { try (ServerSocket serverSocket = new ServerSocket(0)) { jmxPort = serverSocket.getLocalPort(); } catch (IOException e) { throw new RuntimeException(e); } } return builder.setIp(ia.getHostAddress()) .setJmxConnect(JmxConnect.newBuilder() .setIp("127.0.0.1") .setJmxPort(jmxPort) ) .build(); } catch (UnknownHostException e) { throw new RuntimeException(e); } }
Source:
<code>private MessageType getFilteredSchema(MessageType schema, List<String> expectedColumnNames) { List<Type> allColumns = schema.getFields(); List<Type> selectedColumns = new ArrayList<>(); for(String columnName: expectedColumnNames) { selectedColumns.add(allColumns.get(schema.getFieldIndex(columnName))); } <START> MessageType filteredSchema = new MessageType(schema.getName(), selectedColumns); <END> return filteredSchema; }</code><technical_language>Consider returning new directly, local filteredSchema name conflicts member variable of name</technical_language>

Target:
private MessageType getFilteredSchema(MessageType schema, List<String> expectedColumnNames) { List<Type> allColumns = schema.getFields(); List<Type> selectedColumns = new ArrayList<>(); for(String columnName: expectedColumnNames) { if(!partitionedColumnsHm.contains(columnName)) { selectedColumns.add(allColumns.get(schema.getFieldIndex(columnName))); } } return new MessageType(schema.getName(), selectedColumns); }
Source:
<code>public void installServiceTask(String serviceTaskId, List<String> parameters, String referenceLink, Command onDone) { String branchName = null; if(workspaceProjectContext != null) { <START> branchName = workspaceProjectContext.getActiveWorkspaceProject().get().getBranch().getName(); <END> } if (parameters.isEmpty()) { serviceTasksService.call((Void) -> { onDone.execute(); fireChangeEvent(); }).installServiceTask(serviceTaskId, getInstallTarget(), null, branchName); } else { ServiceTaskInstallFormPresenter installFormPresenter = iocManager.lookupBean(ServiceTaskInstallFormPresenter.class).newInstance(); installFormPresenter.showView(onDone, serviceTaskId, getInstallTarget(), parameters, referenceLink); } }</code><technical_language>whitespace issue =</technical_language>

Target:
public void installServiceTask(String serviceTaskId, List<String> parameters, String referenceLink, Command onDone) { if (parameters.isEmpty()) { serviceTasksService.call((Void) -> { onDone.execute(); fireChangeEvent(); }).installServiceTask(serviceTaskId, getInstallTarget(), null, getBranchName()); } else { ServiceTaskInstallFormPresenter installFormPresenter = iocManager.lookupBean(ServiceTaskInstallFormPresenter.class).newInstance(); installFormPresenter.showView(onDone, serviceTaskId, getInstallTarget(), parameters, referenceLink); } }
Source:
<code>public PatchSetComplexDisclosurePanel(final PatchSet ps, boolean isOpen) { super(Util.M.patchSetHeader(ps.getPatchSetId()), isOpen); detailCache = ChangeCache.get(ps.getId().getParentKey()).getChangeDetailCache(); changeDetail = detailCache.get(); patchSet = ps; body = new FlowPanel(); setContent(body); final GitwebLink gw = Gerrit.getGitwebLink(); final InlineLabel revtxt = new InlineLabel(ps.getRevision().get() + " "); revtxt.addStyleName(Gerrit.RESOURCES.css().patchSetRevision()); getHeader().add(revtxt); <START> if (gw != null && gw.isLinkableDraft(ps)) { <END> final Anchor revlink = new Anchor(gw.getLinkName(), false, gw.toRevision(changeDetail.getChange() .getProject(), ps)); revlink.addStyleName(Gerrit.RESOURCES.css().patchSetLink()); getHeader().add(revlink); } if (ps.isDraft()) { final InlineLabel draftLabel = new InlineLabel(Util.C.draftPatchSetLabel()); draftLabel.addStyleName(Gerrit.RESOURCES.css().patchSetRevision()); getHeader().add(draftLabel); } if (isOpen) { ensureLoaded(changeDetail.getCurrentPatchSetDetail()); } else { addOpenHandler(this); } }</code><technical_language>"isLinkableDraft" is "canLink"</technical_language>

Target:
public PatchSetComplexDisclosurePanel(final PatchSet ps, boolean isOpen) { super(Util.M.patchSetHeader(ps.getPatchSetId()), isOpen); detailCache = ChangeCache.get(ps.getId().getParentKey()).getChangeDetailCache(); changeDetail = detailCache.get(); patchSet = ps; body = new FlowPanel(); setContent(body); final GitwebLink gw = Gerrit.getGitwebLink(); final InlineLabel revtxt = new InlineLabel(ps.getRevision().get() + " "); revtxt.addStyleName(Gerrit.RESOURCES.css().patchSetRevision()); getHeader().add(revtxt); if (gw != null && gw.canLink(ps)) { final Anchor revlink = new Anchor(gw.getLinkName(), false, gw.toRevision(changeDetail.getChange() .getProject(), ps)); revlink.addStyleName(Gerrit.RESOURCES.css().patchSetLink()); getHeader().add(revlink); } if (ps.isDraft()) { final InlineLabel draftLabel = new InlineLabel(Util.C.draftPatchSetLabel()); draftLabel.addStyleName(Gerrit.RESOURCES.css().patchSetRevision()); getHeader().add(draftLabel); } if (isOpen) { ensureLoaded(changeDetail.getCurrentPatchSetDetail()); } else { addOpenHandler(this); } }
Source:
<code>public Optional<ConnectorNewTableLayout> getNewTableLayout(ConnectorSession session, ConnectorTableMetadata tableMetadata) { validatePartitionColumns(tableMetadata); validateBucketColumns(tableMetadata); Optional<HiveBucketProperty> bucketProperty = getBucketProperty(tableMetadata.getProperties()); if (!bucketProperty.isPresent()) { return Optional.empty(); } if (!bucketProperty.get().getSortedBy().isEmpty() && !isSortedWritingEnabled(session)) { throw new PrestoException(NOT_SUPPORTED, "Writing to bucketed sorted Hive tables is disabled"); } HivePartitioningHandle hivePartitioningHandle; List<String> bucketedBy = bucketProperty.get().getBucketedBy(); <START> HiveBucketProperty.BucketingType bucketingType = bucketProperty.get().getBucketingType(); <END> OptionalInt maxCompatibleBucketCount = OptionalInt.of(bucketProperty.get().getBucketCount()); switch (bucketingType) { case HIVETYPE: Map<String, HiveType> hiveTypeMap = tableMetadata.getColumns().stream() .collect(toMap(ColumnMetadata::getName, column -> toHiveType(typeTranslator, column.getType()))); hivePartitioningHandle = createPartitioningHandleWithHiveType( bucketProperty.get().getBucketCount(), bucketedBy.stream() .map(hiveTypeMap::get) .collect(toImmutableList()), maxCompatibleBucketCount); break; case PRESTOTYPE: hivePartitioningHandle = createPartitioningHandleWithPrestoType( bucketProperty.get().getBucketCount(), bucketProperty.get().getTypes().get(), maxCompatibleBucketCount); break; default: throw new IllegalStateException(format("Unsupported bucketing type %s", bucketingType)); } return Optional.of(new ConnectorNewTableLayout(hivePartitioningHandle, bucketedBy)); }</code><technical_language>create temporary table. insert. change getNewTableLayout is needed</technical_language>

Target:
public Optional<ConnectorNewTableLayout> getNewTableLayout(ConnectorSession session, ConnectorTableMetadata tableMetadata) { validatePartitionColumns(tableMetadata); validateBucketColumns(tableMetadata); Optional<HiveBucketProperty> bucketProperty = getBucketProperty(tableMetadata.getProperties()); if (!bucketProperty.isPresent()) { return Optional.empty(); } checkArgument(bucketProperty.get().getBucketFunctionType().equals(BucketFunctionType.HIVE_COMPATIBLE), "bucketFunctionType is expected to be HIVE_COMPATIBLE, got: %s", bucketProperty.get().getBucketFunctionType()); if (!bucketProperty.get().getSortedBy().isEmpty() && !isSortedWritingEnabled(session)) { throw new PrestoException(NOT_SUPPORTED, "Writing to bucketed sorted Hive tables is disabled"); } List<String> bucketedBy = bucketProperty.get().getBucketedBy(); Map<String, HiveType> hiveTypeMap = tableMetadata.getColumns().stream() .collect(toMap(ColumnMetadata::getName, column -> toHiveType(typeTranslator, column.getType()))); return Optional.of(new ConnectorNewTableLayout( createHiveCompatiblePartitioningHandle( bucketProperty.get().getBucketCount(), bucketedBy.stream() .map(hiveTypeMap::get) .collect(toImmutableList()), OptionalInt.of(bucketProperty.get().getBucketCount())), bucketedBy)); }
Source:
<code>private void runLocalTrain() throws IOException { if(Constants.TENSORFLOW_DNN.equalsIgnoreCase(modelConfig.getAlgorithm())) { runTensorflowLocalTrain(); return; } <START> runAkkaTrain(isForVarSelect ? 1 : modelConfig.getBaggingNum()); <END> }</code><technical_language>if { } else { } instead of if (return)</technical_language>

Target:
private void runLocalTrain() throws IOException { if(Constants.TENSORFLOW.equalsIgnoreCase(modelConfig.getAlgorithm())) { runTensorflowLocalTrain(); return; } else { runAkkaTrain(isForVarSelect ? 1 : modelConfig.getBaggingNum()); } }
Source:
<code>protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String streamId = StringUtils.substringAfterLast(req.getRequestURI(), "/"); if (!streams.containsKey(streamId)) { logger.debug("Received request for invalid stream id at {}", req.getRequestURI()); resp.sendError(HttpServletResponse.SC_NOT_FOUND); } else { logger.debug("Stream to serve is {}", streamId); <START> AudioStream stream = streams.get(streamId); <END> String mimeType = null; if (stream.getFormat().getCodec() == AudioFormat.CODEC_MP3) { mimeType = "audio/mpeg"; } else if (stream.getFormat().getContainer() == AudioFormat.CONTAINER_WAVE) { mimeType = "audio/wav"; } else if (stream.getFormat().getContainer() == AudioFormat.CONTAINER_OGG) { mimeType = "audio/ogg"; } if (mimeType != null) { resp.setContentType(mimeType); } if (stream instanceof DiscreteAudioStream) { Integer size = ((DiscreteAudioStream) stream).size(); if (size != null) { resp.setContentLength(size); } } ServletOutputStream os = resp.getOutputStream(); IOUtils.copy(stream, os); resp.flushBuffer(); IOUtils.closeQuietly(stream); } }</code><technical_language>streams.remove(streamId) here</technical_language>

Target:
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String streamId = StringUtils.substringAfterLast(req.getRequestURI(), "/"); if (!streams.containsKey(streamId)) { logger.debug("Received request for invalid stream id at {}", req.getRequestURI()); resp.sendError(HttpServletResponse.SC_NOT_FOUND); } else { logger.debug("Stream to serve is {}", streamId); AudioStream stream = streams.remove(streamId); String mimeType = null; if (stream.getFormat().getCodec() == AudioFormat.CODEC_MP3) { mimeType = "audio/mpeg"; } else if (stream.getFormat().getContainer() == AudioFormat.CONTAINER_WAVE) { mimeType = "audio/wav"; } else if (stream.getFormat().getContainer() == AudioFormat.CONTAINER_OGG) { mimeType = "audio/ogg"; } if (mimeType != null) { resp.setContentType(mimeType); } if (stream instanceof DiscreteAudioStream) { Integer size = ((DiscreteAudioStream) stream).size(); if (size != null) { resp.setContentLength(size); } } ServletOutputStream os = resp.getOutputStream(); IOUtils.copy(stream, os); resp.flushBuffer(); IOUtils.closeQuietly(stream); } }
Source:
<code>protected boolean validate() { boolean returnValue = true; Permission p = getPermissionDao().get(getParameters().getPermission().getId()); if (MultiLevelAdministrationHandler.isLastSuperUserPermission(p.getRoleId())) { getReturnValue().getValidationMessages() .add(EngineMessage.ERROR_CANNOT_REMOVE_LAST_SUPER_USER_ROLE.toString()); returnValue = false; } else if (p.getRoleType().equals(RoleType.ADMIN) && !isSystemSuperUser()) { addValidationMessage(EngineMessage.PERMISSION_REMOVE_FAILED_ONLY_SYSTEM_SUPER_USER_CAN_REMOVE_ADMIN_ROLES); returnValue = false; <START> } <END> if((getParameters().getUser() != null && !Objects.equals(p.getAdElementId(), getParameters().getUser().getId())) || (getParameters().getGroup() != null && !Objects.equals(p.getAdElementId(), getParameters().getGroup().getId()))) { addValidationMessage(EngineMessage.INHERITED_PERMISSION_CANT_BE_REMOVED); returnValue = false; } return returnValue; }</code><technical_language>I this operation, removing a permission, "user" "group" parameters. If a malicious user send a permission identifier user group match permission, force system do incorrect operation. If command need user group object retrieve database. condition is hard read. suggest some intermediate variables, meaningful names: DbUser user = getParameters().getUser(); DbGroup group = getParameters().getGroup(); boolean isInheritedUserPermission = user != null && !...; boolean isInheritedGroupPermission = group != null && ...; if (isInheritedUserPermission || isInheritedGroupPermission) { ... }</technical_language>

Target:
protected boolean validate() { boolean returnValue = true; Permission p = getPermissionDao().get(getParameters().getPermission().getId()); if (MultiLevelAdministrationHandler.isLastSuperUserPermission(p.getRoleId())) { getReturnValue().getValidationMessages() .add(EngineMessage.ERROR_CANNOT_REMOVE_LAST_SUPER_USER_ROLE.toString()); returnValue = false; } else if (p.getRoleType().equals(RoleType.ADMIN) && !isSystemSuperUser()) { addValidationMessage(EngineMessage.PERMISSION_REMOVE_FAILED_ONLY_SYSTEM_SUPER_USER_CAN_REMOVE_ADMIN_ROLES); returnValue = false; } if(getParameters().getTargetId() != null && !Objects.equals(p.getAdElementId(), getParameters().getTargetId())) { addValidationMessage(EngineMessage.INHERITED_PERMISSION_CANT_BE_REMOVED); returnValue = false; } return returnValue; }
Source:
<code>private C4BlobKey storeBytesInDatabase(C4BlobStore store) throws LiteCoreException, IOException { final InputStream contentStream = getContentStream(); if (contentStream == null) { throw new IllegalStateException( "No data available to write for install." + "Please ensure that all blobs in the document have non-null content."); } C4BlobWriteStream blobOut = null; try { blobOut = store.openWriteStream(); final byte[] buffer = new byte[MAX_CACHED_CONTENT_LENGTH]; this.blobLength = 0; int n; <START> while ((n = contentStream.read(buffer)) > 0) { <END> blobOut.write(buffer, n); this.blobLength += n; } blobOut.install(); return blobOut.computeBlobKey(); } finally { try { contentStream.close(); } catch (IOException ignore) { } if (blobOut != null) { blobOut.close(); } } }</code><technical_language>Java doc: total number of bytes read buffer, -1 if is more data end of stream reached. Is safer check for -1 >= 0</technical_language>

Target:
private C4BlobKey storeBytesInDatabase(C4BlobStore store) throws LiteCoreException, IOException { final InputStream contentStream = getContentStream(); if (contentStream == null) { throw new IllegalStateException( "No data available to write for install." + "Please ensure that all blobs in the document have non-null content."); } C4BlobWriteStream blobOut = null; try { blobOut = store.openWriteStream(); final byte[] buffer = new byte[MAX_CACHED_CONTENT_LENGTH]; this.blobLength = 0; int n; while ((n = contentStream.read(buffer)) >= 0) { blobOut.write(buffer, n); this.blobLength += n; } blobOut.install(); return blobOut.computeBlobKey(); } finally { try { contentStream.close(); } catch (IOException ignore) { } if (blobOut != null) { blobOut.close(); } } }
Source:
<code>public Mono<Response<Certificate>> mergeCertificateWithResponse(MergeCertificateOptions mergeCertificateConfig) { <START> Objects.requireNonNull(mergeCertificateConfig, "The merge certificate configuration cannot be null."); <END> return withContext(context -> mergeCertificateWithResponse(mergeCertificateConfig, context)); }</code><technical_language>suggestion Objects.requireNonNull(mergeCertificateConfig, "'mergeCertificateConfig' null.");</technical_language>

Target:
public Mono<Response<Certificate>> mergeCertificateWithResponse(MergeCertificateOptions mergeCertificateConfig) { Objects.requireNonNull(mergeCertificateConfig, "'mergeCertificateConfig' cannot be null."); return withContext(context -> mergeCertificateWithResponse(mergeCertificateConfig, context)); }
Source:
<code><START> public void setViewCache(ViewCache viewCache) { <END> this.viewCache = viewCache; }</code><technical_language>final</technical_language>

Target:
final void setViewCache(ViewCache viewCache) { this.viewCache = viewCache; }
Source:
<code>public void create(final String name) { try { <START> new JdkRequest(UriBuilder.fromUri(this.home).build()) <END> .header(HttpHeaders.ACCEPT, MediaType.APPLICATION_XML) .header(HttpHeaders.AUTHORIZATION, this.token) .method(Request.GET) .fetch() .as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK) .as(XmlResponse.class) .rel("/page/links/link[@rel='create']/@href") .header(HttpHeaders.ACCEPT, MediaType.APPLICATION_XML) .method(Request.POST) .body() .set( String.format( "name=%s", URLEncoder.encode(name, CharEncoding.UTF_8) ) ) .back() .fetch() .as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK); } catch (UnsupportedEncodingException ex) { throw new IllegalStateException(ex); } catch (IOException ex) { throw new IllegalStateException(ex); } }</code><technical_language>need UriBuilder</technical_language>

Target:
public void create(final String name) { try { new JdkRequest(this.home) .header(HttpHeaders.ACCEPT, MediaType.APPLICATION_XML) .header(HttpHeaders.AUTHORIZATION, this.token) .fetch() .as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK) .as(XmlResponse.class) .rel("/page/links/link[@rel='create']/@href") .header(HttpHeaders.ACCEPT, MediaType.APPLICATION_XML) .method(Request.POST) .body() .formParam("name", name) .back() .fetch() .as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK); } catch (UnsupportedEncodingException ex) { throw new IllegalStateException(ex); } catch (IOException ex) { throw new IllegalStateException(ex); } }
Source:
<code>public InputStream queryForStream(String query) { key(query); URI uri = uriBuilder.build(); HttpConnection get = Http.GET(uri); <START> get.getConnection().addRequestProperty("Accept", "application/json"); <END> return db.executeRequest(get); }</code><technical_language>I form get.requestProperties.put(...) is preferred</technical_language>

Target:
public InputStream queryForStream(String query) { key(query); URI uri = uriBuilder.build(); HttpConnection get = Http.GET(uri); get.requestProperties.put("Accept", "application/json"); return db.executeRequest(get); }
Source:
<code>private void performHostVerification(InetAddress inetAddress, X509Certificate certificate) throws CertificateException { try { <START> hostnameVerifier.verify(inetAddress.getHostAddress(), certificate); <END> } catch (SSLException addressVerificationException) { try { LOG.debug("Failed to verify host address, attempting to verify host name with reverse dns lookup", addressVerificationException); hostnameVerifier.verify(inetAddress.getHostName(), certificate); } catch (SSLException hostnameVerificationException) { LOG.error("Failed to verify host address", addressVerificationException); LOG.error("Failed to verify hostname", hostnameVerificationException); throw new CertificateException("Failed to verify both host address and host name", hostnameVerificationException); } } }</code><technical_language>IIUC, this verifies host name matches stored in certificates, right? If so, do verify subject is a valid peer intended connect to, random server a valid cert? is this care of other parts of code? For reference, in ZOOKEEPER-1045 for similar verification is comparing name of server name retrieved Kerberos principal. name of server is retrieved zoo.cfg of this require if users want this verification need encode server FQDN in zoo.cfg IP address. do similar here</technical_language>

Target:
private void performHostVerification(InetAddress inetAddress, X509Certificate certificate) throws CertificateException { String hostAddress = ""; String hostName = ""; try { hostAddress = inetAddress.getHostAddress(); hostnameVerifier.verify(hostAddress, certificate); } catch (SSLException addressVerificationException) { try { LOG.debug("Failed to verify host address: attempting to verify host name with reverse dns lookup", hostAddress, addressVerificationException); hostName = inetAddress.getHostName(); hostnameVerifier.verify(hostName, certificate); } catch (SSLException hostnameVerificationException) { LOG.error("Failed to verify host address: {}", hostAddress, addressVerificationException); LOG.error("Failed to verify hostname: {}", hostName, hostnameVerificationException); throw new CertificateException("Failed to verify both host address and host name", hostnameVerificationException); } } }
Source:
<code>public boolean equals(Object o) { <START> if (EqualityUtils.isSameReference(this, o)) { return true; } if (EqualityUtils.isNullOrNotSameClass(this, o)) { return false; } LineageEntry that = (LineageEntry) o; return EqualityUtils.isEqual(_segmentsFrom, that._segmentsFrom) && EqualityUtils.isEqual(_segmentsTo, that._segmentsTo) && EqualityUtils.isEqual(_state, that._state) && EqualityUtils.isEqual(_timestamp, that._timestamp); <END> }</code><technical_language>(nit) Replace IDE auto-generated code (use Objects.equals()) suggestion if (this == o) { return true; } if (!(o instanceof LineageEntry)) { return false; } LineageEntry = (LineageEntry) o; return Objects.equals(_segmentsFrom, that._segmentsFrom) && Objects.equals(_segmentsTo, that._segmentsTo) && _state == that._state && _timestamp == that._timestamp;</technical_language>

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } LineageEntry that = (LineageEntry) o; return _timestamp == that._timestamp && _segmentsFrom.equals(that._segmentsFrom) && _segmentsTo.equals( that._segmentsTo) && _state == that._state; }
Source:
<code>public static int getBlobPropertiesSerDeSize(BlobProperties properties) { return Version_Field_Size_In_Bytes + TTL_Field_Size_In_Bytes + Private_Field_Size_In_Bytes + CreationTime_Field_Size_In_Bytes + BlobSize_Field_Size_In_Bytes + Variable_Field_Size_In_Bytes + Utils.getNullableStringLength(properties.getContentType()) + Variable_Field_Size_In_Bytes + Utils.getNullableStringLength(properties.getOwnerId()) + Variable_Field_Size_In_Bytes <START> + Utils.getNullableStringLength(properties.getServiceId()) + Short.BYTES + Short.BYTES; <END> }</code><technical_language>confused, BP include flag dcId</technical_language>

Target:
public static int getBlobPropertiesSerDeSize(BlobProperties properties) { return VERSION_FIELD_SIZE_IN_BYTES + TTL_FIELD_SIZE_IN_BYTES + PRIVATE_FIELD_SIZE_IN_BYTES + CREATION_TIME_FIELD_SIZE_IN_BYTES + BLOB_SIZE_FIELD_SIZE_IN_BYTES + Utils.getIntStringLength( properties.getContentType()) + Utils.getIntStringLength(properties.getOwnerId()) + Utils.getIntStringLength( properties.getServiceId()) + Short.BYTES + Short.BYTES; }
Source:
<code>public <T> T retryWithHandle(final HandleCallback<T> callback) { final Callable<T> call = new Callable<T>() { @Override public T call() throws Exception { return getDBI().withHandle(callback); } }; <START> final Predicate<Throwable> shouldRetry = new Predicate<Throwable>() <END> { @Override public boolean apply(Throwable e) { return isTransientException(e); } }; final int maxTries = 10; try { return RetryUtils.retry(call, shouldRetry, maxTries); } catch (Exception e) { throw Throwables.propagate(e); } }</code><technical_language>this class field</technical_language>

Target:
public <T> T retryWithHandle(final HandleCallback<T> callback) { final Callable<T> call = new Callable<T>() { @Override public T call() throws Exception { return getDBI().withHandle(callback); } }; final int maxTries = 10; try { return RetryUtils.retry(call, shouldRetry, maxTries); } catch (Exception e) { throw Throwables.propagate(e); } }
Source:
<code>public ExecutionResult executeInVR(final String routerIP, final String script, final String args, final Duration timeout) { Pair<Boolean, String> result; if (s_logger.isDebugEnabled()) { s_logger.debug("Run command on VR: " + routerIP + ", script: " + script + " with args: " + args); } try { result = SshHelper.sshExecute(routerIP, DEFAULT_DOMR_SSHPORT, "root", getSystemVMKeyFile(), null, "/opt/cloud/bin/" + script + " " + args, <START> 60000, 60000, (int)timeout.getMillis()); <END> } catch (final Exception e) { final String msg = "Command failed due to " + e ; s_logger.error(msg); result = new Pair<Boolean, String>(false, msg); } if (s_logger.isDebugEnabled()) { s_logger.debug(script + " execution result: " + result.first().toString()); } return new ExecutionResult(result.first(), result.second()); }</code><technical_language>Please consider defining override of SshHelper.sshExecute method accepts a Duration in order encapsulate this conversion. consider deprecating version accepts int</technical_language>

Target:
public ExecutionResult executeInVR(final String routerIP, final String script, final String args, final Duration timeout) { Pair<Boolean, String> result; if (s_logger.isDebugEnabled()) { s_logger.debug("Run command on VR: " + routerIP + ", script: " + script + " with args: " + args); } try { result = SshHelper.sshExecute(routerIP, DEFAULT_DOMR_SSHPORT, "root", getSystemVMKeyFile(), null, "/opt/cloud/bin/" + script + " " + args, VRScripts.CONNECTION_TIMEOUT, VRScripts.CONNECTION_TIMEOUT, timeout); } catch (final Exception e) { final String msg = "Command failed due to " + e ; s_logger.error(msg); result = new Pair<Boolean, String>(false, msg); } if (s_logger.isDebugEnabled()) { s_logger.debug(script + " execution result: " + result.first().toString()); } return new ExecutionResult(result.first(), result.second()); }
Source:
<code>public void shouldFindUserByUsernameUsingOptionalSearchParameterForMockedHandler() throws Exception { SimpleObject response = deserialize(handle(newGetRequest(getURI(), new Parameter("username", "bruno")))); List<Object> results = Util.getResultsList(response); Object next = results.iterator().next(); assertEquals(1, results.size()); assertEquals(MOCKED_USER_NAME_FOR_OPTIONAL_PARAM, PropertyUtils.getProperty(next, "display")); <START> } <END></code><technical_language>Some ideas for tests: Define handlers: 1) required username:admin, optional preferredLocales 2) required systemId, optional username:bruno 3) optional username:bruno 1. Match 1) for query "?username=admin&preferredLocales=en" 2. Match 2) for query "?systemId=bruno" 3. Match 2) for query "?systemId=bruno&username=bruno" 4. Match 3) for query "?username=bruno" 5. Do match 1) for "?username=bruno&preferredLocales=en" 6. Do match 3) for "?username=james" 7. Do match 2) for "?username=james&systemId=bruno"</technical_language>

Target:
public void shouldFindUserByUsernameUsingOptionalSearchParameterForMockedHandler() throws Exception { SimpleObject response = deserialize(handle(newGetRequest(getURI(), new Parameter("username", "bruno")))); List<Object> results = Util.getResultsList(response); Object next = results.iterator().next(); assertEquals(1, results.size()); assertEquals(MOCKED_USER_NAME_FOR_THRID_COMPONENT, PropertyUtils.getProperty(next, "display")); }
Source:
<code>protected Dialog onCreateDialog(int id, Bundle bundle) { if (id == R.id.dialog_cancel_confirmation) { final String message; if (mType == VCardService.TYPE_IMPORT) { message = getString(R.string.cancel_import_confirmation_message, mDisplayName); } else { message = getString(R.string.cancel_export_confirmation_message, mDisplayName); } final AlertDialog.Builder builder = new AlertDialog.Builder(this) .setMessage(message) <START> .setPositiveButton(android.R.string.yes, new <END> RequestCancelListener()) .setOnCancelListener(mCancelListener) .setNegativeButton(android.R.string.no, mCancelListener); return builder.create(); } else if (id == R.id.dialog_cancel_failed) { final AlertDialog.Builder builder = new AlertDialog.Builder(this) .setTitle(R.string.cancel_vcard_import_or_export_failed) .setIconAttribute(android.R.attr.alertDialogIcon) .setMessage(getString(R.string.fail_reason_unknown)) .setOnCancelListener(mCancelListener) .setPositiveButton(android.R.string.ok, mCancelListener); return builder.create(); } else { Log.w(LOG_TAG, "Unknown dialog id: " + id); return super.onCreateDialog(id, bundle); } }</code><technical_language>sorry, ok cancel. need add string resource</technical_language>

Target:
protected Dialog onCreateDialog(int id, Bundle bundle) { if (id == R.id.dialog_cancel_confirmation) { final String message; if (mType == VCardService.TYPE_IMPORT) { message = getString(R.string.cancel_import_confirmation_message, mDisplayName); } else { message = getString(R.string.cancel_export_confirmation_message, mDisplayName); } final AlertDialog.Builder builder = new AlertDialog.Builder(this) .setMessage(message) .setPositiveButton(R.string.stop_import_export_dialog_yes_txt, new RequestCancelListener()) .setOnCancelListener(mCancelListener) .setNegativeButton(R.string.stop_import_export_dialog_no_txt, mCancelListener); return builder.create(); } else if (id == R.id.dialog_cancel_failed) { final AlertDialog.Builder builder = new AlertDialog.Builder(this) .setTitle(R.string.cancel_vcard_import_or_export_failed) .setIconAttribute(android.R.attr.alertDialogIcon) .setMessage(getString(R.string.fail_reason_unknown)) .setOnCancelListener(mCancelListener) .setPositiveButton(android.R.string.ok, mCancelListener); return builder.create(); } else { Log.w(LOG_TAG, "Unknown dialog id: " + id); return super.onCreateDialog(id, bundle); } }
Source:
<code>public Condition updateFHIRCondition(Condition condition, String theId)throws NotImplementedException { <START> return null; <END> }</code><technical_language>I throwing NotImplementedException instead of returning null</technical_language>

Target:
public Condition updateFHIRCondition(Condition condition, String theId) { throw new NotImplementedException(); }
Source:
<code><START> public void confirmNoKnownAllergies() throws RuntimeException { <END> if (!allergies.isEmpty()) { throw new APIException("Cannot confirm no known allergies if allergy list is not empty"); } allergyStatus = NO_KNOWN_ALLERGIES; }</code><technical_language>@manuelkollus this is required? me, quiet superfluous add a throws clause of a RuntimeException a matter of fact unchecked Exception</technical_language>

Target:
public void confirmNoKnownAllergies() throws APIException { if (!allergies.isEmpty()) { throw new APIException("Cannot confirm no known allergies if allergy list is not empty"); } allergyStatus = NO_KNOWN_ALLERGIES; }
Source:
<code>private void addChannelFromString(Collection<MessageChannel> channels, String channelKey, Message<?> message) { if (channelKey.indexOf(',') != -1) { for (String name : StringUtils.tokenizeToStringArray(channelKey, ",")) { addChannelFromString(channels, name, message); } return; } String channelName = channelKey; boolean mapped = false; if (this.channelMappings.containsKey(channelKey)) { channelName = this.channelMappings.get(channelKey); mapped = true; } if (this.prefix != null) { channelName = this.prefix + channelName; } if (this.suffix != null) { channelName = channelName + this.suffix; } MessageChannel channel = resolveChannelForName(channelName, message); if (channel != null) { channels.add(channel); if (!mapped && !this.dynamicChannels.contains(channelName)) { <START> this.dynamicChannels.add(channelName); <END> } } }</code><technical_language>I if this logic kinda cache some simple eviction policy in face of expiration time. general point route some channel once, stands in List forever</technical_language>

Target:
private void addChannelFromString(Collection<MessageChannel> channels, String channelKey, Message<?> message) { if (channelKey.indexOf(',') != -1) { for (String name : StringUtils.tokenizeToStringArray(channelKey, ",")) { addChannelFromString(channels, name, message); } return; } String channelName = channelKey; boolean mapped = false; if (this.channelMappings.containsKey(channelKey)) { channelName = this.channelMappings.get(channelKey); mapped = true; } if (this.prefix != null) { channelName = this.prefix + channelName; } if (this.suffix != null) { channelName = channelName + this.suffix; } MessageChannel channel = resolveChannelForName(channelName, message); if (channel != null) { channels.add(channel); if (!mapped && !(this.dynamicChannels.get(channelName) != null)) { this.dynamicChannels.put(channelName, channel); } } }
Source:
<code>private void verifyNoHeaderJunk(TaskListener listener) throws IOException, InterruptedException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); connection.exec("true",baos); final String s; try { s = baos.toString(Charset.defaultCharset().name()); } catch (UnsupportedEncodingException ex) { <START> throw new IOException("Default encoding is unsupported"); <END> } if (s.length()!=0) { listener.getLogger().println(Messages.SSHLauncher_SSHHeeaderJunkDetected()); listener.getLogger().println(s); throw new AbortException(); } }</code><technical_language>, ex</technical_language>

Target:
private void verifyNoHeaderJunk(TaskListener listener) throws IOException, InterruptedException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); connection.exec("true",baos); final String s; try { s = baos.toString(Charset.defaultCharset().name()); } catch (UnsupportedEncodingException ex) { throw new IOException("Default encoding is unsupported", ex); } if (s.length()!=0) { listener.getLogger().println(Messages.SSHLauncher_SSHHeeaderJunkDetected()); listener.getLogger().println(s); throw new AbortException(); } }
Source:
<code>private void initOSType() { List<Integer> list = AsyncDataProvider.getAllVMsOsIds(); <START> Collections.sort(list); <END> getOSType().setItems(list); getOSType().setSelectedItem(OsRepository.DEFAULT_OS); }</code><technical_language>I provide a Comparator sort names of OS IDs</technical_language>

Target:
private void initOSType() { List<Integer> list = AsyncDataProvider.getOsIds(); Collections.sort(list); getOSType().setItems(list); getOSType().setSelectedItem(OsRepository.DEFAULT_OS); }