auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected boolean performImageVdsmOperation() { return <START> TransactionSupport.executeInNewTransaction(() <END> -> { VDSReturnValue vdsReturnValue = null; try { Guid storagePoolId = getDiskImage().getStoragePoolId() != null ? getDiskImage().getStoragePoolId() : Guid.Empty; Guid storageDomainId = getDiskImage().getStorageIds() != null && !getDiskImage().getStorageIds().isEmpty() ? getDiskImage().getStorageIds() .get(0) : Guid.Empty; Guid imageGroupId = getDiskImage().getId() != null ? getDiskImage().getId() : Guid.Empty; Guid taskId = persistAsyncTaskPlaceHolder(ActionType.RestoreAllSnapshots); vdsReturnValue = runVdsCommand(VDSCommandType.DestroyImage, postDeleteActionHandler.fixParameters( new DestroyImageVDSCommandParameters(storagePoolId, storageDomainId, imageGroupId, _imagesToDelete, getDiskImage().isWipeAfterDelete(), storageDomainDao.get(storageDomainId).getDiscardAfterDelete(), true))); if (vdsReturnValue.getSucceeded()) { getReturnValue().getInternalVdsmTaskIdList().add( createTask(taskId, vdsReturnValue.getCreationInfo(), ActionType.RestoreAllSnapshots, VdcObjectType.Storage, storageDomainId)); } } catch (EngineException e) { getReturnValue().setFault(new EngineFault(e, e.getVdsError().getCode())); log.info("Image '{}' not exist in Irs", getDiskImage().getImageId()); } return vdsReturnValue != null ? vdsReturnValue.getSucceeded() : false; }); }</code><technical_language>is a vdsm call this block, if takes longer minutes timeout DestroyImageCommand, write database marking NonTransactive enough prevent issues for other flows live/cold merge</technical_language>

Target:
protected boolean performImageVdsmOperation() { VDSReturnValue vdsReturnValue = null; try { Guid storagePoolId = getDiskImage().getStoragePoolId() != null ? getDiskImage().getStoragePoolId() : Guid.Empty; Guid storageDomainId = getDiskImage().getStorageIds() != null && !getDiskImage().getStorageIds().isEmpty() ? getDiskImage().getStorageIds() .get(0) : Guid.Empty; Guid imageGroupId = getDiskImage().getId() != null ? getDiskImage().getId() : Guid.Empty; Guid taskId = persistAsyncTaskPlaceHolder(ActionType.RestoreAllSnapshots); vdsReturnValue = TransactionSupport.executeInScope(TransactionScopeOption.Suppress, () -> runVdsCommand(VDSCommandType.DestroyImage, postDeleteActionHandler.fixParameters(new DestroyImageVDSCommandParameters( storagePoolId, storageDomainId, imageGroupId, _imagesToDelete, getDiskImage().isWipeAfterDelete(), storageDomainDao.get(storageDomainId).getDiscardAfterDelete(), true))) ); if (vdsReturnValue.getSucceeded()) { getReturnValue().getInternalVdsmTaskIdList().add( createTask(taskId, vdsReturnValue.getCreationInfo(), ActionType.RestoreAllSnapshots, VdcObjectType.Storage, storageDomainId)); } } catch (EngineException e) { getReturnValue().setFault(new EngineFault(e, e.getVdsError().getCode())); log.info("Image '{}' not exist in Irs", getDiskImage().getImageId()); } return vdsReturnValue != null ? vdsReturnValue.getSucceeded() : false; }
Source:
<code>public List<String> list(@QueryParam("namePattern") final String namePattern, @QueryParam("selector") final List<String> hostSelectors) { List<String> hosts = model.listHosts(); if (namePattern != null) { final Predicate<String> matchesPattern = Pattern.compile(namePattern).asPredicate(); hosts = hosts.stream() .filter(matchesPattern) .collect(Collectors.toList()); } if (!hostSelectors.isEmpty()) { final List<HostSelector> selectors = hostSelectors.stream() .map(selectorStr -> { final HostSelector parsed = HostSelector.parse(selectorStr); if (parsed == null) { throw new WebApplicationException( Response.status(Response.Status.BAD_REQUEST) .entity("Invalid host selector: " + selectorStr) .build() ); } return parsed; }) .collect(Collectors.toList()); final Function<String, Map<String, String>> getLabels = host -> { final HostStatus hostStatus = model.getHostStatus(host); <START> return hostStatus == null ? emptyMap() : hostStatus.getLabels(); <END> }; final Map<String, Map<String, String>> hostsAndLabels = hosts.stream() .collect(Collectors.toMap(Function.identity(), getLabels)); final HostMatcher matcher = new HostMatcher(hostsAndLabels); hosts = matcher.getMatchingHosts(selectors); } return hosts; }</code><technical_language>easier if model.getHostStatus(host) returned Optional<String> instead? place calls method perform null check, nice address type system</technical_language>

Target:
public List<String> list(@QueryParam("namePattern") final String namePattern, @QueryParam("selector") final List<String> hostSelectors) { List<String> hosts = model.listHosts(); if (namePattern != null) { final Predicate<String> matchesPattern = Pattern.compile(namePattern).asPredicate(); hosts = hosts.stream() .filter(matchesPattern) .collect(Collectors.toList()); } if (!hostSelectors.isEmpty()) { final List<HostSelector> selectors = hostSelectors.stream() .map(selectorStr -> { final HostSelector parsed = HostSelector.parse(selectorStr); if (parsed == null) { throw new WebApplicationException( Response.status(Response.Status.BAD_REQUEST) .entity("Invalid host selector: " + selectorStr) .build() ); } return parsed; }) .collect(Collectors.toList()); final Map<String, Map<String, String>> hostsAndLabels = getLabels(hosts); final HostMatcher matcher = new HostMatcher(hostsAndLabels); hosts = matcher.getMatchingHosts(selectors); } return hosts; }
Source:
<code>public BundleDTO install(String location, byte[] data) throws Exception { <START> if (data == null) { <END> return null; } Bundle installedBundle = null; try (InputStream stream = new ByteArrayInputStream(data)) { installedBundle = context.getBundle(location); if (installedBundle == null) { installedBundle = context.installBundle(location, stream); } else { installedBundle.update(stream); refresh(true); } } return toDTO(installedBundle); }</code><technical_language>data null</technical_language>

