auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private String nodeNamesMapper(final Node<View, Edge> node) { if (node.getContent().getDefinition() instanceof NamedElement) { NamedElement namedElement = (NamedElement) node.getContent().getDefinition(); return namedElement.getName().getValue(); } if (node.getContent().getDefinition() instanceof HasText) { HasText hasText = (HasText) node.getContent().getDefinition(); return hasText.getText().getValue(); } return null; }

Target:
private String nodeNamesMapper(final Node<View, Edge> node) { if (node.getContent().getDefinition() instanceof NamedElement) { final NamedElement namedElement = (NamedElement) node.getContent().getDefinition(); return namedElement.getName().getValue(); } if (node.getContent().getDefinition() instanceof HasText) { final HasText textWrapper = (HasText) node.getContent().getDefinition(); return textWrapper.getText().getValue(); } return null; }
Source:
synchronized IndexReference syncGetIndexSearcher( IndexIdentifier identifier ) { try { IndexReference indexReference = indexSearchers.get( identifier ); if ( indexReference == null ) { indexReference = indexReferenceFactory.createIndexReference( identifier ); indexSearchers.put( identifier, indexReference ); HashMap<String,DocValuesType> fieldTypes = new HashMap<>(); for ( LeafReaderContext leafReaderContext : indexReference.getSearcher().getTopReaderContext().leaves() ) { for ( FieldInfo fieldInfo : leafReaderContext.reader().getFieldInfos() ) { fieldTypes.put( fieldInfo.name, fieldInfo.getDocValuesType() ); } } indexTypeMap.put( identifier, fieldTypes ); } else { if ( !readOnly ) { synchronized ( indexReference ) { indexReference = refreshSearcherIfNeeded( indexReference ); } } } indexReference.incRef(); return indexReference; } catch ( IOException e ) { throw new RuntimeException( e ); } }

Target:
synchronized IndexReference syncGetIndexSearcher( IndexIdentifier identifier ) { try { IndexReference indexReference = indexSearchers.get( identifier ); if ( indexReference == null ) { indexReference = indexReferenceFactory.createIndexReference( identifier ); indexSearchers.put( identifier, indexReference ); ConcurrentHashMap<String,DocValuesType> fieldTypes = new ConcurrentHashMap<>(); for ( LeafReaderContext leafReaderContext : indexReference.getSearcher().getTopReaderContext().leaves() ) { for ( FieldInfo fieldInfo : leafReaderContext.reader().getFieldInfos() ) { fieldTypes.put( fieldInfo.name, fieldInfo.getDocValuesType() ); } } indexTypeMap.put( identifier, fieldTypes ); } else { if ( !readOnly ) { synchronized ( indexReference ) { indexReference = refreshSearcherIfNeeded( indexReference ); } } } indexReference.incRef(); return indexReference; } catch ( IOException e ) { throw new RuntimeException( e ); } }
Source:
private void initFieldsMetaData(TypeSymbol classSymbol) { fieldsReadOnAnotherInstance = FieldsReadOnAnotherInstanceVisitor.getFrom(classSymbol); for (Symbol memberSymbol : classSymbol.memberSymbols()) { if (memberSymbol.isMethodSymbol() && memberSymbol.declaration() != null) { MethodTree methodTree = (MethodTree) memberSymbol.declaration(); if (methodTree.block() != null) { CFG cfg = CFG.build(methodTree); LiveVariables liveVariables = LiveVariables.analyze(cfg, true); fieldsLiveInMethodEntryPerMethod.put(methodTree, liveVariables.getIn(cfg.entry())); } } } }

Target:
private void initFieldsMetaData(TypeSymbol classSymbol) { fieldsReadOnAnotherInstance = FieldsReadOnAnotherInstanceVisitor.getFrom(classSymbol); for (Symbol memberSymbol : classSymbol.memberSymbols()) { if (memberSymbol.isMethodSymbol() && memberSymbol.declaration() != null) { MethodTree methodTree = (MethodTree) memberSymbol.declaration(); if (methodTree.block() != null) { CFG cfg = CFG.build(methodTree); LiveVariables liveVariables = LiveVariables.analyzeWithFields(cfg); fieldsLiveInMethodEntry.addAll(liveVariables.getIn(cfg.entry())); } } } }
Source:
protected JdbcSourceConnectorConfig sourceConfigWithUrl( String url, String... propertyPairs ) { Map<String, String> connProps = new HashMap<>(); connProps.put(JdbcSourceConnectorConfig.MODE_CONFIG, JdbcSourceConnectorConfig.MODE_BULK); connProps.put(JdbcSourceConnectorConfig.TOPIC_PREFIX_CONFIG, "test-"); connProps.putAll(propertiesFromPairs(propertyPairs)); connProps.put(JdbcSourceConnectorConfig.CONNECTION_URL_CONFIG, url); if (quoteTableNames != null) { connProps.put( JdbcSourceConnectorConfig.QUOTE_TABLE_NAMES_CONFIG, quoteTableNames.toString() ); } if (quoteColumnNames != null) { connProps.put( JdbcSourceConnectorConfig.QUOTE_COLUMN_NAMES_CONFIG, quoteColumnNames.toString() ); } return new JdbcSourceConnectorConfig(connProps); }

Target:
protected JdbcSourceConnectorConfig sourceConfigWithUrl( String url, String... propertyPairs ) { Map<String, String> connProps = new HashMap<>(); connProps.put(JdbcSourceConnectorConfig.MODE_CONFIG, JdbcSourceConnectorConfig.MODE_BULK); connProps.put(JdbcSourceConnectorConfig.TOPIC_PREFIX_CONFIG, "test-"); connProps.putAll(propertiesFromPairs(propertyPairs)); connProps.put(JdbcSourceConnectorConfig.CONNECTION_URL_CONFIG, url); if (quoteIdentfiiers != null) { connProps.put("quote.sql.identifiers", quoteIdentfiiers.toString()); } return new JdbcSourceConnectorConfig(connProps); }
Source:
public Job copyAs(CopyRequest request) { return execute(RefactoringJobs.COPY, request); }

Target:
public Job copyAs(CopyRequest request) { return execute(RefactoringJobs.COPY_AS, request); }
Source:
public void printCertificates() { DefaultTable table = new DefaultTable(); for (int i = 0; i < table.rowCount(); i++) { System.out.println("On index " + i + " is : " + table.getItem(i).getText(1)); } }

