auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void loggedInViaSocialAccount(ArrayList<Integer> oldSitesIds) { AnalyticsTracker.track(AnalyticsTracker.Stat.LOGIN_GOOGLE_SUCCEEDED); <START> AnalyticsTracker.track(AnalyticsTracker.Stat.LOGIN_SOCIAL_SUCCESS); <END> loggedInAndFinish(oldSitesIds); }</code><technical_language>LOGIN_GOOGLE_SUCCEEDED LOGIN_SOCIAL_SUCCESS unnecessary if Google is social login. remove LOGIN_GOOGLE_SUCCEEDED other social login types added of stats triggered time LOGIN_SOCIAL_SUCCESS corresponds Calypso</technical_language>

Target:
public void loggedInViaSocialAccount(ArrayList<Integer> oldSitesIds) { AnalyticsTracker.track(AnalyticsTracker.Stat.LOGIN_SOCIAL_SUCCESS); loggedInAndFinish(oldSitesIds); }
Source:
<code>private static DateTime findLastDueDate(final GratuityEventWithPaymentPlan event) { return event.getInstallments().stream().map(i -> i.getEndDate().toDateTimeAtMidnight()).max(new Comparator<DateTime>() { <START> @Override <END> public int compare(DateTime o1, DateTime o2) { return o1.compareTo(o2); } }).orElse(null); }</code><technical_language>lambda above</technical_language>

Target:
private static DateTime findLastDueDate(final GratuityEventWithPaymentPlan event) { return event.getInstallments().stream().map(i -> i.getEndDate().toDateTimeAtMidnight()).max(DateTime::compareTo).orElse(null); }
Source:
<code>protected Object visitDataWriteCommand(InvocationContext ctx, DataWriteCommand command) throws Throwable { try { Object stage; Object key = command.getKey(); if (hasSkipLocking(command)) { if (ctx.isInTxScope()) { ((TxInvocationContext<?>) ctx).addAffectedKey(key); } stage = invokeNext(ctx, command); } else { if (!needRemoteLocks(ctx, key, command)) { acquireLocalLock(ctx, command); stage = invokeNext(ctx, command); } else { final TxInvocationContext txContext = (TxInvocationContext) ctx; LockControlCommand lcc = cf.buildLockControlCommand(key, command.getFlagsBitSet(), txContext.getGlobalTransaction()); return invokeNextAndHandle(ctx, lcc, (rCtx, rCommand, rv, t) -> { rethrowAndReleaseLocksIfNeeded(rCtx, t); acquireLocalLock(rCtx, command); return invokeNext(rCtx, command); }); } } <START> return makeStage(stage).andFinally(ctx, command, (rCtx, rCommand, rv, t) -> { <END> if (t != null) { rethrowAndReleaseLocksIfNeeded(rCtx, t); } }); } catch (Throwable t) { releaseLocksOnFailureBeforePrepare(ctx); throw t; } }</code><technical_language>andExceptionally more appropriate</technical_language>

Target:
protected Object visitDataWriteCommand(InvocationContext ctx, DataWriteCommand command) throws Throwable { try { Object stage; Object key = command.getKey(); if (hasSkipLocking(command)) { if (ctx.isInTxScope()) { ((TxInvocationContext<?>) ctx).addAffectedKey(key); } stage = invokeNext(ctx, command); } else { if (!needRemoteLocks(ctx, key, command)) { acquireLocalLock(ctx, command); stage = invokeNext(ctx, command); } else { final TxInvocationContext txContext = (TxInvocationContext) ctx; LockControlCommand lcc = cf.buildLockControlCommand(key, command.getFlagsBitSet(), txContext.getGlobalTransaction()); return invokeNextAndHandle(ctx, lcc, (rCtx, rCommand, rv, t) -> { rethrowAndReleaseLocksIfNeeded(rCtx, t); acquireLocalLock(rCtx, command); return invokeNext(rCtx, command); }); } } return makeStage(stage).andExceptionally(ctx, command, (rCtx, rCommand, t) -> { rethrowAndReleaseLocksIfNeeded(rCtx, t); throw t; }); } catch (Throwable t) { releaseLocksOnFailureBeforePrepare(ctx); throw t; } }
Source:
<code>public NameEnvironmentAnswer findSecondaryInClass(char[] typeName, String qualifiedPackageName, String qualifiedBinaryFileName) { <START> if(Arrays.equals(TypeConstants.PACKAGE_INFO_NAME, <END> typeName)) { return null; } String typeNameString = new String(typeName); String moduleName = this.module != null ? String.valueOf(this.module.name()) : null; boolean prereqs = this.options != null && isPackage(qualifiedPackageName, moduleName) && ((this.mode & SOURCE) != 0) && doesFileExist(typeNameString + SUFFIX_STRING_java, qualifiedPackageName); return prereqs ? null : findSourceSecondaryType(typeNameString, qualifiedPackageName, qualifiedBinaryFileName); }</code><technical_language>I CharOperation.equals source code uniform</technical_language>

Target:
public NameEnvironmentAnswer findSecondaryInClass(char[] typeName, String qualifiedPackageName, String qualifiedBinaryFileName) { if(CharOperation.equals(TypeConstants.PACKAGE_INFO_NAME, typeName)) { return null; } String typeNameString = new String(typeName); String moduleName = this.module != null ? String.valueOf(this.module.name()) : null; boolean prereqs = this.options != null && isPackage(qualifiedPackageName, moduleName) && ((this.mode & SOURCE) != 0) && doesFileExist(typeNameString + SUFFIX_STRING_java, qualifiedPackageName); return prereqs ? null : findSourceSecondaryType(typeNameString, qualifiedPackageName, qualifiedBinaryFileName); }
Source:
<code>public void report(CheckLevel level, JSError error) { if (!debug && level == CheckLevel.WARNING) return; if (reportClutzMissingTypes && error.description.contains("Bad type annotation. Unknown type")) { <START> reportClutzMissingTypes = false; <END> this.report(CheckLevel.ERROR, JSError.make(error.sourceName, error.getLineNumber(), error.getCharno(), DeclarationGenerator.CLUTZ_MISSING_TYPES)); } super.report(level, error); }</code><technical_language>report occurrences? trading noisy output for need rerun more errors</technical_language>