Target:
public BundleDTO install(String location, byte[] data) throws Exception { Bundle installedBundle = null; try (InputStream stream = new ByteArrayInputStream(data)) { installedBundle = context.getBundle(location); if (installedBundle == null) { installedBundle = context.installBundle(location, stream); } else { installedBundle.update(stream); refresh(true); } } return toDTO(installedBundle); }
Source:
<code>private void dumpPortToFile() { <START> String filename = props.getString(AZKABAN_EXECUTOR_PORT_FILE, "executor.port"); <END> try (BufferedWriter writer = new BufferedWriter(new FileWriter(filename))) { writer.write(String.valueOf(getPort())); writer.write("\n"); } catch (IOException e) { logger.error(e); } }</code><technical_language>Is necessary port file name configurable</technical_language>

Target:
private void dumpPortToFile() { try (BufferedWriter writer = new BufferedWriter(new FileWriter(AZKABAN_EXECUTOR_PORT_FILENAME))) { writer.write(String.valueOf(getPort())); writer.write("\n"); } catch (IOException e) { logger.error(e); Throwables.propagate(e); } }
Source:
<code>public void checkAttributeValue(PerunSessionImpl sess, Facility facility, User user, Attribute attribute) throws WrongAttributeValueException, WrongReferenceAttributeValueException, InternalErrorException, WrongAttributeAssignmentException { if(attribute.getValue() == null) throw new WrongAttributeValueException(attribute, "Login can't be null"); try { Attribute loginNamespaceAttribute = sess.getPerunBl().getAttributesManagerBl().getAttribute(sess, facility, AttributesManager.NS_FACILITY_ATTR_DEF + ":login-namespace"); Attribute loginAttribute = null; if (loginNamespaceAttribute.getValue() != null) { loginAttribute = sess.getPerunBl().getAttributesManagerBl().getAttribute(sess, user, AttributesManager.NS_USER_ATTR_DEF + ":login-namespace:" + (String) loginNamespaceAttribute.getValue()); loginAttribute.setValue(attribute.getValue()); sess.getPerunBl().getAttributesManagerBl().checkAttributeValue(sess, user, loginAttribute); } else { <START> throw new WrongReferenceAttributeValueException(attribute, loginNamespaceAttribute, user, facility, "Badly selected login or namespace is not filled"); <END> } } catch (AttributeNotExistsException e) { throw new ConsistencyErrorException(e); } }</code><technical_language>I problem understanding text of exception. "Facility need nonempty login-namespace attribute." that. (the in other exception below)</technical_language>

Target:
public void checkAttributeValue(PerunSessionImpl sess, Facility facility, User user, Attribute attribute) throws WrongAttributeValueException, WrongReferenceAttributeValueException, InternalErrorException, WrongAttributeAssignmentException { if(attribute.getValue() == null) throw new WrongAttributeValueException(attribute, "Login can't be null"); try { Attribute loginNamespaceAttribute = sess.getPerunBl().getAttributesManagerBl().getAttribute(sess, facility, AttributesManager.NS_FACILITY_ATTR_DEF + ":login-namespace"); Attribute loginAttribute = null; if (loginNamespaceAttribute.getValue() != null) { loginAttribute = sess.getPerunBl().getAttributesManagerBl().getAttribute(sess, user, AttributesManager.NS_USER_ATTR_DEF + ":login-namespace:" + (String) loginNamespaceAttribute.getValue()); loginAttribute.setValue(attribute.getValue()); sess.getPerunBl().getAttributesManagerBl().checkAttributeValue(sess, user, loginAttribute); } else { throw new WrongReferenceAttributeValueException(attribute, loginNamespaceAttribute, user, facility, "Facility need to have nonempty login-namespace attribute."); } } catch (AttributeNotExistsException e) { throw new ConsistencyErrorException(e); } }
Source:
<code>public int onStartCommand(Intent intent, int flags, int startId) { AppLog.i(T.UTILS, "installation referrer service > task: " + startId + " started"); <START> mInstallationReferrerServiceLogic.performTask(intent.getExtras(), Integer.valueOf(startId)); <END> return START_NOT_STICKY; }</code><technical_language>I need Integer.valueOf() boxing startId is int</technical_language>

Target:
public int onStartCommand(Intent intent, int flags, int startId) { AppLog.i(T.UTILS, "installation referrer service > task: " + startId + " started"); mInstallationReferrerServiceLogic.performTask(intent.getExtras(), startId); return START_NOT_STICKY; }
Source:
<code>public Api getConnection() throws UnsecuredConnectionAttemptError, ServerException, IOException { <START> if (api == null) { <END> String url = String.format("%s://%s:%s/ovirt-engine/api", protocol, server, port); log.debug(String.format("Logging to %s as %s", url, username)); api = new Api(url, username, password, true); } return api; }</code><technical_language>I guess need thread safety here. simpler eagerly set api? OvirtClient a singleton. a @Singleton</technical_language>

Target:
public synchronized Api getConnection() throws UnsecuredConnectionAttemptError, ServerException, IOException { if (api == null) { String url = String.format("%s://%s:%s/ovirt-engine/api", protocol, server, port); log.debug(String.format("Logging to %s as %s", url, username)); api = new Api(url, username, password, true); } return api; }
Source:
<code><START> public String buildQueryParams(boolean redactPii) { <END> StringBuilder builder = new StringBuilder(); if (transactionType != null) { builder.append("&transaction_type=").append(transactionType.getValue()); } if (isNotBlank(reference)) builder.append("&reference=").append(reference); if (email != null) { if (redactPii) builder.append("&email=*****"); else builder.append("&email=").append(email); } if (fromDate != null) builder.append("&from_date=").append(fromDate); if (toDate != null) builder.append("&to_date=").append(toDate); if (page != null) builder.append("&page=").append(page); if (displaySize != null) builder.append("&display_size=").append(displaySize); getExternalStates().stream() .findFirst() .ifPresent(state -> builder.append("&state=").append(state)); String paymentStates = this.externalChargeStates.stream() .collect(Collectors.joining(",")); String refundStates = this.externalRefundStates.stream() .collect(Collectors.joining(",")); if (isNotEmpty(paymentStates)) { builder.append("&payment_states=").append(paymentStates); } if (isNotEmpty(refundStates)) { builder.append("&refund_states=").append(refundStates); } if (!cardBrands.isEmpty()) { cardBrands.forEach(cardBrand -> builder.append("&card_brand=").append(cardBrand)); } return builder.toString().replaceFirst("&", ""); }</code><technical_language>This private (as want people call public methods)</technical_language>