Target:
public void printCertificates() { DefaultTable table = new DefaultTable(); for (int i = 0; i < table.rowCount(); i++) { log.info("On index " + i + " is : " + table.getItem(i).getText(1)); } }
Source:
public ASTValue eval(WordsEnvironment environment) throws WordsRuntimeException { ASTValue referenceObject = children.get(0).eval(environment); ASTValue identifier = children.get(1).eval(environment); AST lengthExpression = children.get(2); ASTValue doNow = children.get(3) != null ? children.get(3).eval(environment) : null; WordsObject object; if (referenceObject.type.equals(ASTValue.ValueType.OBJ)){ WordsProperty property = referenceObject.objValue.getProperty(identifier.stringValue); if (property.type != WordsProperty.PropertyType.OBJECT) { throw new WordsInvalidTypeException(ASTValue.ValueType.OBJ.toString(), property.type.toString()); } object = property.objProperty; } else { object = environment.getObject(identifier.stringValue); } if (object == null) { throw new WordsObjectNotFoundException(identifier.stringValue); } WordsWait action = new WordsWait(lengthExpression); if (doNow == null) { object.enqueueAction(action); } else { object.enqueueActionAtFront(action); } return null; }

Target:
public ASTValue eval(WordsEnvironment environment) throws WordsRuntimeException { ASTValue referenceObject = children.get(0).eval(environment); ASTValue identifier = children.get(1).eval(environment); AST lengthExpression = children.get(2); ASTValue doNow = children.get(3) != null ? children.get(3).eval(environment) : null; WordsObject object; if (referenceObject.type.equals(ASTValue.ValueType.OBJ)){ WordsProperty property = referenceObject.objValue.getProperty(identifier.stringValue); if (property.type != WordsProperty.PropertyType.OBJECT) { throw new WordsInvalidTypeException(ASTValue.ValueType.OBJ.toString(), property.type.toString()); } object = property.objProperty; } else { object = environment.getObject(identifier.stringValue); } WordsWait action = new WordsWait(lengthExpression); if (doNow == null) { object.enqueueAction(action); } else { object.enqueueActionAtFront(action); } return null; }
Source:
public void childContextAdded(VElement parentElement, EMFFormsViewContext childContext) { final EMFFormsSettingToControlMapper mapper = childContext.getService(EMFFormsSettingToControlMapper.class); validate(getAllEObjectsToValidate(mapper)); }

Target:
public void childContextAdded(VElement parentElement, EMFFormsViewContext childContext) { validate(getAllEObjectsToValidate()); }
Source:
public void createInstantiator() { Instantiator<Object> objectInstantiator = new ObjectInstantiator(this, provider, parameterNameProvider); if (!instantiateNullParameters()) { objectInstantiator = new NullDecorator(objectInstantiator); } List<Instantiator<?>> instantiatorList = ImmutableList.of( new RequestAttributeInstantiator(request), new VRaptorTypeConverter(converters), FallbackConverter.fallbackToNull(new StringConverter()), new ArrayAdapter(new ArrayInstantiator(this)), new NullDecorator(new ListInstantiator(this)), new NullDecorator(new SetInstantiator(this)), new DependencyInstantiator(), objectInstantiator); multiInstantiator = new MultiInstantiator(instantiatorList); }

Target:
public void createInstantiator() { Instantiator<Object> objectInstantiator = new ObjectInstantiator(this, provider, parameterNameProvider); if (useNullForMissingParameters()) { objectInstantiator = new NullDecorator(objectInstantiator); } List<Instantiator<?>> instantiatorList = ImmutableList.of( new RequestAttributeInstantiator(request), new VRaptorTypeConverter(converters), FallbackConverter.fallbackToNull(new StringConverter()), new ArrayAdapter(new ArrayInstantiator(this)), new NullDecorator(new ListInstantiator(this)), new NullDecorator(new SetInstantiator(this)), new DependencyInstantiator(), objectInstantiator); multiInstantiator = new MultiInstantiator(instantiatorList); }
Source:
public Optional<DeviceData> getMostRecent(final Long accountId, final String externalDeviceId, final DateTime maxTsLimit, final DateTime minTsLimit) { final Expression keyConditionExpression = Expressions.and( Expressions.equals(DeviceDataAttribute.ACCOUNT_ID, toAttributeValue(accountId)), Expressions.between(DeviceDataAttribute.RANGE_KEY, getRangeKey(minTsLimit, externalDeviceId), getRangeKey(maxTsLimit, externalDeviceId))); final Expression filterExpression = Expressions.contains(DeviceDataAttribute.RANGE_KEY, toAttributeValue(externalDeviceId)); final Collection<DeviceDataAttribute> attributes = ALL_ATTRIBUTES; final List<String> tableNames = getTableNames(minTsLimit, maxTsLimit); final Optional<Map<String, AttributeValue>> result = getLatest(tableNames, keyConditionExpression, filterExpression, attributes); if (result.isPresent()) { return Optional.of(attributeMapToDeviceData(result.get())); } else { return Optional.absent(); } }

Target:
public Optional<DeviceData> getMostRecent(final Long accountId, final String externalDeviceId, final DateTime maxTsLimit, final DateTime minTsLimit) { final Expression keyConditionExpression = Expressions.and( Expressions.equals(DeviceDataAttribute.ACCOUNT_ID, toAttributeValue(accountId)), Expressions.between(DeviceDataAttribute.RANGE_KEY, getRangeKey(minTsLimit, externalDeviceId), getRangeKey(maxTsLimit, externalDeviceId))); final Expression filterExpression = Expressions.contains(DeviceDataAttribute.RANGE_KEY, toAttributeValue(externalDeviceId)); final Collection<DeviceDataAttribute> attributes = ALL_ATTRIBUTES; final List<String> tableNames = getTableNames(minTsLimit, maxTsLimit); final Optional<Map<String, AttributeValue>> result = getLatest(tableNames, keyConditionExpression, filterExpression, attributes); if (result.isPresent()) { return Optional.of(attributeMapToDeviceData(result.get())); } return Optional.absent(); }
Source:
public void addIssue() { IssuesLabelService.addIssue(IssueLabelListActivity.this, getRootLayout(), mRepoOwner, mRepoName, mLabel.editedName, mLabel.editedColor) .doOnError(error -> { mAdapter.remove(mAddedLabel); mAddedLabel = null; }) .subscribe(result -> { forceLoaderReload(0); mAddedLabel = null; setResult(RESULT_OK); }, e -> {}); }