Target:
public void report(CheckLevel level, JSError error) { if (!debug && level == CheckLevel.WARNING) return; if (reportClutzMissingTypes && error.description.contains("Bad type annotation. Unknown type")) { reportClutzMissingTypes = false; this.report(CheckLevel.ERROR, JSError.make(DeclarationGenerator.CLUTZ_MISSING_TYPES)); } super.report(level, error); }
Source:
<code>protected Event doExecute(final RequestContext requestContext) { val principal = WebUtils.getAuthentication(requestContext).getPrincipal(); val applicationContext = ApplicationContextProvider.getApplicationContext(); val flowId = requestContext.getActiveFlow().getId(); <START> val provider = (DuoMultifactorAuthenticationProvider) <END> MultifactorAuthenticationUtils.getMultifactorAuthenticationProviderById(flowId, applicationContext).orElseThrow(AbstractMethodError::new); val credential = requestContext.getFlowScope().get(CasWebflowConstants.VAR_ID_CREDENTIAL, DuoCredential.class); credential.setUsername(principal.getId()); credential.setMultifactorProviderId(provider.getId()); val duoAuthenticationService = provider.getDuoAuthenticationService(); val viewScope = requestContext.getViewScope(); viewScope.put("sigRequest", duoAuthenticationService.signRequestToken(principal.getId())); viewScope.put("apiHost", duoAuthenticationService.getApiHost()); viewScope.put("commandName", "credential"); viewScope.put("principal", principal); return success(); }</code><technical_language>Fix wrap</technical_language>

Target:
protected Event doExecute(final RequestContext requestContext) { val principal = WebUtils.getAuthentication(requestContext).getPrincipal(); val credential = requestContext.getFlowScope().get(CasWebflowConstants.VAR_ID_CREDENTIAL, DuoCredential.class); credential.setUsername(principal.getId()); credential.setProviderId(provider.createUniqueId()); val duoAuthenticationService = provider.getDuoAuthenticationService(); val viewScope = requestContext.getViewScope(); viewScope.put("sigRequest", duoAuthenticationService.signRequestToken(principal.getId())); viewScope.put("apiHost", duoAuthenticationService.getApiHost()); viewScope.put("commandName", "credential"); viewScope.put("principal", principal); return success(); }
Source:
<code><START> private void dropLease() { <END> Collection<KinesisClientLease> leases = leaseCoordinator.getAssignments(); if(leases != null && !leases.isEmpty()) { for(KinesisClientLease lease : leases) { if(lease.getLeaseKey().equals(shardInfo.getShardId())) { leaseCoordinator.dropLease(lease); LOG.warn("Dropped lease for shutting down ShardConsumer: " + lease.getLeaseKey()); break; } } } }</code><technical_language>this again, leaseManager.getLease(shardInfo.getShardId()) here</technical_language>

Target:
private void dropLease() { KinesisClientLease lease = leaseCoordinator.getCurrentlyHeldLease(shardInfo.getShardId()); leaseCoordinator.dropLease(lease); LOG.warn("Dropped lease for shutting down ShardConsumer: " + lease.getLeaseKey()); }
Source:
<code>public static Scheduler computation() { <START> synchronized (computationGuard) { <END> if (computationScheduler == null) { Scheduler c = RxJavaPlugins.getInstance().getSchedulersHook().getComputationScheduler(); if (c != null) { computationScheduler = c; } else { computationScheduler = new EventLoopsScheduler(); } } return computationScheduler; } }</code><technical_language>I putting a synchronized block in line of fire this need be. This is a global lock type of stuff I find in production environments</technical_language>

Target:
public static Scheduler computation() { Scheduler s = computationScheduler; if (s != null) { return s; } synchronized (computationGuard) { if (computationScheduler == null) { Scheduler c = RxJavaPlugins.getInstance().getSchedulersHook().getComputationScheduler(); if (c != null) { computationScheduler = c; } else { computationScheduler = new EventLoopsScheduler(); } } return computationScheduler; } }
Source:
<code>private void setupHBaseDist() throws IOException { final Path downloadDirectory = tmp.newFolder("getOrDownload").toPath(); final Path hbaseArchive = downloadCache.getOrDownload(getHBaseDownloadUrl(), downloadDirectory); <START> LOG.info("HBase localtion: {}", hbaseDir.toAbsolutePath()); <END> AutoClosableProcess.runBlocking(CommandLineWrapper .tar(hbaseArchive) .extract() .zipped() .strip(1) .targetDir(hbaseDir) .build()); LOG.info("Configure as hbase.tmp.dir", hbaseDir.toAbsolutePath()); final String tmpDirConfig = "<configuration><property><name>hbase.tmp.dir</name><value>" + hbaseDir + "</value></property></configuration>"; Files.write(hbaseDir.resolve(Paths.get("conf", "hbase-site.xml")), tmpDirConfig.getBytes()); }</code><technical_language>suggestion LOG.info("HBase location: {}", hbaseDir.toAbsolutePath());</technical_language>

Target:
private void setupHBaseDist() throws IOException { final Path downloadDirectory = tmp.newFolder("getOrDownload").toPath(); final Path hbaseArchive = downloadCache.getOrDownload(getHBaseDownloadUrl(), downloadDirectory); LOG.info("HBase location: {}", hbaseDir.toAbsolutePath()); AutoClosableProcess.runBlocking(CommandLineWrapper .tar(hbaseArchive) .extract() .zipped() .strip(1) .targetDir(hbaseDir) .build()); LOG.info("Configure as hbase.tmp.dir", hbaseDir.toAbsolutePath()); final String tmpDirConfig = "<configuration><property><name>hbase.tmp.dir</name><value>" + hbaseDir + "</value></property></configuration>"; Files.write(hbaseDir.resolve(Paths.get("conf", "hbase-site.xml")), tmpDirConfig.getBytes()); }
Source:
<code>private boolean shouldTrigger(Run upstreamBuild, TaskListener listener) { Jenkins jenkins = Jenkins.getInstance(); if (job == null) { return false; } boolean downstreamVisible = false; boolean downstreamDiscoverable = false; try { downstreamVisible = jenkins.getItemByFullName(job.getFullName()) == job; } catch (AccessDeniedException ex) { downstreamDiscoverable = true; } Authentication originalAuth = Jenkins.getAuthentication(); Job upstream = upstreamBuild.getParent(); Authentication auth = Tasks.getAuthenticationOf((Queue.Task) job); if (auth.equals(ACL.SYSTEM) && !QueueItemAuthenticatorConfiguration.get().getAuthenticators().isEmpty()) { auth = Jenkins.ANONYMOUS; } SecurityContext orig = ACL.impersonate(auth); Item authUpstream = null; try { authUpstream = jenkins.getItemByFullName(upstream.getFullName()); } catch (AccessDeniedException ade) { } finally { SecurityContextHolder.setContext(orig); } if(authUpstream != upstream) { if (downstreamVisible) { listener.getLogger().println(Messages.ReverseBuildTrigger_running_as_cannot_even_see_for_trigger_f(auth.getName(), upstream.getFullName(), job.getFullName())); } else { <START> LOGGER.log(Level.WARNING, Messages.ReverseBuildTrigger_running_as_cannot_even_see_but_cannot_tell(auth.getName(), <END> downstreamDiscoverable ? "READ" : "DISCOVER", upstream, job, originalAuth.getName())); } return false; } Result result = upstreamBuild.getResult(); return result != null && result.isBetterOrEqualTo(threshold); }</code><technical_language>System log messages localized</technical_language>

