auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void sendPhoneVerificationToken(Study study, String userId, Phone phone) { checkNotNull(study); checkArgument(isNotBlank(userId)); if (phone == null) { return; } if (isRequestThrottled(ThrottleRequestType.VERIFY_PHONE, userId)) { return; } String sptoken = getNextToken(); <START> String formattedSpToken = sptoken.substring(0,3) + "-" + sptoken.substring(3,6); <END> SmsMessageProvider provider = new SmsMessageProvider.Builder() .withStudy(study) .withToken("sptoken", formattedSpToken) .withSmsTemplate(study.getVerifyPhoneSmsTemplate()) .withExpirationPeriod(PHONE_VERIFICATION_EXPIRATION_PERIOD, VERIFY_OR_RESET_EXPIRE_IN_SECONDS) .withPhone(phone).build(); notificationsService.sendSMSMessage(provider); }</code><technical_language>generate token, store anywhere. user verify phone, get "token invalid" error. Also, VerificationData currently distinguish phone email. This allows users receive token email, verify phone,</technical_language>

Target:
public void sendPhoneVerificationToken(Study study, String userId, Phone phone) { checkNotNull(study); checkArgument(isNotBlank(userId)); if (phone == null) { return; } if (isRequestThrottled(ThrottleRequestType.VERIFY_PHONE, userId)) { return; } String sptoken = getNextToken(); saveVerification(sptoken, new VerificationData(study.getIdentifier(), ChannelType.PHONE, userId)); String formattedSpToken = sptoken.substring(0,3) + "-" + sptoken.substring(3,6); SmsMessageProvider provider = new SmsMessageProvider.Builder() .withStudy(study) .withToken("sptoken", formattedSpToken) .withSmsTemplate(study.getVerifyPhoneSmsTemplate()) .withExpirationPeriod(PHONE_VERIFICATION_EXPIRATION_PERIOD, VERIFY_OR_RESET_EXPIRE_IN_SECONDS) .withPhone(phone).build(); notificationsService.sendSMSMessage(provider); }
Source:
<code><START> public void setIpv6BootProtocol(Ipv6BootProtocol ipv6BootProtocol) { <END> this.ipv6BootProtocol = ipv6BootProtocol; }</code><technical_language>Ipv4 code - "bootProtocol == null) ? Ipv4BootProtocol.NONE : bootProtocol;" adopted code here</technical_language>

Target:
public void setIpv6BootProtocol(Ipv6BootProtocol ipv6BootProtocol) { this.ipv6BootProtocol = (ipv6BootProtocol == null) ? Ipv6BootProtocol.NONE : ipv6BootProtocol; }
Source:
<code>public DataSet<LocatedRow> getDataSet(DataSetProcessor dsp) throws StandardException{ if(statusDirectory != null) { dsp.setPermissive(statusDirectory, getVTIFileName(), failBadRecordCount); } DataSet set=source.getDataSet(dsp); OperationContext operationContext=dsp.createOperationContext(this); ExecRow execRow=getExecRowDefinition(); int[] execRowTypeFormatIds=WriteReadUtils.getExecRowTypeFormatIds(execRow); if(insertMode.equals(InsertNode.InsertMode.UPSERT) && pkCols==null) throw ErrorState.UPSERT_NO_PRIMARY_KEYS.newException(""+heapConglom+""); TxnView txn=getCurrentTransaction(); operationContext.pushScope(); try{ if(statusDirectory!=null) { dsp.setSchedulerPool("import"); if (txn instanceof ActiveWriteTxn) { ActiveWriteTxn activeWriteTxn = (ActiveWriteTxn) txn; <START> activeWriteTxn.setAdditive(true); <END> } else if (txn instanceof WritableTxn) { WritableTxn writableTxn = (WritableTxn)txn; writableTxn.setAdditive(true); } } PairDataSet dataSet=set.index(new InsertPairFunction(operationContext),true); DataSetWriter writer=dataSet.insertData(operationContext) .autoIncrementRowLocationArray(autoIncrementRowLocationArray) .execRowDefinition(getExecRowDefinition()) .execRowTypeFormatIds(execRowTypeFormatIds) .sequences(spliceSequences) .isUpsert(insertMode.equals(InsertNode.InsertMode.UPSERT)) .pkCols(pkCols) .tableVersion(tableVersion) .destConglomerate(heapConglom) .operationContext(operationContext) .txn(txn) .build(); return writer.write(); }finally{ operationContext.popScope(); } }</code><technical_language>This transaction additive, changes current representation of transaction is. needs additive transaction is created</technical_language>

Target:
public DataSet<LocatedRow> getDataSet(DataSetProcessor dsp) throws StandardException{ if(statusDirectory != null) { dsp.setPermissive(statusDirectory, getVTIFileName(), failBadRecordCount); } DataSet set=source.getDataSet(dsp); OperationContext operationContext=dsp.createOperationContext(this); ExecRow execRow=getExecRowDefinition(); int[] execRowTypeFormatIds=WriteReadUtils.getExecRowTypeFormatIds(execRow); if(insertMode.equals(InsertNode.InsertMode.UPSERT) && pkCols==null) throw ErrorState.UPSERT_NO_PRIMARY_KEYS.newException(""+heapConglom+""); TxnView txn=getCurrentTransaction(); operationContext.pushScope(); try{ if(statusDirectory!=null) dsp.setSchedulerPool("import"); PairDataSet dataSet=set.index(new InsertPairFunction(operationContext),true); DataSetWriter writer=dataSet.insertData(operationContext) .autoIncrementRowLocationArray(autoIncrementRowLocationArray) .execRowDefinition(getExecRowDefinition()) .execRowTypeFormatIds(execRowTypeFormatIds) .sequences(spliceSequences) .isUpsert(insertMode.equals(InsertNode.InsertMode.UPSERT)) .pkCols(pkCols) .tableVersion(tableVersion) .destConglomerate(heapConglom) .operationContext(operationContext) .txn(txn) .build(); return writer.write(); }finally{ operationContext.popScope(); } }
Source:
<code>public static void main(String[] args) { if (args.length != 1) { System.err .println("usage: java edu.illinois.cs.cogcomp.lbj.pos.POSTagTokenized <text file>"); System.exit(1); } String testingFile = args[0]; POSTagger tagger = new POSTagger(); Parser parser = new ColumnFormat(testingFile); String sentence = ""; for (String[] s = (String[]) parser.next(); s != null; s = (String[]) parser.next()) { Token first = null; if (s.length > 0) { Token t = first = new Token(new Word(s[0]), null, null); for (int i = 1; i < s.length; ++i) { t.next = new Token(new Word(s[i]), t, null); t = (Token) t.next; } } for (Token word = first; word != null; word = (Token) word.next) { <START> String tag = tagger.discreteValue(word); <END> sentence += " (" + tag + " " + word.form + ")"; } logger.info(sentence.substring(1)); } }</code><technical_language>demo class, STDOUT</technical_language>

