auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Sequence<Cursor> makeCursors( @Nullable final Filter filter, @Nonnull final Interval interval, @Nonnull final VirtualColumns virtualColumns, @Nonnull final Granularity gran, final boolean descending, @Nullable final QueryMetrics<?> queryMetrics ) { final List<VirtualColumn> preJoinVirtualColumns = new ArrayList<>(); final List<VirtualColumn> postJoinVirtualColumns = new ArrayList<>(); final Set<String> baseColumns = determineBaseColumnsWithPreAndPostJoinVirtualColumns( virtualColumns, preJoinVirtualColumns, postJoinVirtualColumns ); JoinFilterSplit joinFilterSplit = JoinFilterAnalyzer.splitFilter(joinFilterPreAnalysis); preJoinVirtualColumns.addAll(joinFilterSplit.getPushDownVirtualColumns()); final Sequence<Cursor> baseCursorSequence = baseAdapter.makeCursors( joinFilterSplit.getBaseTableFilter().isPresent() ? joinFilterSplit.getBaseTableFilter().get() : null, interval, VirtualColumns.create(preJoinVirtualColumns), gran, descending, queryMetrics ); return Sequences.map( baseCursorSequence, cursor -> { Cursor retVal = cursor; for (JoinableClause clause : clauses) { retVal = HashJoinEngine.makeJoinCursor(retVal, clause); } return PostJoinCursor.wrap( retVal, VirtualColumns.create(postJoinVirtualColumns), joinFilterSplit.getJoinTableFilter().isPresent() ? joinFilterSplit.getJoinTableFilter().get() : null ); } ); }

Target:
public Sequence<Cursor> makeCursors( @Nullable final Filter filter, @Nonnull final Interval interval, @Nonnull final VirtualColumns virtualColumns, @Nonnull final Granularity gran, final boolean descending, @Nullable final QueryMetrics<?> queryMetrics ) { final List<VirtualColumn> preJoinVirtualColumns = new ArrayList<>(); final List<VirtualColumn> postJoinVirtualColumns = new ArrayList<>(); determineBaseColumnsWithPreAndPostJoinVirtualColumns( virtualColumns, preJoinVirtualColumns, postJoinVirtualColumns ); JoinFilterSplit joinFilterSplit = JoinFilterAnalyzer.splitFilter(joinFilterPreAnalysis); preJoinVirtualColumns.addAll(joinFilterSplit.getPushDownVirtualColumns()); final Sequence<Cursor> baseCursorSequence = baseAdapter.makeCursors( joinFilterSplit.getBaseTableFilter().isPresent() ? joinFilterSplit.getBaseTableFilter().get() : null, interval, VirtualColumns.create(preJoinVirtualColumns), gran, descending, queryMetrics ); return Sequences.map( baseCursorSequence, cursor -> { Cursor retVal = cursor; for (JoinableClause clause : clauses) { retVal = HashJoinEngine.makeJoinCursor(retVal, clause); } return PostJoinCursor.wrap( retVal, VirtualColumns.create(postJoinVirtualColumns), joinFilterSplit.getJoinTableFilter().isPresent() ? joinFilterSplit.getJoinTableFilter().get() : null ); } ); }
Source:
private void moveVdsToUp(VDS vds) { HostStoragePoolParametersBase tempVar = new HostStoragePoolParametersBase(vds); Backend.getInstance().runInternalAction(VdcActionType.InitVdsOnUp, tempVar); }

Target:
private void moveVdsToUp(VDS vds) { vds.setNonOperationalReason(null); DbFacade.getInstance().getVdsDynamicDao().update(vds.getDynamicData()); HostStoragePoolParametersBase tempVar = new HostStoragePoolParametersBase(vds); Backend.getInstance().runInternalAction(VdcActionType.InitVdsOnUp, tempVar); }
Source:
private Object checkForCompositeRename(ExecutionEvent event) { ISelection sel= HandlerUtil.getCurrentSelection(event); if (sel instanceof IStructuredSelection) { IResource resource= getCurrentResource((IStructuredSelection) sel); if (resource != null) { String placeHolderFileName; if (resource.getFileExtension() != null) { String newName= resource.getName().substring(0, resource.getName().lastIndexOf('.')) + 'a'; placeHolderFileName= newName + '.' + resource.getFileExtension(); } else { placeHolderFileName= resource.getName() + 'a'; } RenameResourceWizard refactoringWizard= new RenameResourceWizard(resource, placeHolderFileName); Change change= getChange(refactoringWizard); return isCompositeChange(change); } } return null; }

Target:
private Object checkForCompositeRename(ExecutionEvent event) { ISelection sel= HandlerUtil.getCurrentSelection(event); if (sel instanceof IStructuredSelection) { IResource resource= getCurrentResource((IStructuredSelection) sel); if (resource != null) { String placeHolderFileName; if (resource.getFileExtension() != null) { String newName= resource.getName().substring(0, resource.getName().indexOf('.')) + 'a'; placeHolderFileName= newName + '.' + resource.getFileExtension(); } else { placeHolderFileName= resource.getName() + 'a'; } RenameResourceWizard refactoringWizard= new RenameResourceWizard(resource, placeHolderFileName); Change change= getChange(refactoringWizard); return isCompositeChange(change); } } return null; }
Source:
public ExpressionProjector(String name, String tableName, Expression expression, boolean isCaseSensitive) { this.name = name; this.expression = expression; this.tableName = tableName; this.isCaseSensitive = isCaseSensitive; this.arrayIndex = -1; }

Target:
public ExpressionProjector(String name, String tableName, Expression expression, boolean isCaseSensitive) { this.name = name; this.expression = expression; this.tableName = tableName; this.isCaseSensitive = isCaseSensitive; }
Source:
private void postDescription(@NonNull String editToken) { descriptionEditCall = new DescriptionEditClient().request(wikiData, pageTitle, editView.getDescription(), editToken, new DescriptionEditClient.Callback() { @Override @SuppressWarnings("checkstyle:magicnumber") public void success(@NonNull Call<DescriptionEdit> call) { new Handler().postDelayed(successRunnable, TimeUnit.SECONDS.toMillis(4)); if (funnel != null) { funnel.logSaved(); } } @Override public void abusefilter(@NonNull Call<DescriptionEdit> call, String info) { editView.setSaveState(false); editView.setError(StringUtil.fromHtml(info)); } @Override public void failure(@NonNull Call<DescriptionEdit> call, @NonNull Throwable caught) { editFailed(caught); } }); }