Target:
private boolean shouldTrigger(Run upstreamBuild, TaskListener listener) { Jenkins jenkins = Jenkins.getInstance(); if (job == null) { return false; } boolean downstreamVisible = false; boolean downstreamDiscoverable = false; try { downstreamVisible = jenkins.getItemByFullName(job.getFullName()) == job; } catch (AccessDeniedException ex) { downstreamDiscoverable = true; } Authentication originalAuth = Jenkins.getAuthentication(); Job upstream = upstreamBuild.getParent(); Authentication auth = Tasks.getAuthenticationOf((Queue.Task) job); if (auth.equals(ACL.SYSTEM) && !QueueItemAuthenticatorConfiguration.get().getAuthenticators().isEmpty()) { auth = Jenkins.ANONYMOUS; } SecurityContext orig = ACL.impersonate(auth); Item authUpstream = null; try { authUpstream = jenkins.getItemByFullName(upstream.getFullName()); } catch (AccessDeniedException ade) { } finally { SecurityContextHolder.setContext(orig); } if(authUpstream != upstream) { if (downstreamVisible) { listener.getLogger().println(Messages.ReverseBuildTrigger_running_as_cannot_even_see_for_trigger_f(auth.getName(), upstream.getFullName(), job.getFullName())); } else { LOGGER.log(Level.WARNING, "Running as {0} cannot even {1} {2} for trigger from {3}, (but cannot tell {4} that)", new Object { auth.getName(), downstreamDiscoverable ? "READ" : "DISCOVER", upstream, job, originalAuth.getName()}); } return false; } Result result = upstreamBuild.getResult(); return result != null && result.isBetterOrEqualTo(threshold); }
Source:
<code>private void readSXSHD() throws NitfFormatException { TreCollection extendedSubheaderTREs = parsingStrategy.parseTREs(reader, graphicExtendedSubheaderLength - GraphicSegmentConstants.SXSOFL_LENGTH, TreSource.GraphicExtendedSubheaderData); segment.mergeTREs(extendedSubheaderTREs); <START> } <END></code><technical_language>I static imports</technical_language>

Target:
private void readSXSHD() throws NitfFormatException { TreCollection extendedSubheaderTREs = parsingStrategy.parseTREs(reader, graphicExtendedSubheaderLength - SXSOFL_LENGTH, TreSource.GraphicExtendedSubheaderData); segment.mergeTREs(extendedSubheaderTREs); }
Source:
<code>private int readByte() throws IOException, InvalidPacketException { long deadline = new Date().getTime() + 200; int b = inputStream.read(); while (b == -1 && new Date().getTime() < deadline) { b = inputStream.read(); try { Thread.sleep(10); } catch (InterruptedException e) } if (b == -1) <START> throw new InvalidPacketException("Read -1 from stream."); <END> if (mode == OperatingMode.API_ESCAPE) { if (SpecialByte.isSpecialByte(b)) { if (b == SpecialByte.ESCAPE_BYTE.getValue()) { deadline = new Date().getTime() + 200; b = inputStream.read(); while (b == -1 && new Date().getTime() < deadline) { b = inputStream.read(); try { Thread.sleep(10); } catch (InterruptedException e) } if (b == -1) throw new InvalidPacketException("Read -1 from stream."); b ^= 0x20; } else { } } } if (lengthRead) { checksum.add(b); readBytes += 1; if (readBytes >= length + 1) { if (!checksum.validate()) throw new InvalidPacketException("Error verifying packet checksum."); } } return b; }</code><technical_language>change this message by: "Error parsing packet: Incomplete packet" add more information, for a user is a message. I apply for rest of "Read -1... " messages</technical_language>

Target:
private int readByte() throws IOException, InvalidPacketException { long deadline = new Date().getTime() + 200; int b = inputStream.read(); while (b == -1 && new Date().getTime() < deadline) { b = inputStream.read(); try { Thread.sleep(10); } catch (InterruptedException e) } if (b == -1) throw new InvalidPacketException("Error parsing packet: Incomplete packet."); if (mode == OperatingMode.API_ESCAPE) { if (SpecialByte.isSpecialByte(b)) { if (b == SpecialByte.ESCAPE_BYTE.getValue()) { deadline = new Date().getTime() + 200; b = inputStream.read(); while (b == -1 && new Date().getTime() < deadline) { b = inputStream.read(); try { Thread.sleep(10); } catch (InterruptedException e) } if (b == -1) throw new InvalidPacketException("Error parsing packet: Incomplete packet."); b ^= 0x20; } else { throw new InvalidPacketException("Expecting a " + SpecialByte.ESCAPE_BYTE.getValue() + ", but got " + b); } } } if (lengthRead) { checksum.add(b); readBytes += 1; if (readBytes >= length + 1) { if (!checksum.validate()) throw new InvalidPacketException("Error verifying packet checksum."); } } return b; }
Source:
<code>private void registerPaxosResource() { <START> paxosResources.resourcesForRegistration().forEach(registrar); <END> }</code><technical_language>non-actionable: This is correct. I prefer reads, feel strongly</technical_language>

Target:
private void registerPaxosResource() { paxosResources.resourcesForRegistration().forEach(registrar::accept); }
Source:
<code>public void executeCommand(UICommand command) { super.executeCommand(command); if (command == getRemoveCommand()) { remove(); } <START> else if ("Cancel".equals(command.getName())) { END> cancel(); } }</code><technical_language>I point of a cancel action in a subtab</technical_language>

