auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private BodyMailMessage createAdviceMessageAndPopulateHeader(PaymentGroup paymentGroup, CustomerProfile customer, String productionEnvironmentCode, String environmentCode) { LOG.debug("createAdviceMessageAndPopulateHeader() starting"); BodyMailMessage message = new BodyMailMessage(); String fromAddress = customer.getAdviceReturnEmailAddr(); if ((fromAddress == null) || (fromAddress.isEmpty())) { fromAddress = parameterService.getParameterValueAsString(CUKFSParameterKeyConstants.KFS_PDP, CUKFSParameterKeyConstants.ALL_COMPONENTS, CUKFSParameterKeyConstants.PDP_CUSTOMER_MISSING_ADVICE_RETURN_EMAIL); } if (StringUtils.equals(productionEnvironmentCode, environmentCode)) { message.addToAddress(paymentGroup.getAdviceEmailAddress()); message.addCcAddress(paymentGroup.getAdviceEmailAddress()); message.addBccAddress(paymentGroup.getAdviceEmailAddress()); message.setFromAddress(fromAddress); message.setSubject(customer.getAdviceSubjectLine()); } else { message.addToAddress(emailService.getDefaultFromAddress()); message.addCcAddress(emailService.getDefaultFromAddress()); message.addBccAddress(emailService.getDefaultFromAddress()); message.setFromAddress(fromAddress); message.setSubject(environmentCode + ": " + customer.getAdviceSubjectLine() + ":" + paymentGroup.getAdviceEmailAddress()); } LOG.debug("sending email to " + paymentGroup.getAdviceEmailAddress() + " for disb # " + paymentGroup.getDisbursementNbr()); return message; }

Target:
private BodyMailMessage createAdviceMessageAndPopulateHeader(PaymentGroup paymentGroup, CustomerProfile customer, String productionEnvironmentCode, String environmentCode) { LOG.debug("createAdviceMessageAndPopulateHeader() starting"); BodyMailMessage message = new BodyMailMessage(); String fromAddress = customer.getAdviceReturnEmailAddr(); if ((fromAddress == null) || (fromAddress.isEmpty())) { fromAddress = parameterService.getParameterValueAsString(CUKFSParameterKeyConstants.KFS_PDP, CUKFSParameterKeyConstants.ALL_COMPONENTS, CUKFSParameterKeyConstants.PDP_CUSTOMER_MISSING_ADVICE_RETURN_EMAIL); } if (StringUtils.equals(productionEnvironmentCode, environmentCode)) { message.addToAddress(paymentGroup.getAdviceEmailAddress()); message.addCcAddress(paymentGroup.getAdviceEmailAddress()); message.addBccAddress(paymentGroup.getAdviceEmailAddress()); message.setFromAddress(fromAddress); message.setSubject(customer.getAdviceSubjectLine()); } else { message.addToAddress(emailService.getDefaultToAddress()); message.addCcAddress(emailService.getDefaultToAddress()); message.addBccAddress(emailService.getDefaultToAddress()); message.setFromAddress(fromAddress); message.setSubject(environmentCode + ": " + customer.getAdviceSubjectLine() + ":" + paymentGroup.getAdviceEmailAddress()); } LOG.debug("sending email to " + paymentGroup.getAdviceEmailAddress() + " for disb # " + paymentGroup.getDisbursementNbr()); return message; }
Source:
public ArrayDefinition createDefinition( IDefinitionScope definitionScope, String fieldName, BitBuffer input) throws CTFReaderException { Definition lenDef = null; if (definitionScope != null) { lenDef = definitionScope.lookupDefinition(getLengthName()); } if (lenDef == null) { throw new CTFReaderException("Sequence length field not found"); } if (!(lenDef instanceof IntegerDefinition)) { throw new CTFReaderException("Sequence length field not integer"); } IntegerDefinition lengthDefinition = (IntegerDefinition) lenDef; if (lengthDefinition.getDeclaration().isSigned()) { throw new CTFReaderException("Sequence length must not be signed"); } long length = lengthDefinition.getValue(); if ((length > Integer.MAX_VALUE) || (!input.canRead((int) length * fElemType.getMaximumSize()))) { throw new CTFReaderException("Sequence length too long " + length); } if(isString()){ byte[] data = new byte[(int) length]; input.get(data); return new FixedStringDefintion(this, definitionScope, fieldName, new String(data)); } Collection<String> collection = fPaths.get(fieldName); while (collection.size() < length) { fPaths.put(fieldName, fieldName + '[' + collection.size() + ']'); } List<String> paths = (List<String>) fPaths.get(fieldName); Builder<Definition> definitions = new ImmutableList.Builder<>(); for (int i = 0; i < length; i++) { definitions.add(fElemType.createDefinition(definitionScope, paths.get(i), input)); } return new CompoundDefinition(this, definitionScope, fieldName, definitions.build()); }

Target:
public ArrayDefinition createDefinition( IDefinitionScope definitionScope, String fieldName, BitBuffer input) throws CTFReaderException { Definition lenDef = null; if (definitionScope != null) { lenDef = definitionScope.lookupDefinition(getLengthName()); } if (lenDef == null) { throw new CTFReaderException("Sequence length field not found"); } if (!(lenDef instanceof IntegerDefinition)) { throw new CTFReaderException("Sequence length field not integer"); } IntegerDefinition lengthDefinition = (IntegerDefinition) lenDef; if (lengthDefinition.getDeclaration().isSigned()) { throw new CTFReaderException("Sequence length must not be signed"); } long length = lengthDefinition.getValue(); if ((length > Integer.MAX_VALUE) || (!input.canRead((int) length * fElemType.getMaximumSize()))) { throw new CTFReaderException("Sequence length too long " + length); } if (isString()) { byte[] data = new byte[(int) length]; input.get(data); return new FixedStringDefinition(this, definitionScope, fieldName, new String(data)); } Collection<String> collection = fPaths.get(fieldName); while (collection.size() < length) { fPaths.put(fieldName, fieldName + '[' + collection.size() + ']'); } List<String> paths = (List<String>) fPaths.get(fieldName); Builder<Definition> definitions = new ImmutableList.Builder<>(); for (int i = 0; i < length; i++) { definitions.add(fElemType.createDefinition(definitionScope, paths.get(i), input)); } return new CompoundDefinition(this, definitionScope, fieldName, definitions.build()); }
Source:
public void transferConnection(final CoreRemotingConnection newConnection) { if (connection != null) { synchronized (connection.getTransferLock()) { connection.removeChannel(id); if (logger.isTraceEnabled()) { logger.trace("RemotingConnectionID=" + connection.getID() + " transferConnection to new RemotingConnectionID=" + (newConnection == null ? "NULL" : newConnection.getID())); } final CoreRemotingConnection rnewConnection = newConnection; rnewConnection.putChannel(id, this); connection = rnewConnection; transferring = true; } } }

