auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public boolean applicable(Context context) { TypeElement parcelable = context.processingEnvironment().getElementUtils().getTypeElement("android.os.Parcelable"); TypeMirror autoValueClass = context.autoValueClass().asType(); return TypeSimplifier.isClassOfType(context.processingEnvironment().getTypeUtils(), parcelable.asType(), <START> autoValueClass); <END> }</code><technical_language>nit: previous line</technical_language>

Target:
public boolean applicable(Context context) { TypeMirror parcelable = context.processingEnvironment().getElementUtils() .getTypeElement("android.os.Parcelable").asType(); TypeMirror autoValueClass = context.autoValueClass().asType(); return TypeSimplifier.isClassOfType(context.processingEnvironment().getTypeUtils(), parcelable, autoValueClass); }
Source:
<code>public AuthenticationResult getToken(String authorizationUrl) throws IOException, AuthenticationException { if (StringExtensions.isNullOrBlank(authorizationUrl)) { throw new IllegalArgumentException("authorizationUrl"); } HashMap<String, String> parameters = StringExtensions.getUrlParameters(authorizationUrl); String encodedState = parameters.get("state"); String state = decodeProtocolState(encodedState); if (!StringExtensions.isNullOrBlank(state)) { Uri stateUri = Uri.parse("http://state/path?" + state); String authorizationUri = stateUri.getQueryParameter("a"); String resource = stateUri.getQueryParameter("r"); if (!StringExtensions.isNullOrBlank(authorizationUri) && !StringExtensions.isNullOrBlank(resource) && resource.equalsIgnoreCase(mRequest.getResource())) { AuthenticationResult result = processUIResponseParams(parameters); if (result != null && result.getCode() != null && !result.getCode().isEmpty()) { if (!StringExtensions.isNullOrBlank(result.getAuthority())) { setTokenEndpoint(result.getAuthority() + DEFAULT_TOKEN_ENDPOINT); } final AuthenticationResult tokenResult; tokenResult = getTokenForCode(result.getCode()); <START> if (!StringExtensions.isNullOrBlank(result.getAuthority())) { <END> tokenResult.setCloudInstanceName(result.getAuthority()); } return tokenResult; } return result; } else { throw new AuthenticationException(ADALError.AUTH_FAILED_BAD_STATE); } } else { throw new AuthenticationException(ADALError.AUTH_FAILED_NO_STATE); } }</code><technical_language>returning complete AAD authority host name</technical_language>

Target:
public AuthenticationResult getToken(String authorizationUrl) throws IOException, AuthenticationException { if (StringExtensions.isNullOrBlank(authorizationUrl)) { throw new IllegalArgumentException("authorizationUrl"); } HashMap<String, String> parameters = StringExtensions.getUrlParameters(authorizationUrl); String encodedState = parameters.get("state"); String state = decodeProtocolState(encodedState); if (!StringExtensions.isNullOrBlank(state)) { Uri stateUri = Uri.parse("http://state/path?" + state); String authorizationUri = stateUri.getQueryParameter("a"); String resource = stateUri.getQueryParameter("r"); if (!StringExtensions.isNullOrBlank(authorizationUri) && !StringExtensions.isNullOrBlank(resource) && resource.equalsIgnoreCase(mRequest.getResource())) { AuthenticationResult result = processUIResponseParams(parameters); if (result != null && result.getCode() != null && !result.getCode().isEmpty()) { final AuthenticationResult tokenResult = getTokenForCode(result.getCode()); if (!StringExtensions.isNullOrBlank(result.getAuthority())) { tokenResult.setAuthority(result.getAuthority()); } else { tokenResult.setAuthority(mRequest.getAuthority()); } return tokenResult; } return result; } else { throw new AuthenticationException(ADALError.AUTH_FAILED_BAD_STATE); } } else { throw new AuthenticationException(ADALError.AUTH_FAILED_NO_STATE); } }
Source:
<code>public void testQuery() throws Exception { List<Map<String, Object>> users = handle.createQuery("SELECT id, name FROM user ORDER BY id ASC") .list(); assertThat(users, contains( map("id", 1, "name", "Alice"), <START> map("id", 2, "name", "Bob"))); <END> }</code><technical_language>switch this assertj? assertThat(users).extracting("id").contains(1, 2); assertThat(users).extracting("name").contains("Alice", "Bob");</technical_language>

Target:
public void testQuery() throws Exception { List<Map<String, Object>> users = handle.createQuery("SELECT id, name FROM user ORDER BY id ASC") .list(); assertThat(users).containsExactly( map("id", 1, "name", "Alice"), map("id", 2, "name", "Bob")); }
Source:
<code>public boolean getToggleStatus() { if (PrefManager.getUserStatus() == Constants.USER_OFFLINE) { return true; } else { return false; } <START> } <END></code><technical_language>reduce number of line codes simply this: public boolean getToggleStatus() { return PrefManager.getUserStatus() == Constants.USER_OFFLINE }</technical_language>

Target:
public boolean getToggleStatus() { public boolean getToggleStatus() { return PrefManager.getUserStatus() == Constants.USER_OFFLINE } }
Source:
<code>public void editServiceTypes(Editable mServiceNameText, Editable mServiceDiscriptionText, Editable mServiceDurationText, String uuid) { Services services=new Services(); services.setName(String.valueOf(mServiceNameText)); services.setDuration(Integer.valueOf(String.valueOf(mServiceDurationText))); <START> Log.e("sgsg",String.valueOf(mServiceDiscriptionText)); <END> services.setDescription(String.valueOf(mServiceDiscriptionText)); RestApi restApi = RestServiceBuilder.createService(RestApi.class); Call<Services> call = restApi.editServiceTypes(uuid,services); call.enqueue(new Callback<Services>() { @Override public void onResponse(Call<Services> call, Response<Services> response) { if (response.isSuccessful()) { mFormAddEditServiceView.endActivity(); } } @Override public void onFailure(Call<Services> call, Throwable t) { Log.e("jvsgsegaegk", String.valueOf(t)); } }); }</code><technical_language>I a consistent tag if Log.e() often</technical_language>

