auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void handleSingleExecution(HttpServletRequest req, HttpServletResponse resp, Map<String , String> templateVariableMap) throws IOException { String executionId = templateVariableMap.get(EXECUTION_ID_KEY); ExecutionDetailedResponse executionResponse; try { <START> executionResponse = executorService.getSingleExecution(executionId); <END> } catch (CloudFlowNotFoundException e) { sendErrorResponse(resp, HttpServletResponse.SC_NOT_FOUND, e.getMessage()); return; } sendResponse(resp, HttpServletResponse.SC_OK, executionResponse); }</code><technical_language>change method name getExecution? more consistent naming pattern in service methods</technical_language>

Target:
private void handleSingleExecution(HttpServletRequest req, HttpServletResponse resp, Map<String , String> templateVariableMap) throws IOException { String executionId = templateVariableMap.get(EXECUTION_ID_KEY); ExecutionDetailedResponse executionResponse; try { executionResponse = executionService.getExecution(executionId); } catch (CloudFlowNotFoundException e) { sendErrorResponse(resp, HttpServletResponse.SC_NOT_FOUND, e.getMessage()); return; } sendResponse(resp, HttpServletResponse.SC_OK, executionResponse); }
Source:
<code>public void testForName_withProviderWithRecursiveCall() throws Exception { FakeCharsetProvider.setDelegate(new MockCharsetProviderWithRecursiveCall()); try { Charset.forName("poop"); <START> } catch (UnsupportedCharsetException expected) { <END> } finally { FakeCharsetProvider.clearDelegate(); } }</code><technical_language>if this test case generate a test failure if expected exception unexpectedly thrown. (Am I missing something?)</technical_language>

Target:
public void testForName_withProviderWithRecursiveCall() throws Exception { FakeCharsetProvider.setDelegate(new MockCharsetProviderWithRecursiveCall()); try { Charset.forName("poop"); fail(); } catch (UnsupportedCharsetException expected) { } finally { FakeCharsetProvider.clearDelegate(); } }
Source:
<code>private MockChartView createMockChartViewFromType(int type) { switch(type) { case ComponentConstants.CHART_TYPE_LINE: return new MockLineChartView(); case ComponentConstants.CHART_TYPE_SCATTER: return new MockScatterChartView(); case ComponentConstants.CHART_TYPE_AREA: return new MockAreaChartView(); case ComponentConstants.CHART_TYPE_BAR: return new MockBarChartView(); case ComponentConstants.CHART_TYPE_PIE: return new MockPieChartView(); default: <START> throw new IllegalArgumentException("type:" + type); <END> } }</code><technical_language>Add a bit more information here, "Invalid chart type: ", in chance this error is encountered error message helps pinpoint problem a bit better</technical_language>

Target:
private MockChartView createMockChartViewFromType(int type) { switch (type) { case ComponentConstants.CHART_TYPE_LINE: return new MockLineChartView(); case ComponentConstants.CHART_TYPE_SCATTER: return new MockScatterChartView(); case ComponentConstants.CHART_TYPE_AREA: return new MockAreaChartView(); case ComponentConstants.CHART_TYPE_BAR: return new MockBarChartView(); case ComponentConstants.CHART_TYPE_PIE: return new MockPieChartView(); default: throw new IllegalArgumentException("Invalid Chart type specified: " + type); } }
Source:
<code>public void onInit(FMLInitializationEvent e) { <START> if (ENABLE_INIT) { <END> throw new CustomModLoadingErrorDisplayException("Custom Test Exception", new RuntimeException("Thrown in Initialization")) { @Override public void initGui(GuiErrorScreen parent, FontRenderer fontRenderer) { } @Override public void drawScreen(GuiErrorScreen parent, FontRenderer fontRenderer, int mouseRelX, int mouseRelY, float tickTime) { parent.drawCenteredString(parent.mc.fontRenderer, "Custom Test Exception", parent.width / 2, 90, 16777215); parent.drawCenteredString(parent.mc.fontRenderer, LOREM_IPSUM, parent.width / 2, 110, 16777215); } }; } }</code><technical_language>braces new lines</technical_language>

Target:
public void onInit(FMLInitializationEvent e) { if (ENABLE_INIT) { throwException("Thrown in Init"); } }
Source:
<code>public static void main(String... args) { Logger.getRootLogger().setLevel(Level.OFF); ConnectionCache c = new ConnectionCache(); int exitCode = 0; if(!args[0].equals("interactive")) { exitCode = new CommandLine(new RootCommand()).setExecutionStrategy(new CommandLine.RunLast()).execute(args); } else { Scanner command = new Scanner(System.in); CommandLine cl = new CommandLine(new RootCommand()).setExecutionStrategy(new CommandLine.RunLast()); while (true) { System.out.print("spliceck> "); String s = command.nextLine(); if (s.equals("exit")) break; if (s.trim().length() == 0) continue; String[] args2 = s.split(" "); exitCode = cl.execute(args2); if( exitCode == 0 ) <START> System.out.println(Utils.Colored.green( "return code " + exitCode + "\n") ); <END> else System.out.println(Utils.Colored.red( "return code " + exitCode + "\n") ); } command.close(); } try { c.close(); } catch (Exception e) { e.printStackTrace(); } System.exit(exitCode); }</code><technical_language>is this necessary</technical_language>

Target:
public static void main(String... args) { Logger.getRootLogger().setLevel(Level.OFF); ConnectionSingleton c = new ConnectionSingleton(); int exitCode = 0; if(!args[0].equals("interactive")) { exitCode = new CommandLine(new RootCommand()).setExecutionStrategy(new CommandLine.RunLast()).execute(args); } else { Scanner command = new Scanner(System.in); CommandLine cl = new CommandLine(new RootCommand()).setExecutionStrategy(new CommandLine.RunLast()); while (true) { System.out.print("spliceck> "); String s = command.nextLine().trim(); if (s.equals("exit") || s.equals("quit") || s.equals("q") ) break; if (s.length() == 0) continue; String[] args2 = s.split(" "); exitCode = cl.execute(args2); } command.close(); } try { c.close(); } catch (Exception e) { e.printStackTrace(); } System.exit(exitCode); }
Source:
<code>public Pair<Expression, Set<OutputAnchor>> getLocalExpr() { Expression expr = new FunVar(this.funInfo); Set<OutputAnchor> outsideAnchors = new HashSet<>(); for (InputAnchor in : this.getActiveInputs()) { Pair<Expression, Set<OutputAnchor>> pair = in.getLocalExpr(); expr = new Apply(expr, pair.a); outsideAnchors.addAll(pair.b); } <START> if (funInfo instanceof DefinitionFunction) { <END> outsideAnchors.addAll(((DefinitionFunction)funInfo).getSource().getAllOutputs()); } return new Pair<>(expr, outsideAnchors); }</code><technical_language>instanceof is a bit ugly, adding extra method FunctionInfo</technical_language>

