auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public <T> T execute(SessionCallback<F, T> callback) { Session<F> session = null; if (this.activeTemplateCallbacks.get() > 0) { session = this.contextSessions.get(); } try { if (session == null) { session = this.sessionFactory.getSession(); } Assert.notNull(session, "failed to acquire a Session"); return callback.doInSession(session); } catch (Exception e) { if (session instanceof CachingSessionFactory<?>.CachedSession) { ((CachingSessionFactory.CachedSession) session).dirty(); } if (e instanceof MessagingException) { throw (MessagingException) e; } throw new MessagingException("Failed to execute on session", e); } finally { <START> if (this.activeTemplateCallbacks.get() == 0 && session != null) { <END> try { session.close(); } catch (Exception ignored) { if (this.logger.isDebugEnabled()) { this.logger.debug("failed to close Session", ignored); } } } } }</code><technical_language>This right - another thread running in invoke. invokeScope variable in rabbit template's doExecute</technical_language>

Target:
public <T> T execute(SessionCallback<F, T> callback) { Session<F> session = null; boolean invokeScope = false; if (this.activeTemplateCallbacks.get() > 0) { session = this.contextSessions.get(); } try { if (session == null) { session = this.sessionFactory.getSession(); } else { invokeScope = true; } return callback.doInSession(session); } catch (Exception e) { if (session instanceof CachingSessionFactory<?>.CachedSession) { ((CachingSessionFactory.CachedSession) session).dirty(); } if (e instanceof MessagingException) { throw (MessagingException) e; } throw new MessagingException("Failed to execute on session", e); } finally { if (!invokeScope) { try { session.close(); } catch (Exception ignored) { if (this.logger.isDebugEnabled()) { this.logger.debug("failed to close Session", ignored); } } } } }
Source:
<code>public Map<String, String> getPrimeVaccinationDateAndDateRange(String subjectId) { LocalDate primeVacDate = null; LocalDate earliestDate = null; LocalDate latestDate = null; if (!StringUtils.isBlank(subjectId)) { LocalDate screeningDate = visitDataService.findVisitBySubjectIdAndType(subjectId, VisitType.SCREENING) .getDate(); primeVacDate = getPrimeVaccinationDate(subjectId); if (screeningDate != null) { if (isFemaleChildBearingAge(subjectId)) { <START> earliestDate = screeningDate.plusDays(14); <END> } else { earliestDate = screeningDate.plusDays(1); } latestDate = screeningDate.plusDays(28); } } Map<String, String> dates = new HashMap<>(); dates.put("primeVacDate", primeVacDate != null ? primeVacDate.toString() : ""); dates.put("earliestDate", earliestDate != null ? earliestDate.toString() : ""); dates.put("latestDate", latestDate != null ? latestDate.toString() : ""); return dates; }</code><technical_language>add number of days constants</technical_language>

Target:
public Map<String, String> getPrimeVaccinationDateAndDateRange(String subjectId) { Subject subject = subjectDataService.findSubjectBySubjectId(subjectId); LocalDate primeVacDate = null; LocalDate earliestDate = null; LocalDate latestDate = null; if (subject != null) { VisitBookingDetails details = getPrimerVaccinationDetails(subject); if (subject.getPrimerVaccinationDate() != null) { primeVacDate = subject.getPrimerVaccinationDate(); } else { primeVacDate = details.getBookingActualDate(); } LocalDate screeningDate = getScreeningDate(subject); if (screeningDate != null) { if (!isFemaleChildBearingAge(details)) { earliestDate = screeningDate.plusDays(ONE_DAY); } else { earliestDate = screeningDate.plusDays(TWO_WEEKS); } latestDate = screeningDate.plusDays(FOUR_WEEKS); } } Map<String, String> dates = new HashMap<>(); dates.put("primeVacDate", primeVacDate != null ? primeVacDate.toString(BookingAppConstants.SIMPLE_DATE_FORMAT) : ""); dates.put("earliestDate", earliestDate != null ? earliestDate.toString(BookingAppConstants.SIMPLE_DATE_FORMAT) : ""); dates.put("latestDate", latestDate != null ? latestDate.toString(BookingAppConstants.SIMPLE_DATE_FORMAT) : ""); return dates; }
Source:
<code>private boolean testTranslationSetup() { testResultValueLabel.setText(""); MediaType mediaType = MediaType.parse("application/json"); JsonArray jsonArray = new JsonArray(); JsonObject jsonObject = new JsonObject(); jsonObject.addProperty("Text", testUntranslatedTextField.getText()); jsonArray.add(jsonObject); String bodyString = jsonArray.toString(); RequestBody body = RequestBody.create(mediaType, bodyString); Request request = new Request.Builder() .url(BingTranslator.getTranlatorUrl(targetLanguageCode)).post(body) .addHeader("Ocp-Apim-Subscription-Key", authenticationKeyField.getText()) .addHeader("Content-type", "application/json").build(); try { Response response = new OkHttpClient().newCall(request).execute(); JsonParser parser = new JsonParser(); JsonArray responses = parser.parse(response.body().string()).getAsJsonArray(); JsonObject response0 = responses.get(0).getAsJsonObject(); JsonArray translations = response0.getAsJsonArray("translations"); JsonObject translation0 = translations.get(0).getAsJsonObject(); testResultValueLabel.setText(translation0.get("text").getAsString()); return true; } catch (IOException | IllegalStateException | ClassCastException | NullPointerException | IndexOutOfBoundsException e) { <START> return false; <END> } }</code><technical_language>this exception need logged</technical_language>