Target:
public void editServiceTypes(Editable mServiceNameText, Editable mServiceDiscriptionText, Editable mServiceDurationText, String uuid) { Services services=new Services(); services.setName(String.valueOf(mServiceNameText)); services.setDuration(Integer.valueOf(String.valueOf(mServiceDurationText))); services.setDescription(String.valueOf(mServiceDiscriptionText)); RestApi restApi = RestServiceBuilder.createService(RestApi.class); Call<Services> call = restApi.editServiceTypes(uuid,services); call.enqueue(new Callback<Services>() { @Override public void onResponse(Call<Services> call, Response<Services> response) { if (response.isSuccessful()) { mFormAddEditServiceView.endActivity(); } } @Override public void onFailure(Call<Services> call, Throwable t) { } }); }
Source:
<code>public boolean every(@Nonnull F<T, Boolean> f) { ImmutableList<T> list = this; <START> while (list instanceof NonEmptyImmutableList) { <END> if (!f.apply(((NonEmptyImmutableList<T>) list).head)) { return false; } list = ((NonEmptyImmutableList<T>) list).tail; } return true; }</code><technical_language>change implementation match exists? real reason for different</technical_language>

Target:
public boolean every(@Nonnull F<T, Boolean> f) { NonEmptyImmutableList<T> list = this; while (true) { if (!f.apply(list.head)) { return false; } if (list.tail instanceof Nil) { return true; } list = ((NonEmptyImmutableList<T>) list.tail); } }
Source:
<code>protected long getBasesExcludedBy(final CountingFilter filter) { if(INTERVALS != null){ return filter.getFilteredRecords(); } <START> return filter.getFilteredBases(); <END> }</code><technical_language>Also, this method shortened a single line: return (INTERVALS != null) ? filter.getFilteredRecords() : filter.getFilteredBases(); Oh, another thing: protocol in this codebase is put spaces 'if' braces. Otherwise, risk incurring wrath of @nh13</technical_language>

Target:
protected long getBasesExcludedBy(final CountingFilter filter) { return filter.getFilteredBases(); }
Source:
<code>private void mergeDiffs(List<? extends Diff> differences, boolean leftToRight) { IDiffRelationshipComputer computer = new CachingDiffRelationshipComputer(mergerRegistry); <START> if (leftToRight) { mergeRunnable = new MergeRunnableImpl(true, true, MergeMode.LEFT_TO_RIGHT, computer); } else { mergeRunnable = new MergeRunnableImpl(true, true, MergeMode.RIGHT_TO_LEFT, computer); } <END> mergeRunnable.merge(differences, leftToRight, mergerRegistry); }</code><technical_language>More : final MergeMode mode; if (leftToRight) { mode = MergeMode.LEFT_TO_RIGHT; } else { mode = MergeMode.RIGHT_TO_LEFT; } mergeRunnable = new MergeRunnableImpl(true, true, mode computer);</technical_language>

Target:
private void mergeDiffs(List<? extends Diff> differences, boolean leftToRight) { IDiffRelationshipComputer computer = new CachingDiffRelationshipComputer(mergerRegistry); final MergeMode mergeMode; if (leftToRight) { mergeMode = MergeMode.LEFT_TO_RIGHT; } else { mergeMode = MergeMode.RIGHT_TO_LEFT; } mergeRunnable = new MergeRunnableImpl(true, true, mergeMode, computer); mergeRunnable.merge(differences, leftToRight, mergerRegistry); }
Source:
<code>private Indices range() { Long last = null; Long first = null; for (Entry<String, Collection<ObjectType>> a : edges.entrySet()) { Long value = RDF.sequenceNumberOf(a.getKey()); if (value != null) { if ((first == null) || (value < first)) { first = value; } if ((last == null) || (value > last)) { last = value; } } } <START> return (first == null) || (last == null) ? null : new Indices(first, last); <END> }</code><technical_language>Returning a null avoided. Is a new Indeces() a solution</technical_language>

Target:
private Pair<Long, Long> range() { Long last = null; Long first = null; for (Entry<String, Collection<ObjectType>> a : edges.entrySet()) { Optional<Long> value = RDF.sequenceNumberOf(a.getKey()); if (value.isPresent()) { if ((first == null) || (value.get() < first)) { first = value.get(); } if ((last == null) || (value.get() > last)) { last = value.get(); } } } return (first == null) || (last == null) ? null : Pair.of(first, last); }
Source:
<code>public void search_user_with_not_and_present_and_equal_field_returns_right_user() { String query = encodeExpected("not (extension.gender pr and extension.gender eq \"male\")"); SCIMSearchResult<User> queryResult = oConnector.searchUsers("filter=" + query + "&sortBy=username", accessToken); assertThat(queryResult.getTotalResults(), is(equalTo(3L))); assertThat(queryResult.getResources().get(0).getUserName(), is(equalTo("existing2"))); <START> assertThat(queryResult.getResources().get(0).getUserName(), is(equalTo("existing3"))); <END> assertThat(queryResult.getResources().get(1).getUserName(), is(equalTo("marissa"))); }</code><technical_language>queryResult.getResources().get(0) 2 usernames</technical_language>

Target:
public void search_user_with_not_and_present_and_equal_field_returns_right_user() { String query = encodeExpected("not (extension.gender pr and extension.gender eq \"male\")"); SCIMSearchResult<User> queryResult = oConnector.searchUsers("filter=" + query + "&sortBy=username", accessToken); assertThat(queryResult.getTotalResults(), is(equalTo(3L))); assertThat(queryResult.getResources().get(0).getUserName(), is(equalTo("existing2"))); assertThat(queryResult.getResources().get(1).getUserName(), is(equalTo("existing3"))); assertThat(queryResult.getResources().get(2).getUserName(), is(equalTo("marissa"))); }
Source:
<code>private List<? extends Message> generateEvents(Message command, CommandContext context) throws InvocationTargetException { checkNotNull(command, "command"); checkNotNull(context, "context"); final Object handlingResult = invokeHandler(command, context); <START> return commandHandlingResultToEvents(handlingResult); <END> }</code><technical_language>Extract variable result</technical_language>

