auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void setVariableTest() { ParameterNameDiscoverer paramNameDiscoverer = mock(ParameterNameDiscoverer.class); when(paramNameDiscoverer.getParameterNames(method)).thenReturn( new String[] {null}); <START> NotNullVariableMethodSecurityEvaluationContext NNVMSEC= new NotNullVariableMethodSecurityEvaluationContext(mock(Authentication.class), mock(MethodInvocation.class), paramNameDiscoverer); <END> try { NNVMSEC.lookupVariable("TESTVALUE"); } catch (IllegalArgumentException unexpected) { fail("name should not be null"); } }</code><technical_language>caps is a final member variable. rename this Context</technical_language>

Target:
public void setVariableTest() { ParameterNameDiscoverer paramNameDiscoverer = mock(ParameterNameDiscoverer.class); when(paramNameDiscoverer.getParameterNames(method)).thenReturn( new String[] {null}); NotNullVariableMethodSecurityEvaluationContext context= new NotNullVariableMethodSecurityEvaluationContext( mock(Authentication.class), mock(MethodInvocation.class), paramNameDiscoverer); context.lookupVariable("TESTVALUE"); fail("name should not be null"); }
Source:
<code>protected void recomputeClassFilters() { <START> Set<String> classNames = new HashSet<>(); <END> for (ClassFilterDescriptor desc : classFilterDescriptors) { if (desc.deny.contains("*")) { classNames.clear(); classNames.addAll(desc.allow); } else { classNames.addAll(desc.allow); classNames.removeAll(desc.deny); } } service.allowedClassNames.clear(); service.allowedClassNames.addAll(classNames); }</code><technical_language>clearer call this variable allowedClassNames, I a long if/else logic classNames.addAll(desc.allow) is in if else. I understand building a list of allowed class names</technical_language>

Target:
protected void recomputeClassFilters() { Set<String> allowedClassNames = new HashSet<>(); for (ClassFilterDescriptor desc : classFilterDescriptors) { if (desc.deny.contains("*")) { allowedClassNames.clear(); allowedClassNames.addAll(desc.allow); } else { allowedClassNames.addAll(desc.allow); allowedClassNames.removeAll(desc.deny); } } service.allowedClassNames.clear(); service.allowedClassNames.addAll(allowedClassNames); }
Source:
<code>public <C> void addListener(Object listener, CacheEventFilter<? super K, ? super V> filter, <START> CacheEventConverter<? super K, ? super V, C> converter, ClassLoader classLoader) { <END> addListenerInternal(listener, null, null, filter, converter, classLoader); }</code><technical_language>need do this</technical_language>

Target:
public <C> void addListener(Object listener, CacheEventFilter<? super K, ? super V> filter, CacheEventConverter<? super K, ? super V, C> converter, ClassLoader classLoader) { addListenerInternal(listener, null, null, null, null, filter, converter, classLoader); }
Source:
<code>private void testEnum() throws SQLException { trace("Test ENUM"); stat.execute("CREATE TABLE TEST(ID INT PRIMARY KEY, \"VALUE\" ENUM('A', 'B', 'C', 'D', 'E'))"); PreparedStatement prep = conn.prepareStatement("INSERT INTO TEST VALUES(?, ?)"); prep.setInt(1, 1); prep.setString(2, "A"); prep.executeUpdate(); prep.setInt(1, 2); prep.setObject(2, "B"); prep.executeUpdate(); prep.setInt(1, 3); prep.setInt(2, 2); prep.executeUpdate(); prep.setInt(1, 4); prep.setObject(2, "D", Types.VARCHAR); prep.executeUpdate(); prep.setInt(1, 5); <START> prep.setObject(2, 4, Types.INTEGER); <END> prep.executeUpdate(); ResultSet rs = stat.executeQuery("SELECT * FROM TEST ORDER BY ID"); testEnumResult(rs, 1, "A", 0); testEnumResult(rs, 2, "B", 1); testEnumResult(rs, 3, "C", 2); testEnumResult(rs, 4, "D", 3); testEnumResult(rs, 5, "E", 4); assertFalse(rs.next()); stat.execute("DROP TABLE TEST"); }</code><technical_language>if setObject(foo, enum geometry, Types.OTHER) longer works, is API change, break some client code</technical_language>

Target:
private void testEnum() throws SQLException { trace("Test ENUM"); stat.execute("CREATE TABLE TEST(ID INT PRIMARY KEY, \"VALUE\" ENUM('A', 'B', 'C', 'D', 'E', 'F', 'G'))"); PreparedStatement prep = conn.prepareStatement("INSERT INTO TEST VALUES(?, ?)"); prep.setInt(1, 1); prep.setString(2, "A"); prep.executeUpdate(); prep.setInt(1, 2); prep.setObject(2, "B"); prep.executeUpdate(); prep.setInt(1, 3); prep.setInt(2, 2); prep.executeUpdate(); prep.setInt(1, 4); prep.setObject(2, "D", Types.VARCHAR); prep.executeUpdate(); prep.setInt(1, 5); prep.setObject(2, "E", Types.OTHER); prep.executeUpdate(); prep.setInt(1, 6); prep.setObject(2, 5, Types.OTHER); prep.executeUpdate(); prep.setInt(1, 7); prep.setObject(2, 6, Types.INTEGER); prep.executeUpdate(); ResultSet rs = stat.executeQuery("SELECT * FROM TEST ORDER BY ID"); testEnumResult(rs, 1, "A", 0); testEnumResult(rs, 2, "B", 1); testEnumResult(rs, 3, "C", 2); testEnumResult(rs, 4, "D", 3); testEnumResult(rs, 5, "E", 4); testEnumResult(rs, 6, "F", 5); testEnumResult(rs, 7, "G", 6); assertFalse(rs.next()); stat.execute("DROP TABLE TEST"); }
Source:
<code>public synchronized void filterByKeyedCalloutData(OrderedHashtable<String, String> keyToExtraDataMapping) { externalData = keyToExtraDataMapping; if (entitySearcher != null) { entitySearcher.cancelSearch(); } <START> LinkedHashSet<String> topMatchingCaseIds = new LinkedHashSet<>(); <END> for (Enumeration en = externalData.keys(); en.hasMoreElements(); ) { String key = (String)en.nextElement(); topMatchingCaseIds.add(key); } isFilteringByCalloutResult = true; entitySearcher = new EntityKeyFilterer(this, mNodeFactory, full, context, topMatchingCaseIds); entitySearcher.start(); }</code><technical_language>This variable name more specific fingerprint scanning case rest of code. I necessarily object helped understand on, aiming generic other cases, a odd for this variable inconsistent that</technical_language>