Target:
private boolean testTranslationSetup() { testResultValueLabel.setText(""); MediaType mediaType = MediaType.parse("application/json"); JsonArray jsonArray = new JsonArray(); JsonObject jsonObject = new JsonObject(); jsonObject.addProperty("Text", testUntranslatedTextField.getText()); jsonArray.add(jsonObject); String bodyString = jsonArray.toString(); RequestBody body = RequestBody.create(mediaType, bodyString); Request request = new Request.Builder() .url(BingTranslator.getTranlatorUrl(targetLanguageCode)).post(body) .addHeader("Ocp-Apim-Subscription-Key", authenticationKeyField.getText()) .addHeader("Content-type", "application/json").build(); try { Response response = new OkHttpClient().newCall(request).execute(); JsonParser parser = new JsonParser(); JsonArray responses = parser.parse(response.body().string()).getAsJsonArray(); JsonObject response0 = responses.get(0).getAsJsonObject(); JsonArray translations = response0.getAsJsonArray("translations"); JsonObject translation0 = translations.get(0).getAsJsonObject(); testResultValueLabel.setText(translation0.get("text").getAsString()); return true; } catch (IOException | IllegalStateException | ClassCastException | NullPointerException | IndexOutOfBoundsException e) { logger.log(Level.WARNING, "Test of Bing Translator failed due to exception", e); return false; } }
Source:
<code>static void initializeServer(Injector injector, Lifecycle lifecycle, final Server server) { JettyServerInitializer initializer = injector.getInstance(JettyServerInitializer.class); try { initializer.initialize(server, injector); } catch (ConfigurationException e) { throw new ProvisionException(Iterables.getFirst(e.getErrorMessages(), null).getMessage()); } lifecycle.addHandler( new Lifecycle.Handler() { @Override public void start() throws Exception { server.start(); } @Override public void stop() { if (activeConnections.get() != 0) { long graceFullShutDownTime = (int)server.getAttribute(GRACEFUL_SHUTDOWN_TIME); log.info("Waiting for [%s] milliseconds for active requests to be zero, current active requests=[%s]", graceFullShutDownTime, activeConnections.get()); try { Thread.sleep(graceFullShutDownTime); } catch (InterruptedException e) { log.error("Sleep has been interrupted, while waiting for active requests to be zero"); <START> } <END> } log.info("Stopping Jetty Server with active requests=[%s]", activeConnections.get()); try { server.stop(); } catch (Exception e) { log.warn(e, "Unable to stop Jetty server."); } } } ); }</code><technical_language>Thread.currentThread().interrupt(); and/or rethrow</technical_language>

Target:
static void initializeServer(Injector injector, Lifecycle lifecycle, final Server server) { JettyServerInitializer initializer = injector.getInstance(JettyServerInitializer.class); try { initializer.initialize(server, injector); } catch (ConfigurationException e) { throw new ProvisionException(Iterables.getFirst(e.getErrorMessages(), null).getMessage()); } lifecycle.addHandler( new Lifecycle.Handler() { @Override public void start() throws Exception { server.start(); } private Handler getStatisticsHandler() { for (Handler handler : server.getHandlers()) { if (handler.getClass().equals(StatisticsHandler.class)) { return handler; } } return null; } @Override public void stop() { StatisticsHandler statisticsHandler = (StatisticsHandler) getStatisticsHandler(); if (statisticsHandler != null) { long startTime = System.currentTimeMillis(); long gracefulShutDownTimeout = (long) server.getAttribute(GRACEFUL_SHUTDOWN_TIMEOUT); if (statisticsHandler.getRequestsActive() > 0) { log.info("Waiting for upto [%s] milliseconds for active requests to be zero, current active requests=[%s]", gracefulShutDownTimeout, statisticsHandler.getRequestsActive()); } while (statisticsHandler.getRequestsActive() > 0 && System.currentTimeMillis() - startTime < gracefulShutDownTimeout) { try { Thread.sleep(500); } catch (InterruptedException e) { log.error("Sleep has been interrupted, while waiting for active requests to be zero"); stopImmediately(); Thread.currentThread().interrupt(); return; } } log.info("Stopping Jetty Server with active requests=[%s]", statisticsHandler.getRequestsActive()); } stopImmediately(); } private void stopImmediately() { try { server.stop(); } catch (Exception e) { log.warn(e, "Unable to stop Jetty server."); } } } ); }
Source:
<code>public void add( final Trans value ) { List<Trans> internalList = new ArrayList<>(); internalList.addAll( internal ); <START> for ( Trans t : internalList ) { <END> if ( t.getTransMeta().equals( value.getTransMeta() ) ) { return; } } super.add( value ); }</code><technical_language>creating a new list? iterate original internal list in line 140 "for ( IExternalResourceInfo resource : internal ) {"</technical_language>

Target:
public void add( final Trans value ) { for ( Trans t : internal ) { if ( t.getTransMeta().equals( value.getTransMeta() ) ) { return; } } super.add( value ); }
Source:
<code>private CHProfile select(HintsMap weightingMap, Boolean edgeBased, Integer uTurnCosts) throws CHProfileSelectionException { this.weightingMap = weightingMap; findCHProfilesMatchingWeighting(); if (!foundCHProfilesMatchingWeighting()) { throw new CHProfileSelectionException("Cannot find CH profile for weighting map " + weightingMap + " in entries: " + entriesStrs + "."); } <START> if (edgeBased != null && uTurnCosts != null) { <END> return selectUsingEdgeBasedAndUTurnCosts(edgeBased, uTurnCosts); } else if (edgeBased != null) { return selectUsingEdgeBased(edgeBased); } else if (uTurnCosts != null) { return selectUsingUTurnCosts(uTurnCosts); } else { return selectUsingWeightingOnly(); } }</code><technical_language>fine due named cases IMO</technical_language>

Target:
private CHProfile select(HintsMap weightingMap, Boolean edgeBased, Integer uTurnCosts) { this.weightingMap = weightingMap; findCHProfilesMatchingWeighting(); if (!foundCHProfilesMatchingWeighting()) { throw new CHProfileSelectionException("Cannot find CH profile for weighting map " + weightingMap + " in entries: " + entriesStrs + "."); } if (edgeBased != null && uTurnCosts != null) { return selectUsingEdgeBasedAndUTurnCosts(edgeBased, uTurnCosts); } else if (edgeBased != null) { return selectUsingEdgeBased(edgeBased); } else if (uTurnCosts != null) { return selectUsingUTurnCosts(uTurnCosts); } else { return selectUsingWeightingOnly(); } }
Source:
<code>protected String[] customCommandLineValidation() { <START> IOUtil.assertFileIsReadable(INPUT); <END> if (!isBamOrSamFile(INPUT) && IGNORE_READ_GROUPS) { return new String[]{"The parameter IGNORE_READ_GROUPS can only be used with BAM/SAM inputs."}; } return super.customCommandLineValidation(); }</code><technical_language>oh, I see, validating Readability here..</technical_language>