Target:
private String buildQueryParams(boolean redactPii) { StringBuilder builder = new StringBuilder(); if (transactionType != null) { builder.append("&transaction_type=").append(transactionType.getValue()); } if (isNotBlank(reference)) builder.append("&reference=").append(reference); if (email != null) { if (redactPii) { builder.append("&email=*****"); } else { builder.append("&email=").append(email); } } if (fromDate != null) builder.append("&from_date=").append(fromDate); if (toDate != null) builder.append("&to_date=").append(toDate); if (page != null) builder.append("&page=").append(page); if (displaySize != null) builder.append("&display_size=").append(displaySize); getExternalStates().stream() .findFirst() .ifPresent(state -> builder.append("&state=").append(state)); String paymentStates = this.externalChargeStates.stream() .collect(Collectors.joining(",")); String refundStates = this.externalRefundStates.stream() .collect(Collectors.joining(",")); if (isNotEmpty(paymentStates)) { builder.append("&payment_states=").append(paymentStates); } if (isNotEmpty(refundStates)) { builder.append("&refund_states=").append(refundStates); } if (!cardBrands.isEmpty()) { cardBrands.forEach(cardBrand -> builder.append("&card_brand=").append(cardBrand)); } return builder.toString().replaceFirst("&", ""); }
Source:
<code>public void bindToCommit(CommitMetadata commitMetadata) { <START> argumentIsNotNull(commitMetadata); <END> this.commitMetadata = Optional.of(commitMetadata); }</code><technical_language>if (commitMetadata != null) { throw new IllegalStateException("Change efectively immutable") }</technical_language>

Target:
public void bindToCommit(CommitMetadata commitMetadata) { argumentIsNotNull(commitMetadata); if (this.commitMetadata.isPresent()) { throw new IllegalStateException("Change should be efectively immutable"); } this.commitMetadata = Optional.of(commitMetadata); }
Source:
<code>public Worker(MetricServiceAppConfiguration config, String id, String startTime, String endTime, Boolean exactTimeWindow, Boolean series, String downsample, Map<String, String> tags, List<MetricSpecification> queries) { if (queries == null) { <START> RuntimeException t = new RuntimeException("WHAT???"); <END> t.printStackTrace(); throw t; } this.id = id; this.startTime = startTime; this.endTime = endTime; this.exactTimeWindow = exactTimeWindow; this.series = series; this.tags = tags; this.downsample = downsample; this.queries = queries; }</code><technical_language>a exception message is needed :)</technical_language>

Target:
public Worker(MetricServiceAppConfiguration config, String id, String startTime, String endTime, Boolean exactTimeWindow, Boolean series, String downsample, Map<String, String> tags, List<MetricSpecification> queries) { if (queries == null) { log.error("Attempt to create query worker without any queries specified"); IllegalArgumentException t = new IllegalArgumentException( "No queries specified"); throw t; } this.id = id; this.startTime = startTime; this.endTime = endTime; this.exactTimeWindow = exactTimeWindow; this.series = series; this.tags = tags; this.downsample = downsample; this.queries = queries; }
Source:
<code>public List<ProjectProblem> getProblems() { <START> return null; <END> }</code><technical_language>return actual list of problems? reference.getProblems() WDYT</technical_language>

Target:
public List<ProjectProblem> getProblems() { return problems; }
Source:
<code>public void runCommand(Player player, List<String> arguments) { PlayerAuth auth = playerCache.getAuth(player.getName()); if (auth != null && !Utils.isEmailEmpty(auth.getEmail())) { <START> commonService.send(player, MessageKey.EMAIL_SHOW, emailMask(auth.getEmail())); <END> } else { commonService.send(player, MessageKey.SHOW_NO_EMAIL); } }</code><technical_language>good configurable email masked. a for willing bet create issue for in future</technical_language>

Target:
public void runCommand(Player player, List<String> arguments) { PlayerAuth auth = playerCache.getAuth(player.getName()); if (auth != null && !Utils.isEmailEmpty(auth.getEmail())) { if(commonService.getProperty(SecuritySettings.USE_EMAIL_MASKING)){ commonService.send(player, MessageKey.EMAIL_SHOW, emailMask(auth.getEmail())); } else { commonService.send(player, MessageKey.EMAIL_SHOW, auth.getEmail()); } } else { commonService.send(player, MessageKey.SHOW_NO_EMAIL); } }
Source:
<code>public void checkStateChanged(CheckStateChangedEvent event) { if (fChartViewer != null) { <START> Collection<ITmfTreeViewerEntry> checkedViewerEntries = getCheckedViewerEntries(); <END> int size = Iterables.size(Iterables.filter(checkedViewerEntries, TmfGenericTreeEntry.class)); IPreferenceStore corePreferenceStore = Activator.getDefault().getCorePreferenceStore(); String hide = corePreferenceStore.getString(ITmfUIPreferences.HIDE_MANY_ENTRIES_SELECTED_TOGGLE); if (size > 20 && !MessageDialogWithToggle.ALWAYS.equals(hide)) { MessageDialogWithToggle.openWarning(getControl().getShell(), Messages.AbstractSelectTreeViewer_ManyEntriesSelectedTitle, String.format(Messages.AbstractSelectTreeViewer_ManyEntriesSelectedMessage, size), Messages.AbstractSelectTreeViewer_ManyEntriesSelectedDontShowAgain, false, corePreferenceStore, ITmfUIPreferences.HIDE_MANY_ENTRIES_SELECTED_TOGGLE); } fChartViewer.handleCheckStateChangedEvent(checkedViewerEntries); refresh(); } }</code><technical_language>In practice, this check state listener receive event. previous listener difficulty handling large selection freeze UI thread for a long time. user died warning dialog. find a prompt user elements checked. user able cancel selection</technical_language>

