auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static void teardownClusters() throws IOException { <START> terminateCluster(clusterBinding); <END> }</code><technical_language>clusterBinding = null; terminateCluster(clusterBinding)</technical_language>

Target:
public static void teardownClusters() throws IOException { terminateCluster(clusterBinding); clusterBinding = null; }
Source:
<code>private Firmware(Builder builder) { this.uid = builder.uid; this.version = builder.uid.getFirmwareVersion(); this.vendor = builder.vendor; this.model = builder.model; this.description = builder.description; this.prerequisiteVersion = builder.prerequisiteVersion; this.changelog = builder.changelog; this.onlineChangelog = builder.onlineChangelog; this.inputStream = builder.inputStream; this.md5Hash = builder.md5Hash; this.properties = Collections <START> .unmodifiableMap(builder.properties != null ? builder.properties : new HashMap<>()); <END> this.internalVersion = new Version(this.version); this.internalPrerequisiteVersion = this.prerequisiteVersion != null ? new Version(this.prerequisiteVersion) : null; }</code><technical_language>Collections.emptyMap() instead of (unused) new HashMap()</technical_language>

Target:
private Firmware(Builder builder) { this.uid = builder.uid; this.version = builder.uid.getFirmwareVersion(); this.vendor = builder.vendor; this.model = builder.model; this.description = builder.description; this.prerequisiteVersion = builder.prerequisiteVersion; this.changelog = builder.changelog; this.onlineChangelog = builder.onlineChangelog; this.inputStream = builder.inputStream; this.md5Hash = builder.md5Hash; this.properties = Collections .unmodifiableMap(builder.properties != null ? builder.properties : Collections.emptyMap()); this.internalVersion = new Version(this.version); this.internalPrerequisiteVersion = this.prerequisiteVersion != null ? new Version(this.prerequisiteVersion) : null; }
Source:
<code>void putServiceSpans(Map<String, Set<Pair<String>>> indexToServiceSpans, String index, Span s) { Set<Pair<String>> serviceSpans = indexToServiceSpans.get(index); <START> synchronized(indexToServiceSpansCache) { <END> Set<Pair<String>> serviceSpansCached = indexToServiceSpansCache.get(index); if (serviceSpans == null) indexToServiceSpans.put(index, serviceSpans = new LinkedHashSet<>()); if (serviceSpansCached == null) indexToServiceSpansCache.put(index, serviceSpansCached = Collections.newSetFromMap(new LinkedHashMap<Pair<String>, Boolean>() { @Override protected boolean removeEldestEntry(Map.Entry<Pair<String>, Boolean> eldest) { return size() > MAX_CACHE_ENTRIES; } })); for (String serviceName : s.serviceNames()) { Pair<String> p = Pair.create(serviceName, s.name); if (!serviceSpansCached.contains(p)) { serviceSpans.add(p); serviceSpansCached.add(p); } } } }</code><technical_language>end needing tune this later.. for put in some unit tests, some contended benchmarks</technical_language>

Target:
void putServiceSpans(Map<String, Set<Pair<String>>> indexToServiceSpans, String index, Span s) { Set<Pair<String>> serviceSpans = indexToServiceSpans.get(index); if (serviceSpans == null) indexToServiceSpans.put(index, serviceSpans = new LinkedHashSet<>()); for (String serviceName : s.serviceNames()) { serviceSpans.add(Pair.create(serviceName, s.name)); } }
Source:
<code>public boolean handleDown(PointF coordinate) { if (coordinate == null) { return false; } mInitialEventCoordinate = new PointF(coordinate.x, coordinate.y); mPreviousEventCoordinate = new PointF(coordinate.x, coordinate.y); pathToDraw.moveTo(coordinate.x, coordinate.y); movedDistance.set(0, 0); pathInsideBitmap = false; <START> if ((coordinate.x < PaintroidApplication.drawingSurface.getBitmapWidth()) && (coordinate.y < PaintroidApplication.drawingSurface <END> .getBitmapHeight()) && (coordinate.x > 0) && (coordinate.y > 0)) { pathInsideBitmap = true; } return true; }</code><technical_language>write a utility function for this check occurs more once</technical_language>

Target:
public boolean handleDown(PointF coordinate) { if (coordinate == null) { return false; } mInitialEventCoordinate = new PointF(coordinate.x, coordinate.y); mPreviousEventCoordinate = new PointF(coordinate.x, coordinate.y); pathToDraw.moveTo(coordinate.x, coordinate.y); movedDistance.set(0, 0); pathInsideBitmap = false; pathInsideBitmap = checkPathInsideBitmap(coordinate); return true; }
Source:
<code>void methodResolutionByUniqueIdWithParams(LogRecordListener listener) { UniqueIdSelector selector = selectUniqueId( uniqueIdForMethod(HerTestClass.class, "test7(java.lang.String)").toString()); resolver.resolveSelectors(request().selectors(selector).build(), engineDescriptor); assertEquals(2, engineDescriptor.getDescendants().size()); List<UniqueId> uniqueIds = uniqueIds(); assertThat(uniqueIds).contains(uniqueIdForClass(HerTestClass.class)); assertThat(uniqueIds).contains(uniqueIdForMethod(HerTestClass.class, "test7(java.lang.String)")); assertThat(listener.stream() .filter(logRecord -> JavaElementsResolver.class.getName().equals(logRecord.getLoggerName())) <START> ).isEmpty(); <END> }</code><technical_language>able remove filter org.junit.platform.commons.logging.LogRecordListener.stream(Class<?>)</technical_language>

Target:
void methodResolutionByUniqueIdWithParams(LogRecordListener listener) { UniqueIdSelector selector = selectUniqueId( uniqueIdForMethod(HerTestClass.class, "test7(java.lang.String)").toString()); resolver.resolveSelectors(request().selectors(selector).build(), engineDescriptor); assertEquals(2, engineDescriptor.getDescendants().size()); List<UniqueId> uniqueIds = uniqueIds(); assertThat(uniqueIds).contains(uniqueIdForClass(HerTestClass.class)); assertThat(uniqueIds).contains(uniqueIdForMethod(HerTestClass.class, "test7(java.lang.String)")); assertThat(listener.stream(JavaElementsResolver.class)).isEmpty(); }
Source:
<code>private String buildCanonicalizedHeadersString(Multimap<String, String> canonicalizedHeadersMap) { StringBuilder canonicalizedHeadersBuffer = new StringBuilder(); for (Entry<String, String> header : canonicalizedHeadersMap.entries()) { String key = header.getKey(); <START> canonicalizedHeadersBuffer.append(String.format("%s:%s\n", key.toLowerCase(), header.getValue())); <END> } return canonicalizedHeadersBuffer.toString(); }</code><technical_language>Kind of anti-pattern here, this compiles another StringBuffer allocation. Instead: canonicalizedHeadersBuffer.append(key.toLowerCase()) .append(':').append(header.getValue()).append('\n');</technical_language>

