auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public boolean isActive(FeatureState featureState, FeatureUser user) { HttpServletRequest request = HttpServletRequestHolder.get(); if (request != null) { List<String> parts = Strings.splitAndTrim(featureState.getParameter(PARAM_IPS), "[\\s,]+"); try { <START> String remoteAddr = request.getHeader("X-FORWARDED-FOR"); <END> if(Strings.isBlank(remoteAddr)) { remoteAddr = request.getRemoteAddr(); } InetAddress remoteInetAddress = InetAddress.getByName(remoteAddr); for (String part : parts) { if (part.equals(remoteAddr)) { return true; } if (part.contains("/")) { CIDRUtils cidrUtil = new CIDRUtils(part); if (cidrUtil.isInRange(remoteInetAddress)) { return true; } } else if (remoteInetAddress.equals(InetAddress.getByName(part))) { return true; } } } catch (UnknownHostException | IllegalArgumentException e) { log.warn("Ignoring illegal IP address or CIDR range "); } } return false; }</code><technical_language>X-Forwarded-For instead of uppercase. header is typically client</technical_language>

Target:
public boolean isActive(FeatureState featureState, FeatureUser user) { HttpServletRequest request = HttpServletRequestHolder.get(); if (request != null) { List<String> parts = Strings.splitAndTrim(featureState.getParameter(PARAM_IPS), "[\\s,]+"); try { String remoteAddr = request.getHeader("X-Forwarded-For"); if (Strings.isBlank(remoteAddr)) { remoteAddr = request.getRemoteAddr(); } InetAddress remoteInetAddress = InetAddress.getByName(remoteAddr); for (String part : parts) { if (part.equals(remoteAddr)) { return true; } if (part.contains("/")) { CIDRUtils cidrUtil = new CIDRUtils(part); if (cidrUtil.isInRange(remoteInetAddress)) { return true; } } else if (remoteInetAddress.equals(InetAddress.getByName(part))) { return true; } } } catch (UnknownHostException | IllegalArgumentException e) { log.warn("Ignoring illegal IP address or CIDR range "); } } return false; }
Source:
<code><START> final public void end() { <END> onEnd(); if (previous != null && (!previous.isScheduled())) { previous.schedule(); } }</code><technical_language>public final</technical_language>

Target:
public final void end() { onEnd(); if (previous != null && !previous.isScheduled()) { previous.schedule(); } }
Source:
<code>public IssueBacklog(IProject project, IUserSession userSession) { m_project = new ProjectObject(); <START> m_project.setNickName(project.getName()); <END> m_userSession = userSession; m_config = new Configuration(m_userSession); }</code><technical_language>setName(newName)</technical_language>

Target:
public IssueBacklog(IProject project, IUserSession userSession) { m_project = new ProjectObject(project.getName()); m_userSession = userSession; m_config = new Configuration(m_userSession); }
Source:
<code>FilterBuilder getTagKeyFilter(final TagKeyFilter filter, final boolean nested) { final FilterBuilder builder = FilterBuilders.boolFilter(); if (filter instanceof TagKeyLiteralOrFilter) { ((BoolFilterBuilder) builder).must(FilterBuilders.regexpFilter (QUERY_TAG_VALUE_KEY, "" + <START> ".*")) <END> .must(FilterBuilders.termFilter(QUERY_TAG_KEY_KEY, filter.filter())); } else if (filter instanceof TagKeyRegexFilter) { ((BoolFilterBuilder) builder).must(FilterBuilders.regexpFilter(QUERY_TAG_VALUE_KEY, ".*")) .must(FilterBuilders.regexpFilter(QUERY_TAG_KEY_KEY, filter.filter())); } if (nested) { return FilterBuilders.nestedFilter(TAG_PATH, builder); } return builder; }</code><technical_language>clean empty quotes new line</technical_language>

Target:
FilterBuilder getTagKeyFilter(final TagKeyFilter filter, final boolean nested) { final FilterBuilder builder = FilterBuilders.boolFilter(); if (filter instanceof TagKeyLiteralOrFilter) { ((BoolFilterBuilder) builder).must(FilterBuilders.regexpFilter (QUERY_TAG_VALUE_KEY, ".*")) .must(FilterBuilders.termFilter(QUERY_TAG_KEY_KEY, filter.filter())); } else if (filter instanceof TagKeyRegexFilter) { ((BoolFilterBuilder) builder).must(FilterBuilders.regexpFilter(QUERY_TAG_VALUE_KEY, ".*")) .must(FilterBuilders.regexpFilter(QUERY_TAG_KEY_KEY, filter.filter())); } if (nested) { return FilterBuilders.nestedFilter(TAG_PATH, builder); } return builder; }
Source:
<code>public void patchGroupWithParentUnprocessable() throws Exception { <START> context.turnOffAuthorisationSystem(); <END> EPerson reviewer1 = EPersonBuilder.createEPerson(context) .withEmail("reviewer1@example.com") .withPassword(password) .build(); parentCommunity = CommunityBuilder.createCommunity(context) .withName("Parent Community") .build(); Community child1 = CommunityBuilder.createSubCommunity(context, parentCommunity) .withName("Sub Community") .build(); Collection col1 = CollectionBuilder.createCollection(context, child1) .withName("Collection 1") .withWorkflowGroup(1, admin, reviewer1) .build(); final Group workflowGroup = col1.getWorkflowStep1(context); final String name = workflowGroup.getName(); String token = getAuthToken(admin.getEmail(), password); String requestBody = " [\n" + " {\n" + " \"op\": \"replace\",\n" + " \"path\": \"/name\",\n" + " \"value\": \"new name\"\n" + " }\n" + " ]"; getClient(token) .perform(patch("/api/eperson/groups/" + workflowGroup.getID()).content(requestBody) .contentType(MediaType.APPLICATION_JSON_PATCH_JSON)) .andExpect(status().isUnprocessableEntity()); getClient(token) .perform(get("/api/eperson/groups/" + workflowGroup.getID())) .andExpect(status().isOk()) .andExpect(jsonPath("$", Matchers.is( GroupMatcher.matchGroupEntry(workflowGroup.getID(), name)) )); }</code><technical_language>This method is missing a context.restoreAuthSystemState();</technical_language>