Target:
private List<? extends Message> generateEvents(Message command, CommandContext context) throws InvocationTargetException { checkNotNull(command, "command"); checkNotNull(context, "context"); final Class<? extends Message> commandClass = command.getClass(); final Method method = commandHandlers.get(commandClass); if (method == null) { throw missingCommandHandler(commandClass); } final CommandHandlerMethod commandHandler = new AggregateCommandHandler(this, method); final List<? extends Message> result = commandHandler.invoke(command, context); return result; }
Source:
<code>public void stepEnded(AbstractStepScope stepScope) { if (stepScope.getBestScoreImproved()) { DefaultSolverScope solverScope = stepScope.getPhaseScope().getSolverScope(); long bestSolutionTimeMillis = solverScope.getBestSolutionTimeMillis(); Score bestScore = solverScope.getBestScore(); for (Iterator<Pair<Long, Score>> it = bestScoreImprovementHistoryQueue.iterator(); it.hasNext(); ) { Pair<Long, Score> bestScoreImprovement = it.next(); Score scoreDifference = bestScore.subtract(bestScoreImprovement.getValue()); final boolean timeLimitNotYetReached = <START> bestScoreImprovement.getKey() + unimprovedTimeMillisSpentLimit >= bestSolutionTimeMillis; <END> final boolean scoreImprovedOverThreshold = scoreDifference.compareTo(unimprovedScoreDifferenceThreshold) >= 0; if (scoreImprovedOverThreshold && timeLimitNotYetReached) { it.remove(); long safeTimeMillis = bestSolutionTimeMillis + unimprovedTimeMillisSpentLimit; solverSafeTimeMillis = safeTimeMillis; phaseSafeTimeMillis = safeTimeMillis; } else { break; } } bestScoreImprovementHistoryQueue.add(Pair.of(bestSolutionTimeMillis, bestScore)); } }</code><technical_language>this reuse bestSolutionTimeMillis instead of getKey()</technical_language>