Target:
private void postDescription(@NonNull String editToken) { descriptionEditCall = new DescriptionEditClient().request(wikiData, pageTitle, editView.getDescription(), editToken, new DescriptionEditClient.Callback() { @Override @SuppressWarnings("checkstyle:magicnumber") public void success(@NonNull Call<DescriptionEdit> call) { new Handler().postDelayed(successRunnable, TimeUnit.SECONDS.toMillis(4)); if (funnel != null) { funnel.logSaved(); } } @Override public void abusefilter(@NonNull Call<DescriptionEdit> call, @Nullable String code, @Nullable String info) { editView.setSaveState(false); if (info != null) { editView.setError(StringUtil.fromHtml(info)); } if (funnel != null) { funnel.logAbuseFilterWarning(code); } } @Override public void failure(@NonNull Call<DescriptionEdit> call, @NonNull Throwable caught) { editFailed(caught); if (funnel != null) { funnel.logError(caught.getMessage()); } } }); }
Source:
private Optional<List<Image>> getAmiFromEC2Api(String account, String region, final String imageId) { try { AmazonEC2Client ec2Client = clientProvider.getClient( AmazonEC2Client.class, account, getRegion( fromName(region))); DescribeImagesRequest describeImagesRequest = new DescribeImagesRequest(); describeImagesRequest.setImageIds(newArrayList(imageId)); return ofNullable(ec2Client.describeImages(describeImagesRequest).getImages().stream().collect(Collectors.toList())); } catch (final AmazonClientException e) { log.warn("Could not describe image " + imageId, e); return empty(); } }

Target:
private Optional<Image> getAmiFromEC2Api(String account, String region, final String imageId) { try { final AmazonEC2Client ec2Client = clientProvider.getClient( AmazonEC2Client.class, account, getRegion(fromName(region))); final DescribeImagesResult response = ec2Client.describeImages(new DescribeImagesRequest().withImageIds(imageId)); return ofNullable(response) .map(DescribeImagesResult::getImages) .map(List::stream) .flatMap(Stream::findFirst); } catch (final AmazonClientException e) { log.warn("Could not describe image " + imageId, e); return empty(); } }
Source:
public int getPartitionedSplitCount() { if (taskStateMachine.getState().isDone()) { return 0; } synchronized (this) { int count = 0; for (PlanNodeId partitionedSource : fragment.getTableScanSchedulingOrder()) { Collection<Split> partitionedSplits = splits.get(partitionedSource); count += partitionedSplits.size(); } return count; } }

Target:
public int getPartitionedSplitCount() { if (taskStateMachine.getState().isDone()) { return 0; } synchronized (this) { int count = 0; for (PlanNodeId tableScanPlanNodeId : fragment.getTableScanSchedulingOrder()) { Collection<Split> partitionedSplits = splits.get(tableScanPlanNodeId); count += partitionedSplits.size(); } return count; } }
Source:
public void createPayment_responseWith400_whenAmountFieldIsNotAValidJsonField() throws IOException { String payload = "{" + " \"amount\" : { \"whatever\": 1 }," + " \"reference\" : \"Some reference\"," + " \"description\" : \"Some description\"," + " \"return_url\" : \"<LINK_0>\"" + "}"; System.out.println("payload = " + payload); InputStream body = postPaymentResponse(BEARER_TOKEN, payload) .statusCode(400) .contentType(JSON) .extract() .body().asInputStream(); JsonAssert.with(body) .assertThat("$.*", hasSize(2)) .assertThat("$.code", is("P0100")) .assertThat("$.description", is("Invalid attribute value: amount. Must be a valid numeric format")); }

Target:
public void createPayment_responseWith400_whenAmountFieldIsNotAValidJsonField() throws IOException { String payload = "{" + " \"amount\" : { \"whatever\": 1 }," + " \"reference\" : \"Some reference\"," + " \"description\" : \"Some description\"," + " \"return_url\" : \"<LINK_0>\"" + "}"; InputStream body = postPaymentResponse(BEARER_TOKEN, payload) .statusCode(400) .contentType(JSON) .extract() .body().asInputStream(); JsonAssert.with(body) .assertThat("$.*", hasSize(2)) .assertThat("$.code", is("P0100")) .assertThat("$.description", is("Invalid attribute value: amount. Must be a valid numeric format")); }
Source:
public LockRenewalOperation getAutoRenewSessionLock(String sessionId, Duration maxLockRenewalDuration) { if (isDisposed.get()) { throw logger.logThrowableAsError(new IllegalStateException( String.format(INVALID_OPERATION_DISPOSED_RECEIVER, "getAutoRenewSessionLock"))); } else if (!receiverOptions.isSessionReceiver()) { throw logger.logThrowableAsError(new IllegalStateException( "Cannot renew session lock on a non-session receiver.")); } else if (maxLockRenewalDuration == null) { throw logger.logThrowableAsError(new NullPointerException("'maxLockRenewalDuration' cannot be null.")); } else if (maxLockRenewalDuration.isNegative()) { throw logger.logThrowableAsError(new IllegalArgumentException( "'maxLockRenewalDuration' cannot be negative.")); } return new LockRenewalOperation(sessionId, maxLockRenewalDuration, true, this::renewSessionLock); }

Target:
public LockRenewalOperation getAutoRenewSessionLock(String sessionId, Duration maxLockRenewalDuration) { if (isDisposed.get()) { throw logger.logExceptionAsError(new IllegalStateException( String.format(INVALID_OPERATION_DISPOSED_RECEIVER, "getAutoRenewSessionLock"))); } else if (!receiverOptions.isSessionReceiver()) { throw logger.logExceptionAsError(new IllegalStateException( "Cannot renew session lock on a non-session receiver.")); } else if (maxLockRenewalDuration == null) { throw logger.logExceptionAsError(new NullPointerException("'maxLockRenewalDuration' cannot be null.")); } else if (maxLockRenewalDuration.isNegative()) { throw logger.logExceptionAsError(new IllegalArgumentException( "'maxLockRenewalDuration' cannot be negative.")); } else if (Objects.isNull(sessionId)) { throw logger.logExceptionAsError(new NullPointerException("'sessionId' cannot be null.")); } else if (sessionId.isEmpty()) { throw logger.logExceptionAsError(new IllegalArgumentException("'sessionId' cannot be empty.")); } final LockRenewalOperation operation = new LockRenewalOperation(sessionId, maxLockRenewalDuration, true, this::renewSessionLock); renewalContainer.addOrUpdate(sessionId, Instant.now().plus(maxLockRenewalDuration), operation); return operation; }
Source:
private void importProject(Intent data) { if (data == null) { setShowProgressBar(false); return; } boolean isImporting = false; try { isImporting = data.getExtras().getSerializable("IS_IMPORTING_FROM_IMPLICIT_INTENT") != null; } catch (NullPointerException e) { Log.e(TAG, "Null pointer exception", e); } try { if (!data.getData().getScheme().equals("file") && !isImporting) { throw new IllegalArgumentException("importProject has to be called with a file uri. (not a content uri"); } } catch (NullPointerException e) { Log.e(TAG, "Null pointer exception", e); } try { File cacheFile = new File(CACHE_DIR, CACHED_PROJECT_ZIP_FILE_NAME); if (cacheFile.exists()) { cacheFile.delete(); } File src = new File(data.getData().getPath()); if (src.isDirectory()) { new ProjectImportTask() .setListener(projectImportListener) .execute(src); } else { File projectFile = StorageOperations .copyUriToDir(getContext().getContentResolver(), data.getData(), CACHE_DIR, CACHED_PROJECT_ZIP_FILE_NAME); new ProjectUnzipAndImportTask() .setListener(projectUnzipAndImportListener) .execute(projectFile); } setShowProgressBar(true); } catch (IOException | NullPointerException e) { Log.e(TAG, "Cannot resolve project to import.", e); } }

