auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void testOnlyReduceTaskRun() throws Exception { ScriptingManager scriptingManager = getScriptingManager(manager(0)); Cache<String, String> cache = cache(0); loadData(cache, "/macbeth.txt"); loadScript(scriptingManager, "/wordCountReducer.js"); <START> CompletableFuture<Object> future = scriptingManager.runScript("wordCountReducer.js", new TaskContext().cache(cache)); <END> }</code><technical_language>line throws IllegalArgumentException? need do this CompletableFuture here</technical_language>

Target:
public void testOnlyReduceTaskRun() throws Exception { ScriptingManager scriptingManager = getScriptingManager(manager(0)); Cache<String, String> cache = cache(0); loadData(cache, "/macbeth.txt"); loadScript(scriptingManager, "/wordCountReducer.js"); scriptingManager.runScript("wordCountReducer.js", new TaskContext().cache(cache)); }
Source:
<code>public void viewTest() { onView(withId(R.id.faceView)).check(matches(isDisplayed())); <START> activityRule.getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); <END> onView(withId(R.id.faceView)).check(matches(isDisplayed())); activityRule.getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); onView(withId(R.id.eyeView)).check(matches(isDisplayed())); activityRule.getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); onView(withId(R.id.eyeView)).check(matches(isDisplayed())); activityRule.getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); onView(withId(R.id.hairView)).check(matches(isDisplayed())); activityRule.getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); onView(withId(R.id.hairView)).check(matches(isDisplayed())); activityRule.getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); onView(withId(R.id.clothView)).check(matches(isDisplayed())); activityRule.getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); onView(withId(R.id.clothView)).check(matches(isDisplayed())); activityRule.getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); onView(withId(R.id.continueButton)).check(matches(isDisplayed())); activityRule.getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); onView(withId(R.id.continueButton)).check(matches(isDisplayed())); activityRule.getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); }</code><technical_language>changing orientation check if items displayed before</technical_language>

Target:
public void viewTest() { onView(withId(R.id.faceView)).check(matches(isDisplayed())); onView(withId(R.id.eyeView)).check(matches(isDisplayed())); onView(withId(R.id.hairView)).check(matches(isDisplayed())); onView(withId(R.id.clothView)).check(matches(isDisplayed())); onView(withId(R.id.continueButton)).check(matches(isDisplayed())); }
Source:
<code>public void upgrade(User userEntity) { userEntity.getBuddies() <START> .forEach(buddy -> buddy.setLastStatusChangeTime(buddy.getBuddyAnonymized().getLastStatusChangeTime())); <END> }</code><technical_language>Please nullify time stamp {{BuddyAnonymized}}. that, prevent identity matching (the purpose of this ticket) migration</technical_language>

Target:
public void upgrade(User userEntity) { userEntity.getBuddies().forEach(buddy -> upgradeBuddy(buddy)); }
Source:
<code>private void findNegotiatingProfiles(ServletRequest req) { List<String> schemes = new ArrayList<String>(); if (profiles == null) { synchronized (this) { if (profiles == null) { schemes = new ArrayList<>(); profiles = new ArrayList<AuthenticationProfile>(1); long caps = 0; for (String nego : req.getServletContext().getInitParameter(CAPABILITIES_PARAMETER).trim().split("\\|")) { try { caps |= Authn.Capabilities.class.getField(nego).getInt(null); <START> } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException ex) { <END> } } for (AuthenticationProfile profile : AuthenticationProfileRepository.getInstance().getProfiles()) { if (profile != null) { ExtMap authnContext = profile.getAuthn().getContext(); if ((authnContext.<Long> get(Authn.ContextKeys.CAPABILITIES).longValue() & caps) != caps) { profiles.add(0, profile); } schemes.addAll(authnContext.<List<String>>get(Authn.ContextKeys.HTTP_AUTHENTICATION_SCHEME, Collections.<String>emptyList())); } } } } } ((HttpServletRequest) req).setAttribute(FiltersHelper.Constants.SCHEMES_KEY, schemes); }</code><technical_language>print error least... if fail war load entirely</technical_language>