Target:
public void patchGroupWithParentUnprocessable() throws Exception { context.turnOffAuthorisationSystem(); EPerson reviewer1 = EPersonBuilder.createEPerson(context) .withEmail("reviewer1@example.com") .withPassword(password) .build(); parentCommunity = CommunityBuilder.createCommunity(context) .withName("Parent Community") .build(); Community child1 = CommunityBuilder.createSubCommunity(context, parentCommunity) .withName("Sub Community") .build(); Collection col1 = CollectionBuilder.createCollection(context, child1) .withName("Collection 1") .withWorkflowGroup(1, admin, reviewer1) .build(); final Group workflowGroup = col1.getWorkflowStep1(context); final String name = workflowGroup.getName(); context.restoreAuthSystemState(); String token = getAuthToken(admin.getEmail(), password); List<Operation> ops = new ArrayList<>(); ReplaceOperation replaceOperation = new ReplaceOperation("/name", "new name"); ops.add(replaceOperation); String requestBody = getPatchContent(ops); getClient(token) .perform(patch("/api/eperson/groups/" + workflowGroup.getID()).content(requestBody) .contentType(MediaType.APPLICATION_JSON_PATCH_JSON)) .andExpect(status().isUnprocessableEntity()); getClient(token) .perform(get("/api/eperson/groups/" + workflowGroup.getID())) .andExpect(status().isOk()) .andExpect(jsonPath("$", Matchers.is( GroupMatcher.matchGroupEntry(workflowGroup.getID(), name)) )); }
Source:
<code>public void addInformation(ItemStack stack, @Nullable World worldIn, List<String> tooltip, ITooltipFlag flagIn) { <START> if (stack.getTagCompound() == null){ <END> stack.setTagInfo("baton_mode", stack.serializeNBT()); stack.getTagCompound().setByte("baton_mode", (byte) BatonMode.CLEAR_COMMAND.ordinal()); } String keyText, text; text = "RMB" + " = " + I18n.format("guistrings.npc.baton.add_remove"); tooltip.add(text); keyText = InputHandler.ALT_ITEM_USE_1.getDisplayName(); BatonMode mode = BatonMode.values()[stack.getTagCompound().getByte("baton_mode")]; text = keyText + " = " + "Execute Command: " + I18n.format(mode.getTranslationKey()); tooltip.add(text); keyText = InputHandler.ALT_ITEM_USE_2.getDisplayName(); text = keyText + " = " + "Lock/Unlock Hotbar, use scroll wheel to change mode when locked"; tooltip.add(text); }</code><technical_language>this !stack.hasTagCompound()</technical_language>

Target:
public void addInformation(ItemStack stack, @Nullable World worldIn, List<String> tooltip, ITooltipFlag flagIn) { if (!stack.hasTagCompound()){ stack.setTagInfo("baton_mode", new NBTBuilder().setString("baton_mode", BatonMode.getDefault().getTranslationKey()).build()); stack.setTagInfo("scroll_lock", new NBTBuilder().setBoolean("scroll_lock", false).build()); } String keyText, text; text = "RMB" + " = " + I18n.format("guistrings.npc.baton.add_remove"); tooltip.add(text); keyText = InputHandler.ALT_ITEM_USE_1.getDisplayName(); ; text = keyText + " = " + "Execute Command: " + I18n.format(getMode(stack).getTranslationKey()); tooltip.add(text); keyText = InputHandler.ALT_ITEM_USE_2.getDisplayName(); text = keyText + " = " + "Lock/Unlock Hotbar, use scroll wheel to change mode when locked"; tooltip.add(text); }
Source:
<code>static void testFailed(String name, Throwable exception) { <START> String message = "Test starting: " + name; <END> consoleLog(message); log.error(message, exception); failed.incrementAndGet(); printStatus(); }</code><technical_language>"Test starting: " -> "Test failed: "</technical_language>

Target:
static void testFailed(String name, Throwable exception) { String message = "Test failed: " + name; consoleLog(message); log.error(message, exception); failed.incrementAndGet(); printStatus(); }
Source:
<code>public DiagnosticReport getDiagnosticReport(final String accessionNumber) { loadHandlerMap(); List<Order> orders = dao.getOrdersByAccessionNumber(accessionNumber); <START> if (orders != null && !orders.isEmpty()) { <END> Order order = orders.get(0); String handlerName = orderTypeToHandlerNameMap.get(order.getOrderType().getName()); if (StringUtils.isEmpty(handlerName)) { handlerName = orderTypeToHandlerNameMap.get(DEFAULT_HANDLER); } return FHIRDiagnosticReportUtil.getFHIRDiagnosticReport(order.getUuid(), getHandler(handlerName)); } else { throw new APIException("Can not identify order by accession number"); } }</code><technical_language>I curious. difference **orders != null !orders.isEmpty()**</technical_language>

Target:
public DiagnosticReport getDiagnosticReport(final String accessionNumber) { loadHandlerMap(); List<Order> orders = dao.getOrdersByAccessionNumber(accessionNumber); if (!orders.isEmpty()) { Order order = orders.get(0); String handlerName = orderTypeToHandlerNameMap.get(order.getOrderType().getName()); if (StringUtils.isEmpty(handlerName)) { handlerName = orderTypeToHandlerNameMap.get(DEFAULT_HANDLER); } return FHIRDiagnosticReportUtil.getFHIRDiagnosticReport(order.getUuid(), getHandler(handlerName)); } else { throw new APIException("Can not identify order by accession number"); } }
Source:
<code>protected void uploadIndividuals(String embeddedVP, FilePath[] paths, FilePath workspace) throws WAStorageException { final UploadServiceData serviceData = getServiceData(); try { final CloudBlobContainer container = getCloudBlobContainer(); List<UploadObject> uploadObjects = new ArrayList<>(); for (FilePath src : paths) { final String blobPath = getItemPath(src, embeddedVP); final CloudBlockBlob blob = container.getBlockBlobReference(blobPath); configureBlobPropertiesAndMetadata(blob, src); <START> StorageAccountInfo accountInfo = serviceData.getStorageAccountInfo(); <END> String sas = generateWriteSASURL(accountInfo, blob.getName(), Constants.BLOB_STORAGE, container.getName()); String blobURL = blob.getUri().toString().replace("http://", "https://"); UploadObject uploadObject = new UploadObject(blob.getName(), src, blobURL, sas, Constants.BLOB_STORAGE, blob.getServiceClient().getCredentials().getAccountName(), blob.getProperties(), blob.getMetadata()); uploadObjects.add(uploadObject); } UploadOnSlave uploadOnSlave = new UploadOnSlave(uploadObjects); List<Future<UploadResult>> results = workspace.act(uploadOnSlave); updateAzureBlobs(results, serviceData.getIndividualBlobs()); } catch (Exception e) { String storageAcc = AppInsightsUtils.hash(serviceData.getStorageAccountInfo().getStorageAccName()); AzureStoragePlugin.sendEvent(AppInsightsConstants.AZURE_BLOB_STORAGE, UPLOAD_FAILED, "StorageAccount", storageAcc, "Message", e.getMessage()); throw new WAStorageException("Fail to upload archive to blob", e); } }</code><technical_language>reusable code line 79 - line 92</technical_language>