Target:
private void importProject(Intent data) { if (data == null || data.getData() == null) { setShowProgressBar(false); ToastUtil.showError(getContext(), R.string.error_import_project); return; } try { File cacheFile = new File(CACHE_DIR, CACHED_PROJECT_ZIP_FILE_NAME); if (cacheFile.exists()) { cacheFile.delete(); } File src = new File(data.getData().getPath()); if (src.isDirectory()) { new ProjectImportTask() .setListener(projectImportListener) .execute(src); } else { File projectFile = StorageOperations .copyUriToDir(getContext().getContentResolver(), data.getData(), CACHE_DIR, CACHED_PROJECT_ZIP_FILE_NAME); new ProjectUnzipAndImportTask() .setListener(projectUnzipAndImportListener) .execute(projectFile); } setShowProgressBar(true); } catch (IOException e) { Log.e(TAG, "Cannot resolve project to import.", e); } }
Source:
private ValidationResult validateAndAddToStorageRequests(QuotaStorageConsumptionParameter param, Quota quota, String commandClassName, Map<Pair<Guid, Guid>, StorageRequest> requestMap) { if (param.getStorageDomainId() == null) { log.error("Quota storage parameters from command '{}' are missing storage domain id", commandClassName); return new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_QUOTA_IS_NOT_VALID); } Pair<Guid, Guid> key = quota.isGlobalStorageQuota() ? new Pair<>(quota.getId(), null) : new Pair<>(quota.getId(), param.getStorageDomainId()); if (!requestMap.containsKey(key)) { QuotaStorage quotaStorage = quota.isGlobalStorageQuota() ? quota.getGlobalQuotaStorage() : quota.getQuotaStorages().stream() .filter(s -> s.getStorageId().equals(param.getStorageDomainId())) .findAny().orElse(null); if (quotaStorage == null) { log.error("Quota storage parameters from command '{}'. Storage domain does not match quota", commandClassName); return new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_NO_QUOTA_SET_FOR_DOMAIN); } requestMap.put(key, new StorageRequest(quota, quotaStorage)); } double requestedStorage = param.getQuotaAction() == QuotaConsumptionParameter.QuotaAction.CONSUME ? param.getRequestedStorageGB() : -param.getRequestedStorageGB(); StorageRequest request = requestMap.get(key); request.addStorage(requestedStorage); return ValidationResult.VALID; }

Target:
private ValidationResult validateAndAddToStorageRequests(QuotaStorageConsumptionParameter param, Quota quota, String commandClassName, Map<Pair<Guid, Guid>, StorageRequest> requestMap) { if (param.getStorageDomainId() == null) { log.error("Quota storage parameters from command '{}' are missing storage domain id", commandClassName); return new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_QUOTA_IS_NOT_VALID); } Pair<Guid, Guid> key = quota.isGlobalStorageQuota() ? new Pair<>(quota.getId(), null) : new Pair<>(quota.getId(), param.getStorageDomainId()); if (!requestMap.containsKey(key)) { QuotaStorage quotaStorage = quota.isGlobalStorageQuota() ? quota.getGlobalQuotaStorage() : quota.getQuotaStorages().stream() .filter(s -> s.getStorageId().equals(param.getStorageDomainId())) .findAny().orElse(null); if (quotaStorage == null) { log.error("Quota storage parameters from command '{}'. Storage domain does not match quota", commandClassName); return new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_NO_QUOTA_SET_FOR_DOMAIN); } requestMap.put(key, new StorageRequest(quota, quotaStorage)); } int quotaActionCoef = 1; if (param.getQuotaAction() == QuotaConsumptionParameter.QuotaAction.RELEASE) { quotaActionCoef = -1; } StorageRequest request = requestMap.get(key); request.addStorage(quotaActionCoef * param.getRequestedStorageGB()); return ValidationResult.VALID; }
Source:
static ICPPFunction[] instantiateForFunctionCall(ICPPFunction[] fns, ICPPTemplateArgument[] tmplArgs, List<IType> fnArgs, List<ValueCategory> argCats, boolean withImpliedObjectArg, IASTNode point) { boolean requireTemplate= tmplArgs != null; boolean haveTemplate= false; for (final ICPPFunction func : fns) { if (func instanceof ICPPConstructor || (func instanceof ICPPMethod && ((ICPPMethod) func).isDestructor())) requireTemplate= false; if (func instanceof ICPPFunctionTemplate) { ICPPFunctionTemplate template= (ICPPFunctionTemplate) func; try { if (containsDependentType(fnArgs)) return new ICPPFunction[] {CPPDeferredFunction.createForCandidates(fns)}; if (requireTemplate) { if (hasDependentArgument(tmplArgs)) return new ICPPFunction[] {CPPDeferredFunction.createForCandidates(fns)}; } } catch (DOMException e) { return NO_FUNCTIONS; } haveTemplate= true; break; } } if (!haveTemplate && !requireTemplate) return fns; final List<ICPPFunction> result= new ArrayList<ICPPFunction>(fns.length); for (ICPPFunction fn : fns) { if (fn != null) { if (fn instanceof ICPPFunctionTemplate) { ICPPFunctionTemplate fnTmpl= (ICPPFunctionTemplate) fn; ICPPFunction inst = instantiateForFunctionCall(fnTmpl, tmplArgs, fnArgs, argCats, withImpliedObjectArg, point); if (inst != null) result.add(inst); } else if (!requireTemplate || fn instanceof ICPPUnknownBinding) { result.add(fn); } } } return result.toArray(new ICPPFunction[result.size()]); }