Target:
public Pair<Expression, Set<OutputAnchor>> getLocalExpr() { Expression expr = new FunVar(this.funInfo); Set<OutputAnchor> outsideAnchors = new HashSet<>(); for (InputAnchor in : this.getActiveInputs()) { Pair<Expression, Set<OutputAnchor>> pair = in.getLocalExpr(); expr = new Apply(expr, pair.a); outsideAnchors.addAll(pair.b); } outsideAnchors.addAll(funInfo.getRequiredBlocks().stream().flatMap(block -> block.getAllOutputs().stream()).collect(Collectors.toList())); return new Pair<>(expr, outsideAnchors); }
Source:
<code>private void givenOneReposAndOneMergeRequest() { final StashRepo oneRepo = new StashRepo("repo1"); List<StashRepo> stashRepos = new ArrayList<>(); stashRepos.add(oneRepo); List<StashPullRequest> stashMergeRequests = new ArrayList<>(); stashMergeRequests.add(new StashPullRequest("1", stashRepos.get(0))); final StashPullRequest stashPullRequest = new StashPullRequest("2", stashRepos.get(0)); stashPullRequest.addReviewer(new StashUser("user", "user name")); stashMergeRequests.add(stashPullRequest); stashMergeRequests.add(new StashPullRequest("1", stashRepos.get(0))); doReturn(stashRepos).when(stashApiClient).readStashRepos(any(StashConfig.class)); <START> doReturn(asList(new StashPullRequest("1", oneRepo))).when(stashApiClient).readStashPullRequests(GIVEN_STASH_CONFIG, oneRepo); <END> }</code><technical_language>a lot of code duplication :) givenTwoReposAndThreeMergeRequests refactored create a separate method creates a repo, creates a pull request, for tests properly duplication</technical_language>

Target:
private void givenOneReposAndOneMergeRequest() { List<StashRepo> stashRepos = createRepositories(1); mockStashapiClientReadStashRepos(stashRepos); mockStashApiClientReadStashPullRequest(stashRepos.get(0), asList(new StashPullRequest("1", stashRepos.get(0)))); }
Source:
<code>private static boolean sendToSlackChannel(String authToken, String message, String channel) { boolean success = false; logger.info("sendToSlackChannel authToken='{}', message='{}', channel='{}'", authToken, message, channel); SlackSession session = null; try { session = SlackSessionFactory.createWebSocketSlackSession(authToken); session.connect(); SlackChannel slackChannel = session.findChannelByName(channel); if (slackChannel == null) { logger.error("Could not find Slack channel '{}'", channel); } else { session.sendMessage(slackChannel, message); success = true; } } catch (IOException e) { logger.error("Error sending message to Slack channel", e); } finally { try { if (session != null) { session.disconnect(); } } catch (IOException e) { <START> logger.error("Error disonnecting Slack session", e); <END> } } return success; }</code><technical_language>"disconnecting"</technical_language>

Target:
private static boolean sendToSlackChannel(String authToken, String message, String channel) { boolean success = false; logger.debug("sendToSlackChannel authToken='{}', message='{}', channel='{}'", authToken, message, channel); SlackSession session = null; try { session = SlackSessionFactory.createWebSocketSlackSession(authToken); session.connect(); SlackChannel slackChannel = session.findChannelByName(channel); if (slackChannel == null) { logger.error("Could not find Slack channel '{}'", channel); } else { session.sendMessage(slackChannel, message); success = true; } } catch (IOException e) { logger.error("Error sending message to Slack channel", e); } finally { try { if (session != null) { session.disconnect(); } } catch (IOException e) { logger.error("Error disconnecting Slack session", e); } } return success; }
Source:
<code>public void registerMBean(Metric metric, ObjectName name) { AbstractBean mbean; if (metric instanceof Gauge) mbean = new JmxGauge((Gauge<?>) metric, name); else if (metric instanceof Counter) mbean = new JmxCounter((Counter) metric, name); else if (metric instanceof Histogram) mbean = new JmxHistogram((Histogram) metric, name); else if (metric instanceof Timer) mbean = new JmxTimer((Timer) metric, name, TimeUnit.SECONDS, TimeUnit.MICROSECONDS); else if (metric instanceof Metered) mbean = new JmxMeter((Metered) metric, name, TimeUnit.SECONDS); <START> else if (metric instanceof IntegerSetting) <END> mbean = new JmxIntegerSetting((IntegerSetting) metric, name); else throw new IllegalArgumentException("Unknown metric type: " + metric.getClass()); if (!mBeanServer.isRegistered(name)) mBeanServer.registerMBean(mbean, name, MBeanWrapper.OnException.LOG); }</code><technical_language>Codahale metrics typically a read thing, I this route a 1 in of Cassandra set this I prefer move Virtual Tables work refactor JMX MBeans. JMXEnabledThreadPoolExecutor a setMaximumThreads this confusing</technical_language>

Target:
public void registerMBean(Metric metric, ObjectName name) { AbstractBean mbean; if (metric instanceof Gauge) mbean = new JmxGauge((Gauge<?>) metric, name); else if (metric instanceof Counter) mbean = new JmxCounter((Counter) metric, name); else if (metric instanceof Histogram) mbean = new JmxHistogram((Histogram) metric, name); else if (metric instanceof Timer) mbean = new JmxTimer((Timer) metric, name, TimeUnit.SECONDS, TimeUnit.MICROSECONDS); else if (metric instanceof Metered) mbean = new JmxMeter((Metered) metric, name, TimeUnit.SECONDS); else throw new IllegalArgumentException("Unknown metric type: " + metric.getClass()); if (!mBeanServer.isRegistered(name)) mBeanServer.registerMBean(mbean, name, MBeanWrapper.OnException.LOG); }
Source:
<code>private void updateUploadingMediaList() { AztecText.AttributePredicate uploadingPredicate = getPredicateWithClass("uploading"); mUploadingMediaProgressMax.clear(); for (Attributes attrs : content.getAllElementAttributes(uploadingPredicate)) { String localMediaId = attrs.getValue("data-wpid"); if (!TextUtils.isEmpty(localMediaId)) { <START> mUploadingMediaProgressMax.put(localMediaId, new Float(0)); <END> } } }</code><technical_language>drop unnecessary boxing a tiny optimization 0f instead of new Float(0) (also clears a lint warning)</technical_language>