Target:
private static String buildCanonicalizedHeadersString(Multimap<String, String> canonicalizedHeadersMap) { StringBuilder canonicalizedHeadersBuffer = new StringBuilder(); for (Entry<String, String> header : canonicalizedHeadersMap.entries()) { String key = header.getKey(); canonicalizedHeadersBuffer.append(key.toLowerCase()).append(':').append(header.getValue()).append('\n'); } return canonicalizedHeadersBuffer.toString(); }
Source:
<code>public void testMove() throws Exception { walker.move(); <START> assertEquals(37.0 , walker.getX(), 0); <END> walker.setFacingRight(false); walker.move(); assertEquals(32.0, walker.getX(), 0); }</code><technical_language>x coordinate now? Jumping is vertical code, influence speed in x direction. This means broke something, adjusting test is right solution if fails</technical_language>

Target:
public void testMove() throws Exception { walker.move(); assertEquals(Level.SPRITE_SIZE + Settings.MONSTER_SPEED , walker.getX(), 0); walker.setFacingRight(false); walker.move(); assertEquals(Level.SPRITE_SIZE, walker.getX(), 0); }
Source:
<code><START> public void testInvalidFilePathProvided() throws Exception { <END> params = new String[1]; params[0] = "/test/a.xm"; new SubmitJobCommand(params).execute(currentContextMock); assertThat(stack.get(0).getMessage(), is("'" + params[0] + "' is not a valid file.")); Mockito.verify(schedulerRestClientMock, times(0)).submitJobArchive(anyString(), anyObject(), anyObject()); throw stack.get(0); }</code><technical_language>improve naming of test testInvalidFilePathProvidedThrowsException</technical_language>

Target:
public void testInvalidFilePathProvided() throws Exception { params = new String[1]; params[0] = "/file/path/non/valid/a.xm"; new SubmitJobCommand(params).execute(currentContextMock); assertThat(stack.get(0).getMessage(), is("'" + params[0] + "' is not a valid file.")); Mockito.verify(schedulerRestClientMock, times(0)) .submitJobArchive(anyString(), convertObjectToInputStream(anyObject()), anyMap()); throw stack.get(0); }
Source:
<code>private Map<String, String> addBuildArgsFromProperties(Properties properties) { String argPrefix = "docker.buildArg."; Map<String, String> buildArgs = new HashMap<>(); for(Object keyObj : properties.keySet()){ String key = (String)keyObj; if (key.startsWith(argPrefix)){ <START> String argKey = key.replace(argPrefix, ""); <END> buildArgs.put(argKey, properties.getProperty(key)); } } log.debug(String.format("Build args set %s", buildArgs)); return buildArgs; }</code><technical_language>replaceFirst substring(argPrefix.length() for case a strange name for build arg :)</technical_language>

Target:
private Map<String, String> addBuildArgsFromProperties(Properties properties) { String argPrefix = "docker.buildArg."; Map<String, String> buildArgs = new HashMap<>(); for(Object keyObj : properties.keySet()){ String key = (String)keyObj; if (key.startsWith(argPrefix)){ String argKey = key.replaceFirst(argPrefix, ""); buildArgs.put(argKey, properties.getProperty(key)); } } log.debug(String.format("Build args set %s", buildArgs)); return buildArgs; }
Source:
<code>protected void turn(float degree) throws AutonomousModeOverException, InterruptedException { DriveCode.rotate.set(degree/degree); <START> waitUntilAtLeast(HeadingSensor.yaw, degree); <END> DriveCode.rotate.set(0.0f); }</code><technical_language>in mind yaw is absolute (sort of), relative. Is this method supposed turn a specific angle turn a specific angle? way, implemented this</technical_language>

Target:
protected void turn(float degree) throws AutonomousModeOverException, InterruptedException { float startingYaw = HeadingSensor.yaw.get(); if (degree > 0) { DriveCode.rotate.set(rotateSpeed.get()); waitUntilAtLeast(HeadingSensor.yaw, startingYaw + degree); } else { DriveCode.rotate.set(-rotateSpeed.get()); waitUntilAtMost(HeadingSensor.yaw, startingYaw + degree); } DriveCode.rotate.set(0.0f); }
Source:
<code>private void downloadFile(String bucketName, String keyName, String filePath, boolean pause, AmazonS3 s3Client) { getOut().println("Downloading to file: " + filePath + (pause ? " (pause)" : "")); File f = new File(filePath); TransferManager xferMgr = TransferManagerBuilder.standard().withS3Client(s3Client).build(); try { Download xfer = xferMgr.download(bucketName, keyName, f); SchedulerExamplesUtils.showTransferProgress(xfer); SchedulerExamplesUtils.waitForCompletion(xfer); } catch (AmazonServiceException e) { getErr().println(e.getMessage()); System.exit(1); } <START> xferMgr.shutdownNow(); <END> }</code><technical_language>finally</technical_language>

Target:
private void downloadFile(String bucketName, String keyName, String filePath, boolean pause, AmazonS3 s3Client) { getOut().println("Downloading to file: " + filePath + (pause ? " (pause)" : "")); File f = new File(filePath); TransferManager xferMgr = TransferManagerBuilder.standard().withS3Client(s3Client).build(); try { Download xfer = xferMgr.download(bucketName, keyName, f); SchedulerExamplesUtils.showTransferProgress(xfer); SchedulerExamplesUtils.waitForCompletion(xfer); } catch (AmazonServiceException e) { getErr().println(e.getMessage()); System.exit(1); } finally { xferMgr.shutdownNow(); } }
Source:
<code>public void start(final ServiceProvider<Service> serviceProvider) { try { Properties properties = new Properties(); <START> properties.put("connection.name", "EHCACHE:" + this.entityIdentifier); <END> clusterConnection = ConnectionFactory.connect(clusterUri, properties); } catch (ConnectionException ex) { throw new RuntimeException(ex); } entityFactory = new EhcacheClientEntityFactory(clusterConnection); if (autoCreate) { try { create(); } catch (IllegalStateException ex) { } } connect(); }</code><technical_language>is entityIdentifier like? URI? name part? I caps for Ehcache</technical_language>