Target:
public void transferConnection(final CoreRemotingConnection newConnection) { synchronized (connection.getTransferLock()) { connection.removeChannel(id); if (logger.isTraceEnabled()) { logger.trace("RemotingConnectionID=" + (connection == null ? "NULL" : connection.getID()) + " transferConnection to new RemotingConnectionID=" + (newConnection == null ? "NULL" : newConnection.getID())); } final CoreRemotingConnection rnewConnection = newConnection; rnewConnection.putChannel(id, this); connection = rnewConnection; transferring = true; } }
Source:
public void stopSetup(@BindingParam("finishDate") Date when, @BindingParam("setupQty") int setupQty, @BindingParam("reason") Locale reason) { result = when + "," + setupQty + reason; }

Target:
public void stopSetup(@BindingParam("finishDate") Date when, @BindingParam("setupQty") int setupQty, @BindingParam("reason") Locale reason) { result = when + "," + setupQty + "," + reason; }
Source:
public void testVerifyManifestPermission_valid() throws NoSuchAlgorithmException, NoSuchPaddingException, IllegalArgumentException, ClassNotFoundException, NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException, NameNotFoundException, NoSuchFieldException { FileMockContext mockContext = new FileMockContext(getContext()); Boolean actual; mockContext.setPermission("android.permission.INTERNET",PackageManager.PERMISSION_GRANTED); mockContext.setPermission("android.permission.GET_ACCOUNTS",PackageManager.PERMISSION_GRANTED); mockContext.setPermission("android.permission.MANAGE_ACCOUNTS",PackageManager.PERMISSION_GRANTED); mockContext.setPermission("android.permission.USE_CREDENTIALS",PackageManager.PERMISSION_GRANTED); Object brokerProxy = ReflectionUtils.getInstance("com.microsoft.aad.adal.BrokerProxy"); String authenticatorType = AuthenticationConstants.Broker.BROKER_ACCOUNT_TYPE; String brokerPackage = AuthenticationConstants.Broker.PACKAGE_NAME; String contextPackage = "com.test"; Signature signature = new Signature(testSignature); AuthenticationSettings.INSTANCE.setBrokerSignature(testTag); Account[] accts = getAccountList("currentUserName", authenticatorType); prepareProxyForTest(brokerProxy, authenticatorType, brokerPackage, contextPackage, signature, true, accts); ReflectionUtils.setFieldValue(brokerProxy, "mContext", mockContext); Method m = ReflectionUtils.getTestMethod(brokerProxy, "verifyManifestPermissions"); actual = (Boolean)m.invoke(brokerProxy); assertTrue(actual); }

Target:
public void testVerifyManifestPermission_valid() throws NoSuchAlgorithmException, IllegalArgumentException, ClassNotFoundException, NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException, NameNotFoundException, NoSuchFieldException { FileMockContext mockContext = new FileMockContext(getContext()); Boolean actual; mockContext.setPermission("android.permission.INTERNET",PackageManager.PERMISSION_GRANTED); mockContext.setPermission("android.permission.GET_ACCOUNTS",PackageManager.PERMISSION_GRANTED); mockContext.setPermission("android.permission.MANAGE_ACCOUNTS",PackageManager.PERMISSION_GRANTED); mockContext.setPermission("android.permission.USE_CREDENTIALS",PackageManager.PERMISSION_GRANTED); Object brokerProxy = ReflectionUtils.getInstance("com.microsoft.aad.adal.BrokerProxy"); String authenticatorType = AuthenticationConstants.Broker.BROKER_ACCOUNT_TYPE; String brokerPackage = AuthenticationConstants.Broker.COMPANY_PORTAL_APP_PACKAGE_NAME; String contextPackage = "com.test"; Signature signature = new Signature(testSignature); AuthenticationSettings.INSTANCE.setBrokerSignature(testTag); Account[] accts = getAccountList("currentUserName", authenticatorType); prepareProxyForTest(brokerProxy, authenticatorType, brokerPackage, contextPackage, signature, true, accts); ReflectionUtils.setFieldValue(brokerProxy, "mContext", mockContext); Method m = ReflectionUtils.getTestMethod(brokerProxy, "verifyManifestPermissions"); actual = (Boolean)m.invoke(brokerProxy); assertTrue(actual); }
Source:
public void initialize() { BlockManager blockManager = CoreRegistry.get(BlockManager.class); theme = BlockTheme.builder(blockManager) .register(DefaultBlockType.ROOF_FLAT, "LightAndShadowResources:MagicPlank") .register(DefaultBlockType.FENCE, "LightAndShadowResources:MagicGlass") .register(DefaultBlockType.BUILDING_WALL, "LightAndShadowResources:MagicStone") .build(); redDice = CoreRegistry.get(BlockManager.class).getBlock("LightAndShadowResources:redDice"); blackDice = CoreRegistry.get(BlockManager.class).getBlock("LightAndShadowResources:blackDice"); }

Target:
public void initialize() { BlockManager blockManager = CoreRegistry.get(BlockManager.class); theme = BlockTheme.builder(blockManager) .register(DefaultBlockType.ROOF_FLAT, "LightAndShadowResources:MagicPlank") .register(DefaultBlockType.FENCE, "LightAndShadowResources:MagicGlass") .register(DefaultBlockType.BUILDING_WALL, "LightAndShadowResources:MagicStone") .build(); }
Source:
private String getByAccountName(CodeReviewCommit codeReviewCommit) { Account account = getAccount(codeReviewCommit); if (account != null && account.getUserName() != null) { return " by " + account.getUserName(); } return ""; }

Target:
private String getByAccountName(CodeReviewCommit codeReviewCommit) { Account account = getAccount(codeReviewCommit); if (account != null && account.getFullName() != null) { return " by " + account.getUserName(); } return ""; }
Source:
static String extractParameterName(CtBehavior method, int paramNumber) { MethodInfo methodInfo = method.getMethodInfo(); CodeAttribute codeAttribute = methodInfo.getCodeAttribute(); if (codeAttribute != null) { LocalVariableAttribute attr = (LocalVariableAttribute) codeAttribute.getAttribute(LocalVariableAttribute .tag); if (attr != null) { int pos = Modifier.isStatic(method.getModifiers()) ? 0 : 1; return attr.variableName(paramNumber + pos); } } return null; }