Target:
protected void uploadIndividuals(String embeddedVP, FilePath[] paths, FilePath workspace) throws WAStorageException { final UploadServiceData serviceData = getServiceData(); try { final CloudBlobContainer container = getCloudBlobContainer(); List<UploadObject> uploadObjects = new ArrayList<>(); for (FilePath src : paths) { final String blobPath = getItemPath(src, embeddedVP); final CloudBlockBlob blob = container.getBlockBlobReference(blobPath); configureBlobPropertiesAndMetadata(blob, src); UploadObject uploadObject = generateUploadObject(src, serviceData.getStorageAccountInfo(), blob, container.getName()); uploadObjects.add(uploadObject); } UploadOnSlave uploadOnSlave = new UploadOnSlave(uploadObjects); List<Future<UploadResult>> results = workspace.act(uploadOnSlave); updateAzureBlobs(results, serviceData.getIndividualBlobs()); } catch (Exception e) { String storageAcc = AppInsightsUtils.hash(serviceData.getStorageAccountInfo().getStorageAccName()); AzureStoragePlugin.sendEvent(AppInsightsConstants.AZURE_BLOB_STORAGE, UPLOAD_FAILED, "StorageAccount", storageAcc, "Message", e.getMessage()); throw new WAStorageException("Fail to upload archive to blob", e); } }
Source:
<code>public void testConcurrentListenerAddAndRemove(Method method) throws InterruptedException, ExecutionException { String counterName = method.getName(); defineAndCreateCounter(counterName, 1); List<T> counters = getCounters(counterName); List<IncrementTask> taskList = counters.stream() .map(IncrementTask::new) .collect(Collectors.toList()); List<Future<?>> futureTaskList = taskList.stream() .map(this::fork) .collect(Collectors.toList()); T counter = counters.get(0); Handle<BaseCounterImplTest.EventLogger> handle = addListenerTo(counter, new BaseCounterImplTest.EventLogger()); <START> Thread.sleep(1000); <END> handle.remove(); taskList.forEach(IncrementTask::stop); futureTaskList.forEach(this::awaitFuture); drainAndCheckEvents(handle); assertNoEvents(handle); increment(counter); assertNoEvents(handle); }</code><technical_language>-(</technical_language>

Target:
public void testConcurrentListenerAddAndRemove(Method method) throws InterruptedException, ExecutionException { String counterName = method.getName(); defineAndCreateCounter(counterName, 1); List<T> counters = getCounters(counterName); List<IncrementTask> taskList = counters.stream() .map(IncrementTask::new) .collect(Collectors.toList()); List<Future<?>> futureTaskList = taskList.stream() .map(this::fork) .collect(Collectors.toList()); T counter = counters.get(0); Handle<BaseCounterImplTest.EventLogger> handle = addListenerTo(counter, new BaseCounterImplTest.EventLogger()); eventually(() -> handle.getCounterListener().size() > 5); handle.remove(); taskList.forEach(IncrementTask::stop); futureTaskList.forEach(this::awaitFuture); drainAndCheckEvents(handle); assertNoEvents(handle); increment(counter); assertNoEvents(handle); }
Source:
<code>public void testInputKinds() { Service service = connect(); InputCollection inputs = service.getInputs(); Set<InputKind> kinds = inputs.getInputKinds(); <START> boolean hasTest2 = false; <END> for (InputKind ik : kinds) { if (ik.kind == "test2") { hasTest2 = true; } } }</code><technical_language>This variable is written read</technical_language>

Target:
@Test public void testInputKinds() { Service service = connect(); InputCollection inputs = service.getInputs(); Set<InputKind> kinds = inputs.getInputKinds(); boolean hasTest2 = false; for (InputKind ik : kinds) { if (ik.getKind() == "test2") { hasTest2 = true; } } SplunkTestCase.assertTrue(hasTest2); }
Source:
<code>public TaskInfo( String taskName, int maxNumberOfParallelSubtasks, int indexOfSubtask, int numberOfParallelSubtasks, int attemptNumber, String allocationIDAsString) { checkArgument(indexOfSubtask >= 0, "Task index must be a non-negative number."); checkArgument(maxNumberOfParallelSubtasks >= 1, "Max parallelism must be a positive number."); checkArgument(maxNumberOfParallelSubtasks >= numberOfParallelSubtasks, "Max parallelism must be >= than parallelism."); checkArgument(numberOfParallelSubtasks >= 1, "Parallelism must be a positive number."); checkArgument(indexOfSubtask < numberOfParallelSubtasks, "Task index must be less than parallelism."); checkArgument(attemptNumber >= 0, "Attempt number must be a non-negative number."); this.taskName = checkNotNull(taskName, "Task Name must not be null."); this.maxNumberOfParallelSubtasks = maxNumberOfParallelSubtasks; this.indexOfSubtask = indexOfSubtask; this.numberOfParallelSubtasks = numberOfParallelSubtasks; this.attemptNumber = attemptNumber; <START> this.taskNameWithSubtasks = taskName + " (" + (indexOfSubtask + 1) + '/' + numberOfParallelSubtasks + ')' + " - execution #" + attemptNumber; <END> this.allocationIDAsString = checkNotNull(allocationIDAsString); }</code><technical_language>In order blow length of messages much, append + "#" + attemptNumber? all: - other components named - reminding million times in a single log this is execution overkill ;)</technical_language>