Target:
public void stepEnded(AbstractStepScope stepScope) { if (stepScope.getBestScoreImproved()) { DefaultSolverScope solverScope = stepScope.getPhaseScope().getSolverScope(); long bestSolutionTimeMillis = solverScope.getBestSolutionTimeMillis(); Score bestScore = solverScope.getBestScore(); for (Iterator<Pair<Long, Score>> it = bestScoreImprovementHistoryQueue.iterator(); it.hasNext(); ) { Pair<Long, Score> bestScoreImprovement = it.next(); Score scoreDifference = bestScore.subtract(bestScoreImprovement.getValue()); boolean timeLimitNotYetReached = bestScoreImprovement.getKey() + unimprovedTimeMillisSpentLimit >= bestSolutionTimeMillis; boolean scoreImprovedOverThreshold = scoreDifference.compareTo(unimprovedScoreDifferenceThreshold) >= 0; if (scoreImprovedOverThreshold && timeLimitNotYetReached) { it.remove(); long safeTimeMillis = bestSolutionTimeMillis + unimprovedTimeMillisSpentLimit; solverSafeTimeMillis = safeTimeMillis; phaseSafeTimeMillis = safeTimeMillis; } else { break; } } bestScoreImprovementHistoryQueue.add(Pair.of(bestSolutionTimeMillis, bestScore)); } }
Source:
<code>public void checkAngularPatternfyStarterProjectCommands() { consoles.executeCommandFromProjectExplorer( ANGULAR_PATTERNFLY_STARTER, BUILD_GOAL, INSTALL_DEPENDENCIES_COMMAND_ITEM.getItem(ANGULAR_PATTERNFLY_STARTER), "bower_components/font-awesome"); consoles.executeCommandFromProjectExplorer( ANGULAR_PATTERNFLY_STARTER, RUN_GOAL, RUN_COMMAND_ITEM.getItem(ANGULAR_PATTERNFLY_STARTER), "Waiting..."); <START> consoles.checkWebElementVisibilityAtPreviewPage(By.xpath(" END> consoles.closeProcessTabWithAskDialog("angular-patternfly-starter:run"); }</code><technical_language>clear "//*[@id='pf-app']" is about. this point name string somehow</technical_language>

Target:
public void checkAngularPatternfyStarterProjectCommands() { By textOnPreviewPage = By.xpath(" consoles.executeCommandFromProjectExplorer( ANGULAR_PROJECT, BUILD_GOAL, INSTALL_DEPENDENCIES_COMMAND_ITEM.getItem(ANGULAR_PROJECT), "bower_components/font-awesome"); consoles.executeCommandFromProjectExplorer( ANGULAR_PROJECT, RUN_GOAL, RUN_COMMAND_ITEM.getItem(ANGULAR_PROJECT), "Waiting..."); consoles.checkWebElementVisibilityAtPreviewPage(textOnPreviewPage); consoles.closeProcessTabWithAskDialog(RUN_COMMAND_ITEM.getItem(ANGULAR_PROJECT)); }
Source:
<code>@Override public void unparseCall(final SqlWriter writer, final SqlCall call, final int leftPrec, final int rightPrec) { switch (call.getKind()) { case POSITION: final SqlWriter.Frame frame = writer.startFunCall("STRPOS"); writer.sep(","); call.operand(1).unparse(writer, leftPrec, rightPrec); writer.sep(","); call.operand(0).unparse(writer, leftPrec, rightPrec); if (3 == call.operandCount()) { throw new RuntimeException("3rd operand Not Supported for Function STRPOS in Big Query"); } writer.endFunCall(frame); break; case UNION: if (!((SqlSetOperator) call.getOperator()).isAll()) { SqlSyntax.BINARY.unparse(writer, UNION_DISTINCT, call, leftPrec, rightPrec); } break; case EXCEPT: if (!((SqlSetOperator) call.getOperator()).isAll()) { SqlSyntax.BINARY.unparse(writer, EXCEPT_DISTINCT, call, leftPrec, rightPrec); } break; case INTERSECT: if (!((SqlSetOperator) call.getOperator()).isAll()) { SqlSyntax.BINARY.unparse(writer, INTERSECT_DISTINCT, call, leftPrec, rightPrec); } break; <START> case REGEXP_SUBSTR: <END> unparseRegexSubstr(writer, call, leftPrec, rightPrec); break; default: super.unparseCall(writer, call, leftPrec, rightPrec); } }</code><technical_language>A Sqlkind is needed for REGEXP_SUBSTR. unparse super.unparseCall(writer, call, leftPrec, rightPrec);, in require implement unparse for new operators</technical_language>

Target:
@Override public void unparseCall(final SqlWriter writer, final SqlCall call, final int leftPrec, final int rightPrec) { switch (call.getKind()) { case POSITION: final SqlWriter.Frame frame = writer.startFunCall("STRPOS"); writer.sep(","); call.operand(1).unparse(writer, leftPrec, rightPrec); writer.sep(","); call.operand(0).unparse(writer, leftPrec, rightPrec); if (3 == call.operandCount()) { throw new RuntimeException("3rd operand Not Supported for Function STRPOS in Big Query"); } writer.endFunCall(frame); break; case UNION: if (((SqlSetOperator) call.getOperator()).isAll()) { super.unparseCall(writer, call, leftPrec, rightPrec); } else { SqlSyntax.BINARY.unparse(writer, UNION_DISTINCT, call, leftPrec, rightPrec); } break; case EXCEPT: if (((SqlSetOperator) call.getOperator()).isAll()) { throw new RuntimeException("BigQuery does not support EXCEPT ALL"); } SqlSyntax.BINARY.unparse(writer, EXCEPT_DISTINCT, call, leftPrec, rightPrec); break; case INTERSECT: if (((SqlSetOperator) call.getOperator()).isAll()) { throw new RuntimeException("BigQuery does not support INTERSECT ALL"); } SqlSyntax.BINARY.unparse(writer, INTERSECT_DISTINCT, call, leftPrec, rightPrec); break; case TRIM: unparseTrim(writer, call, leftPrec, rightPrec); break; case REGEXP_SUBSTR: unparseRegexSubstr(writer, call, leftPrec, rightPrec); break; default: super.unparseCall(writer, call, leftPrec, rightPrec); } }
Source:
<code>public WireRecord(Map<String, TypedValue<?>> properties) { requireNonNull(properties, "Properties cannot be null"); <START> this.properties = properties; <END> }</code><technical_language>immutable. new HashMap<>(properties). clients able mutate state of WireRecord provided map reference</technical_language>

Target:
public WireRecord(Map<String, TypedValue<?>> properties) { requireNonNull(properties, "Properties cannot be null"); this.properties = new HashMap<>(properties); }
Source:
<code>boolean complete(int bookieIndex, BookieSocketAddress host, ByteBuf buffer) { boolean completed = super.complete(bookieIndex, host, buffer); <START> if (completed && lh.bk.getConf().getEnsemblePlacementPolicySlowBookies()) { <END> int numReplicasTried = getNextReplicaIndexToReadFrom(); for (int i = 0 ; i < numReplicasTried - 1; i++) { int slowBookieIndex = writeSet.get(i); BookieSocketAddress slowBookieSocketAddress = ensemble.get(slowBookieIndex); lh.bk.placementPolicy.registerSlowBookie(slowBookieSocketAddress, entryId); } } return completed; }</code><technical_language>i need check if this is enabled here. if disabled, placement policy ignore extra info</technical_language>

Target:
boolean complete(int bookieIndex, BookieSocketAddress host, ByteBuf buffer) { boolean completed = super.complete(bookieIndex, host, buffer); if (completed) { int numReplicasTried = getNextReplicaIndexToReadFrom(); for (int i = 0 ; i < numReplicasTried - 1; i++) { int slowBookieIndex = writeSet.get(i); BookieSocketAddress slowBookieSocketAddress = ensemble.get(slowBookieIndex); lh.bk.placementPolicy.registerSlowBookie(slowBookieSocketAddress, eId); } } return completed; }
Source:
<code>static Slf4jLogMessageContext parseSlf4jContextFromLogMessage(String logMessage) { Matcher m = LOGGER_CONTEXT_PATTERN.matcher(logMessage); <START> String loggerName = "appium.service"; <END> Level level = INFO; if (m.find()) { loggerName += "." + m.group(2).toLowerCase().replaceAll("\\s+", ""); if (m.group(1) != null) { level = DEBUG; } } return new Slf4jLogMessageContext(loggerName, level); }</code><technical_language>This in constant</technical_language>

Target:
static Slf4jLogMessageContext parseSlf4jContextFromLogMessage(String logMessage) { Matcher m = LOGGER_CONTEXT_PATTERN.matcher(logMessage); String loggerName = APPIUM_SERVICE_SLF4J_LOGGER_PREFIX; Level level = INFO; if (m.find()) { loggerName += "." + m.group(2).toLowerCase().replaceAll("\\s+", ""); if (m.group(1) != null) { level = DEBUG; } } return new Slf4jLogMessageContext(loggerName, level); }
Source:
<code>public void should_wait_on_connection_if_zero_core_connections() throws Exception { int readTimeout = 1000; int reconnectInterval = 1000; Cluster cluster = this.createClusterBuilder() .withSocketOptions(new SocketOptions() .setConnectTimeoutMillis(readTimeout) .setReadTimeoutMillis(reconnectInterval)) .withReconnectionPolicy(new ConstantReconnectionPolicy(1000)).build(); try { cluster.init(); assertThat(cluster).hasOpenControlConnection(); Connection.Factory factory = spy(cluster.manager.connectionFactory); cluster.manager.connectionFactory = factory; HostConnectionPool pool = createPool(cluster, 0, 2); assertThat(pool.connections).hasSize(0); assertThat(cluster).host(1).hasState(Host.State.UP); assertThat(cluster).hasOpenControlConnection(); reset(factory); MockRequest request = MockRequest.send(pool, 1); verify(factory, timeout(readTimeout).times(1)).open(any(HostConnectionPool.class)); <START> Uninterruptibles.getUninterruptibly(request.connectionFuture, 5, TimeUnit.SECONDS); <END> assertPoolSize(pool, 1); request.requestInitialized.get(); request.simulateSuccessResponse(); } finally { cluster.close(); } }</code><technical_language>This line needed anymore completion of requestInitialized depends connectionFuture</technical_language>

Target:
public void should_wait_on_connection_if_zero_core_connections() throws Exception { int readTimeout = 1000; int reconnectInterval = 1000; Cluster cluster = this.createClusterBuilder() .withSocketOptions(new SocketOptions() .setConnectTimeoutMillis(readTimeout) .setReadTimeoutMillis(reconnectInterval)) .withReconnectionPolicy(new ConstantReconnectionPolicy(1000)).build(); try { cluster.init(); assertThat(cluster).hasOpenControlConnection(); Connection.Factory factory = spy(cluster.manager.connectionFactory); cluster.manager.connectionFactory = factory; HostConnectionPool pool = createPool(cluster, 0, 2); assertThat(pool.connections).hasSize(0); assertThat(cluster).host(1).hasState(Host.State.UP); assertThat(cluster).hasOpenControlConnection(); reset(factory); MockRequest request = MockRequest.send(pool, 1); verify(factory, timeout(readTimeout).times(1)).open(any(HostConnectionPool.class)); assertPoolSize(pool, 1); Uninterruptibles.getUninterruptibly(request.requestInitialized, 10, TimeUnit.SECONDS); request.simulateSuccessResponse(); } finally { cluster.close(); } }
Source:
<code>private void waitForState( ScheduledServiceListResource task, String state ) throws Exception { final long start = System.currentTimeMillis(); final String name = task.getName(); String actualState; while ( !( actualState = task.getStatus() ).equals( state ) ) { <START> log.info( String.format( "Seeing state '%s' for task '%s', waiting for '%s'", actualState, name, state ) ); <END> if ( System.currentTimeMillis() - start > 15000 ) { throw new IllegalStateException( String.format( "Task '%s' was not in expected state '%s' after waiting for 15s (actual state: '%s')", name, state, actualState ) ); } Time.millis( 500 ).sleep(); task = TaskScheduleUtil.getTask( name ); checkNotNull( task, "Task not found!" ); } }</code><technical_language>avoid String.format slf4j placeholders '{}' - 3 arguments need <LINK_0>,%20java.lang.Object%5B%5D) form</technical_language>

Target:
private void waitForState( ScheduledServiceListResource task, String state ) throws Exception { final long start = System.currentTimeMillis(); final String name = task.getName(); String actualState; while ( !( actualState = task.getStatus() ).equals( state ) ) { log.info( "Seeing state '{}' for task '{}', waiting for '{}'", new String[] { actualState, name, state } ); if ( System.currentTimeMillis() - start > 15000 ) { throw new IllegalStateException( String.format( "Task '%s' was not in expected state '%s' after waiting for 15s (actual state: '%s')", name, state, actualState ) ); } Time.millis( 500 ).sleep(); task = TaskScheduleUtil.getTask( name ); checkNotNull( task, "Task not found!" ); } }
Source:
<code>public boolean isAllowed(List<String> idList, Set<Identity> identities) { switch (accessMode()) { <START> case "required": <END> if (isWhitelisted(idList)) { break; } throw new ClientVisibleException(ResponseCodes.UNAUTHORIZED); case "restricted": boolean hasAccessToAProject = authDao.hasAccessToAnyProject(identities, false, null); if (hasAccessToAProject || isWhitelisted(idList)) { break; } throw new ClientVisibleException(ResponseCodes.UNAUTHORIZED); case "unrestricted": break; default: throw new ClientVisibleException(ResponseCodes.UNAUTHORIZED); } return true; }</code><technical_language>define values string constants</technical_language>

Target:
public boolean isAllowed(List<String> idList, Set<Identity> identities) { switch (accessMode()) { case REQUIRED_ACCESSMODE: if (isWhitelisted(idList)) { break; } throw new ClientVisibleException(ResponseCodes.UNAUTHORIZED); case RESTRICTED_ACCESSMODE: boolean hasAccessToAProject = authDao.hasAccessToAnyProject(identities, false, null); if (hasAccessToAProject || isWhitelisted(idList)) { break; } throw new ClientVisibleException(ResponseCodes.UNAUTHORIZED); case UNRESTRICTED_ACCESSMODE: break; default: throw new ClientVisibleException(ResponseCodes.UNAUTHORIZED); } return true; }
Source:
<code>protected void launchJavaElements(List<IJavaElement> elements, String mode) throws CoreException { <START> launch(elements.iterator().next().getJavaProject().getProject().getFullPath(), mode); <END> }</code><technical_language>elements.get(0).getJava.... is elements.iterator().next().getJava.... Lets consistent. elements is a list, lets get(0) match code above</technical_language>

Target:
protected void launchJavaElements(List<IJavaElement> elements, String mode) throws CoreException { launch(elements.get(0).getJavaProject().getProject().getFullPath(), mode); }
Source:
<code>public void setup() { PowerMockito.mockStatic(GraphDatabase.class); <START> Driver driverMock = Mockito.mock(Driver.class); <END> Mockito.when(GraphDatabase.routingDriver(Mockito.any(), Mockito.any(), Mockito.any())).thenReturn(driverMock); }</code><technical_language>suggestion</technical_language>

Target:
public void setup() { PowerMockito.mockStatic(GraphDatabase.class); Mockito .when(GraphDatabase.routingDriver(Mockito.any(), Mockito.any(), Mockito.any())) .thenAnswer(Answers.RETURNS_MOCKS); }
Source:
<code>public void onStart(Intent intent, int startId) { super.onStart(intent, startId); final int commandType = intent.getIntExtra(SERVICE_COMMAND_KEY, COMMAND_BLANK); final Intent executeParamIntent = intent; <START> new AsyncTask(){ <END> @Override protected ArrayList doInBackground(Object... objs) { try { executeCommand(commandType, executeParamIntent); } catch (Exception e) { LogUtils.logD(e.getMessage()); } return null; } }.execute(null); }</code><technical_language>parameterized AsyncTask instead of raw type, put parameters in execute get in doInBackgroud, for example: new AsyncTask<Bundle, Void, Void>() { ..... }</technical_language>

Target:
public void onStart(Intent intent, int startId) { super.onStart(intent, startId); Bundle taskParams = new Bundle(); taskParams.putParcelable(PARAM_INTENT_KEY, intent); new AsyncTask<Bundle, Void, Void>(){ @Override protected Void doInBackground(Bundle... objs) { try { Intent executeParamIntent = objs[0].getParcelable(PARAM_INTENT_KEY); int commandType = executeParamIntent.getIntExtra(SERVICE_COMMAND_KEY, COMMAND_BLANK); executeCommand(commandType, executeParamIntent); } catch (Exception e) { LogUtils.logD(e.getMessage()); } return null; } }.execute(new Bundle[]{taskParams}); }
Source:
<code>private void doStartThread() { assert thread == null; executor.execute(new Runnable() { @Override public void run() { thread = nonVolatileThread = Thread.currentThread(); if (interrupted) { nonVolatileThread.interrupt(); } boolean success = false; updateLastExecutionTime(); try { SingleThreadEventExecutor.this.run(); success = true; } catch (Throwable t) { logger.warn("Unexpected exception from an event executor: ", t); } finally { for (;;) { int oldState = state; if (oldState >= ST_SHUTTING_DOWN || STATE_UPDATER.compareAndSet( SingleThreadEventExecutor.this, oldState, ST_SHUTTING_DOWN)) { break; } } if (success && gracefulShutdownStartTime == 0) { if (logger.isErrorEnabled()) { logger.error("Buggy " + EventExecutor.class.getSimpleName() + " implementation; " + SingleThreadEventExecutor.class.getSimpleName() + ".confirmShutdown() must " + "be called before run() implementation terminates."); } } try { for (;;) { if (confirmShutdown()) { break; } } } finally { try { cleanup(); } finally { FastThreadLocal.removeAll(); thread = nonVolatileThread = null; synchronized (threadLock) { <START> STATE_UPDATER.set(SingleThreadEventExecutor.this, ST_TERMINATED); <END> threadLock.notifyAll(); } if (logger.isWarnEnabled() && !taskQueue.isEmpty()) { logger.warn("An event executor terminated with " + "non-empty task queue (" + taskQueue.size() + ')'); } terminationFuture.setSuccess(null); } } } } }); }</code><technical_language>@njhill this need in synchronized block ? I move out</technical_language>

Target:
private void doStartThread() { assert thread == null; executor.execute(new Runnable() { @Override public void run() { thread = nonVolatileThread = Thread.currentThread(); if (interrupted) { nonVolatileThread.interrupt(); } boolean success = false; updateLastExecutionTime(); try { SingleThreadEventExecutor.this.run(); success = true; } catch (Throwable t) { logger.warn("Unexpected exception from an event executor: ", t); } finally { for (;;) { int oldState = state; if (oldState >= ST_SHUTTING_DOWN || STATE_UPDATER.compareAndSet( SingleThreadEventExecutor.this, oldState, ST_SHUTTING_DOWN)) { break; } } if (success && gracefulShutdownStartTime == 0) { if (logger.isErrorEnabled()) { logger.error("Buggy " + EventExecutor.class.getSimpleName() + " implementation; " + SingleThreadEventExecutor.class.getSimpleName() + ".confirmShutdown() must " + "be called before run() implementation terminates."); } } try { for (;;) { if (confirmShutdown()) { break; } } } finally { try { cleanup(); } finally { FastThreadLocal.removeAll(); thread = nonVolatileThread = null; STATE_UPDATER.set(SingleThreadEventExecutor.this, ST_TERMINATED); synchronized (threadLock) { threadLock.notifyAll(); } if (logger.isWarnEnabled() && !taskQueue.isEmpty()) { logger.warn("An event executor terminated with " + "non-empty task queue (" + taskQueue.size() + ')'); } terminationFuture.setSuccess(null); } } } } }); }
Source:
<code>public FixedRequestAttributes toFixedRequestAttributes() { <START> if (isOverrideWorkspaceSettings()) { <END> FixedRequestAttributesBuilder builder = FixedRequestAttributesBuilder.fromEmptySettings(getWorkingDir()) .gradleUserHome(getGradleUserHome()) .gradleDistribution(getGradleDistribution()) .javaHome(getJavaHome()) .jvmArguments(getJvmArguments()) .arguments(getArguments()); if (isOverriddenOffline()) { builder.arguments(Arrays.asList("--offline")); } if (isOverriddenBuildScansEnabled()) { builder.jvmArguments(Arrays.asList("-Dscan")); } return builder.build(); } else { return FixedRequestAttributesBuilder.fromWorkspaceSettings(getWorkingDir()) .gradleUserHome(getGradleUserHome()) .gradleDistribution(getGradleDistribution()) .javaHome(getJavaHome()) .jvmArguments(getJvmArguments()) .arguments(getArguments()) .build(); } }</code><technical_language>This simplified adding explicit support for offline publishBuildScans FixedRequestAttributesBuilder. workspace settings overwrite offline setter overWriteWorkspaceSettings is true. I.e. builder = fromWorkspaceSettings() .gradleUserHome() ... if (isOverwrite) { builder.offline(isOffline()) builder.publishBuildScans(isPublishBuildScans()) } This in handy add project a layer in between</technical_language>

Target:
public FixedRequestAttributes toFixedRequestAttributes() { FixedRequestAttributesBuilder builder = FixedRequestAttributesBuilder.fromWorkspaceSettings(getWorkingDir()) .gradleUserHome(getGradleUserHome()) .gradleDistribution(getGradleDistribution()) .javaHome(getJavaHome()) .jvmArguments(getJvmArguments()) .arguments(getArguments()); if (isOverrideWorkspaceSettings()) { builder.buildScansEnabled(isBuildScansEnabled()); builder.offlineMode(isOffline()); } return builder.build(); }
Source:
<code>protected void eventHandle(@NonNull ITmfEvent event) { ITmfStateSystemBuilder ss = getStateSystemBuilder(); if (ss == null) { return; } long timestamp = event.getTimestamp().toNanos(); Long duration = event.getContent().getFieldValue(Long.class, IOpenTracingConstants.DURATION); if (duration == null) { return; } int quark; String name = String.valueOf(TmfTraceUtils.resolveAspectOfNameForEvent(event.getTrace(), "Name", event)); String spanId = event.getContent().getFieldValue(String.class, IOpenTracingConstants.SPAN_ID); String refId = event.getContent().getFieldValue(String.class, IOpenTracingConstants.REFERENCES + "/CHILD_OF"); if (refId == null) { quark = ss.getQuarkAbsoluteAndAdd(name + <START> "/" + <END> spanId); } else { Integer parentQuark = spanMap.get(refId); if (parentQuark == null) { return; } quark = ss.getQuarkRelativeAndAdd(parentQuark, name + "/" + spanId); } ss.modifyAttribute(timestamp, name, quark); ss.modifyAttribute(timestamp + duration, (Object) null, quark); spanMap.put(event.getContent().getFieldValue(String.class, IOpenTracingConstants.SPAN_ID), quark); }</code><technical_language>single quote '/' remove //$NON-NLS-1$</technical_language>

Target:
protected void eventHandle(@NonNull ITmfEvent event) { ITmfStateSystemBuilder ss = getStateSystemBuilder(); if (ss == null) { return; } long timestamp = event.getTimestamp().toNanos(); Long duration = event.getContent().getFieldValue(Long.class, IOpenTracingConstants.DURATION); if (duration == null) { return; } int quark; String name = String.valueOf(TmfTraceUtils.resolveAspectOfNameForEvent(event.getTrace(), "Name", event)); String spanId = event.getContent().getFieldValue(String.class, IOpenTracingConstants.SPAN_ID); String refId = event.getContent().getFieldValue(String.class, IOpenTracingConstants.REFERENCES + "/CHILD_OF"); if (refId == null) { quark = ss.getQuarkAbsoluteAndAdd(name + '/' + spanId); } else { Integer parentQuark = spanMap.get(refId); if (parentQuark == null) { return; } quark = ss.getQuarkRelativeAndAdd(parentQuark, name + '/' + spanId); } ss.modifyAttribute(timestamp, name, quark); ss.modifyAttribute(timestamp + duration, (Object) null, quark); spanMap.put(event.getContent().getFieldValue(String.class, IOpenTracingConstants.SPAN_ID), quark); }
Source:
<code>private LocationHandle createLocationHandle(HdfsContext context, ConnectorSession session, Path targetPath, boolean isExistingTable) { if (shouldUseTemporaryDirectory(session, context, targetPath)) { Path writePath = createTemporaryPath(session, context, hdfsEnvironment, targetPath); return new LocationHandle(targetPath, writePath, isExistingTable, STAGE_AND_MOVE_TO_TARGET_DIRECTORY); } else { <START> return new LocationHandle(targetPath, targetPath, isExistingTable, DIRECT_TO_TARGET_NEW_DIRECTORY); <END> } }</code><technical_language>write mode DIRECT_TO_TARGET_EXISTING_DIRECTORY change</technical_language>

Target:
private LocationHandle createLocationHandle(HdfsContext context, ConnectorSession session, Path targetPath, boolean isExistingTable) { if (shouldUseTemporaryDirectory(session, context, targetPath)) { Path writePath = createTemporaryPath(session, context, hdfsEnvironment, targetPath); return new LocationHandle(targetPath, writePath, isExistingTable, STAGE_AND_MOVE_TO_TARGET_DIRECTORY); } if (isExistingTable) { return new LocationHandle(targetPath, targetPath, true, DIRECT_TO_TARGET_EXISTING_DIRECTORY); } return new LocationHandle(targetPath, targetPath, false, DIRECT_TO_TARGET_NEW_DIRECTORY); }
Source:
<code><START> public String getTableName() <END> { return tableName; }</code><technical_language>methods private</technical_language>

Target:
private String getTableName() { return tableName; }
Source:
<code>protected void annex(final T oldStorage) { getStorage().annex(oldStorage); <START> logv("annexed " + oldStorage + " to " + this); <END> }</code><technical_language>Instead of importing method I write TrayLog.logv( more obvious method part of AbstractTrayPreference class</technical_language>

Target:
protected void annex(final T oldStorage) { getStorage().annex(oldStorage); TrayLog.v("annexed " + oldStorage + " to " + this); }
Source:
<code>public PongCommandHandler() { this.rand = new Random(); this.messages = new ArrayList<>(); this.messages.add("Come at me {u}! I will smash you at ping-pong"); this.messages.add("{u} can't play ping-pong"); this.messages.add("Who wants to challenge {u} to a game of ping-pong?"); this.messages.add("Taking all bets - Willie vs {u} at ping-pong. First to 11."); this.messages.add("{u} has uber ping-pong hacks. Like a bionic hand or something..."); <START> this.messages.add("Grab your bats is time to play ping-pong! Come at me {u}"); <END> }</code><technical_language>o</technical_language>

Target:
public PongCommandHandler() { this.rand = new Random(); this.messages = new ArrayList<>(); this.messages.add("Come at me {u}! I will smash you at ping-pong"); this.messages.add("{u} can't play ping-pong"); this.messages.add("Who wants to challenge {u} to a game of ping-pong?"); this.messages.add("Taking all bets - Willie vs {u} at ping-pong. First to 11."); this.messages.add("{u} has uber ping-pong hacks. Like a bionic hand or something..."); this.messages.add("Who wants to pong {u} with me?"); this.messages.add("Grab your bats is time to play ping-pong! Come at me {u}"); }
Source:
<code>public void setShouldScanBarCodes(boolean shouldScanBarCodes) { <START> if (shouldScanBarCodes && !mBarcodeDetector) { <END> setupBarcodeDetector(); } this.mShouldScanBarCodes = shouldScanBarCodes; setScanning(mShouldDetectFaces || mShouldDetectBarcodes || mShouldScanBarCodes || mShouldRecognizeText); }</code><technical_language>I this is Java, JavaScript. this compile? I "!mBarcodeDetector" part. converted boolean automatically, it</technical_language>

Target:
public void setShouldScanBarCodes(boolean shouldScanBarCodes) { if (shouldScanBarCodes && mBarcodeDetector == null) { setupBarcodeDetector(); } this.mShouldScanBarCodes = shouldScanBarCodes; setScanning(mShouldDetectFaces || mShouldDetectBarcodes || mShouldScanBarCodes || mShouldRecognizeText); }
Source:
<code><START> public JobEntity(final Injector jobInjector, <END> final String jobId, final int numServers, final ExecutorConfiguration serverExecutorConf, final TableConfiguration serverTableConf, final int numWorkers, final ExecutorConfiguration workerExecutorConf, final TableConfiguration workerTableConf, final String inputPath) { this.jobInjector = jobInjector; this.jobId = jobId; this.numServers = numServers; this.serverExecutorConf = serverExecutorConf; this.serverTableConf = serverTableConf; this.numWorkers = numWorkers; this.workerExecutorConf = workerExecutorConf; this.workerTableConf = workerTableConf; this.inputPath = inputPath; }</code><technical_language>Builder pattern is preferred structure easily changed</technical_language>

Target:
private JobEntity(final Injector jobInjector, final String jobId, final int numServers, final ExecutorConfiguration serverExecutorConf, final TableConfiguration serverTableConf, final int numWorkers, final ExecutorConfiguration workerExecutorConf, final TableConfiguration workerTableConf, final String inputPath) { this.jobInjector = jobInjector; this.jobId = jobId; this.numServers = numServers; this.serverExecutorConf = serverExecutorConf; this.serverTableConf = serverTableConf; this.numWorkers = numWorkers; this.workerExecutorConf = workerExecutorConf; this.workerTableConf = workerTableConf; this.inputPath = inputPath; }
Source:
<code>public void asyncGetCube(int cubeX, int cubeY, int cubeZ, Requirement req, Consumer<Cube> callback) { <START> Cube cube = cubeMap.get(cubeX, cubeY, cubeZ); <END> if (req == Requirement.GET_CACHED || (cube != null && req.compareTo(Requirement.GENERATE) <= 0)) { callback.accept(cube); return; } if (cube == null) { AsyncWorldIOExecutor.queueCubeLoad(worldServer, cubeIO, this, cubeX, cubeY, cubeZ, loaded -> { IColumn col = getLoadedColumn(cubeX, cubeZ); if (col != null) { onCubeLoaded(loaded, col); loaded = postCubeLoadAttempt(cubeX, cubeY, cubeZ, loaded, col, req); } callback.accept(loaded); }); } }</code><technical_language>change it</technical_language>

Target:
public void asyncGetCube(int cubeX, int cubeY, int cubeZ, Requirement req, Consumer<Cube> callback) { Cube cube = getLoadedCube(cubeX, cubeY, cubeZ); if (req == Requirement.GET_CACHED || (cube != null && req.compareTo(Requirement.GENERATE) <= 0)) { callback.accept(cube); return; } if (cube == null) { AsyncWorldIOExecutor.queueCubeLoad(worldServer, cubeIO, this, cubeX, cubeY, cubeZ, loaded -> { IColumn col = getLoadedColumn(cubeX, cubeZ); if (col != null) { onCubeLoaded(loaded, col); loaded = postCubeLoadAttempt(cubeX, cubeY, cubeZ, loaded, col, req); } callback.accept(loaded); }); } }
Source:
<code>public Event(CompletionTime completionTime, String eventSource) { if (null == eventSource || eventSource.isEmpty()) { throw new IllegalStateException("Cannot determine the event source"); } this.context = new HashMap<>(1); this.context.put("id", completionTime.getId()); this.tags = new HashMap<>(); this.tags.put("uri", completionTime.getUri()); this.tags.put("operation", completionTime.getOperation()); Set<Property> properties = completionTime.getProperties(); if (properties != null && properties.size() > 0) { <START> properties.forEach(p -> this.tags.put(p.getName(), p.getValue())); <END> } if (completionTime.getFault() != null && !completionTime.getFault().isEmpty()) { this.tags.put("fault", completionTime.getFault()); } this.category = eventSource; this.dataSource = "APM"; this.id = String.format("%s-%s", eventSource, completionTime.getId()); this.ctime = completionTime.getTimestamp(); this.text = Long.toString(completionTime.getDuration()); }</code><technical_language>a note, properties is a set property name unique - need consider this handled translating a map for alert tags. For this ok</technical_language>

Target:
public Event(CompletionTime completionTime, String eventSource) { if (null == eventSource || eventSource.isEmpty()) { throw new IllegalStateException("Cannot determine the event source"); } this.context = new HashMap<>(1); this.context.put("id", completionTime.getId()); this.tags = new HashMap<>(); this.tags.put("uri", completionTime.getUri()); this.tags.put("operation", completionTime.getOperation()); Set<Property> properties = completionTime.getProperties(); if (properties != null && properties.size() > 0) { properties.forEach(p -> this.tags.put(p.getName(), p.getValue())); } if (completionTime.getFault() != null && !completionTime.getFault().isEmpty()) { this.tags.put("fault", completionTime.getFault()); } this.category = eventSource; this.dataSource = "APM"; this.id = UUID.randomUUID().toString(); this.ctime = completionTime.getTimestamp(); this.text = Long.toString(completionTime.getDuration()); }
Source:
<code>protected void onProgressUpdate(IOException... values) { super.onProgressUpdate(values); if(values.length < 1) return; IOException result = values[0]; ArchivePasswordCache.getInstance().remove(compressedPath); GeneralDialogCreation.showPasswordDialog(AppConfig.getInstance().getMainActivityContext(), <START> (MainActivity)AppConfig.getInstance().getMainActivityContext(), <END> AppConfig.getInstance().getUtilsProvider().getAppTheme(), R.string.archive_password_prompt, R.string.authenticate_password, (dialog, which) -> { EditText editText = dialog.getView().findViewById(R.id.singleedittext_input); ArchivePasswordCache.getInstance().put(compressedPath, editText.getText().toString()); this.extractService.get().getDataPackages().clear(); this.paused = false; dialog.dismiss(); }, ((dialog, which) -> { dialog.dismiss(); toastOnParseError(result); cancel(true); progressHandler.setCancelled(true); stopSelf(); this.paused = false; })); }</code><technical_language>time get this file, context null</technical_language>

Target:
protected void onProgressUpdate(IOException... values) { super.onProgressUpdate(values); if(values.length < 1 || !passwordProtected) return; IOException result = values[0]; ArchivePasswordCache.getInstance().remove(compressedPath); GeneralDialogCreation.showPasswordDialog(AppConfig.getInstance().getMainActivityContext(), (MainActivity)AppConfig.getInstance().getMainActivityContext(), AppConfig.getInstance().getUtilsProvider().getAppTheme(), R.string.archive_password_prompt, R.string.authenticate_password, (dialog, which) -> { EditText editText = dialog.getView().findViewById(R.id.singleedittext_input); ArchivePasswordCache.getInstance().put(compressedPath, editText.getText().toString()); this.extractService.get().getDataPackages().clear(); this.paused = false; dialog.dismiss(); }, ((dialog, which) -> { dialog.dismiss(); toastOnParseError(result); cancel(true); progressHandler.setCancelled(true); stopSelf(); this.paused = false; })); }
Source:
<code>public static ByteBuffer marshall(StreamingMarshaller marshaller, Object obj) throws CacheLoaderException, InterruptedException { try { return marshaller.objectToBuffer(obj); } catch (IOException e) { <START> log.errorMarshallingBucket(e, obj); <END> throw new CacheLoaderException("I/O failure while marshalling object: " + obj, e); } }</code><technical_language>log message updated</technical_language>

Target:
public static ByteBuffer marshall(StreamingMarshaller marshaller, Object obj) throws CacheLoaderException, InterruptedException { try { return marshaller.objectToBuffer(obj); } catch (IOException e) { log.errorMarshallingObject(e, obj); throw new CacheLoaderException("I/O failure while marshalling object: " + obj, e); } }
Source:
<code>public void test(){ doInJPA( this::entityManagerFactory, entityManager -> { try { entityManager.createNativeQuery( "select 1 " + "from pg_sleep(2) " ) .getResultList(); fail("Should have thrown lock timeout exception!"); } catch (Exception expected) { expected.printStackTrace(); assertTrue( ExceptionUtil.rootCause(expected) <START> .getMessage().contains("csanceling statement due to user request") <END> ); } } ); }</code><technical_language>message is expected misspelled csanceling, right</technical_language>

Target:
public void test(){ doInJPA( this::entityManagerFactory, entityManager -> { try { entityManager.createNativeQuery( "select 1 " + "from pg_sleep(2) " ) .getResultList(); fail("Should have thrown lock timeout exception!"); } catch (Exception expected) { expected.printStackTrace(); assertTrue( ExceptionUtil.rootCause(expected) .getMessage().contains("canceling statement due to user request") ); } } ); }