Target:
static ICPPFunction[] instantiateForFunctionCall(ICPPFunction[] fns, ICPPTemplateArgument[] tmplArgs, List<IType> fnArgs, List<ValueCategory> argCats, boolean withImpliedObjectArg, IASTNode point) { boolean requireTemplate= tmplArgs != null; boolean haveTemplate= false; for (final ICPPFunction func : fns) { if (func instanceof ICPPConstructor || (func instanceof ICPPMethod && ((ICPPMethod) func).isDestructor())) requireTemplate= false; if (func instanceof ICPPFunctionTemplate) { ICPPFunctionTemplate template= (ICPPFunctionTemplate) func; if (containsDependentType(fnArgs)) return new ICPPFunction[] {CPPDeferredFunction.createForCandidates(fns)}; if (requireTemplate && hasDependentArgument(tmplArgs)) return new ICPPFunction[] {CPPDeferredFunction.createForCandidates(fns)}; haveTemplate= true; break; } } if (!haveTemplate && !requireTemplate) return fns; final List<ICPPFunction> result= new ArrayList<ICPPFunction>(fns.length); for (ICPPFunction fn : fns) { if (fn != null) { if (fn instanceof ICPPFunctionTemplate) { ICPPFunctionTemplate fnTmpl= (ICPPFunctionTemplate) fn; ICPPFunction inst = instantiateForFunctionCall(fnTmpl, tmplArgs, fnArgs, argCats, withImpliedObjectArg, point); if (inst != null) result.add(inst); } else if (!requireTemplate || fn instanceof ICPPUnknownBinding) { result.add(fn); } } } return result.toArray(new ICPPFunction[result.size()]); }
Source:
private Set<JoinPath> extractJoinPaths(Set<ColumnProjection> groupByDimensions, Table table) { return resolveProjectedDimensions(groupByDimensions, table).stream() .map(column -> referenceTable.getResolvedJoinPaths(table, column.getName())) .map(Collection::stream) .reduce(Stream.empty(), (s1, s2) -> Streams.concat(s1, s2)) .collect(Collectors.toCollection(LinkedHashSet::new)); }

Target:
private Set<JoinPath> extractJoinPaths(Set<ColumnProjection> groupByDimensions, Table table) { return resolveProjectedDimensions(groupByDimensions, table).stream() .map(column -> referenceTable.getResolvedJoinPaths(table, column.getName())) .flatMap(Collection::stream) .collect(Collectors.toCollection(LinkedHashSet::new)); }
Source:
protected Query doBuild(LuceneSearchPredicateContext context) { if ( !ignoreAnalyzer && overrideAnalyzer == null ) { analyzerChecker.failIfNotCompatible(); } Analyzer analyzer = buildAnalyzer(); Map<String, Float> weights = new LinkedHashMap<>(); for ( String fieldName : fields.keySet() ) { LuceneSimpleQueryStringPredicateBuilderFieldState state = fields.get( fieldName ); Float boost = state.getBoost(); if ( boost == null ) { boost = 1f; } weights.put( fieldName, boost ); } SimpleQueryParser queryParser = new SimpleQueryParser( analyzer, weights, -1 ); queryParser.setDefaultOperator( defaultOperator ); return queryParser.parse( simpleQueryString ); }

Target:
protected Query doBuild(LuceneSearchPredicateContext context) { if ( !ignoreAnalyzer && overrideAnalyzer == null ) { analyzerChecker.failIfNotCompatible(); } Analyzer analyzer = buildAnalyzer(); Map<String, Float> weights = new LinkedHashMap<>(); for ( Map.Entry<String, LuceneSimpleQueryStringPredicateBuilderFieldState> entry : fields.entrySet() ) { LuceneSimpleQueryStringPredicateBuilderFieldState state = entry.getValue(); Float boost = state.getBoost(); if ( boost == null ) { boost = 1f; } weights.put( entry.getKey(), boost ); } SimpleQueryParser queryParser = new SimpleQueryParser( analyzer, weights, -1 ); queryParser.setDefaultOperator( defaultOperator ); return queryParser.parse( simpleQueryString ); }
Source:
private boolean _getAutoTeleportEnabled() { return config.getBoolean("autoteleportenabled", false); }

Target:
private boolean _getAutoTeleportEnabled() { return config.getBoolean("teleportauto", false); }
Source:
public List<ChangeData> queryChanges(final String queryString) throws OrmException, QueryParseException { final Predicate<ChangeData> visibleToMe = queryBuilder.is_visible(); Predicate<ChangeData> s = compileQuery(queryString, visibleToMe); List<ChangeData> results = new ArrayList<ChangeData>(); HashSet<Change.Id> want = new HashSet<Change.Id>(); for (ChangeData d : ((ChangeDataSource) s).read()) { if (d.hasChange()) { if (visibleToMe.match(d)) { results.add(d); } } else { want.add(d.getId()); } } if (!want.isEmpty()) { for (Change c : db.get().changes().get(want)) { ChangeData d = new ChangeData(c); if (visibleToMe.match(d)) { results.add(d); } } } Collections.sort(results, sortkeyAfter != null ? cmpAfter : cmpBefore); int limit = limit(s); if (results.size() > maxLimit) { moreResults = true; } if (limit < results.size()) { results = results.subList(0, limit); } if (sortkeyAfter != null) { Collections.reverse(results); } queryBuilder.release(); return results; }

Target:
public List<ChangeData> queryChanges(final String queryString) throws OrmException, QueryParseException { final Predicate<ChangeData> visibleToMe = queryBuilder.is_visible(); Predicate<ChangeData> s = compileQuery(queryString, visibleToMe); List<ChangeData> results = new ArrayList<ChangeData>(); HashSet<Change.Id> want = new HashSet<Change.Id>(); try { for (ChangeData d : ((ChangeDataSource) s).read()) { if (d.hasChange()) { if (visibleToMe.match(d)) { results.add(d); } } else { want.add(d.getId()); } } if (!want.isEmpty()) { for (Change c : db.get().changes().get(want)) { ChangeData d = new ChangeData(c); if (visibleToMe.match(d)) { results.add(d); } } } Collections.sort(results, sortkeyAfter != null ? cmpAfter : cmpBefore); int limit = limit(s); if (results.size() > maxLimit) { moreResults = true; } if (limit < results.size()) { results = results.subList(0, limit); } if (sortkeyAfter != null) { Collections.reverse(results); } } finally { queryBuilder.release(); } return results; }
Source:
public SlackNotificationException(IOException e) { super("Unable to send a notification to slack error:" + e.getMessage()); }