Target:
public TaskInfo( String taskName, int maxNumberOfParallelSubtasks, int indexOfSubtask, int numberOfParallelSubtasks, int attemptNumber, String allocationIDAsString) { checkArgument(indexOfSubtask >= 0, "Task index must be a non-negative number."); checkArgument(maxNumberOfParallelSubtasks >= 1, "Max parallelism must be a positive number."); checkArgument(maxNumberOfParallelSubtasks >= numberOfParallelSubtasks, "Max parallelism must be >= than parallelism."); checkArgument(numberOfParallelSubtasks >= 1, "Parallelism must be a positive number."); checkArgument(indexOfSubtask < numberOfParallelSubtasks, "Task index must be less than parallelism."); checkArgument(attemptNumber >= 0, "Attempt number must be a non-negative number."); this.taskName = checkNotNull(taskName, "Task Name must not be null."); this.maxNumberOfParallelSubtasks = maxNumberOfParallelSubtasks; this.indexOfSubtask = indexOfSubtask; this.numberOfParallelSubtasks = numberOfParallelSubtasks; this.attemptNumber = attemptNumber; this.taskNameWithSubtasks = taskName + " (" + (indexOfSubtask + 1) + '/' + numberOfParallelSubtasks + ')' + "#" + attemptNumber; this.allocationIDAsString = checkNotNull(allocationIDAsString); }
Source:
<code>public ActivationKeyDTO setContentOverrides(Set<ActivationKeyContentOverrideDTO> contentOverrides) { if (contentOverrides != null) { if (this.contentOverrides == null) { this.contentOverrides = new HashSet<ActivationKeyContentOverrideDTO>(); } else { this.contentOverrides.clear(); } for (ActivationKeyContentOverrideDTO dto : contentOverrides) { if (dto == null || <START> dto.getContentLabel() == null || "".equals(dto.getContentLabel()) || <END> dto.getName() == null || "".equals(dto.getName()) || dto.getValue() == null || "".equals(dto.getValue())) { throw new IllegalArgumentException("collection contains null or incomplete dtos"); } this.contentOverrides.add( new ActivationKeyContentOverrideDTO( dto.getContentLabel(), dto.getName(), dto.getValue())); } } else { this.contentOverrides = null; } return this; }</code><technical_language>here: .isEmpty() .equals for empty checks</technical_language>

Target:
public ActivationKeyDTO setContentOverrides(Set<ActivationKeyContentOverrideDTO> contentOverrides) { if (contentOverrides != null) { if (this.contentOverrides == null) { this.contentOverrides = new HashSet<ActivationKeyContentOverrideDTO>(); } else { this.contentOverrides.clear(); } for (ActivationKeyContentOverrideDTO dto : contentOverrides) { if (isNullOrIncomplete(dto)) { throw new IllegalArgumentException("collection contains null " + "or incomplete content override"); } this.contentOverrides.add( new ActivationKeyContentOverrideDTO( dto.getContentLabel(), dto.getName(), dto.getValue())); } } else { this.contentOverrides = null; } return this; }
Source:
<code>private void run(String[] args) throws Exception { this.config = MaxwellConfig.buildConfig("config.properties", args); SchemaStore.createMaxwellSchema(this.config.getMasterConnection()); <START> <END> if ( this.config.getInitialPosition() != null ) { LOGGER.info("Maxwell is booting, starting at " + this.config.getInitialPosition()); SchemaStore store = SchemaStore.restore(this.config.getMasterConnection(), this.config.getInitialPosition()); this.schema = store.getSchema(); } else { initFirstRun(); } AbstractProducer producer = this.config.getProducer(); MaxwellParser p = new MaxwellParser(this.schema, producer); p.setConfig(this.config); p.run(); }</code><technical_language>understand this. This needs happen right? right place in run</technical_language>

Target:
private void run(String[] args) throws Exception { this.config = MaxwellConfig.buildConfig("config.properties", args); SchemaStore.ensureMaxwellSchema(this.config.getMasterConnection()); if ( this.config.getInitialPosition() != null ) { LOGGER.info("Maxwell is booting, starting at " + this.config.getInitialPosition()); SchemaStore store = SchemaStore.restore(this.config.getMasterConnection(), this.config.getInitialPosition()); this.schema = store.getSchema(); } else { initFirstRun(); } AbstractProducer producer = this.config.getProducer(); MaxwellParser p = new MaxwellParser(this.schema, producer); p.setConfig(this.config); p.run(); }
Source:
<code>public void forbidsNonPublicCloneMethod() throws Exception { <START> final String file = "CloneMethodMustBePublic.java"; <END> new PMDAssert( file, Matchers.is(false), Matchers.containsString( String.format( PMDValidatorTest.BRACKETS, "CloneMethodMustBePublic" ) ) ).validate(); }</code><technical_language>@Happy-Neko inline this variable</technical_language>

Target:
public void forbidsNonPublicCloneMethod() throws Exception { new PMDAssert( "CloneMethodMustBePublic.java", Matchers.is(false), Matchers.containsString( String.format( PMDValidatorTest.BRACKETS, "CloneMethodMustBePublic" ) ) ).validate(); }
Source:
<code>public void testTokenFetch() { long millis = System.currentTimeMillis(); final String username = "someusername" + millis; final String password = "somepassword" + millis; final String repeat = password; new AMLoginInfoTask() { @Override public void onCatch(Throwable caught) { L.e(caught); fail(); } @Override public void onFinish(AMLoginInfoResult result) { if (result.getEnabled()) { L.i("Logging in with AuthManager"); isAuthManagerEnabled = true; amSubject = new AMSubject(username, password, repeat, null); amSubject.execute(); } else { L.i("Logging in with legacy login"); legacySubject = new Subject(username, password, null); legacySubject.execute(); } } }.execute(); <START> CompatCreateAccountResult result = isAuthManagerEnabled ? amSubject.await() <END> : legacySubject.await(); handleCreateAccountResult(result); }</code><technical_language>subject initialized callback returns. this lose race NPE? I this solved making AMLoginInfoTask subclass provides latching mechanisms AMSubject Subject. code (super approximately): LoginInfo info = new LoginInfo(); info.execute(); info.await(); assertThat(info.result(), ...); // more approximate if (info.legacyAuth()) { Subject subject = new Subject(username, password, null); subject.execute(); subject.await(); assertThat(subject.result(), ...); } else { AMSubject subject = new AMSubject(username, password, null); subject.execute(); subject.await(); assertThat(subject.result(), ...); }</technical_language>

Target:
public void testTokenFetch() { long millis = System.currentTimeMillis(); CompatCreateAccountResult result; final String username = "someusername" + millis; final String password = "somepassword" + millis; loginInfo.execute(); loginInfo.await(); if (isAuthManagerEnabled) { AMSubject amSubject = new AMSubject(username, password, password, null); amSubject.execute(); result = amSubject.await(); } else { Subject subject = new Subject(username, password, null); subject.execute(); result = subject.await(); } handleCreateAccountResult(result); }
Source:
<code>private boolean isInitialImageSizeSupported() { StoragePool storagePool = DbFacade.getInstance().getStoragePoolDao().get( getParameters().getStoragePoolId()); <START> return FeatureSupported.initialSizeSparseDiskSupported(storagePool.getCompatibilityVersion()); <END> }</code><technical_language>discussing this Arik Freddy, lets try cluster compatible</technical_language>