Target:
private void addIssue() { IssuesLabelService.addIssue( IssueLabelListActivity.this, mRepoOwner, mRepoName, mLabel.editedName, mLabel.editedColor ).subscribe(result -> { forceLoaderReload(0); mAddedLabel = null; setResult(RESULT_OK); }, error -> { mAdapter.remove(mAddedLabel); mAddedLabel = null; }); }
Source:
public void visitNode(Tree tree) { if (!hasSemantic()) { return; } ExpressionTree statement = ((ExpressionStatementTree) tree).expression(); if (statement.is(Kind.METHOD_INVOCATION)) { ExpressionTree methodSelect = ((MethodInvocationTree) statement).methodSelect(); if (methodSelect.is(Kind.MEMBER_SELECT)) { MethodSymbol symbol = (MethodSymbol) getSemanticModel().getReference(((MemberSelectExpressionTree) methodSelect).identifier()); if (symbol != null && symbol.owner().type().isSubtypeOf("java.io.InputStream") && (isRead(symbol) || isSkip(symbol))) { addIssue(methodSelect, "Check the return value of the \"" + symbol.name() + "\" call to see how many bytes were read."); } } } }

Target:
public void visitNode(Tree tree) { if (!hasSemantic()) { return; } ExpressionTree statement = ((ExpressionStatementTree) tree).expression(); if (statement.is(Kind.METHOD_INVOCATION)) { Symbol symbol = ((MethodInvocationTreeImpl) statement).getSymbol(); if (symbol.isMethodSymbol()) { checkMethod(statement, (MethodSymbol) symbol); } } }
Source:
public void coverage() { FixedCouponBondTrade test1 = FixedCouponBondTrade.builder() .securityLink(SECURITY_LINK_RESOLVED) .tradeInfo(TRADE_INFO) .quantity(QUANTITY) .payment(UPFRONT_PAYMENT) .build(); coverImmutableBean(test1); FixedCouponBondTrade test2 = FixedCouponBondTrade.builder() .securityLink(SecurityLink.resolved(UnitSecurity.builder(PRODUCT) .standardId(StandardId.of("Ticker", "GOV1-BND1")) .build())) .quantity(100L) .payment(Payment.of(CurrencyAmount.of(EUR, NOTIONAL * 0.05), SETTLEMENT_DATE)) .build(); coverBeanEquals(test1, test2); }

Target:
public void coverage() { FixedCouponBondTrade test1 = FixedCouponBondTrade.builder() .securityLink(SECURITY_LINK_RESOLVED) .tradeInfo(TRADE_INFO) .quantity(QUANTITY) .payment(UPFRONT_PAYMENT) .build(); coverImmutableBean(test1); FixedCouponBondTrade test2 = FixedCouponBondTrade.builder() .securityLink(SecurityLink.resolved(UnitSecurity.builder(PRODUCT) .standardId(StandardId.of("Ticker", "GOV1-BND1")) .build())) .quantity(100L) .payment(Payment.of(CurrencyAmount.of(EUR, -NOTIONAL * QUANTITY * 0.99), SETTLEMENT_DATE)) .build(); coverBeanEquals(test1, test2); }
Source:
public void elevatedAccessEvent(ElevatedAccessEvent elevatedAccessEvent) { ImmutableSet.Builder<ListenableFuture<Void>> builder = ImmutableSet.builder(); for (final SingularityEventSender eventListener : eventListeners) { builder.add( listenerExecutorService.submit( new Callable<Void>() { @Override public Void call() { eventListener.elevatedAccessEvent(elevatedAccessEvent); return null; } } ) ); } processFutures(builder.build()); }

Target:
public void elevatedAccessEvent(ElevatedAccessEvent elevatedAccessEvent) { ImmutableSet.Builder<ListenableFuture<Void>> builder = ImmutableSet.builder(); for (final SingularityEventSender eventListener : eventListeners) { builder.add( listenerExecutorService.submit( () -> { eventListener.elevatedAccessEvent(elevatedAccessEvent); return null; } ) ); } processFutures(builder.build()); }
Source:
private static boolean isBinaryValid(CallExpression callExpression) { return callExpression.getChildren().size() == 2 && ((callExpression.getChildren().get(0) instanceof FieldReferenceExpression && callExpression.getChildren().get(1) instanceof ValueLiteralExpression) || (callExpression.getChildren().get(0) instanceof ValueLiteralExpression && callExpression.getChildren().get(1) instanceof FieldReferenceExpression)); }

Target:
private static boolean isBinaryValid(CallExpression callExpression) { return callExpression.getChildren().size() == 2 && ( isRef(callExpression.getChildren().get(0)) && isLit(callExpression.getChildren().get(1)) || isLit(callExpression.getChildren().get(0)) && isRef(callExpression.getChildren().get(1)) ); }
Source:
public Enum canOpen() { if (isModified()) { int userChoice = JOptionPane.showConfirmDialog(this, "This document has been modified. Do you want to save it first?", "Save document", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); if (userChoice == JOptionPane.YES_OPTION) { return CanOpenState.SAVE_AND_OPEN; } else if (userChoice == JOptionPane.NO_OPTION) { return CanOpenState.OPEN; } else { return CanOpenState.CANCEL; } } else { return CanOpenState.OPEN; } }

Target:
public UnsavedWorkState canOpen() { if (isModified() && !isPreviewDisplayed()) { int userChoice = JOptionPane.showConfirmDialog(this, "This document has been modified. Do you want to save it first?", "Save document", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); if (userChoice == JOptionPane.YES_OPTION) { return UnsavedWorkState.SAVE_AND_OPEN; } else if (userChoice == JOptionPane.NO_OPTION) { return UnsavedWorkState.OPEN; } else { return UnsavedWorkState.CANCEL; } } else { return UnsavedWorkState.OPEN; } }
Source:
public void setupTestRepos() throws Exception { final RepositoryMock snapshotRepoMock = createSnapshotRepo(); final DefaultUnzipRepository unzipRepo = createUnzipRepo(snapshotRepoMock); snapshotRepoUnzipCache = unzipRepo.getCache(); Assert.assertNotNull(snapshotRepoUnzipCache.getRepository().getRepositoryItemUidAttributeManager()); oldZip = snapshotRepoUnzipCache.getArchive(PATH_TO_OLD_ZIP); Assert.assertNotNull(snapshotRepoUnzipCache.getRepository().getRepositoryItemUidAttributeManager()); oldOtherzip = snapshotRepoUnzipCache.getArchive(PATH_TO_OLD_OTHER_ZIP); latestOtherZip = snapshotRepoUnzipCache.getArchive(PATH_TO_LATEST_OTHER_ZIP); Assert.assertTrue(oldOtherzip.exists()); Assert.assertTrue(oldZip.exists()); Assert.assertTrue(latestOtherZip.exists()); }

