auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void setupBlobstore() throws AuthorizationException, KeyNotFoundException { IStormClusterState state = stormClusterState; BlobStore store = blobStore; Set<String> localKeys = new HashSet<>(); for (Iterator<String> it = store.listKeys(); it.hasNext();) { localKeys.add(it.next()); } Set<String> activeKeys = new HashSet<>(state.activeKeys()); Set<String> activeLocalKeys = new HashSet<>(localKeys); activeLocalKeys.retainAll(activeKeys); Set<String> keysToDelete = new HashSet<>(localKeys); keysToDelete.removeAll(activeKeys); NimbusInfo nimbusInfo = nimbusHostPortInfo; LOG.debug("Deleting keys not on the zookeeper {}", keysToDelete); for (String toDelete: keysToDelete) { store.deleteBlob(toDelete, NIMBUS_SUBJECT); } LOG.debug("Creating list of key entries for blobstore inside zookeeper local {}", activeKeys, activeLocalKeys); <START> CuratorFramework zkClient = BlobStoreUtils.createZKClient(conf); <END> for (String key: activeLocalKeys) { try { state.setupBlobstore(key, nimbusInfo, getVersionForKey(key, nimbusInfo, zkClient)); } catch (KeyNotFoundException e) { store.deleteBlob(key, NIMBUS_SUBJECT); } } }</code><technical_language>**zkClient guaranteed closed.** Please ensure zkClient is closed for statement</technical_language>

Target:
private void setupBlobstore() throws AuthorizationException, KeyNotFoundException { IStormClusterState state = stormClusterState; BlobStore store = blobStore; Set<String> localKeys = new HashSet<>(); for (Iterator<String> it = store.listKeys(); it.hasNext();) { localKeys.add(it.next()); } Set<String> activeKeys = new HashSet<>(state.activeKeys()); Set<String> activeLocalKeys = new HashSet<>(localKeys); activeLocalKeys.retainAll(activeKeys); Set<String> keysToDelete = new HashSet<>(localKeys); keysToDelete.removeAll(activeKeys); NimbusInfo nimbusInfo = nimbusHostPortInfo; LOG.debug("Deleting keys not on the zookeeper {}", keysToDelete); for (String toDelete: keysToDelete) { store.deleteBlob(toDelete, NIMBUS_SUBJECT); } LOG.debug("Creating list of key entries for blobstore inside zookeeper local {}", activeKeys, activeLocalKeys); for (String key: activeLocalKeys) { try { state.setupBlobstore(key, nimbusInfo, getVersionForKey(key, nimbusInfo, conf, zkClient)); } catch (KeyNotFoundException e) { store.deleteBlob(key, NIMBUS_SUBJECT); } } }
Source:
<code><START> private void closeQuietly(AutoCloseable resource) { <END> try { if (resource != null) { resource.close(); } } catch (Exception e) { logger.warn("Closing resource", e); } }</code><technical_language>static? (This move MySqlUtils anyway.)</technical_language>

Target:
private static void closeQuietly(AutoCloseable resource) { try { if (resource != null) { resource.close(); } } catch (Exception e) { logger.warn("Closing resource", e); } }
Source:
<code>public void testGetActionName(){ assertEquals("instructorCourse", ActivityLogEntry.getActionName("/page/instructorCourse")); assertEquals("instructorCourse", ActivityLogEntry.getActionName("/page/instructorCourse?user=x")); try { ActivityLogEntry.getActionName("instructorCourse"); signalFailureToDetectException("getActionName should throw an exception if an action cannot be retrieved"); <START> } catch (Exception e) { <END> assertEquals("java.lang.ArrayIndexOutOfBoundsException: 2", e.toString()); } }</code><technical_language>I this is specifically ArrayIndexOutOfBoundsException. Try catch a generic one</technical_language>

Target:
public void testGetActionName(){ assertEquals("instructorCourse", ActivityLogEntry.getActionName("/page/instructorCourse")); assertEquals("instructorCourse", ActivityLogEntry.getActionName("/page/instructorCourse?user=x")); try { ActivityLogEntry.getActionName("instructorCourse"); signalFailureToDetectException("getActionName should throw an exception if an action cannot be retrieved"); } catch (ArrayIndexOutOfBoundsException e) { assertEquals("java.lang.ArrayIndexOutOfBoundsException: 2", e.toString()); } }
Source:
<code>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()); <START> message.addBccAddress(emailService.getDefaultFromAddress()); <END> message.setFromAddress(fromAddress); message.setSubject(environmentCode + ": " + customer.getAdviceSubjectLine() + ":" + paymentGroup.getAdviceEmailAddress()); } LOG.debug("sending email to " + paymentGroup.getAdviceEmailAddress() + " for disb # " + paymentGroup.getDisbursementNbr()); return message; }</code><technical_language>properties default "to" address instead of default "from" one</technical_language>

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:
<code>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); } <START> if(isString()){ <END> 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()); }</code><technical_language>spacnig</technical_language>

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:
<code>public void transferConnection(final CoreRemotingConnection newConnection) { <START> if (connection != null) { <END> 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; } } }</code><technical_language>here.. connection null</technical_language>

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:
<code>public void stopSetup(@BindingParam("finishDate") Date when, @BindingParam("setupQty") int setupQty, @BindingParam("reason") Locale reason) { <START> result = when + "," + setupQty + reason; <END> }</code><technical_language>add ","</technical_language>