Target:
private boolean isInitialImageSizeSupported() { VDS vds = DbFacade.getInstance().getVdsDao().get(this.getCurrentIrsProxyData().getCurrentVdsId()); return FeatureSupported.initialSizeSparseDiskSupported(vds.getVdsGroupCompatibilityVersion()); }
Source:
<code>final List<FindReplace> commentlinks() { JsArray<CommentLinkInfo> cls = commentlinks0().values(); List<FindReplace> commentLinks = new ArrayList<FindReplace>(cls.length()); for (int i = 0; i < cls.length(); i++) { CommentLinkInfo cl = cls.get(i); if (!cl.enabled()) { continue; } if (cl.link() != null) { commentLinks.add(new LinkFindReplace(cl.match(), cl.link())); } else { try { FindReplace fr = new RawFindReplace(cl.match(), cl.html()); commentLinks.add(fr); } catch (RuntimeException e) { new <START> ErrorDialog(e.getMessage()).center(); <END> } } } return commentLinks; }</code><technical_language>message is long. Do want put UI</technical_language>

Target:
final List<FindReplace> commentlinks() { JsArray<CommentLinkInfo> cls = commentlinks0().values(); List<FindReplace> commentLinks = new ArrayList<FindReplace>(cls.length()); for (int i = 0; i < cls.length(); i++) { CommentLinkInfo cl = cls.get(i); if (!cl.enabled()) { continue; } if (cl.link() != null) { commentLinks.add(new LinkFindReplace(cl.match(), cl.link())); } else { try { FindReplace fr = new RawFindReplace(cl.match(), cl.html()); commentLinks.add(fr); } catch (RuntimeException e) { int index = e.getMessage().indexOf("at Object"); new ErrorDialog(index == -1 ? e.getMessage() : e.getMessage().substring(0, index)).center(); } } } return commentLinks; }
Source:
<code>public Optional<BibEntry> performSearchById(String identifier) throws FetcherException { Optional<DOI> doi = DOI.parse(identifier); String agency = ""; try { <START> if (doi.isPresent()) { <END> Optional<BibEntry> fetchedEntry; if (getAgency(doi.get()).isPresent() && "medra".equalsIgnoreCase(getAgency(doi.get()).get())) { fetchedEntry = new Medra().performSearchById(identifier); } else { URL doiURL = new URL(doi.get().getURIAsASCIIString()); URLDownload download = new URLDownload(doiURL); download.addHeader("Accept", MediaTypes.APPLICATION_BIBTEX); String bibtexString = download.asString(); fetchedEntry = BibtexParser.singleFromString(bibtexString, preferences, new DummyFileUpdateMonitor()); fetchedEntry.ifPresent(this::doPostCleanup); } return fetchedEntry; } else { throw new FetcherException(Localization.lang("Invalid DOI: '%0'.", identifier)); } } catch (IOException e) { throw new FetcherException(Localization.lang("Connection error"), e); } catch (ParseException e) { throw new FetcherException("Could not parse BibTeX entry", e); } catch (JSONException e) { throw new FetcherException("Could not retrieve Registration Agency", e); } }</code><technical_language>is .orElseThrow(...) in optionals. Rewriting is difficult here. touched code, importance here</technical_language>

Target:
public Optional<BibEntry> performSearchById(String identifier) throws FetcherException { Optional<DOI> doi = DOI.parse(identifier); try { if (doi.isPresent()) { Optional<BibEntry> fetchedEntry; if (doi.get().getAgency().isPresent() && "medra".equalsIgnoreCase(doi.get().getAgency().get())) { return new Medra().performSearchById(identifier); } URL doiURL = new URL(doi.get().getURIAsASCIIString()); URLDownload download = getUrlDownload(doiURL); download.addHeader("Accept", MediaTypes.APPLICATION_BIBTEX); String bibtexString = download.asString(); fetchedEntry = BibtexParser.singleFromString(bibtexString, preferences, new DummyFileUpdateMonitor()); fetchedEntry.ifPresent(this::doPostCleanup); return fetchedEntry; } else { throw new FetcherException(Localization.lang("Invalid DOI: '%0'.", identifier)); } } catch (IOException e) { throw new FetcherException(Localization.lang("Connection error"), e); } catch (ParseException e) { throw new FetcherException("Could not parse BibTeX entry", e); } catch (JSONException e) { throw new FetcherException("Could not retrieve Registration Agency", e); } }
Source:
<code>public void getEligibleVolumes() { this.startProgress(constants.fetchingDataMessage()); AsyncQuery aQuery = new AsyncQuery(new INewAsyncCallback() { @Override public void onSuccess(Object model, Object returnValue) { GlusterVolumeGeoRepCreateModel.this.stopProgress(); VdcQueryReturnValue vdcReturnValue = (VdcQueryReturnValue) returnValue; if(!vdcReturnValue.getSucceeded()) { setQueryFailureMessage(vdcReturnValue.getExceptionString()); onPropertyChanged(new PropertyChangedEventArgs("queryFailed")); } else { List<GlusterVolumeEntity> eligibleVolumesList = (List<GlusterVolumeEntity>) vdcReturnValue.getReturnValue(); <START> recommendationViolations = null; <END> setVolumeList(eligibleVolumesList); getSlaveClusters().setItems(GlusterVolumeGeoRepCreateModel.this.getClusterForVolumes(eligibleVolumesList)); } } }); Frontend.getInstance().runQuery(VdcQueryType.GetGlusterGeoReplicationEligibleVolumes, new IdQueryParameters(masterVolume.getId()), aQuery); }</code><technical_language>setter</technical_language>