Target:
public void executeCommand(UICommand command) { super.executeCommand(command); if (command == getRemoveCommand()) { remove(); } }
Source:
<code>public void deleteWireConfiguration(final WireConfiguration wireConfiguration) { requireNonNull(wireConfiguration, s_message.wireConfigurationNonNull()); s_logger.info(s_message.removingWires()); try { final Wire[] wiresList = this.wireAdmin.getWires(null); if (wiresList != null) { for (final Wire wire : wiresList) { final Dictionary<?, ?> props = wire.getProperties(); final String producerPid = props.get(WIREADMIN_PRODUCER_PID).toString(); final String consumerPid = props.get(WIREADMIN_CONSUMER_PID).toString(); final String emitterFactoryPid = this.wireHelperService .getServicePid(wireConfiguration.getEmitterPid()); final String receiverFactoryPid = this.wireHelperService .getServicePid(wireConfiguration.getReceiverPid()); if ((emitterFactoryPid != null) && (receiverFactoryPid != null) && producerPid.equals(emitterFactoryPid) && consumerPid.equals(receiverFactoryPid)) { synchronized (this.wireConfigs) { for (final Iterator<WireConfiguration> iter = this.wireConfigs.iterator(); iter .hasNext();) { final WireConfiguration configuration = iter.next(); if (configuration.equals(wireConfiguration)) { iter.remove(); this.wireAdmin.deleteWire(wire); break; } } } } } } } catch (final InvalidSyntaxException e) { <START> throw new IllegalArgumentException(ThrowableUtil.stackTraceAsString(e)); <END> } s_logger.info(s_message.removingWiresDone()); }</code><technical_language>throw in exception is intended</technical_language>

Target:
public void deleteWireConfiguration(final WireConfiguration wireConfiguration) { requireNonNull(wireConfiguration, message.wireConfigurationNonNull()); logger.info(message.removingWires()); try { final Wire[] wiresList = this.wireAdmin.getWires(wireConfiguration.getFilter()); if (wiresList != null) { for (final Wire wire : wiresList) { final Dictionary<?, ?> props = wire.getProperties(); final String producerPid = props.get(WIREADMIN_PRODUCER_PID).toString(); final String consumerPid = props.get(WIREADMIN_CONSUMER_PID).toString(); final String emitterFactoryPid = this.wireHelperService .getServicePid(wireConfiguration.getEmitterPid()); final String receiverFactoryPid = this.wireHelperService .getServicePid(wireConfiguration.getReceiverPid()); if ((emitterFactoryPid != null) && (receiverFactoryPid != null) && producerPid.equals(emitterFactoryPid) && consumerPid.equals(receiverFactoryPid)) { synchronized (this.wireConfigs) { for (final Iterator<WireConfiguration> iter = this.wireConfigs.iterator(); iter .hasNext();) { final WireConfiguration configuration = iter.next(); if (configuration.equals(wireConfiguration)) { iter.remove(); this.wireAdmin.deleteWire(wire); break; } } } } } } } catch (final InvalidSyntaxException ise) { throw new IllegalArgumentException(ise); } logger.info(message.removingWiresDone()); }
Source:
<code>public void setUnlogged(String user) { String sql = "UPDATE " + tableName + " SET " + col.IS_LOGGED + "=? WHERE LOWER(" + col.NAME + ")=?;"; if (user != null) { try (PreparedStatement pst = con.prepareStatement(sql)) { pst.setInt(1, 0); pst.setString(2, user); pst.executeUpdate(); } catch (SQLException ex) { logSqlException(ex); } } <START> } <END></code><technical_language>in MySQL class, missing initialization of hasSession column</technical_language>

Target:
public void setUnlogged(String user) { String sql = "UPDATE " + tableName + " SET " + col.IS_LOGGED + "=? WHERE LOWER(" + col.NAME + ")=?;"; try (PreparedStatement pst = con.prepareStatement(sql)) { pst.setInt(1, 0); pst.setString(2, user); pst.executeUpdate(); } catch (SQLException ex) { logSqlException(ex); } }
Source:
<code>public Validation validate(Validation val) { if (SystemEnvironment.getProperty("jetty.home", "").equals("")) { new SystemEnvironment().setProperty("jetty.home", new SystemEnvironment().getPropertyImpl("user.dir")); <START> new SystemEnvironment().setProperty("jetty.base", new SystemEnvironment().getPropertyImpl("user.dir")); <END> } File home = new File(new SystemEnvironment().getPropertyImpl("jetty.home")); File work = new File(new SystemEnvironment().getPropertyImpl("jetty.home"), "work"); if (home.exists()) { if (work.exists()) { try { FileUtils.deleteDirectory(work); } catch (IOException e) { String message = format("Error trying to remove Jetty working directory {0}: {1}", work.getAbsolutePath(), e); return val.addError(new RuntimeException(message)); } } work.mkdir(); } return Validation.SUCCESS; }</code><technical_language>Is a possibility jetty.home is empty, jetty.base is? In case, jetty.base left empty</technical_language>

Target:
public Validation validate(Validation val) { SystemEnvironment systemEnvironment = new SystemEnvironment(); if (SystemEnvironment.getProperty("jetty.home", "").equals("")) { systemEnvironment.setProperty("jetty.home", systemEnvironment.getPropertyImpl("user.dir")); } systemEnvironment.setProperty("jetty.base", systemEnvironment.getPropertyImpl("jetty.home")); File home = new File(systemEnvironment.getPropertyImpl("jetty.home")); File work = new File(systemEnvironment.getPropertyImpl("jetty.home"), "work"); if (home.exists()) { if (work.exists()) { try { FileUtils.deleteDirectory(work); } catch (IOException e) { String message = format("Error trying to remove Jetty working directory {0}: {1}", work.getAbsolutePath(), e); return val.addError(new RuntimeException(message)); } } work.mkdir(); } return Validation.SUCCESS; }
Source:
<code>private URL deploymentOne() throws Throwable { <START> System.out.println("deployment"); <END> return new URL("<LINK_0>"); }</code><technical_language>Remove this</technical_language>

Target:
private URL deploymentOne() throws Throwable { return new URL("<LINK_0>"); }
Source:
<code>public int onStartCommand(Intent intent, int flags, int startId) { if (intent != null) { if (Utils.isOreoOrLater()) { Notification notification = new NotificationCompat.Builder(this, ALERT_CHANNEL_ID) <START> .setContentTitle("Update alerts") <END> .setSmallIcon(R.drawable.stat_notify_calendar) .setShowWhen(false) .build(); startForeground(1337, notification); } Message msg = mServiceHandler.obtainMessage(); msg.arg1 = startId; msg.obj = intent.getExtras(); mServiceHandler.sendMessage(msg); } return START_REDELIVER_INTENT; }</code><technical_language>change this "Event notifications"</technical_language>