Target:
public static void main(String[] args) { if (args.length != 1) { System.err .println("usage: java edu.illinois.cs.cogcomp.lbj.pos.POSTagTokenized <text file>"); System.exit(1); } String testingFile = args[0]; POSTagger tagger = new POSTagger(); Parser parser = new ColumnFormat(testingFile); String sentence = ""; for (String[] s = (String[]) parser.next(); s != null; s = (String[]) parser.next()) { Token first = null; if (s.length > 0) { Token t = first = new Token(new Word(s[0]), null, null); for (int i = 1; i < s.length; ++i) { t.next = new Token(new Word(s[i]), t, null); t = (Token) t.next; } } for (Token word = first; word != null; word = (Token) word.next) { String tag = tagger.discreteValue(word); sentence += " (" + tag + " " + word.form + ")"; } System.out.println(sentence.substring(1)); } }
Source:
<code>private Integer getAutoMaxBandwidthForCluster(Guid clusterId) { Integer qosBandwidth = getQosBandwidth(clusterId); if (qosBandwidth != null) { return qosBandwidth; } Integer linkSpeedBandwidth = getLinkSpeedBandwidth(clusterId); <START> return linkSpeedBandwidth; <END> }</code><technical_language>please inline linkSpeedBandwidth</technical_language>

Target:
private Integer getAutoMaxBandwidthForCluster(Guid clusterId) { Integer qosBandwidth = getQosBandwidth(clusterId); if (qosBandwidth != null) { return qosBandwidth; } return getLinkSpeedBandwidth(clusterId); }
Source:
<code><START> public void forEach(MultimapAggregationStateConsumer consumer) <END> { BlockBuilder keyBlockBuilder = keyBlockBuilders.get(getGroupId()); BlockBuilder valueBlockBuilder = valueBlockBuilders.get(getGroupId()); for (int i = 0; !isEmpty() && keyBlockBuilder != null && i < keyBlockBuilder.getPositionCount(); i++) { consumer.accept(keyBlockBuilder, valueBlockBuilder, i); } }</code><technical_language>I write: java BlockBuilder keyBlockBuilder = keyBlockBuilders.get(getGroupId()); BlockBuilder valueBlockBuilder = valueBlockBuilders.get(getGroupId()); if (keyBlockBuilder == null) { return; } for (int i = 0; i < keyBlockBuilder.getPositionCount(); i++) { consumer.accept(keyBlockBuilder, valueBlockBuilder, i); } In general, for global checks keyBlockBuilder != null, do outsize loop instead of check loop. logic clear</technical_language>

Target:
public void forEach(MultimapAggregationStateConsumer consumer) { BlockBuilder keyBlockBuilder = keyBlockBuilders.get(getGroupId()); BlockBuilder valueBlockBuilder = valueBlockBuilders.get(getGroupId()); if (keyBlockBuilder == null) { return; } for (int i = 0; i < keyBlockBuilder.getPositionCount(); i++) { consumer.accept(keyBlockBuilder, valueBlockBuilder, i); } }
Source:
<code>public String insert(@RequestBody(required = true) JaxbRule rule) { long priority = rule.getPriority() == null ? 0 : rule.getPriority().longValue(); if (adminService.getRuleByPriority(priority) != null) { adminService.shift(priority, 1); } Long id = adminService.insert(rule.toRule()); if (rule.getLimits() != null && rule.getAccess().equals("LIMIT")) { adminService.setLimits(id, rule.getLimits().toRuleLimits(null)); } if (rule.getLayerDetails() != null && !rule.getAccess().equals("LIMIT")) { adminService.setDetails(id, rule.getLayerDetails().toLayerDetails(null)); } HttpHeaders headers = new HttpHeaders(); <START> headers.setContentType(MediaType.TEXT_PLAIN); <END> return String.valueOf(id); }</code><technical_language>headers used</technical_language>

Target:
public String insert(@RequestBody(required = true) JaxbRule rule) { long priority = rule.getPriority() == null ? 0 : rule.getPriority().longValue(); if (adminService.getRuleByPriority(priority) != null) { adminService.shift(priority, 1); } Long id = adminService.insert(rule.toRule()); if (rule.getLimits() != null && rule.getAccess().equals("LIMIT")) { adminService.setLimits(id, rule.getLimits().toRuleLimits(null)); } if (rule.getLayerDetails() != null && !rule.getAccess().equals("LIMIT")) { adminService.setDetails(id, rule.getLayerDetails().toLayerDetails(null)); } return String.valueOf(id); }
Source:
<code>public void verifyContainsElement(By childBy) { List<WebElement> elements = browser.driver.findElements(childBy); <START> assertFalse(elements.isEmpty()); <END> }</code><technical_language>inline elements here? method line long. for other methods</technical_language>

Target:
public void verifyContainsElement(By childBy) { assertFalse(browser.driver.findElements(childBy).isEmpty()); }
Source:
<code>public List<Resource> getAssignedResources(PerunSession sess, User user) throws InternalErrorException { try { return jdbc.query("select distinct " + resourceMappingSelectQuery + " from resources join groups_resources on resources.id=groups_resources.resource_id " + " join groups on groups_resources.group_id=groups.id" + " join groups_members on groups.id=groups_members.group_id " + " join members on groups_members.member_id=members.id " + " where members.user_id=?", RESOURCE_MAPPER, user.getId()); <START> } catch (EmptyResultDataAccessException e) { <END> return new ArrayList<>(); } catch (RuntimeException e) { throw new InternalErrorException(e); } }</code><technical_language>Peter B. in commit <LINK_0> this exception is thrown for jdbc.query is right. is problem in method jdbc.query</technical_language>