Target:
static Optional<String> extractParameterName(CtBehavior method, int paramNumber) { MethodInfo methodInfo = method.getMethodInfo(); CodeAttribute codeAttribute = methodInfo.getCodeAttribute(); if (codeAttribute != null) { LocalVariableAttribute attr = (LocalVariableAttribute) codeAttribute.getAttribute(LocalVariableAttribute .tag); if (attr != null) { int pos = Modifier.isStatic(method.getModifiers()) ? 0 : 1; return Optional.ofNullable(attr.variableName(paramNumber + pos)); } } return Optional.empty(); }
Source:
public FilteredSourceFiles( List<Path> rawSrcFiles, BuildTarget buildTarget, GoToolchain goToolchain, GoPlatform platform, List<FileType> fileTypes) { this.rawSrcFiles = rawSrcFiles; this.extraSrcFiles = new ArrayList<>(); initFilterSteps(buildTarget, goToolchain, platform, fileTypes); }

Target:
public FilteredSourceFiles( List<Path> rawSrcFiles, BuildTarget buildTarget, GoToolchain goToolchain, GoPlatform platform, List<FileType> fileTypes) { this(rawSrcFiles, ImmutableList.of(), buildTarget, goToolchain, platform, fileTypes); }
Source:
private void handleParsing() { if (parsing) { return; } parsing = true; do { if (demand > 0L) { int next; if (delimited) { next = parseDelimited(); } else { next = parseFixed(); } if (next == -1) { ReadStream<Buffer> s = stream; if (s != null) { s.resume(); } break; } if (demand != Long.MAX_VALUE) { demand--; } Buffer event = buff.getBuffer(start, next); start = pos; Handler<Buffer> handler = eventHandler; if (handler != null) { handler.handle(event); } } else { ReadStream<Buffer> s = stream; if (s != null) { s.pause(); } break; } } while (true); int len = buff.length(); if (start == len) { buff = EMPTY_BUFFER; } else { buff = buff.getBuffer(start, len); if (streamEnded) { Handler<Buffer> handler = eventHandler; if (handler != null) { int next; if (delimited) { next = parseDelimited(); } else { next = parseFixed(); } handler.handle(next == -1 ? buff : buff.getBuffer(0, next)); } } } pos -= start; start = 0; if (streamEnded) { end(); } parsing = false; }

Target:
private void handleParsing() { if (parsing) { return; } parsing = true; try { do { if (demand > 0L) { int next; if (delimited) { next = parseDelimited(); } else { next = parseFixed(); } if (next == -1) { if (streamEnded) { if (buff.length() == 0) { break; } next = buff.length(); } else { ReadStream<Buffer> s = stream; if (s != null) { s.resume(); } if (streamEnded) { continue; } break; } } if (demand != Long.MAX_VALUE) { demand--; } Buffer event = buff.getBuffer(start, next); start = pos; Handler<Buffer> handler = eventHandler; if (handler != null) { handler.handle(event); } if (streamEnded) { break; } } else { ReadStream<Buffer> s = stream; if (s != null) { s.pause(); } break; } } while (true); int len = buff.length(); if (start == len) { buff = EMPTY_BUFFER; } else { buff = buff.getBuffer(start, len); } pos -= start; start = 0; if (streamEnded) { end(); } } finally { parsing = false; } }
Source:
public void setPriority(int priority) { if (priority < Thread.MIN_PRIORITY) { priority = Thread.MIN_PRIORITY; } else if (priority > Thread.MAX_PRIORITY) { priority = Thread.MAX_PRIORITY; } Process.setThreadPriority(NICE_VALUES[priority - 1]); }

Target:
public void setPriority(int priority) { if (priority < Thread.MIN_PRIORITY || priority > Thread.MAX_PRIORITY) { throw new IllegalArgumentException("Priority out of range: " + priority); } Process.setThreadPriority(NICE_VALUES[priority - Thread.MIN_PRIORITY]); }
Source:
default String describe(boolean pretty) { ScriptBuilder builder = new ScriptBuilder(pretty) .append("CREATE KEYSPACE ") .append(getName()) .append(" WITH REPLICATION = { 'class' : '") .append(getReplication().get("class")) .append("'"); for (Map.Entry<String, String> entry : getReplication().entrySet()) { if (!entry.getKey().equals("class")) { builder .append(", '") .append(entry.getKey()) .append("': '") .append(entry.getValue()) .append("'"); } } return builder .append(" } AND DURABLE_WRITES = ") .append(Boolean.toString(isDurableWrites())) .append(";") .build(); }

Target:
default String describe(boolean pretty) { ScriptBuilder builder = new ScriptBuilder(pretty) .append("CREATE KEYSPACE ") .append(getName()) .append(" WITH replication = { 'class' : '") .append(getReplication().get("class")) .append("'"); for (Map.Entry<String, String> entry : getReplication().entrySet()) { if (!entry.getKey().equals("class")) { builder .append(", '") .append(entry.getKey()) .append("': '") .append(entry.getValue()) .append("'"); } } return builder .append(" } AND durable_writes = ") .append(Boolean.toString(isDurableWrites())) .append(";") .build(); }
Source:
public CommandResult<CanvasViolation> execute(final AbstractCanvasHandler context) { if (Objects.nonNull(parent) && Objects.nonNull(child)) { context.undock(parent, child); getChild().getInEdges().stream() .filter(e -> e.getContent() instanceof Child) .findAny() .ifPresent(e -> context.addChild(e.getSourceNode(), child)); context.applyElementMutation(parent, MutationContext.STATIC); context.applyElementMutation(child, MutationContext.STATIC); } return buildResult(); }

Target:
public CommandResult<CanvasViolation> execute(final AbstractCanvasHandler context) { if (Objects.isNull(parent) || Objects.isNull(child)) { throw new IllegalArgumentException("Parent and child should not be null"); } context.undock(parent, child); getChild().getInEdges().stream() .filter(e -> e.getContent() instanceof Child) .findAny() .ifPresent(e -> context.addChild(e.getSourceNode(), child)); context.applyElementMutation(parent, MutationContext.STATIC); context.applyElementMutation(child, MutationContext.STATIC); return buildResult(); }
Source:
public List<ISuite> runSuitesLocally() { if (m_suites.isEmpty()) { setStatus(HAS_NO_TEST); error("No test suite found. Nothing to run"); usage(); return Lists.newArrayList(); } SuiteRunnerMap suiteRunnerMap = new SuiteRunnerMap(); if (m_suites.get(0).getVerbose() >= 2) { Version.displayBanner(); } for (XmlSuite xmlSuite : m_suites) { createSuiteRunners(suiteRunnerMap, xmlSuite); } if (m_suiteThreadPoolSize == 1 && !m_randomizeSuites) { for (XmlSuite xmlSuite : m_suites) { runSuitesSequentially(xmlSuite, suiteRunnerMap, getVerbose(xmlSuite), getDefaultSuiteName()); } return Lists.newArrayList(suiteRunnerMap.values()); } DynamicGraph<ISuite> suiteGraph = new DynamicGraph<>(); for (XmlSuite xmlSuite : m_suites) { populateSuiteGraph(suiteGraph, suiteRunnerMap, xmlSuite); } IThreadWorkerFactory<ISuite> factory = new SuiteWorkerFactory(suiteRunnerMap, 0 , getDefaultSuiteName()); GraphThreadPoolExecutor<ISuite> pooledExecutor = new GraphThreadPoolExecutor<>("suites", suiteGraph, factory, m_suiteThreadPoolSize, m_suiteThreadPoolSize, Integer.MAX_VALUE, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>()); Utils.log("TestNG", 2, "Starting executor for all suites"); pooledExecutor.run(); try { pooledExecutor.awaitTermination(Long.MAX_VALUE, TimeUnit.MILLISECONDS); pooledExecutor.shutdownNow(); } catch (InterruptedException handled) { Thread.currentThread().interrupt(); error("Error waiting for concurrent executors to finish " + handled.getMessage()); } return Lists.newArrayList(suiteRunnerMap.values()); }