Target:
public void stopSetup(@BindingParam("finishDate") Date when, @BindingParam("setupQty") int setupQty, @BindingParam("reason") Locale reason) { result = when + "," + setupQty + "," + reason; }
Source:
<code><START> public void testVerifyManifestPermission_valid() throws NoSuchAlgorithmException, NoSuchPaddingException, IllegalArgumentException, ClassNotFoundException, NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException, NameNotFoundException, NoSuchFieldException { <END> 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); }</code><technical_language>split if does't fit</technical_language>

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:
<code>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(); <START> redDice = CoreRegistry.get(BlockManager.class).getBlock("LightAndShadowResources:redDice"); <END> blackDice = CoreRegistry.get(BlockManager.class).getBlock("LightAndShadowResources:blackDice"); }</code><technical_language>Convert "L&SResources:redDice" a constant well. Try avoid hard coded strings possible, everywhere</technical_language>

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:
<code>private String getByAccountName(CodeReviewCommit codeReviewCommit) { Account account = getAccount(codeReviewCommit); if (account != null && account.getUserName() != null) { return " by " + <START> account.getUserName(); <END> } return ""; }</code><technical_language>I want name email in message. username is null (for example), need DisplayName</technical_language>

Target:
private String getByAccountName(CodeReviewCommit codeReviewCommit) { Account account = getAccount(codeReviewCommit); if (account != null && account.getFullName() != null) { return " by " + account.getUserName(); } return ""; }
Source:
<code>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); } } <START> return null; <END> }</code><technical_language>explain while this return null</technical_language>

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:
<code>public FilteredSourceFiles( List<Path> rawSrcFiles, BuildTarget buildTarget, GoToolchain goToolchain, GoPlatform platform, List<FileType> fileTypes) { this.rawSrcFiles = rawSrcFiles; this.extraSrcFiles = new ArrayList<>(); <START> initFilterSteps(buildTarget, goToolchain, platform, fileTypes); <END> }</code><technical_language>instead of initializing filterSteps in initFilterSteps do following? filterSteps = createFilterSteps(buildTarget, goToolchain, platform, fileTypes);</technical_language>

Target:
public FilteredSourceFiles( List<Path> rawSrcFiles, BuildTarget buildTarget, GoToolchain goToolchain, GoPlatform platform, List<FileType> fileTypes) { this(rawSrcFiles, ImmutableList.of(), buildTarget, goToolchain, platform, fileTypes); }
Source:
<code>private void handleParsing() { <START> if (parsing) { <END> 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; }</code><technical_language>is this needed</technical_language>

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:
<code>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 - <START> 1]); <END> }</code><technical_language>priority - Thread.MIN_PRIORITY (which is priority - 1, accident)</technical_language>

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:
<code>default String describe(boolean pretty) { ScriptBuilder builder = new ScriptBuilder(pretty) .append("CREATE KEYSPACE ") .append(getName()) <START> .append(" WITH REPLICATION = { 'class' : '") <END> .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(); }</code><technical_language>right that. I impression. revert then</technical_language>

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:
<code>public CommandResult<CanvasViolation> execute(final AbstractCanvasHandler context) { <START> if (Objects.nonNull(parent) && Objects.nonNull(child)) { <END> 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(); }</code><technical_language>prefer throwing a NPE in case of is null, sense calling this command some null parent candidate, right? letting developer realize calling wrong args? (You PortablePreconditions.checkNotNull for this kind of checks)</technical_language>

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:
<code>public List<ISuite> runSuitesLocally() { if (m_suites.isEmpty()) { setStatus(HAS_NO_TEST); error("No test suite found. Nothing to run"); usage(); <START> return Lists.newArrayList(); <END> } 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()); }</code><technical_language>Collections.emptyList()</technical_language>

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:
<code>protected boolean validateImageNotInTemplate() { <START> if (!hasImages()) { <END> return true; } return getVmTemplateDAO().get(getRepresentativeSourceImageId()) == null; }</code><technical_language>check hasImages in canDoAction if skip validations</technical_language>