Target:
public void setupTestRepos() throws Exception { final RepositoryMock snapshotRepoMock = createSnapshotRepo(); final DefaultUnzipRepository unzipRepo = createUnzipRepo(snapshotRepoMock); snapshotRepoUnzipCache = unzipRepo.getCache(); Assert.assertNotNull(snapshotRepoUnzipCache.repository.getRepositoryItemUidAttributeManager()); oldZip = snapshotRepoUnzipCache.getArchive(PATH_TO_OLD_ZIP); Assert.assertNotNull(snapshotRepoUnzipCache.repository.getRepositoryItemUidAttributeManager()); oldOtherzip = snapshotRepoUnzipCache.getArchive(PATH_TO_OLD_OTHER_ZIP); latestOtherZip = snapshotRepoUnzipCache.getArchive(PATH_TO_LATEST_OTHER_ZIP); Assert.assertTrue(oldOtherzip.exists()); Assert.assertTrue(oldZip.exists()); Assert.assertTrue(latestOtherZip.exists()); }
Source:
protected void onActivityResult(int requestCode,int resultCode,Intent capturedData){ if(requestCode == REQUEST_IMAGE_CAPTURE && resultCode == RESULT_OK){ new CheckAvailableSpaceTask(getCapturedImageFile().getAbsolutePath()).execute(); } else if(requestCode == REQUEST_IMAGE_CAPTURE && resultCode == RESULT_CANCELED){ if(image != null){ image.delete(); Log_OC.d(TAG,getResources().getString(R.string.file_deleted)); } setResult(RESULT_CANCELED); finish(); } else if(resultCode == RESULT_CANCELED){ setResult(RESULT_CANCELED); finish(); } }

Target:
protected void onActivityResult(int requestCode,int resultCode,Intent capturedData){ if(requestCode == REQUEST_IMAGE_CAPTURE && resultCode == RESULT_OK){ new CheckAvailableSpaceTask(getCapturedImageFile().getAbsolutePath()).execute(); } else if(requestCode == REQUEST_IMAGE_CAPTURE && resultCode == RESULT_CANCELED){ if(image != null){ image.delete(); Log_OC.d(TAG,"File deleted"); } setResult(RESULT_CANCELED); finish(); } else if(resultCode == RESULT_CANCELED){ setResult(RESULT_CANCELED); finish(); } }
Source:
private static GoAssignmentStatement getValidAssignmentParent(@Nullable PsiElement element) { return ObjectUtils.nullizeByCondition(PsiTreeUtil.getNonStrictParentOfType(element, GoAssignmentStatement.class), assignment -> assignment == null || !assignment.isValid() || !isAssignmentEqualsSized(assignment)); }

Target:
private static GoAssignmentStatement getValidAssignmentParent(@Nullable PsiElement element) { GoAssignmentStatement assignment = PsiTreeUtil.getNonStrictParentOfType(element, GoAssignmentStatement.class); return assignment != null && assignment.isValid() && isAssignmentEqualsSized(assignment) ? assignment : null; }
Source:
public GraphService(Class<T> type) { this.type = type; }

Target:
protected GraphService(Class<T> type) { this.type = type; }
Source:
public void subscribe(Pattern pattern) { delegate.subscribe(pattern, new ConsumerRebalanceListener() { @Override public void onPartitionsRevoked(Collection<TopicPartition> partitions) @Override public void onPartitionsAssigned(Collection<TopicPartition> partitions) }); }

Target:
public void subscribe(Pattern pattern) { delegate.subscribe(pattern, NO_OP_CONSUMER_REBALANCE_LISTENER); }
Source:
@Override public void accept(List<Span> spans, final Callback<Void> callback) { StringBuilder request = new StringBuilder(); for (Span s : spans) { createSpanIndexRequest(s, request); } HttpEntity entity = new NStringEntity(request.toString(), ContentType.APPLICATION_JSON); client.performRequest("POST", "/_bulk", Collections.<String, String>emptyMap(), entity, new ResponseListener() { @Override public void onSuccess(Response response) { callback.onSuccess(null); } @Override public void onFailure(Exception e) { callback.onError(e); } }); }

Target:
@Override public void accept(List<Span> spans, final Callback<Void> callback) { Buffer body = new Buffer(); try { for (Span s : spans) indexSpan(s, body); } catch (IOException e) { callback.onError(e); return; } Call post = client.newCall(new Request.Builder() .url(baseUrl.resolve("/_bulk")) .post(RequestBody.create(APPLICATION_JSON, body.readByteString())).build()); post.enqueue(new okhttp3.Callback() { @Override public void onFailure(Call call, IOException e) { callback.onError(e); } @Override public void onResponse(Call call, Response response){ if (ElasticsearchRestStorage.FLUSH_ON_WRITES) { try { client.newCall(flushRequest).execute(); } catch (IOException e) { callback.onError(e); return; } } callback.onSuccess(null); } }); }
Source:
public SpliceSchemaWatcher(String dbName, String schemaName) { this.dbName = dbName; this.schemaName = schemaName.toUpperCase(); }

Target:
public SpliceSchemaWatcher(String dbName, String schemaName) { this(schemaName); this.dbName = dbName; }
Source:
private void transitionTo(String name, Application.Status status) { Application target = applications.get(name); LOG.info("Transitioning '{}' application from to {}", name, target.getStatus(), status); boolean replaced = applications.replace(name, target, target.transitionTo(status)); if (!replaced) { throw new ConcurrentModificationException("Unable to transition '" + name + "' application to " + status); } }

Target:
private void transitionTo(String name, Application.Status status) { Application target = checkNotNull(applications.get(name), "No application found with name '%'", name); LOG.info("Transitioning '{}' application from to {}", name, target.getStatus(), status); boolean replaced = applications.replace(name, target, target.transitionTo(status)); if (!replaced) { throw new ConcurrentModificationException("Unable to transition '" + name + "' application to " + status); } }
Source:
protected String[] fillTypeCombo() { ArrayList<String> list = new ArrayList<>(); for(DataType dataType : DataTypeLibrary.getInstance().getDataTypesSorted()){ list.add(dataType.getName()); } return list.toArray(new String[0]); }

Target:
protected String[] fillTypeCombo() { List<String> list = new ArrayList<>(); for(DataType dataType : DataTypeLibrary.getInstance().getDataTypesSorted()){ list.add(dataType.getName()); } return list.toArray(new String[0]); }
Source:
protected void executeQueryCommand() { Provider hostProvider = getProvider(); HostProviderProxy proxy = ((HostProviderProxy) ProviderProxyFactory.getInstance().create(hostProvider)); getQueryReturnValue().setReturnValue(chainToString(proxy.getCertificateChain())); }