Target:
public List<ISuite> runSuitesLocally() { if (m_suites.isEmpty()) { setStatus(HAS_NO_TEST); error("No test suite found. Nothing to run"); usage(); return Collections.emptyList(); } SuiteRunnerMap suiteRunnerMap = new SuiteRunnerMap(); if (m_suites.get(0).getVerbose() >= 2) { Version.displayBanner(); } for (XmlSuite xmlSuite : m_suites) { createSuiteRunners(suiteRunnerMap, xmlSuite); } if (m_suiteThreadPoolSize == 1 && !m_randomizeSuites) { for (XmlSuite xmlSuite : m_suites) { runSuitesSequentially(xmlSuite, suiteRunnerMap, getVerbose(xmlSuite), getDefaultSuiteName()); } return Lists.newArrayList(suiteRunnerMap.values()); } DynamicGraph<ISuite> suiteGraph = new DynamicGraph<>(); for (XmlSuite xmlSuite : m_suites) { populateSuiteGraph(suiteGraph, suiteRunnerMap, xmlSuite); } IThreadWorkerFactory<ISuite> factory = new SuiteWorkerFactory(suiteRunnerMap, 0 , getDefaultSuiteName()); GraphThreadPoolExecutor<ISuite> pooledExecutor = new GraphThreadPoolExecutor<>("suites", suiteGraph, factory, m_suiteThreadPoolSize, m_suiteThreadPoolSize, Integer.MAX_VALUE, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>()); Utils.log("TestNG", 2, "Starting executor for all suites"); pooledExecutor.run(); try { pooledExecutor.awaitTermination(Long.MAX_VALUE, TimeUnit.MILLISECONDS); pooledExecutor.shutdownNow(); } catch (InterruptedException handled) { Thread.currentThread().interrupt(); error("Error waiting for concurrent executors to finish " + handled.getMessage()); } return Lists.newArrayList(suiteRunnerMap.values()); }
Source:
protected boolean validateImageNotInTemplate() { if (!hasImages()) { return true; } return getVmTemplateDAO().get(getRepresentativeSourceImageId()) == null; }

Target:
protected boolean validateImageNotInTemplate() { return getVmTemplateDAO().get(getRepresentativeSourceImageId()) == null; }
Source:
private void setOrgStyle() {MAcctSchema acctSchema = MAcctSchema.getClientAcctSchema(Env.getCtx(), Env.getAD_Client_ID(Env.getCtx()))[0]; if (acctSchema == null) FDialog.error(form.getWindowNo(), "@No Acctschema@"); MAcctSchemaElement acctElementOrg = acctSchema.getAcctSchemaElement(MAcctSchemaElement.ELEMENTTYPE_Organization); Boolean orgMandatory = acctElementOrg.isBalanced()?true:false; if (orgMandatory) lOrg.setStyle("color : red"); else lOrg.setStyle("color : black"); lPeriodTo.setStyle("color:red"); lCube.setStyle("color:red"); }

Target:
private void setOrgStyle() {MAcctSchema acctSchema = MAcctSchema.getClientAcctSchema(Env.getCtx(), Env.getAD_Client_ID(Env.getCtx()))[0]; if (acctSchema == null) { StringBuffer errorMessage = new StringBuffer(); errorMessage.append("@No Acctschema@"); FDialog.error(form.getWindowNo(), errorMessage.toString()); } MAcctSchemaElement acctElementOrg = acctSchema.getAcctSchemaElement(MAcctSchemaElement.ELEMENTTYPE_Organization); Boolean orgMandatory = acctElementOrg.isBalanced()?true:false; if (orgMandatory) lOrg.setStyle("color : red"); else lOrg.setStyle("color : black"); lPeriodTo.setStyle("color:red"); lCube.setStyle("color:red"); }
Source:
private PublicKey decodePublicKey(JsonObject publicKeyJson) throws NoSuchAlgorithmException, InvalidKeySpecException { String keyN = publicKeyJson.get("n").getAsString(); String keyE = publicKeyJson.get("e").getAsString(); Base64.Decoder decoder = keyN.endsWith("=") || keyN.contains("+") || keyN.contains("/") ? Base64.getDecoder() : Base64.getUrlDecoder(); BigInteger modulus = new BigInteger(1, decoder.decode(keyN)); BigInteger publicExponent = new BigInteger(1, decoder.decode(keyE)); RSAPublicKeySpec publicKeySpec = new RSAPublicKeySpec(modulus, publicExponent); return KeyFactory.getInstance(CuCamsConstants.CapAssetApi.RSA).generatePublic(publicKeySpec); }

Target:
private PublicKey decodePublicKey(JsonObject publicKeyJson) throws NoSuchAlgorithmException, InvalidKeySpecException { String keyModuloN = publicKeyJson.get(CuCamsConstants.CapAssetApi.COGNITO_PUBLIC_KEY_MODULO).getAsString(); String keyExponentE = publicKeyJson.get(CuCamsConstants.CapAssetApi.COGNITO_PUBLIC_KEY_EXPONENT).getAsString(); Base64.Decoder decoder = Base64.getUrlDecoder(); BigInteger modulus = new BigInteger(1, decoder.decode(keyModuloN)); BigInteger publicExponent = new BigInteger(1, decoder.decode(keyExponentE)); RSAPublicKeySpec publicKeySpec = new RSAPublicKeySpec(modulus, publicExponent); return KeyFactory.getInstance(CuCamsConstants.CapAssetApi.RSA).generatePublic(publicKeySpec); }
Source:
protected void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException { ListProjects impl = factory.get(); if (acceptsJson(req)) { impl.setFormat(ListProjects.OutputFormat.JSON_COMPACT); } if (paramParser.parse(impl, req, res)) { ByteArrayOutputStream buf = new ByteArrayOutputStream(); if (impl.isFormatJson()) { res.setContentType(JSON_TYPE); buf.write(JSON_MAGIC); } else { res.setContentType("text/plain"); } impl.display(buf); res.setCharacterEncoding("UTF-8"); send(req, res, buf.toByteArray()); } }