Target:
public SlackNotificationException(IOException e) { super("Unable to send a notification to slack:" + e.getMessage()); }
Source:
private void processSwitchEvent(List<PilightBindingConfig> configs, Status status) { String type = status.getType(); State state = OnOffType.valueOf(status.getValues().get("state").toUpperCase()); if (type.equals(DeviceType.SWITCH)) { } else if (type.equals(DeviceType.DIMMER)) { BigDecimal dimLevel = BigDecimal.ZERO; if (status.getValues().get("dimlevel") != null) dimLevel = getPercentageFromDimLevel(status.getValues().get("dimlevel")); else { dimLevel = state.equals(OnOffType.ON) ? new BigDecimal("100") : BigDecimal.ZERO; } state = new PercentType(dimLevel); } for (PilightBindingConfig config : configs) eventPublisher.postUpdate(config.getItemName(), state); }

Target:
private void processSwitchEvent(List<PilightBindingConfig> configs, Status status) { String type = status.getType(); State state = OnOffType.valueOf(status.getValues().get("state").toUpperCase()); if (type.equals(DeviceType.SWITCH)) { } else if (type.equals(DeviceType.DIMMER)) { BigDecimal dimLevel = BigDecimal.ZERO; if (status.getValues().get("dimlevel") != null) dimLevel = getPercentageFromDimLevel(status.getValues().get("dimlevel")); else { dimLevel = state.equals(OnOffType.ON) ? new BigDecimal("100") : BigDecimal.ZERO; } state = new PercentType(dimLevel); } for (PilightBindingConfig config : configs) { eventPublisher.postUpdate(config.getItemName(), state); } }
Source:
private String getKey(String liveEnvName) { if (interceptorManager.isPlaybackMode()) { return DUMMY_KEY; } return System.getenv(liveEnvName); }

Target:
private String getKey(String liveEnvName) { if (interceptorManager.isPlaybackMode()) { return DUMMY_KEY; } String key = System.getenv(liveEnvName); assertNotNull(key, "System environment variable " + liveEnvName + "is null"); return key; }
Source:
public ICubeGenerator createCubeGenerator() { if(!(this.worldObj.getWorldType() instanceof ICubicWorldType)){ throw new IllegalStateException("Cubic world provider does not override creageCubeGenerator() and the world type is not ICubicWorldType!"); } return ((ICubicWorldType) this.worldObj.getWorldType()) .createCubeGenerator(getCubicWorld()); }

Target:
public ICubeGenerator createCubeGenerator() { if(!(this.worldObj.getWorldType() instanceof ICubicWorldType)){ throw new IllegalStateException("Cubic world provider does not override createCubeGenerator() and the world type is not ICubicWorldType!"); } return ((ICubicWorldType) this.worldObj.getWorldType()) .createCubeGenerator(getCubicWorld()); }
Source:
public String getCachedString() { final String rv; if (variableData.expression == null || variableData.expression.length() == 0) { rv = "_"; } else if (Double.isNaN(getCachedValue())) { rv = "*"; } else { rv = String.valueOf((int) getCachedValue()); } return rv; }

Target:
private String getCachedString() { final String returnValue; if (variableData.expression == null || variableData.expression.length() == 0) { returnValue = getContext().getString(R.string.empty_equation_result); } else if (Double.isNaN(getCachedValue())) { returnValue = getContext().getString(R.string.equation_error_result); } else { returnValue = String.valueOf((int) getCachedValue()); } return returnValue; }
Source:
public void testMapGenericExecuteMask() { final WinNT.GENERIC_MAPPING mapping = new WinNT.GENERIC_MAPPING(); mapping.genericRead = new DWORD(FILE_GENERIC_READ); mapping.genericWrite = new DWORD(FILE_GENERIC_WRITE); mapping.genericExecute = new DWORD(FILE_GENERIC_EXECUTE); mapping.genericAll = new DWORD(FILE_ALL_ACCESS); final DWORDByReference rights = new DWORDByReference(new DWORD(GENERIC_EXECUTE)); Advapi32.INSTANCE.MapGenericMask(rights, mapping); assertEquals(FILE_GENERIC_EXECUTE, rights.getValue().intValue()); assertTrue(GENERIC_EXECUTE != (rights.getValue().intValue() & GENERIC_EXECUTE)); }

Target:
public void testMapGenericExecuteMask() { final GENERIC_MAPPING mapping = new GENERIC_MAPPING(); mapping.genericRead = new DWORD(FILE_GENERIC_READ); mapping.genericWrite = new DWORD(FILE_GENERIC_WRITE); mapping.genericExecute = new DWORD(FILE_GENERIC_EXECUTE); mapping.genericAll = new DWORD(FILE_ALL_ACCESS); final DWORDByReference rights = new DWORDByReference(new DWORD(GENERIC_EXECUTE)); Advapi32.INSTANCE.MapGenericMask(rights, mapping); assertEquals(FILE_GENERIC_EXECUTE, rights.getValue().intValue()); assertTrue(GENERIC_EXECUTE != (rights.getValue().intValue() & GENERIC_EXECUTE)); }
Source:
private boolean isCustomPage(HttpMessage msg, CustomPage.Type cpType) { if (customPageMap == null) { customPageMap = new HashMap<CustomPage.Type, Boolean>(); } return customPageMap.computeIfAbsent( cpType, k -> customPageMap.put(cpType, context.isCustomPage(msg, cpType))); }

Target:
private boolean isCustomPage(HttpMessage msg, CustomPage.Type cpType) { if (context == null) { return false; } if (customPageMap == null) { customPageMap = new HashMap<CustomPage.Type, Boolean>(); } return customPageMap.computeIfAbsent( cpType, type -> context.isCustomPageWithFallback(msg, type)); }
Source:
public Page getOutput() { if (!fragmentsBlocks.isEmpty()) { Block fragmentsBlock = fragmentsBlocks.poll(); systemMemoryContext.setBytes(getRetainedMemoryBytes()); return createFragmentsPage(fragmentsBlock); } if (!isBlocked().isDone()) { return null; } if (!statisticsAggregationOperator.isFinished()) { verify(statisticsAggregationOperator.isBlocked().isDone(), "aggregation operator should not be blocked"); OperationTimer timer = new OperationTimer(statisticsCpuTimerEnabled); Page page = statisticsAggregationOperator.getOutput(); timer.end(statisticsTiming); if (page == null) { return null; } return createStatisticsPage(types, page, getTableCommitContext(false)); } if (state != State.FINISHING) { return null; } state = State.FINISHED; Page finalPage = createFinalPage(); systemMemoryContext.setBytes(getRetainedMemoryBytes()); return finalPage; }