Target:
public void start(final ServiceProvider<Service> serviceProvider) { try { Properties properties = new Properties(); properties.put(ConnectionPropertyNames.CONNECTION_NAME, CONNECTION_PREFIX + this.entityIdentifier); clusterConnection = ConnectionFactory.connect(clusterUri, properties); } catch (ConnectionException ex) { throw new RuntimeException(ex); } entityFactory = new EhcacheClientEntityFactory(clusterConnection); if (autoCreate) { try { create(); } catch (IllegalStateException ex) { } } connect(); }
Source:
<code>public static <T> boolean getEnableJoinFilterRewrite(Query<T> query) { <START> return parseBoolean(query, JOIN_FILTER_PUSH_DOWN_KEY, DEFAULT_ENABLE_JOIN_FILTER_REWRITE); <END> }</code><technical_language>Wrong key name (unused new rewrite key name flagged intellij inspection job)</technical_language>

Target:
public static <T> boolean getEnableJoinFilterRewrite(Query<T> query) { return parseBoolean(query, JOIN_FILTER_REWRITE_KEY, DEFAULT_ENABLE_JOIN_FILTER_REWRITE); }
Source:
<code>protected void before() { cache = cacheFactory.create(); <START> server = new GeodeRedisServer("localhost", 6380, (InternalCache) cache); <END> server.setAllowUnsupportedCommands(true); }</code><technical_language>Change this 0</technical_language>

Target:
protected void before() { cache = cacheFactory.create(); server = new GeodeRedisServer("localhost", 0, (InternalCache) cache); server.setAllowUnsupportedCommands(true); }
Source:
<code>public void testAutoCompleteCheckActivationData() { String caseId = caseService.startCase(deploymentUnit.getIdentifier(), STAGE_WITH_ACTIVATION_COND); assertThat(caseId).isNotNull().isEqualTo(FIRST_CASE_ID); assertCaseInstanceActive(caseId); Collection<CaseStageInstance> activeStages = caseRuntimeDataService.getCaseInstanceStages(caseId, true, new QueryContext()); assertThat(activeStages).hasSize(0); caseService.addDataToCaseFile(caseId, "readyToActivate", true); activeStages = caseRuntimeDataService.getCaseInstanceStages(caseId, true, new QueryContext()); assertThat(activeStages).hasSize(1); CaseInstance caseInstance = caseService.getCaseInstance(caseId); Long processInstanceId = ((CaseInstanceImpl)caseInstance).getProcessInstanceId(); Boolean readyVar = processService.execute(deploymentUnit.getIdentifier(), ProcessInstanceIdContext.get(processInstanceId), new ExecutableCommand<Boolean>() { private static final long serialVersionUID = 6953820688229804654L; @Override public Boolean execute(Context context) { KieSession ksession = ((RegistryContext) context).lookup( KieSession.class ); <START> <END> WorkflowProcessInstance pi = (WorkflowProcessInstance) ksession.getProcessInstance(processInstanceId); NodeInstance ni = pi.getNodeInstances().iterator().next(); return (Boolean) ni.getVariable("ready"); } }); assertNotNull("Ready variable should not be null", readyVar); assertTrue("Ready variable should be set to true", readyVar); caseService.addDataToCaseFile(caseId, "readyToComplete", true); assertCaseInstanceNotActive(caseId); }</code><technical_language>is this change needed</technical_language>

Target:
public void testAutoCompleteCheckActivationData() { String caseId = caseService.startCase(deploymentUnit.getIdentifier(), STAGE_WITH_ACTIVATION_COND); assertThat(caseId).isNotNull().isEqualTo(FIRST_CASE_ID); assertCaseInstanceActive(caseId); Collection<CaseStageInstance> activeStages = caseRuntimeDataService.getCaseInstanceStages(caseId, true, new QueryContext()); assertThat(activeStages).hasSize(0); caseService.addDataToCaseFile(caseId, "readyToActivate", true); activeStages = caseRuntimeDataService.getCaseInstanceStages(caseId, true, new QueryContext()); assertThat(activeStages).hasSize(1); CaseInstance caseInstance = caseService.getCaseInstance(caseId); Long processInstanceId = ((CaseInstanceImpl)caseInstance).getProcessInstanceId(); Boolean readyVar = processService.execute(deploymentUnit.getIdentifier(), ProcessInstanceIdContext.get(processInstanceId), new ExecutableCommand<Boolean>() { private static final long serialVersionUID = 6953820688229804654L; @Override public Boolean execute(Context context) { KieSession ksession = ((RegistryContext) context).lookup( KieSession.class ); WorkflowProcessInstance pi = (WorkflowProcessInstance) ksession.getProcessInstance(processInstanceId, true); NodeInstance ni = pi.getNodeInstances().iterator().next(); return (Boolean) ni.getVariable("ready"); } }); assertNotNull("Ready variable should not be null", readyVar); assertTrue("Ready variable should be set to true", readyVar); caseService.addDataToCaseFile(caseId, "readyToComplete", true); assertCaseInstanceNotActive(caseId); }
Source:
<code>protected Aged(int age, Date created, String id) { this.age = age; this.created = checkNotNull(created); <START> this.id = checkNotNull(id); <END> }</code><technical_language>Add messages: checkNotNull(id, "id"); etc.</technical_language>

Target:
protected Aged(int age, Date created, String id) { this.age = age; this.created = checkNotNull(created, "created required"); this.id = checkNotNull(id, "id required"); }
Source:
<code>protected void assertEventsAreTheSame(Set<String> contributionEvents) { assertEquals(events.size(), contributionEvents.size()); events.forEach(event -> { if (!contributionEvents.contains(event)) { <START> fail("The Expected Events are not the same as the ones registered on the Contribution"); <END> } }); }</code><technical_language>Add expected events event in failure message</technical_language>