Target:
private void updateUploadingMediaList() { AztecText.AttributePredicate uploadingPredicate = getPredicateWithClass("uploading"); mUploadingMediaProgressMax.clear(); for (Attributes attrs : content.getAllElementAttributes(uploadingPredicate)) { String localMediaId = attrs.getValue("data-wpid"); if (!TextUtils.isEmpty(localMediaId)) { mUploadingMediaProgressMax.put(localMediaId, 0f); } } }
Source:
<code>public static String constructAddErrorRecordString(ComplexEventChunk<StreamEvent> eventChunk, boolean isObjectColumnPresent, TableDefinition tableDefinition, Exception e) { JsonObject payloadJson = new JsonObject(); <START> if (isObjectColumnPresent || e instanceof ConnectionUnavailableException) { payloadJson.addProperty("isEditable", false); } else { payloadJson.addProperty("isEditable", true); } <END> JsonArray attributes = new JsonArray(); JsonArray records = new JsonArray(); for (Attribute attribute : tableDefinition.getAttributeList()) { JsonObject attributeJson = new JsonObject(); attributeJson.add("name", new JsonPrimitive(attribute.getName())); attributeJson.add("type", new JsonPrimitive(String.valueOf(attribute.getType()))); attributes.add(attributeJson); } payloadJson.add("attributes", attributes); while (eventChunk.hasNext()) { StreamEvent streamEvent = eventChunk.next(); JsonArray record = new JsonArray(); for (Object item : streamEvent.getOutputData()) { if (item == null) { record.add(JsonNull.INSTANCE); } record.add(String.valueOf(item)); } records.add(record); } payloadJson.add("records", records); return payloadJson.toString(); }</code><technical_language>replace this with: payloadJson.addProperty("isEditable", !(isObjectColumnPresent || e instanceof ConnectionUnavailableException)); is another instance too, do same</technical_language>

Target:
public static String constructAddErrorRecordString(ComplexEventChunk<StreamEvent> eventChunk, boolean isObjectColumnPresent, TableDefinition tableDefinition, Exception e) { JsonObject payloadJson = new JsonObject(); payloadJson.addProperty("isEditable", !(isObjectColumnPresent || e instanceof ConnectionUnavailableException)); JsonArray attributes = new JsonArray(); JsonArray records = new JsonArray(); for (Attribute attribute : tableDefinition.getAttributeList()) { JsonObject attributeJson = new JsonObject(); attributeJson.add("name", new JsonPrimitive(attribute.getName())); attributeJson.add("type", new JsonPrimitive(String.valueOf(attribute.getType()))); attributes.add(attributeJson); } payloadJson.add("attributes", attributes); while (eventChunk.hasNext()) { StreamEvent streamEvent = eventChunk.next(); JsonArray record = new JsonArray(); for (Object item : streamEvent.getOutputData()) { if (item == null) { record.add(JsonNull.INSTANCE); } else { record.add(String.valueOf(item)); } } records.add(record); } payloadJson.add("records", records); return payloadJson.toString(); }
Source:
<code>public LuceneQuery build() { String jpqlString = accept(new JPAQueryGenerator()); <START> log.tracef("JPQL string : %s", jpqlString); <END> Sort sort = null; if (sortCriteria != null && !sortCriteria.isEmpty()) { SortField[] sortField = new SortField[sortCriteria.size()]; int i = 0; for (SortCriteria sc : sortCriteria) { sortField[i++] = new SortField(sc.getAttributePath(), SortField.STRING, sc.getSortOrder() == SortOrder.DESC); } sort = new Sort(sortField); } LuceneProcessingChain processingChain = new LuceneProcessingChain((SearchFactoryIntegrator) searchManager.getSearchFactory(), entityNamesResolver, null); QueryParser queryParser = new QueryParser(); LuceneQueryParsingResult parsingResult = queryParser.parseQuery(jpqlString, processingChain); return new EmbeddedLuceneQuery(searchManager, parsingResult, sort, startOffset, maxResults); }</code><technical_language>a nano optimization, I guard tracef invocation if (log.isTraceEnabled())</technical_language>

Target:
public LuceneQuery build() { String jpqlString = accept(new JPAQueryGenerator()); if (log.isTraceEnabled()) { log.tracef("JPQL string : %s", jpqlString); } Sort sort = null; if (sortCriteria != null && !sortCriteria.isEmpty()) { SortField[] sortField = new SortField[sortCriteria.size()]; int i = 0; for (SortCriteria sc : sortCriteria) { sortField[i++] = new SortField(sc.getAttributePath(), SortField.STRING, sc.getSortOrder() == SortOrder.DESC); } sort = new Sort(sortField); } LuceneProcessingChain processingChain = new LuceneProcessingChain((SearchFactoryIntegrator) searchManager.getSearchFactory(), entityNamesResolver, null); QueryParser queryParser = new QueryParser(); LuceneQueryParsingResult parsingResult = queryParser.parseQuery(jpqlString, processingChain); return new EmbeddedLuceneQuery(searchManager, parsingResult, sort, startOffset, maxResults); }
Source:
<code>public boolean create(Personname personnameRecord) { LOG.trace("PersonnameDAO.create() - Begin"); <START> boolean result = true; <END> if (personnameRecord != null) { result = super.create(personnameRecord); } LOG.trace("PersonnameDAO.create() - End"); return result; }</code><technical_language>need for result variable</technical_language>

Target:
public boolean create(Personname personnameRecord) { LOG.trace("PersonnameDAO.create() - Begin"); return personnameRecord != null ? super.create(personnameRecord) : true; }
Source:
<code>protected void applyResults(Runnable runnable) { synchronized (fLastZoomThreadId) { <START> if (fInstanceId == fLastZoomThreadId) { <END> runnable.run(); } } }</code><technical_language>instead check this thread is fZoomThread? latest. prevent applied result set fZoomThread null (e.g. in traceClosed())</technical_language>

Target:
protected void applyResults(Runnable runnable) { synchronized (fZoomThreadResultLock) { if (this == fZoomThread) { runnable.run(); } } }
Source:
<code>public VisualEditorSaveChangesDialog clickSaveWithRecaptcha() { waitForElementClickableByElement(publishButton); if (checkIfElementOnPage(recaptchaArea)) { recaptchaContainer = saveDialogBody.findElement(recaptchaImageBy); waitForElementVisibleByElement(recaptchaContainer); } publishButton.click(); <START> PageObjectLogging.log("clickSaveWithRecaptcha", "The 2nd Publish Button is clicked", true); <END> return new VisualEditorSaveChangesDialog(driver); }</code><technical_language>logging logged click</technical_language>