Target:
public int onStartCommand(Intent intent, int flags, int startId) { if (intent != null) { if (Utils.isOreoOrLater()) { Notification notification = new NotificationCompat.Builder(this, ALERT_CHANNEL_ID) .setContentTitle("Event notifications") .setSmallIcon(R.drawable.stat_notify_calendar) .setShowWhen(false) .build(); startForeground(1337, notification); } Message msg = mServiceHandler.obtainMessage(); msg.arg1 = startId; msg.obj = intent.getExtras(); mServiceHandler.sendMessage(msg); } return START_REDELIVER_INTENT; }
Source:
<code>public List<InsightCard> getInsights(@Scope(OAuthScope.INSIGHTS_READ) final AccessToken accessToken) { LOGGER.debug("Returning list of insights for account id = {}", accessToken.accountId); final Boolean chronological = false; final DateTime queryDate = DateTime.now(DateTimeZone.UTC).plusDays(1); final ImmutableList<InsightCard> cards = insightsDAODynamoDB.getInsightsByDate(accessToken.accountId, queryDate, chronological, MAX_INSIGHTS_NUM); if (cards.size() == 0) { final Optional<Account> optionalAccount = accountDAO.getById(accessToken.accountId); int userAgeInYears = 0; if (optionalAccount.isPresent()) { userAgeInYears = DateTimeUtil.getDateDiffFromNowInDays(optionalAccount.get().DOB) / 365; } final List<InsightCard> introCards = GenericInsights.getIntroCards(accessToken.accountId, userAgeInYears); for (InsightCard card : introCards) { <START> this.insightsDAODynamoDB.insertInsight(card); <END> } return introCards; } return cards; }</code><technical_language>3 queries? ^^</technical_language>

Target:
public List<InsightCard> getInsights(@Scope(OAuthScope.INSIGHTS_READ) final AccessToken accessToken) { LOGGER.debug("Returning list of insights for account id = {}", accessToken.accountId); final Boolean chronological = false; final DateTime queryDate = DateTime.now(DateTimeZone.UTC).plusDays(1); final ImmutableList<InsightCard> cards = insightsDAODynamoDB.getInsightsByDate(accessToken.accountId, queryDate, chronological, MAX_INSIGHTS_NUM); if (cards.size() == 0) { final Optional<Account> optionalAccount = accountDAO.getById(accessToken.accountId); int userAgeInYears = 0; if (optionalAccount.isPresent()) { userAgeInYears = DateTimeUtil.getDateDiffFromNowInDays(optionalAccount.get().DOB) / 365; } final List<InsightCard> introCards = IntroductionInsights.getIntroCards(accessToken.accountId, userAgeInYears); this.insightsDAODynamoDB.insertListOfInsights(introCards); return introCards; } return cards; }
Source:
<code>public Boolean deleteLoanRepayment(String accountId, String repaymentId) throws MambuApiException { <START> if (accountId == null && repaymentId == null) { <END> throw new IllegalArgumentException("Account ID and Repayment ID must not be null!"); } return serviceExecutor.deleteOwnedEntity(MambuEntityType.LOAN_ACCOUNT, accountId, MambuEntityType.REPAYMENTS, repaymentId); }</code><technical_language>operator instead of AND</technical_language>

Target:
public Boolean deleteLoanRepayment(String accountId, String repaymentId) throws MambuApiException { if (accountId == null || repaymentId == null) { throw new IllegalArgumentException("Account ID and Repayment ID must not be null!"); } return serviceExecutor.deleteOwnedEntity(MambuEntityType.LOAN_ACCOUNT, accountId, MambuEntityType.REPAYMENTS, repaymentId); }
Source:
<code>private void setupMouseEvents() { setOnMouseClicked(e -> { int currentlySelected = getSelectionModel().getSelectedIndex(); if (currentlySelected != -1) { selectedIndex = Optional.of(currentlySelected); logger.info("Mouse click on item index " + selectedIndex.get()); if (e.getButton().equals(MouseButton.SECONDARY)){ triggerItemSelectedSecondary(selectedIndex.get()); } else { <START> triggerItemSelected(selectedIndex.get()); <END> } } }); }</code><technical_language>currentlySelected here</technical_language>

Target:
private void setupMouseEvents() { setOnMouseClicked(e -> { int currentlySelected = getSelectionModel().getSelectedIndex(); if (currentlySelected != -1) { selectedIndex = Optional.of(currentlySelected); logger.info("Mouse click on item index " + selectedIndex.get()); onItemSelected.accept(selectedIndex.get()); } }); }
Source:
<code>public void testWriteFlushesIfAboveThreshold() throws IOException { int fileSizeThreshold = 100; final FsCheckpointStreamFactory factory = createFactory(FileSystem.getLocalFileSystem(), fileSizeThreshold, fileSizeThreshold); final FsCheckpointStreamFactory.FsCheckpointStateOutputStream stream = factory.createCheckpointStateOutputStream(CheckpointedStateScope.EXCLUSIVE); stream.write(new byte[fileSizeThreshold]); File[] files = new File(exclusiveStateDir.toUri()).listFiles(); assertEquals(1, files.length); File file = files[0]; assertEquals(fileSizeThreshold, file.length()); for (int i = 0; i < fileSizeThreshold; i++) { stream.write(127); <START> } <END> assertEquals(fileSizeThreshold, file.length()); }</code><technical_language>add additional stream.write(new byte[10]); call check other write method for flushing problem</technical_language>

Target:
public void testWriteFlushesIfAboveThreshold() throws IOException { int fileSizeThreshold = 100; final FsCheckpointStreamFactory factory = createFactory(FileSystem.getLocalFileSystem(), fileSizeThreshold, fileSizeThreshold); final FsCheckpointStreamFactory.FsCheckpointStateOutputStream stream = factory.createCheckpointStateOutputStream(CheckpointedStateScope.EXCLUSIVE); stream.write(new byte[fileSizeThreshold]); File[] files = new File(exclusiveStateDir.toUri()).listFiles(); assertEquals(1, files.length); File file = files[0]; assertEquals(fileSizeThreshold, file.length()); stream.write(new byte[fileSizeThreshold - 1]); stream.write(127); assertEquals(fileSizeThreshold, file.length()); }
Source:
<code>public GoGoDuckProcess(WPSResourceManager resourceManager, HttpNotifier httpNotifier, Catalog catalog, GeoServerResourceLoader resourceLoader, GeoServer geoserver) { super(resourceManager, httpNotifier, geoserver); this.catalog = catalog; this.resourceLoader = resourceLoader; <START> URLMangler.setUrlManglingMap(getConfigMap("/ncwms/urlSubstitution")); <END> }</code><technical_language>gogoduck</technical_language>