Target:
protected void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException { ListProjects impl = factory.get(); if (acceptsJson(req)) { impl.setFormat(OutputFormat.JSON_COMPACT); } if (paramParser.parse(impl, req, res)) { ByteArrayOutputStream buf = new ByteArrayOutputStream(); if (impl.getFormat().isJson()) { res.setContentType(JSON_TYPE); buf.write(JSON_MAGIC); } else { res.setContentType("text/plain"); } impl.display(buf); res.setCharacterEncoding("UTF-8"); send(req, res, buf.toByteArray()); } }
Source:
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { cronService.sendEmailToEndorseds(); _LOG.info("Executing schedule task."); }

Target:
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { cronService.sendEmailToEndorseds(); _LOG.info("Endorsement Resume schedule task executed"); }
Source:
public static void resetConfigs(String filePath) { resetCount++; hadoopConfiguration = null; hdfsUtils = null; jarCopyed = false; LbLogsConfiguration lbLogsConf; if (filePath == null) { lbLogsConf = new LbLogsConfiguration(); } else { lbLogsConf = new LbLogsConfiguration(StaticFileUtils.expandUser(filePath)); } jarCopyed = false; cacheDir = lbLogsConf.getString(LbLogsConfigurationKeys.rawlogs_cache_dir); backupDir = lbLogsConf.getString(LbLogsConfigurationKeys.rawlogs_backup_dir); fileSystemRootDir = lbLogsConf.getString(LbLogsConfigurationKeys.filesystem_root_dir); localJobsJarPath = lbLogsConf.getString(LbLogsConfigurationKeys.job_jar_path); hadoopXmlFile = lbLogsConf.getString(LbLogsConfigurationKeys.hadoop_xml_file); mapreduceInputPrefix = lbLogsConf.getString(LbLogsConfigurationKeys.mapreduce_input_prefix); mapreduceOutputPrefix = lbLogsConf.getString(LbLogsConfigurationKeys.mapreduce_output_prefix); fileRegion = lbLogsConf.getString(LbLogsConfigurationKeys.files_region); hdfsUserName = lbLogsConf.getString(LbLogsConfigurationKeys.hdfs_user_name); hdfsJobsJarPath = lbLogsConf.getString(LbLogsConfigurationKeys.hdfs_job_jar_path); numReducers = lbLogsConf.getString(LbLogsConfigurationKeys.num_reducers); daysOfLZOsToKeep = getIntOrDefault(lbLogsConf, LbLogsConfigurationKeys.days_of_lzos_to_keep, 90); daysOfZipsToKeep = getIntOrDefault(lbLogsConf, LbLogsConfigurationKeys.days_of_zips_to_keep, 7); HdfsBlockSize = getIntOrDefault(lbLogsConf, LbLogsConfigurationKeys.hdfs_block_size_megs, 128); replicationCount = getIntOrDefault(lbLogsConf, LbLogsConfigurationKeys.replication_count, 2); }

Target:
public static void resetConfigs(String filePath) { resetCount++; hadoopConfiguration = null; hdfsUtils = null; jarCopyed = false; LbLogsConfiguration lbLogsConf; if (filePath == null) { lbLogsConf = new LbLogsConfiguration(); } else { lbLogsConf = new LbLogsConfiguration(StaticFileUtils.expandUser(filePath)); } jarCopyed = false; cacheDir = lbLogsConf.getString(LbLogsConfigurationKeys.rawlogs_cache_dir); backupDir = lbLogsConf.getString(LbLogsConfigurationKeys.rawlogs_backup_dir); fileSystemRootDir = lbLogsConf.getString(LbLogsConfigurationKeys.filesystem_root_dir); localJobsJarPath = lbLogsConf.getString(LbLogsConfigurationKeys.job_jar_path); hadoopXmlFile = lbLogsConf.getString(LbLogsConfigurationKeys.hadoop_xml_file); mapreduceInputPrefix = lbLogsConf.getString(LbLogsConfigurationKeys.mapreduce_input_prefix); mapreduceOutputPrefix = lbLogsConf.getString(LbLogsConfigurationKeys.mapreduce_output_prefix); fileRegion = lbLogsConf.getString(LbLogsConfigurationKeys.files_region); hdfsUserName = lbLogsConf.getString(LbLogsConfigurationKeys.hdfs_user_name); hdfsJobsJarPath = lbLogsConf.getString(LbLogsConfigurationKeys.hdfs_job_jar_path); numReducers = lbLogsConf.getString(LbLogsConfigurationKeys.num_reducers); daysOfLZOsToKeep = getInt(lbLogsConf, LbLogsConfigurationKeys.days_of_lzos_to_keep); daysOfZipsToKeep = getInt(lbLogsConf, LbLogsConfigurationKeys.days_of_zips_to_keep); hdfsBlockSize = getInt(lbLogsConf, LbLogsConfigurationKeys.hdfs_block_size_megs); replicationCount = getInt(lbLogsConf, LbLogsConfigurationKeys.replication_count); }
Source:
public void uploadApp(@RequestParam("file") MultipartFile multipartFile) throws IOException, ZipException { InputStream fileInputStream = multipartFile.getInputStream(); String filename = multipartFile.getOriginalFilename(); String formFieldName = multipartFile.getName(); String tempDir = appManagerService.uploadApp(fileInputStream, filename, formFieldName); String configFile = appManagerService.extractFileContent(tempDir, ZIP_CONFIG_FILE); AppConfig appConfig = appManagerService.checkAndObtainConfig(tempDir, configFile); String htmlTemplate = appManagerService.extractFileContent(APPS_DIR + separator + appConfig.getUri(), ZIP_INDEX_FILE); appManagerService.configureApp(appConfig, htmlTemplate); }

Target:
public void uploadApp(@RequestParam("file") MultipartFile multipartFile) throws CouldNotUploadAppException { String filename = multipartFile.getOriginalFilename(); String formFieldName = multipartFile.getName(); try { InputStream fileInputStream = multipartFile.getInputStream(); String tempDir = appManagerService.uploadApp(fileInputStream, filename, formFieldName); String configFile = appManagerService.extractFileContent(tempDir, ZIP_CONFIG_FILE); AppConfig appConfig = appManagerService.checkAndObtainConfig(tempDir, configFile); String htmlTemplate = appManagerService.extractFileContent(APPS_DIR + separator + appConfig.getUri(), ZIP_INDEX_FILE); appManagerService.configureApp(appConfig, htmlTemplate); } catch (IOException | ZipException err) { throw new CouldNotUploadAppException(filename); } }
Source:
public Optional<Text> getHelp(CommandSource source) { checkNotNull(source, "source"); Text.Builder builder = Text.builder(); Optional<Text> desc = getShortDescription(source); if (desc.isPresent()) { builder.append(desc.get(), Text.NEW_LINE); } builder.append(getUsage(source)); Optional<Text> extdesc = getExtendedDescription(source); if (extdesc.isPresent()) { builder.append(Text.NEW_LINE, extdesc.get()); } return Optional.of(builder.build()); }