Target:
protected void executeQueryCommand() { Provider hostProvider = getProvider(); HostProviderProxy proxy = ProviderProxyFactory.getInstance().create(hostProvider); getQueryReturnValue().setReturnValue(chainToString(proxy.getCertificateChain())); }
Source:
public synchronized void addReferencePointResources( Map<IReferencePoint, List<IResource>> referencePointResourcesMapping) { if (referencePointResourcesMapping == null) { return; } Map<IReferencePoint, List<IResource>> referencePointMapping = new HashMap<>(); for (Map.Entry<IReferencePoint, List<IResource>> entry : referencePointResourcesMapping.entrySet()) { referencePointMapping.put(entry.getKey(), entry.getValue()); } nextProjectNegotiation.add(referencePointMapping); if (nextProjectNegotiationWorker != null && nextProjectNegotiationWorker.isAlive()) { return; } else if (currentProjectNegotiations.isEmpty()) { startNextProjectNegotiation(); return; } Runnable worker = new Runnable() { @Override public void run() { synchronized (nextProjectNegotiation) { while (!currentProjectNegotiations.isEmpty()) { try { nextProjectNegotiation.wait(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); return; } } } startNextProjectNegotiation(); } }; nextProjectNegotiationWorker = ThreadUtils.runSafeAsync(log, worker); }

Target:
public synchronized void addReferencePointResources( Map<IReferencePoint, List<IResource>> referencePointResourcesMapping) { if (referencePointResourcesMapping == null) { return; } nextProjectNegotiation.add(referencePointResourcesMapping); if (nextProjectNegotiationWorker != null && nextProjectNegotiationWorker.isAlive()) { return; } else if (currentProjectNegotiations.isEmpty()) { startNextProjectNegotiation(); return; } Runnable worker = new Runnable() { @Override public void run() { synchronized (nextProjectNegotiation) { while (!currentProjectNegotiations.isEmpty()) { try { nextProjectNegotiation.wait(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); return; } } } startNextProjectNegotiation(); } }; nextProjectNegotiationWorker = ThreadUtils.runSafeAsync(log, worker); }
Source:
public void canHandleDuplicateQueries() { writeToLogs(1, 100); int minLastVerified = 27; List<HistoryQuery> queries = IntStream.range(0, 10) .boxed() .map(idx -> HistoryQuery.of(NAMESPACE_AND_USE_CASE, minLastVerified + idx, minLastVerified + 500)) .collect(Collectors.toList()); List<LogsForNamespaceAndUseCase> paxosHistory = HistoryLoaderAndTransformer.getLogsForHistoryQueries(history, queries); sanityCheckLoadedHistory(paxosHistory, 100 - minLastVerified + 1); }

Target:
public void canHandleDuplicateQueries() { writeToLogs(1, 100); int minLastVerified = 27; List<HistoryQuery> queries = IntStream.range(0, 10) .boxed() .map(idx -> HistoryQueries.unboundedHistoryQuerySinceSeq(minLastVerified)) .collect(Collectors.toList()); List<LogsForNamespaceAndUseCase> paxosHistory = HistoryLoaderAndTransformer.getLogsForHistoryQueries(history, queries); sanityCheckLoadedHistory(paxosHistory, 100 - minLastVerified + 1); }
Source:
public void clearDB() { try { dbOperator.update("DELETE FROM projects"); dbOperator.update("DELETE FROM project_versions"); dbOperator.update("DELETE FROM project_properties"); dbOperator.update("DELETE FROM project_permissions"); dbOperator.update("DELETE FROM project_flows"); dbOperator.update("DELETE FROM project_files"); dbOperator.update("DELETE FROM project_events"); dbOperator.update("DELETE FROM project_flow_files"); } catch (final SQLException e) { e.printStackTrace(); } }

Target:
public void clearDB() { try { dbOperator.update("TRUNCATE TABLE projects"); dbOperator.update("TRUNCATE TABLE project_versions"); dbOperator.update("TRUNCATE TABLE project_properties"); dbOperator.update("TRUNCATE TABLE project_permissions"); dbOperator.update("TRUNCATE TABLE project_flows"); dbOperator.update("TRUNCATE TABLE project_files"); dbOperator.update("TRUNCATE TABLE project_events"); dbOperator.update("TRUNCATE TABLE project_flow_files"); } catch (final SQLException e) { e.printStackTrace(); } }
Source:
public void startEditingHeaderCell(final int uiHeaderRowIndex) { if (!EditableHeaderUtilities.hasEditableHeader(this)) { return; } if (!EditableHeaderUtilities.isEditableHeader(this, uiHeaderRowIndex)) { return; } final BaseGridRendererHelper rendererHelper = gridWidget.getRendererHelper(); final BaseGridRendererHelper.RenderingInformation ri = rendererHelper.getRenderingInformation(); final BaseGridRendererHelper.ColumnInformation ci = rendererHelper.getColumnInformation(rendererHelper.getColumnOffset(this) + this.getWidth() / 2); final EditableHeaderMetaData headerMetaData = (EditableHeaderMetaData) this.getHeaderMetaData().get(uiHeaderRowIndex); final GridBodyCellEditContext context = EditableHeaderUtilities.makeRenderContext(gridWidget, ri, ci, uiHeaderRowIndex); headerMetaData.edit(context); }

Target:
public void startEditingHeaderCell(final int uiHeaderRowIndex) { if (!EditableHeaderUtilities.hasEditableHeader(this)) { return; } if (!EditableHeaderUtilities.isEditableHeader(this, uiHeaderRowIndex)) { return; } final BaseGridRendererHelper rendererHelper = gridWidget.getRendererHelper(); final BaseGridRendererHelper.RenderingInformation ri = rendererHelper.getRenderingInformation(); final double columnXCoordinate = rendererHelper.getColumnOffset(this) + this.getWidth() / 2; final BaseGridRendererHelper.ColumnInformation ci = rendererHelper.getColumnInformation(columnXCoordinate); final EditableHeaderMetaData headerMetaData = (EditableHeaderMetaData) this.getHeaderMetaData().get(uiHeaderRowIndex); final GridBodyCellEditContext context = EditableHeaderUtilities.makeRenderContext(gridWidget, ri, ci, uiHeaderRowIndex); headerMetaData.edit(context); }
Source:
private void reportDifference(Object o1, Object o2, final String label) { if (o1 == null) { o1 = "null"; } if (o2 == null) { o2 = "null"; } reportDifference(o1.toString(), o2.toString(), label); }