Target:
public GoGoDuckProcess(WPSResourceManager resourceManager, HttpNotifier httpNotifier, Catalog catalog, GeoServerResourceLoader resourceLoader, GeoServer geoserver) { super(resourceManager, httpNotifier, geoserver); this.catalog = catalog; this.resourceLoader = resourceLoader; URLMangler.setUrlManglingMap(getConfigMap("/gogoduck/urlSubstitution")); }
Source:
<code>protected boolean isArchitectureUpdatable(Cluster <START> group) { <END> if (group.getCompatibilityVersion() != getParameters().getCluster().getCompatibilityVersion() && cpuFlagsManagerHandler.checkIfCpusExist(group.getCpuName(), group.getCompatibilityVersion()) && !cpuFlagsManagerHandler.checkIfCpusExist(group.getCpuName(), getParameters().getCluster().getCompatibilityVersion())) { return true; } return oldCluster.getArchitecture() == ArchitectureType.undefined ? true : getArchitecture() == oldCluster.getArchitecture(); }</code><technical_language>Please, rename this parameter oldCluster in other methods. is named 'group' Cluster named VdsGroup in past. is confusing</technical_language>

Target:
protected boolean isArchitectureUpdatable(Cluster group) { if (!group.getCompatibilityVersion().equals(getParameters().getCluster().getCompatibilityVersion()) && ((cpuFlagsManagerHandler.checkIfCpusExist(group.getCpuName(), group.getCompatibilityVersion()) && !cpuFlagsManagerHandler.checkIfCpusExist(group.getCpuName(), getParameters().getCluster().getCompatibilityVersion())) || !cpuFlagsManagerHandler.checkIfCpusExist(getCluster().getCpuName(), getParameters().getCluster().getCompatibilityVersion()))) { return true; } return oldCluster.getArchitecture() == ArchitectureType.undefined ? true : getArchitecture() == oldCluster.getArchitecture(); }
Source:
<code>public Tk103Protocol() { super("tk103"); setSupportedDataCommands( Command.TYPE_POSITION_SINGLE, Command.TYPE_POSITION_PERIODIC, Command.TYPE_POSITION_STOP, Command.TYPE_GET_VERSION, Command.TYPE_REBOOT_DEVICE, Command.TYPE_SET_ODOMETER, Command.TYPE_ENGINE_STOP, Command.TYPE_ENGINE_RESUME, <START> "T580W_positionSingle", <END> "T580W_positionRealtime", "T580W_positionRealtimeStop", "T580W_modeDeepSleepInterval1Hour", "T580W_modeDeepSleepInterval2Hour", "T580W_modeDeepSleepInterval3Hour", "T580W_modeDeepSleepInterval4Hour", "T580W_modeDeepSleepMotion", "T580W_modeDeepSleepOff", "T580W_alarmSosOn", "T580W_alarmSosOff", "T580W_multiControllerOn", "T580W_multiControllerOff", "T580W_rebootDevice"); }</code><technical_language>need map commands standard ones. Applies all</technical_language>

Target:
public Tk103Protocol() { super("tk103"); setSupportedDataCommands( Command.TYPE_CUSTOM, Command.TYPE_GET_DEVICE_STATUS, Command.TYPE_IDENTIFICATION, Command.TYPE_MODE_DEEP_SLEEP, Command.TYPE_MODE_POWER_SAVING, Command.TYPE_ALARM_SOS, Command.TYPE_SET_CONNECTION, Command.TYPE_SOS_NUMBER, Command.TYPE_POSITION_SINGLE, Command.TYPE_POSITION_PERIODIC, Command.TYPE_POSITION_STOP, Command.TYPE_GET_VERSION, Command.TYPE_REBOOT_DEVICE, Command.TYPE_SET_ODOMETER, Command.TYPE_ENGINE_STOP, Command.TYPE_ENGINE_RESUME); }
Source:
<code>void allStoppped() throws Exception { setUp(2); setUpFreeIpaAvailabilityResponse(false); when(stackInstanceProviderChecker.checkStatus(stack, notTerminatedInstances)).thenReturn(List.of( createCloudVmInstanceStatus(INSTANCE_1, com.sequenceiq.cloudbreak.cloud.model.InstanceStatus.STOPPED), <START> createCloudVmInstanceStatus(INSTANCE_1, com.sequenceiq.cloudbreak.cloud.model.InstanceStatus.STOPPED) <END> )); underTest.executeInternal(jobExecutionContext); verify(stackUpdater).updateStackStatus(eq(stack), eq(DetailedStackStatus.STOPPED), any()); }</code><technical_language>I guess this INSTANCE_2. applies someStoppped. test is green, this case investigated</technical_language>

Target:
void allStoppped() throws Exception { setUp(2); setUpFreeIpaAvailabilityResponse(false); when(stackInstanceProviderChecker.checkStatus(stack, notTerminatedInstances)).thenReturn(List.of( createCloudVmInstanceStatus(INSTANCE_1, com.sequenceiq.cloudbreak.cloud.model.InstanceStatus.STOPPED), createCloudVmInstanceStatus(INSTANCE_2, com.sequenceiq.cloudbreak.cloud.model.InstanceStatus.STOPPED) )); underTest.executeInternal(jobExecutionContext); verify(stackUpdater).updateStackStatus(eq(stack), eq(DetailedStackStatus.STOPPED), any()); }
Source:
<code>public void setup() { <START> Ignition.start(getConfiguration("srv1", false)); <END> Ignition.start(getConfiguration("srv2", false)); Ignition.start(getConfiguration(IGNITE_CLIENT_INSTANCE_NAME, true)); }</code><technical_language>a variable start specific number of grids</technical_language>

Target:
public void setup() { int cnt = gridCnt(); for (int i = 0; i < cnt; i++) Ignition.start(getConfiguration("srv" + i, false)); Ignition.start(getConfiguration(IGNITE_CLIENT_INSTANCE_NAME, true)); }
Source:
<code>public FileItem getMediaFileItemFromFormManager(String fileLink, CrfBean crf, CrfVersion crfVersion) { RestTemplate restTemplate = new RestTemplate(); restTemplate.getMessageConverters().add(new ByteArrayHttpMessageConverter()); HttpHeaders headers = new HttpHeaders(); headers.setAccept(Arrays.asList(MediaType.APPLICATION_OCTET_STREAM)); HttpEntity<String> entity = new HttpEntity<String>(headers); ResponseEntity<byte[]> response = restTemplate.exchange(fileLink, HttpMethod.GET, entity, byte[].class, "1"); FileItem fileItem = null; if (response.getStatusCode() == HttpStatus.OK) { String fileName = ""; try { String disposition = response.getHeaders().get("Content-Disposition").get(0); fileName = disposition.replaceFirst("(?i)^.*filename=\"([^\"]+)\".*$", "$1"); String dir = Utils.getCrfMediaFilePath(crf, crfVersion); if (!new File(dir).exists()) { new File(dir).mkdirs(); logger.debug("Made the directory " + dir); } File file = new File(dir + fileName); <START> FileOutputStream output = new FileOutputStream(file); <END> IOUtils.write(response.getBody(), output); fileItem = new DiskFileItem("media_file", response.getHeaders().get("Content-Type").get(0), false, fileName, 100000000, file); } catch (IOException e) { e.printStackTrace(); } } return fileItem; }</code><technical_language>need close stream in finally block</technical_language>