Target:
protected void assertEventsAreTheSame(Set<String> contributionEvents) { assertEquals(events.size(), contributionEvents.size()); events.forEach(event -> { if (!contributionEvents.contains(event)) { fail(String.format( "The expected event '%s' is not present on the events registered by the contribution: [%s]", event, String.join(",", contributionEvents))); } }); }
Source:
<code>public DropdownActionButton(List<ActionButtonDefinition<T>> actions, List selectedItems) { <START> super(); <END> initDropdownButton(); initWidget(WidgetUiBinder.uiBinder.createAndBindUi(this)); initMenuPopup(actions, selectedItems); addMouseHandlers(); }</code><technical_language>implicit</technical_language>

Target:
public DropdownActionButton(List<ActionButtonDefinition<T>> actions, List selectedItems) { initDropdownButton(); initWidget(WidgetUiBinder.uiBinder.createAndBindUi(this)); initMenuPopup(actions, selectedItems); addMouseHandlers(); }
Source:
<code>public void initialize() { eventBus.register(this); JavaFxUtil.fixScrollSpeed(scrollPane); initializeDynamicChatPosition(); player = playerService.getCurrentPlayer().get(); initializeUppercaseText(); initializeBindings(); teamMatchmakingService.getParty().getMembers().addListener((Observable o) -> { <START> playerCard.pseudoClassStateChanged(LEADER_PSEUDO_CLASS, (teamMatchmakingService.getParty().getOwner().equals(player) && teamMatchmakingService.getParty().getMembers().size() > 1)); List<PartyMember> members = new ArrayList<>(teamMatchmakingService.getParty().getMembers()); partyMemberPane.getChildren().clear(); members.removeIf(partyMember -> partyMember.getPlayer().equals(player)); for(int i = 0; i < members.size(); i++) { PartyMemberItemController controller = uiService.loadFxml("theme/play/teammatchmaking/matchmaking_member_card.fxml"); controller.setMember(members.get(i)); if (members.size() == 1) { <END> partyMemberPane.add(controller.getRoot(), 0, 0, 2, 1); } else { partyMemberPane.add(controller.getRoot(), i % 2, i / 2); } } }); teamMatchmakingService.getParty().getMembers().addListener((InvalidationListener) c -> { refreshingLabel.setVisible(false); selectFactionsBasedOnParty(); }); JavaFxUtil.addListener(teamMatchmakingService.getParty().ownerProperty(), (observable, oldValue, newValue) -> { if (matchmakingChatController != null) { matchmakingChatController.closeChannel(); } createChannelTab(String.format("#%s'sParty", newValue.getUsername())); }); createChannelTab(String.format("#%s'sParty", teamMatchmakingService.getParty().getOwner().getUsername())); fafService.requestMatchmakerInfo(); }</code><technical_language>extract method</technical_language>

Target:
public void initialize() { eventBus.register(this); JavaFxUtil.fixScrollSpeed(scrollPane); initializeDynamicChatPosition(); player = playerService.getCurrentPlayer().get(); initializeUppercaseText(); initializeBindings(); teamMatchmakingService.getParty().getMembers().addListener((Observable o) -> renderPartyMembers()); if (teamMatchmakingService.isQueuesReadyForUpdate()) { renderQueues(); } teamMatchmakingService.queuesReadyForUpdateProperty().addListener((observable, oldValue, newValue) -> { if (newValue) { renderQueues(); } }); player.statusProperty().addListener((observable, oldValue, newValue) -> { if (newValue != PlayerStatus.IDLE) { teamMatchmakingService.getPlayersInGame().add(player); } else { teamMatchmakingService.getPlayersInGame().remove(player); } }); teamMatchmakingService.getParty().getMembers().addListener((InvalidationListener) c -> { refreshingLabel.setVisible(false); selectFactionsBasedOnParty(); }); JavaFxUtil.addListener(teamMatchmakingService.getParty().ownerProperty(), (observable, oldValue, newValue) -> { if (matchmakingChatController != null) { matchmakingChatController.closeChannel(); } createChannelTab("#" + newValue.getUsername() + PARTY_CHANNEL_SUFFIX); }); createChannelTab("#" + teamMatchmakingService.getParty().getOwner().getUsername() + PARTY_CHANNEL_SUFFIX); fafService.requestMatchmakerInfo(); }
Source:
<code>public void writeDateTime( long epochSecondUTC, int nano, String zoneId ) throws RuntimeException { <START> writeValue( ZonedDateTime.of( LocalDate.ofEpochDay( epochSecondUTC ), LocalTime.ofNanoOfDay( nano ), ZoneId.of( zoneId ) ) ); <END> }</code><technical_language>this method ZonedDateTime.of aboveZonedDateTime.ofInstant? thing, time zone formats. Also, in BaseToObjectValueWriter</technical_language>

Target:
public void writeDateTime( long epochSecondUTC, int nano, String zoneId ) throws RuntimeException { writeValue( ZonedDateTime.ofInstant( Instant.ofEpochSecond(epochSecondUTC, nano), ZoneId.of( zoneId ) ) ); }
Source:
<code>public FieldDataFetcher(String fieldName) { <START> assertNotNull(fieldName, "`name` can't be null"); <END> this.fieldName = fieldName; }</code><technical_language>fieldName</technical_language>

Target:
public FieldDataFetcher(String fieldName) { assertNotNull(fieldName, "`fieldName` can't be null"); this.fieldName = fieldName; }
Source:
<code>protected void SyncSearch() { super.SyncSearch(); Frontend.RunQuery(VdcQueryType.GetAllVmsAndVmPools, new VdcQueryParametersBase(), new AsyncQuery(this, new INewAsyncCallback() { @Override public void OnSuccess(Object model, Object returnValue) { <START> UserPortalBasicListModel userPortalBasicListModel = (UserPortalBasicListModel) model; <END> ArrayList<VM> vms = new ArrayList<VM>(); ArrayList<vm_pools> pools = new ArrayList<vm_pools>(); VdcQueryReturnValue retValue = (VdcQueryReturnValue) returnValue; if (retValue != null && retValue.getSucceeded()) { List<Object> list = (ArrayList<Object>) retValue.getReturnValue(); for (Object object : list) { if (object instanceof VM) { vms.add((VM) object); } else if (object instanceof vm_pools) { pools.add((vm_pools) object); } } } userPortalBasicListModel.setvms(vms); userPortalBasicListModel.setpools(pools); userPortalBasicListModel.OnVmAndPoolLoad(); } })); }</code><technical_language>general - this method in place avoid need maintain in places</technical_language>