Target:
public List<Resource> getAssignedResources(PerunSession sess, User user) { try { return jdbc.query("select distinct " + resourceMappingSelectQuery + " from resources" + " join groups_resources on resources.id=groups_resources.resource_id " + " join groups on groups_resources.group_id=groups.id" + " join groups_members on groups.id=groups_members.group_id " + " join members on groups_members.member_id=members.id " + " where members.user_id=?", RESOURCE_MAPPER, user.getId()); } catch (RuntimeException e) { throw new InternalErrorException(e); } }
Source:
<code>void registerFlashMessageCallback(final DataTypeFlashMessage flashMessage) { switch (flashMessage.getType()) { case ERROR: break; <START> case WARNING: <END> warningCallback = flashMessage.getOnSuccess(); break; } }</code><technical_language>safer setting warningCallback = Optional.empty() is a risk remains set a previous warning</technical_language>

Target:
void registerFlashMessageCallback(final DataTypeFlashMessage flashMessage) { switch (flashMessage.getType()) { case ERROR: break; case WARNING: warningSuccessCallback = flashMessage.getOnSuccess(); warningErrorCallback = flashMessage.getOnError(); break; } }
Source:
<code>public ExecutorServiceBuilder maxPoolSize(int maxPoolSize) { if (maxPoolSize < corePoolSize) { <START> throw new IllegalArgumentException("maxPoolSize must be greater then corePoolSize"); <END> } this.maxPoolSize = maxPoolSize; return this; }</code><technical_language>suggestion throw new IllegalArgumentException("maxPoolSize greater corePoolSize");</technical_language>

Target:
public ExecutorServiceBuilder maxPoolSize(int maxPoolSize) { if (maxPoolSize < corePoolSize) { throw new IllegalArgumentException("maxPoolSize must be greater than corePoolSize"); } this.maxPoolSize = maxPoolSize; return this; }
Source:
<code>public TaskResult runTask(@NotNull TaskContext taskContext) { Build build; if (npmBuildContext.isNpmCommandInstall()) { build = executeNpmInstall(); } else { build = executeNpmPublish(); } if (build == null) { return failRun(taskContext); } <START> buildInfoHelper.addEnvVarsToBuild(npmBuildContext, build); <END> if (npmBuildContext.isCaptureBuildInfo()) { buildFromTask = build; } Map<String, String> customBuildData = taskContext.getBuildContext().getBuildResult().getCustomBuildData(); if (!customBuildData.containsKey(BUILD_RESULT_COLLECTION_ACTIVATED_PARAM)) { customBuildData.put(BUILD_RESULT_COLLECTION_ACTIVATED_PARAM, "true"); } return TaskResultBuilder.newBuilder(taskContext).success().build(); }</code><technical_language>inserted if bellow (redundant if build is captured)</technical_language>

Target:
public TaskResult runTask(@NotNull TaskContext taskContext) { Build build; if (npmBuildContext.isNpmCommandInstall()) { build = executeNpmInstall(); } else { build = executeNpmPublish(); } if (build == null) { return failRun(taskContext); } if (npmBuildContext.isCaptureBuildInfo()) { buildInfoHelper.addEnvVarsToBuild(npmBuildContext, build); taskBuildInfo = build; } Map<String, String> customBuildData = taskContext.getBuildContext().getBuildResult().getCustomBuildData(); if (!customBuildData.containsKey(BUILD_RESULT_COLLECTION_ACTIVATED_PARAM)) { customBuildData.put(BUILD_RESULT_COLLECTION_ACTIVATED_PARAM, "true"); } return TaskResultBuilder.newBuilder(taskContext).success().build(); }
Source:
<code>private CompositeByteBuf addComponents(boolean increaseIndex, int cIndex, Iterable<ByteBuf> buffers) { if (buffers instanceof ByteBuf) { return addComponent(increaseIndex, cIndex, (ByteBuf) buffers); } checkNotNull(buffers, "buffers"); Iterator<ByteBuf> it = buffers.iterator(); try { checkComponentIndex(cIndex); for (ByteBuf b; it.hasNext() && (b = it.next()) != null;) { cIndex = addComponent0(increaseIndex, cIndex, b) + 1; cIndex = Math.min(cIndex, componentCount); } <START> } finally { <END> while (it.hasNext()) { ReferenceCountUtil.safeRelease(it.next()); } } consolidateIfNeeded(); return this; }</code><technical_language>this addComponent() (not 0)</technical_language>