Target:
public FileItem getMediaFileItemFromFormManager(String fileLink, CrfBean crf, CrfVersion crfVersion) { RestTemplate restTemplate = new RestTemplate(); restTemplate.getMessageConverters().add(new ByteArrayHttpMessageConverter()); HttpHeaders headers = new HttpHeaders(); headers.setAccept(Arrays.asList(MediaType.APPLICATION_OCTET_STREAM)); HttpEntity<String> entity = new HttpEntity<String>(headers); ResponseEntity<byte[]> response = restTemplate.exchange(fileLink, HttpMethod.GET, entity, byte[].class, "1"); FileItem fileItem = null; if (response.getStatusCode() == HttpStatus.OK) { String fileName = ""; FileOutputStream output = null; try { String disposition = response.getHeaders().get("Content-Disposition").get(0); fileName = disposition.replaceFirst("(?i)^.*filename=\"([^\"]+)\".*$", "$1"); String dir = Utils.getCrfMediaFilePath(crf, crfVersion); if (!new File(dir).exists()) { new File(dir).mkdirs(); logger.debug("Made the directory " + dir); } File file = new File(dir + fileName); output = new FileOutputStream(file); IOUtils.write(response.getBody(), output); fileItem = new DiskFileItem("media_file", response.getHeaders().get("Content-Type").get(0), false, fileName, 100000000, file); } catch (IOException e) { e.printStackTrace(); } finally { try { if (output != null) { output.close(); } } catch (IOException e) { e.printStackTrace(); } } } return fileItem; }
Source:
<code>protected Value<DyeColor> constructValue(DyeColor actualValue) { <START> return SpongeValueFactory.getInstance().createValue(Keys.DYE_COLOR, actualValue, DyeColors.PURPLE); <END> }</code><technical_language>new SpongeValue<>(this.key, DyeColors.PURPLE, actualValue);</technical_language>

Target:
protected Value<DyeColor> constructValue(DyeColor actualValue) { return new SpongeValue<>(Keys.DYE_COLOR, DyeColors.PURPLE, actualValue); }
Source:
<code>private String extractSnapshotId(String filename, String version, String type, String classifier) { <START> if (version == null) <END> return null; String front = version.substring(0, version.indexOf("-SNAPSHOT")); String back = "." + type; if (classifier != null) { back = "-" + classifier + back; } int idx1 = filename.indexOf(front) + front.length() + 1; int idx2 = filename.indexOf(back); if (idx1 > 0 && idx1 < filename.length() && idx2 > 0 && idx2 < filename.length()) { return filename.substring(idx1, idx2); } else { return null; } }</code><technical_language>Please surround if blocks curly braces</technical_language>

Target:
private String extractSnapshotId(String filename, String version, String type, String classifier) { if (version == null) { return null; } String front = version.substring(0, version.indexOf("-SNAPSHOT")); String back = "." + type; if (classifier != null) { back = "-" + classifier + back; } int idx1 = filename.indexOf(front) + front.length() + 1; int idx2 = filename.indexOf(back); if (idx1 > 0 && idx1 < filename.length() && idx2 > 0 && idx2 < filename.length()) { return filename.substring(idx1, idx2); } else { return null; } }
Source:
<code>public Response getInstallers(@ApiParam(value = "Max items") @QueryParam("maxItems") @DefaultValue("30") int maxItems, @ApiParam(value = "Skip count") @QueryParam("skipCount") @DefaultValue("0") int skipCount) throws InstallerException, BadRequestException { try { Page<? extends Installer> installers = installerRegistry.getInstallers(maxItems, skipCount); return Response.ok() .entity(installers.getItems()) .header("Link", createLinkHeader(installers)) <START> .header("TotalItemsCount", installers.getTotalItemsCount()) <END> .build(); } catch (IllegalArgumentException e) { throw new BadRequestException(e.getMessage()); } }</code><technical_language>1. do need exact count of items here? 2. Custom headers follow X- prefix naming</technical_language>

Target:
public Response getInstallers(@ApiParam(value = "Max items") @QueryParam("maxItems") @DefaultValue("30") int maxItems, @ApiParam(value = "Skip count") @QueryParam("skipCount") @DefaultValue("0") int skipCount) throws InstallerException, BadRequestException { try { Page<? extends Installer> installers = installerRegistry.getInstallers(maxItems, skipCount); return Response.ok() .entity(installers.getItems()) .header("Link", createLinkHeader(installers)) .header(TOTAL_ITEMS_COUNT_HEADER, installers.getTotalItemsCount()) .build(); } catch (IllegalArgumentException e) { throw new BadRequestException(e.getMessage()); } }
Source:
<code>private List<List<Integer>> buildSortedAvailableInputs() { final SortedMap<Integer, List<Integer>> orderedAvailableInputIds = new TreeMap<>(); for (InputSpec inputSpec : inputSpecs) { List<Integer> inputIds = orderedAvailableInputIds .computeIfAbsent(inputSpec.getReadOrder(), k -> new ArrayList<>()); inputIds.add(inputSpec.getMultipleInputId()); } <START> return new ArrayList<>(orderedAvailableInputIds.values()); <END> }</code><technical_language>LinkedList instead, need remove head frequently in endInput</technical_language>

Target:
private List<List<Integer>> buildSortedAvailableInputs() { final SortedMap<Integer, List<Integer>> orderedAvailableInputIds = new TreeMap<>(); for (InputSpec inputSpec : inputSpecs) { List<Integer> inputIds = orderedAvailableInputIds .computeIfAbsent(inputSpec.getReadOrder(), k -> new LinkedList<>()); inputIds.add(inputSpec.getMultipleInputId()); } return new LinkedList<>(orderedAvailableInputIds.values()); }
Source:
<code>public Iterable<Header> getHeaders() { if (headers == null) { <START> headers = new ArrayList<>(); <END> } return headers; }</code><technical_language>return a new arraylist - return empty iterable, e.g. return Collections.emptyList();</technical_language>