Target:
protected void SyncSearch() { super.SyncSearch(); Frontend.RunQuery(VdcQueryType.GetAllVmsAndVmPools, new VdcQueryParametersBase(), new AsyncQuery(this, new INewAsyncCallback() { @Override public void OnSuccess(Object model, Object returnValue) { UserPortalBasicListModel userPortalBasicListModel = (UserPortalBasicListModel) model; ArrayList<VM> vms = new ArrayList<VM>(); ArrayList<vm_pools> pools = new ArrayList<vm_pools>(); VdcQueryReturnValue retValue = (VdcQueryReturnValue) returnValue; if (retValue != null && retValue.getSucceeded()) { List<Object> list = (ArrayList<Object>) retValue.getReturnValue(); if (list != null) { for (Object object : list) { if (object instanceof VM) { vms.add((VM) object); } else if (object instanceof vm_pools) { pools.add((vm_pools) object); } } } } userPortalBasicListModel.setvms(vms); userPortalBasicListModel.setpools(pools); userPortalBasicListModel.OnVmAndPoolLoad(); } })); }
Source:
<code>public void onBindViewHolder(ViewHolder holder, int i) { Item item = getItemInternal(i); <START> final Activity activity = item.getActivity(); <END> holder.url = activity.getUrl(); if (shouldShowGPlusButton()) { holder.plusButton.setVisibility(View.VISIBLE); holder.plusButton.initialize(activity.getUrl(), ACTIVITY_REQUEST_CODE_GPLUS_BUTTON); } else { holder.plusButton.setVisibility(View.GONE); } if (activity.getPublished() != null) { holder.timeStamp.setVisibility(View.VISIBLE); holder.timeStamp.setText( Utils.toHumanTimePeriod( mContext, activity.getPublished(), DateTime.now() ) ); } else { holder.timeStamp.setVisibility(View.GONE); } if (activity.getVerb().equals("share")) { populateShare(activity, holder); } else { holder.shareContainer.setVisibility(View.GONE); populatePost(activity, holder.content); } if (activity.getObject().getAttachments() != null && activity.getObject().getAttachments().size() > 0) { final Attachment attachment = activity.getObject().getAttachments().get(0); switch (getItemViewType(i)) { case VIEWTYPE_ARTICLE: populateArticle(holder, holder.container, attachment); break; case VIEWTYPE_VIDEO: populateVideo(holder, holder.container, attachment); break; case VIEWTYPE_PHOTO: populatePhoto(holder, holder.container, attachment); break; case VIEWTYPE_ALBUM: populateAlbum(holder, holder.container, attachment); break; case VIEWTYPE_EVENT: populateEvent(holder, holder.container, attachment); break; } } }</code><technical_language>This is similar updatePlusOne method. If put else statement method, same</technical_language>

Target:
public void onBindViewHolder(ViewHolder holder, int i) { Item item = getItemInternal(i); final Activity activity = item.getActivity(); holder.url = activity.getUrl(); updatePlusOne(holder); if (activity.getPublished() != null) { holder.timeStamp.setVisibility(View.VISIBLE); holder.timeStamp.setText( Utils.toHumanTimePeriod( mContext, activity.getPublished(), DateTime.now() ) ); } else { holder.timeStamp.setVisibility(View.GONE); } if (activity.getVerb().equals("share")) { populateShare(activity, holder); } else { holder.shareContainer.setVisibility(View.GONE); populatePost(activity, holder.content); } if (activity.getObject().getAttachments() != null && activity.getObject().getAttachments().size() > 0) { final Attachment attachment = activity.getObject().getAttachments().get(0); switch (getItemViewType(i)) { case VIEWTYPE_ARTICLE: populateArticle(holder, holder.container, attachment); break; case VIEWTYPE_VIDEO: populateVideo(holder, holder.container, attachment); break; case VIEWTYPE_PHOTO: populatePhoto(holder, holder.container, attachment); break; case VIEWTYPE_ALBUM: populateAlbum(holder, holder.container, attachment); break; case VIEWTYPE_EVENT: populateEvent(holder, holder.container, attachment); break; } } }
Source:
<code>public void run() { SHUTDOWN_TASKS.forEach(r -> { try { r.run(); <START> } catch (Throwable e) { <END> LOG.error("exception while shutting down", e); } }); SHUTDOWN_TASKS.clear(); }</code><technical_language>catch throwables. RuntimeExceptions most. seen</technical_language>

Target:
public void run() { SHUTDOWN_TASKS.forEach(r -> { try { r.run(); } catch (RuntimeException e) { LOG.error("exception while shutting down", e); } }); SHUTDOWN_TASKS.clear(); }
Source:
<code>public static void validate(FilterPredicate predicate, MessageType schema) { Preconditions.checkNotNull(predicate, "predicate"); <START> Preconditions.checkNotNull(schema, "schema"); <END> predicate.accept(new SchemaCompatibilityValidator(schema)); }</code><technical_language>I if a tool automatically adds null checks if NotNull annotation jsr305. bytecode rewriting build time doable</technical_language>

Target:
public static void validate(FilterPredicate predicate, MessageType schema) { checkNotNull(predicate, "predicate"); checkNotNull(schema, "schema"); predicate.accept(new SchemaCompatibilityValidator(schema)); }
Source:
<code>public static BenchmarkSuite getBenchmarkSuiteObject(String suite, String querySet) { BenchmarkQuery benchmarkQuery1 = new BenchmarkQuery(querySet, "Q1", "SELECT 1", CATALOG, SCHEMA); BenchmarkQuery benchmarkQuery2 = new BenchmarkQuery(querySet, "Q2", "SELECT 2", CATALOG, SCHEMA); BenchmarkQuery benchmarkQuery3 = new BenchmarkQuery(querySet, "Q3", "SELECT 3", CATALOG, SCHEMA); <START> List<String> stream1 = Arrays.asList("Q1", "Q2"); List<String> stream2 = Arrays.asList("Q2", "Q3"); <END> PhaseSpecification phaseSpecification1 = new PhaseSpecification("STREAM", Arrays.asList(stream1, stream2)); PhaseSpecification phaseSpecification2 = new PhaseSpecification("CONCURRENT", Arrays.asList(stream2, stream1)); Map<String, String> sessionProperties = new HashMap(); sessionProperties.put("max", "5"); return new BenchmarkSuite(new BenchmarkSuiteInfo(suite, querySet, Arrays.asList(phaseSpecification1, phaseSpecification2), Optional.of(sessionProperties)), Arrays.asList(benchmarkQuery1, benchmarkQuery2, benchmarkQuery3)); }</code><technical_language>create a list, ImmutableList.of()</technical_language>