Target:
public void getEligibleVolumes() { this.startProgress(constants.fetchingDataMessage()); AsyncQuery aQuery = new AsyncQuery(new INewAsyncCallback() { @Override public void onSuccess(Object model, Object returnValue) { GlusterVolumeGeoRepCreateModel.this.stopProgress(); VdcQueryReturnValue vdcReturnValue = (VdcQueryReturnValue) returnValue; if(!vdcReturnValue.getSucceeded()) { setQueryFailureMessage(vdcReturnValue.getExceptionString()); } else { List<GlusterVolumeEntity> eligibleVolumesList = (List<GlusterVolumeEntity>) vdcReturnValue.getReturnValue(); setRecommendationViolations(null); setVolumeList(eligibleVolumesList); getSlaveClusters().setItems(GlusterVolumeGeoRepCreateModel.this.getClusterForVolumes(eligibleVolumesList)); } } }); Frontend.getInstance().runQuery(VdcQueryType.GetGlusterGeoReplicationEligibleVolumes, new IdQueryParameters(masterVolume.getId()), aQuery); }
Source:
<code><START> private String buildPasswordString() { <END> int len = text.get().length(); StringBuilder b = new StringBuilder(len); for (int i = 0; i < len; i++) { b.append("*"); } return b.toString(); }</code><technical_language>this snippet if char[] arr = new char[33]; Arrays.fill(arr, '*'); String str = String.valueOf(arr);</technical_language>

Target:
private String buildPasswordString() { char[] arr = new char[text.get().length()]; Arrays.fill(arr, '*'); return String.valueOf(arr); }
Source:
<code>private final JDBC2RecoveryConnection getConnection () throws SQLException { String number = new String("" + connectionIndex); String url = new String(dbTag + number + urlTag); String password = new String(dbTag + number + passwordTag); String user = new String(dbTag + number + userTag); String dynamicClass = new String(dbTag + number + dynamicClassTag); Properties dbProperties = new Properties(); String theUser = props.getProperty(user); String thePassword = props.getProperty(password); String theURL = props.getProperty(url); if (theUser != null) { dbProperties.put(TransactionalDriver.userName, theUser); dbProperties.put(TransactionalDriver.password, thePassword); String dc = props.getProperty(dynamicClass); if (dc != null) dbProperties.put(TransactionalDriver.dynamicClass, dc); JDBC2RecoveryConnection connection = new JDBC2RecoveryConnection(theURL, dbProperties); <START> connections.add(connection); <END> return connection; } else return null; }</code><technical_language>connections collection is this change is superfluous</technical_language>

Target:
private final JDBC2RecoveryConnection getConnection () throws SQLException { if (connections[connectionIndex] == null) { String number = new String(""+ (connectionIndex + 1)); String url = new String(dbTag + number + urlTag); String password = new String(dbTag + number + passwordTag); String user = new String(dbTag + number + userTag); String dynamicClass = new String(dbTag + number + dynamicClassTag); Properties dbProperties = new Properties(); String theUser = props.getProperty(user); String thePassword = props.getProperty(password); String theURL = props.getProperty(url); if (theUser != null) { dbProperties.put(TransactionalDriver.userName, theUser); dbProperties.put(TransactionalDriver.password, thePassword); String dc = props.getProperty(dynamicClass); if (dc != null) dbProperties.put(TransactionalDriver.dynamicClass, dc); JDBC2RecoveryConnection connection = new JDBC2RecoveryConnection(theURL, dbProperties); connections[connectionIndex] = connection; return connection; } else { jdbcLogger.i18NLogger.warn_recovery_basic_xarec("BasicXARecovery.getConnection -"); throw new SQLException(jdbcLogger.i18NLogger.insufficientConnectionInformation()); } } return connections[connectionIndex]; }
Source:
<code>public void predicateFullTextTerm(String term, String fuzzyFlop) { ensureLeftSideIsAPropertyPath(); PropertyPath<TypeDescriptor<TypeMetadata>> property = resolveAlias(propertyPath); if (property.isEmpty()) { throw log.getPredicatesOnEntityAliasNotAllowedException(propertyPath.asStringPath()); } <START> checkAnalyzed(property,true); <END> Object comparisonObject = parameterValue(term); if (phase == Phase.WHERE) { checkAnalyzed(property, true); whereBuilder.addFullTextTerm(property, comparisonObject.toString(), fuzzyFlop == null ? null : (fuzzyFlop.equals("~") ? 2 : Integer.parseInt(fuzzyFlop))); } else if (phase == Phase.HAVING) { throw log.getFullTextQueriesNotAllowedInHavingClauseException(); } else { throw new IllegalStateException(); } }</code><technical_language>checkAnalyzed(property,true); if statement already. do need too</technical_language>

Target:
public void predicateFullTextTerm(String term, String fuzzyFlop) { ensureLeftSideIsAPropertyPath(); PropertyPath<TypeDescriptor<TypeMetadata>> property = resolveAlias(propertyPath); if (property.isEmpty()) { throw log.getPredicatesOnEntityAliasNotAllowedException(propertyPath.asStringPath()); } if (phase == Phase.WHERE) { checkAnalyzed(property, true); Object comparisonObject = parameterValue(term); whereBuilder.addFullTextTerm(property, comparisonObject.toString(), fuzzyFlop == null ? null : (fuzzyFlop.equals("~") ? 2 : Integer.parseInt(fuzzyFlop))); } else if (phase == Phase.HAVING) { throw log.getFullTextQueriesNotAllowedInHavingClauseException(); } else { throw new IllegalStateException(); } }
Source:
<code>private boolean hasStudentReceivedReminder(String courseName, String courseId, String studentEmail) throws Exception { RetryManager retryManager = new RetryManager(3); return retryManager.runUntilSuccessful(new RetryableTaskReturns<Boolean>("Received email") { String keyToSend; String keyReceivedInEmail; boolean isDoneExecuting; @Override public Boolean run() throws RuntimeException { <START> keyToSend = BackDoor.getEncryptedKeyForStudent(courseId, studentEmail); <END> try { keyReceivedInEmail = EmailAccount.getRegistrationKeyFromGmail(studentEmail, courseName, courseId); isDoneExecuting = true; } catch (Exception e) { isDoneExecuting = false; e.printStackTrace(); } return keyToSend.equals(keyReceivedInEmail); } @Override public boolean isSuccessful(Boolean result) { return isDoneExecuting; } }); }</code><technical_language>this constant? is a need put this in run()</technical_language>