Target:
protected String[] customCommandLineValidation() { IOUtil.assertFileIsReadable(INPUT); boolean isBamOrSamFile = isBamOrSamFile(INPUT); if (!isBamOrSamFile && IGNORE_READ_GROUPS) { return new String[]{"The parameter IGNORE_READ_GROUPS can only be used with BAM/SAM inputs."}; } if (isBamOrSamFile && OBSERVED_SAMPLE_ALIAS != null) { return new String[]{"The parameter OBSERVED_SAMPLE_ALIAS can only be used with a VCF input."}; } return super.customCommandLineValidation(); }
Source:
<code>public EntryChangeViewModel(BibEntry entry, BibEntry newEntry, BibDatabaseContext database) { super(); this.firstEntry = entry; this.secondEntry = newEntry; name = entry.getCiteKeyOptional() .map(key -> Localization.lang("Modified entry") + ": '" + key + '\'') .orElse(Localization.lang("Modified entry")); <START> mergePanel = new MergeEntries(firstEntry, secondEntry, database.getMode()); <END> }</code><technical_language>Please move this initialization description method, a lot of changed entries result in a huge number of initialized controls</technical_language>

Target:
public EntryChangeViewModel(BibEntry entry, BibEntry newEntry, BibDatabaseContext database) { super(); this.oldEntry = entry; this.newEntry = newEntry; this.database = database; name = entry.getCiteKeyOptional() .map(key -> Localization.lang("Modified entry") + ": '" + key + '\'') .orElse(Localization.lang("Modified entry")); }
Source:
<code><START> public static ByteBuffer serializeState(final Object obj) throws IOException { <END> try(ByteArrayOutputStream b = new ByteArrayOutputStream()){ try(ObjectOutputStream o = new ObjectOutputStream(b)){ o.writeObject(obj); o.flush(); } return ByteBuffer.wrap(b.toByteArray()); } }</code><technical_language>public</technical_language>

Target:
private static ByteBuffer serializeState(final Object obj) throws RuntimeException { try { try (final ByteArrayOutputStream b = new ByteArrayOutputStream()) { try (final ObjectOutputStream o = new ObjectOutputStream(b)) { o.writeObject(obj); o.flush(); } return ByteBuffer.wrap(b.toByteArray()); } } catch (final IOException e) { LOG.log(Level.SEVERE, "An exception occured while serializing the state."); e.printStackTrace(); throw new RuntimeException("Error while serializing the operator state."); } }
Source:
<code>private String waitForCid(CommandBuilder docker, Process p) throws InterruptedException, IOException { for (int i = 0; i < 10; i++) { Thread.sleep(500); String output = IOUtils.toString(p.getInputStream()); try { if (p.exitValue() != 0) { throw new IOException("docker died unexpectedly: " + docker + "\n" + output); } } catch (IllegalThreadStateException e) { } if (output != null && output.length() != 0) { return output.trim(); } } <START> throw new IOException("docker didn't leave CID file yet still running. Huh?: "+docker+"\n"+IOUtils.toString(p.getInputStream())); <END> }</code><technical_language>didn;t ask leave a CID file..</technical_language>

Target:
private String waitForCid(CommandBuilder docker, Process p) throws InterruptedException, IOException { String output = IOUtils.toString(p.getInputStream()); if (p.waitFor() != 0) { throw new IOException("docker died unexpectedly with return code " + p.exitValue() + " : " + docker + "\n" + output); } if (output != null && output.length() != 0) { return output.trim(); } throw new IOException("docker didn't output a container id or have a non-zero exit status. Huh?: "+docker); }
Source:
<code>public void buildsTextFromIntArray() throws Exception { final Object[][] pairs = new Object[][] { new Object[] {new int[0], EMPTY_ARRAY}, new Object[] {new int[] {1}, "[1]"}, new Object[] {new int[] {1, 2, 3}, "[1, 2, 3]"}, }; <START> for (final Object[] pair : pairs) { <END> MatcherAssert.assertThat( Mnemos.toText(pair[0], false, false), Matchers.equalTo(pair[1].toString()) ); } }</code><technical_language>this for is in array tests, move a private method</technical_language>

Target:
public void buildsTextFromIntArray() throws Exception { final Object[][] pairs = new Object[][] { new Object[] {new int[0], MnemosTest.EMPTY_ARRAY}, new Object[] {new int[] {1}, "[1]"}, new Object[] {new int[] {1, 2, 3}, "[1, 2, 3]"}, }; this.validateText(pairs); }
Source:
<code>public Content findContent(Context context, CachingOptions cachingOptions, String url) throws InvalidContextException, StoreException { if (context.getStoreAdapter().exists(context, cachingOptions, url)) { return context.getStoreAdapter().findContent(context, cachingOptions, url); } else { String blobUrl = blobUrlResolver.getBlobUrl(url); <START> if(context.getStoreAdapter().exists(context, cachingOptions, blobUrl)) { <END> Content content = context.getStoreAdapter().findContent(context, cachingOptions, blobUrl); try(InputStream is = content.getInputStream()) { Blob blob = mapper.readValue(is, Blob.class); Function<String, InputStream> configGetter = path -> { try { return findContent(context, cachingOptions, path).getInputStream(); } catch (Exception e) { return null; } }; BlobStore store = blobStoreResolver.getById(configGetter, blob.getStoreId()); return new ResourceBasedContent(store.getResource(blob)); } catch (IOException e) { throw new StoreException("Error reading blob file at " + blobUrl, e); } } } return null; }</code><technical_language>Space if</technical_language>

Target:
public Content findContent(Context context, CachingOptions cachingOptions, String url) throws InvalidContextException, StoreException { if (context.getStoreAdapter().exists(context, cachingOptions, url)) { return context.getStoreAdapter().findContent(context, cachingOptions, url); } else { String blobUrl = blobUrlResolver.getBlobUrl(url); if (context.getStoreAdapter().exists(context, cachingOptions, blobUrl)) { Content content = context.getStoreAdapter().findContent(context, cachingOptions, blobUrl); try (InputStream is = content.getInputStream()) { Blob blob = mapper.readValue(is, Blob.class); Function<String, InputStream> configGetter = path -> { try { return findContent(context, cachingOptions, path).getInputStream(); } catch (Exception e) { return null; } }; BlobStore store = blobStoreResolver.getById(configGetter, blob.getStoreId()); return new ResourceBasedContent(store.getResource(blob)); } catch (IOException | ConfigurationException e) { throw new StoreException("Error reading blob file at " + blobUrl, e); } } } return null; }
Source:
<code>public Object visit(PropertyIsEqualTo filter, Object extraData) { <START> Optional<FilterFunction_pgNearest> nearestOpt = getNearestFilter(filter); <END> if (nearestOpt.isPresent()) { return visit(nearestOpt.get(), extraData); } else { return super.visit(filter, extraData); } }</code><technical_language>Un-necessary usage of Optional, literally replaces a null check. If Optional is handle a chain of transformations/getters potential null values, sense, if is a chance in setting (public API) sense (unless a performance critical bit), in a private setting this one, is please avoid plain nulls</technical_language>