Target:
public static BenchmarkSuite getBenchmarkSuiteObject(String suite, String querySet) { BenchmarkQuery benchmarkQuery1 = new BenchmarkQuery(querySet, "Q1", "SELECT 1", CATALOG, SCHEMA); BenchmarkQuery benchmarkQuery2 = new BenchmarkQuery(querySet, "Q2", "SELECT 2", CATALOG, SCHEMA); BenchmarkQuery benchmarkQuery3 = new BenchmarkQuery(querySet, "Q3", "SELECT 3", CATALOG, SCHEMA); return new BenchmarkSuite(new BenchmarkSuiteInfo(suite, querySet, getBenchmarkSuitePhases(), getBenchmarkSuiteSessionProperties()), ImmutableList.of(benchmarkQuery1, benchmarkQuery2, benchmarkQuery3)); }
Source:
<code>protected final int futVars(Propagator prop) { int pid = prop.getId(); int futVars = pid2arity.get(pid); if (futVars == -1) { futVars = 0; <START> for (int i = 0; i < prop.getNbVars(); i++) { if (!prop.getVar(i).isInstantiated()) { if (++futVars > 1) { break; } } } <END> futVars = prop.arity(); pid2arity.put(pid, futVars); } return futVars; }</code><technical_language>is purpose of this for loop ? I understand it, increases futVars is strictly greater 1 call arity() is basically this for loop, stopping criterion</technical_language>

Target:
protected final int futVars(Propagator prop) { int pid = prop.getId(); int futVars = pid2arity.get(pid); if (futVars == -1) { futVars = 0; for (int i = 0; i < prop.getNbVars(); i++) { if (!prop.getVar(i).isInstantiated()) { if (++futVars > 1) { break; } } } pid2arity.put(pid, futVars); } return futVars; }
Source:
<code>private void showErrorAutoConfiguration() { new AlertDialog.Builder(activity) .setTitle(R.string.error_message) .setMessage(R.string.error_auto_configuration) .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int arg1) { <START> continueWithDemoUser(); <END> } }).create().show(); }</code><technical_language>autoconfiguration fail, app continue demo user, do nothing, in no-login mode</technical_language>

Target:
private void showErrorAutoConfiguration() { new AlertDialog.Builder(activity) .setTitle(R.string.error_message) .setMessage(R.string.error_auto_configuration) .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int arg1) { goNextActivity(); } }).create().show(); }
Source:
<code>private void timeout(final Client client) { <START> LOG.debug("Client timed out", client.getEndpoint()); <END> clientStatusTracker.setClientUnreachable(client.getEndpoint()); }</code><technical_language>isDebugEnabled</technical_language>

Target:
private void timeout(final Client client) { if(LOG.isDebugEnabled()) { LOG.debug("Client timed out", client.getEndpoint()); } clientStatusTracker.setClientUnreachable(client.getEndpoint()); }
Source:
<code>public void testDefaults() { <START> assertRecordedDefaults(recordDefaults(CompilerConfig.class) <END> .setInterpreterEnabled(false) .setExpressionCacheEnabled(true)); }</code><technical_language>I thought do: assertRecordedDefaults( recordDefaults(CompilerConfig.class) .setInterpreterEnabled(false) .setExpressionCacheEnabled(true));</technical_language>

Target:
public void testDefaults() { assertRecordedDefaults(recordDefaults(CompilerConfig.class) .setInterpreterEnabled(false) .setExpressionCacheSize(10_000)); }
Source:
<code>public int nextPartition(String topic, Cluster cluster, int prevPartition) { List<PartitionInfo> partitions = cluster.partitionsForTopic(topic); int numPartitions = partitions.size(); if (numPartitions == 1) { indexCache.put(topic, 0); return 0; <START> } else if (indexCache.get(topic) == null || prevPartition == indexCache.get(topic)) { <END> Integer part = indexCache.get(topic); List<PartitionInfo> availablePartitions = cluster.availablePartitionsForTopic(topic); Integer random = Utils.toPositive(ThreadLocalRandom.current().nextInt()); if (availablePartitions.size() < 1) { part = random % numPartitions; } else if (availablePartitions.size() == 1) { part = availablePartitions.get(0).partition(); } else { while (part == indexCache.get(topic)) { random = Utils.toPositive(ThreadLocalRandom.current().nextInt()); part = availablePartitions.get(random % availablePartitions.size()).partition(); } } indexCache.putIfAbsent(topic, part); indexCache.replace(topic, prevPartition, part); return indexCache.get(topic); } return indexCache.get(topic); }</code><technical_language>do indexCache.get(topic) twice. is inefficient needs lock release (or do atomic operation twice, whatever). Also, get a result time complicates logic here</technical_language>

Target:
public int nextPartition(String topic, Cluster cluster, int prevPartition) { List<PartitionInfo> partitions = cluster.partitionsForTopic(topic); Integer oldPart = indexCache.get(topic); Integer newPart = oldPart; if (oldPart == null || oldPart == prevPartition) { List<PartitionInfo> availablePartitions = cluster.availablePartitionsForTopic(topic); Integer random = Utils.toPositive(ThreadLocalRandom.current().nextInt()); if (availablePartitions.size() < 1) { newPart = random % partitions.size(); } else if (availablePartitions.size() == 1) { newPart = availablePartitions.get(0).partition(); } else { while (newPart == null || newPart.equals(oldPart)) { random = Utils.toPositive(ThreadLocalRandom.current().nextInt()); newPart = availablePartitions.get(random % availablePartitions.size()).partition(); } } if (oldPart == null) { indexCache.putIfAbsent(topic, newPart); } else { indexCache.replace(topic, prevPartition, newPart); } return indexCache.get(topic); } return indexCache.get(topic); }
Source:
<code>private void populate() { choiceBox = new ComboBox<>(repositoryChoices); choiceBox.setPromptText(tr("Please select the repository type you want to add")); choiceBox.setConverter(new StringConverter<RepositoryType>() { @Override public String toString(RepositoryType repositoryType) { return repositoryType.getLabel(); } @Override public RepositoryType fromString(String string) { return Arrays.stream(RepositoryType.values()).filter(type -> type.getLabel().equals(string)).findAny() .orElse(null); } }); choiceBox.setOnAction( event -> onRepositoryTypeSelection.accept(choiceBox.getSelectionModel().getSelectedItem())); Label choiceBoxLabel = new Label(tr("Repository type:")); choiceBoxLabel.setLabelFor(choiceBox); HBox content = new HBox(choiceBoxLabel, choiceBox); <START> content.setAlignment(Pos.CENTER_LEFT); <END> content.setSpacing(10); HBox.setHgrow(choiceBox, Priority.ALWAYS); this.setCenter(content); }</code><technical_language>I this approach. I set css</technical_language>