Target:
private static void reportDifference(Object o1, Object o2, final String label) { if (o1 == null) { o1 = "null"; } if (o2 == null) { o2 = "null"; } reportDifference(o1.toString(), o2.toString(), label); }
Source:
public void whenRemoveThenDeleteFromDatabase() throws Exception { final EventType eventType = buildDefaultEventType(); insertEventType(eventType); repository.removeEventType(eventType.getName()); final int rows = template.queryForObject("SELECT count(*) FROM zn_data.event_type", Integer.class); assertThat("Number of rows should encrease", rows, equalTo(0)); final int schemaRows = template.queryForObject("SELECT count(*) FROM zn_data.event_type_schema", Integer.class); assertThat("Number of rows should encrease", schemaRows, equalTo(0)); }

Target:
public void whenRemoveThenDeleteFromDatabase() throws Exception { final EventType eventType = buildDefaultEventType(); insertEventType(eventType); repository.removeEventType(eventType.getName()); final int rows = template.queryForObject("SELECT count(*) FROM zn_data.event_type", Integer.class); assertThat("Number of rows should encrease", rows, equalTo(0)); final int schemaRows = template.queryForObject("SELECT count(*) FROM zn_data.event_type_schema", Integer.class); assertThat("Number of rows should decrease", schemaRows, equalTo(0)); }
Source:
private void thawVm() { if (!isLiveSnapshotApplicable() || !isCinderDisksExist()) { return; } VDSReturnValue returnValue; try { returnValue = runVdsCommand(VDSCommandType.Thaw, new VdsAndVmIDVDSParametersBase(getVds().getId(), getVmId())); } catch (EngineException e) { handleThawVmFailure(e); return; } if (!returnValue.getSucceeded()) { handleThawVmFailure(new EngineException(EngineError.thawErr)); } }

Target:
private void thawVm() { if (!shouldFreezeVm()) { return; } VDSReturnValue returnValue; try { returnValue = runVdsCommand(VDSCommandType.Thaw, new VdsAndVmIDVDSParametersBase(getVds().getId(), getVmId())); } catch (EngineException e) { handleThawVmFailure(e); return; } if (!returnValue.getSucceeded()) { handleThawVmFailure(new EngineException(EngineError.thawErr)); } }
Source:
public String getToolTipText(Object element) { final EObject domainObject = (EObject) element; IObservableValue observableValue; try { observableValue = getEMFFormsDatabinding() .getObservableValue(dmr, domainObject); } catch (final DatabindingFailedException ex) { getReportService().report(new DatabindingFailedReport(ex)); return null; } final EStructuralFeature structuralFeature = (EStructuralFeature) observableValue.getValueType(); final EObject eObject = (EObject) ((IObserving) observableValue).getObserved(); final Setting setting = ((InternalEObject) eObject).eSetting(structuralFeature); observableValue.dispose(); final VDiagnostic vDiagnostic = vTableControl.getDiagnostic(); if (vDiagnostic != null) { final String message = DiagnosticMessageExtractor.getMessage(vDiagnostic.getDiagnostic(domainObject, feature)); if (message != null && !message.isEmpty()) { return ECPTooltipModifierHelper.modifyString(message, setting); } } final Object value = eObject.eGet(structuralFeature, true); if (value == null) { return null; } final String tooltip = ECPTooltipModifierHelper.modifyString(String.valueOf(value), setting); if (tooltip == null || tooltip.isEmpty()) { return null; } }

Target:
public String getToolTipText(Object element) { final EObject domainObject = (EObject) element; IObservableValue observableValue; try { observableValue = getEMFFormsDatabinding() .getObservableValue(dmr, domainObject); } catch (final DatabindingFailedException ex) { getReportService().report(new DatabindingFailedReport(ex)); return null; } final EStructuralFeature structuralFeature = (EStructuralFeature) observableValue.getValueType(); final EObject eObject = (EObject) ((IObserving) observableValue).getObserved(); final Setting setting = ((InternalEObject) eObject).eSetting(structuralFeature); observableValue.dispose(); final VDiagnostic vDiagnostic = vTableControl.getDiagnostic(); if (vDiagnostic != null) { final String message = DiagnosticMessageExtractor.getMessage(vDiagnostic.getDiagnostic(domainObject, feature)); if (message != null && !message.isEmpty()) { return ECPTooltipModifierHelper.modifyString(message, setting); } } final Object value = eObject.eGet(structuralFeature, true); if (value == null) { return null; } final String tooltip = ECPTooltipModifierHelper.modifyString(String.valueOf(value), setting); if (tooltip == null || tooltip.isEmpty()) { return null; } return tooltip; }
Source:
public static String injectContextDependentValuesForTest(String content) { Date now = new Date(); return content.replace("<!-- test.url -->", TestProperties.TEAMMATES_URL) .replace("<!-- studentmotd.url -->", Config.STUDENT_MOTD_URL) .replace("<!-- version -->", TestProperties.TEAMMATES_VERSION) .replace("<!-- test.student1 -->", TestProperties.TEST_STUDENT1_ACCOUNT) .replace("<!-- test.student1.truncated -->", StringHelper.truncateLongId(TestProperties.TEST_STUDENT1_ACCOUNT)) .replace("<!-- test.student2 -->", TestProperties.TEST_STUDENT2_ACCOUNT) .replace("<!-- test.student2.truncated -->", StringHelper.truncateLongId(TestProperties.TEST_STUDENT2_ACCOUNT)) .replace("<!-- test.instructor -->", TestProperties.TEST_INSTRUCTOR_ACCOUNT) .replace("<!-- test.instructor.truncated -->", StringHelper.truncateLongId(TestProperties.TEST_INSTRUCTOR_ACCOUNT)) .replace("<!-- test.admin -->", TestProperties.TEST_ADMIN_ACCOUNT) .replace("<!-- test.admin.truncated -->", StringHelper.truncateLongId(TestProperties.TEST_ADMIN_ACCOUNT)) .replace("<!-- nexthour.date -->", TimeHelper.formatDate(TimeHelper.getNextHour())) .replace("<!-- now.datetime -->", TimeHelper.formatTime12H(now)) .replace("<!-- now.datetime.comments -->", TimeHelper.formatDateTimeForSessions(now, 0)); }