Target:
public Optional<Text> getHelp(CommandSource source) { checkNotNull(source, "source"); Text.Builder builder = Text.builder(); this.getShortDescription(source).ifPresent((a) -> builder.append(a, Text.NEW_LINE)); builder.append(getUsage(source)); this.getExtendedDescription(source).ifPresent((a) -> builder.append(Text.NEW_LINE, a)); return Optional.of(builder.build()); }
Source:
public void fromAttributes(Map<String, String> attributes) { if (attributes != null) { String valuesString = attributes.get(TAG_VALUES_ATTRIBUTE); if (valuesString != null) { @SuppressWarnings("unchecked") Map<String, Object> values = (Map<String, Object>) ObjectUtils.fromJson(valuesString); ObjectType type = ObjectType.getInstance(ObjectUtils.to(UUID.class, values.get("_type"))); if (type != null) { Object object = type.createObject(ObjectUtils.to(UUID.class, values.get("_id"))); if (object instanceof Reference) { State state = State.getInstance(object); state.setValues(values); reference = (Reference) object; } } } } }

Target:
public void fromAttributes(Map<String, String> attributes) { if (attributes == null) { return; } String valuesString = attributes.get(VALUES_ATTRIBUTE); if (valuesString == null) { return; } @SuppressWarnings("unchecked") Map<String, Object> values = (Map<String, Object>) ObjectUtils.fromJson(valuesString); ObjectType type = ObjectType.getInstance(ObjectUtils.to(UUID.class, values.get("_type"))); if (type == null) { return; } Object object = type.createObject(ObjectUtils.to(UUID.class, values.get("_id"))); if (!(object instanceof Reference)) { return; } State state = State.getInstance(object); state.setValues(values); reference = (Reference) object; }
Source:
int offer(DBBPool.BBContainer cont, long startId, long endId, long timestamp) throws IOException { assert(m_endId == INVALID_ID || startId == m_endId+1) : "Current endId=" + m_endId + ", input startId=" + startId; if (m_closed) { throw new IOException("Segment closed"); } return offer0(cont, startId, endId, timestamp); }

Target:
int offer(DBBPool.BBContainer cont, long startId, long endId, long timestamp) throws IOException { assert(m_endId == INVALID_ID || startId == m_endId+1) : "Current endId=" + m_endId + ", input startId=" + startId; if (m_closed) { throw new IOException("Segment closed"); } final ByteBuffer buf = cont.b(); final int remaining = buf.remaining(); boolean compress = m_compress && remaining >= 32 && buf.isDirect(); final int maxCompressedSize = (compress ? CompressionService.maxCompressedLength(remaining) : remaining) + ENTRY_HEADER_BYTES; if (remaining() < maxCompressedSize) { return -1; } m_syncedSinceLastEdit = false; DBBPool.BBContainer destBuf = cont; int written = 0; try { m_entryHeaderBuf.b().clear(); if (compress) { destBuf = DBBPool.allocateDirectAndPool(maxCompressedSize); final int compressedSize = CompressionService.compressBuffer(buf, destBuf.b()); destBuf.b().limit(compressedSize); writeEntryHeader(destBuf.b(), PBDSegment.FLAG_COMPRESSED); } else { destBuf = cont; writeEntryHeader(destBuf.b(), PBDSegment.NO_FLAGS); } m_entryHeaderBuf.b().flip(); while (m_entryHeaderBuf.b().hasRemaining()) { m_fc.write(m_entryHeaderBuf.b()); } destBuf.b().flip(); written = destBuf.b().remaining(); while (destBuf.b().hasRemaining()) { m_fc.write(destBuf.b()); } updateHeaderDataAfterOffer(remaining, startId, endId, timestamp); } finally { if (compress) { destBuf.discard(); } } return written; }
Source:
public List<ReferenceCountingResourceHolder<T>> takeBatch(final int elementNum) { checkInitialized(); try { return pollObjects(elementNum).stream().map(this::wrapObject).collect(Collectors.toList()); } catch (InterruptedException e) { throw Throwables.propagate(e); } }

Target:
public List<ReferenceCountingResourceHolder<T>> takeBatch(final int elementNum) { checkInitialized(); try { return takeObjects(elementNum).stream().map(this::wrapObject).collect(Collectors.toList()); } catch (InterruptedException e) { throw new RuntimeException(e); } }
Source:
public static void checkInfantryDestruction(Entity entity, int distFromCenter, Entity attacker, Vector<Integer> alreadyHit, Vector<Report> vPhaseReport, IGame game, Server server) { int rollTarget = -1; if(entity instanceof BattleArmor) { rollTarget = 7; } else if(entity instanceof Infantry) { rollTarget = 9; } else { return; } int roll = Compute.d6(2); int result = roll + distFromCenter; boolean destroyed = result < rollTarget; Report r = new Report(9987); r.indent(1); r.subject = attacker.getId(); r.newlines = 1; r.add(rollTarget); r.add(roll); r.add(distFromCenter); r.choose(destroyed); vPhaseReport.addElement(r); if(destroyed) { vPhaseReport.addAll(server.destroyEntity(entity, "fuel-air ordnance detonation", false, false)); alreadyHit.add(entity.getId()); } return; }

Target:
public static void checkInfantryDestruction(Entity entity, int distFromCenter, Entity attacker, Vector<Integer> alreadyHit, Vector<Report> vPhaseReport, IGame game, Server server) { int rollTarget = -1; if(entity instanceof BattleArmor) { rollTarget = 7; } else if(entity instanceof Infantry) { rollTarget = 9; } else { return; } int roll = Compute.d6(2); int result = roll + distFromCenter; boolean destroyed = result <= rollTarget; Report r = new Report(9987); r.indent(1); r.subject = attacker.getId(); r.newlines = 1; r.add(rollTarget); r.add(roll); r.add(distFromCenter); r.choose(destroyed); vPhaseReport.addElement(r); if(destroyed) { vPhaseReport.addAll(server.destroyEntity(entity, "fuel-air ordnance detonation", false, false)); alreadyHit.add(entity.getId()); } return; }
Source:
Account(JSONObject metadata) throws JSONException { if (metadata == null) { throw new IllegalArgumentException("metadata cannot be null."); } short metadataVersion = (short) metadata.getInt(ACCOUNT_METADATA_VERSION_KEY); switch (metadataVersion) { case ACCOUNT_METADATA_VERSION_1: id = (short) metadata.getInt(ACCOUNT_ID_KEY); name = metadata.getString(ACCOUNT_NAME_KEY); status = AccountStatus.valueOf(metadata.getString(ACCOUNT_STATUS_KEY)); checkRequiredFieldsForBuild(); JSONArray containerArray = metadata.getJSONArray(CONTAINERS_KEY); Collection<Container> containers = new ArrayList<>(); if (containerArray != null) { for (int index = 0; index < containerArray.length(); index++) { JSONObject containerMetadata = containerArray.getJSONObject(index); Container container = new Container(containerMetadata); containers.add(container); updateContainerMap(container); } checkAccountIdInContainers(); checkDuplicateContainerNameOrId(containers); } break; default: throw new IllegalStateException("Unsupported account metadata version=" + metadataVersion); } }