Target:
protected boolean validateImageNotInTemplate() { return getVmTemplateDAO().get(getRepresentativeSourceImageId()) == null; }
Source:
<code>private void setOrgStyle() {MAcctSchema acctSchema = MAcctSchema.getClientAcctSchema(Env.getCtx(), Env.getAD_Client_ID(Env.getCtx()))[0]; if (acctSchema == null) <START> FDialog.error(form.getWindowNo(), "@No Acctschema@"); <END> 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"); }</code><technical_language>Please change **@NoAccrschema@** for **@C_AcctSchema_ID@ @NotFound@**</technical_language>

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:
<code>private PublicKey decodePublicKey(JsonObject publicKeyJson) throws NoSuchAlgorithmException, InvalidKeySpecException { <START> String keyN = publicKeyJson.get("n").getAsString(); <END> 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); }</code><technical_language>constants for "n" "e"</technical_language>

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:
<code>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); <START> buf.write(JSON_MAGIC); <END> } else { res.setContentType("text/plain"); } impl.display(buf); res.setCharacterEncoding("UTF-8"); send(req, res, buf.toByteArray()); } }</code><technical_language>Hmm, I understand for JSON_MAGIC is needed here, result in WebUI broken me: )]}' [{"name":"P"},{"name":"X"}, ... output just: [{"name":"P"},{"name":"X"}, ...</technical_language>

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:
<code>public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { cronService.sendEmailToEndorseds(); <START> _LOG.info("Executing schedule task."); <END> }</code><technical_language>@tsr-thulio Improve this message. "Endorsement Resume schedule task executed"</technical_language>

Target:
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { cronService.sendEmailToEndorseds(); _LOG.info("Endorsement Resume schedule task executed"); }
Source:
<code>public void uploadApp(@RequestParam("file") MultipartFile multipartFile) throws IOException, ZipException { InputStream fileInputStream = multipartFile.getInputStream(); String filename = multipartFile.getOriginalFilename(); String formFieldName = multipartFile.getName(); <START> String tempDir = appManagerService.uploadApp(fileInputStream, filename, formFieldName); <END> 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); }</code><technical_language>of calls throw a io exception, i need handle this</technical_language>

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:
<code>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()) { <START> builder.append(Text.NEW_LINE, extdesc.get()); <END> } return Optional.of(builder.build()); }</code><technical_language>this.getExtendedDescription(source).ifPresent(builder::append); so, instead of 3 lines</technical_language>

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:
<code>public void fromAttributes(Map<String, String> attributes) { <START> if (attributes != null) { <END> 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; } } } } }</code><technical_language>do, I think: java if (attributes == null) { return; } This applies valuesString, type, object checks below</technical_language>

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:
<code>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; <START> if (m_closed) { <END> throw new IOException("Segment closed"); } return offer0(cont, startId, endId, timestamp); }</code><technical_language>difference this offer0 is assert m_closed check only. is OK if m_closed check is done this offer offer0</technical_language>

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:
<code>public List<ReferenceCountingResourceHolder<T>> takeBatch(final int elementNum) { checkInitialized(); try { <START> return pollObjects(elementNum).stream().map(this::wrapObject).collect(Collectors.toList()); <END> } catch (InterruptedException e) { throw Throwables.propagate(e); } }</code><technical_language>takeObjects pollObjects - semantics changed</technical_language>

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:
<code>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; <START> boolean destroyed = result < rollTarget; <END> 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; }</code><technical_language>suggestion boolean destroyed = result <= rollTarget;</technical_language>

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:
<code>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); <START> containers.add(container); <END> updateContainerMap(container); } checkAccountIdInContainers(); checkDuplicateContainerNameOrId(containers); } break; default: throw new IllegalStateException("Unsupported account metadata version=" + metadataVersion); } }</code><technical_language>do parent check adding map. do duplicate check itself. if (container.getParentAccountId() != id) { throw new IllegalStateException( "Container belong this account parentAccountId=" + container.getParentAccountId() + " is accountId=" + id); } if(containerIdToContainerMap.containsKey(container.getId()) || containerNameToContainerMap.containsKey(container.getName()){ throw exception.... }</technical_language>

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:
<code>public void testVisibilitySpinnerDefaultYes() { enterSettingScreen(); <START> onView(allOf(withText("Yes"), withParent(withId(R.id.spinner_visibility)))).check(matches(isDisplayed())); <END> }</code><technical_language>ID instead of hardcoding texts</technical_language>

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

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:
<code>private void createModule() { checkIfExists(); updateParentPOM(); pomService.create(moduleRoot, pom); createMavenDirectories(); kModuleService.setUpKModule(simpleModuleInstance.getKModuleXMLPath()); createDefaultPackage(); projectImportsService.saveProjectImports(simpleModuleInstance.getImportsPath()); <START> packageNameWhiteListService.createModuleWhiteList(simpleModuleInstance.getPackageNamesWhiteListPath(), <END> defaultPackageNamesWhiteListEntry()); moduleRepositoriesService.create(simpleModuleInstance.getRepositoriesPath()); }</code><technical_language>formating</technical_language>

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:
<code>public Collection<StashComment> getPullRequestOverviewComments(PullRequestRef pr) throws StashClientException { return getPaged( <START> MessageFormat.format(API_ONE_PR + "/activities", baseUrl, pr.project(), pr.repository(), pr.pullRequestId()), <END> "Error!" ).stream().map(StashCollector::extractCommentFromActivity).flatMap(StashPluginUtils::removeEmpty).collect(Collectors.toList()); }</code><technical_language>![MAJOR](<LINK_0> 'Severity: MAJOR') Format specifiers instead of string concatenation. [![rule](<LINK_1>](<LINK_2></technical_language>

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()); }