Target:
public static String injectContextDependentValuesForTest(String content) { Date now = new Date(); return content.replace("<!-- test.url -->", TestProperties.TEAMMATES_URL) .replace("<!-- studentmotd.url -->", Config.STUDENT_MOTD_URL) .replace("<!-- version -->", TestProperties.TEAMMATES_VERSION) .replace("<!-- test.student1 -->", TestProperties.TEST_STUDENT1_ACCOUNT) .replace("<!-- test.student1.truncated -->", StringHelper.truncateLongId(TestProperties.TEST_STUDENT1_ACCOUNT)) .replace("<!-- test.student2 -->", TestProperties.TEST_STUDENT2_ACCOUNT) .replace("<!-- test.student2.truncated -->", StringHelper.truncateLongId(TestProperties.TEST_STUDENT2_ACCOUNT)) .replace("<!-- test.instructor -->", TestProperties.TEST_INSTRUCTOR_ACCOUNT) .replace("<!-- test.instructor.truncated -->", StringHelper.truncateLongId(TestProperties.TEST_INSTRUCTOR_ACCOUNT)) .replace("<!-- test.admin -->", TestProperties.TEST_ADMIN_ACCOUNT) .replace("<!-- test.admin.truncated -->", StringHelper.truncateLongId(TestProperties.TEST_ADMIN_ACCOUNT)) .replace("<!-- nexthour.date -->", TimeHelper.formatDate(TimeHelper.getNextHour())) .replace("<!-- now.datetime -->", TimeHelper.formatTime12H(now)) .replace("<!-- now.datetime.sessions -->", TimeHelper.formatDateTimeForSessions(now, 0)); }
Source:
private static String getTokenFileFromClassloader(Class<?> contextClass, VaadinContext context) throws IOException { System.out.println("SSSSSSSSSSSSSSSSSSSSSs " + ((VaadinServletContext) context).getContext()); String tokenResource = VAADIN_SERVLET_RESOURCES + TOKEN_FILE; Lookup lookup = context.getAttribute(Lookup.class); ResourceProvider resourceProvider = lookup .lookup(ResourceProvider.class); List<URL> classResources = resourceProvider .getApplicationResources(contextClass, tokenResource); List<URL> contextResources = resourceProvider .getApplicationResources(context, tokenResource); List<URL> resources = Stream .concat(classResources.stream(), contextResources.stream()) .collect(Collectors.toList()); URL resource = resources.stream() .filter(url -> !url.getPath().endsWith("jar!/" + tokenResource)) .findFirst().orElse(null); if (resource == null && !resources.isEmpty()) { return getPossibleJarResource(contextClass, context, resources); } return resource == null ? null : FrontendUtils.streamToString(resource.openStream()); }

Target:
private static String getTokenFileFromClassloader(Class<?> contextClass, VaadinContext context) throws IOException { String tokenResource = VAADIN_SERVLET_RESOURCES + TOKEN_FILE; Lookup lookup = context.getAttribute(Lookup.class); ResourceProvider resourceProvider = lookup .lookup(ResourceProvider.class); List<URL> classResources = resourceProvider .getApplicationResources(contextClass, tokenResource); List<URL> contextResources = resourceProvider .getApplicationResources(context, tokenResource); List<URL> resources = Stream .concat(classResources.stream(), contextResources.stream()) .collect(Collectors.toList()); URL resource = resources.stream() .filter(url -> !url.getPath().endsWith("jar!/" + tokenResource)) .findFirst().orElse(null); if (resource == null && !resources.isEmpty()) { return getPossibleJarResource(contextClass, context, resources); } return resource == null ? null : FrontendUtils.streamToString(resource.openStream()); }
Source:
private void updateKibanaIndexPatternAsync(final String indexPatternLocation, final String elasticsearchKibanaIndexPatternPath, final boolean force) { asyncESPool.submit(new Runnable() { @Override public void run() { try { ObjectNode stagemonitorPattern = JsonUtils.getMapper().readTree(IOUtils.getResourceAsStream(indexPatternLocation)).deepCopy(); stagemonitorPattern.put("fields", getFields(stagemonitorPattern.get("fields").asText())); JsonNode currentPattern = fetchCurrentKibanaIndexPatternConfiguration(elasticsearchKibanaIndexPatternPath); JsonNode mergedDefinition = JsonMerger.merge(currentPattern, stagemonitorPattern, mergeStrategy().mergeEncodedObjects("fieldFormatMap").encodedArrayWithKey("fields", "name")); sendAsJson((String) "PUT", elasticsearchKibanaIndexPatternPath, (Object) mergedDefinition, force); } catch (IOException e) { logger.error("Error while updating kibana index pattern, definition = {}, pattern path = {}", e, indexPatternLocation, elasticsearchKibanaIndexPatternPath); } catch (IllegalArgumentException e) { logger.error("Error while preparing data for kibana index pattern update, definition = {}, pattern path = {}", e, indexPatternLocation, elasticsearchKibanaIndexPatternPath); } } private JsonNode fetchCurrentKibanaIndexPatternConfiguration(String elasticsearchKibanaIndexPatternPath) throws IOException { try { return getJson(elasticsearchKibanaIndexPatternPath).get("_source"); } catch (FileNotFoundException e) { return JsonUtils.getMapper().createObjectNode(); } } }); }

Target:
private void updateKibanaIndexPatternAsync(final String indexPatternLocation, final String elasticsearchKibanaIndexPatternPath, final boolean force) { asyncESPool.submit(new Runnable() { @Override public void run() { try { ObjectNode stagemonitorPattern = JsonUtils.getMapper().readTree(IOUtils.getResourceAsStream(indexPatternLocation)).deepCopy(); stagemonitorPattern.put("fields", getFields(stagemonitorPattern.get("fields").asText())); JsonNode currentPattern = fetchCurrentKibanaIndexPatternConfiguration(elasticsearchKibanaIndexPatternPath); JsonNode mergedDefinition = JsonMerger.merge(currentPattern, stagemonitorPattern, mergeStrategy().mergeEncodedObjects("fieldFormatMap").encodedArrayWithKey("fields", "name")); sendAsJson("PUT", elasticsearchKibanaIndexPatternPath, mergedDefinition, force); } catch (IOException e) { logger.error("Error while updating kibana index pattern, definition = {}, pattern path = {}", e, indexPatternLocation, elasticsearchKibanaIndexPatternPath); } catch (IllegalArgumentException e) { logger.error("Error while preparing data for kibana index pattern update, definition = {}, pattern path = {}", e, indexPatternLocation, elasticsearchKibanaIndexPatternPath); } } private JsonNode fetchCurrentKibanaIndexPatternConfiguration(String elasticsearchKibanaIndexPatternPath) throws IOException { try { return getJson(elasticsearchKibanaIndexPatternPath).get("_source"); } catch (FileNotFoundException e) { return JsonUtils.getMapper().createObjectNode(); } } }); }
Source:
protected void initializeType(File typeDir) { Iterator<File> files = Arrays.asList(typeDir.listFiles((FileFilter)mediaFileFilter)).iterator(); while (files.hasNext()) addMediaElement(typeDir.getName(), files.next()); synchronized (updateLock) { update(createTypeElement(typeDir.getName())); } }