Target:
private void findNegotiatingProfiles(ServletRequest req) { List<String> schemes = new ArrayList<String>(); if (profiles == null) { synchronized (this) { if (profiles == null) { schemes = new ArrayList<>(); profiles = new ArrayList<AuthenticationProfile>(1); for (AuthenticationProfile profile : AuthenticationProfileRepository.getInstance().getProfiles()) { if (profile != null) { ExtMap authnContext = profile.getAuthn().getContext(); if ((authnContext.<Long> get(Authn.ContextKeys.CAPABILITIES).longValue() & caps) != caps) { profiles.add(0, profile); } schemes.addAll(authnContext.<List<String>>get(Authn.ContextKeys.HTTP_AUTHENTICATION_SCHEME, Collections.<String>emptyList())); } } } } } ((HttpServletRequest) req).setAttribute(FiltersHelper.Constants.SCHEMES_KEY, schemes); }
Source:
<code>public SqmRoot visitPathRoot(HqlParser.PathRootContext ctx) { final String name = ctx.entityName().fullNameText; log.debugf( "Handling root path - %s", name ); final EntityDomainType entityDescriptor = getCreationContext().getJpaMetamodel().resolveHqlEntityReference( name ); if ( name.equals( entityDescriptor.getHibernateEntityName() ) && getCreationOptions().useStrictJpaCompliance() ) { throw new StrictJpaComplianceViolation( "Encountered FQN entity name [" + name + "], but strict JPQL compliance was requested", StrictJpaComplianceViolation.Type.FQN_ENTITY_NAME ); <START> } <END> if ( entityDescriptor instanceof SqmPolymorphicRootDescriptor ) { if ( getCreationOptions().useStrictJpaCompliance() ) { throw new StrictJpaComplianceViolation( "Encountered unmapped polymorphic reference [" + entityDescriptor.getHibernateEntityName() + "], but strict JPQL compliance was requested", StrictJpaComplianceViolation.Type.UNMAPPED_POLYMORPHISM ); } if ( processingStateStack.depth() > 1 ) { throw new SemanticException( "Illegal implicit-polymorphic domain path in sub-query : " + entityDescriptor.getName() ); } } final String alias = visitIdentificationVariableDef( ctx.identificationVariableDef() ); final SqmRoot sqmRoot = new SqmRoot( entityDescriptor, alias, creationContext.getNodeBuilder() ); processingStateStack.getCurrent().getPathRegistry().register( sqmRoot ); return sqmRoot; }</code><technical_language>This is close, check be: if ( getCreationOptions().useStrictJpaCompliance() && ! name.equals( entityDescriptor.getName() ) { ... }</technical_language>

Target:
public SqmRoot visitPathRoot(HqlParser.PathRootContext ctx) { final String name = ctx.entityName().fullNameText; log.debugf( "Handling root path - %s", name ); final EntityDomainType entityDescriptor = getCreationContext().getJpaMetamodel().resolveHqlEntityReference( name ); checkFQNEntityNameJpaComplianceViolationIfNeeded( name, entityDescriptor ); if ( entityDescriptor instanceof SqmPolymorphicRootDescriptor ) { if ( getCreationOptions().useStrictJpaCompliance() ) { throw new StrictJpaComplianceViolation( "Encountered unmapped polymorphic reference [" + entityDescriptor.getHibernateEntityName() + "], but strict JPQL compliance was requested", StrictJpaComplianceViolation.Type.UNMAPPED_POLYMORPHISM ); } if ( processingStateStack.depth() > 1 ) { throw new SemanticException( "Illegal implicit-polymorphic domain path in sub-query : " + entityDescriptor.getName() ); } } final String alias = visitIdentificationVariableDef( ctx.identificationVariableDef() ); final SqmRoot sqmRoot = new SqmRoot( entityDescriptor, alias, creationContext.getNodeBuilder() ); processingStateStack.getCurrent().getPathRegistry().register( sqmRoot ); return sqmRoot; }
Source:
<code>protected void setResult(Collection<T> newUserSelection) { <START> if (newUserSelection == null) { <END> result = null; } else { result = newUserSelection; } }</code><technical_language>if else blocks unnecessary, write "result = newUserSelection"</technical_language>

Target:
protected void setResult(Collection<T> newUserSelection) { result = newUserSelection; }
Source:
<code>public void onActivate(ActivateEvent event, EntityRef entity) { LASTeamComponent baseTeamComponent = entity.getComponent(LASTeamComponent.class); EntityRef player = event.getInstigator(); CharacterHeldItemComponent characterHeldItemComponent = player.getComponent(CharacterHeldItemComponent.class); if (characterHeldItemComponent != null) { EntityRef heldItem = characterHeldItemComponent.selectedItem; <START> if (baseTeamComponent.team.equals(baseTeamComponent.RED) && heldItem.getComponent(BlockItemComponent.class).blockFamily.getURI().toString() <END> .equalsIgnoreCase("LightAndShadowResources:BlackFlag")) { redScore++; } if (baseTeamComponent.team.equals(baseTeamComponent.BLACK) && heldItem.getComponent(BlockItemComponent.class).blockFamily.getURI().toString() .equalsIgnoreCase("LightAndShadowResources:RedFlag")) { blackScore++; } } }</code><technical_language>//check -> // Check</technical_language>

Target:
public void onActivate(ActivateEvent event, EntityRef entity) { LASTeamComponent baseTeamComponent = entity.getComponent(LASTeamComponent.class); EntityRef player = event.getInstigator(); CharacterHeldItemComponent characterHeldItemComponent = player.getComponent(CharacterHeldItemComponent.class); if (characterHeldItemComponent != null) { EntityRef heldItem = characterHeldItemComponent.selectedItem; if (baseTeamComponent.team.equals(LASUtils.RED_TEAM) && heldItem.getComponent(BlockItemComponent.class).blockFamily.getURI().toString().equals(LASUtils.BLACK_FLAG_URI)) { redScore++; } if (baseTeamComponent.team.equals(LASUtils.BLACK_TEAM) && heldItem.getComponent(BlockItemComponent.class).blockFamily.getURI().toString().equals(LASUtils.RED_FLAG_URI)) { blackScore++; } } }
Source:
<code>private static File zip(String component, String... files) { try { File temporaryZip = Files.createTempFile("tmp", null).toFile(); try (FileOutputStream fos = new FileOutputStream(temporaryZip); ZipOutputStream zos = new ZipOutputStream(fos)) { zos.putNextEntry(new ZipEntry(component + "/")); zos.closeEntry(); for (String file : files) { String entryName = component + "/" + file; zos.putNextEntry(new ZipEntry(entryName)); <START> String filePath = String.format("components/" + entryName); <END> try (InputStream in = ComponentZipUtil.class.getClassLoader().getResourceAsStream(filePath)) { IOUtils.copy(in, zos); } zos.closeEntry(); } } return temporaryZip; } catch (IOException ex) { throw new RuntimeException(ex); } }</code><technical_language>remove string format</technical_language>

Target:
private static File zip(String component, String... files) { try { File temporaryZip = Files.createTempFile("tmp", null).toFile(); try (FileOutputStream fos = new FileOutputStream(temporaryZip); ZipOutputStream zos = new ZipOutputStream(fos)) { zos.putNextEntry(new ZipEntry(component + "/")); zos.closeEntry(); for (String file : files) { String entryName = component + "/" + file; zos.putNextEntry(new ZipEntry(entryName)); String filePath = "components/" + entryName; try (InputStream in = ComponentZipUtil.class.getClassLoader().getResourceAsStream(filePath)) { IOUtils.copy(in, zos); } zos.closeEntry(); } } return temporaryZip; } catch (IOException ex) { throw new RuntimeException(ex); } }
Source:
<code>private String notional(SwapLeg leg) { if (leg instanceof RateCalculationSwapLeg) { RateCalculationSwapLeg rcLeg = (RateCalculationSwapLeg) leg; NotionalSchedule notionalSchedule = rcLeg.getNotionalSchedule(); ValueSchedule amount = notionalSchedule.getAmount(); double notional = amount.getInitialValue(); <START> String varying = !amount.getSteps().isEmpty() || amount.getStepSequence().isPresent() ? " varying" : ""; <END> Currency currency = notionalSchedule.getFxReset().map(fxr -> fxr.getReferenceCurrency()).orElse(rcLeg.getCurrency()); return SummarizerUtils.amount(currency, notional) + varying; } if (leg instanceof RatePeriodSwapLeg) { RatePeriodSwapLeg rpLeg = (RatePeriodSwapLeg) leg; return SummarizerUtils.amount(rpLeg.getPaymentPeriods().get(0).getNotionalAmount()); } return ""; }</code><technical_language>Tiny point, I 'variable' is more natural term 'varying'</technical_language>

Target:
private String notional(SwapLeg leg) { if (leg instanceof RateCalculationSwapLeg) { RateCalculationSwapLeg rcLeg = (RateCalculationSwapLeg) leg; NotionalSchedule notionalSchedule = rcLeg.getNotionalSchedule(); ValueSchedule amount = notionalSchedule.getAmount(); double notional = amount.getInitialValue(); String vary = !amount.getSteps().isEmpty() || amount.getStepSequence().isPresent() ? " variable" : ""; Currency currency = notionalSchedule.getFxReset().map(fxr -> fxr.getReferenceCurrency()).orElse(rcLeg.getCurrency()); return SummarizerUtils.amount(currency, notional) + vary; } if (leg instanceof RatePeriodSwapLeg) { RatePeriodSwapLeg rpLeg = (RatePeriodSwapLeg) leg; return SummarizerUtils.amount(rpLeg.getPaymentPeriods().get(0).getNotionalAmount()); } return ""; }
Source:
<code>public void getFilePathFromProjectRoot() throws Exception { final Path repositoryRoot = getPath("file:/ "/"); final Path pathToFile = getPath("file:/ "file.txt"); assertEquals("/org/test/file.txt", Paths.removePrefix(pathToFile, <START> repositoryRoot)); <END> }</code><technical_language>@Rikkola result is expected leading slash? removing prefix result a relative path, I expect there. For example, in kie-wb-common is this (after applying this PR): java private boolean isIncrementalBuildPossible(final Path resourcePath) throws NoModuleException { return getDestinationPath(resourcePath).startsWith("src/main/resources/"); } private String getDestinationPath(final Path originalPath) throws NoModuleException { return Paths.removePrefix(originalPath, module(originalPath).getRootPath()); } So, this work? Is guaranteed removing module root resourcePath start src/main/resources /src/main/resources</technical_language>

Target:
public void getFilePathFromProjectRoot() throws Exception { final Path repositoryRoot = getPath("file:/ "/"); final Path pathToFile = getPath("file:/ "file.txt"); assertEquals("org/test/file.txt", Paths.removePrefix(pathToFile, repositoryRoot)); }
Source:
<code>public int visit(IASTStatement stmt) { if (stmt instanceof IASTReturnStatement) { IASTReturnStatement ret = (IASTReturnStatement) stmt; IASTInitializerClause returnValue = ret.getReturnArgument(); if (returnValue != null) { hasret = true; } ReturnTypeKind returnKind = getReturnTypeKind(func); if (returnKind == ReturnTypeKind.NonVoid && !isConstructorDestructor(func)) { if (checkImplicitReturn(RET_NO_VALUE_ID) || isExplicitReturn(func)) { if (returnValue == null) reportProblem(RET_NO_VALUE_ID, ret); else if (analizer != null) <START> analizer.visit(ret.getReturnValue()); <END> } } else if (returnKind == ReturnTypeKind.Void) { if (returnValue instanceof IASTExpression) { IType type = ((IASTExpression) returnValue).getExpressionType(); if (isVoid(type)) return PROCESS_SKIP; reportProblem(RET_ERR_VALUE_ID, returnValue); } } return PROCESS_SKIP; } return PROCESS_CONTINUE; }</code><technical_language>type of parameter of ReturnTypeAnalyzer.visit() IASTInitializerClause. a slightly more general node type IASTExpression, handle C++11's "return {args}" "{args}" is expression</technical_language>

Target:
public int visit(IASTStatement stmt) { if (stmt instanceof IASTReturnStatement) { IASTReturnStatement ret = (IASTReturnStatement) stmt; IASTInitializerClause returnValue = ret.getReturnArgument(); if (returnValue != null) { hasret = true; } ReturnTypeKind returnKind = getReturnTypeKind(func, getType()); if (returnKind == ReturnTypeKind.NonVoid && !isConstructorDestructor(func)) { if (checkImplicitReturn(RET_NO_VALUE_ID) || isExplicitReturn(func)) { if (returnValue == null) reportProblem(RET_NO_VALUE_ID, ret); else if (analyzer != null) analyzer.visit(ret.getReturnValue()); } } else if (returnKind == ReturnTypeKind.Void) { if (returnValue instanceof IASTExpression) { IType type = ((IASTExpression) returnValue).getExpressionType(); if (isVoid(type)) return PROCESS_SKIP; reportProblem(RET_ERR_VALUE_ID, returnValue); } } return PROCESS_SKIP; } return PROCESS_CONTINUE; }
Source:
<code>public boolean onUnbind(Intent intent) { isBound = false; connectivityChangesRegister.unregister(); <START> connectivityChangesForwarder = null; <END> connectivityChangesRegister = null; binder = null; return super.onUnbind(intent); }</code><technical_language>need a null check in some usages of collaborators</technical_language>

Target:
public boolean onUnbind(Intent intent) { isBound = false; if (connectivityChangesRegister != null) { connectivityChangesRegister.unregister(); connectivityChangesRegister = null; } if (connectivityChangesForwarder != null) { connectivityChangesForwarder = null; } binder = null; return super.onUnbind(intent); }
Source:
<code>private void setReplDumpTablesList(Tree replTablesNode) throws HiveException { assert(replTablesNode.getChildCount() <= 2); <START> for (int listIdx = 0; listIdx < replTablesNode.getChildCount(); listIdx++) { <END> Tree tablesListNode = replTablesNode.getChild(listIdx); assert(tablesListNode.getType() == TOK_REPL_TABLES_LIST); List<String> tablesList = new ArrayList<>(); for (int child = 0; child < tablesListNode.getChildCount(); child++) { Tree tablePatternNode = tablesListNode.getChild(child); if (tablePatternNode.getType() == TOK_NULL) { LOG.error(ErrorMsg.REPL_INVALID_DB_OR_TABLE_PATTERN.getMsg()); throw new SemanticException(ErrorMsg.REPL_INVALID_DB_OR_TABLE_PATTERN.getMsg()); } tablesList.add(unescapeSQLString(tablePatternNode.getText())); } if (listIdx == 0) { LOG.info("ReplScope: Set Included Tables List: {}", tablesList); replScope.setIncludedTablePatterns(tablesList); } else { LOG.info("ReplScope: Set Excluded Tables List: {}", tablesList); replScope.setExcludedTablePatterns(tablesList); } } }</code><technical_language>replTablesNode.getChildCount cached</technical_language>

Target:
private void setReplDumpTablesList(Tree replTablesNode) throws HiveException { int childCount = replTablesNode.getChildCount(); assert(childCount <= 2); for (int listIdx = 0; listIdx < childCount; listIdx++) { Tree tablesListNode = replTablesNode.getChild(listIdx); assert(tablesListNode.getType() == TOK_REPL_TABLES_LIST); List<String> tablesList = new ArrayList<>(); for (int child = 0; child < tablesListNode.getChildCount(); child++) { Tree tablePatternNode = tablesListNode.getChild(child); if (tablePatternNode.getType() == TOK_NULL) { LOG.error(ErrorMsg.REPL_INVALID_DB_OR_TABLE_PATTERN.getMsg()); throw new SemanticException(ErrorMsg.REPL_INVALID_DB_OR_TABLE_PATTERN.getMsg()); } tablesList.add(unescapeSQLString(tablePatternNode.getText())); } if (listIdx == 0) { LOG.info("ReplScope: Set Included Tables List: {}", tablesList); replScope.setIncludedTablePatterns(tablesList); } else { LOG.info("ReplScope: Set Excluded Tables List: {}", tablesList); replScope.setExcludedTablePatterns(tablesList); } } }
Source:
<code>public List<JdbcColumnHandle> getColumns(ConnectorSession session, JdbcTableHandle tableHandle) { try (Connection connection = connectionFactory.openConnection()) { try (ResultSet resultSet = getColumns(tableHandle, connection.getMetaData())) { List<JdbcColumnHandle> columns = new ArrayList<>(); while (resultSet.next()) { JdbcTypeHandle typeHandle = new JdbcTypeHandle( resultSet.getInt("DATA_TYPE"), resultSet.getInt("COLUMN_SIZE"), resultSet.getInt("DECIMAL_DIGITS")); Optional<ReadMapping> columnMapping = toPrestoType(session, typeHandle); if (columnMapping.isPresent()) { String columnName = resultSet.getString("COLUMN_NAME"); <START> boolean nullable = resultSet.getBoolean("NULLABLE"); <END> columns.add(new JdbcColumnHandle(connectorId, columnName, typeHandle, columnMapping.get().getType(), nullable)); } } if (columns.isEmpty()) { throw new TableNotFoundException(tableHandle.getSchemaTableName()); } return ImmutableList.copyOf(columns); } } catch (SQLException e) { throw new PrestoException(JDBC_ERROR, e); } }</code><technical_language>This accessed getInt compared columnNullable</technical_language>

Target:
public List<JdbcColumnHandle> getColumns(ConnectorSession session, JdbcTableHandle tableHandle) { try (Connection connection = connectionFactory.openConnection()) { try (ResultSet resultSet = getColumns(tableHandle, connection.getMetaData())) { List<JdbcColumnHandle> columns = new ArrayList<>(); while (resultSet.next()) { JdbcTypeHandle typeHandle = new JdbcTypeHandle( resultSet.getInt("DATA_TYPE"), resultSet.getInt("COLUMN_SIZE"), resultSet.getInt("DECIMAL_DIGITS")); Optional<ReadMapping> columnMapping = toPrestoType(session, typeHandle); if (columnMapping.isPresent()) { String columnName = resultSet.getString("COLUMN_NAME"); boolean nullable = columnNullable == resultSet.getInt("NULLABLE"); columns.add(new JdbcColumnHandle(connectorId, columnName, typeHandle, columnMapping.get().getType(), nullable)); } } if (columns.isEmpty()) { throw new TableNotFoundException(tableHandle.getSchemaTableName()); } return ImmutableList.copyOf(columns); } } catch (SQLException e) { throw new PrestoException(JDBC_ERROR, e); } }
Source:
<code>public Promise<Result> call(final Context ctx) { final ActionContext actionContext = buildActionContext(ctx); Promise<CommonProfile> profile = retrieveUserProfile(actionContext); return profile.flatMap(new Function<CommonProfile, Promise<Result>>() { @Override public Promise<Result> apply(CommonProfile profile) throws Throwable { if (profile == null) { return authenticationFailure(actionContext); } else { saveUserProfile(profile, actionContext); return authenticationSuccess(profile, actionContext); } } }).recover(new Function<Throwable, Result>() { @Override public Result apply(Throwable a) throws Throwable { if (a instanceof RequiresHttpAction) { RequiresHttpAction e = (RequiresHttpAction) a; return requireActionToResult(e.getCode(), actionContext); } else { logger.error("Unexpected error", a); <START> return internalServerError(a.getMessage()); <END> } } }); }</code><technical_language>throw a TechnicalException application do is do in case of exceptions</technical_language>

Target:
public Promise<Result> call(final Context ctx) { final ActionContext actionContext = ActionContext.build(ctx, configuration); Promise<CommonProfile> profile = retrieveUserProfile(actionContext); return profile.flatMap(new Function<CommonProfile, Promise<Result>>() { @Override public Promise<Result> apply(CommonProfile profile) throws Throwable { if (profile == null) { return authenticationFailure(actionContext); } else { saveUserProfile(profile, actionContext); return authenticationSuccess(profile, actionContext); } } }).recover(new Function<Throwable, Result>() { @Override public Result apply(Throwable a) throws Throwable { if (a instanceof RequiresHttpAction) { RequiresHttpAction e = (RequiresHttpAction) a; return requireActionToResult(e.getCode(), actionContext); } else { logger.error("Unexpected error", a); throw a; } } }); }
Source:
<code>public synchronized void stopBackgroundScanning() { <START> logger.debug("Stopping usb-serial background discovery"); <END> ScheduledFuture<?> currentBackgroundScanningJob = backgroundScanningJob; if (currentBackgroundScanningJob != null && !currentBackgroundScanningJob.isCancelled()) { if (currentBackgroundScanningJob.cancel(true)) { backgroundScanningJob = null; logger.debug("Stopped usb-serial background discovery"); } } }</code><technical_language>**USB**-serial</technical_language>

Target:
public synchronized void stopBackgroundScanning() { logger.debug("Stopping USB-Serial background discovery"); ScheduledFuture<?> currentBackgroundScanningJob = backgroundScanningJob; if (currentBackgroundScanningJob != null && !currentBackgroundScanningJob.isCancelled()) { if (currentBackgroundScanningJob.cancel(true)) { backgroundScanningJob = null; logger.debug("Stopped USB-serial background discovery"); } } }
Source:
<code><START> public int size() { <END> return items.size(); }</code><technical_language>need public in non-public class</technical_language>

Target:
int size() { return items.size(); }
Source:
<code>private void init() { log.info("Start initializing {}", getClass().getSimpleName()); <START> log.info("Setting data center compatibility checker to run every 7 days"); <END> schedulerUtil.scheduleAFixedDelayJob(this, "onTimer", new Class[]{}, new Object[]{}, 0, 7, TimeUnit.DAYS); log.info("Finished initializing {}", getClass().getSimpleName()); }</code><technical_language>debug remove completely</technical_language>

Target:
private void init() { log.info("Start initializing {}", getClass().getSimpleName()); schedulerUtil.scheduleAFixedDelayJob(this, "onTimer", new Class[]{}, new Object[]{}, 0, 7, TimeUnit.DAYS); log.info("Finished initializing {}", getClass().getSimpleName()); }
Source:
<code>public void execute(SensorContext context) { FileSystem fs = context.fileSystem(); FilePredicate xmlFilesPredicate = fs.predicates().matchesPathPattern("**/*.xml"); List<InputFile> inputFiles = new ArrayList<>(); fs.inputFiles(xmlFilesPredicate).forEach(inputFiles::add); if (inputFiles.isEmpty()) { return; } ProgressReport progressReport = new ProgressReport("Report about progress of Java XML analyzer", TimeUnit.SECONDS.toMillis(10)); progressReport.start(inputFiles.stream().map(InputFile::toString).collect(Collectors.toList())); boolean successfullyCompleted = false; <START> boolean cancelled = false; <END> try { for (InputFile inputFile : inputFiles) { scanFile(context, inputFile); progressReport.nextFile(); } successfullyCompleted = !cancelled; } finally { if (successfullyCompleted) { progressReport.stop(); } else { progressReport.cancel(); } } }</code><technical_language>do need this variable</technical_language>

Target:
public void execute(SensorContext context) { FileSystem fs = context.fileSystem(); FilePredicate xmlFilesPredicate = fs.predicates().matchesPathPattern("**/*.xml"); List<InputFile> inputFiles = new ArrayList<>(); fs.inputFiles(xmlFilesPredicate).forEach(inputFiles::add); if (inputFiles.isEmpty()) { return; } ProgressReport progressReport = new ProgressReport("Report about progress of Java XML analyzer", TimeUnit.SECONDS.toMillis(10)); progressReport.start(inputFiles.stream().map(InputFile::toString).collect(Collectors.toList())); boolean successfullyCompleted = false; boolean cancelled = false; try { for (InputFile inputFile : inputFiles) { if (context.isCancelled()) { cancelled = true; break; } scanFile(context, inputFile); progressReport.nextFile(); } successfullyCompleted = !cancelled; } finally { if (successfullyCompleted) { progressReport.stop(); } else { progressReport.cancel(); } } }
Source:
<code>@Override public Response load(Uri uri, int networkPolicy) throws IOException { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { installCacheIfNeeded(context); } StringBuilder builder = CACHE_HEADER_BUILDER.get(); builder.setLength(0); if (NetworkPolicy.isOfflineOnly(networkPolicy)) { <START> builder.append("only-if-cached").append(',').append("max-age=").append(Integer.MAX_VALUE); <END> } else { if (!NetworkPolicy.shouldReadFromDiskCache(networkPolicy)) { builder.append("no-cache"); } } HttpURLConnection connection = openConnection(uri); connection.setUseCaches(true); if (!builder.toString().isEmpty()) { connection.setRequestProperty("Cache-Control", builder.toString()); } int responseCode = connection.getResponseCode(); if (responseCode >= 300) { connection.disconnect(); throw new ResponseException(responseCode + " " + connection.getResponseMessage(), networkPolicy, responseCode); } long contentLength = connection.getHeaderFieldInt("Content-Length", -1); boolean fromCache = parseResponseSourceHeader(connection.getHeaderField(RESPONSE_SOURCE)); return new Response(connection.getInputStream(), fromCache, contentLength); }</code><technical_language>This a String constant</technical_language>

Target:
@Override public Response load(Uri uri, int networkPolicy) throws IOException { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { installCacheIfNeeded(context); } HttpURLConnection connection = openConnection(uri); connection.setUseCaches(true); if (networkPolicy != 0) { String headerValue; if (NetworkPolicy.isOfflineOnly(networkPolicy)) { headerValue = FORCE_CACHE; } else { StringBuilder builder = CACHE_HEADER_BUILDER.get(); builder.setLength(0); if (!NetworkPolicy.shouldReadFromDiskCache(networkPolicy)) { builder.append("no-cache"); } if (!NetworkPolicy.shouldWriteToDiskCache(networkPolicy)) { if (builder.length() > 0) { builder.append(','); } builder.append("no-store"); } headerValue = builder.toString(); } connection.setRequestProperty("Cache-Control", headerValue); } int responseCode = connection.getResponseCode(); if (responseCode >= 300) { connection.disconnect(); throw new ResponseException(responseCode + " " + connection.getResponseMessage(), networkPolicy, responseCode); } long contentLength = connection.getHeaderFieldInt("Content-Length", -1); boolean fromCache = parseResponseSourceHeader(connection.getHeaderField(RESPONSE_SOURCE)); return new Response(connection.getInputStream(), fromCache, contentLength); }
Source:
<code>public void closesTemplateInputStream() throws IOException { final String template = "hello, world!"; final MockInputStream templateStream = new MockInputStream(template); MatcherAssert.assertThat( IOUtils.toString( new RsVelocity( templateStream, Collections.<CharSequence, Object>emptyMap() ).body() ), Matchers.equalTo(template) ); <START> MatcherAssert.assertThat(templateStream.isClosed(), Matchers.is(true)); <END> }</code><technical_language>@Happy-Neko mock InputStream Mockito here, behavior testing</technical_language>

Target:
public void closesTemplateInputStream() throws IOException { final String template = "hello, world!"; final StateAwareInputStream templateStream = new StateAwareInputStream(IOUtils.toInputStream(template)); MatcherAssert.assertThat( IOUtils.toString( new RsVelocity( templateStream, Collections.<CharSequence, Object>emptyMap() ).body() ), Matchers.equalTo(template) ); MatcherAssert.assertThat(templateStream.isClosed(), Matchers.is(true)); }
Source:
<code>private static CryptoModule instantiateCryptoModule(String cryptoModuleClassname) { log.debug("About to instantiate crypto module {}", cryptoModuleClassname); CryptoModule cryptoModule = null; Class cryptoModuleClazz = null; try { cryptoModuleClazz = AccumuloVFSClassLoader.loadClass(cryptoModuleClassname); } catch (ClassNotFoundException e1) { <START> throw new RuntimeException("Could not find configured crypto module " + cryptoModuleClassname); <END> } Class[] interfaces = cryptoModuleClazz.getInterfaces(); boolean implementsCryptoModule = false; for (Class clazz : interfaces) { if (clazz.equals(CryptoModule.class)) { implementsCryptoModule = true; break; } } if (!implementsCryptoModule) { throw new RuntimeException("Configured Accumulo crypto module " + cryptoModuleClassname + " does not implement the CryptoModule interface."); } else { try { cryptoModule = (CryptoModule) cryptoModuleClazz.newInstance(); log.debug("Successfully instantiated crypto module {}", cryptoModuleClassname); } catch (InstantiationException e) { throw new RuntimeException("Got instantiation exception when instantiating crypto module " + cryptoModuleClassname); } catch (IllegalAccessException e) { throw new RuntimeException("Got illegal access exception when trying to instantiate crypto module " + cryptoModuleClassname); } } return cryptoModule; }</code><technical_language>Big +1 this change. silently fall plaintext issue user-declared crypto. said, CryptoModule configurable. tightly coupled crypto code of module. I ciphers crypto parameters configurable</technical_language>

Target:
private static CryptoModule instantiateCryptoModule(String cryptoModuleClassname) { log.debug("About to instantiate crypto module {}", cryptoModuleClassname); CryptoModule cryptoModule = null; Class<?> cryptoModuleClazz = null; try { cryptoModuleClazz = AccumuloVFSClassLoader.loadClass(cryptoModuleClassname); } catch (ClassNotFoundException e1) { throw new IllegalArgumentException("Could not find configured crypto module " + cryptoModuleClassname); } Class<?>[] interfaces = cryptoModuleClazz.getInterfaces(); boolean implementsCryptoModule = false; for (Class<?> clazz : interfaces) { if (clazz.equals(CryptoModule.class)) { implementsCryptoModule = true; break; } } if (!implementsCryptoModule) { throw new IllegalArgumentException("Configured Accumulo crypto module " + cryptoModuleClassname + " does not implement the CryptoModule interface."); } else { try { cryptoModule = (CryptoModule) cryptoModuleClazz.newInstance(); log.debug("Successfully instantiated crypto module {}", cryptoModuleClassname); } catch (InstantiationException | IllegalAccessException e) { throw new IllegalArgumentException("Unable to instantiate the crypto module: " + cryptoModuleClassname, e); } } return cryptoModule; }
Source:
<code>public void testStartExport() throws IOException { ExportDocket exportDocket = new ExportDocket(); File file = new File("docket.pdf"); FileOutputStream fileOutputStream = new FileOutputStream(file); File xslFile = new File("src/test/resources/docket.xsl"); <START> try { <END> exportDocket.startExport(docketDataGenerator.createDocketData("processId", "signature", "doctype"), fileOutputStream, xslFile); } catch (IOException e) { throw new IOException(e.getMessage()); } finally { fileOutputStream.close(); } }</code><technical_language>Please [try-with-resources](<LINK_0> statement instead of handling this manually</technical_language>

Target:
public void testStartExport() throws IOException { ExportDocket exportDocket = new ExportDocket(); File file = new File("docket.pdf"); File xslFile = new File("src/test/resources/docket.xsl"); try (FileOutputStream fileOutputStream = new FileOutputStream(file)) { exportDocket.startExport(docketDataGenerator.createDocketData("processId", "signature", "doctype"), fileOutputStream, xslFile); } catch (IOException e) { throw new IOException(e.getMessage()); } }
Source:
<code>protected void onInit() { super.onInit(); this.jpaExecutor.setBeanFactory(this.getBeanFactory()); if(this.evaluationContext == null) { this.evaluationContext = ExpressionUtils.createStandardEvaluationContext(getBeanFactory()); <START> } <END> }</code><technical_language>instead, please, implements IntegrationEvaluationContextAware</technical_language>

Target:
protected void onInit() { super.onInit(); this.jpaExecutor.setBeanFactory(this.getBeanFactory()); }
Source:
<code>public Rectangle merge(Rectangle other) { <START> requireNonNull(other, "other is null"); <END> return new Rectangle(min(this.xMin, other.xMin), min(this.yMin, other.yMin), max(this.xMax, other.xMax), max(this.yMax, other.yMax)); }</code><technical_language>This is necessary. fail NPE in line if it. In general, more important do kinds of checks holding value, code fail in unrelated place</technical_language>

Target:
public Rectangle merge(Rectangle other) { return new Rectangle(min(this.xMin, other.xMin), min(this.yMin, other.yMin), max(this.xMax, other.xMax), max(this.yMax, other.yMax)); }
Source:
<code>public void testGetCommunicationSummaryStatisticsServiceNameMissingOperation() throws StoreException { CompletionTime ct1 = new CompletionTime(); ct1.setUri("in1"); ct1.setBusinessTransaction("testapp"); ct1.getProperties().add(new Property("prop", "val")); ct1.getProperties().add(new Property(Constants.PROP_SERVICE_NAME, "wildfly")); analytics.storeFragmentCompletionTimes(null, Arrays.asList(ct1)); Criteria criteria = new Criteria() .setStartTime(0) .setEndTime(100000) .setBusinessTransaction("testapp"); Collection<CommunicationSummaryStatistics> communicationSummaryStatisticsList = analytics.getCommunicationSummaryStatistics(null, criteria, false); Assert.assertEquals(1, communicationSummaryStatisticsList.size()); CommunicationSummaryStatistics communicationSummaryStatistics = communicationSummaryStatisticsList.iterator().next(); <START> Assert.assertNotNull("wildfly", communicationSummaryStatistics.getServiceName()); <END> }</code><technical_language>assertEquals</technical_language>

Target:
public void testGetCommunicationSummaryStatisticsServiceNameMissingOperation() throws StoreException { CompletionTime ct1 = new CompletionTime(); ct1.setUri("in1"); ct1.setBusinessTransaction("testapp"); ct1.getProperties().add(new Property("prop", "val")); ct1.getProperties().add(new Property(Constants.PROP_SERVICE_NAME, "wildfly")); analytics.storeFragmentCompletionTimes(null, Arrays.asList(ct1)); Criteria criteria = new Criteria() .setStartTime(0) .setEndTime(100000) .setBusinessTransaction("testapp"); Collection<CommunicationSummaryStatistics> communicationSummaryStatisticsList = analytics.getCommunicationSummaryStatistics(null, criteria, false); Assert.assertEquals(1, communicationSummaryStatisticsList.size()); CommunicationSummaryStatistics communicationSummaryStatistics = communicationSummaryStatisticsList.iterator().next(); Assert.assertEquals("wildfly", communicationSummaryStatistics.getServiceName()); }
Source:
<code>public void clear() { long start = System.currentTimeMillis(); try (LockResource r = new LockResource(mLock.writeLock())) { for (Counter counter : mClusterCounters.values()) { counter.dec(counter.getCount()); } mLastClearTime = System.currentTimeMillis(); MetricsSystem.resetAllMetrics(); } <START> LOG.info("Clearing the metrics store and metrics system in ms", <END> System.currentTimeMillis() - start); }</code><technical_language>nit: suggestion LOG.info("Cleared metrics store metrics system in ms",</technical_language>

Target:
public void clear() { long start = System.currentTimeMillis(); try (LockResource r = new LockResource(mLock.writeLock())) { for (Counter counter : mClusterCounters.values()) { counter.dec(counter.getCount()); } mLastClearTime = System.currentTimeMillis(); MetricsSystem.resetAllMetrics(); } LOG.info("Cleared the metrics store and metrics system in ms", System.currentTimeMillis() - start); }
Source:
<code>public static List<Rule> compose(Collection<ExternalDependency> dependencies) { return dependencies .stream() .filter( dependency -> dependency.packaging.equals("aar") || dependency.packaging.equals("jar")) .sorted( (o1, o2) -> ComparisonChain.start() .compare(o1.packaging, o2.packaging) .compare(o1.getCacheName(), o2.getCacheName()) .result()) .map( dependency -> { String source = null; if (dependency.hasSourceJar()) { source = dependency.getSourceFileName(); } String ruleType; String prebuiltType; String mavenCoords; switch (dependency.packaging) { case "jar": ruleType = "prebuilt_jar"; prebuiltType = "binary_jar"; mavenCoords = dependency.getMavenCoords(); break; case "aar": ruleType = "android_prebuilt_aar"; prebuiltType = "aar"; <START> mavenCoords = null; <END> break; default: throw new IllegalStateException("Dependency not a valid prebuilt: " + dependency); } ImmutableList.Builder<Rule> rulesBuilder = ImmutableList.builder(); rulesBuilder.add( new Prebuilt() .prebuiltType(prebuiltType) .prebuilt(dependency.getDepFileName()) .mavenCoords(mavenCoords) .source(source) .ruleType(ruleType) .name(dependency.getCacheName())); if (dependency.hasLintJar()) { rulesBuilder.add( new Prebuilt() .prebuiltType("binary_jar") .prebuilt(dependency.getLintFileName()) .ruleType("prebuilt_jar") .name(dependency.getLintCacheName())); } return rulesBuilder.build(); }) .flatMap(Collection::stream) .collect(Collectors.toList()); }</code><technical_language>dependency.getMavenCoords()</technical_language>

Target:
public static List<Rule> compose(Collection<ExternalDependency> dependencies) { return dependencies .stream() .filter(dependency -> ImmutableList.of(JAR, AAR).contains(dependency.getPackaging())) .sorted( (o1, o2) -> ComparisonChain.start() .compare(o1.getPackaging(), o2.getPackaging()) .compare(o1.getCacheName(), o2.getCacheName()) .result()) .map( dependency -> { String source = null; if (dependency.hasSourceFile()) { source = dependency.getSourceFileName(); } String ruleType; String prebuiltType; switch (dependency.getPackaging()) { case JAR: ruleType = JAVA_PREBUILT_JAR; prebuiltType = BINARY_JAR; break; case AAR: ruleType = ANDROID_PREBUILT_AAR; prebuiltType = AAR; break; default: throw new IllegalStateException("Dependency not a valid prebuilt: " + dependency); } ImmutableList.Builder<Rule> rulesBuilder = ImmutableList.builder(); rulesBuilder.add( new Prebuilt() .prebuiltType(prebuiltType) .prebuilt(dependency.getDependencyFileName()) .mavenCoords(dependency.getMavenCoords()) .source(source) .ruleType(ruleType) .name(dependency.getCacheName())); if (dependency.hasLintFile()) { rulesBuilder.add( new Prebuilt() .prebuiltType(BINARY_JAR) .prebuilt(dependency.getLintFileName()) .ruleType(JAVA_PREBUILT_JAR) .name(dependency.getLintCacheName())); } return rulesBuilder.build(); }) .flatMap(Collection::stream) .collect(Collectors.toList()); }
Source:
<code>public TimeInfoMsg(String rawMsg) { super(rawMsg); if (this.payload.length == TIME_INFO_PAYLOAD_LEN) { logger.debug("Year => "+(this.payload[0]+2000)); logger.debug("Month => "+(((this.payload[3]&0xC0)>>4)|((this.payload[4]&0xC0)>>6))); logger.debug("DoM => "+this.payload[1]); logger.debug("Hour => "+(this.payload[2] & 0x3F)); logger.debug("Min => "+(this.payload[3] & 0x3F)); logger.debug("Sec => "+(this.payload[4] & 0x3F)); messageTimeInfo = new GregorianCalendar(this.payload[0]+2000, (((this.payload[3]&0xC0)>>4)|((this.payload[4]&0xC0)>>6))-1, this.payload[1], (this.payload[2] & 0x3F), (this.payload[3] & 0x3F), (this.payload[4] & 0x3F)); } else if (this.payload.length == TIME_INFO_REQUEST_PAYLOAD_LEN) { messageTimeInfo = new GregorianCalendar(0,0,1); logger.debug("Received Time request - setting time to 1/1/0"); } <START> else <END> logger.error("TimeInfoMsg raw packet was of incorrect length to parse! Expect "+TIME_INFO_PAYLOAD_LEN+" got "+payload.length); }</code><technical_language>please add curly braces</technical_language>

Target:
public TimeInfoMsg(String rawMsg) { super(rawMsg); if (this.payload.length == TIME_INFO_PAYLOAD_LEN) { logger.debug("Year => " + (this.payload[0] + 2000)); logger.debug("Month => " + (((this.payload[3] & 0xC0) >> 4) | ((this.payload[4] & 0xC0) >> 6))); logger.debug("DoM => " + this.payload[1]); logger.debug("Hour => " + (this.payload[2] & 0x3F)); logger.debug("Min => " + (this.payload[3] & 0x3F)); logger.debug("Sec => " + (this.payload[4] & 0x3F)); messageTimeInfo = new GregorianCalendar( this.payload[0] + 2000, (((this.payload[3] & 0xC0) >> 4) | ((this.payload[4] & 0xC0) >> 6)) - 1, this.payload[1], (this.payload[2] & 0x3F), (this.payload[3] & 0x3F), (this.payload[4] & 0x3F)); } else if (this.payload.length == TIME_INFO_REQUEST_PAYLOAD_LEN) { messageTimeInfo = new GregorianCalendar(0, 0, 1); logger.debug("Received Time request - setting time to 1/1/0"); } else { logger.error("TimeInfoMsg raw packet was of incorrect length to parse! Expect " + TIME_INFO_PAYLOAD_LEN + " got " + payload.length); } }
Source:
<code>protected Argument build(ZoneId value, ConfigRegistry config) { <START> return new LoggableBinderArgument<>(Objects.toString(value, null), PreparedStatement::setString); <END> }</code><technical_language>v4 Argument add a getValue() method something, stop hacks</technical_language>

Target:
protected Argument build(ZoneId value, ConfigRegistry config) { return LoggableBinderArgument.bindAsString(value); }
Source:
<code>private List<SubmitRecord> invalidResult(Term rule, Term record, String reason) { return <START> ruleError("Submit rule " + rule + " for change " + cd.getId() + " of " + getProjectName() + " output invalid result: " + record + (reason == null ? "" : ". Reason: " + reason)); <END> }</code><technical_language>String.format easier digest</technical_language>

Target:
private List<SubmitRecord> invalidResult(Term rule, Term record, String reason) { return ruleError(String.format("Submit rule %s for change %s of %s output " + "invalid result: %s%s", rule, cd.getId(), getProjectName(), record, (reason == null ? "" : ". Reason: " + reason))); }
Source:
<code>public void doCapture_shouldSetChargeStatusToCaptureApprovedRetryOnError_whenProviderReturnsErrorResponse() { String gatewayTxId = "theTxId"; ChargeEntity charge = createNewChargeWith("worldpay", 1L, CAPTURE_APPROVED, gatewayTxId); ChargeEntity chargeSpy = spy(charge); mockChargeDaoOperations(chargeSpy); worldpayWillRespondWithError(); when(mockedProviders.byName(charge.getPaymentGatewayName())).thenReturn(mockedPaymentProvider); GatewayResponse response = cardCaptureService.doCapture(charge.getExternalId()); assertThat(response.isFailed(), is(true)); InOrder inOrder = Mockito.inOrder(chargeSpy); inOrder.verify(chargeSpy).setStatus(CAPTURE_READY); inOrder.verify(chargeSpy).setStatus(CAPTURE_APPROVED_RETRY); verify(mockedChargeEventDao).persistChargeEventOf(chargeSpy, Optional.empty()); verify(mockStatusUpdater).updateChargeTransactionStatus(charge.getExternalId(), CAPTURE_READY); <START> verify(mockStatusUpdater).updateChargeTransactionStatus(charge.getExternalId(), CAPTURE_APPROVED_RETRY); <END> verifyZeroInteractions(mockUserNotificationService); }</code><technical_language>in-order verification opportunities</technical_language>

Target:
public void doCapture_shouldSetChargeStatusToCaptureApprovedRetryOnError_whenProviderReturnsErrorResponse() { String gatewayTxId = "theTxId"; ChargeEntity charge = createNewChargeWith("worldpay", 1L, CAPTURE_APPROVED, gatewayTxId); ChargeEntity chargeSpy = spy(charge); mockChargeDaoOperations(chargeSpy); worldpayWillRespondWithError(); when(mockedProviders.byName(charge.getPaymentGatewayName())).thenReturn(mockedPaymentProvider); GatewayResponse response = cardCaptureService.doCapture(charge.getExternalId()); assertThat(response.isFailed(), is(true)); InOrder inOrder = Mockito.inOrder(chargeSpy); inOrder.verify(chargeSpy).setStatus(CAPTURE_READY); inOrder.verify(chargeSpy).setStatus(CAPTURE_APPROVED_RETRY); verify(mockedChargeEventDao).persistChargeEventOf(chargeSpy, Optional.empty()); InOrder inOrderStatusUpdater = Mockito.inOrder(mockStatusUpdater); inOrderStatusUpdater.verify(mockStatusUpdater).updateChargeTransactionStatus(charge.getExternalId(), CAPTURE_READY); inOrderStatusUpdater.verify(mockStatusUpdater).updateChargeTransactionStatus(charge.getExternalId(), CAPTURE_APPROVED_RETRY); verifyZeroInteractions(mockUserNotificationService); }
Source:
<code>public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain chain) throws IOException, ServletException { HttpServletRequest request = (HttpServletRequest) servletRequest; HttpServletResponse response = (HttpServletResponse) servletResponse; String token = request.getHeader("X-Proofpoint-TraceToken"); if (token == null || token.isEmpty()) { createAndRegisterNewRequestToken(); } else if (token.charAt(0) == '{') { try { registerTraceToken(TRACE_TOKEN_JSON_CODEC.fromJson(token)); } catch (RuntimeException e) { <START> createAndRegisterNewRequestToken(); <END> } } else { registerRequestToken(token); } chain.doFilter(request, response); }</code><technical_language>I change this. If caller passes in a trace token starts {, parse json, I call registerRequestToken() raw string value. continue pass trace token passed in us. Creating a new request token right</technical_language>

Target:
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain chain) throws IOException, ServletException { HttpServletRequest request = (HttpServletRequest) servletRequest; HttpServletResponse response = (HttpServletResponse) servletResponse; String token = request.getHeader("X-Proofpoint-TraceToken"); if (token == null || token.isEmpty()) { registerNewRequestToken(request); } else if (token.charAt(0) == '{') { try { registerTraceToken(TRACE_TOKEN_JSON_CODEC.fromJson(token)); } catch (RuntimeException e) { registerNewRequestToken(request); } } else { registerRequestToken(token); } chain.doFilter(request, response); }