Target:
public Object visit(PropertyIsEqualTo filter, Object extraData) { helper.out = out; FilterFunction_pgNearest nearest = helper.getNearestFilter(filter); if (nearest != null) { return helper.visit( nearest, extraData, new FilterToSqlHelper.NearestHelperContext( pgDialect, (a, b) -> { try { pgDialect.encodeGeometryValue( a, helper.getFeatureTypeGeometryDimension(), helper.getFeatureTypeGeometrySRID(), b); } catch (IOException e) { throw new RuntimeException(e); } })); } else { return super.visit(filter, extraData); } }
Source:
<code>public void resilientToRepeatedRedirects() { server.stubFor(TIMESTAMP_MAPPING.willReturn(aResponse() .withStatus(308) <START> .withHeader("Location", getUriForPort(serverPort)))); <END> Instant start = Instant.now(); ExecutorService ex = PTExecutors.newSingleThreadExecutor(true); ex.submit(this::scheduleServerRecoveryAfterFiveSeconds); assertThatCode(this::makeTimestampsRequest).doesNotThrowAnyException(); assertThat(Instant.now()) .as("should recover in a second after things are good again") .isBefore(start.plus(Duration.ofSeconds(11))); ex.shutdown(); }</code><technical_language>Magic header strings best, for user agents</technical_language>

Target:
public void resilientToRepeatedRedirects() { server.stubFor(TIMESTAMP_MAPPING.willReturn(aResponse() .withStatus(308) .withHeader(HttpHeaders.LOCATION, getUriForPort(serverPort)))); Instant start = Instant.now(); ExecutorService ex = PTExecutors.newSingleThreadExecutor(true); ex.submit(this::scheduleServerRecoveryAfterFiveSeconds); assertThatCode(this::makeTimestampsRequest).doesNotThrowAnyException(); assertThat(Instant.now()) .as("should recover in a second after things are good again") .isBefore(start.plus(Duration.ofSeconds(6))); ex.shutdown(); }
Source:
<code>public static String removeCDATAFromPayload(String inputPayload) { if (inputPayload.startsWith("<![CDATA[")) { inputPayload = inputPayload.substring(9); <START> int i = inputPayload.indexOf("]]>"); <END> if (i == -1) throw new IllegalStateException("argument starts with <![CDATA[ but cannot find pairing ]]>"); inputPayload = inputPayload.substring(0, i); } return inputPayload; }</code><technical_language>index of returns, occurrence is a chance this break in CDATA CDATA scenario</technical_language>

Target:
public static String removeCDATAFromPayload(String inputPayload) { if (inputPayload.startsWith("<![CDATA[")) { inputPayload = inputPayload.substring(9); int i = inputPayload.lastIndexOf("]]>"); if (i == -1) throw new IllegalStateException("argument starts with <![CDATA[ but cannot find pairing ]]>"); inputPayload = inputPayload.substring(0, i); } return inputPayload; }
Source:
<code>public boolean doWorkunitAction(String wuid, ECLWUActions action) throws ArrayOfEspException, RemoteException, Exception { WUAction wa = new WUAction(); wa.setWUActionType(action); wa.setWuids(new String[] { wuid }); WUActionResponse war = this.getSoapProxy().getWsWorkunitsServiceSoap().WUAction(wa); if (war == null || war.getActionResults() == null || war.getActionResults().length == 0 || war.getActionResults()[0].getResult() == null || !war.getActionResults()[0].getResult().equals("Success")) { org.hpccsystems.ws.client.gen.wsworkunits.v1_56.WUAction fwa = new org.hpccsystems.ws.client.gen.wsworkunits.v1_56.WUAction(); fwa.setActionType(action.getValue()); fwa.setWuids(new String[] { wuid }); org.hpccsystems.ws.client.gen.wsworkunits.v1_56.WUActionResponse fwar = this.fallBackWorkunitsServiceSoapProxy.getWsWorkunitsServiceSoap().WUAction(fwa); if (fwar == null || fwar.getActionResults() == null || fwar.getActionResults().length == 0 || fwar.getActionResults()[0].getResult() == null || !fwar.getActionResults()[0].getResult().equals("Success")) { <START> throw new Exception("Unable to perform " + action.getValue() + " on " + wuid); <END> } } return true; }</code><technical_language>provide actual reason this failed</technical_language>

Target:
public boolean doWorkunitAction(String wuid, ECLWUActions action) throws ArrayOfEspException, RemoteException, Exception { WUAction wa = new WUAction(); wa.setWUActionType(action); wa.setWuids(new String[] { wuid }); WUActionResponse war = this.getSoapProxy().getWsWorkunitsServiceSoap().WUAction(wa); if (war == null || war.getActionResults() == null || war.getActionResults().length == 0 || war.getActionResults()[0].getResult() == null || !war.getActionResults()[0].getResult().equals("Success")) { org.hpccsystems.ws.client.gen.wsworkunits.v1_56.WUAction fwa = new org.hpccsystems.ws.client.gen.wsworkunits.v1_56.WUAction(); fwa.setActionType(action.getValue()); fwa.setWuids(new String[] { wuid }); org.hpccsystems.ws.client.gen.wsworkunits.v1_56.WUActionResponse fwar = this.fallBackWorkunitsServiceSoapProxy.getWsWorkunitsServiceSoap().WUAction(fwa); if (fwar == null || fwar.getActionResults() == null || fwar.getActionResults().length == 0 || fwar.getActionResults()[0].getResult() == null || !fwar.getActionResults()[0].getResult().equals("Success")) { String failreason = "unknown action result"; if (fwar != null && fwar.getActionResults() != null && fwar.getActionResults()[0].getResult() != null) failreason = fwar.getActionResults()[0].getResult(); throw new Exception("Unable to perform " + action.getValue() + " on " + wuid + " :: " + failreason); } } return true; }
Source:
<code><START> private Stage toStage(Map stage) { <END> return Stage.newBuilder() .setType(stage.get("type").toString()) .setStatus(Status.valueOf(stage.get("status").toString().toUpperCase())) .build(); }</code><technical_language>for mentioning this in proto review, this weird. I this proto fields: * spinnaker_instance * application * execution if anything, stacked other way: execution application field a spinnaker_instance field. execution is a property of application... for catching this before, this is backwards..</technical_language>