Target:
protected void initializeType(File typeDir) { Iterator<File> files = Arrays.asList(typeDir.listFiles((FileFilter)mediaFileFilter)).iterator(); while (files.hasNext()) { addMediaElement(typeDir.getName(), files.next()); } synchronized (updateLock) { update(createTypeElement(typeDir.getName())); } }
Source:
private List<ParameterOption> getOptions() { List<ParameterOption> options = new ArrayList<>(); File soundsDir = Paths.get(ConfigConstants.getConfigFolder(), AudioManager.SOUND_DIR).toFile(); if (soundsDir.isDirectory()) { for (String fileName : soundsDir.list()) { if (fileName.contains(".")) { String soundName = StringUtils.capitalize(fileName.substring(0, fileName.indexOf("."))); options.add(new ParameterOption(fileName, soundName)); } } } return options; }

Target:
private List<ParameterOption> getOptions() { List<ParameterOption> options = new ArrayList<>(); File soundsDir = Paths.get(ConfigConstants.getConfigFolder(), AudioManager.SOUND_DIR).toFile(); if (soundsDir.isDirectory()) { for (String fileName : soundsDir.list()) { if (fileName.contains(".") && !fileName.startsWith(".")) { String soundName = StringUtils.capitalize(fileName.substring(0, fileName.lastIndexOf("."))); options.add(new ParameterOption(fileName, soundName)); } } } return options; }
Source:
private void validateNotRemovingLabeledNetworks() { Map<String, VdsNetworkInterface> nicsByName = Entities.entitiesByName(params.getInterfaces()); Map<String, VdsNetworkInterface> hostInterfacesByNetworkName = Entities.hostInterfacesByNetworkName(getExistingIfaces().values()); for (String network : removedNetworks) { VdsNetworkInterface nic = hostInterfacesByNetworkName.get(network); final String baseInterfaceName = NetworkUtils.stripVlan(nic); if (nic != null && !removedBonds.containsKey(baseInterfaceName)) { if (NetworkUtils.isVlan(nic)) { nic = nicsByName.get(baseInterfaceName); if (nic == null) { continue; } } Network removedNetwork = getExistingClusterNetworks().get(network); if (NetworkUtils.isLabeled(nic) && removedNetwork != null && nic.getLabels().contains(removedNetwork.getLabel())) { addViolation(VdcBllMessages.ACTION_TYPE_FAILED_CANNOT_REMOVE_LABELED_NETWORK_FROM_NIC, network); } } } }

Target:
private void validateNotRemovingLabeledNetworks() { Map<String, VdsNetworkInterface> nicsByName = Entities.entitiesByName(params.getInterfaces()); Map<String, VdsNetworkInterface> hostInterfacesByNetworkName = Entities.hostInterfacesByNetworkName(getExistingIfaces().values()); for (String network : removedNetworks) { VdsNetworkInterface nic = hostInterfacesByNetworkName.get(network); final String baseInterfaceName = NetworkUtils.stripVlan(nic); if (!removedBonds.containsKey(baseInterfaceName)) { if (NetworkUtils.isVlan(nic)) { nic = nicsByName.get(baseInterfaceName); if (nic == null) { continue; } } Network removedNetwork = getExistingClusterNetworks().get(network); if (NetworkUtils.isLabeled(nic) && removedNetwork != null && nic.getLabels().contains(removedNetwork.getLabel())) { addViolation(VdcBllMessages.ACTION_TYPE_FAILED_CANNOT_REMOVE_LABELED_NETWORK_FROM_NIC, network); } } } }
Source:
public String createExecution(ExecutionParameters executionParameters) throws CloudFlowException { requireNonNull(executionParameters); Project project = this.projectManager.getProject("yb-test"); Flow flow = project.getFlow("flowPriority2"); final ExecutableFlow exflow = FlowUtils.createExecutableFlow(project, flow); setAzkabanExecutionOptions(executionParameters, exflow); try { this.executorManager.submitExecutableFlow(exflow, executionParameters.getSubmitUser()); } catch (ExecutorManagerException e) { if (e.getReason() != null) { throw new CloudFlowValidationException(e.getMessage()); } else { final String errorMessage = String.format("Failed to create execution of flow with id %s " + "and version %s.", executionParameters.getFlowId(), executionParameters.getFlowVersion()); logger.error(errorMessage, e); throw new CloudFlowException(errorMessage); } } return String.valueOf(exflow.getExecutionId()); }

Target:
public String createExecution(ExecutionParameters executionParameters) { requireNonNull(executionParameters); Project project = this.projectManager.getProject("yb-test"); Flow flow = project.getFlow("flowPriority2"); final ExecutableFlow exflow = FlowUtils.createExecutableFlow(project, flow); setAzkabanExecutionOptions(executionParameters, exflow); try { this.executorManager.submitExecutableFlow(exflow, executionParameters.getSubmitUser()); } catch (ExecutorManagerException e) { if (e.getReason() != null) { throw new CloudFlowValidationException(e.getMessage()); } else { final String errorMessage = format("Failed to create execution of flow with id %s " + "and version %s.", executionParameters.getFlowId(), executionParameters.getFlowVersion()); logger.error(errorMessage, e); throw new CloudFlowException(errorMessage); } } return String.valueOf(exflow.getExecutionId()); }
Source:
public <K, V> Cache<K, V> getCache(String cacheName) { return new Cache<K, V>(service.cache); }

Target:
public <K, V> Cache<K, V> getCache(String cacheName) { if (cacheName == null) { cacheName = service.cacheName; } javax.cache.Cache<K, V> cache = service.cacheManager.getCache(cacheName); if (cache == null) { cache = service.cacheManager.createCache(cacheName, new MutableConfiguration<K, V>()); } return new Cache<K, V>(cache); }
Source:
public static void restrictUsername(String username) { Pattern pattern = Pattern.compile("(?i)^(?!.*(dockstore|admin|curator|system|manager)).*$"); Matcher matcher = pattern.matcher(username); if (!matcher.find()) { throw new CustomWebApplicationException("Cannot change username to " + username + " because it contains one or more of the following keywords: dockstore, admin, curator, system, or manager", HttpStatus.SC_BAD_REQUEST); } }

Target:
public static void restrictUsername(String username) { Matcher matcher = USERNAME_CONTAINS_KEYWORD_PATTERN.matcher(username); if (matcher.find()) { throw new CustomWebApplicationException("Cannot change username to " + username + " because it contains one or more of the following keywords: dockstore, admin, curator, system, or manager", HttpStatus.SC_BAD_REQUEST); } }