Target:
private void populate() { choiceBox = new ComboBox<>(repositoryChoices); choiceBox.setPromptText(tr("Please select the repository type you want to add")); choiceBox.setConverter(new StringConverter<RepositoryType>() { @Override public String toString(RepositoryType repositoryType) { return repositoryType.getLabel(); } @Override public RepositoryType fromString(String string) { return Arrays.stream(RepositoryType.values()).filter(type -> type.getLabel().equals(string)).findAny() .orElse(null); } }); choiceBox.setOnAction( event -> onRepositoryTypeSelection.accept(choiceBox.getSelectionModel().getSelectedItem())); Label choiceBoxLabel = new Label(tr("Repository type:")); choiceBoxLabel.setLabelFor(choiceBox); HBox content = new HBox(choiceBoxLabel, choiceBox); content.setId("repositoryTypeSelection"); HBox.setHgrow(choiceBox, Priority.ALWAYS); this.setCenter(content); }
Source:
<code>protected boolean verifyResult(Object rawExpression, Object resultRaw) { if (resultRaw != null && !(resultRaw instanceof List) && !(resultRaw instanceof Map)) { <START> throw new IllegalArgumentException("A list was expected"); <END> } if (!(rawExpression instanceof String)) { throw new IllegalArgumentException("Malformed raw data"); } String raw = (String) rawExpression; ObjectMapper objectMapper = new ObjectMapper(); try { JsonNode jsonNode = objectMapper.readTree(raw); if (jsonNode.isArray()) { return verifyList((ArrayNode) jsonNode, (List) resultRaw); } else if (jsonNode.isObject()) { return verifyObject((ObjectNode) jsonNode, resultRaw); } throw new IllegalArgumentException("Malformed raw data"); } catch (IOException e) { throw new IllegalArgumentException("Malformed raw data", e); } }</code><technical_language>Minor thing, message "list map expected"</technical_language>

Target:
protected boolean verifyResult(Object rawExpression, Object resultRaw) { if (resultRaw != null && !(resultRaw instanceof List) && !(resultRaw instanceof Map)) { throw new IllegalArgumentException("A list or map was expected"); } if (!(rawExpression instanceof String)) { throw new IllegalArgumentException("Malformed raw data"); } String raw = (String) rawExpression; ObjectMapper objectMapper = new ObjectMapper(); try { JsonNode jsonNode = objectMapper.readTree(raw); if (jsonNode.isArray()) { return verifyList((ArrayNode) jsonNode, (List) resultRaw); } else if (jsonNode.isObject()) { return verifyObject((ObjectNode) jsonNode, resultRaw); } throw new IllegalArgumentException("Malformed raw data"); } catch (IOException e) { throw new IllegalArgumentException("Malformed raw data", e); } }
Source:
<code>public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); initHandler(); String email = getArguments().getString(ExtraConstants.EMAIL); ActionCodeSettings actionCodeSettings = getArguments().getParcelable(ExtraConstants .ACTION_CODE_SETTINGS); <START> if (!mEmailSent && (savedInstanceState == null || !savedInstanceState.getBoolean <END> (EMAIL_SENT))) { mEmailLinkSendEmailHandler.sendSignInLinkToEmail(email, actionCodeSettings); } }</code><technical_language>crazy formatter is again</technical_language>

Target:
public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); initHandler(); String email = getArguments().getString(ExtraConstants.EMAIL); ActionCodeSettings actionCodeSettings = getArguments().getParcelable(ExtraConstants .ACTION_CODE_SETTINGS); if (!mEmailSent) { mEmailLinkSendEmailHandler.sendSignInLinkToEmail(email, actionCodeSettings); } }
Source:
<code>public void onAuthenticationChanged(OnAuthenticationChanged event) { if (event.isError()) { <START> AppLog.d(T.MAIN, "GOOGLE SIGNIN: onAuthenticationChanged - error"); <END> AppLog.e(T.API, "LoginGoogleFragment.onAuthenticationChanged: " + event.error.type + " - " + event.error.message); mAnalyticsListener.trackLoginFailed(event.getClass().getSimpleName(), event.error.type.toString(), event.error.message); mAnalyticsListener.trackSocialFailure(event.getClass().getSimpleName(), event.error.type.toString(), event.error.message); showError(getString(R.string.login_error_generic)); } else { AppLog.d(T.MAIN, "GOOGLE SIGNIN: onAuthenticationChanged - success"); AppLog.i(T.NUX, "LoginGoogleFragment.onAuthenticationChanged: " + event.toString()); mGoogleListener.onGoogleLoginFinished(); finishSignUp(); } }</code><technical_language>For differentiation two, Google *login* *signup* *signin*. update SIGNIN LOGIN for consistency</technical_language>

Target:
public void onAuthenticationChanged(OnAuthenticationChanged event) { if (event.isError()) { AppLog.d(T.MAIN, "GOOGLE LOGIN: onAuthenticationChanged - error"); AppLog.e(T.API, "LoginGoogleFragment.onAuthenticationChanged: " + event.error.type + " - " + event.error.message); mAnalyticsListener.trackLoginFailed(event.getClass().getSimpleName(), event.error.type.toString(), event.error.message); mAnalyticsListener.trackSocialFailure(event.getClass().getSimpleName(), event.error.type.toString(), event.error.message); showError(getString(R.string.login_error_generic)); } else { AppLog.d(T.MAIN, "GOOGLE LOGIN: onAuthenticationChanged - success"); AppLog.i(T.NUX, "LoginGoogleFragment.onAuthenticationChanged: " + event.toString()); mGoogleListener.onGoogleLoginFinished(); finishFlow(); } }
Source:
<code>public List<AuditLogWithHistory> getEmailAuditLogsWithHistoryForId(final UUID accountEmailId, final AuditLevel auditLevel, final InternalTenantContext context) throws AccountApiException { <START> return transactionalSqlDao.execute(true, AccountApiException.class, new EntitySqlDaoTransactionWrapper<List<AuditLogWithHistory>>() { <END> @Override public List<AuditLogWithHistory> inTransaction(final EntitySqlDaoWrapperFactory entitySqlDaoWrapperFactory) { final AccountEmailSqlDao transactional = entitySqlDaoWrapperFactory.become(AccountEmailSqlDao.class); return auditDao.getAuditLogsWithHistoryForId(transactional, TableName.ACCOUNT_EMAIL, accountEmailId, auditLevel, context); } }); }</code><technical_language>other signature (without exception)? AccountApiException is thrown (same remark below)</technical_language>