Target:
public synchronized void filterByKeyedCalloutData(OrderedHashtable<String, String> keyToExtraDataMapping) { calloutResponseData = keyToExtraDataMapping; if (entityFilterer != null) { entityFilterer.cancelSearch(); } LinkedHashSet<String> keysToFilterBy = new LinkedHashSet<>(); for (Enumeration en = calloutResponseData.keys(); en.hasMoreElements(); ) { String key = (String)en.nextElement(); keysToFilterBy.add(key); } isFilteringByCalloutResult = true; entityFilterer = new EntityKeyFilterer(this, mNodeFactory, full, context, keysToFilterBy); entityFilterer.start(); }
Source:
<code>private static boolean hasProperEquals(MethodTree methodTree) { <START> Symbol.MethodSymbol symbol = methodTree.symbol(); <END> if (symbol == null) { return true; } Symbol.TypeSymbol enclosingClass = symbol.enclosingClass(); if (enclosingClass == null) { return true; } return enclosingClass.memberSymbols().stream().anyMatch(MethodNamedEqualsCheck::isEqualsMethod); }</code><technical_language>This happen if semantic is present (symbol method is annotated returning null). test if semantic is present raise issue if is case</technical_language>

Target:
private static boolean hasProperEquals(MethodTree methodTree) { Symbol.MethodSymbol symbol = methodTree.symbol(); Symbol.TypeSymbol enclosingClass = symbol.enclosingClass(); return enclosingClass != null && enclosingClass.memberSymbols().stream().anyMatch(MethodNamedEqualsCheck::isEqualsMethod); }
Source:
<code><START> public boolean isValueTypeIndexable(StringBuffer msg) { <END> msg.append("conjuction expression: '" + getExpressionType().symbol() + "'"); return false; }</code><technical_language>I guess logical expressions produce a boolean value? Is check for a boolean output type in AbstractExpression</technical_language>

Target:
public boolean isValueTypeIndexable(StringBuffer msg) { msg.append("logical expression: '" + getExpressionType().symbol() + "'"); return false; }
Source:
<code>public HttpResponse makeCaseFetchRequest(String baseUri, boolean includeStateFlags) throws ClientProtocolException, IOException { if (LocalDataPullResponseFactory.INSTANCE.isAsyncRestore) { <START> return makeAsyncCaseFetchRequest(); <END> } else { int responseCode; if (caseFetchResponseCodeStack.size() > 0) { responseCode = caseFetchResponseCodeStack.remove(0); } else { responseCode = 200; } return HttpResponseMock.buildHttpResponseMock(responseCode); } }</code><technical_language>makeAsyncCaseFetchRequest is called is line, inline body here</technical_language>

Target:
public HttpResponse makeCaseFetchRequest(String baseUri, boolean includeStateFlags) throws ClientProtocolException, IOException { int responseCode; if (caseFetchResponseCodeStack.size() > 0) { responseCode = caseFetchResponseCodeStack.remove(0); } else { responseCode = 200; } if (responseCode == 202) { return HttpResponseMock.buildHttpResponseMockForAsyncRestore(); } else { return HttpResponseMock.buildHttpResponseMock(responseCode); } }
Source:
<code>public List<HiveObjectPrivilege> listDBGrantsAll(String catName, String dbName) { List<HiveObjectPrivilege> results = Collections.emptyList(); try { openTransaction(); results = listDBGrantsAll(catName, dbName, null); commitTransaction(); } catch (Exception e) { throw new RuntimeException(e); } finally { <START> rollbackAndCleanup(true, null); <END> } return results; }</code><technical_language>for delay, concern is set success true rollbackAndCleanup transaction unable rollback</technical_language>

Target:
public List<HiveObjectPrivilege> listDBGrantsAll(String catName, String dbName) { List<HiveObjectPrivilege> results = Collections.emptyList(); boolean success = false; try { openTransaction(); results = listDBGrantsAll(catName, dbName, null); success = commitTransaction(); } catch (Exception e) { throw new RuntimeException(e); } finally { rollbackAndCleanup(success, null); } return results; }
Source:
<code>public void channelInactive(ChannelHandlerContext ctx) throws Exception { String remote = ctx.channel().attr(NettyTransport.SENDER).get(); LOG.debug("Disconnected from server {}", remote); <START> Sender senderInMap = senders.get(remote); <END> receiver.onDisconnected(remote); ctx.close(); }</code><technical_language>operation SenderInMap, is this line redundant</technical_language>

Target:
public void channelInactive(ChannelHandlerContext ctx) throws Exception { String remote = ctx.channel().attr(NettyTransport.SENDER).get(); LOG.debug("Disconnected from server {}", remote); receiver.onDisconnected(remote); ctx.close(); }
Source:
<code>public static <T> Spy<T> ofClass(Class<T> spyClass) { <START> return new Spy<T>(spyClass); <END> }</code><technical_language>Please remove excessive space character</technical_language>