Target:
private Account(JSONObject metadata) throws JSONException { if (metadata == null) { throw new IllegalArgumentException("metadata cannot be null."); } short metadataVersion = (short) metadata.getInt(JSON_VERSION_KEY); switch (metadataVersion) { case JSON_VERSION_1: id = (short) metadata.getInt(ACCOUNT_ID_KEY); name = metadata.getString(ACCOUNT_NAME_KEY); status = AccountStatus.valueOf(metadata.getString(STATUS_KEY)); checkRequiredFieldsForBuild(); JSONArray containerArray = metadata.getJSONArray(CONTAINERS_KEY); if (containerArray != null) { for (int index = 0; index < containerArray.length(); index++) { Container container = Container.fromJson(containerArray.getJSONObject(index)); checkParentAccountIdInContainers(container); checkDuplicateContainerNameOrId(container); updateContainerMap(container); } } break; default: throw new IllegalStateException("Unsupported account json version=" + metadataVersion); } }
Source:
public void testVisibilitySpinnerDefaultYes() { enterSettingScreen(); onView(allOf(withText("Yes"), withParent(withId(R.id.spinner_visibility)))).check(matches(isDisplayed())); }

Target:
public void testVisibilitySpinnerDefaultYes() { enterSettingScreen(); onView(allOf(withText(R.string.yes), withParent(withId(R.id.spinner_visibility)))).check(matches(isDisplayed())); }
Source:
public void handleError(HttpServletRequest request, HttpServletResponse response, HandlerContext context) { response.setHeader("WWW-Authenticate", "Basic realm=\"Please enter user name and password to access OpenHab\""); response.setStatus(401); context.execute(request, response); }

Target:
public void handleError(HttpServletRequest request, HttpServletResponse response, HandlerContext context) { response.setHeader("WWW-Authenticate", "Basic realm=\"Please enter user name and password to access system\""); response.setStatus(401); context.execute(request, response); }
Source:
private void createModule() { checkIfExists(); updateParentPOM(); pomService.create(moduleRoot, pom); createMavenDirectories(); kModuleService.setUpKModule(simpleModuleInstance.getKModuleXMLPath()); createDefaultPackage(); projectImportsService.saveProjectImports(simpleModuleInstance.getImportsPath()); packageNameWhiteListService.createModuleWhiteList(simpleModuleInstance.getPackageNamesWhiteListPath(), defaultPackageNamesWhiteListEntry()); moduleRepositoriesService.create(simpleModuleInstance.getRepositoriesPath()); }

Target:
private void createModule() { checkIfExists(); updateParentPOM(); pomService.create(moduleRoot, pom); createMavenDirectories(); kModuleService.setUpKModule(simpleModuleInstance.getKModuleXMLPath()); createDefaultPackage(); projectImportsService.saveProjectImports(simpleModuleInstance.getImportsPath()); String packageNamesWhiteListContent = defaultPackageNamesWhiteListEntry(); packageNameWhiteListService.createModuleWhiteList(simpleModuleInstance.getPackageNamesWhiteListPath(), packageNamesWhiteListContent); moduleRepositoriesService.create(simpleModuleInstance.getRepositoriesPath()); }
Source:
public Collection<StashComment> getPullRequestOverviewComments(PullRequestRef pr) throws StashClientException { return getPaged( MessageFormat.format(API_ONE_PR + "/activities", baseUrl, pr.project(), pr.repository(), pr.pullRequestId()), "Error!" ).stream().map(StashCollector::extractCommentFromActivity).flatMap(StashPluginUtils::removeEmpty).collect(Collectors.toList()); }

Target:
public Collection<StashComment> getPullRequestOverviewComments(PullRequestRef pr) throws StashClientException { return getPaged( MessageFormat.format(API_ONE_PR_ACTIVITIES, baseUrl, pr.project(), pr.repository(), pr.pullRequestId()), "Error!" ).stream().map(StashCollector::extractCommentFromActivity).flatMap(StashPluginUtils::removeEmpty).collect(Collectors.toList()); }
Source:
private void sendPack() throws IOException { final boolean sideband = options.contains(OPTION_SIDE_BAND) || options.contains(OPTION_SIDE_BAND_64K); ProgressMonitor pm = NullProgressMonitor.INSTANCE; OutputStream packOut = rawOut; if (sideband) { int bufsz = SideBandOutputStream.SMALL_BUF; if (options.contains(OPTION_SIDE_BAND_64K)) bufsz = SideBandOutputStream.MAX_BUF; packOut = new SideBandOutputStream(SideBandOutputStream.CH_DATA, bufsz, rawOut); if (!options.contains(OPTION_NO_PROGRESS)) pm = new SideBandProgressMonitor(new SideBandOutputStream( SideBandOutputStream.CH_PROGRESS, bufsz, rawOut)); } PackConfig cfg = packConfig; if (cfg == null) cfg = new PackConfig(db); final PackWriter pw = new PackWriter(cfg, walk.getObjectReader()); try { pw.setDeltaBaseAsOffset(options.contains(OPTION_OFS_DELTA)); pw.setThin(options.contains(OPTION_THIN_PACK)); if(depth > 0) { pw.preparePack(pm, wantAll, commonBase, unshallowCommits, depth); } else { pw.preparePack(pm, wantAll, commonBase); } if (options.contains(OPTION_INCLUDE_TAG)) { for (final Ref r : refs.values()) { final RevObject o; try { o = walk.parseAny(r.getObjectId()); } catch (IOException e) { continue; } if (o.has(WANT) || !(o instanceof RevTag)) continue; final RevTag t = (RevTag) o; if (!pw.willInclude(t) && pw.willInclude(t.getObject())) pw.addObject(t); } } pw.writePack(pm, NullProgressMonitor.INSTANCE, packOut); } finally { pw.release(); } packOut.flush(); if (sideband) pckOut.end(); }