Target:
private boolean hasStudentReceivedReminder(String courseName, String courseId, String studentEmail) throws Exception { String keyToSend = BackDoor.getEncryptedKeyForStudent(courseId, studentEmail); RetryManager retryManager = new RetryManager(5); String keyReceivedInEmail = retryManager.runUntilSuccessful( new RetryableTaskReturnsThrows<String, Exception>("Retrieve registration key") { @Override public String run() throws IOException, MessagingException { return EmailAccount.getRegistrationKeyFromGmail(studentEmail, courseName, courseId); } @Override public boolean isSuccessful(String result) { return result != null; } }); return keyToSend.equals(keyReceivedInEmail); }
Source:
<code>public void testLoadOrderedPublicEvents_7() throws Throwable { UserDetails user = new OAuth2TestUtils.UserBuilder("jack_bauer", "0x24") .withAuthorization(Group.FREE_GROUP_NAME, "tempRole", Permission.BACKOFFICE).build(); String accessToken = mockOAuthInterceptor(user); ResultActions result = mockMvc .perform(get("/plugins/cms/contents") .param("status", IContentService.STATUS_ONLINE) .param("sort", IContentManager.CONTENT_FIRST_EDITOR_FILTER_KEY) .param("direction", FieldSearchFilter.DESC_ORDER) .param("filters[0].attribute", IContentManager.ENTITY_TYPE_CODE_FILTER_KEY) .param("filters[0].operator", "eq") .param("filters[0].value", "EVN") .sessionAttr("user", user) .header("Authorization", "Bearer " + accessToken)); <START> String bodyResult = result.andReturn().getResponse().getContentAsString(); result.andExpect(status().isOk()); String[] expectedFreeContentsId = {}; int payloadSize = JsonPath.read(bodyResult, "$.payload.size()"); Assert.assertEquals(expectedFreeContentsId.length, payloadSize); for (int i = 0; i < expectedFreeContentsId.length; i++) { String expectedId = expectedFreeContentsId[i]; String extractedId = JsonPath.read(bodyResult, "$.payload[" + i + "].id"); Assert.assertEquals(expectedId, extractedId); } <END> }</code><technical_language>Code style</technical_language>

Target:
public void testLoadOrderedPublicEvents_7() throws Throwable { UserDetails user = new OAuth2TestUtils.UserBuilder("jack_bauer", "0x24") .withAuthorization(Group.FREE_GROUP_NAME, "tempRole", Permission.BACKOFFICE).build(); String accessToken = mockOAuthInterceptor(user); ResultActions result = mockMvc .perform(get("/plugins/cms/contents") .param("status", IContentService.STATUS_ONLINE) .param("sort", IContentManager.CONTENT_FIRST_EDITOR_FILTER_KEY) .param("direction", FieldSearchFilter.DESC_ORDER) .param("filters[0].attribute", IContentManager.ENTITY_TYPE_CODE_FILTER_KEY) .param("filters[0].operator", "eq") .param("filters[0].value", "EVN") .sessionAttr("user", user) .header("Authorization", "Bearer " + accessToken)); result.andDo(print()) .andExpect(status().isOk()) .andExpect(jsonPath("$.payload.size()", is(0))); }
Source:
<code>public void visitField(PsiField field) { super.visitField(field); final PsiElement parent = field.getParent(); if (parent instanceof PsiClass) { final PsiClass clazz = (PsiClass) parent; <START> if (clazz.hasAnnotation("lombok.Value")) { <END> final PsiModifierList modifierList = field.getModifierList(); if (modifierList != null) { if (modifierList.hasExplicitModifier(PRIVATE)) { final Optional<PsiElement> psiPrivate = Arrays.stream(modifierList.getChildren()) .filter(psiElement -> psiElement.toString().contains("private")) .findFirst(); psiPrivate.ifPresent(psiElement -> holder.registerProblem(psiElement, "Redundant private field modifier", ProblemHighlightType.WARNING, new RemoveModifierFix(PRIVATE)) ); } if (modifierList.hasExplicitModifier(FINAL)) { final Optional<PsiElement> psiFinal = Arrays.stream(modifierList.getChildren()) .filter(psiElement -> psiElement.toString().contains("final")) .findFirst(); psiFinal.ifPresent(psiElement -> holder.registerProblem(psiElement, "Redundant final field modifier", ProblemHighlightType.WARNING, new RemoveModifierFix(PRIVATE)) ); } } } } }</code><technical_language>Please lombol.Value.class.getName() syntax</technical_language>

Target:
public void visitField(PsiField field) { super.visitField(field); final PsiElement parent = field.getParent(); if (parent instanceof PsiClass) { final PsiClass clazz = (PsiClass) parent; if (clazz.hasAnnotation(lombok.Value.class.getName())) { final PsiModifierList modifierList = field.getModifierList(); if (modifierList != null) { if (modifierList.hasExplicitModifier(PRIVATE)) { final Optional<PsiElement> psiPrivate = Arrays.stream(modifierList.getChildren()) .filter(psiElement -> PRIVATE.equals(psiElement.getText())) .findFirst(); psiPrivate.ifPresent(psiElement -> holder.registerProblem(psiElement, "Redundant private field modifier", ProblemHighlightType.WARNING, new RemoveModifierFix(PRIVATE)) ); } if (modifierList.hasExplicitModifier(FINAL)) { final Optional<PsiElement> psiFinal = Arrays.stream(modifierList.getChildren()) .filter(psiElement -> FINAL.equals(psiElement.getText())) .findFirst(); psiFinal.ifPresent(psiElement -> holder.registerProblem(psiElement, "Redundant final field modifier", ProblemHighlightType.WARNING, new RemoveModifierFix(FINAL)) ); } } } } }
Source:
<code>private String setButtonOrLink(JButton button, String desc, String label, String url) { boolean accessibleIDE = PreferencesData.getBoolean("ide.accessible"); String retString = desc; if (accessibleIDE) { button.setVisible(true); button.addActionListener(e -> { Base.openURL(url); }); } else { <START> retString += " " + format("<a href=\"{0}\">{1}</a>", url, label); <END> } return retString; }</code><technical_language>if extra space beginning is needed though... leave eventually tackle in a refactor uniform setButtonOrLink methods</technical_language>

Target:
private String setButtonOrLink(JButton button, String desc, String label, String url) { boolean accessibleIDE = PreferencesData.getBoolean("ide.accessible"); String retString = desc; if (accessibleIDE) { button.setVisible(true); button.addActionListener(e -> { Base.openURL(url); }); } else { retString += " " + format("<a href=\"{0}\">{1}</a><br/>", url, label); } return retString; }
Source:
<code><START> public static void validateHeaderConfigAction(String action) { <END> if (!HEADER_ACTIONS.stream().anyMatch(action::equalsIgnoreCase)) { throw new ConfigException(String.format("Invalid header config action: '%s'. " + "Expected one of %s", action, HEADER_ACTIONS)); } }</code><technical_language>This package-level protected: suggestion // Visible for testing static void validateHeaderConfigAction(String action) {</technical_language>