Target:
public static <T> Spy<T> ofClass(Class<T> spyClass) { return new Spy<>(spyClass); }
Source:
<code>public static void sendPullRequestBuildStatusEvent(final CommitParameterAction commitParameter, final GitStatusState buildState, final String buildDescription, final String targetUrl, final String jobFullPath) { try { if (commitParameter != null) { if (commitParameter instanceof PullRequestParameterAction) { final PullRequestParameterAction prpa = (PullRequestParameterAction) commitParameter; final PullRequestMergeCommitCreatedEventArgs pullRequestMergeCommitCreatedEventArgs = prpa.getPullRequestMergeCommitCreatedEventArgs(); sendPullRequestBuildStatusEvent(pullRequestMergeCommitCreatedEventArgs, buildState, buildDescription, targetUrl, jobFullPath); } } } catch (final Exception e) { <START> e.printStackTrace(); <END> } return; }</code><technical_language>errors logger (<LINK_0> easy find filter</technical_language>

Target:
public static void sendPullRequestBuildStatusEvent(final CommitParameterAction commitParameter, final GitStatusState buildState, final String buildDescription, final String targetUrl, final String jobFullPath) { try { if (commitParameter != null) { if (commitParameter instanceof PullRequestParameterAction) { final PullRequestParameterAction prpa = (PullRequestParameterAction) commitParameter; final PullRequestMergeCommitCreatedEventArgs pullRequestMergeCommitCreatedEventArgs = prpa.getPullRequestMergeCommitCreatedEventArgs(); sendPullRequestBuildStatusEvent(pullRequestMergeCommitCreatedEventArgs, buildState, buildDescription, targetUrl, jobFullPath); } } } catch (final Exception e) { log.warning("ERROR: sendPullRequestBuildStatusEvent fails due to exception: " + e.getMessage()); } return; }
Source:
<code>public void writeTo(ObjectOutput output) throws IOException { output.writeObject(origin); <START> output.writeObject(segments); <END> }</code><technical_language>IntSetsExternalization.writeTo() IntSetsExternalization.readFrom()</technical_language>

Target:
public void writeTo(ObjectOutput output) throws IOException { IntSetsExternalization.writeTo(output, segments); }
Source:
<code>private void handleSearchAccount() { <START> unreadAccount.setSummary(selectedAccountUuid); <END> unreadFolderEnabled.setEnabled(false); unreadFolder.setEnabled(false); selectedFolderName = null; }</code><technical_language>This displays internal account identifier (unified_inbox all_messages) instead of display name</technical_language>

Target:
private void handleSearchAccount() { if (SearchAccount.UNIFIED_INBOX.equals(selectedAccountUuid)) { unreadAccount.setSummary(R.string.unread_widget_unified_inbox_account_summary); } else if (SearchAccount.ALL_MESSAGES.equals(selectedAccountUuid)) { unreadAccount.setSummary(R.string.unread_widget_all_messages_account_summary); } unreadFolderEnabled.setEnabled(false); unreadFolderEnabled.setChecked(false); unreadFolder.setEnabled(false); selectedFolderName = null; }
Source:
<code>public void testCheckSubProcessTaskWhenCallActivity (){ securityUtil.logInAs("salaboy"); ProcessInstance processInstance = processRuntime.start( ProcessPayloadBuilder .start() .withProcessDefinitionKey(PARENT_PROCESS_CALL_ACTIVITY) .build()); assertThat(processInstance).isNotNull(); ProcessInstance subProcessInstance = processRuntime.processInstances( Pageable.of(0, 50), ProcessPayloadBuilder .processInstances() <START> .withProcessDefinitionKey(SUB_PROCESS_CALL_ACTIVITY) <END> .build()) .getContent() .get(0); assertThat(subProcessInstance).isNotNull(); assertThat(subProcessInstance.getParentId()).isEqualTo(processInstance.getId()); assertThat(subProcessInstance.getProcessDefinitionKey()).isEqualTo(SUB_PROCESS_CALL_ACTIVITY); Task task = taskRuntime.tasks( Pageable.of(0, 50), TaskPayloadBuilder .tasks() .withProcessInstanceId(subProcessInstance.getId()) .build()) .getContent() .get(0); assertThat(task).isNotNull(); assertThat("my-task-call-activity").isEqualTo(task.getName()); }</code><technical_language>I .withParentProcessInstanceId(processInstance.getId()) instead of .withProcessDefinitionKey(SUB_PROCESS_CALL_ACTIVITY) avoid failures in case another test starts instance of this process definition</technical_language>

Target:
public void testCheckSubProcessTaskWhenCallActivity (){ securityUtil.logInAs("salaboy"); ProcessInstance processInstance = processRuntime.start( ProcessPayloadBuilder .start() .withProcessDefinitionKey(PARENT_PROCESS_CALL_ACTIVITY) .build()); assertThat(processInstance).isNotNull(); List<ProcessInstance> subProcessInstanceList = processRuntime.processInstances( Pageable.of(0, 50), ProcessPayloadBuilder .processInstances() .withParentProcessInstanceId(processInstance.getId()) .build()) .getContent(); assertThat(subProcessInstanceList).isNotEmpty(); ProcessInstance subProcessInstance = subProcessInstanceList.get(0); assertThat(subProcessInstance).isNotNull(); assertThat(subProcessInstance.getParentId()).isEqualTo(processInstance.getId()); assertThat(subProcessInstance.getProcessDefinitionKey()).isEqualTo(SUB_PROCESS_CALL_ACTIVITY); List <Task> taskList = taskRuntime.tasks( Pageable.of(0, 50), TaskPayloadBuilder .tasks() .withProcessInstanceId(subProcessInstance.getId()) .build()) .getContent(); assertThat(taskList).isNotEmpty(); Task task = taskList.get(0); assertThat(task).isNotNull(); assertThat("my-task-call-activity").isEqualTo(task.getName()); }
Source:
<code>public SshCredentialDialog addCredential() { if (getElement(by.xpath(" String providerXpathExpr = " + "/div[@class='bd']/ul[@class='first-of-type']/li[contains(@class, 'yuimenuitem')]" + "/span[contains(@class,'yuimenuitemlabel') and contains(text(), 'Jenkins')]"; <START> for (WebElement addButton : self().findElements(by.xpath(" END> if (addButton.isDisplayed()) { addButton.click(); break; } } for (WebElement menuItem : self().findElements(by.xpath(providerXpathExpr))) { if (menuItem.isDisplayed()) { menuItem.click(); break; } } } else { self().findElement(by.button("Add")).click(); } return new SshCredentialDialog(getPage(), "/credentials"); }</code><technical_language>find(by.button("//button[@class='credentials-add-menu']")).click();. is a similar problem a couple of lines below</technical_language>

Target:
public SshCredentialDialog addCredential() { find(by.button("Add")).click(); if (getElement(by.xpath(" String providerXpathExpr = " + "/div[@class='bd']/ul[@class='first-of-type']/li[contains(@class, 'yuimenuitem')]" + "/span[contains(@class,'yuimenuitemlabel') and contains(text(), 'Jenkins')]"; find(by.xpath(providerXpathExpr)).click(); } return new SshCredentialDialog(getPage(), "/credentials"); }
Source:
<code>public SlackUserProperty() { <START> this.userId = null; <END> this.disableNotifications = false; }</code><technical_language>do need content in this constructor all</technical_language>

Target:
public SlackUserProperty() { }
Source:
<code>public void testAbfsOutputStreamBytesFailed() { describe("Testing Bytes Failed during uploading in AbfsOutputSteam"); AbfsOutputStreamStatisticsImpl abfsOutputStreamStatistics = new AbfsOutputStreamStatisticsImpl(); <START> assertValues("number fo bytes failed to upload", 0, <END> abfsOutputStreamStatistics.getBytesUploadFailed()); int randomBytesFailed = new Random().nextInt(LOW_RANGE_FOR_RANDOM_VALUE); abfsOutputStreamStatistics.uploadFailed(randomBytesFailed); assertValues("number fo bytes failed to upload", randomBytesFailed, abfsOutputStreamStatistics.getBytesUploadFailed()); abfsOutputStreamStatistics = new AbfsOutputStreamStatisticsImpl(); randomBytesFailed = new Random().nextInt(HIGH_RANGE_FOR_RANDOM_VALUE); abfsOutputStreamStatistics.uploadFailed(randomBytesFailed); assertValues("number fo bytes failed to upload", randomBytesFailed, abfsOutputStreamStatistics.getBytesUploadFailed()); }</code><technical_language>typo</technical_language>

Target:
public void testAbfsOutputStreamBytesFailed() { describe("Testing number of bytes failed during upload in AbfsOutputSteam"); AbfsOutputStreamStatisticsImpl abfsOutputStreamStatistics = new AbfsOutputStreamStatisticsImpl(); assertEquals("Mismatch in number of bytes failed to upload", 0, abfsOutputStreamStatistics.getBytesUploadFailed()); int randomBytesFailed = new Random().nextInt(LOW_RANGE_FOR_RANDOM_VALUE); abfsOutputStreamStatistics.uploadFailed(randomBytesFailed); assertEquals("Mismatch in number of bytes failed to upload", randomBytesFailed, abfsOutputStreamStatistics.getBytesUploadFailed()); abfsOutputStreamStatistics = new AbfsOutputStreamStatisticsImpl(); int expectedBytesFailed = 0; for (int i = 0; i < OPERATIONS; i++) { randomBytesFailed = new Random().nextInt(HIGH_RANGE_FOR_RANDOM_VALUE); abfsOutputStreamStatistics.uploadFailed(randomBytesFailed); expectedBytesFailed += randomBytesFailed; } assertEquals("Mismatch in number of bytes failed to upload", expectedBytesFailed, abfsOutputStreamStatistics.getBytesUploadFailed()); }
Source:
<code>public Command getCommand( @NonNull String commandID) throws ThingIFException { if (this.target == null) { throw new IllegalStateException("Can not perform this action before onboarding"); } if (TextUtils.isEmpty(commandID)) { throw new IllegalArgumentException("commandID is null or empty"); } String path = MessageFormat.format("/thing-if/apps/{0}/targets/{1}/commands/{2}", this.app.getAppID(), this.target.getTypedID().toString(), commandID); String url = Path.combine(this.app.getBaseUrl(), path); Map<String, String> headers = this.newHeader(); IoTRestRequest request = new IoTRestRequest(url, IoTRestRequest.Method.GET, headers); JSONObject responseBody = this.restClient.sendRequest(request); try { <START> return gson.fromJson(responseBody.toString(), Command.class); <END> }catch (JsonParseException ex) { if (ex.getCause() instanceof ThingIFException) { throw (ThingIFException)ex.getCause(); }else{ throw ex; } } }</code><technical_language>add this gson field</technical_language>

Target:
public Command getCommand( @NonNull String commandID) throws ThingIFException { if (this.target == null) { throw new IllegalStateException("Can not perform this action before onboarding"); } if (TextUtils.isEmpty(commandID)) { throw new IllegalArgumentException("commandID is null or empty"); } String path = MessageFormat.format("/thing-if/apps/{0}/targets/{1}/commands/{2}", this.app.getAppID(), this.target.getTypedID().toString(), commandID); String url = Path.combine(this.app.getBaseUrl(), path); Map<String, String> headers = this.newHeader(); IoTRestRequest request = new IoTRestRequest(url, IoTRestRequest.Method.GET, headers); JSONObject responseBody = this.restClient.sendRequest(request); try { return this.gson.fromJson(responseBody.toString(), Command.class); }catch (JsonParseException ex) { if (ex.getCause() instanceof ThingIFException) { throw (ThingIFException)ex.getCause(); }else{ throw ex; } } }
Source:
<code>private void incrementCurrentUsageInBytesIfRequired(long delta) { if(byteSized) { <START> while(true) { <END> long expect = currentUsageinBytes.get(); long update = expect + delta; if(currentUsageinBytes.compareAndSet(expect, update)) { break; } } } }</code><technical_language>loop? AtomicLong.addAndGet</technical_language>

Target:
private void incrementCurrentUsageInBytesIfRequired(long delta) { if(byteSized) { currentUsageinBytes.addAndGet(delta); } }
Source:
<code>Offer getOffer(String id) { List<Offer> offers = offerBookService.getOffers().stream() .filter(o -> o.getId().equals(id)) <START> .collect(Collectors.toList()); <END> if (offers.isEmpty()) throw new IllegalArgumentException(format("offer with id '%s' not found", id)); else return offers.get(0); }</code><technical_language>wrong, a bit odd list for element. .findAny() returns Optional<> do offer.isPresent() return offer.get() making clear expect find offer</technical_language>

Target:
Offer getOffer(String id) { return offerBookService.getOffers().stream() .filter(o -> o.getId().equals(id)) .findAny().orElseThrow(() -> new IllegalStateException(format("offer with id '%s' not found", id))); }
Source:
<code>public RabbitManagementTemplate(String baseUri, String user, String password) { CredentialsProvider credsProvider = new BasicCredentialsProvider(); credsProvider.setCredentials( new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT), new UsernamePasswordCredentials(user, password)); HttpClient httpClient = HttpClients.custom().setDefaultCredentialsProvider(credsProvider).build(); AuthCache authCache = new BasicAuthCache(); BasicScheme basicAuth = new BasicScheme(); URI uri; try { uri = new URI(baseUri); } catch (URISyntaxException e) { throw new AmqpException("Invalid URI", e); } authCache.put(new HttpHost(uri.getHost(), uri.getPort(), uri.getScheme()), basicAuth); final HttpClientContext localContext = HttpClientContext.create(); localContext.setAuthCache(authCache); RestTemplate restTemplate = new RestTemplate(new HttpComponentsClientHttpRequestFactory(httpClient) { @Override protected HttpContext createHttpContext(HttpMethod httpMethod, URI uri) { return localContext; } }); <START> this.restTemplate = restTemplate; <END> this.baseUri = baseUri; }</code><technical_language>I optimize a bit: java this.restTemplate.setMessageConverters(Collections.<HttpMessageConverter<?>>singletonList( new MappingJackson2HttpMessageConverter())); get deal application/json content-type</technical_language>

Target:
public RabbitManagementTemplate(String baseUri, String user, String password) { CredentialsProvider credsProvider = new BasicCredentialsProvider(); credsProvider.setCredentials( new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT), new UsernamePasswordCredentials(user, password)); HttpClient httpClient = HttpClients.custom().setDefaultCredentialsProvider(credsProvider).build(); AuthCache authCache = new BasicAuthCache(); BasicScheme basicAuth = new BasicScheme(); URI uri; try { uri = new URI(baseUri); } catch (URISyntaxException e) { throw new AmqpException("Invalid URI", e); } authCache.put(new HttpHost(uri.getHost(), uri.getPort(), uri.getScheme()), basicAuth); final HttpClientContext localContext = HttpClientContext.create(); localContext.setAuthCache(authCache); RestTemplate restTemplate = new RestTemplate(new HttpComponentsClientHttpRequestFactory(httpClient) { @Override protected HttpContext createHttpContext(HttpMethod httpMethod, URI uri) { return localContext; } }); restTemplate.setMessageConverters(Collections.<HttpMessageConverter<?>>singletonList( new MappingJackson2HttpMessageConverter())); this.restTemplate = restTemplate; this.baseUri = baseUri; }
Source:
<code>private boolean registerTimerResource(final TimerImpl timer) { synchronized (this.timers) { if (this.timers.containsKey(timer.getId())) { this.timers.put(timer.getId(), timer); return false; } this.timers.put(timer.getId(), timer); <START> this.resource.timerCreated(timer.getId()); <END> return true; } }</code><technical_language>timers is declared a synchronized map. want switch a regular HashMap guard access avoid double synchronize it</technical_language>

Target:
private boolean registerTimerResource(final TimerImpl timer) { synchronized (this.timers) { if (this.timers.containsKey(timer.getId())) { return false; } this.timers.put(timer.getId(), timer); this.resource.timerCreated(timer.getId()); return true; } }
Source:
<code>public void evaluateLiteralExpression() { assertEquals(1, evaluator.evaluateLiteralExpression(String.class.getCanonicalName(), Collections.emptyList(), "# 1")); assertEquals("Value", evaluator.evaluateLiteralExpression(String.class.getCanonicalName(), Collections.emptyList(), "# \"Value\"")); assertThatThrownBy(() -> evaluator.evaluateLiteralExpression(String.class.getCanonicalName(), Collections.emptyList(), "1+")) .isInstanceOf(RuntimeException.class); assertThatThrownBy(() -> evaluator.evaluateLiteralExpression(String.class.getCanonicalName(), Collections.emptyList(), new Object())) .isInstanceOf(IllegalArgumentException.class) .hasMessageStartingWith("Raw value should be a String"); <START> assertThatThrownBy(() -> evaluator.evaluateLiteralExpression(String.class.getCanonicalName(), Collections.emptyList(), new Object())) <END> .isInstanceOf(IllegalArgumentException.class) .hasMessageStartingWith("Raw value should be a String"); }</code><technical_language>duplicate</technical_language>

Target:
public void evaluateLiteralExpression() { assertEquals(1, evaluator.evaluateLiteralExpression(Integer.class.getCanonicalName(), Collections.emptyList(), MVEL_ESCAPE_SYMBOL + " 1")); assertEquals("Value", evaluator.evaluateLiteralExpression(String.class.getCanonicalName(), Collections.emptyList(), MVEL_ESCAPE_SYMBOL + " \"Value\"")); assertThatThrownBy(() -> evaluator.evaluateLiteralExpression(String.class.getCanonicalName(), Collections.emptyList(), "1+")) .isInstanceOf(RuntimeException.class); assertThatThrownBy(() -> evaluator.evaluateLiteralExpression(String.class.getCanonicalName(), Collections.emptyList(), new Object())) .isInstanceOf(IllegalArgumentException.class) .hasMessageStartingWith("Raw expression should be a String"); assertThatThrownBy(() -> evaluator.evaluateLiteralExpression(String.class.getCanonicalName(), Collections.emptyList(), MVEL_ESCAPE_SYMBOL + " 1")) .isInstanceOf(IllegalArgumentException.class) .hasMessageStartingWith("Cannot assign a 'java.lang.Integer"); }
Source:
<code>public void init(){ <START> isReqContextActive.set(bm.getContext(RequestScoped.class).isActive()); <END> }</code><technical_language>I catch ContextNotActiveException set false. reason is exception lead CreationException complicate test debugging</technical_language>

Target:
public void init() { try { isRequestContextActiveDuringPostConstruct.set(bm.getContext(RequestScoped.class).isActive()); } catch (ContextNotActiveException e) { isRequestContextActiveDuringPostConstruct.set(false); } }
Source:
<code>static ExecutionJobVertex mockExecutionJobVertex( JobVertexID jobVertexID, List<OperatorID> jobVertexIDs, int parallelism, int maxParallelism) throws Exception { final ExecutionJobVertex executionJobVertex = mock(ExecutionJobVertex.class); ExecutionVertex[] executionVertices = new ExecutionVertex[parallelism]; for (int i = 0; i < parallelism; i++) { executionVertices[i] = mockExecutionVertex( new ExecutionAttemptID(), jobVertexID, jobVertexIDs, parallelism, maxParallelism, ExecutionState.RUNNING); when(executionVertices[i].getParallelSubtaskIndex()).thenReturn(i); } when(executionJobVertex.getJobVertexId()).thenReturn(jobVertexID); when(executionJobVertex.getTaskVertices()).thenReturn(executionVertices); when(executionJobVertex.getParallelism()).thenReturn(parallelism); when(executionJobVertex.getMaxParallelism()).thenReturn(maxParallelism); when(executionJobVertex.isMaxParallelismConfigured()).thenReturn(true); List<OperatorIdPair> operatorIdPairs = new ArrayList<>(); for (OperatorID operatorID : jobVertexIDs) { <START> operatorIdPairs.add(new OperatorIdPair(operatorID, null)); <END> } when(executionJobVertex.getOperatorIdPairList()).thenReturn(new OperatorIdPairList(operatorIdPairs)); return executionJobVertex; }</code><technical_language>do a factory method create OperatorIdPair generated ID</technical_language>

Target:
static ExecutionJobVertex mockExecutionJobVertex( JobVertexID jobVertexID, List<OperatorID> jobVertexIDs, int parallelism, int maxParallelism) throws Exception { final ExecutionJobVertex executionJobVertex = mock(ExecutionJobVertex.class); ExecutionVertex[] executionVertices = new ExecutionVertex[parallelism]; for (int i = 0; i < parallelism; i++) { executionVertices[i] = mockExecutionVertex( new ExecutionAttemptID(), jobVertexID, jobVertexIDs, parallelism, maxParallelism, ExecutionState.RUNNING); when(executionVertices[i].getParallelSubtaskIndex()).thenReturn(i); } when(executionJobVertex.getJobVertexId()).thenReturn(jobVertexID); when(executionJobVertex.getTaskVertices()).thenReturn(executionVertices); when(executionJobVertex.getParallelism()).thenReturn(parallelism); when(executionJobVertex.getMaxParallelism()).thenReturn(maxParallelism); when(executionJobVertex.isMaxParallelismConfigured()).thenReturn(true); List<OperatorIDPair> operatorIDPairs = new ArrayList<>(); for (OperatorID operatorID : jobVertexIDs) { operatorIDPairs.add(OperatorIDPair.generatedIDOnly(operatorID)); } when(executionJobVertex.getOperatorIDs()).thenReturn(operatorIDPairs); return executionJobVertex; }
Source:
<code>public int getMarks(TreeWalk walk) throws MissingObjectException, IncorrectObjectTypeException, IOException { int marks = 0; for (int index = 0; index < filters.length; index++) { TreeFilter filter = filters[index]; if (filter != null) { try { boolean marked = filter.include(walk); if (marked) <START> marks |= (int) (1L << index); <END> } catch (StopWalkException e) { filters[index] = null; } } } return marks; }</code><technical_language>Instead of casting omit "L"</technical_language>

Target:
public int getMarks(TreeWalk walk) throws MissingObjectException, IncorrectObjectTypeException, IOException { int marks = 0; for (int index = 0; index < filters.length; index++) { TreeFilter filter = filters[index]; if (filter != null) { try { boolean marked = filter.include(walk); if (marked) marks |= (1 << index); } catch (StopWalkException e) { filters[index] = null; } } } return marks; }
Source:
<code>private void verifyAndOrRebuildIndex(Map<byte[], List<Mutation>> indexKeyToMutationMap, Set<byte[]> mostRecentIndexRowKeys) throws IOException { if (indexKeyToMutationMap.size() == 0) { return; } if (verifyType != IndexTool.IndexVerifyType.ONLY) { <START> try (org.apache.hadoop.hbase.client.Connection connection = <END> HBaseFactoryProvider.getHConnectionFactory().createConnection(env.getConfiguration())) { endKeys = connection.getRegionLocator(indexHTable.getName()).getEndKeys(); } } List<Map<byte[], List<Mutation>>> mapList = getPerTaskIndexKeyToMutationMaps((TreeMap)indexKeyToMutationMap, endKeys, rowCountPerTask); int taskCount = mapList.size(); TaskBatch<Boolean> tasks = new TaskBatch<>(taskCount); List<IndexToolVerificationResult> verificationResultList = new ArrayList<>(taskCount); for (int i = 0; i < taskCount; i++) { IndexToolVerificationResult perTaskVerificationResult = new IndexToolVerificationResult(scan); verificationResultList.add(perTaskVerificationResult); addRebuildAndOrVerifyTask(tasks, mapList.get(i), mostRecentIndexRowKeys, perTaskVerificationResult); } submitTasks(tasks); if (verify) { for (IndexToolVerificationResult result : verificationResultList) { verificationResult.add(result); } } }</code><technical_language>Creating HBase connections is heavy-weight. re-use somewhere, a Phoenix connection? Also, this code is duplicated in constructor, factor out a small helper function</technical_language>

Target:
private void verifyAndOrRebuildIndex(Map<byte[], List<Mutation>> indexKeyToMutationMap, Set<byte[]> mostRecentIndexRowKeys) throws IOException { if (indexKeyToMutationMap.size() == 0) { return; } if (verifyType != IndexTool.IndexVerifyType.ONLY) { endKeys = connection.getRegionLocator(indexHTable.getName()).getEndKeys(); } List<Map<byte[], List<Mutation>>> mapList = getPerTaskIndexKeyToMutationMaps((TreeMap)indexKeyToMutationMap, endKeys, rowCountPerTask); int taskCount = mapList.size(); TaskBatch<Boolean> tasks = new TaskBatch<>(taskCount); List<IndexToolVerificationResult> verificationResultList = new ArrayList<>(taskCount); for (int i = 0; i < taskCount; i++) { IndexToolVerificationResult perTaskVerificationResult = new IndexToolVerificationResult(scan); verificationResultList.add(perTaskVerificationResult); addRebuildAndOrVerifyTask(tasks, mapList.get(i), mostRecentIndexRowKeys, perTaskVerificationResult); } submitTasks(tasks); if (verify) { for (IndexToolVerificationResult result : verificationResultList) { verificationResult.add(result); } } }
Source:
<code>public void shouldWriteAndReadRateHistoryProperly() throws Exception { ConsumerInstance consumer = consumer("consumer1"); RateHistory rateHistory = RateHistory.create(0.5); maxRateRegistry.writeRateHistory(consumer, rateHistory); wait.untilZookeeperPathIsCreated( zookeeperPaths.consumersRateHistoryPath(cluster, consumer.getSubscription(), consumer.getConsumerId())); <START> await().atMost(Duration.TWO_SECONDS).until(() -> maxRateRegistry.getRateHistory(consumer).equals(rateHistory)); <END> }</code><technical_language>Duration.TWO_SECONDS -> static import</technical_language>

Target:
public void shouldWriteAndReadRateHistoryProperly() throws Exception { ConsumerInstance consumer = consumer("consumer1"); RateHistory rateHistory = RateHistory.create(0.5); maxRateRegistry.writeRateHistory(consumer, rateHistory); wait.untilZookeeperPathIsCreated( zookeeperPaths.consumersRateHistoryPath(cluster, consumer.getSubscription(), consumer.getConsumerId())); await().atMost(TWO_SECONDS).until(() -> maxRateRegistry.getRateHistory(consumer).equals(rateHistory)); }
Source:
<code>public synchronized void remove(JobRequest request) { mCacheId.remove(request.getJobId()); if (!TextUtils.isEmpty(request.getTag())) { mCacheTag.remove(request.getTag()); } try { <START> mDbHelper.getWritableDatabase().delete(JOB_TABLE_NAME, COLUMN_ID + " = " + request.getJobId(), null); <END> } catch (Exception e) { Cat.e(e, "could not delete %s", request); } }</code><technical_language>bound parameters (you're for queries)</technical_language>

Target:
public synchronized void remove(JobRequest request) { mCacheId.remove(request.getJobId()); if (!TextUtils.isEmpty(request.getTag())) { mCacheTag.remove(request.getTag()); } try { mDbHelper.getWritableDatabase().delete(JOB_TABLE_NAME, COLUMN_ID + "=?", new String[]{String.valueOf(request.getJobId())}); } catch (Exception e) { Cat.e(e, "could not delete %s", request); } }
Source:
<code>public void testFetchRecentlyFinishedFlows() throws Exception { if (!isTestSetup()) { return; } ExecutorLoader loader = createLoader(); ExecutableFlow flow1 = TestUtils.createExecutableFlow("exectest1", "exec1"); loader.uploadExecutableFlow(flow1); flow1.setStatus(Status.SUCCEEDED); flow1.setEndTime(System.currentTimeMillis()); loader.updateExecutableFlow(flow1); List<ExecutableFlow> flows = loader.fetchRecentlyFinishedFlows(recentlyFinishedLifetimeMs); Assert.assertEquals(1, flows.size()); Assert.assertEquals(flow1.getExecutionId(), flows.get(0).getExecutionId()); Assert.assertEquals(flow1.getProjectName(), flows.get(0).getProjectName()); Assert.assertEquals(flow1.getFlowId(), flows.get(0).getFlowId()); Assert.assertEquals(flow1.getVersion(), flows.get(0).getVersion()); <START> Thread.currentThread().sleep(recentlyFinishedLifetimeMs); <END> flows = loader.fetchRecentlyFinishedFlows(recentlyFinishedLifetimeMs); Assert.assertTrue(flows.isEmpty()); }</code><technical_language>thread need sleep here? important a unit test run fast possible. in a ms is norm</technical_language>

Target:
public void testFetchRecentlyFinishedFlows() throws Exception { if (!isTestSetup()) { return; } ExecutorLoader loader = createLoader(); ExecutableFlow flow1 = TestUtils.createExecutableFlow("exectest1", "exec1"); loader.uploadExecutableFlow(flow1); flow1.setStatus(Status.SUCCEEDED); flow1.setEndTime(DateTimeUtils.currentTimeMillis()); loader.updateExecutableFlow(flow1); List<ExecutableFlow> flows = loader.fetchRecentlyFinishedFlows( RECENTLY_FINISHED_LIFETIME); Assert.assertEquals(1, flows.size()); Assert.assertEquals(flow1.getExecutionId(), flows.get(0).getExecutionId()); Assert.assertEquals(flow1.getProjectName(), flows.get(0).getProjectName()); Assert.assertEquals(flow1.getFlowId(), flows.get(0).getFlowId()); Assert.assertEquals(flow1.getVersion(), flows.get(0).getVersion()); }
Source:
<code>public void testAddRepoManifest() throws Exception { <START> StringBuilder xmlContent = new StringBuilder(); <END> xmlContent.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n") .append("<manifest>") .append("<remote name=\"remote1\" fetch=\".\" />") .append("<default revision=\"master\" remote=\"remote1\" />") .append("<project path=\"foo\" name=\".\" />") .append("</manifest>"); writeTrashFile("manifest.xml", xmlContent.toString()); RepoCommand command = new RepoCommand(db); command.setPath(db.getWorkTree() + "/manifest.xml") .setURI(remoteGit.getRepository().getDirectory().toURI().toString()) .call(); File hello = new File(db.getWorkTree() + "/foo/hello.txt"); assertTrue(hello.exists()); BufferedReader reader = new BufferedReader(new FileReader(hello)); String content = reader.readLine(); assertTrue(content.startsWith("world")); }</code><technical_language>I + join string literals together. javac a StringBuilder for you</technical_language>

Target:
public void testAddRepoManifest() throws Exception { StringBuilder xmlContent = new StringBuilder(); xmlContent.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n") .append("<manifest>") .append("<remote name=\"remote1\" fetch=\".\" />") .append("<default revision=\"master\" remote=\"remote1\" />") .append("<project path=\"foo\" name=\".\" />") .append("</manifest>"); writeTrashFile("manifest.xml", xmlContent.toString()); RepoCommand command = new RepoCommand(db); command.setPath(db.getWorkTree().getAbsolutePath() + "/manifest.xml") .setURI(remoteGit.getRepository().getDirectory().toURI().toString()) .call(); File hello = new File(db.getWorkTree(), "foo/hello.txt"); assertTrue("submodule was checked out", hello.exists()); BufferedReader reader = new BufferedReader(new FileReader(hello)); String content = reader.readLine(); reader.close(); assertEquals("submodule content is as expected.", "world", content); }
Source:
<code>public List<DeviceModel> getDevices(UserModel user) { <START> Query query = em.createQuery("select d from FederatedUserDeviceInfoEntity d where d.userId = :userId"); <END> query.setParameter("userId", user.getId()); List<FederatedUserDeviceInfoEntity> resultList = query.getResultList(); return resultList.stream().map(this::toModel).collect(Collectors.toList()); }</code><technical_language>replace namedQuery try named queries everywhere</technical_language>

Target:
public List<DeviceModel> getDevices(UserModel user) { Query query = em.createNamedQuery("findDevicesByUser"); query.setParameter("userId", user.getId()); return ((List<FederatedUserDeviceInfoEntity>) query.getResultList()).stream().map(this::toModel).collect(Collectors.toList()); }
Source:
<code>public void testMoveProjectContainingGitRepo() throws Exception { TestProject project = initRepoInsideProject(); testUtils.addFileToProject(project.getProject(), "file.txt", "some text"); AddToIndexOperation addToIndexOperation = new AddToIndexOperation( new IResource[] { project.getProject().getFile("file.txt") }); addToIndexOperation.execute(null); IProjectDescription description = project.getProject().getDescription(); description.setName("P2"); project.getProject().move(description, IResource.FORCE | IResource.SHALLOW, null); IProject project2 = ResourcesPlugin.getWorkspace().getRoot() .getProject("P2"); assertNotNull(RepositoryMapping.getMapping(project2.getProject())); <START> assertEquals("Project-1", <END> RepositoryMapping.getMapping(project2.getProject()) .getRepository().getDirectory().getParentFile() .getName()); }</code><technical_language>P2 now? test succeeds, GitMoveDeleteHook nothing, eclipse moves RepositoryProvider property, GitProvider contains RepositoryMapping. GitMoveDeleteHook wrt RepositoryMapping, condition newLocationFile.getAbsolutePath().contains( srcm.getRepository().getWorkTree().getAbsolutePath()) in line 217 is fulfilled. If project eclipse workspace, GitMoveDeleteHook try do something, fail java.lang.StringIndexOutOfBoundsException in line 231</technical_language>

Target:
public void testMoveProjectContainingGitRepo() throws Exception { TestProject project = initRepoInsideProject(); testUtils.addFileToProject(project.getProject(), "file.txt", "some text"); AddToIndexOperation addToIndexOperation = new AddToIndexOperation( new IResource[] { project.getProject().getFile("file.txt") }); addToIndexOperation.execute(null); IProjectDescription description = project.getProject().getDescription(); description.setName("P2"); project.getProject().move(description, IResource.FORCE | IResource.SHALLOW, null); IProject project2 = ResourcesPlugin.getWorkspace().getRoot() .getProject("P2"); assertNotNull(RepositoryMapping.getMapping(project2.getProject())); assertEquals("P2", RepositoryMapping.getMapping(project2) .getRepository().getDirectory().getParentFile() .getName()); }
Source:
<code>private Cache<String, Car> getWriteOnlyCache(int cacheId) { Cache<String, Car> cache = cache(cacheId); AdvancedCache<String,Car> advancedCache = cache.getAdvancedCache(); AdvancedCache<String, Car> withFlags = advancedCache.withFlags(Flag.IGNORE_RETURN_VALUES, Flag.SKIP_INDEX_CLEANUP); <START> System.out.print("Using " + cacheId + ": " + cache +"\t"); <END> return withFlags; }</code><technical_language>This System.out in caller, here. Btw, isnt's logging preferred System.out, in tests</technical_language>

Target:
private Cache<String, Car> getWriteOnlyCache(int cacheId) { Cache<String, Car> cache = cache(cacheId); AdvancedCache<String,Car> advancedCache = cache.getAdvancedCache(); AdvancedCache<String, Car> withFlags = advancedCache.withFlags(Flag.IGNORE_RETURN_VALUES, Flag.SKIP_INDEX_CLEANUP); return withFlags; }
Source:
<code>public String getNicelyFormattedName() { StringBuffer out = new StringBuffer(); <START> char char_ = "_".charAt(0); <END> char prevchar = 0; for (char c : this.name().toCharArray()) { if (c != char_ && prevchar != char_) { out.append(String.valueOf(c).toLowerCase()); } else if (c != char_) { out.append(String.valueOf(c)); } prevchar = c; } return out.toString(); }</code><technical_language>is some library this method does. If want this way, char literal? '_' == "_".charAt(0)</technical_language>

Target:
public String getNicelyFormattedName() { StringBuffer out = new StringBuffer(); char char_ = '_'; char prevchar = 0; for (char c : this.name().toCharArray()) { if (c != char_ && prevchar != char_) { out.append(String.valueOf(c).toLowerCase()); } else if (c != char_) { out.append(String.valueOf(c)); } prevchar = c; } return out.toString(); }
Source:
<code>public String getSolution() { <START> return "<LINK_0>"; <END> }</code><technical_language>This obtained i18n file in case is a language specific reference. solution provide some guidance, this CS added references</technical_language>

Target:
public String getSolution() { return SOLUTION; }
Source:
<code>public static Optional<Curie> of(String raw) { try { String namespace = raw.split(":")[0]; <START> String identifier = raw.split(":")[1]; <END> return Optional.of(new Curie(namespace, identifier)); } catch (Exception e) { return Optional.empty(); } }</code><technical_language>suggest want raw.split(":",2) colons</technical_language>

Target:
public static Optional<Curie> of(String raw) { try { String[] split = raw.split(":", 2); String namespace = split[0]; String identifier = split[1]; return Optional.of(new Curie(namespace, identifier)); } catch (Exception e) { return Optional.empty(); } }
Source:
<code>protected void addGlobalMeta(String key, boolean value) { <START> addGlobalMeta(key, new Boolean(value)); <END> }</code><technical_language>static valueOf methods below</technical_language>

Target:
protected void addGlobalMeta(String key, boolean value) { addGlobalMeta(key, Boolean.valueOf(value)); }
Source:
<code><START> private static OGCGeometry readPoint(BasicSliceInput input) <END> { double x = input.readDouble(); double y = input.readDouble(); Point point; if (isEsriNaN(x) || isEsriNaN(y)) { point = new Point(); } else { point = new Point(x, y); } return createFromEsriGeometry(point, null, false); }</code><technical_language>return type tightened OGCPoint</technical_language>

Target:
private static OGCPoint readPoint(BasicSliceInput input) { double x = input.readDouble(); double y = input.readDouble(); Point point; if (isNaN(x) || isNaN(y)) { point = new Point(); } else { point = new Point(x, y); } return new OGCPoint(point, null); }
Source:
<code>public void get_user_in_token() throws DotSecurityException, DotDataException, ParseException { final User user = userAPI.loadUserById(userId); user.setModificationDate(date); final JsonWebTokenService jsonWebTokenService = JsonWebTokenFactory.getInstance().getJsonWebTokenService(); assertNotNull(jsonWebTokenService); String jsonWebToken = jsonWebTokenService.generateUserToken(new UserToken(jwtId, <START> userId, date, DateUtil.daysToMillis(2), user.getSkinId() <END> )); System.out.println(jsonWebToken); assertNotNull(jsonWebToken); final JWToken jwtBean = jsonWebTokenService.parseToken(jsonWebToken); assertNotNull(jwtBean); assertEquals(jwtBean.getId(), jwtId); assertEquals(jwtBean.getIssuer(), clusterId); final String subject = jwtBean.getSubject(); assertNotNull(subject); assertEquals(subject, userId); JsonWebTokenUtils jsonWebTokenUtils = new JsonWebTokenUtils(jsonWebTokenService); User userInToken = jsonWebTokenUtils.getUser(jsonWebToken, "127.0.0.1"); assertNotNull(userInToken); assertEquals(user, userInToken); }</code><technical_language>discussed, need add property methods for rememberMeToken e.g. user.getRememberMeToken() save of this field "skinUI" saving db</technical_language>

Target:
public void get_user_in_token() throws DotSecurityException, DotDataException, ParseException { final User user = userAPI.loadUserById(userId); user.setModificationDate(date); final JsonWebTokenService jsonWebTokenService = JsonWebTokenFactory.getInstance().getJsonWebTokenService(); assertNotNull(jsonWebTokenService); final String jwtId = user.getRememberMeToken(); final UserToken userToken = new UserToken.Builder() .id(jwtId).subject(userId) .modificationDate(date) .expiresDate(DateUtil.daysToMillis(2)) .build(); String jsonWebToken = jsonWebTokenService.generateUserToken(userToken); System.out.println(jsonWebToken); assertNotNull(jsonWebToken); final JWToken jwtBean = jsonWebTokenService.parseToken(jsonWebToken); assertNotNull(jwtBean); assertEquals(jwtBean.getId(), jwtId); assertEquals(jwtBean.getIssuer(), clusterId); final String subject = jwtBean.getSubject(); assertNotNull(subject); assertEquals(subject, userId); JsonWebTokenUtils jsonWebTokenUtils = new JsonWebTokenUtils(jsonWebTokenService); User userInToken = jsonWebTokenUtils.getUser(jsonWebToken, "127.0.0.1"); assertNotNull(userInToken); assertEquals(user, userInToken); }