Target:
public Page getOutput() { if (!fragmentsBlocks.isEmpty()) { Block fragmentsBlock = fragmentsBlocks.poll(); systemMemoryContext.setBytes(getRetainedMemoryBytes()); return createFragmentsPage(fragmentsBlock); } if (!isBlocked().isDone()) { return null; } if (!statisticsAggregationOperator.isFinished()) { verify(statisticsAggregationOperator.isBlocked().isDone(), "aggregation operator should not be blocked"); OperationTimer timer = new OperationTimer(statisticsCpuTimerEnabled); Page page = statisticsAggregationOperator.getOutput(); timer.end(statisticsTiming); if (page == null) { return null; } return createStatisticsPage(types, page, createTableCommitContext(false)); } if (state != State.FINISHING) { return null; } state = State.FINISHED; Page finalPage = createFinalPage(); systemMemoryContext.setBytes(getRetainedMemoryBytes()); return finalPage; }
Source:
public void cleanupVmSnapshotJobs(){ List<AsyncJobVO> jobs = _jobMgr.findFailureAsyncJobs(VmWorkCreateVMSnapshot.class.getName(), VmWorkRevertToVMSnapshot.class.getName()); for (AsyncJobVO job : jobs) { try { if (job.getCmd().equalsIgnoreCase(VmWorkCreateVMSnapshot.class.getName())) { VmWorkCreateVMSnapshot work = VmWorkSerializer.deserialize(VmWorkCreateVMSnapshot.class, job.getCmdInfo()); cleanupVmSnapshotCreateFailure(work.getVmSnapshotId()); } else if(job.getCmd().equalsIgnoreCase(VmWorkRevertToVMSnapshot.class.getName())) { VmWorkRevertToVMSnapshot work = VmWorkSerializer.deserialize(VmWorkRevertToVMSnapshot.class, job.getCmdInfo()); cleanupVmSnapshotRevertFailure(work.getVmSnapshotId()); } } catch (Exception e) { s_logger.debug("clean up job failure, will continue", e); } } }

Target:
public void cleanupVmSnapshotJobs(){ List<AsyncJobVO> jobs = _jobMgr.findFailureAsyncJobs(VmWorkCreateVMSnapshot.class.getName(), VmWorkRevertToVMSnapshot.class.getName()); for (AsyncJobVO job : jobs) { try { if (job.getCmd().equalsIgnoreCase(VmWorkCreateVMSnapshot.class.getName())) { VmWorkCreateVMSnapshot work = VmWorkSerializer.deserialize(VmWorkCreateVMSnapshot.class, job.getCmdInfo()); cleanupVmSnapshotCreateFailure(work.getVmSnapshotId()); } else if(job.getCmd().equalsIgnoreCase(VmWorkRevertToVMSnapshot.class.getName())) { VmWorkRevertToVMSnapshot work = VmWorkSerializer.deserialize(VmWorkRevertToVMSnapshot.class, job.getCmdInfo()); cleanupVmSnapshotRevertFailure(work.getVmSnapshotId()); } } catch (Exception e) { s_logger.error("clean up job failure, will continue", e); } } }
Source:
protected void performCheck() throws Exception { doCheck(videobridge); }

Target:
protected void performCheck() throws Exception { Objects.requireNonNull(videobridge, "No Videobridge service available"); if (MappingCandidateHarvesters.stunDiscoveryFailed) { throw new Exception("Address discovery through STUN failed"); } if (!Harvesters.isHealthy()) { throw new Exception("Failed to bind single-port"); } checkXmppConnection(videobridge); Conference conference = videobridge.createConference(null, null, false, null); try { check(conference); } finally { videobridge.expireConference(conference); } }
Source:
void replay() { synchronized (this) { if (emitting) { missed = true; return; } emitting = true; } Queue<Object> q = queue; for (;;) { Subscriber<? super T> s = subscriber.get(); boolean unlimited = false; if (s != null) { boolean d = done; boolean empty = q.isEmpty(); if (checkTerminated(d, empty, delayError, s)) { return; } long r = get(); unlimited = r == Long.MAX_VALUE; long e = 0L; while (r != 0) { d = done; Object v = q.poll(); empty = v == null; if (checkTerminated(d, empty, delayError, s)) { return; } if (empty) { break; } T value = NotificationLite.getValue(v); try { s.onNext(value); } catch (Throwable ex) { q.clear(); Exceptions.throwIfFatal(ex); s.onError(OnErrorThrowable.addValueAsLastCause(ex, value)); return; } r--; e++; } if (!unlimited && e != 0L) { addAndGet(-e); } } synchronized (this) { if (!missed) { if (unlimited && q.isEmpty()) { caughtUp = true; } emitting = false; return; } missed = false; } } }

Target:
void replay() { synchronized (this) { if (emitting) { missed = true; return; } emitting = true; } Queue<Object> q = queue; boolean delayError = this.delayError; for (;;) { Subscriber<? super T> s = subscriber.get(); boolean unlimited = false; if (s != null) { boolean d = done; boolean empty = q.isEmpty(); if (checkTerminated(d, empty, delayError, s)) { return; } long r = get(); unlimited = r == Long.MAX_VALUE; long e = 0L; while (r != 0) { d = done; Object v = q.poll(); empty = v == null; if (checkTerminated(d, empty, delayError, s)) { return; } if (empty) { break; } T value = NotificationLite.getValue(v); try { s.onNext(value); } catch (Throwable ex) { q.clear(); Exceptions.throwIfFatal(ex); s.onError(OnErrorThrowable.addValueAsLastCause(ex, value)); return; } r--; e++; } if (!unlimited && e != 0L) { addAndGet(-e); } } synchronized (this) { if (!missed) { if (unlimited && q.isEmpty()) { caughtUp = true; } emitting = false; return; } missed = false; } } }
Source:
private StringConverter<Number> ratingLabelFormatter(final List<RatingHistoryDataPoint> dataPoints) { return new StringConverter<Number>() { @Override public String toString(Number object) { int number = object.intValue(); int numberOfDataPoints = dataPoints.size(); int dataPointIndex = number >= numberOfDataPoints ? numberOfDataPoints - 1 : number; return dataPoints.get(dataPointIndex) == null ? "" : DATE_FORMATTER.format(dataPoints.get(dataPointIndex).getInstant()); } @Override public Number fromString(String string) { return null; } }; }

Target:
private StringConverter<Number> ratingLabelFormatter(final List<RatingHistoryDataPoint> dataPoints) { return new StringConverter<Number>() { @Override public String toString(Number object) { int number = object.intValue(); int numberOfDataPoints = dataPoints.size(); int dataPointIndex = number >= numberOfDataPoints ? numberOfDataPoints - 1 : number; if (dataPointIndex >= dataPoints.size() || dataPointIndex < 0) { return ""; } return DATE_FORMATTER.format(dataPoints.get(dataPointIndex).getInstant()); } @Override public Number fromString(String string) { return null; } }; }
Source:
private static Map<String, String> extractMetadata(Map<Utf8, Utf8> metadata) { if (metadata == null) { return Collections.EMPTY_MAP; } return metadata.entrySet() .stream() .collect(Collectors.toMap( entry -> entry.getKey().toString(), entry -> entry.getValue().toString() )); }