Target:
private CompositeByteBuf addComponents(boolean increaseIndex, int cIndex, Iterable<ByteBuf> buffers) { if (buffers instanceof ByteBuf) { return addComponent(increaseIndex, cIndex, (ByteBuf) buffers); } checkNotNull(buffers, "buffers"); Iterator<ByteBuf> it = buffers.iterator(); try { checkComponentIndex(cIndex); while (it.hasNext()) { ByteBuf b = it.next(); if (b == null) { break; } cIndex = addComponent0(increaseIndex, cIndex, b) + 1; cIndex = Math.min(cIndex, componentCount); } } finally { while (it.hasNext()) { ReferenceCountUtil.safeRelease(it.next()); } } consolidateIfNeeded(); return this; }
Source:
<code>protected void startDebugging(OpenShiftServerBehaviour behaviour, DebugContext context, IProgressMonitor monitor) { IDebugListener listener = new IDebugListener() { @Override public void onDebugChange(DebugContext context, IProgressMonitor monitor) throws CoreException { int localPort = mapPortForwarding(context, monitor); IServer server = behaviour.getServer(); ILaunch debuggerLaunch = attachRemoteDebugger(server, localPort, monitor); <START> if (debuggerLaunch != null) { <END> overrideHotcodeReplace(server, debuggerLaunch); } } @Override public void onPodRestart(DebugContext debuggingContext, IProgressMonitor monitor) throws CoreException { onDebugChange(debuggingContext, monitor); } }; context.setDebugListener(listener); OpenShiftDebugMode.enableDebugging(context, monitor); }</code><technical_language>![MAJOR](<LINK_1> 'Severity: MAJOR') Remove this expression evaluates "true" [![rule](<LINK_2>](<LINK_0></technical_language>

Target:
protected void startDebugging(OpenShiftServerBehaviour behaviour, DebugContext context, IProgressMonitor monitor) { IDebugListener listener = new IDebugListener() { @Override public void onDebugChange(DebugContext context, IProgressMonitor monitor) throws CoreException { int localPort = mapPortForwarding(context, monitor); IServer server = behaviour.getServer(); ILaunch debuggerLaunch = attachRemoteDebugger(server, localPort, monitor); if (debuggerLaunch != null) { overrideHotcodeReplace(server, debuggerLaunch); } } @Override public void onPodRestart(DebugContext debuggingContext, IProgressMonitor monitor) throws CoreException { onDebugChange(debuggingContext, monitor); } }; context.setDebugListener(listener); OpenShiftDebugMode.enableDebugging(context); }
Source:
<code>public void limit_asSubQuery() { realm.executeTransaction(r -> { for (int i = 0; i < 5; i++) { r.createObject(AllTypes.class).setColumnLong(i % 5); } }); RealmResults<AllTypes> results = realm.where(AllTypes.class) .sort(AllTypes.FIELD_LONG, Sort.DESCENDING) .findAll() .where() <START> .distinct(AllTypes.FIELD_LONG) <END> .findAll() .where() .limit(2) .findAll(); assertEquals(2, results.size()); assertEquals(4, results.first().getColumnLong()); assertEquals(3, results.last().getColumnLong()); }</code><technical_language>distinct is applied create duplicates r.createObject(AllTypes.class).setColumnLong(i % 5);</technical_language>

Target:
public void limit_asSubQuery() { realm.executeTransaction(r -> { for (int i = 0; i < 10; i++) { r.createObject(AllTypes.class).setColumnLong(i % 5); } }); RealmResults<AllTypes> results = realm.where(AllTypes.class) .sort(AllTypes.FIELD_LONG, Sort.DESCENDING) .findAll() .where() .distinct(AllTypes.FIELD_LONG) .findAll() .where() .limit(2) .findAll(); assertEquals(2, results.size()); assertEquals(4, results.first().getColumnLong()); assertEquals(3, results.last().getColumnLong()); }
Source:
<code>private static String toString(InputStream is) { try { <START> return new String(ByteStreams.toByteArray(is)); <END> } catch (IOException e) { throw new RuntimeException(e); } }</code><technical_language>charset</technical_language>

Target:
private static String toString(InputStream is) { try { return new String(ByteStreams.toByteArray(is), StandardCharsets.UTF_8); } catch (IOException e) { throw new RuntimeException(e); } }
Source:
<code>private boolean isValidReviewer(Account member, ChangeControl control) { if (member.isActive()) { IdentifiedUser user = identifiedUserFactory.create(member.getId()); <START> if (control.forUser(user).isRefVisible()) { return true; } <END> } return false; }</code><technical_language>[optional] this shortened to: return control.forUser(user).isRefVisible();</technical_language>

Target:
private boolean isValidReviewer(Account member, ChangeControl control) { if (member.isActive()) { IdentifiedUser user = identifiedUserFactory.create(member.getId()); return control.forUser(user).isRefVisible(); } return false; }
Source:
<code>public void render(){ <START> System.out.println("Rendering Path "+toString()); <END> for(Node n:nodes){ MojamComponent.screen.alphaFill((int)n.pos.x, (int)n.pos.y, Tile.WIDTH, Tile.HEIGHT, 0x00ccff, 0x10); } }</code><technical_language>This debug output deleted</technical_language>

Target:
public void render(){ for(Node n:nodes){ MojamComponent.screen.alphaFill((int)n.pos.x, (int)n.pos.y, Tile.WIDTH, Tile.HEIGHT, 0x00ccff, 0x10); } }
Source:
<code>private void markReachable(final Set<ObjectId> have, final int maxTime) throws IOException { for <START> (final Ref <END> r : local.getRefDatabase().getRefsByPrefix(ALL)) { ObjectId id = r.getPeeledObjectId(); if (id == null) id = r.getObjectId(); if (id == null) continue; parseReachable(id); } for (ObjectId id : local.getAdditionalHaves()) parseReachable(id); for (ObjectId id : have) parseReachable(id); if (maxTime > 0) { final Date maxWhen = new Date(maxTime * 1000L); walk.sort(RevSort.COMMIT_TIME_DESC); walk.markStart(reachableCommits); walk.setRevFilter(CommitTimeRevFilter.after(maxWhen)); for (;;) { final RevCommit c = walk.next(); if (c == null) break; if (c.has(ADVERTISED) && !c.has(COMMON)) { c.add(COMMON); c.carry(COMMON); reachableCommits.add(c); } } } }</code><technical_language>optional: while it, remove unnecessary "final". if aiming for a minimal change, 'refs' local var</technical_language>

Target:
private void markReachable(final Set<ObjectId> have, final int maxTime) throws IOException { for (Ref r : local.getRefDatabase().getRefsByPrefix(ALL)) { ObjectId id = r.getPeeledObjectId(); if (id == null) id = r.getObjectId(); if (id == null) continue; parseReachable(id); } for (ObjectId id : local.getAdditionalHaves()) parseReachable(id); for (ObjectId id : have) parseReachable(id); if (maxTime > 0) { final Date maxWhen = new Date(maxTime * 1000L); walk.sort(RevSort.COMMIT_TIME_DESC); walk.markStart(reachableCommits); walk.setRevFilter(CommitTimeRevFilter.after(maxWhen)); for (;;) { final RevCommit c = walk.next(); if (c == null) break; if (c.has(ADVERTISED) && !c.has(COMMON)) { c.add(COMMON); c.carry(COMMON); reachableCommits.add(c); } } } }
Source:
<code>public static Map<String, Object> optionsAsMap(List<Option> options) { Map<String, Object> map = new LinkedHashMap<String, Object>(); for (Option option : options) { String name = option.getName(); Object value = option.getValue(); if (value instanceof String || value instanceof List) { map.put(name, value); } else if (value instanceof Option) { Map<String, Object> newMap = optionsAsMap(Arrays.asList((Option) value)); Object oldValue = map.get(name); if (oldValue instanceof Map) { Map<String, Object> oldMap = (Map<String, Object>) oldValue; for (Map.Entry<String, Object> entry : newMap.entrySet()) { oldMap.put(entry.getKey(), entry.getValue()); } } else { map.put(name, newMap); } } else if (value instanceof Map) { Object oldValue = map.get(name); if (oldValue instanceof Map) { ((Map<String, Object>) oldValue).putAll((Map<String, Object>) value); } else { map.put(name, value); } } else { throw new AssertionError("Option value must be String, Option, List, or Map<String, ?>"); } } <START> return map; <END> }</code><technical_language>Yeah, unfortunate</technical_language>

Target:
public static Map<String, Object> optionsAsMap(List<Option> options) { Map<String, Object> map = new LinkedHashMap<String, Object>(); for (Option option : options) { String name = option.getName(); Object value = option.getValue(); if (value instanceof String || value instanceof List) { map.put(name, value); } else if (value instanceof Option) { Map<String, Object> newMap = optionsAsMap(Arrays.asList((Option) value)); Object oldValue = map.get(name); if (oldValue instanceof Map) { Map<String, Object> oldMap = (Map<String, Object>) oldValue; oldMap = new LinkedHashMap<String, Object>(oldMap); oldMap.putAll(newMap); map.put(name, oldMap); } else { map.put(name, newMap); } } else if (value instanceof Map) { Object oldValue = map.get(name); if (oldValue instanceof Map) { ((Map<String, Object>) oldValue).putAll((Map<String, Object>) value); } else { map.put(name, value); } } else { throw new AssertionError("Option value must be String, Option, List, or Map<String, ?>"); } } return unmodifiableMap(map); }
Source:
<code><START> public static TaskResultImpl getTaskResult(SchedulerDBManager dbManager, InternalJob job, InternalTask task) { <END> if (task == null){ return null; } TaskResultImpl taskResult; JobDescriptor jobDescriptor = job.getJobDescriptor(); if (jobDescriptor.getRunningTasks().get(task.getId()) != null){ taskResult = (TaskResultImpl) dbManager.loadTasksResults(job.getId(), Collections.singletonList(task.getId())) .get(task.getId()); } else { taskResult = getEmptyTaskResultWithTaskIdAndExecutionTime(task); if (jobDescriptor.getPausedTasks().get(task.getId()) != null){ taskResult.setPropagatedVariables(getPropagatedVariables(dbManager, job, task)); } } return taskResult; }</code><technical_language>Remove static more testable</technical_language>

Target:
public TaskResultImpl getTaskResult(SchedulerDBManager dbManager, InternalJob job, InternalTask task) throws UnknownTaskException { return getTaskResult(dbManager, job, task, null, null); }
Source:
<code>public void testParceling() { LinkAddress l; l = new LinkAddress(V6_ADDRESS, 64, 123, 456); assertParcelingIsLossless(l); l = new LinkAddress(V4 + "/28", IFA_F_PERMANENT, RT_SCOPE_LINK); <START> assertParcelingIsLossless(l); assertFieldCountEquals(4, LinkAddress.class); } <END></code><technical_language>this assertParcelSane</technical_language>

Target:
public void testParceling() { LinkAddress l; l = new LinkAddress(V6_ADDRESS, 64, 123, 456); assertParcelingIsLossless(l); l = new LinkAddress(V4 + "/28", IFA_F_PERMANENT, RT_SCOPE_LINK); assertParcelSane(l, 4); }
Source:
<code>public Map<SystemStreamPartition, List<IncomingMessageEnvelope>> poll(Set<SystemStreamPartition> systemStreamPartitions, long timeout) throws InterruptedException { <START> if (perminentEventHubError != null) { <END> String msg = String.format("Received a non transient error from event hub partition receiver (ssp=%s)", failedSSPReceiver); throw new SamzaException(msg, perminentEventHubError); } return super.poll(systemStreamPartitions, timeout); }</code><technical_language>s/perminent/permenant</technical_language>

Target:
public Map<SystemStreamPartition, List<IncomingMessageEnvelope>> poll(Set<SystemStreamPartition> systemStreamPartitions, long timeout) throws InterruptedException { Throwable handlerError = eventHubHandlerError.get(); if (handlerError != null) { if (isErrorTransient(handlerError)) { LOG.warn("Received a transient error from event hub partition receiver, restarted receiver", handlerError); } else { String msg = "Received a non transient error from event hub partition receiver"; throw new SamzaException(msg, handlerError); } } return super.poll(systemStreamPartitions, timeout); }
Source:
<code>public View getView(int position, View convertView, ViewGroup parent) { if (convertView == null) { convertView = inflater.inflate(R.layout.item_full_search_result, parent, false); } TextView pageTitleText = (TextView) convertView.findViewById(R.id.result_title); FullSearchResult result = (FullSearchResult) getItem(position); pageTitleText.setText(result.getTitle().getDisplayText()); TextView descriptionText = (TextView) convertView.findViewById(R.id.result_description); <START> descriptionText.setText(descriptionCache.get(result.getWikiBaseId())); <END> ImageView imageView = (ImageView) convertView.findViewById(R.id.result_image); String thumbnail = pageImagesCache.get(result.getTitle().getPrefixedText()); if (thumbnail == null) { Picasso.with(parent.getContext()) .load(R.drawable.ic_pageimage_placeholder) .into(imageView); } else { Picasso.with(parent.getContext()) .load(thumbnail) .placeholder(R.drawable.ic_pageimage_placeholder) .error(R.drawable.ic_pageimage_placeholder) .into(imageView); } if (position == results.size() - 1 && lastResults.getContinueOffset() > 0) { doSearch(currentSearchTerm, lastResults.getContinueOffset()); } return convertView; }</code><technical_language>crashes wikiBaseId is null</technical_language>

Target:
public View getView(int position, View convertView, ViewGroup parent) { if (convertView == null) { convertView = inflater.inflate(R.layout.item_full_search_result, parent, false); } TextView pageTitleText = (TextView) convertView.findViewById(R.id.result_title); FullSearchResult result = (FullSearchResult) getItem(position); pageTitleText.setText(result.getTitle().getDisplayText()); String wikidataId = result.getWikiBaseId(); if (!TextUtils.isEmpty(wikidataId)) { TextView descriptionText = (TextView) convertView.findViewById(R.id.result_description); descriptionText.setText(descriptionCache.get(wikidataId)); } ImageView imageView = (ImageView) convertView.findViewById(R.id.result_image); String thumbnail = pageImagesCache.get(result.getTitle().getPrefixedText()); if (thumbnail == null) { Picasso.with(parent.getContext()) .load(R.drawable.ic_pageimage_placeholder) .into(imageView); } else { Picasso.with(parent.getContext()) .load(thumbnail) .placeholder(R.drawable.ic_pageimage_placeholder) .error(R.drawable.ic_pageimage_placeholder) .into(imageView); } if (position == results.size() - 1 && lastResults.getContinueOffset() > 0) { doSearch(currentSearchTerm, lastResults.getContinueOffset()); } return convertView; }
Source:
<code>protected void consumerRemoved(SimpleConsumer consumer) { <START> this.inUseConsumerChannels.remove(consumer); <END> }</code><technical_language>wrong is here: ![wrong_object_to_remove](<LINK_0> this.inUseConsumerChannels.remove(consumer.getChannel());</technical_language>

Target:
protected void consumerRemoved(SimpleConsumer consumer) { this.inUseConsumerChannels.remove(consumer.getChannel()); this.whenUsed.remove(consumer); }
Source:
<code>public byte[] getBytes() { <START> ByteBuffer buffer = ByteBuffer.allocate(PARTITION_SIZE_IN_BYTES); <END> buffer.putShort(CURRENT_VERSION); buffer.putLong(id); return buffer.array(); }</code><technical_language>places partition is serialized? comfortable - this is repeated code needs in sync</technical_language>

Target:
public byte[] getBytes() { return ClusterMapUtils.serializeShortAndLong(CURRENT_VERSION, id); }
Source:
<code>private String buildURL(DownloadBuilder downloadBuilder) { StringBuilder result = new StringBuilder(); if (Strings.isFilled(downloadBuilder.getBaseURL())) { result.append(downloadBuilder.getBaseURL()); } result.append("/storage/physical/"); result.append(downloadBuilder.getBucket()); result.append("/"); if (downloadBuilder.isEternallyValid()) { result.append(computeEternallyValidHash(downloadBuilder.getPhysicalKey())); } else { result.append(computeHash(downloadBuilder.getPhysicalKey(), 0)); } result.append("/"); if (Strings.isFilled(downloadBuilder.getAddonText())) { <START> result.append(Strings.reduceCharacters(downloadBuilder.getAddonText()).replaceAll("[^a-zA-Z0-9\\-_.]", "-")); <END> result.append("--"); } result.append(downloadBuilder.getPhysicalKey()); result.append("."); result.append(downloadBuilder.getFileExtension()); if (Strings.isFilled(downloadBuilder.getFilename())) { result.append("?name="); result.append(Strings.urlEncode(downloadBuilder.getFilename())); } return result.toString(); }</code><technical_language>this replaceAll in sirius-kernel Files.java a Files.replaceSth Function</technical_language>

Target:
private String buildURL(DownloadBuilder downloadBuilder) { StringBuilder result = new StringBuilder(); if (Strings.isFilled(downloadBuilder.getBaseURL())) { result.append(downloadBuilder.getBaseURL()); } result.append("/storage/physical/"); result.append(downloadBuilder.getBucket()); result.append("/"); if (downloadBuilder.isEternallyValid()) { result.append(computeEternallyValidHash(downloadBuilder.getPhysicalKey())); } else { result.append(computeHash(downloadBuilder.getPhysicalKey(), 0)); } result.append("/"); if (Strings.isFilled(downloadBuilder.getAddonText())) { result.append(Strings.reduceCharacters(NON_URL_CHARACTERS.matcher(downloadBuilder.getAddonText()) .replaceAll("-"))); result.append("--"); } result.append(downloadBuilder.getPhysicalKey()); result.append("."); result.append(downloadBuilder.getFileExtension()); if (Strings.isFilled(downloadBuilder.getFilename())) { result.append("?name="); result.append(Strings.urlEncode(downloadBuilder.getFilename())); } return result.toString(); }
Source:
<code>public void attachDelegate(final OutputStream newDelegate) { <START> wrapped = Objects.requireNonNull(newDelegate); <END> }</code><technical_language>I harmless, previous delegate is flushed if is currently attached. detaching be</technical_language>

Target:
public void attachDelegate(final OutputStream newDelegate) { Preconditions.checkState(wrapped == null); wrapped = Objects.requireNonNull(newDelegate); }
Source:
<code>public void testTick() { Job j = new DummyJob(0); repo.addOrUpdateJob(j); Instant t1 = t0.plus(tickSize.multipliedBy(3).dividedBy(2)); ScheduledJob job = new ScheduledJob(t1, j.getId()); TestKit tk = new TestKit(system); ActorRef scheduler = system.actorOf(JobScheduler.props(repo, clock)); scheduler.tell(new JobScheduler.ScheduleCmd(job), tk.getRef()); tk.expectMsg(true); Assert.assertEquals(Collections.singletonList(job), getPlan(tk, scheduler)); clock.tick(); scheduler.tell(JobScheduler.Tick.INSTANCE, tk.getRef()); tk.expectNoMsg(); Assert.assertEquals(Collections.singletonList(job), getPlan(tk, scheduler)); clock.tick(); scheduler.tell(JobScheduler.Tick.INSTANCE, tk.getRef()); tk.expectMsg(JobExecutor.Success.INSTANCE); tk.expectNoMsg(); <START> System.out.println(getPlan(tk, scheduler)); <END> Assert.assertEquals( Collections.singletonList(new ScheduledJob(t1.plus(tickSize), j.getId())), getPlan(tk, scheduler)); }</code><technical_language>write system out; a logger</technical_language>

Target:
public void testTick() { Job j = new DummyJob(0); repo.addOrUpdateJob(j); Instant t1 = t0.plus(tickSize.multipliedBy(3).dividedBy(2)); ScheduledJob job = new ScheduledJob(t1, j.getId()); TestKit tk = new TestKit(system); ActorRef scheduler = system.actorOf(JobScheduler.props(repo, clock)); scheduler.tell(new JobScheduler.ScheduleCmd(job), tk.getRef()); tk.expectMsg(true); Assert.assertEquals(Collections.singletonList(job), getPlan(tk, scheduler)); clock.tick(); scheduler.tell(JobScheduler.Tick.INSTANCE, tk.getRef()); tk.expectNoMsg(); Assert.assertEquals(Collections.singletonList(job), getPlan(tk, scheduler)); clock.tick(); scheduler.tell(JobScheduler.Tick.INSTANCE, tk.getRef()); tk.expectMsg(JobExecutor.Success.INSTANCE); tk.expectNoMsg(); Assert.assertEquals( Collections.singletonList(new ScheduledJob(t1.plus(tickSize), j.getId())), getPlan(tk, scheduler)); }
Source:
<code>public ImageDescriptor getDisabledImageDescriptor() { return <START> DebugUITools.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_DUPLICATE_CONFIG); <END> }</code><technical_language>This IMG_WIZBAN_EXPORT_CONFIGS duplicate export icons currently</technical_language>

Target:
public ImageDescriptor getDisabledImageDescriptor() { return DebugUITools.getImageDescriptor(IInternalDebugUIConstants.IMG_WIZBAN_EXPORT_CONFIGS); }
Source:
<code>private String getReplicationId() { if(filter == null) { return this.sourceDb.getIdentifier() ; } else { <START> return this.sourceDb.getIdentifier() + "?" + filter.toString(); <END> } }</code><technical_language>Is this CouchDB uses? good consistent, people debugging things</technical_language>

Target:
private String getReplicationId() { if(filter == null) { return this.sourceDb.getIdentifier() ; } else { return this.sourceDb.getIdentifier() + "?" + filter.toQueryString(); } }
Source:
<code>default void copyToDirectory(Path outputDirectory) throws IOException { <START> checkNotNull(outputDirectory, outputDirectory); <END> copyToFile(outputDirectory.resolve(this.getFileName())); }</code><technical_language>checkNotNull(outputDirectory, "output directory');</technical_language>

Target:
default void copyToDirectory(Path outputDirectory) throws IOException { checkNotNull(outputDirectory, "outputDirectory"); copyToFile(outputDirectory.resolve(this.getFileName())); }
Source:
<code>public int hashCode() { int result = dataSource != null ? dataSource.hashCode() : 0; result = 31 * result + (context != null ? context.hashCode() : 0); result = 31 * result + (querySegmentSpec != null ? querySegmentSpec.hashCode() : 0); result = 31 * result + (duration != null ? duration.hashCode() : 0); <START> if (isDescending()) { <END> result = 31 * result + 1; } return result; }</code><technical_language>standard intellij auto-generated code do need hand-written</technical_language>

Target:
public int hashCode() { int result = dataSource != null ? dataSource.hashCode() : 0; result = 31 * result + (descending ? 1 : 0); result = 31 * result + (context != null ? context.hashCode() : 0); result = 31 * result + (querySegmentSpec != null ? querySegmentSpec.hashCode() : 0); result = 31 * result + (duration != null ? duration.hashCode() : 0); return result; }
Source:
<code>public ITmfTrace openTrace(String projectName, String traceName, boolean isExperiment) throws FileNotFoundException { IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); IProject rootProject = root.getProject(projectName); TmfProjectElement rootElement = TmfProjectRegistry.getProject(Objects.requireNonNull(rootProject)); <START> String childrenName = isExperiment ? "Experiments" : "Traces"; END> ITmfProjectModelElement traceFolder = rootElement.getChild(childrenName); ITmfProjectModelElement traceChild = traceFolder.getChild(traceName); if (!(traceChild instanceof TmfCommonProjectElement)) { throw new FileNotFoundException(); } Display.getDefault().syncExec(new Runnable() { @Override public void run() { TmfOpenTraceHelper.openTraceFromElement((TmfCommonProjectElement) traceChild); } }); TmfCommonProjectElement projectElement = (TmfCommonProjectElement) traceChild; ITmfTrace trace = projectElement.getTrace(); Integer tryCounter = 0; final Integer numberOfTry = 10; while (trace == null && tryCounter < numberOfTry) { try { Thread.sleep(100); } catch (InterruptedException e) { break; } trace = projectElement.getTrace(); tryCounter++; } if (trace != null) { return trace; } throw new FileNotFoundException(); }</code><technical_language>folderName</technical_language>

Target:
public ITmfTrace openTrace(String projectName, String traceName, boolean isExperiment) throws FileNotFoundException { IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); IProject rootProject = root.getProject(projectName); TmfProjectElement rootElement = TmfProjectRegistry.getProject(Objects.requireNonNull(rootProject)); String folderName = isExperiment ? "Experiments" : "Traces"; ITmfProjectModelElement traceFolder = rootElement.getChild(folderName); for(String name : traceName.split("/")) { traceFolder = traceFolder.getChild(name); } ITmfProjectModelElement traceChild = traceFolder; if (!(traceChild instanceof TmfCommonProjectElement)) { throw new FileNotFoundException(); } Display.getDefault().syncExec(new Runnable() { @Override public void run() { TmfOpenTraceHelper.openTraceFromElement((TmfCommonProjectElement) traceChild); } }); TmfCommonProjectElement projectElement = (TmfCommonProjectElement) traceChild; ITmfTrace trace = projectElement.getTrace(); Integer tryCounter = 0; final Integer numberOfTry = 10; while (trace == null && tryCounter < numberOfTry) { try { Thread.sleep(100); } catch (InterruptedException e) { break; } trace = projectElement.getTrace(); tryCounter++; } if (trace != null) { return trace; } throw new FileNotFoundException(); }
Source:
<code>protected void executeCommand() { <START> boolean isStorageDisconnectSucceeded = disconnectStorage(); <END> if(isStorageDisconnectSucceeded) { String connectionId = getConnection().getid(); if(StringUtils.isNotEmpty(connectionId)) { getDbFacade().getStorageServerConnectionDao().remove(connectionId); } setSucceeded(true); } }</code><technical_language>Alissa, MIchael wrote in earlier patchset - this call throw exception rest executed - connection removed db regardless, if network error vdsm call? want db record? In opinion logic "remove db attempt disconnect vdsm" - if fail disconnect vdsm meaning in db</technical_language>

Target:
protected void executeCommand() { String connectionId = getConnection().getid(); if(StringUtils.isNotEmpty(connectionId)) { getDbFacade().getStorageServerConnectionDao().remove(connectionId); } disconnectStorage(); setSucceeded(true); }
Source:
<code>public String playerHeight(@Sender EntityRef client, @CommandParam("height") float amount) { ClientComponent clientComp = client.getComponent(ClientComponent.class); CharacterMovementComponent move = clientComp.character.getComponent(CharacterMovementComponent.class); if (move != null) { float prevHeight = move.height; move.height = amount; clientComp.character.saveComponent(move); LocationComponent loc = client.getComponent(LocationComponent.class); Vector3f currentPosition = loc.getWorldPosition(); <START> teleportCommand(client, currentPosition.getX(), currentPosition.getY() + (amount - prevHeight)/2, currentPosition.getZ()); <END> physics.removeCharacterCollider(clientComp.character); physics.getCharacterCollider(clientComp.character); return "Height of player set to " + amount + " (was " + prevHeight + ")"; } return ""; }</code><technical_language>instead of other command for CharacterTeleportEvent(as in teleport command itself). reasons for this: (a) visible effect of sorts a change of player height, I bother character needed teleported, (b) easier refactor this want integrate potion effects such</technical_language>

Target:
public String playerHeight(@Sender EntityRef client, @CommandParam("height") float amount) { try { ClientComponent clientComp = client.getComponent(ClientComponent.class); CharacterMovementComponent move = clientComp.character.getComponent(CharacterMovementComponent.class); if (move != null) { float prevHeight = move.height; move.height = amount; clientComp.character.saveComponent(move); LocationComponent loc = client.getComponent(LocationComponent.class); Vector3f currentPosition = loc.getWorldPosition(); clientComp.character .send(new CharacterTeleportEvent(new Vector3f(currentPosition.getX(), currentPosition.getY() + (amount - prevHeight) / 2, currentPosition.getZ()))); physics.removeCharacterCollider(clientComp.character); physics.getCharacterCollider(clientComp.character); return "Height of player set to " + amount + " (was " + prevHeight + ")"; } return ""; } catch (NullPointerException e) { e.printStackTrace(); return ""; } }
Source:
<code>private static ServerJMSMessage processExtraProperties(ServerJMSMessage jms, TypedProperties properties) { if (properties != null) { properties.forEach((k, v) -> { <START> jms.getInnerMessage().putObjectProperty(k, v); <END> }); } return jms; }</code><technical_language>why</technical_language>

Target:
private static ServerJMSMessage processExtraProperties(ServerJMSMessage jms, TypedProperties properties) { if (properties != null) { properties.forEach((k, v) -> { if (!k.equals(AMQPMessage.ADDRESS_PROPERTY)) { jms.getInnerMessage().putObjectProperty(k, v); } }); } return jms; }
Source:
<code>private void deleteSubnet(GcpContext context, AuthenticatedContext auth, Network network, String subnetId) throws IOException { CloudResource subnetResource = createNamedResource(GCP_SUBNET, subnetId); try { CloudResource deletedResource = gcpSubnetResourceBuilder.delete(context, auth, subnetResource, network); if (deletedResource != null) { PollTask<List<CloudResourceStatus>> task = statusCheckFactory.newPollResourceTask( gcpSubnetResourceBuilder, auth, Collections.singletonList(deletedResource), context, true); syncPollingScheduler.schedule(task); } <START> } catch (Exception e) { <END> LOGGER.debug("Skipping resource creation: {}", e.getMessage()); } }</code><technical_language>creation -> deletion</technical_language>

Target:
private void deleteSubnet(GcpContext context, AuthenticatedContext auth, Network network, String subnetId) throws IOException { CloudResource subnetResource = createNamedResource(GCP_SUBNET, subnetId); try { CloudResource deletedResource = gcpSubnetResourceBuilder.delete(context, auth, subnetResource, network); if (deletedResource != null) { PollTask<List<CloudResourceStatus>> task = statusCheckFactory.newPollResourceTask( gcpSubnetResourceBuilder, auth, Collections.singletonList(deletedResource), context, true); syncPollingScheduler.schedule(task); } } catch (Exception e) { LOGGER.debug("Skipping resource deletion: {}", e.getMessage()); } }
Source:
<code>public Set<SystemPackage> getObject() { final long start = System.currentTimeMillis(); Set<SystemPackage> systemPackages = createSystemPackages(); final long finish = System.currentTimeMillis(); <START> if (logger.isInfoEnabled() && (finish - start) > 1500L) { <END> logger.info("System Package scanning took '{}' milliseconds. Possible improvement: enable System Package " + "cache by adding 'osgi.container.system-package-cache.mode:ENABLE' " + "to 'osgi-container.properties' (DISABLE by default because of #281)", (finish - start)); } return systemPackages; }</code><technical_language>is need wrap this check logger.isInfoEnabled(). In general, checking if a log level is enabled is expensive operations create log messages</technical_language>

Target:
public Set<SystemPackage> getObject() { final long start = System.currentTimeMillis(); Set<SystemPackage> systemPackages = createSystemPackages(); final long finish = System.currentTimeMillis(); if (finish - start > 1500L) { logger.info("System Package scanning took '{}' milliseconds. Possible improvement: enable System Package " + "cache by adding 'osgi.container.system-package-cache.mode:ENABLE' " + "to 'osgi-container.properties'", (finish - start)); } return systemPackages; }
Source:
<code>public void setTaskScheduler(TaskScheduler taskScheduler) { <START> setTaskScheduler(taskScheduler); <END> }</code><technical_language>??? work? super.. IDEA shows recursion for</technical_language>

Target:
public void setTaskScheduler(TaskScheduler taskScheduler) { super.setTaskScheduler(taskScheduler); }
Source:
<code>public void apply(RequestTemplate requestTemplate) { String accessToken = accessTokenGenerator.getAccessToken(APIConstants.KEY_MANAGER_OAUTH2_REST_API_MGT_SCOPES); requestTemplate.header("Authorization", "Bearer " + accessToken); <START> } <END></code><technical_language>constants in APIConstant class. AUTHORIZATION_HEADER_DEFAULT, AUTHORIZATION_BEARER</technical_language>

Target:
public void apply(RequestTemplate requestTemplate) { String accessToken = accessTokenGenerator.getAccessToken(APIConstants.KEY_MANAGER_OAUTH2_REST_API_MGT_SCOPES); requestTemplate .header(APIConstants.AUTHORIZATION_HEADER_DEFAULT, APIConstants.AUTHORIZATION_BEARER + accessToken); }
Source:
<code>public void submitWithoutConfirmationEmail() { WebElement sendEmailChecbox = browser.driver.findElement(By.name(Const.ParamsNames.SEND_SUBMISSION_EMAIL)); WebElement submitButton = browser.driver.findElement(By.id("response_submit_button")); if (sendEmailChecbox.isSelected()) { click(sendEmailChecbox); } click(submitButton); <START> waitForPageToLoad(); <END> }</code><technical_language>reuse clickSubmitButton() instead of repeating contents of function</technical_language>

Target:
public void submitWithoutConfirmationEmail() { WebElement sendEmailChecbox = browser.driver.findElement(By.name(Const.ParamsNames.SEND_SUBMISSION_EMAIL)); if (sendEmailChecbox.isSelected()) { click(sendEmailChecbox); } clickSubmitButton(); }