Target:
private Stage toStage(Map stage) { return Stage.newBuilder() .setType(stage.getOrDefault("type", "unknown").toString()) .setStatus(Status.valueOf(stage.getOrDefault("status", "UNKNOWN").toString().toUpperCase())) .build(); }
Source:
<code>public void testBuildHistory() { int historySize = 8; MissionControlView view = jenkins.views.create(MissionControlView.class, "mission-control-sample-view"); view.configure(); view.setHideBuildHistory(false); view.setHistorySize(historySize); view.save(); String strSimpleJob = "simple-job"; String strFailedJob = "simple-failed-job"; FreeStyleJob job = jenkins.jobs.create(FreeStyleJob.class, strSimpleJob); for (int i = 0; i < historySize + 2; ++i) { job.startBuild().waitUntilFinished(); } job = jenkins.jobs.create(FreeStyleJob.class, strFailedJob); job.configure(); job.addShellStep("sh <"); job.save(); job.startBuild().waitUntilFinished(); view.open(); WebElement buildHistory = driver.findElement(By.id("jenkinsBuildHistory")); <START> Assert.assertEquals(0, buildHistory.findElements(By.xpath(". END> view.reloadConfiguration(); view.open(); buildHistory = driver.findElement(By.id("jenkinsBuildHistory")); Assert.assertEquals(historySize, buildHistory.findElements(By.xpath(". WebElement failedBuild = buildHistory.findElement(By.xpath(". assertThat(failedBuild.getAttribute("class"), containsString("danger")); for (WebElement successfulBuild : buildHistory.findElements(By.xpath(". assertThat(successfulBuild.getAttribute("class"), containsString("")); } }</code><technical_language>Harmcrest matcher assertThat(buildHistory.findElements(By.xpath(".//tbody/tr")), hasSize(0));</technical_language>

Target:
public void testBuildHistory() { int historySize = 8; MissionControlView view = jenkins.views.create(MissionControlView.class, "mission-control-sample-view"); view.configure(); view.setHideBuildHistory(false); view.setHistorySize(historySize); view.save(); String strSimpleJob = "simple-job"; String strFailedJob = "simple-failed-job"; FreeStyleJob job = jenkins.jobs.create(FreeStyleJob.class, strSimpleJob); for (int i = 0; i < historySize; ++i) { job.startBuild().waitUntilFinished(); } job = jenkins.jobs.create(FreeStyleJob.class, strFailedJob); job.configure(); job.addShellStep("sh <"); job.save(); job.startBuild().waitUntilFinished(); view.open(); assertThat(view.getBuildHistoryArea().getBuildHistorySize(), is(0)); view.reloadConfiguration(); view.open(); assertThat(view.getBuildHistoryArea().getBuildHistorySize(), is(historySize)); assertThat(view.getBuildHistoryArea().getFailedBuildsOfJob(strFailedJob), hasSize(1)); assertThat(view.getBuildHistoryArea().getSuccessfulBuildsOfJob(strSimpleJob), hasSize(historySize - 1)); }
Source:
<code>private KafkaSupervisor getSupervisor( int replicas, int taskCount, boolean useEarliestOffset, String duration, Period lateMessageRejectionPeriod ) { KafkaSupervisorIOConfig kafkaSupervisorIOConfig = new KafkaSupervisorIOConfig( KAFKA_TOPIC, replicas, taskCount, new Period(duration), ImmutableMap.of("myCustomKey", "myCustomValue", "bootstrap.servers", kafkaHost), new Period("P1D"), new Period("PT30S"), useEarliestOffset, new Period("PT30M"), lateMessageRejectionPeriod ); KafkaIndexTaskClientFactory taskClientFactory = new KafkaIndexTaskClientFactory(null, null) { @Override public KafkaIndexTaskClient build( TaskInfoProvider taskInfoProvider, String dataSource, int numThreads, Duration httpTimeout, long numRetries ) { Assert.assertEquals(TEST_CHAT_THREADS, numThreads); Assert.assertEquals(TEST_HTTP_TIMEOUT.toStandardDuration(), httpTimeout); Assert.assertEquals(TEST_CHAT_RETRIES, numRetries); return taskClient; } }; return new TestableKafkaSupervisor( taskStorage, taskMaster, indexerMetadataStorageCoordinator, taskClientFactory, objectMapper, new KafkaSupervisorSpec( dataSchema, tuningConfig, kafkaSupervisorIOConfig, null, taskStorage, taskMaster, indexerMetadataStorageCoordinator, taskClientFactory, objectMapper, new NoopServiceEmitter() ) ); <START> } <END></code><technical_language>is add basic UT</technical_language>

Target:
private KafkaSupervisor getSupervisor( int replicas, int taskCount, boolean useEarliestOffset, String duration, Period lateMessageRejectionPeriod ) { KafkaSupervisorIOConfig kafkaSupervisorIOConfig = new KafkaSupervisorIOConfig( KAFKA_TOPIC, replicas, taskCount, new Period(duration), ImmutableMap.of("myCustomKey", "myCustomValue", "bootstrap.servers", kafkaHost), new Period("P1D"), new Period("PT30S"), useEarliestOffset, new Period("PT30M"), lateMessageRejectionPeriod ); KafkaIndexTaskClientFactory taskClientFactory = new KafkaIndexTaskClientFactory(null, null) { @Override public KafkaIndexTaskClient build( TaskInfoProvider taskInfoProvider, String dataSource, int numThreads, Duration httpTimeout, long numRetries ) { Assert.assertEquals(TEST_CHAT_THREADS, numThreads); Assert.assertEquals(TEST_HTTP_TIMEOUT.toStandardDuration(), httpTimeout); Assert.assertEquals(TEST_CHAT_RETRIES, numRetries); return taskClient; } }; return new TestableKafkaSupervisor( taskStorage, taskMaster, indexerMetadataStorageCoordinator, taskClientFactory, objectMapper, new KafkaSupervisorSpec( dataSchema, tuningConfig, kafkaSupervisorIOConfig, null, taskStorage, taskMaster, indexerMetadataStorageCoordinator, taskClientFactory, objectMapper, new NoopServiceEmitter(), new DruidMonitorSchedulerConfig() ) ); }
Source:
<code><START> public boolean isArray(Schema<?> schema) { <END> return schema instanceof ArraySchema; }</code><technical_language>static (same for isMap)</technical_language>

Target:
private static boolean isArray(Schema<?> schema) { return schema instanceof ArraySchema; }
Source:
<code>public Socket connect(HostAndPort addr, int timeout, ConnectionWatcher optionalWatcher, boolean allowClientSocketFactory, int socketBufferSize, boolean useSSL, TcpSocketFactory socketFactory) throws IOException { if (useSSL) { throw new IllegalArgumentException(); } Socket socket = null; if (allowClientSocketFactory) { socket = createCustomClientSocket(addr); } if (socket == null) { socket = socketFactory.createSocket(); socket.setKeepAlive(ENABLE_TCP_KEEP_ALIVE); if (socketBufferSize != -1) { socket.setReceiveBufferSize(socketBufferSize); } if (optionalWatcher != null) { optionalWatcher.beforeConnect(socket); } InetSocketAddress inetSocketAddress = addr.getSocketInetAddress(); try { socket.connect(inetSocketAddress, Math.max(timeout, 0)); } catch (ConnectException connectException) { <START> LogService.getLogger().info("Failed to connect to " + inetSocketAddress); <END> throw connectException; } finally { if (optionalWatcher != null) { optionalWatcher.afterConnect(socket); } } } return socket; }</code><technical_language>This debugging code left in. Delete it</technical_language>

Target:
public Socket connect(HostAndPort addr, int timeout, ConnectionWatcher optionalWatcher, boolean allowClientSocketFactory, int socketBufferSize, boolean useSSL, TcpSocketFactory socketFactory) throws IOException { if (useSSL) { throw new IllegalArgumentException(); } Socket socket = null; if (allowClientSocketFactory) { socket = createCustomClientSocket(addr); } if (socket == null) { socket = socketFactory.createSocket(); socket.setKeepAlive(ENABLE_TCP_KEEP_ALIVE); if (socketBufferSize != -1) { socket.setReceiveBufferSize(socketBufferSize); } if (optionalWatcher != null) { optionalWatcher.beforeConnect(socket); } InetSocketAddress inetSocketAddress = addr.getSocketInetAddress(); try { socket.connect(inetSocketAddress, Math.max(timeout, 0)); } catch (ConnectException connectException) { logger.info("Failed to connect to " + inetSocketAddress); throw connectException; } finally { if (optionalWatcher != null) { optionalWatcher.afterConnect(socket); } } } return socket; }
Source:
<code>public ResponseEntity<String> scheduleMappingJob(@RequestParam String mappingProjectId, @RequestParam String targetEntityTypeId, @RequestParam(required = false) String label, @RequestParam(required = false, name = "package") String packageId, @RequestParam(required = false) Boolean addSourceAttribute) throws URISyntaxException { mappingProjectId = mappingProjectId.trim(); targetEntityTypeId = targetEntityTypeId.trim(); label = trim(label); packageId = trim(packageId); try { validateEntityName(targetEntityTypeId); if (mappingService.getMappingProject(mappingProjectId) == null) { throw new UnknownMappingProjectException(mappingProjectId); } if (packageId != null) { Package pack = dataService.getMeta().getPackage(packageId); if (pack == null) { throw new UnknownPackageException(packageId); } if (isSystemPackage(pack)) { throw new IllegalTargetPackageException(packageId); } } } <START> catch (CodedRuntimeException cre) <END> { return ResponseEntity.badRequest().contentType(TEXT_PLAIN).body(cre.getLocalizedMessage()); } MappingJobExecution mappingJobExecution = scheduleMappingJobInternal(mappingProjectId, targetEntityTypeId, addSourceAttribute, packageId, label); String jobHref = concatEntityHref(mappingJobExecution); return created(new URI(jobHref)).contentType(TEXT_PLAIN).body(jobHref); }</code><technical_language>This is longer job of Controller, I think</technical_language>

Target:
public ResponseEntity<String> scheduleMappingJob(@RequestParam String mappingProjectId, @RequestParam String targetEntityTypeId, @RequestParam(required = false) String label, @RequestParam(required = false, name = "package") String packageId, @RequestParam(required = false) Boolean addSourceAttribute) throws URISyntaxException { mappingProjectId = mappingProjectId.trim(); targetEntityTypeId = targetEntityTypeId.trim(); label = trim(label); packageId = trim(packageId); validateEntityName(targetEntityTypeId); if (mappingService.getMappingProject(mappingProjectId) == null) { throw new UnknownEntityException(mappingProjectMetaData, mappingProjectId); } if (packageId != null) { Package pack = dataService.getMeta().getPackage(packageId); if (pack == null) { throw new UnknownPackageException(packageId); } if (isSystemPackage(pack)) { throw new IllegalTargetPackageException(packageId); } } MappingJobExecution mappingJobExecution = scheduleMappingJobInternal(mappingProjectId, targetEntityTypeId, addSourceAttribute, packageId, label); String jobHref = concatEntityHref(mappingJobExecution); return created(new URI(jobHref)).contentType(TEXT_PLAIN).body(jobHref); }
Source:
<code>protected void doWork(ProductInterface product) throws Exception { try { worker.doWork(); } catch (Exception e) { if (errorCount.incrementAndGet() > MAX_ERRORS) { e.printStackTrace(); <START> Thread.currentThread().interrupt(); <END> } else { System.err.printf("%s: %s%n", getProductWorker().getName(), e.getMessage()); } } }</code><technical_language>Please explain interrupt is exception</technical_language>

Target:
protected void doWork(ProductInterface product) throws Exception { try { worker.doWork(); } catch (Exception e) { if (errorCount.incrementAndGet() > MAX_ERRORS) { e.printStackTrace(); throw e; } else { System.err.printf("%s: %s%n", getProductWorker().getName(), e.getMessage()); } } }
Source:
<code>public URL getAuthenticatedUrl(@NonNull TaskRepository repository, @NonNull IRepositoryElement element) { URL resultUrl = null; try { String url = element.getUrl(); <START> String urlString = url.replace("/rest.cgi/bug/", "/show_bug.cgi?id="); END> resultUrl = new URL(urlString); } catch (MalformedURLException e) { e.printStackTrace(); } return resultUrl; }</code><technical_language>do this for Tasks repository elements</technical_language>

Target:
public URL getAuthenticatedUrl(@NonNull TaskRepository repository, @NonNull IRepositoryElement element) { if (element instanceof ITask) { try { String url = element.getUrl(); String urlString = url.replace("/rest.cgi/bug/", "/show_bug.cgi?id="); return new URL(urlString); } catch (MalformedURLException e) { StatusHandler.log( new Status(IStatus.ERROR, BugzillaRestCore.ID_PLUGIN, "could not create url from string", e)); } } return super.getAuthenticatedUrl(repository, element); }
Source:
<code>public void invalidityInfoFor_invalidGender_returnErrorString() { String invalidGender = "alpha male"; String actual = validator.getInvalidityInfoForGender(invalidGender); assertEquals("Invalid gender should return appropriate error string", String.format(GENDER_ERROR_MESSAGE, invalidGender), actual); invalidGender = "<script> alert('hi!'); </script>"; actual = validator.getInvalidityInfoForGender(invalidGender); <START> assertEquals("Invalid gender should return appropriate error string", <END> String.format(GENDER_ERROR_MESSAGE, SanitizationHelper.sanitizeForHtml(invalidGender)), actual); }</code><technical_language>"Invalid gender return error string" error message is informative developer? sth "Unsanitized content return error string"</technical_language>

Target:
public void invalidityInfoFor_invalidGender_returnErrorString() { String invalidGender = "alpha male"; String actual = validator.getInvalidityInfoForGender(invalidGender); assertEquals("Invalid gender should return appropriate error stirng", String.format(GENDER_ERROR_MESSAGE, invalidGender), actual); invalidGender = "<script> alert('hi!'); </script>"; actual = validator.getInvalidityInfoForGender(invalidGender); assertEquals("Unsanitized, invalid gender should return appropriate error string", String.format(GENDER_ERROR_MESSAGE, SanitizationHelper.sanitizeForHtml(invalidGender)), actual); }
Source:
<code><START> private void testLOB() throws SQLException { <END> deleteDb("bigResult"); Connection conn = getConnection("bigResult"); Statement stat = conn.createStatement(); stat.execute("SET MAX_MEMORY_ROWS " + 1); stat.execute("CREATE TABLE TEST(ID INT PRIMARY KEY, VALUE BLOB NOT NULL)"); PreparedStatement ps = conn.prepareStatement("INSERT INTO TEST VALUES (?, ?)"); byte[] data = new byte[1_000_000]; for (int i = 1; i <= 10; i++) { ps.setInt(1, i); Arrays.fill(data, (byte) i); ps.setBytes(2, data); ps.executeUpdate(); } Blob[] blobs = new Blob[10]; ResultSet rs = stat.executeQuery("SELECT * FROM TEST"); for (int i = 1; i <= 10; i++) { assertTrue(rs.next()); assertEquals(i, rs.getInt(1)); blobs[i - 1] = rs.getBlob(2); } assertFalse(rs.next()); rs.close(); for (int i = 1; i <= 10; i++) { Blob b = blobs[i - 1]; byte[] bytes = b.getBytes(1, (int) b.length()); Arrays.fill(data, (byte) i); assertEquals(data, bytes); b.free(); } conn.close(); }</code><technical_language>nice test LOB CLOB, slightly paths in some places occasionally resulted in bugs</technical_language>

Target:
private void testLOB() throws SQLException { deleteDb("bigResult"); Connection conn = getConnection("bigResult"); Statement stat = conn.createStatement(); stat.execute("SET MAX_MEMORY_ROWS " + 1); stat.execute("CREATE TABLE TEST(ID INT PRIMARY KEY, VALUE BLOB NOT NULL)"); PreparedStatement ps = conn.prepareStatement("INSERT INTO TEST VALUES (?, ?)"); int length = 1_000_000; byte[] data = new byte[length]; for (int i = 1; i <= 10; i++) { ps.setInt(1, i); Arrays.fill(data, (byte) i); ps.setBytes(2, data); ps.executeUpdate(); } Blob[] blobs = new Blob[10]; ResultSet rs = stat.executeQuery("SELECT * FROM TEST"); for (int i = 1; i <= 10; i++) { assertTrue(rs.next()); assertEquals(i, rs.getInt(1)); blobs[i - 1] = rs.getBlob(2); } assertFalse(rs.next()); rs.close(); for (int i = 1; i <= 10; i++) { Blob b = blobs[i - 1]; byte[] bytes = b.getBytes(1, (int) b.length()); Arrays.fill(data, (byte) i); assertEquals(data, bytes); b.free(); } stat.execute("DROP TABLE TEST"); stat.execute("CREATE TABLE TEST(ID INT PRIMARY KEY, VALUE CLOB NOT NULL)"); ps = conn.prepareStatement("INSERT INTO TEST VALUES (?, ?)"); char[] cdata = new char[length]; for (int i = 1; i <= 10; i++) { ps.setInt(1, i); Arrays.fill(cdata, (char) i); ps.setString(2, new String(cdata)); ps.executeUpdate(); } Clob[] clobs = new Clob[10]; rs = stat.executeQuery("SELECT * FROM TEST"); for (int i = 1; i <= 10; i++) { assertTrue(rs.next()); assertEquals(i, rs.getInt(1)); clobs[i - 1] = rs.getClob(2); } assertFalse(rs.next()); rs.close(); for (int i = 1; i <= 10; i++) { Clob c = clobs[i - 1]; String string = c.getSubString(1, (int) c.length()); Arrays.fill(cdata, (char) i); assertEquals(new String(cdata), string); c.free(); } conn.close(); }
Source:
<code>public void visitNode(Tree tree) { ExpressionTree target = null; ExpressionTree shift = null; if (tree.is(Kind.LEFT_SHIFT, Kind.RIGHT_SHIFT)) { BinaryExpressionTree binaryExpressionTree = (BinaryExpressionTree) tree; target = binaryExpressionTree.leftOperand(); shift = binaryExpressionTree.rightOperand(); } else { AssignmentExpressionTreeImpl assignmentExpressionTree = (AssignmentExpressionTreeImpl) tree; target = assignmentExpressionTree.variable(); shift = assignmentExpressionTree.expression(); } String identifier = getIdentifierName(target); boolean expectLong = treeTypeIsLong(target); boolean expectInt = treeTypeIsInt(target); boolean shiftIsMinus = shift.is(Kind.UNARY_MINUS); if (shift.is(Kind.UNARY_MINUS, Kind.UNARY_PLUS)) { shift = ((UnaryExpressionTree) shift).expression(); } if (isShiftEvaluable(shift, expectInt || expectLong)) { <START> String value = ((LiteralTreeImpl) shift).value(); <END> long numberBits = (shiftIsMinus ? -1 : 1) * (expectInt ? Integer.parseInt(value) : Long.parseLong(value)); long reducedNumberBits = numberBits % (expectLong ? 64 : 32); insertIssue(tree, numberBits, reducedNumberBits, expectInt, identifier); } }</code><technical_language>need cast LiteralTreeImpl in this case : LiteralTree is sufficient</technical_language>

Target:
public void visitNode(Tree tree) { String identifier; ExpressionTree shift; if (tree.is(Kind.LEFT_SHIFT, Kind.RIGHT_SHIFT)) { BinaryExpressionTree binaryExpressionTree = (BinaryExpressionTree) tree; identifier = getIdentifierName(binaryExpressionTree.leftOperand()); shift = binaryExpressionTree.rightOperand(); } else { AssignmentExpressionTree assignmentExpressionTree = (AssignmentExpressionTree) tree; identifier = getIdentifierName(assignmentExpressionTree.variable()); shift = assignmentExpressionTree.expression(); } int sign = shift.is(Kind.UNARY_MINUS) ? -1 : 1; if (shift.is(Kind.UNARY_MINUS, Kind.UNARY_PLUS)) { shift = ((UnaryExpressionTree) shift).expression(); } if (shift.is(Kind.INT_LITERAL, Kind.LONG_LITERAL)) { int base = getBase(tree); long numberBits = sign * Long.decode(((LiteralTree) shift).value()); long reducedNumberBits = numberBits % base; String message = getMessage(numberBits, reducedNumberBits, base, identifier); if (message != null) { addIssue(tree, message); } } }
Source:
<code>public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } <START> if (getClass() != obj.getClass()) { <END> return false; } ConnectorId other = (ConnectorId) obj; if (this.connectorType == null) { if (other.connectorType != null) { return false; } } else if (!this.connectorType.equals(other.connectorType)) { return false; } if (this.domainType == null) { if (other.domainType != null) { return false; } } else if (!this.domainType.equals(other.domainType)) { return false; } if (this.instanceId == null) { if (other.instanceId != null) { return false; } } else if (!this.instanceId.equals(other.instanceId)) { return false; } return true; }</code><technical_language>I allow a comparison a String (fullId) Metdata (map)</technical_language>

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() == obj.getClass()) { ConnectorId other = (ConnectorId) obj; return equals(other); } if (Map.class.isInstance(obj)) { Map<?, ?> metadata = (Map<?, ?>) obj; return toMetaData().equals(metadata); } if (obj instanceof String) { return toFullID().equals(obj); } return false; }
Source:
<code>public static boolean isCidrFormatValid(String cidr) { <START> return (cidr == null || !cidr.matches(getCidrRegex())) ? <END> false : true; }</code><technical_language>a user sends empty cidr (i.e. supplied in parameters) fail this validation</technical_language>