Target:
private Map<String, String> extractMetadata(Map<Utf8, Utf8> metadata) { return Optional.ofNullable(metadata).orElse(Collections.emptyMap()) .entrySet() .stream() .collect(Collectors.toMap( entry -> entry.getKey().toString(), entry -> entry.getValue().toString() )); }
Source:
private Mutation createDelMutation(String path, String cf, String cq, String val) { Text row = new Text(MetadataSchema.DeletesSection.getRowPrefix() + SortSkew.getCode(path) + path); Mutation delFlag = new Mutation(row); delFlag.put(cf, cq, val); return delFlag; }

Target:
private Mutation createDelMutation(String path, String cf, String cq, String val) { Text row = new Text(MetadataSchema.DeletesSection.encodeRow(path)); Mutation delFlag = new Mutation(row); delFlag.put(cf, cq, val); return delFlag; }
Source:
protected V failoverExecution(final Exception cause, long timeout, TimeUnit unit) throws Exception { final List<Address> executionCandidates = executionCandidates(getOwningTask()); FailoverContext fc = new FailoverContext() { @Override public <K> List<K> inputKeys() { return (List<K>) getInputKeys(); } @Override public Address executionFailureLocation() { return getExecutionTarget(); } @Override public List<Address> executionCandidates() { return executionCandidates; } @Override public Throwable cause() { return cause; } }; Address target = getOwningTask().getTaskFailoverPolicy().failover(fc); log.warnf("Distributed task failed at %s due to %s and is failing over to be executed at %s", getExecutionTarget(), cause, target); DistributedTaskPart<V> part = createDistributedTaskPart(owningTask, distCommand, getInputKeys(), target, failedOverCount); part.execute(); return part.get(timeout, unit); }

Target:
protected V failoverExecution(final Exception cause, long timeout, TimeUnit unit) throws Exception { final List<Address> executionCandidates = executionCandidates(getOwningTask()); FailoverContext fc = new FailoverContext() { @Override public <K> List<K> inputKeys() { return (List<K>) getInputKeys(); } @Override public Address executionFailureLocation() { return getExecutionTarget(); } @Override public List<Address> executionCandidates() { return executionCandidates; } @Override public Throwable cause() { return cause; } }; Address failoverTarget = getOwningTask().getTaskFailoverPolicy().failover(fc); log.distributedTaskFailover(fc.executionFailureLocation(), failoverTarget, cause); DistributedTaskPart<V> part = createDistributedTaskPart(owningTask, distCommand, getInputKeys(), failoverTarget, failedOverCount); part.execute(); return part.get(timeout, unit); }
Source:
public String getMessage() { if (this.getCause() == null) { return super.getMessage(); } else if (this.getCause() instanceof QueryInterruptedException){ return this.getMessage(); } else if (this.getCause() instanceof InterruptedException) { return QUERY_INTERRUPTED; } else if (this.getCause() instanceof CancellationException) { return QUERY_CANCELLED; } else if (this.getCause() instanceof TimeoutException) { return QUERY_TIMEOUT; } else { return UNKNOWN_EXCEPTION; } }

Target:
public String getMessage() { if (this.getCause() == null) { return super.getMessage(); } else if (this.getCause() instanceof QueryInterruptedException) { return getCause().getMessage(); } else if (this.getCause() instanceof InterruptedException) { return QUERY_INTERRUPTED; } else if (this.getCause() instanceof CancellationException) { return QUERY_CANCELLED; } else if (this.getCause() instanceof TimeoutException) { return QUERY_TIMEOUT; } else { return UNKNOWN_EXCEPTION; } }
Source:
public ResponseData build() { final ResponseData rtuResponseData = new ResponseData(this.organisationIdentification, this.messageType, this.deviceIdentification, this.correlationUid, this.resultType, this.messageData); return rtuResponseData; }

Target:
public ResponseData build() { return new ResponseData(this.organisationIdentification, this.messageType, this.deviceIdentification, this.correlationUid, this.resultType, this.messageData); }
Source:
private boolean mkdir(Path path) throws IOException { String key = pathToKey(path); adapter.createDirectory(key); return true; }

Target:
private boolean mkdir(Path path) throws IOException { String key = pathToKey(path); return adapter.createDirectory(key); }
Source:
private static void assertNoTCCL() { ClassLoader tccl = Thread.currentThread().getContextClassLoader(); if (tccl instanceof ModuleClassLoader) { Assert.assertNull("TCCL is null", tccl); } }

Target:
private static void assertNoTCCL() { ClassLoader tccl = Thread.currentThread().getContextClassLoader(); Assert.assertFalse("TCCL not ModuleClassLoader: " + tccl, tccl instanceof ModuleClassLoader); }
Source:
public int[] borrowIntArray(int positionCount) { checkState(borrowedIntArrays.size() < maxOutstandingArrays, "Requested too many arrays: %s", borrowedIntArrays.size()); while (!intArrays.isEmpty() && intArrays.peek().length < positionCount) { int[] popped = intArrays.pop(); estimatedSizeInBytes -= sizeOf(popped); } int[] array; if (intArrays.isEmpty()) { array = new int[positionCount]; estimatedSizeInBytes += sizeOf(array); } else { array = intArrays.pop(); } checkState(borrowedIntArrays.add(array), "Attempted to borrow array which was already borrowed"); return array; }

Target:
public int[] borrowIntArray(int positionCount) { checkState(borrowedIntArrays.size() < maxOutstandingArrays, "Requested too many arrays: %s", borrowedIntArrays.size()); int[] array; while (!intArrays.isEmpty() && intArrays.peek().length < positionCount) { array = intArrays.pop(); estimatedSizeInBytes -= sizeOf(array); } if (intArrays.isEmpty()) { array = new int[positionCount]; estimatedSizeInBytes += sizeOf(array); } else { array = intArrays.pop(); } verify(borrowedIntArrays.add(array), "Attempted to borrow array which was already borrowed"); return array; }
Source:
public String getProperty(String key) { return (String) value.get(key); }

Target:
public String getProperty(String key) { return value.get(key); }
Source:
public void run() { Long rescheduleAt = handler.tick(false); scheduledFutureRef.getAndUpdate(value -> { if (value != null) { if (rescheduleAt == null) { return scheduledPool.schedule(scheduleRunnable, 10, TimeUnit.MILLISECONDS); } else if (rescheduleAt != 0) { return scheduledPool.schedule(scheduleRunnable, rescheduleAt - TimeUnit.NANOSECONDS.toMillis(System.nanoTime()), TimeUnit.MILLISECONDS); } } return value; }); }