Target:
public VisualEditorSaveChangesDialog clickSaveWithRecaptcha() { waitForElementClickableByElement(publishButton); if (checkIfElementOnPage(recaptchaArea)) { recaptchaContainer = saveDialogBody.findElement(recaptchaImageBy); waitForElementVisibleByElement(recaptchaContainer); } publishButton.click(); return new VisualEditorSaveChangesDialog(driver); }
Source:
<code>public void start() throws Exception { <START> if (connectivity.isDeviceOnline(mSettings.canDownloadWith3G())) { <END> List<Language> languagesFromServer = client.getLanguages(); List<Language> languagesToDownload = getLanguagesToDownload(languagesFromServer); updateLocalTranslations(languagesToDownload, client); } }</code><technical_language>for media, this is correct</technical_language>

Target:
public void start() throws Exception { if (connectivity.isDeviceOnline()) { List<Language> languagesFromServer = client.getLanguages(); List<Language> languagesToDownload = getLanguagesToDownload(languagesFromServer); updateLocalTranslations(languagesToDownload, client); } }
Source:
<code>public void VisualEditorEditing_004_insertLinks() { String articleName2 = PageContent.articleNamePrefix + base.getTimeStamp(); ArticlePageObject article = base.openArticleByName(wikiURL, articleName2); VisualEditorPageObject ve = article.openVEModeWithMainEditButton(); ve.verifyVEToolBarPresent(); ve.verifyEditorSurfacePresent(); VisualEditorHyperLinkDialog veLinkDialog = ve.clickLinkButton(); <START> ve = veLinkDialog.typeInLinkInput(PageContent.internalLink); <END> veLinkDialog.verifyMatchingPageIsTop(); ve = veLinkDialog.clickLinkResult(); ve.typeReturn(); veLinkDialog = ve.clickLinkButton(); ve = veLinkDialog.typeInLinkInput(PageContent.redLink); veLinkDialog.verifyNewPageIsTop(); ve = veLinkDialog.clickLinkResult(); ve.typeReturn(); veLinkDialog = ve.clickLinkButton(); ve = veLinkDialog.typeInLinkInput(PageContent.externalLink); veLinkDialog.verifyExternalLinkIsTop(); ve = veLinkDialog.clickLinkResult(); ve.typeReturn(); VisualEditorSaveChangesDialog saveDialog = ve.clickPublishButton(); VisualEditorReviewChangesDialog reviewDialog = saveDialog.clickReviewYourChanges(); reviewDialog.verifyAddedDiffs(linkWikiTexts); }</code><technical_language>assigned is used, is reason for that? if remove assigning variable change this line "veLinkDialog.typeInLinkInput(PageContent.internalLink);"</technical_language>

Target:
public void VisualEditorEditing_004_insertLinks() { String articleName2 = PageContent.articleNamePrefix + base.getTimeStamp(); ArticlePageObject article = base.openArticleByName(wikiURL, articleName2); VisualEditorPageObject ve = article.openVEModeWithMainEditButton(); ve.verifyVEToolBarPresent(); ve.verifyEditorSurfacePresent(); VisualEditorHyperLinkDialog veLinkDialog = ve.clickLinkButton(); veLinkDialog.typeInLinkInput(PageContent.internalLink); veLinkDialog.verifyMatchingPageIsTop(); ve = veLinkDialog.clickLinkResult(); ve.typeReturn(); veLinkDialog = ve.clickLinkButton(); veLinkDialog.typeInLinkInput(PageContent.redLink); veLinkDialog.verifyNewPageIsTop(); ve = veLinkDialog.clickLinkResult(); ve.typeReturn(); veLinkDialog = ve.clickLinkButton(); veLinkDialog.typeInLinkInput(PageContent.externalLink); veLinkDialog.verifyExternalLinkIsTop(); ve = veLinkDialog.clickLinkResult(); ve.typeReturn(); VisualEditorSaveChangesDialog saveDialog = ve.clickPublishButton(); VisualEditorReviewChangesDialog reviewDialog = saveDialog.clickReviewYourChanges(); reviewDialog.verifyAddedDiffs(linkWikiTexts); }
Source:
<code>private static void writeAddress(@NonNull Parcel dest, @NonNull InetAddress addr) { if (addr instanceof Inet6Address) { final Inet6Address v6Addr = (Inet6Address) addr; <START> dest.writeByte(ADDR_TYPE_V6); dest.writeByteArray(v6Addr.getAddress()); dest.writeInt(v6Addr.getScopeId()); <END> return; } dest.writeByte(ADDR_TYPE_OTHER); dest.writeByteArray(addr.getAddress()); }</code><technical_language>I this smaller. - write address - Write a boolean a scoped address (if getScopeId() returns 0, not) - If boolean is 1, write scope ID</technical_language>

Target:
private static void writeAddress(@NonNull Parcel dest, @NonNull InetAddress addr) { dest.writeByteArray(addr.getAddress()); if (addr instanceof Inet6Address) { final Inet6Address v6Addr = (Inet6Address) addr; final boolean hasScopeId = v6Addr.getScopeId() != 0; dest.writeBoolean(hasScopeId); if (hasScopeId) dest.writeInt(v6Addr.getScopeId()); } }
Source:
<code>public void onSpecialSymbol(char symbol) { <START> this.wikimodelListener.onSpecialSymbol(symbol); <END> }</code><technical_language>This work</technical_language>

Target:
public void onSpecialSymbol(char symbol) { this.wikimodelListener.onSpecialSymbol(String.valueOf(symbol)); }
Source:
<code>public void close() { log.debug("Closing"); if ( state.compareAndSet(CuratorFrameworkState.STARTED, CuratorFrameworkState.STOPPED) ) { listeners.forEach(new Function<CuratorListener, Void>() { @Override public Void apply(CuratorListener listener) { CuratorEvent event = new CuratorEventImpl(CuratorFrameworkImpl.this, CuratorEventType.CLOSING, 0, null, null, null, null, null, null, null, null); try { listener.eventReceived(CuratorFrameworkImpl.this, event); } catch ( Exception e ) { log.error("Exception while sending Closing event", e); } return null; } }); listeners.clear(); unhandledErrorListeners.clear(); connectionStateManager.close(); if (backgroundThread != null) { backgroundThread.interrupt(); try { <START> backgroundThread.join(1000); <END> } catch ( InterruptedException e ) { Thread.currentThread().interrupt(); } } client.close(); namespaceWatcherMap.close(); } }</code><technical_language>Add a field CuratorFrameworkFactory builder this configured</technical_language>