Target:
public List<AuditLogWithHistory> getEmailAuditLogsWithHistoryForId(final UUID accountEmailId, final AuditLevel auditLevel, final InternalTenantContext context) { return transactionalSqlDao.execute(true, new EntitySqlDaoTransactionWrapper<List<AuditLogWithHistory>>() { @Override public List<AuditLogWithHistory> inTransaction(final EntitySqlDaoWrapperFactory entitySqlDaoWrapperFactory) { final AccountEmailSqlDao transactional = entitySqlDaoWrapperFactory.become(AccountEmailSqlDao.class); return auditDao.getAuditLogsWithHistoryForId(transactional, TableName.ACCOUNT_EMAIL, accountEmailId, auditLevel, context); } }); }
Source:
<code><START> private void handleResponse(Consumer<RuntimeModel> modelLoaded, Command emptyModel, Optional<RuntimeModel> runtimeModelOp) { <END> if (runtimeModelOp.isPresent()) { RuntimeModel runtimeModel = runtimeModelOp.get(); registerModel(runtimeModel); modelLoaded.accept(runtimeModel); } else { emptyModel.execute(); } }</code><technical_language>Consider adding a BusyIndicatorView for this call</technical_language>

Target:
private void handleResponse(Consumer<RuntimeModel> modelLoaded, Command emptyModel, Optional<RuntimeModel> runtimeModelOp) { loading.hideBusyIndicator(); if (runtimeModelOp.isPresent()) { RuntimeModel runtimeModel = runtimeModelOp.get(); registerModel(runtimeModel); modelLoaded.accept(runtimeModel); } else { emptyModel.execute(); } }
Source:
<code>public Set<Node> getNodes() { Set<Node> nodes = this.nodes; if(nodes!=null) return nodes; <START> Set<Node> r = new TreeSet<Node>(new NodeSorter()); <END> Jenkins h = Jenkins.getInstance(); if(this.matches(h)) r.add(h); for (Node n : h.getNodes()) { if(this.matches(n)) r.add(n); } return this.nodes = Collections.unmodifiableSet(r); }</code><technical_language>@daniel-beck thank for adding this is achieve goal - point of view this kind of sorting do UI side. In current implementation TreeSet re-balanced time add a new node - lead hundreds of re-allocations for big instances. getNodes is in a tons of other methods (only in Jenkins Core), I prefer switch TreeSet, expose another method UI (if want this logic server side)</technical_language>

Target:
public Set<Node> getNodes() { Set<Node> nodes = this.nodes; if(nodes!=null) return nodes; Set<Node> r = new HashSet<>(); Jenkins h = Jenkins.getInstance(); if(this.matches(h)) r.add(h); for (Node n : h.getNodes()) { if(this.matches(n)) r.add(n); } return this.nodes = Collections.unmodifiableSet(r); }
Source:
<code>public <T> T fromJson(JsonReader reader, Type typeOfT) throws JsonIOException, JsonSyntaxException { boolean isEmpty = true; boolean oldLenient = reader.isLenient(); reader.setLenient(true); try { <START> JsonToken token = reader.peek(); <END> if (token == JsonToken.END_DOCUMENT) { return null; } isEmpty = false; TypeToken<T> typeToken = (TypeToken<T>) TypeToken.get(typeOfT); TypeAdapter<T> typeAdapter = getAdapter(typeToken); T object = typeAdapter.read(reader); return object; } catch (EOFException e) { if (isEmpty) { return null; } throw new JsonSyntaxException(e); } catch (IllegalStateException e) { throw new JsonSyntaxException(e); } catch (IOException e) { throw new JsonSyntaxException(e); } catch (AssertionError e) { AssertionError error = new AssertionError("AssertionError (GSON " + GsonBuildConfig.VERSION + "): " + e.getMessage()); error.initCause(e); throw error; } finally { reader.setLenient(oldLenient); } }</code><technical_language>@StrongerXi, I noticed in line 926 reader is set lenient anyways. isEmpty variable EOFException handling removed. is a test for this: <LINK_0> is explicitly making reader lenient, multiple tests fail if reader lenient fromJson(...)</technical_language>

Target:
public <T> T fromJson(JsonReader reader, Type typeOfT) throws JsonIOException, JsonSyntaxException { boolean oldLenient = reader.isLenient(); reader.setLenient(true); try { if (reader.peek() == JsonToken.END_DOCUMENT) { return null; } TypeToken<T> typeToken = (TypeToken<T>) TypeToken.get(typeOfT); TypeAdapter<T> typeAdapter = getAdapter(typeToken); T object = typeAdapter.read(reader); return object; } catch (IllegalStateException e) { throw new JsonSyntaxException(e); } catch (IOException e) { throw new JsonSyntaxException(e); } catch (AssertionError e) { AssertionError error = new AssertionError("AssertionError (GSON " + GsonBuildConfig.VERSION + "): " + e.getMessage()); error.initCause(e); throw error; } finally { reader.setLenient(oldLenient); } }
Source:
<code>private String generateTokenValueResponse() { <START> byte[] cookieBytes = getThreadLocalRequest().getSession().getId().getBytes(); <END> return StringUtils.toHexString(Md5Utils.getMd5Digest(cookieBytes)); }</code><technical_language>Charset.forName("UTF-8")</technical_language>

Target:
private String generateTokenValueResponse() { byte[] tokenBytes = getThreadLocalRequest().getSession().getId().getBytes(Charset.forName("UTF-8")); return StringUtils.toHexString(Md5Utils.getMd5Digest(tokenBytes)); }