Target:
public void checkStateChanged(CheckStateChangedEvent event) { if (fChartViewer != null) { fChartViewer.handleCheckStateChangedEvent(getCheckedViewerEntries()); refresh(); } }
Source:
<code>private int interpolateArgumentIndexToParameterIndex(List<HaxeExpression> arguments, HaxeParameterDescription[] parameters, int currentArgumentIndex) { int argumentIndex = 0; int recoverParameterIndex = 0; if (arguments == null || arguments.size() == 0) return argumentIndex; final int parameterCount = parameters.length; final int argumentsCount = arguments.size(); for (int parameterIndex = 0; parameterIndex < parameterCount; parameterIndex++) { if (argumentIndex >= argumentsCount) return parameterIndex; final HaxeParameterDescription parameter = parameters[parameterIndex]; if (!parameters[parameterIndex].isPredefined()) { if (argumentIndex == currentArgumentIndex) return parameterIndex; recoverParameterIndex = parameterIndex + 1; argumentIndex++; continue; } final HaxeExpression argument = arguments.get(argumentIndex); final ResultHolder parameterType = parameter.getResultHolder(); <START> final ResultHolder argumentType = HaxeTypeResolver.getPsiElementType(argument, new HaxeGenericResolver()); <END> if (parameterType.canAssign(argumentType)) { if (argumentIndex == currentArgumentIndex) return parameterIndex; recoverParameterIndex = parameterIndex + 1; argumentIndex++; } } return recoverParameterIndex; }</code><technical_language>current method class</technical_language>

Target:
private int interpolateArgumentIndexToParameterIndex(List<HaxeExpression> arguments, HaxeParameterDescription[] parameters, int currentArgumentIndex) { int argumentIndex = 0; int recoverParameterIndex = 0; if (arguments == null || arguments.size() == 0) return argumentIndex; final int parameterCount = parameters.length; final int argumentsCount = arguments.size(); for (int parameterIndex = 0; parameterIndex < parameterCount; parameterIndex++) { if (argumentIndex >= argumentsCount) return parameterIndex; final HaxeParameterDescription parameter = parameters[parameterIndex]; if (!parameters[parameterIndex].isPredefined()) { if (argumentIndex == currentArgumentIndex) return parameterIndex; recoverParameterIndex = parameterIndex + 1; argumentIndex++; continue; } final HaxeExpression argument = arguments.get(argumentIndex); final ResultHolder parameterType = parameter.getResultHolder(); final ResultHolder argumentType = HaxeTypeResolver.getPsiElementType(argument, HaxeGenericResolverUtil.generateResolverFromScopeParents(argument)); if (parameterType.canAssign(argumentType)) { if (argumentIndex == currentArgumentIndex) return parameterIndex; recoverParameterIndex = parameterIndex + 1; argumentIndex++; } } return recoverParameterIndex; }
Source:
<code>public ChandraFlamesCatalyst(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{4}{R}{R}"); this.addSuperType(SuperType.LEGENDARY); this.subtype.add(SubType.CHANDRA); this.addAbility(new PlaneswalkerEntersWithLoyaltyCountersAbility(5)); this.addAbility(new LoyaltyAbility(new DamagePlayersEffect(3, TargetController.OPPONENT), 1)); <START> CastCardFromGraveyardEffect minusEffect = new CastCardFromGraveyardEffect(); <END> minusEffect.setText("You may cast target red instant or sorcery card from your graveyard. If that spell would be put into your graveyard this turn, exile it instead."); Ability ability = new LoyaltyAbility(minusEffect, -2); ability.addTarget(new TargetCardInYourGraveyard(filter)); this.addAbility(ability); Effect discardHandEffect = new DiscardHandControllerEffect(); Effect drawEffect = new DrawCardSourceControllerEffect(7); drawEffect.setText(", then draw seven cards"); Effect castSpellsFromHandEffect = new CastFromHandWithoutPayingManaCostEffect( StaticFilters.FILTER_CARD_NON_LAND, true, Duration.EndOfTurn); castSpellsFromHandEffect.setText("Until end of turn, you may cast spells from your hand without paying their mana costs."); Ability ultimateAbility = new LoyaltyAbility(discardHandEffect, -8); ultimateAbility.addEffect(drawEffect); ultimateAbility.addEffect(castSpellsFromHandEffect); this.addAbility(ultimateAbility); }</code><technical_language>full names -- cast graveyard exile (or add param enable/disable exile -- add "hidden" effects class)</technical_language>

Target:
public ChandraFlamesCatalyst(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{4}{R}{R}"); this.addSuperType(SuperType.LEGENDARY); this.subtype.add(SubType.CHANDRA); this.addAbility(new PlaneswalkerEntersWithLoyaltyCountersAbility(5)); this.addAbility(new LoyaltyAbility(new DamagePlayersEffect(3, TargetController.OPPONENT), 1)); CastCardFromGraveyardThenExileItEffect minusEffect = new CastCardFromGraveyardThenExileItEffect(); minusEffect.setText("You may cast target red instant or sorcery card from your graveyard. If that spell would be put into your graveyard this turn, exile it instead"); Ability ability = new LoyaltyAbility(minusEffect, -2); ability.addTarget(new TargetCardInYourGraveyard(filter)); this.addAbility(ability); Effect discardHandEffect = new DiscardHandControllerEffect(); Effect drawEffect = new DrawCardSourceControllerEffect(7); drawEffect.setText(", then draw seven cards"); Effect castSpellsFromHandEffect = new CastFromHandWithoutPayingManaCostEffect( StaticFilters.FILTER_CARD_NON_LAND, true, Duration.EndOfTurn); castSpellsFromHandEffect.setText("Until end of turn, you may cast spells from your hand without paying their mana costs"); Ability ultimateAbility = new LoyaltyAbility(discardHandEffect, -8); ultimateAbility.addEffect(drawEffect); ultimateAbility.addEffect(castSpellsFromHandEffect); this.addAbility(ultimateAbility); }
Source:
<code>protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.fragment_dashboard); if (savedInstanceState == null) { <START> prepareUI(); <END> } }</code><technical_language>@ivanarrizabalaga do extract this bit of code a method? Is leave fork</technical_language>

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.fragment_dashboard); if (savedInstanceState == null) { DashboardUnsentFragment detailsFragment = new DashboardUnsentFragment(); detailsFragment.setArguments(getIntent().getExtras()); FragmentTransaction ft = getFragmentManager().beginTransaction(); ft.add(R.id.dashboard_details_container, detailsFragment); ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE); ft.commit(); DashboardSentFragment completedFragment = new DashboardSentFragment(); detailsFragment.setArguments(getIntent().getExtras()); FragmentTransaction ftr = getFragmentManager().beginTransaction(); ftr.add(R.id.dashboard_completed_container, completedFragment); ftr.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE); ftr.commit(); } }
Source:
<code><START> List<byte[]> deaggregateKinesisRecord(Record kinesisRecord) throws InvalidProtocolBufferException { <END> ByteBuffer kinesisRecordData = kinesisRecord.getData(); int recordSize = kinesisRecordData.position(0).remaining(); boolean validAggregateLength = (recordSize > KPL_AGGREGATE_MAGIC_NUMBERS.length + KPL_AGGREGATE_CHECKSUM_LENGTH_IN_BYTES); if (!validAggregateLength) { ByteBuffer kinesisData = (ByteBuffer) kinesisRecord.getData().position(0); return Collections.singletonList(toByteArray(kinesisData)); } else { byte[] magicNumbers = new byte[KPL_AGGREGATE_MAGIC_NUMBERS.length]; byte[] protobufMessage = new byte[recordSize - KPL_AGGREGATE_CHECKSUM_LENGTH_IN_BYTES - KPL_AGGREGATE_MAGIC_NUMBERS.length]; byte[] checksum = new byte[KPL_AGGREGATE_CHECKSUM_LENGTH_IN_BYTES]; kinesisRecordData.get(magicNumbers, 0, magicNumbers.length); kinesisRecordData.get(protobufMessage, 0, protobufMessage.length); kinesisRecordData.get(checksum, 0, checksum.length); byte[] messageHash = Hashing.md5().hashBytes(protobufMessage).asBytes(); if (Arrays.equals(magicNumbers, KPL_AGGREGATE_MAGIC_NUMBERS) && Arrays.equals(messageHash, checksum)) { List<byte[]> data = new ArrayList<>(); AggregatedRecordProtos.AggregatedRecord aggregatedRecord = AggregatedRecordProtos.AggregatedRecord.parseFrom(protobufMessage); for (AggregatedRecordProtos.Record userRecord : aggregatedRecord.getRecordsList()) { data.add(userRecord.getData().toByteArray()); } return data; } else { ByteBuffer kinesisData = (ByteBuffer) kinesisRecord.getData().position(0); return Collections.singletonList(toByteArray(kinesisData)); } } }</code><technical_language>a good one. @VisibleForTesting means: "I this private, I needed call in a unit test."</technical_language>