Target:
public void close() { log.debug("Closing"); if ( state.compareAndSet(CuratorFrameworkState.STARTED, CuratorFrameworkState.STOPPED) ) { listeners.forEach(new Function<CuratorListener, Void>() { @Override public Void apply(CuratorListener listener) { CuratorEvent event = new CuratorEventImpl(CuratorFrameworkImpl.this, CuratorEventType.CLOSING, 0, null, null, null, null, null, null, null, null); try { listener.eventReceived(CuratorFrameworkImpl.this, event); } catch ( Exception e ) { log.error("Exception while sending Closing event", e); } return null; } }); if ( executorService != null ) { executorService.shutdownNow(); try { executorService.awaitTermination(maxCloseWaitMs, TimeUnit.MILLISECONDS); } catch ( InterruptedException e ) { Thread.currentThread().interrupt(); } } listeners.clear(); unhandledErrorListeners.clear(); connectionStateManager.close(); client.close(); namespaceWatcherMap.close(); } }
Source:
<code>public static <T> BufferedIterator<T> buffered(Iterator<T> self) { <START> return new IteratorBufferedIterator<T>(self); <END> }</code><technical_language>In case is a BufferedIterator this return instead of re-wrapping</technical_language>

Target:
public static <T> BufferedIterator<T> buffered(Iterator<T> self) { if (self instanceof BufferedIterator) { return (BufferedIterator<T>) self; } else { return new IteratorBufferedIterator<T>(self); } }
Source:
<code>public <K, V> void send(final String topic, final K key, final V value, final Headers headers, final Integer partition, final Long timestamp, final Serializer<K> keySerializer, final Serializer<V> valueSerializer) { checkForException(); final byte[] keyBytes = keySerializer.serialize(topic, headers, key); final byte[] valBytes = valueSerializer.serialize(topic, headers, value); final ProducerRecord<byte[], byte[]> serializedRecord = new ProducerRecord<>(topic, partition, timestamp, keyBytes, valBytes, headers); transactionManager.send(serializedRecord, (metadata, exception) -> { if (sendException != null) { return; } if (exception == null) { final TopicPartition tp = new TopicPartition(metadata.topic(), metadata.partition()); offsets.put(tp, metadata.offset()); } else { recordSendError(topic, exception, serializedRecord); <START> log.trace("Failed record: (key value timestamp {}) topic=[{}] partition=[{}]", key, value, timestamp, topic, partition); <END> } }); }</code><technical_language>weird transactionManager send record application is EOS. issue name StreamProducer</technical_language>

Target:
public <K, V> void send(final String topic, final K key, final V value, final Headers headers, final Integer partition, final Long timestamp, final Serializer<K> keySerializer, final Serializer<V> valueSerializer) { checkForException(); final byte[] keyBytes; final byte[] valBytes; try { keyBytes = keySerializer.serialize(topic, headers, key); valBytes = valueSerializer.serialize(topic, headers, value); } catch (final RuntimeException exception) { final String errorMessage = String.format(SEND_EXCEPTION_MESSAGE, topic, taskId, exception.toString()); throw new StreamsException(errorMessage, exception); } final ProducerRecord<byte[], byte[]> serializedRecord = new ProducerRecord<>(topic, partition, timestamp, keyBytes, valBytes, headers); streamsProducer.send(serializedRecord, (metadata, exception) -> { if (sendException != null) { return; } if (exception == null) { final TopicPartition tp = new TopicPartition(metadata.topic(), metadata.partition()); offsets.put(tp, metadata.offset()); } else { recordSendError(topic, exception, serializedRecord); log.trace("Failed record: (key value timestamp {}) topic=[{}] partition=[{}]", key, value, timestamp, topic, partition); } }); }
Source:
<code>private Guid findChildCommandByActionType(VdcActionType commandType, List<Guid> childCmdIds) { <START> for (Guid cmdId : childCmdIds) { <END> CommandEntity commandEntity = CommandCoordinatorUtil.getCommandEntity(cmdId); if (commandEntity.getCommandType() == commandType) { return cmdId; } } return null; }</code><technical_language>shorter java stream api</technical_language>

Target:
private Guid findChildCommandByActionType(VdcActionType commandType, List<Guid> childCmdIds) { return childCmdIds.stream() .filter(cmdId -> CommandCoordinatorUtil.getCommandEntity(cmdId).getCommandType() == commandType) .findFirst().orElse(null); }
Source:
<code><START> private List<DiskImage> getDiskList() { <END> List<DiskImage> disksList = new ArrayList<>(); for (DiskImage diskImage : diskInfoDestinationMap.values()) { DiskImage clone = DiskImage.copyOf(diskImage); clone.setVolumeType(VolumeType.Sparse); if (getDiskStorageDomain(diskImage).getStorageType().isBlockDomain()) { clone.setvolumeFormat(VolumeFormat.COW); } else { clone.setvolumeFormat(VolumeFormat.RAW); } } return disksList; }</code><technical_language>redundant space private modifier</technical_language>

Target:
private List<DiskImage> getDiskList() { List<DiskImage> disksList = new ArrayList<>(); for (DiskImage diskImage : diskInfoDestinationMap.values()) { DiskImage clone = DiskImage.copyOf(diskImage); clone.setVolumeType(VolumeType.Sparse); if (getDiskStorageDomain(diskImage).getStorageType().isBlockDomain()) { clone.setvolumeFormat(VolumeFormat.COW); } } return disksList; }
Source:
<code>private void reloadData(Quester quester) { <START> if (quester == null) return; <END> quester.saveData(); quester.loadData(); }</code><technical_language>{} for if statements, single-line ones</technical_language>

Target:
private void reloadData(Quester quester) { if (quester == null) { return; } quester.saveData(); quester.loadData(); }
Source:
<code>public void render(GraphicsContext gc) { if (isDead()) { return; } getBoundingArea().setRotation(behaviour); if (sprite != null) { drawRotatedImage(gc, sprite, getBoundingArea()); <START> } <END> }</code><technical_language>add else case calls render method of superClass (Entity), is rendered (a lovely red box). <organisation</technical_language>