Target:
public Iterable<Header> getHeaders() { if (headers == null) { return Collections.emptyList(); } return headers; }
Source:
<code>public FunctionExpression create(List<Expression> children, StatementContext context) throws SQLException { assert children.size() == 0; PTable table = context.getCurrentTable().getTable(); byte[] emptyColumnFamilyName = SchemaUtil.getEmptyColumnFamily(table); byte[] emptyColumnName = table.getEncodingScheme() == PTable.QualifierEncodingScheme.NON_ENCODED_QUALIFIERS ? QueryConstants.EMPTY_COLUMN_BYTES : table.getEncodingScheme().encode(QueryConstants.ENCODED_EMPTY_COLUMN_NAME); List<Expression> emptyColumnExpression = Arrays.asList(new Expression[] {new KeyValueColumnExpression(new PDatum() { @Override public boolean isNullable() { return true; } @Override public PDataType getDataType() { return PDate.INSTANCE; } @Override public Integer getMaxLength() { return null; } @Override public Integer getScale() { return null; } @Override public SortOrder getSortOrder() { return SortOrder.getDefault(); } }, emptyColumnFamilyName, emptyColumnName)}); <START> IndexUtil.addEmptyColumnToScan(context.getScan(), emptyColumnFamilyName, emptyColumnName); <END> return new PhoenixRowTimestampFunction(emptyColumnExpression, emptyColumnFamilyName, emptyColumnName); }</code><technical_language>IndexUtil handle non-index table here</technical_language>

Target:
public FunctionExpression create(List<Expression> children, StatementContext context) throws SQLException { if (children.size() != 0) { throw new IllegalArgumentException( "PhoenixRowTimestampFunction does not take any parameters" ); } PTable table = context.getCurrentTable().getTable(); byte[] emptyColumnFamilyName = SchemaUtil.getEmptyColumnFamily(table); byte[] emptyColumnName = table.getEncodingScheme() == PTable.QualifierEncodingScheme.NON_ENCODED_QUALIFIERS ? QueryConstants.EMPTY_COLUMN_BYTES : table.getEncodingScheme().encode(QueryConstants.ENCODED_EMPTY_COLUMN_NAME); Expression emptyColumnExpression = new KeyValueColumnExpression(new PDatum() { @Override public boolean isNullable() { return false; } @Override public PDataType getDataType() { return PDate.INSTANCE; } @Override public Integer getMaxLength() { return null; } @Override public Integer getScale() { return null; } @Override public SortOrder getSortOrder() { return SortOrder.getDefault(); } }, emptyColumnFamilyName, emptyColumnName); List<Expression> expressionList = Arrays.asList(new Expression[] {emptyColumnExpression}); context.getScan().addColumn(emptyColumnFamilyName, emptyColumnName); return new PhoenixRowTimestampFunction(expressionList); }
Source:
<code>public ModelAndView resolveException(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, Exception e) { if (!(e instanceof RuntimeException)) { return PASS_TO_NEXT_RESOLVER; } <START> int httpStatusCode = <END> AnnotationUtils.isAnnotationDeclaredLocally(ResponseStatus.class, e.getClass()) ? AnnotationUtils.findAnnotation(e.getClass(), ResponseStatus.class).value().value() : HttpServletResponse.SC_INTERNAL_SERVER_ERROR; String errorMessageKey = errorMessageKeyMap.getOrDefault(e.getClass(), TECHNICAL_ERROR_MESSAGE_KEY); String errorMessage = messageKeyResolver.resolveMessageOrDefault(errorMessageKey); httpServletResponse.setStatus(httpStatusCode); httpServletRequest.setAttribute(WebUtils.ERROR_STATUS_CODE_ATTRIBUTE, httpStatusCode); httpServletRequest.setAttribute(WebUtils.ERROR_MESSAGE_ATTRIBUTE, errorMessage); if (!RequestInspector.isAjaxRequest(httpServletRequest)) { return new ModelAndView(ERROR_VIEW_NAME); } else { RestResponse restResponse = new RestResponse(e.getMessage()); ModelAndView modelAndView = new ModelAndView(jsonView); modelAndView.addObject("errorMessage", restResponse.getErrorMessage()); modelAndView.addObject("fields", restResponse.getFields()); return modelAndView; } }</code><technical_language>Please extract this logic a separate method improve readability</technical_language>

Target:
public ModelAndView resolveException(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, Exception e) { if (!(e instanceof RuntimeException)) { return PASS_TO_NEXT_RESOLVER; } int httpStatusCode = getHttpStatusCodeForException(e.getClass()); httpServletResponse.setStatus(httpStatusCode); if (!RequestInspector.isAjaxRequest(httpServletRequest)) { ModelAndView modelAndView = new ModelAndView(ERROR_VIEW_NAME); String errorMessage = messageKeyResolver.resolveMessageOrDefault(TECHNICAL_ERROR_MESSAGE_KEY); modelAndView.addObject(WebUtils.ERROR_STATUS_CODE_ATTRIBUTE, httpStatusCode); modelAndView.addObject(WebUtils.ERROR_MESSAGE_ATTRIBUTE, errorMessage); return modelAndView; } else { RestResponse restResponse = new RestResponse(e.getMessage()); ModelAndView modelAndView = new ModelAndView(jsonView); modelAndView.addObject("errorMessage", restResponse.getErrorMessage()); modelAndView.addObject("fields", restResponse.getFields()); return modelAndView; } }
Source:
<code>public void cect_PairingActivity_OneTouchPlay() throws Exception { ITestDevice device = getDevice(); <START> device.executeShellCommand(START_COMMAND + ACTION_CONNECT_INPUT_NORMAL); <END> hdmiCecClient.checkExpectedOutput(CecDevice.TV, CecMessage.TEXT_VIEW_ON); String message = hdmiCecClient.checkExpectedOutput(CecMessage.ACTIVE_SOURCE); assertThat(hdmiCecClient.getParamsFromMessage(message)).isEqualTo(PHYSICAL_ADDRESS); }</code><technical_language>Device rebooted test starts, avoid clash ongoing OTP processing</technical_language>

Target:
public void cect_PairingActivity_OneTouchPlay() throws Exception { ITestDevice device = getDevice(); device.reboot(); device.executeShellCommand(START_COMMAND + ACTION_CONNECT_INPUT_NORMAL); hdmiCecClient.checkExpectedOutput(CecDevice.TV, CecMessage.TEXT_VIEW_ON); String message = hdmiCecClient.checkExpectedOutput(CecMessage.ACTIVE_SOURCE); assertThat(hdmiCecClient.getParamsFromMessage(message)).isEqualTo(PHYSICAL_ADDRESS); device.executeShellCommand(FORCE_STOP_COMMAND + SETTINGS_PACKAGE); }