Target:
List<byte[]> deaggregateKinesisRecord(Record kinesisRecord) throws InvalidProtocolBufferException { ByteBuffer kinesisRecordData = kinesisRecord.getData(); int recordSize = kinesisRecordData.position(0).remaining(); if (recordSize > KPL_AGGREGATE_MAGIC_NUMBERS.length + KPL_AGGREGATE_CHECKSUM_LENGTH_IN_BYTES) { byte[] magicNumbers = new byte[KPL_AGGREGATE_MAGIC_NUMBERS.length]; byte[] protobufMessage = new byte[recordSize - KPL_AGGREGATE_CHECKSUM_LENGTH_IN_BYTES - KPL_AGGREGATE_MAGIC_NUMBERS.length]; byte[] checksum = new byte[KPL_AGGREGATE_CHECKSUM_LENGTH_IN_BYTES]; kinesisRecordData.get(magicNumbers, 0, magicNumbers.length); kinesisRecordData.get(protobufMessage, 0, protobufMessage.length); kinesisRecordData.get(checksum, 0, checksum.length); byte[] messageHash = Hashing.md5().hashBytes(protobufMessage).asBytes(); if (Arrays.equals(magicNumbers, KPL_AGGREGATE_MAGIC_NUMBERS) && Arrays.equals(messageHash, checksum)) { List<byte[]> data = new ArrayList<>(); AggregatedRecordProtos.AggregatedRecord aggregatedRecord = AggregatedRecordProtos.AggregatedRecord.parseFrom( protobufMessage); for (AggregatedRecordProtos.Record userRecord : aggregatedRecord.getRecordsList()) { data.add(userRecord.getData().toByteArray()); } return data; } } return Collections.singletonList(toByteArray((ByteBuffer) kinesisRecordData.position(0))); }
Source:
<code>private long extractRetryDelay(MessageSendingResult result) { return result.isRetryLater() ? result.getRetryAfterMillis() <START> : subscription.getSubscriptionPolicy().getMessageBackoff(); <END> }</code><technical_language>I if header Retry-After is absent respect message backoff policy..</technical_language>

Target:
private long extractRetryDelay(MessageSendingResult result) { long defaultBackoff = subscription.getSerialSubscriptionPolicy().getMessageBackoff(); long ttlMillis = TimeUnit.SECONDS.toMillis(subscription.getSerialSubscriptionPolicy().getMessageTtl()); return result.getRetryAfterMillis().map(delay -> Math.min(delay, ttlMillis)).orElse(defaultBackoff); }
Source:
<code>void onComplete(PutOperation op) { Exception e = op.getOperationException(); String blobId = op.getBlobIdString(); if (blobId == null && e == null) { e = new RouterException("Operation failed, but exception was not set", RouterErrorCode.UnexpectedInternalError); routerMetrics.operationFailureWithUnsetExceptionCount.inc(); } if (e != null) { blobId = null; routerMetrics.onPutBlobError(e); routerCallback.scheduleDeletes(op.getSuccessfullyPutChunkIdsIfComposite(), op.getServiceId()); } else { <START> CreatedBlobType blobType = op.getNumDataChunks() == 1 ? CreatedBlobType.Simple : CreatedBlobType.Composite; <END> notificationSystem.onBlobCreated(op.getBlobIdString(), op.getBlobProperties(), op.getUserMetadata(), blobType); for (StoreKey storeKey : op.getSuccessfullyPutChunkIdsIfComposite()) { notificationSystem.onBlobCreated(storeKey.getID(), op.getBlobProperties(), op.getUserMetadata(), CreatedBlobType.DataChunk); } updateChunkingAndSizeMetricsOnSuccessfulPut(op); } routerMetrics.operationDequeuingRate.mark(); routerMetrics.putBlobOperationLatencyMs.update(time.milliseconds() - op.getSubmissionTimeMs()); NonBlockingRouter.completeOperation(op.getFuture(), op.getCallback(), blobId, e); }</code><technical_language>Is this "recommended" of checking blob type</technical_language>