Target:
public void render(GraphicsContext gc) { if (isDead()) { return; } getBoundingArea().setRotation(behaviour); if (sprite != null) { drawRotatedImage(gc, sprite, getBoundingArea()); } else { super.render(gc); } }
Source:
<code>protected IStatus run(IProgressMonitor monitor) { String[][] configurations = fInfo.targets; if (configurations == null) configurations = new String[][] {{TargetPlatform.getOS(), TargetPlatform.getWS(), TargetPlatform.getOSArch(), TargetPlatform.getNL()}}; cleanupBuildRepo(); errorMessage = null; SubMonitor subMonitor = <START> SubMonitor.convert(monitor, <END> 10); try { String featureID = "org.eclipse.pde.container.feature"; fFeatureLocation = fBuildTempLocation + File.separator + featureID; createFeature(featureID, fFeatureLocation, configurations, fProduct.includeLaunchers()); createBuildPropertiesFile(fFeatureLocation, configurations); doExport(featureID, null, fFeatureLocation, configurations, subMonitor.newChild(8)); } catch (IOException e) { PDECore.log(e); } catch (InvocationTargetException e) { return new Status(IStatus.ERROR, PDECore.PLUGIN_ID, PDECoreMessages.FeatureBasedExportOperation_ProblemDuringExport, e.getTargetException()); } catch (CoreException e) { if (errorMessage != null) return parseErrorMessage(e); return e.getStatus(); } finally { for (int j = 0; j < fInfo.items.length; j++) { try { deleteBuildFiles(fInfo.items[j]); } catch (CoreException e) { PDECore.log(e); } } cleanup(null, subMonitor.newChild(1)); } if (hasAntErrors()) { return new Status(IStatus.WARNING, PDECore.PLUGIN_ID, NLS.bind(PDECoreMessages.FeatureExportOperation_CompilationErrors, fInfo.destinationDirectory)); } errorMessage = null; return Status.OK_STATUS; }</code><technical_language>Ticks line up. method body consumes 9 ticks</technical_language>

Target:
protected IStatus run(IProgressMonitor monitor) { String[][] configurations = fInfo.targets; if (configurations == null) configurations = new String[][] {{TargetPlatform.getOS(), TargetPlatform.getWS(), TargetPlatform.getOSArch(), TargetPlatform.getNL()}}; cleanupBuildRepo(); errorMessage = null; SubMonitor subMonitor = SubMonitor.convert(monitor, 9); try { String featureID = "org.eclipse.pde.container.feature"; fFeatureLocation = fBuildTempLocation + File.separator + featureID; createFeature(featureID, fFeatureLocation, configurations, fProduct.includeLaunchers()); createBuildPropertiesFile(fFeatureLocation, configurations); doExport(featureID, null, fFeatureLocation, configurations, subMonitor.newChild(8)); } catch (IOException e) { PDECore.log(e); } catch (InvocationTargetException e) { return new Status(IStatus.ERROR, PDECore.PLUGIN_ID, PDECoreMessages.FeatureBasedExportOperation_ProblemDuringExport, e.getTargetException()); } catch (CoreException e) { if (errorMessage != null) return parseErrorMessage(e); return e.getStatus(); } finally { for (int j = 0; j < fInfo.items.length; j++) { try { deleteBuildFiles(fInfo.items[j]); } catch (CoreException e) { PDECore.log(e); } } cleanup(null, subMonitor.newChild(1)); } if (hasAntErrors()) { return new Status(IStatus.WARNING, PDECore.PLUGIN_ID, NLS.bind(PDECoreMessages.FeatureExportOperation_CompilationErrors, fInfo.destinationDirectory)); } errorMessage = null; return Status.OK_STATUS; }
Source:
<code>public PointList getPolygonPoints() { <START> if ((getOwner().getChildren().get(0)) instanceof IRoundedRectangleFigure) { <END> IRoundedRectangleFigure packageFigure = ((IRoundedRectangleFigure) ((IFigure) getOwner().getChildren().get(0))); Rectangle packageHeader = packageFigure.getPackageHeader().getCopy(); packageFigure.translateToAbsolute(packageHeader); if (!packageHeader.isEmpty()) { PointList points = new PointList(5); Rectangle anchorableRectangle = getBox(); points.addPoint(anchorableRectangle.x, anchorableRectangle.y); points.addPoint(anchorableRectangle.x + packageHeader.width, anchorableRectangle.y); points.addPoint(anchorableRectangle.x + packageHeader.width, anchorableRectangle.y + packageHeader.height); points.addPoint(anchorableRectangle.x + anchorableRectangle.width, anchorableRectangle.y + packageHeader.height); points.addPoint(anchorableRectangle.x + anchorableRectangle.width, anchorableRectangle.y + anchorableRectangle.height); points.addPoint(anchorableRectangle.x, anchorableRectangle.y + anchorableRectangle.height); points.addPoint(anchorableRectangle.x, anchorableRectangle.y); return points; } else { return super.getPolygonPoints(); } } else { return super.getPolygonPoints(); } }</code><technical_language>above. I extract a function</technical_language>

Target:
public PointList getPolygonPoints() { if (getFigure() instanceof IRoundedRectangleFigure) { IRoundedRectangleFigure packageFigure = ((IRoundedRectangleFigure) ((IFigure) getFigure())); Rectangle packageHeader = packageFigure.getPackageHeader().getCopy(); packageFigure.translateToAbsolute(packageHeader); if (!packageHeader.isEmpty()) { PointList points = new PointList(5); Rectangle anchorableRectangle = getBox(); points.addPoint(anchorableRectangle.x, anchorableRectangle.y); points.addPoint(anchorableRectangle.x + packageHeader.width, anchorableRectangle.y); points.addPoint(anchorableRectangle.x + packageHeader.width, anchorableRectangle.y + packageHeader.height); points.addPoint(anchorableRectangle.x + anchorableRectangle.width, anchorableRectangle.y + packageHeader.height); points.addPoint(anchorableRectangle.x + anchorableRectangle.width, anchorableRectangle.y + anchorableRectangle.height); points.addPoint(anchorableRectangle.x, anchorableRectangle.y + anchorableRectangle.height); points.addPoint(anchorableRectangle.x, anchorableRectangle.y); return points; } else { return super.getPolygonPoints(); } } else { return super.getPolygonPoints(); } }
Source:
<code>public void testReflectingOnlyCurrentLayer() { PointF screenPointLeft = new PointF(displayWidth / 2 - 10, displayHeight / 2 - 5); PointF screenPointRight = new PointF(displayWidth / 2 + 10, displayHeight / 2 - 5); onView(isRoot()).perform(touchAt(screenPointLeft)); onLayerMenuView().performOpen(); onLayerMenuView().performAddLayer(); onLayerMenuView().performClose(); onView(isRoot()).perform(touchAt(screenPointRight)); ToolBarViewInteraction.onToolBarView().performSelectTool(ToolType.TRANSFORM); try { Thread.sleep(100); } catch (Exception e) { <START> e.printStackTrace(); <END> Log.d("LayerIntegrationTest", e.getMessage()); } onView(withId(R.id.transform_flip_vertical_btn)).perform(click()); ToolBarViewInteraction.onToolBarView().performSelectTool(ToolType.PIPETTE); onView(isRoot()).perform(touchAt(screenPointRight)); int color = PaintroidApplication.currentTool.getDrawPaint().getColor(); assertEquals("Color should be transparent", Color.TRANSPARENT, color); onView(withId(R.id.btn_top_undo)).perform(click()); onView(isRoot()).perform(touchAt(screenPointRight)); color = PaintroidApplication.currentTool.getDrawPaint().getColor(); assertEquals("Color should be black", Color.BLACK, color); onView(withId(R.id.btn_top_redo)).perform(click()); onView(isRoot()).perform(touchAt(screenPointRight)); color = PaintroidApplication.currentTool.getDrawPaint().getColor(); assertEquals("Color should be transparent", Color.TRANSPARENT, color); }</code><technical_language>please change Log.e(e.getMessage())</technical_language>