Target:
public static boolean isCidrFormatValid(String cidr) { return (cidr == null || !cidr.matches(ValidationUtils.CIDR_FORMAT_PATTERN)) ? false : true; }
Source:
<code>private void updateIsLiveMergeSupported(Object entity) { if (entity == null) { return; } VM vm = (VM) entity; if (vm.getRunOnVds() == null || !AsyncDataProvider.getInstance().isLiveMergeSupported(vm)) { setLiveMergeSupported(false); return; } AsyncQuery query = new AsyncQuery(this, new INewAsyncCallback() { @Override public void onSuccess(Object model, Object returnValue) { <START> VmSnapshotListModel target = (VmSnapshotListModel) model; <END> VDS vds = (VDS) returnValue; target.setLiveMergeSupported(vds.getLiveMergeSupport()); } }); AsyncDataProvider.getInstance().getHostById(query, vm.getRunOnVds()); }</code><technical_language>for readability/consistency: s/target/vmSnapshotListModel</technical_language>

Target:
private void updateIsLiveMergeSupported(Object entity) { if (entity == null) { return; } VM vm = (VM) entity; if (vm.getRunOnVds() == null || !AsyncDataProvider.getInstance().isLiveMergeSupported(vm)) { setLiveMergeSupported(false); return; } AsyncQuery query = new AsyncQuery(this, new INewAsyncCallback() { @Override public void onSuccess(Object model, Object returnValue) { VmSnapshotListModel vmSnapshotListModel = (VmSnapshotListModel) model; VDS vds = (VDS) returnValue; vmSnapshotListModel.setLiveMergeSupported(vds.getLiveMergeSupport()); } }); AsyncDataProvider.getInstance().getHostById(query, vm.getRunOnVds()); }
Source:
<code>public void getGeoSpeedAlerts() throws Exception { String result; result = geoLocationProviderServiceImpl.getSpeedAlerts(getDeviceIdentifier()); Assert.assertNotNull(result); Assert.assertEquals(result, "{'speedLimit':" + <START> SAMPLE_SPEED_ALERT_VALUE + "}"); <END> }</code><technical_language>Formatting issue</technical_language>

Target:
public void getGeoSpeedAlerts() throws GeoLocationBasedServiceException { String result; result = geoLocationProviderServiceImpl.getSpeedAlerts(getDeviceIdentifier()); Assert.assertNotNull(result); Assert.assertEquals(result, "{'speedLimit':" + SAMPLE_SPEED_ALERT_VALUE + "}"); }
Source:
<code>public static Throwable from(Throwable throwable) { String message = String.format("%s [%s] occurred while processing thread (%s)", highLevelType(throwable), throwable, Thread.currentThread().getName()); <START> return new SuppressedException(message); <END> }</code><technical_language>is this want? means lose stacktrace information for suppressed exception, right</technical_language>

Target:
public static Throwable from(Throwable throwable) { String message = String.format("%s [%s] occurred while processing thread (%s)", highLevelType(throwable), throwable, Thread.currentThread().getName()); SuppressedException suppressedException = new SuppressedException(message); suppressedException.setStackTrace(throwable.getStackTrace()); return suppressedException; }