Target:
void onComplete(PutOperation op) { Exception e = op.getOperationException(); String blobId = op.getBlobIdString(); op.maybeNotifyForBlobCreation(); if (blobId == null && e == null) { e = new RouterException("Operation failed, but exception was not set", RouterErrorCode.UnexpectedInternalError); routerMetrics.operationFailureWithUnsetExceptionCount.inc(); } if (e != null) { blobId = null; routerMetrics.onPutBlobError(e); routerCallback.scheduleDeletes(op.getSuccessfullyPutChunkIdsIfComposite(), op.getServiceId()); } else { updateChunkingAndSizeMetricsOnSuccessfulPut(op); } routerMetrics.operationDequeuingRate.mark(); routerMetrics.putBlobOperationLatencyMs.update(time.milliseconds() - op.getSubmissionTimeMs()); NonBlockingRouter.completeOperation(op.getFuture(), op.getCallback(), blobId, e); }
Source:
<code>static AwsDates generateXAmzDate() { DateFormat dateFormat = new SimpleDateFormat(X_AMZ_DATE_FORMAT); dateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); <START> String xAmzDate = dateFormat.format(new Date(Clock.SYSTEM.currentTimeMillis())); <END> return fromXAmzDate(xAmzDate); }</code><technical_language>need Clock here; System.getCurrentTimeMillis</technical_language>

Target:
static AwsDates generateXAmzDate() { DateFormat dateFormat = new SimpleDateFormat(X_AMZ_DATE_FORMAT); dateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); String xAmzDate = dateFormat.format(new Date(System.currentTimeMillis())); return new AwsDates(xAmzDate); }
Source:
<code>public PatchSetContent pull(IReviewItemSet parentObject, String key, IProgressMonitor monitor) throws CoreException { RemoteEmfConsumer<IReview, IReviewItemSet, String, PatchSetDetail, PatchSetDetail, String> itemSetConsumer = getGerritProvider().getReviewItemSetFactory() .getConsumerForLocalKey(parentObject.getReview(), key); PatchSetDetail detail = itemSetConsumer.getRemoteObject(); <START> while (detail == null) { <END> try { Thread.sleep(20); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } itemSetConsumer.pull(false, monitor); detail = itemSetConsumer.getRemoteObject(); } if (detail != null) { PatchSetContent content = new PatchSetContent((PatchSet) null, detail); return pull(parentObject, content, monitor); } throw new CoreException(new Status(IStatus.ERROR, GerritCorePlugin.PLUGIN_ID, "Couldn't obtain patch set detail for " + key + ". Check remote connection.")); }</code><technical_language>Do want this wait forever</technical_language>

Target:
public PatchSetContent pull(IReviewItemSet parentObject, String key, IProgressMonitor monitor) throws CoreException { RemoteEmfConsumer<IReview, IReviewItemSet, String, PatchSetDetail, PatchSetDetail, String> itemSetConsumer = getGerritProvider().getReviewItemSetFactory() .getConsumerForLocalKey(parentObject.getReview(), key); PatchSetDetail detail = itemSetConsumer.getRemoteObject(); if (detail == null) { itemSetConsumer.pull(false, monitor); detail = itemSetConsumer.getRemoteObject(); } if (detail != null) { PatchSetContent content = new PatchSetContent((PatchSet) null, detail); return pull(parentObject, content, monitor); } throw new CoreException(new Status(IStatus.ERROR, GerritCorePlugin.PLUGIN_ID, "Couldn't obtain patch set detail for " + key + ". Check remote connection.")); }
Source:
<code>private IViewReference[] getViewReferences(boolean allPerspectives) { MPerspective perspective = getCurrentPerspective(); if (perspective != null) { int scope = allPerspectives ? WINDOW_SCOPE : EModelService.PRESENTATION; Set<MUIElement> parts = new HashSet<MUIElement>(); List<MPlaceholder> placeholders = modelService.findElements(window, null, MPlaceholder.class, null, scope); parts.addAll(placeholders); parts.addAll(modelService.findElements(window, null, MPart.class, null, scope)); List<IViewReference> visibleReferences = new ArrayList<IViewReference>(); for (ViewReference reference : viewReferences) { if (parts.contains(reference.getModel()) && reference.getModel().isToBeRendered()) { visibleReferences.add(reference); for (MPlaceholder placeholder : placeholders) { <START> if (reference.getModel() == placeholder.getRef() && !placeholder.isToBeRendered()) { <END> visibleReferences.remove(reference); } } } } return visibleReferences.toArray(new IViewReference[visibleReferences.size()]); } return new IViewReference[0]; }</code><technical_language>check if placeholder isVisible? PartServiceImpl#isPartOrPlaceholderInPerspective</technical_language>

Target:
private IViewReference[] getViewReferences(boolean allPerspectives) { MPerspective perspective = getCurrentPerspective(); if (perspective != null) { int scope = allPerspectives ? WINDOW_SCOPE : EModelService.PRESENTATION; Set<MUIElement> parts = new HashSet<MUIElement>(); List<MPlaceholder> placeholders = modelService.findElements(window, null, MPlaceholder.class, null, scope); parts.addAll(placeholders); parts.addAll(modelService.findElements(window, null, MPart.class, null, scope)); List<IViewReference> visibleReferences = new ArrayList<IViewReference>(); for (ViewReference reference : viewReferences) { MPart model = reference.getModel(); if (parts.contains(model) && model.isToBeRendered() && (model.getCurSharedRef() == null || model.getCurSharedRef().isToBeRendered())) { visibleReferences.add(reference); } } return visibleReferences.toArray(new IViewReference[visibleReferences.size()]); } return new IViewReference[0]; }
Source:
<code><START> final public Double getWeight(ExecutionSemester semester) { <END> if (isBolonhaDegree()) { return getEctsCredits(semester); } if (getDegreeType().isMasterDegree()) { return getCredits(); } final Double weigth = super.getWeigth(); return (weigth == null || weigth == 0.0) ? WEIGHT_FOR_PRE_BOLONHA : weigth; }</code><technical_language>constants removed source code</technical_language>

Target:
final public Double getWeight(ExecutionSemester semester) { if (isBolonhaDegree()) { return getEctsCredits(semester); } if (getDegreeType().isMasterDegree()) { return getCredits(); } return super.getWeigth(); }
Source:
<code>public void testIsConnectionDoesNotExistForHostAndTargetFails() { when(storageServerConnectionExtensionDao.getByHostIdAndTarget(conn.getHostId(), conn.getIqn())).thenReturn(new StorageServerConnectionExtension()); <START> assertNotNull(validator.isConnectionDoesNotExistForHostAndTarget(conn).getMessage()); <END> }</code><technical_language>assert exact message</technical_language>