Target:
public void testReflectingOnlyCurrentLayer() { PointF screenPointLeft = new PointF(displayWidth / 2 - 10, displayHeight / 2 - 5); PointF screenPointRight = new PointF(displayWidth / 2 + 10, displayHeight / 2 - 5); onView(isRoot()).perform(touchAt(screenPointLeft)); onLayerMenuView().performOpen(); onLayerMenuView().performAddLayer(); onLayerMenuView().performClose(); onView(isRoot()).perform(touchAt(screenPointRight)); ToolBarViewInteraction.onToolBarView().performSelectTool(ToolType.TRANSFORM); try { Thread.sleep(100); } catch (Exception e) { Log.e("LayerIntegrationTest", e.getMessage()); } onView(withId(R.id.transform_flip_vertical_btn)).perform(click()); ToolBarViewInteraction.onToolBarView().performSelectTool(ToolType.PIPETTE); onView(isRoot()).perform(touchAt(screenPointRight)); int color = PaintroidApplication.currentTool.getDrawPaint().getColor(); assertEquals("Color should be transparent", Color.TRANSPARENT, color); onView(withId(R.id.btn_top_undo)).perform(click()); onView(isRoot()).perform(touchAt(screenPointRight)); color = PaintroidApplication.currentTool.getDrawPaint().getColor(); assertEquals("Color should be black", Color.BLACK, color); onView(withId(R.id.btn_top_redo)).perform(click()); onView(isRoot()).perform(touchAt(screenPointRight)); color = PaintroidApplication.currentTool.getDrawPaint().getColor(); assertEquals("Color should be transparent", Color.TRANSPARENT, color); }
Source:
<code>public <K> HashMap<K, ImList<T>> groupBy(Function1<? super T, K> f) { HashMap<K, ImList<T>> m = new HashMap<>(); for (final T elem : backingList) { final K key = f.apply(elem); final ImList<T> val = m.get(key); if (val == null) { m.put(key, create(elem)); } else { m.put(key, val.append(elem)); <START> } <END> } return m; }</code><technical_language>I this be: m.put(key, ImOption.apply(m.get(key)).map(lst-> lst.append(elem)).getOrElse(() -> create(elem)); better</technical_language>

Target:
public <K> HashMap<K, ImList<T>> groupBy(Function1<? super T, K> f) { HashMap<K, ImList<T>> m = new HashMap<>(); for (final T elem : backingList) { final K key = f.apply(elem); m.put(key, ImOption.apply(m.get(key)).map( lst -> lst.append(elem) ).getOrElse(() -> create(elem))); } return m; }
Source:
<code><START> public ArrayList<String> checkListTexts() { <END> ArrayList<String> list = new ArrayList<String>(CHECKLIST_SIZE); list.add("&1) the correct dialog displays."); list.add("&2) the dialog is an appropriate size for the required resolution (1024x768)."); list.add("&3) the texts are correct and not cut off."); list.add("&4) all strings have been externalized properly."); list.add("&5) all the widgets are viewable and not cut off."); return list; }</code><technical_language>I a callers of this method. I suggest return a java.util.List here, callers do need concrete ArrayList implementation</technical_language>

Target:
public List<String> checkListTexts() { List<String> list = new ArrayList<String>(CHECKLIST_SIZE); list.add("&1) the correct dialog displays."); list.add("&2) the dialog is an appropriate size for the required resolution (1024x768)."); list.add("&3) the texts are correct and not cut off."); list.add("&4) all strings have been externalized properly."); list.add("&5) all the widgets are viewable and not cut off."); return list; }
Source:
<code>private void updateBoundedGarbageSize(SMRGarbageEntry garbageEntry) { <START> if (resetBoundedGarbageSize) { <END> boundedGarbageSize = totalGarbageSize; resetBoundedGarbageSize = false; } boundedGarbageSize += garbageEntry.getGarbageSizeUpTo(nextCompactionUpperBound); }</code><technical_language>wired</technical_language>

Target:
private void updateBoundedGarbageSize(SMRGarbageEntry garbageEntry) { if (compactionUpperBound != nextCompactionUpperBound) { compactionUpperBound = nextCompactionUpperBound; boundedGarbageSize = totalGarbageSize; } boundedGarbageSize += garbageEntry.getGarbageSizeUpTo(compactionUpperBound); }
Source:
<code><START> public LdapObjectDefinitionBuilder(String id) <END> { this.id = requireNonNull(id, "id is null"); }</code><technical_language>I meant this constructor private. constructor of LdapObjectDefinition private. be</technical_language>

Target:
private LdapObjectDefinitionBuilder(String id) { this.id = requireNonNull(id, "id is null"); }
Source:
<code>public ImmutableWorkerInfo findWorkerForTask( final WorkerTaskRunnerConfig config, final ImmutableMap<String, ImmutableWorkerInfo> zkWorkers, final Task task ) { <START> Map<String, Integer> restSlots = new TreeMap<String, Integer>( <END> new Comparator<String>() { @Override public int compare(String o1, String o2) { int diff = o2.length() - o1.length(); if (diff != 0) { return diff; } return o1.compareTo(o2); } } ) { { Map<String, Integer> configs = limitConfig.getLimit(); for (String taskIdPrefix: configs.keySet()) { put(taskIdPrefix, configs.get(taskIdPrefix)); } } }; for (ImmutableWorkerInfo zkWorker: zkWorkers.values()) { for (String taskId: zkWorker.getRunningTasks()) { for (String taskIdPrefix: restSlots.keySet()) { if (taskId.startsWith(taskIdPrefix)) { restSlots.put(taskIdPrefix, restSlots.get(taskIdPrefix) - 1); } } } } String taskId = task.getId(); for (String taskIdPrefix: restSlots.keySet()) { if (taskId.startsWith(taskIdPrefix)) { if (restSlots.getOrDefault(taskIdPrefix, 1) <= 0) { return null; } } } final TreeSet<ImmutableWorkerInfo> sortedWorkers = Sets.newTreeSet( Comparator.comparing(ImmutableWorkerInfo::getAvailableCapacity).reversed() .thenComparing(zkWorker -> zkWorker.getWorker().getVersion())); sortedWorkers.addAll(zkWorkers.values()); final String minWorkerVer = config.getMinWorkerVersion(); for (ImmutableWorkerInfo zkWorker : sortedWorkers) { if (zkWorker.canRunTask(task) && zkWorker.isValidVersion(minWorkerVer)) { return zkWorker; } } return null; }</code><technical_language>I this replaced Comparator.comparing(String::length).reversed().thenComparing(Comparator.naturalOrder());</technical_language>

Target:
public ImmutableWorkerInfo findWorkerForTask( final WorkerTaskRunnerConfig config, final ImmutableMap<String, ImmutableWorkerInfo> zkWorkers, final Task task ) { Map<String, Integer> rest = new TreeMap<String, Integer>( Comparator.comparing(String::length).reversed().thenComparing(Comparator.naturalOrder()) ); Map<String, Integer> configs = limitConfig.getLimit(); for (String taskIdPrefix: configs.keySet()) { rest.put(taskIdPrefix, configs.get(taskIdPrefix)); } for (ImmutableWorkerInfo zkWorker: zkWorkers.values()) { for (String taskId: zkWorker.getRunningTasks()) { for (String taskIdPrefix: rest.keySet()) { if (taskId.startsWith(taskIdPrefix)) { rest.put(taskIdPrefix, rest.get(taskIdPrefix) - 1); } } } } String taskId = task.getId(); for (String taskIdPrefix: rest.keySet()) { if (taskId.startsWith(taskIdPrefix)) { if (rest.getOrDefault(taskIdPrefix, 1) <= 0) { return null; } } } final TreeSet<ImmutableWorkerInfo> sortedWorkers = Sets.newTreeSet( Comparator.comparing(ImmutableWorkerInfo::getAvailableCapacity).reversed() .thenComparing(zkWorker -> zkWorker.getWorker().getVersion())); sortedWorkers.addAll(zkWorkers.values()); final String minWorkerVer = config.getMinWorkerVersion(); for (ImmutableWorkerInfo zkWorker : sortedWorkers) { if (zkWorker.canRunTask(task) && zkWorker.isValidVersion(minWorkerVer)) { return zkWorker; } } return null; }
Source:
<code>public int hashCode() { <START> return 37 * pattern.hashCode() + factField.hashCode(); <END> }</code><technical_language>If find analysis panel starts a bit loopy (IIRC does), want check hashCode implementations - try result = ~~result type construct.. I dig out original email if like</technical_language>

Target:
public int hashCode() { final int result = 37 * pattern.hashCode() + factField.hashCode(); return ~~result; }
Source:
<code>private int getOrCreateLabelId( String labelName ) throws ProcedureException { try { return ktx.tokenWrite().labelGetOrCreateForName( labelName ); } catch ( TooManyLabelsException | IllegalTokenNameException e ) { <START> throw new ProcedureException( e.status(), e, "" ); <END> } }</code><technical_language>Please replace empty string a proper error message</technical_language>

Target:
private int getOrCreateLabelId( String labelName ) throws ProcedureException { try { return ktx.tokenWrite().labelGetOrCreateForName( labelName ); } catch ( TooManyLabelsException | IllegalTokenNameException e ) { throw new ProcedureException( e.status(), e, e.getMessage() ); } }
Source:
<code>public boolean validate(IOperationMonitor monitor) throws BugzillaRestException { RepositoryLocation location = getClient().getLocation(); if (location.getBooleanPropery(IBugzillaRestConstants.REPOSITORY_USE_API_KEY)) { UserCredentials credentials = location.getCredentials(AuthenticationType.REPOSITORY); if (credentials == null) { throw new IllegalStateException("Authentication requested without valid credentials"); } String url = MessageFormat.format("/valid_login?login={0}&api_key={1}", <START> new Object[] { credentials.getUserName(), <END> location.getProperty(IBugzillaRestConstants.REPOSITORY_API_KEY) }); BooleanResult response = new BugzillaRestUnauthenticatedGetRequest<BooleanResult>(client, url, new TypeToken<BooleanResult>() { }).run(monitor); return response.getResult(); } else { LoginToken validateResponse = new BugzillaRestLoginRequest(client).run(monitor); if (validateResponse != null && !Strings.isNullOrEmpty(validateResponse.getId())) { String url = MessageFormat.format("/logout?token={0}", new Object[] { validateResponse.getToken() }); new BugzillaRestUnauthenticatedGetRequest<BooleanResult>(client, url, new TypeToken<BooleanResult>() { }).run(monitor); return true; } } return false; }</code><technical_language>MessageFormat.format() takes a varargs for message parameters, construct array, pass in username API key</technical_language>

Target:
public boolean validate(IOperationMonitor monitor) throws BugzillaRestException { RepositoryLocation location = getClient().getLocation(); if (location.getBooleanPropery(IBugzillaRestConstants.REPOSITORY_USE_API_KEY)) { UserCredentials credentials = location.getCredentials(AuthenticationType.REPOSITORY); Preconditions.checkState(credentials != null, "Authentication requested without valid credentials"); String url = MessageFormat.format("/valid_login?login={0}&api_key={1}", credentials.getUserName(), location.getProperty(IBugzillaRestConstants.REPOSITORY_API_KEY)); BooleanResult response = new BugzillaRestUnauthenticatedGetRequest<BooleanResult>(client, url, new TypeToken<BooleanResult>() { }).run(monitor); return response.getResult(); } else { LoginToken validateResponse = new BugzillaRestLoginRequest(client).run(monitor); if (validateResponse != null && !Strings.isNullOrEmpty(validateResponse.getId())) { String url = MessageFormat.format("/logout?token={0}", validateResponse.getToken()); new BugzillaRestUnauthenticatedGetRequest<BooleanResult>(client, url, new TypeToken<BooleanResult>() { }).run(monitor); return true; } } return false; }