Target:
private void sendPack() throws IOException { final boolean sideband = options.contains(OPTION_SIDE_BAND) || options.contains(OPTION_SIDE_BAND_64K); ProgressMonitor pm = NullProgressMonitor.INSTANCE; OutputStream packOut = rawOut; if (sideband) { int bufsz = SideBandOutputStream.SMALL_BUF; if (options.contains(OPTION_SIDE_BAND_64K)) bufsz = SideBandOutputStream.MAX_BUF; packOut = new SideBandOutputStream(SideBandOutputStream.CH_DATA, bufsz, rawOut); if (!options.contains(OPTION_NO_PROGRESS)) pm = new SideBandProgressMonitor(new SideBandOutputStream( SideBandOutputStream.CH_PROGRESS, bufsz, rawOut)); } PackConfig cfg = packConfig; if (cfg == null) cfg = new PackConfig(db); final PackWriter pw = new PackWriter(cfg, walk.getObjectReader()); try { pw.setDeltaBaseAsOffset(options.contains(OPTION_OFS_DELTA)); pw.setThin(options.contains(OPTION_THIN_PACK)); if (depth > 0) pw.setShallowPack(depth, unshallowCommits); pw.preparePack(pm, wantAll, commonBase); if (options.contains(OPTION_INCLUDE_TAG)) { for (final Ref r : refs.values()) { final RevObject o; try { o = walk.parseAny(r.getObjectId()); } catch (IOException e) { continue; } if (o.has(WANT) || !(o instanceof RevTag)) continue; final RevTag t = (RevTag) o; if (!pw.willInclude(t) && pw.willInclude(t.getObject())) pw.addObject(t); } } pw.writePack(pm, NullProgressMonitor.INSTANCE, packOut); } finally { pw.release(); } packOut.flush(); if (sideband) pckOut.end(); }
Source:
default SourceMap sourceMap() { return null; }

Target:
default Optional<SourceMap> sourceMap() { return Optional.empty(); }
Source:
private void setupVdsNetworkInterfaceDao() { when(getDbFacadeMockInstance().getInterfaceDao()).thenReturn(vdsNetworkInterfaceDaoMock); List<VdsNetworkInterface> expectedVdsNetworkInterface = Collections.singletonList(vdsNetworkInterface); when(vdsNetworkInterfaceDaoMock.getVdsInterfacesByNetworkId(networkId)).thenReturn( expectedVdsNetworkInterface); }

Target:
private void setupVdsNetworkInterfaceDao() { List<VdsNetworkInterface> expectedVdsNetworkInterface = Collections.singletonList(vdsNetworkInterface); when(vdsNetworkInterfaceDaoMock.getVdsInterfacesByNetworkId(networkId)).thenReturn( expectedVdsNetworkInterface); when(getDbFacadeMockInstance().getInterfaceDao()).thenReturn(vdsNetworkInterfaceDaoMock); }
Source:
public void testGetProjectListWithWorkflow() throws Exception { Project<?, ?> masterProject = createFreeStyleProject("project"); WorkflowJob p = (WorkflowJob) Jenkins.getInstance().createProject(WorkflowJob.class, "workflowproject"); p.setDefinition(new CpsFlowDefinition("println('hello')")); BlockableBuildTriggerConfig masterConfig = createConfig("subproject1, workflowproject"); addParameterizedTrigger(masterProject, masterConfig); Project subProject1 = createFreeStyleProject("subproject1"); subProject1.setQuietPeriod(0); List<Job> jobs = masterConfig.getProjectListGeneral(masterProject.getParent(), null); assertEquals(2, jobs.size()); assertTrue("Job should include workflow job", jobs.contains(p)); assertTrue("Job should include non-workflow job", jobs.contains(subProject1)); List<AbstractProject> projects = masterConfig.getProjectList(masterProject.getParent(), null); assertEquals(1, projects.size()); assertFalse("Projects should NOT include workflow job", projects.contains(p)); assertTrue("Projects should include non-workflow job", projects.contains(subProject1)); }

Target:
public void testGetProjectListWithWorkflow() throws Exception { Project<?, ?> masterProject = createFreeStyleProject("project"); WorkflowJob p = jenkins.createProject(WorkflowJob.class, "workflowproject"); p.setDefinition(new CpsFlowDefinition("println('hello')")); BlockableBuildTriggerConfig masterConfig = createConfig("subproject1, workflowproject"); addParameterizedTrigger(masterProject, masterConfig); Project subProject1 = createFreeStyleProject("subproject1"); subProject1.setQuietPeriod(0); List<Job> jobs = masterConfig.getJobs(masterProject.getParent(), null); assertEquals(2, jobs.size()); assertTrue("Job should include workflow job", jobs.contains(p)); assertTrue("Job should include non-workflow job", jobs.contains(subProject1)); List<AbstractProject> projects = masterConfig.getProjectList(masterProject.getParent(), null); assertEquals(1, projects.size()); assertFalse("Projects should NOT include workflow job", projects.contains(p)); assertTrue("Projects should include non-workflow job", projects.contains(subProject1)); }
Source:
protected void addVmPermission() { super.addVmPermission(); if (!getParameters().isCopyTemplatePermissions()) { return; } PermissionDAO dao = getDbFacade().getPermissionDao(); List<permissions> templatePermissions = dao.getAllForEntity(getVmTemplateId(), getCurrentUser().getUserId(), false); List<permissions> vmPermissions = new ArrayList<permissions>(); for (permissions templatePermission : templatePermissions) { vmPermissions.add(new permissions(getCurrentUser().getUserId(), templatePermission.getrole_id(), getVmId(), VdcObjectType.VM)); } if (vmPermissions.size() > 0) { MultiLevelAdministrationHandler.addPermission(vmPermissions.toArray(new permissions[vmPermissions.size()])); } }

Target:
protected void addVmPermission() { super.addVmPermission(); if (!getParameters().isCopyTemplatePermissions()) { return; } PermissionDAO dao = getDbFacade().getPermissionDao(); List<permissions> templatePermissions = dao.getAllForEntity(getVmTemplateId(), getCurrentUser().getUserId(), false); List<permissions> vmPermissions = new ArrayList<permissions>(); for (permissions templatePermission : templatePermissions) { boolean templateOwnerRole = templatePermission.getrole_id().equals(PredefinedRoles.TEMPLATE_OWNER.getId()); boolean templateUserRole = templatePermission.getrole_id().equals(PredefinedRoles.TEMPLATE_USER.getId()); if (templateOwnerRole || templateUserRole) { continue; } vmPermissions.add(new permissions(getCurrentUser().getUserId(), templatePermission.getrole_id(), getVmId(), VdcObjectType.VM)); } if (vmPermissions.size() > 0) { MultiLevelAdministrationHandler.addPermission(vmPermissions.toArray(new permissions[vmPermissions.size()])); } }