Target:
public void testIsConnectionDoesNotExistForHostAndTargetFails() { when(storageServerConnectionExtensionDao.getByHostIdAndTarget(conn.getHostId(), conn.getIqn())).thenReturn(new StorageServerConnectionExtension()); assertEquals(EngineMessage.ACTION_TYPE_FAILED_STORAGE_CONNECTION_EXTENSION_ALREADY_EXISTS, validator.isConnectionDoesNotExistForHostAndTarget(conn).getMessage()); }
Source:
<code>public void matchBatchType() throws Exception { BatchExecution actualExecution = BatchExecution.builder() .withBatchQueries(BatchQuery.builder().withQuery("some query").build(), unmatchingBatchQuery) .withBatchType(LOGGED) .build(); BatchExecution expectedExecution = BatchExecution.builder() .withBatchQueries(BatchQuery.builder().withQuery("some query").build()) .withBatchType(LOGGED) .build(); <START> BatchExecutionMatcher underTest = new BatchExecutionMatcher(expectedExecution); <END> boolean matched = underTest.matchesSafely(newArrayList(actualExecution, unmatchingBatchExecution)); assertTrue(matched); }</code><technical_language>status method in tests? is unused atm</technical_language>

Target:
public void matchBatchType() throws Exception { BatchExecution actualExecution = BatchExecution.builder() .withBatchQueries(BatchQuery.builder().withQuery("some query").build(), unmatchingBatchQuery) .withBatchType(LOGGED) .build(); BatchExecution expectedExecution = BatchExecution.builder() .withBatchQueries(BatchQuery.builder().withQuery("some query").build()) .withBatchType(LOGGED) .build(); BatchExecutionMatcher underTest = batchExecutionRecorded(expectedExecution); boolean matched = underTest.matchesSafely(newArrayList(actualExecution, unmatchingBatchExecution)); assertTrue(matched); }
Source:
<code>public void emitTuples() { if(initialOffset.equals("latest")) { if(noOfWindows < noOfWindowsToEscape) { return; } } int range = getMaxvalue() - getMinvalue() + 1; while (count < getTuplesBlast()) { int rval = getMinvalue() + random.nextInt(range); if (integer_data.isConnected()) { integer_data.emit(rval); } if (string_data.isConnected()) { string_data.emit(Integer.toString(rval)); } if (output.isConnected()) { output.emit(rval); } count++; } <START> <END> }</code><technical_language>Remove extra newline</technical_language>

Target:
public void emitTuples() { if(disableGenerate) { return; } if(initialOffset.equals(KafkaValidationModule.DEFAULTOFFSET)) { if(noOfWindows < noOfWindowsToEscape) { return; } } int range = getMaxvalue() - getMinvalue() + 1; while (count < getTuplesBlast()) { int rval = getMinvalue() + random.nextInt(range); if (integer_data.isConnected()) { integer_data.emit(rval); } if (string_data.isConnected()) { string_data.emit(Integer.toString(rval)); } if (output.isConnected()) { output.emit(rval); } count++; } }
Source:
<code>public void shouldNotifyWithTheRightCommentedDocument() { try (CapturingEventListener listener = new CapturingEventListener(COMMENT_ADDED, DOCUMENT_CREATED)) { Comment createdComment = createCommentAndAddSubscription("CommentAdded", "Creation"); DocumentModel commentDocumentModel = session.getDocument(new IdRef(createdComment.getId())); transactionalFeature.nextTransaction(); assertTrue(listener.hasBeenFired(COMMENT_ADDED)); assertTrue(listener.hasBeenFired(DOCUMENT_CREATED)); List<Event> handledEvents = listener.streamCapturedEvents() .filter(e -> COMMENT_ADDED.equals(e.getName())) .collect(Collectors.toList()); assertEquals(1, handledEvents.size()); checkDocumentEventContext(handledEvents.get(0), commentDocumentModel, commentedDocumentModel, commentedDocumentModel); checkReceivedMail(emailsResult.getMails(), commentDocumentModel, commentedDocumentModel, <START> handledEvents.get(0), COMMENT_ADDED); <END> Comment reply = createComment(commentDocumentModel); DocumentModel replyDocumentModel = session.getDocument(new IdRef(reply.getId())); transactionalFeature.nextTransaction(); handledEvents = listener.streamCapturedEvents() .filter(e -> COMMENT_ADDED.equals(e.getName())) .collect(Collectors.toList()); assertEquals(2, handledEvents.size()); checkDocumentEventContext(handledEvents.get(1), replyDocumentModel, commentDocumentModel, commentedDocumentModel); checkReceivedMail(emailsResult.getMails(), replyDocumentModel, commentedDocumentModel, handledEvents.get(1), COMMENT_ADDED); } }</code><technical_language>suggestion</technical_language>

Target:
public void shouldNotifyWithTheRightCommentedDocument() { Comment createdComment = createComment(commentedDocumentModel); DocumentModel createdCommentDocModel = session.getDocument(new IdRef(createdComment.getId())); transactionalFeature.nextTransaction(); captureAndVerifyCommentEventNotification(() -> { addSubscriptions("CommentAdded"); Comment reply = createComment(createdCommentDocModel); DocumentModel replyDocumentModel = session.getDocument(new IdRef(reply.getId())); return session.getDocument(new IdRef(replyDocumentModel.getId())); }, COMMENT_ADDED, DOCUMENT_CREATED); }
Source:
<code>private void handleException(Exception e, HttpServletResponse resp) throws IOException { if (e instanceof InvalidRequestException || e instanceof CodecException ) { LOG.warn("Invalid request", e); resp.setStatus(HttpServletResponse.SC_BAD_REQUEST); resp.getWriter().append("Invalid request:").append(e.getMessage()).flush(); } else if (e instanceof RequestRejectedException) { LOG.warn("Request rejected", e); resp.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); resp.getWriter().append("Request rejected:").append(e.getMessage()).flush(); } else if (e instanceof InvalidResponseException) { <START> LOG.warn("Invalid response", e); <END> resp.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); resp.getWriter().append("Invalid Response:").append(e.getMessage()).flush(); } else if (e instanceof InterruptedException) { LOG.warn("Thread Interrupted", e); resp.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); resp.getWriter().append("Thread Interrupted:").append(e.getMessage()).flush(); } else { LOG.warn("Unexpected exception", e); resp.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); resp.getWriter().append("Unexpected exception:").append(e.getMessage()).flush(); } }</code><technical_language>code is required, import is wrong (probably due erroneous auto completion). need import is org.eclipse.leshan.core.request.exception.RequestCanceledException ..</technical_language>