Target:
public void run() { Long rescheduleAt = handler.tick(false); if (rescheduleAt == null) { scheduleOp.setDelay(10); scheduledFutureRef.getAndUpdate(scheduleOp); } else if (rescheduleAt != 0) { scheduleOp.setDelay(rescheduleAt - TimeUnit.NANOSECONDS.toMillis(System.nanoTime())); scheduledFutureRef.getAndUpdate(scheduleOp); } }
Source:
public final LogResult postLog(final Geocache cache, final LogType logType, final Calendar date, final String log, final String logPassword, final List<TrackableLog> trackableLogs) { final LogResult result = ECApi.postLog(cache, logType, date, log); return result; }

Target:
public final LogResult postLog(final Geocache cache, final LogType logType, final Calendar date, final String log, final String logPassword, final List<TrackableLog> trackableLogs) { return ECApi.postLog(cache, logType, date, log); }
Source:
public void testMapInt32ToPrestoInteger() { PrimitiveType intType = new PrimitiveType(OPTIONAL, PrimitiveType.PrimitiveTypeName.INT32, "int_col", OriginalType.INT_32); ColumnDescriptor columnDescriptor = new ColumnDescriptor(new String[]{"int_col"}, PrimitiveType.PrimitiveTypeName.INT32, 0, 1); RichColumnDescriptor intColumn = new RichColumnDescriptor(columnDescriptor, intType); assertEquals(ParquetTypeUtils.getPrestoType(TupleDomain.all(), intColumn), INTEGER); }

Target:
public void testMapInt32ToPrestoInteger() { PrimitiveType intType = new PrimitiveType(OPTIONAL, PrimitiveTypeName.INT32, "int_col", OriginalType.INT_32); ColumnDescriptor columnDescriptor = new ColumnDescriptor(new String[]{"int_col"}, PrimitiveTypeName.INT32, 0, 1); RichColumnDescriptor intColumn = new RichColumnDescriptor(columnDescriptor, intType); assertEquals(getPrestoType(TupleDomain.all(), intColumn), INTEGER); }
Source:
public void configurePipeline(PipelineConfigurer pipelineConfigurer) { Preconditions.checkArgument(!Strings.isNullOrEmpty(config.schema), "Schema must be specified."); try { Schema schema = Schema.parseJson(config.schema); pipelineConfigurer.getStageConfigurer().setOutputSchema(schema); } catch (Exception e) { throw new IllegalArgumentException("Invalid input schema: " + e.getMessage(), e); } }

Target:
public void configurePipeline(PipelineConfigurer pipelineConfigurer) { Preconditions.checkArgument(!Strings.isNullOrEmpty(config.schema), "Schema must be specified."); try { Schema schema = Schema.parseJson(config.schema); pipelineConfigurer.getStageConfigurer().setOutputSchema(schema); } catch (Exception e) { throw new IllegalArgumentException("Invalid output schema: " + e.getMessage(), e); } }
Source:
public Principal getUserPrincipal() { if (subject == null || subject.getPrincipals().isEmpty()) return null; return subject.getPrincipals().iterator().next(); }

Target:
public Principal getUserPrincipal() { if (subject == null || subject.getPrincipals().isEmpty()) { return null; } return subject.getPrincipals().iterator().next(); }
Source:
public void execute() { Resource umlResource = UmlUtils.getUmlModel(modelSet).getResource(); model = (org.eclipse.uml2.uml.Model) umlResource.getContents().get(0); URI qudvURI = URI.createURI(SysMLResource.QUDV_LIBRARY_PATH).appendFragment("QUDV"); qudv = modelSet.getEObject(qudvURI, true); this.getCommandStack(modelSet).execute(new RecordingCommand(modelSet.getTransactionalEditingDomain()) { @Override protected void doExecute() { PackageImport importPrimitivePack = model.createPackageImport((org.eclipse.uml2.uml.Package) qudv); if (!model.getPackageImports().contains(importPrimitivePack)) { model.getPackageImports().add(importPrimitivePack); } try { model.eResource().save(Collections.EMPTY_MAP); } catch (IOException e) { Activator.getLogHelper().error(e); } } }); }

Target:
public void execute() { Resource umlResource = UmlUtils.getUmlModel(modelSet).getResource(); root = (org.eclipse.uml2.uml.Package) umlResource.getContents().get(0); URI qudvURI = URI.createURI(SysMLResource.QUDV_LIBRARY_PATH).appendFragment(SysMLResource.QUDV_LIBRARY_ROOT_ID); qudv = (org.eclipse.uml2.uml.Package) modelSet.getEObject(qudvURI, true); this.getCommandStack(modelSet).execute(new RecordingCommand(modelSet.getTransactionalEditingDomain()) { @Override protected void doExecute() { PackageImport importPrimitivePack = root.createPackageImport(qudv); if (!root.getPackageImports().contains(importPrimitivePack)) { root.getPackageImports().add(importPrimitivePack); } try { root.eResource().save(Collections.EMPTY_MAP); } catch (IOException e) { Activator.getLogHelper().error(e); } } }); }
Source:
public byte[] encodeMessage(EhcacheEntityMessage message) { return message.encode(); }

Target:
public byte[] encodeMessage(EhcacheEntityMessage message) { if (message.getType() == EhcacheEntityMessage.Type.LIFECYCLE_OP) { return lifeCycleMessageCodec.encode((LifecycleMessage) message); } else { return serverStoreOpCodec.encode((ServerStoreOpMessage) message); } }
Source:
@Override public void initialize(InputSplit split, TaskAttemptContext context) throws IOException, InterruptedException { final PhoenixMultiViewInputSplit pSplit = (PhoenixMultiViewInputSplit)split; final List<ViewInfoWritable> viewInfoTracker = pSplit.getViewInfoTrackerList(); it = viewInfoTracker.iterator(); }

Target:
@Override public void initialize(InputSplit split, TaskAttemptContext context) throws IOException { if (split instanceof PhoenixMultiViewInputSplit) { final PhoenixMultiViewInputSplit pSplit = (PhoenixMultiViewInputSplit)split; final List<ViewInfoWritable> viewInfoTracker = pSplit.getViewInfoTrackerList(); it = viewInfoTracker.iterator(); } else { LOGGER.error("InputSplit class cannot cast to PhoenixMultiViewInputSplit."); throw new IOException("InputSplit class cannot cast to PhoenixMultiViewInputSplit"); } }