Target:
static void validateHeaderConfigAction(String action) { if (!HEADER_ACTIONS.stream().anyMatch(action::equalsIgnoreCase)) { throw new ConfigException(String.format("Invalid header config action: '%s'. " + "Expected one of %s", action, HEADER_ACTIONS)); } }
Source:
<code>public void testWithMergedRegions() throws Exception { final TableName tableName = TableName.valueOf(name.getMethodName()); MiniHBaseCluster cluster = TEST_UTIL.getHBaseCluster(); Admin admin = TEST_UTIL.getAdmin(); Table table = TEST_UTIL.getConnection().getTable(tableName); List<Put> puts = new ArrayList<>(); for (int i = 0; i < 10000; i++) { puts.add(new Put(Bytes.toBytes("rowkey_" + i)) .addColumn(Bytes.toBytes("fam1"), Bytes.toBytes("q1"), Bytes.toBytes("val_" + i))); } table.put(puts); admin.flush(tableName); HRegionServer regionServer = cluster.getRegionServer(0); String rsName = regionServer.getServerName().getAddress().toString(); int numRegions = regionServer.getNumberOfOnlineRegions(); List<HRegion> hRegions = regionServer.getRegions().stream() .filter(hRegion -> hRegion.getRegionInfo().getTable().equals(tableName)) .collect(Collectors.toList()); RegionMover.RegionMoverBuilder rmBuilder = new RegionMover.RegionMoverBuilder(rsName, TEST_UTIL.getConfiguration()).ack(true) <START> .maxthreads(2); <END> try (RegionMover rm = rmBuilder.build()) { LOG.debug("Unloading {}", regionServer.getServerName()); rm.unload(); Assert.assertEquals(0, regionServer.getNumberOfOnlineRegions()); LOG.debug("Successfully Unloaded, now Loading"); admin.mergeRegionsAsync(new byte[][] { hRegions.get(0).getRegionInfo().getRegionName(), hRegions.get(1).getRegionInfo().getRegionName() }, true) .get(5, TimeUnit.SECONDS); Assert.assertTrue(rm.load()); Assert.assertEquals(numRegions - 2, regionServer.getNumberOfOnlineRegions()); } }</code><technical_language>this change</technical_language>

Target:
public void testWithMergedRegions() throws Exception { final TableName tableName = TableName.valueOf(name.getMethodName()); MiniHBaseCluster cluster = TEST_UTIL.getHBaseCluster(); Admin admin = TEST_UTIL.getAdmin(); Table table = TEST_UTIL.getConnection().getTable(tableName); List<Put> puts = new ArrayList<>(); for (int i = 0; i < 10000; i++) { puts.add(new Put(Bytes.toBytes("rowkey_" + i)) .addColumn(Bytes.toBytes("fam1"), Bytes.toBytes("q1"), Bytes.toBytes("val_" + i))); } table.put(puts); admin.flush(tableName); HRegionServer regionServer = cluster.getRegionServer(0); String rsName = regionServer.getServerName().getAddress().toString(); int numRegions = regionServer.getNumberOfOnlineRegions(); List<HRegion> hRegions = regionServer.getRegions().stream() .filter(hRegion -> hRegion.getRegionInfo().getTable().equals(tableName)) .collect(Collectors.toList()); RegionMover.RegionMoverBuilder rmBuilder = new RegionMover.RegionMoverBuilder(rsName, TEST_UTIL.getConfiguration()).ack(true) .maxthreads(8); try (RegionMover rm = rmBuilder.build()) { LOG.debug("Unloading {}", regionServer.getServerName()); rm.unload(); Assert.assertEquals(0, regionServer.getNumberOfOnlineRegions()); LOG.debug("Successfully Unloaded, now Loading"); admin.mergeRegionsAsync(new byte[][] { hRegions.get(0).getRegionInfo().getRegionName(), hRegions.get(1).getRegionInfo().getRegionName() }, true) .get(5, TimeUnit.SECONDS); Assert.assertTrue(rm.load()); Assert.assertEquals(numRegions - 2, regionServer.getNumberOfOnlineRegions()); } }
Source:
<code>public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } final SentMessageTrace other = (SentMessageTrace) obj; <START> return Objects.equals(this.messageId, other.messageId) <END> && Objects.equals(this.timestamp, other.timestamp) && Objects.equals(this.subscription, other.subscription) && Objects.equals(this.reason, other.reason) && Objects.equals(this.partition, other.partition) && Objects.equals(this.offset, other.offset) && Objects.equals(this.topicName, other.topicName) && Objects.equals(this.message, other.message) && Objects.equals(this.status, other.status) && Objects.equals(this.cluster, other.cluster); }</code><technical_language>here, i bet needs of equal. test code/reqeuirements leak main</technical_language>

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } final SentMessageTrace other = (SentMessageTrace) obj; return Objects.equals(this.messageId, other.messageId) && Objects.equals(this.subscription, other.subscription) && Objects.equals(this.timestamp, other.timestamp) && Objects.equals(this.status, other.status); }
Source:
<code>public static String threadDump(final String msg) { <START> try ( <END> StringWriter str = new StringWriter(); PrintWriter out = new PrintWriter(str) ) { ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean(); out.println("*******************************************************************************"); out.println("Complete Thread dump " + msg); for (ThreadInfo threadInfo : threadMXBean.dumpAllThreads(true, true)) { out.println(threadInfoToString(threadInfo)); } long[] deadlockedThreads = threadMXBean.findDeadlockedThreads(); if (deadlockedThreads != null && deadlockedThreads.length > 0) { out.println("Deadlock detected!"); out.println(); for (ThreadInfo threadInfo : threadMXBean.getThreadInfo(deadlockedThreads, true, true)) { out.println(threadInfoToString(threadInfo)); } } out.println("==============================================================================="); out.println("End Thread dump " + msg); out.println("*******************************************************************************"); return str.toString(); } catch (IOException e) { logger.error("Exception thrown during generating of thread dump.", e); } return "Generating of thread dump failed " + msg; }</code><technical_language>Hmmmm... complete this.. need of a reuse this logic ActiveMQServerImpl::threadDump</technical_language>

Target:
public static String threadDump(final String msg) { return ThreadDumpUtil.threadDump(msg); }