Target:
private void handleException(Exception e, HttpServletResponse resp) throws IOException { if (e instanceof InvalidRequestException || e instanceof CodecException ) { LOG.warn("Invalid request", e); resp.setStatus(HttpServletResponse.SC_BAD_REQUEST); resp.getWriter().append("Invalid request:").append(e.getMessage()).flush(); } else if (e instanceof RequestRejectedException) { LOG.warn("Request rejected", e); resp.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); resp.getWriter().append("Request rejected:").append(e.getMessage()).flush(); } else if (e instanceof RequestCanceledException) { LOG.warn("Request cancelled", e); resp.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); resp.getWriter().append("Request cancelled:").append(e.getMessage()).flush(); } else if (e instanceof InvalidResponseException) { LOG.warn("Invalid response", e); resp.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); resp.getWriter().append("Invalid Response:").append(e.getMessage()).flush(); } else if (e instanceof InterruptedException) { LOG.warn("Thread Interrupted", e); resp.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); resp.getWriter().append("Thread Interrupted:").append(e.getMessage()).flush(); } else { LOG.warn("Unexpected exception", e); resp.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); resp.getWriter().append("Unexpected exception:").append(e.getMessage()).flush(); } }
Source:
<code>public static List<UUID> getSequence() { return Arrays.asList( new UUID( Long.MIN_VALUE, Long.MIN_VALUE ), new UUID( Long.MIN_VALUE, -1L ), new UUID( Long.MIN_VALUE, 0L ), <START> new UUID( Long.MIN_VALUE, 1L ), <END> new UUID( Long.MAX_VALUE, Long.MIN_VALUE ), new UUID( Long.MAX_VALUE, Long.MAX_VALUE ) ); }</code><technical_language>nitpicking... add a "nominal" value, UUID.fromString("8cea97f9-9696-4299-9f05-636a208b6c1f")</technical_language>

Target:
public static List<UUID> getSequence() { return Arrays.asList( new UUID( Long.MIN_VALUE, Long.MIN_VALUE ), new UUID( Long.MIN_VALUE, -1L ), new UUID( Long.MIN_VALUE, 0L ), new UUID( Long.MIN_VALUE, 1L ), new UUID( Long.MAX_VALUE, Long.MIN_VALUE ), new UUID( Long.MAX_VALUE, Long.MAX_VALUE ), UUID.fromString( "8cea97f9-9696-4299-9f05-636a208b6c1f" ) ); }
Source:
<code>private void startProxy(final IServer startedServer) { if (proxyServers.containsKey(startedServer)) { final LiveReloadProxyServer proxyServer = proxyServers.get(startedServer); try { proxyServer.start(); } catch (Exception e) { Logger.error("Failed to start LiveReload Proxy on port " + ((NetworkConnector)proxyServer.getConnectors()[0]).getPort() + " for server " + startedServer.getName(), e); } } else { try { final int targetPort = WSTUtils.getWebPort(startedServer); if (targetPort == -1) { return; } final String targetHost = WSTUtils.getWebHost(startedServer); final boolean allowRemoteConnections = isRemoteConnectionsAllowed(); final boolean enableScriptInjection = isScriptInjectionEnabled(); final String proxyHost = getProxyHost(); final int proxyPort = getProxyPort(startedServer); final LiveReloadProxyServer proxyServer = new LiveReloadProxyServer(proxyHost, proxyPort, targetHost, targetPort, websocketPort, allowRemoteConnections, enableScriptInjection); proxyServers.put(startedServer, proxyServer); final JettyServerRunner proxyRunner = JettyServerRunner.start(proxyServer); proxyRunners.put(startedServer, proxyRunner); } catch (Exception e) { <START> Logger.error("Failed to create or start LiveReload proxy for server " + startedServer.getName(), e); <END> } } }</code><technical_language>shouldnt show this user in a msg dialog</technical_language>

Target:
private void startProxy(final IServer startedServer) { if (proxyServers.containsKey(startedServer)) { final LiveReloadProxyServer proxyServer = proxyServers.get(startedServer); try { proxyServer.start(); } catch (Exception e) { Logger.error("Failed to start LiveReload Proxy on port " + ((NetworkConnector)proxyServer.getConnectors()[0]).getPort() + " for server " + startedServer.getName(), e); } } else { try { final int targetPort = WSTUtils.getWebPort(startedServer); if (targetPort == -1) { return; } final String targetHost = WSTUtils.getWebHost(startedServer); final boolean allowRemoteConnections = isRemoteConnectionsAllowed(); final boolean enableScriptInjection = isScriptInjectionEnabled(); final String proxyHost = getProxyHost(); final int proxyPort = getProxyPort(startedServer); final LiveReloadProxyServer proxyServer = new LiveReloadProxyServer(proxyHost, proxyPort, targetHost, targetPort, websocketPort, allowRemoteConnections, enableScriptInjection); proxyServers.put(startedServer, proxyServer); final JettyServerRunner proxyRunner = JettyServerRunner.start(proxyServer); if(proxyRunner != null) { proxyRunners.put(startedServer, proxyRunner); } } catch (Exception e) { Logger.error("Failed to create or start LiveReload proxy for server " + startedServer.getName(), e); } } }
Source:
<code>public BinaryContent transform(Metacard metacard, Map<String, Serializable> arguments) throws CatalogTransformerException { if (metacard == null) { LOGGER.debug("Attempted to transform null metacard"); throw new CatalogTransformerException("Null metacard cannot be transformed to XLSX"); } <START> return xlsxMetacardUtility.buildSpreadSheet(Collections.singletonList(metacard)); <END> }</code><technical_language>Personally if operations broken lines for readability. List<Metacard> metacards = Collections.singletonList(metacard); return xlsxMetacardUtility.buildSpreadSheet(metacards);</technical_language>

Target:
public BinaryContent transform(Metacard metacard, Map<String, Serializable> arguments) throws CatalogTransformerException { if (metacard == null) { LOGGER.debug("Attempted to transform null metacard"); throw new CatalogTransformerException("Null metacard cannot be transformed to XLSX"); } List<Metacard> metacards = Collections.singletonList(metacard); return XlsxMetacardUtility.buildSpreadSheet(metacards); }