auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void setInstitutionPanels( Map<String, List<FeedbackSessionAttributes>> map, Map<String, String> sessionToInstructorIdMap) { institutionPanels = new ArrayList<InstitutionPanel>(); for (String key : map.keySet()) { <START> if (!key.equals("Unknown")) { <END> institutionPanels.add(new InstitutionPanel( key, getFeedbackSessionRows( map.get(key), sessionToInstructorIdMap))); } } String key = "Unknown"; List<FeedbackSessionAttributes> feedbackSessions = map.get(key); if (feedbackSessions != null) { institutionPanels.add(new InstitutionPanel( key, getFeedbackSessionRows( feedbackSessions, sessionToInstructorIdMap))); } }</code><technical_language>good extract "Unknown" a constant in this class</technical_language>

Target:
public void setInstitutionPanels( Map<String, List<FeedbackSessionAttributes>> map, Map<String, String> sessionToInstructorIdMap) { institutionPanels = new ArrayList<InstitutionPanel>(); for (String key : map.keySet()) { if (!key.equals(UNKNOWN_INSTITUTION)) { institutionPanels.add(new InstitutionPanel( key, getFeedbackSessionRows( map.get(key), sessionToInstructorIdMap))); } } String key = UNKNOWN_INSTITUTION; List<FeedbackSessionAttributes> feedbackSessions = map.get(key); if (feedbackSessions != null) { institutionPanels.add(new InstitutionPanel( key, getFeedbackSessionRows( feedbackSessions, sessionToInstructorIdMap))); } }
Source:
<code>private void waitBetweenPolls() { <START> while(lastTimeBeforePoll != null && System.currentTimeMillis() - lastTimeBeforePoll < POLLING_BREAK) { <END> try { Thread.sleep(POLLING_BREAK); } catch (InterruptedException e) { } } lastTimeBeforePoll = System.currentTimeMillis(); }</code><technical_language>please formatter</technical_language>

Target:
private void waitBetweenPolls() { while (timestampOfEndOfPreviousInvocation != null && System.currentTimeMillis() - timestampOfEndOfPreviousInvocation < POLLING_BREAK) { try { Thread.sleep(POLLING_BREAK); } catch (InterruptedException e) { } } }
Source:
<code>public double[] call(double[] values) throws MLModelBuilderException { try { double[] normalizedValues = new double[values.length]; for (int i = 0; i < values.length; i++) { if (values[i] > max.get(i)) { normalizedValues[i] = 1; } else if (values[i] < min.get(i)) { normalizedValues[i] = 0; } else if (min.get(i) == max.get(i)) { normalizedValues[i] = 0.5; } else { normalizedValues[i] = (values[i] - min.get(i)) / (max.get(i) - min.get(i)); } } return normalizedValues; } catch (Exception e) { throw new MLModelBuilderException("An error occurred while normalizing values: " + e.getMessage(), e); } <START> } <END></code><technical_language>Please write a unit test test this transformation</technical_language>

Target:
public double[] call(double[] values) throws MLModelBuilderException { try { double[] normalizedValues = new double[values.length]; for (int i = 0; i < values.length; i++) { if (Double.compare(values[i], max.get(i)) > 0) { normalizedValues[i] = 1.0; } else if (Double.compare(values[i], min.get(i)) < 0) { normalizedValues[i] = 0.0; } else if (Double.compare(min.get(i), max.get(i)) == 0) { normalizedValues[i] = 0.5; } else { normalizedValues[i] = (values[i] - min.get(i)) / (max.get(i) - min.get(i)); } } return normalizedValues; } catch (Exception e) { throw new MLModelBuilderException("An error occurred while normalizing values: " + e.getMessage(), e); } }
Source:
<code>private boolean haveGitHubIdEntry(ReviewDb db, Account.Id accountId, AccountExternalId.Key key) throws OrmException { boolean found = false; for (AccountExternalId id : db.accountExternalIds().byAccount(accountId)) { if (id.getKey().equals(key)) { <START> found = true; break; <END> } } return found; }</code><technical_language>Local variable is necessary. Instead, do: return true;</technical_language>

Target:
private boolean haveGitHubIdEntry(ReviewDb db, Account.Id accountId, AccountExternalId.Key key) throws OrmException { boolean found = false; for (AccountExternalId id : db.accountExternalIds().byAccount(accountId)) { if (id.getKey().equals(key)) { return true; } } return false; }
Source:
<code>private String unescapeEscapedJsonString(final String escapedJsonString) throws IOException, XPathException { <START> JsonFactory jsonFactory = new JsonFactory(); <END> StringBuilder unescapedJsonStringBuilder = new StringBuilder(); String unescapedJsonString; try { JsonParser jsonParser = jsonFactory.createParser("\"" + escapedJsonString + "\""); while (!jsonParser.isClosed()) { JsonToken jsonToken = jsonParser.nextToken(); if (jsonParser.hasTextCharacters()) { unescapedJsonStringBuilder.append(jsonParser.getValueAsString()); } } } catch (JsonParseException e) { logger.error("fn:xml-to-json(): FOJS0007: Bad JSON escape sequence. XML claims string is escaped. String does not parse as valid JSON string. Offending string in double quotes : \"" + escapedJsonString + "\""); throw new XPathException(ErrorCodes.FOJS0007, "Bad JSON escape sequence. XML claims string is escaped. String does not parse as valid JSON string. Offending string in error logs."); } unescapedJsonString = unescapedJsonStringBuilder.toString(); return unescapedJsonString; }</code><technical_language>final</technical_language>

Target:
private String unescapeEscapedJsonString(final String escapedJsonString) throws IOException, XPathException { final JsonFactory jsonFactory = new JsonFactory(); final StringBuilder unescapedJsonStringBuilder = new StringBuilder(); final String unescapedJsonString; try { final JsonParser jsonParser = jsonFactory.createParser("\"" + escapedJsonString + "\""); while (!jsonParser.isClosed()) { jsonParser.nextToken(); if (jsonParser.hasTextCharacters()) { unescapedJsonStringBuilder.append(jsonParser.getValueAsString()); } } } catch (JsonParseException e) { logger.error("fn:xml-to-json(): FOJS0007: Bad JSON escape sequence. XML claims string is escaped. String does not parse as valid JSON string. Offending string in double quotes : \"" + escapedJsonString + "\""); throw new XPathException(ErrorCodes.FOJS0007, "Bad JSON escape sequence. XML claims string is escaped. String does not parse as valid JSON string. Offending string in error logs."); } unescapedJsonString = unescapedJsonStringBuilder.toString(); return unescapedJsonString; }
Source:
<code><START> protected String getReleaseNotesForFixVersion(String projectKey, String versionName, String filter) <END> throws TimeoutException { JiraSession session = getSession(); if (session == null) { LOGGER.warning("Jira session could not be established"); return ""; } List<Issue> issues = session.getIssuesWithFixVersion(projectKey, versionName, filter); if (issues.isEmpty()) { return ""; } Map<String, Set<String>> releaseNotes = new HashMap<>(); for (Issue issue : issues) { String key = issue.getKey(); String summary = issue.getSummary(); String status = issue.getStatus().getName(); String type = issue.getIssueType().getName(); Set<String> issueSet; if (releaseNotes.containsKey(type)) { issueSet = releaseNotes.get(type); } else { issueSet = new HashSet<>(); releaseNotes.put(type, issueSet); } issueSet.add(String.format(" - [%s] %s (%s)", key, summary, status)); } StringBuilder sb = new StringBuilder(); for ( Map.Entry<String, Set<String>> entry : releaseNotes.entrySet() ) { sb.append(String.format("# %s\n", entry.getKey())); for (String issue : entry.getValue()) { sb.append(issue); sb.append("\n"); } } return sb.toString(); }</code><technical_language>breaking compatibility? -1 breaking compatibility</technical_language>

Target:
public String getReleaseNotesForFixVersion(String projectKey, String versionName, String filter) throws TimeoutException { JiraSession session = getSession(); if (session == null) { LOGGER.warning("Jira session could not be established"); return ""; } List<Issue> issues = session.getIssuesWithFixVersion(projectKey, versionName, filter); if (issues.isEmpty()) { return ""; } Map<String, Set<String>> releaseNotes = new HashMap<>(); for (Issue issue : issues) { String key = issue.getKey(); String summary = issue.getSummary(); String status = issue.getStatus().getName(); String type = issue.getIssueType().getName(); Set<String> issueSet; if (releaseNotes.containsKey(type)) { issueSet = releaseNotes.get(type); } else { issueSet = new HashSet<>(); releaseNotes.put(type, issueSet); } issueSet.add(String.format(" - [%s] %s (%s)", key, summary, status)); } StringBuilder sb = new StringBuilder(); for ( Map.Entry<String, Set<String>> entry : releaseNotes.entrySet() ) { sb.append(String.format("# %s\n", entry.getKey())); for (String issue : entry.getValue()) { sb.append(issue); sb.append("\n"); } } return sb.toString(); }
Source:
<code>private String[] getDimVals(final DimDim dimLookup, final List<String> dimValues) { final String[] retVal = new String[dimValues.size()]; if (dimValues.size() == 0) { if (!dimLookup.contains(null)) { dimLookup.add(null); } <START> return retVal; <END> } int count = 0; for (String dimValue : dimValues) { String canonicalDimValue = dimLookup.get(dimValue); if (!dimLookup.contains(canonicalDimValue)) { dimLookup.add(dimValue); } retVal[count] = canonicalDimValue; count++; } Arrays.sort(retVal); return retVal; }</code><technical_language>returning empty array instead of returning null</technical_language>

Target:
private String[] getDimVals(final DimDim dimLookup, final List<String> dimValues) { final String[] retVal = new String[dimValues.size()]; if (dimValues.size() == 0) { if (!dimLookup.contains(null)) { dimLookup.add(null); } return null; } int count = 0; for (String dimValue : dimValues) { String canonicalDimValue = dimLookup.get(dimValue); if (!dimLookup.contains(canonicalDimValue)) { dimLookup.add(dimValue); } retVal[count] = canonicalDimValue; count++; } Arrays.sort(retVal); return retVal; }
Source:
<code>protected void configure() { <START> getDockerImageName(); <END> }</code><technical_language>configure is user-overridable method, is need trigger</technical_language>

Target:
protected void configure() { }
Source:
<code>private MacPool createPoolInternal(org.ovirt.engine.core.common.businessentities.MacPool macPool, boolean engineStartup) { if (macPools.containsKey(macPool.getId())) { throw new IllegalStateException(UNABLE_TO_CREATE_MAC_POOL_IT_ALREADY_EXIST); } log.debug("Creating new MacPool {}.", macPool); MacPool poolForScope = macPoolFactory.createMacPool(macPool, engineStartup); List<MacPool> overlappingPools = macPools.entrySet().stream() .filter(poolEntry -> poolEntry.getKey() != poolForScope.getId() && poolEntry.getValue().overlaps(poolForScope)) .map(Map.Entry::getValue) .collect(Collectors.toList()); if (!overlappingPools.isEmpty()) { StringJoiner joiner = new StringJoiner(", "); overlappingPools.forEach(pool -> <START> joiner.add(pool.getId().toString())); <END> String macReport = joiner.toString(); String msg = "MAC pool '%s' overlaps with other MAC pools: [%s]"; log.warn(String.format(msg, macPool.getName(), macReport)); AuditLogableImpl auditLoggable = new AuditLogableImpl(); auditLoggable.addCustomValue("macPoolName", macPool.getName()); auditLoggable.addCustomValue("overlapping", macReport); auditLogDirector.log(auditLoggable, AuditLogType.MAC_POOL_VIOLATES_NO_OVERLAPPING_MAC_POOLS); } macPools.put(macPool.getId(), poolForScope); return poolForScope; }</code><technical_language>Name better, I guess this is some effort, decide if want name in a follow-uppatch</technical_language>

Target:
private MacPool createPoolInternal(org.ovirt.engine.core.common.businessentities.MacPool macPool, boolean engineStartup) { if (macPools.containsKey(macPool.getId())) { throw new IllegalStateException(UNABLE_TO_CREATE_MAC_POOL_IT_ALREADY_EXIST); } log.debug("Creating new MacPool {}.", macPool); MacPool poolForScope = macPoolFactory.createMacPool(macPool, engineStartup); macPools.put(macPool.getId(), poolForScope); return poolForScope; }
Source:
<code>protected void initTiffParser() { super.initTiffParser(); if (handler != null) { Image i = handler.imageMap.get(0); <START> tiffParser.setYCbCrCorrection(!"versa".equalsIgnoreCase(i.devModel) && !"leica scn400".equalsIgnoreCase(i.devModel); <END> } }</code><technical_language>suggestion tiffParser.setYCbCrCorrection(!("versa".equalsIgnoreCase(i.devModel) || "leica scn400".equalsIgnoreCase(i.devModel)));</technical_language>

Target:
protected void initTiffParser() { super.initTiffParser(); if (handler != null) { Image i = handler.imageMap.get(0); tiffParser.setYCbCrCorrection(!("versa".equalsIgnoreCase(i.devModel) || "leica scn400".equalsIgnoreCase(i.devModel))); } }
Source:
<code>public Reply<?> fetchEmergencyAlertURI(@Named("id") String id, Request request) { Optional<AccessPoint> ap = repository.findById(id); if (!ap.isPresent()) { return Reply.with("Not found AP with id " + id).notFound(); } <START> String host = request.header("HOST"); <END> String emergencyURI = host + "/r/emergency-alerts"; return Reply.with(emergencyURI).ok(); }</code><technical_language>I proper string representation of host header is "Host"</technical_language>

Target:
public Reply<?> fetchEmergencyAlertURI(@Named("id") String id, Request request) { Optional<AccessPoint> ap = repository.findById(id); if (!ap.isPresent()) { return Reply.with("Not found AP with id " + id).notFound(); } String host = request.header("Host"); String emergencyURI = host + "/r/emergency-alerts"; return Reply.with(emergencyURI).ok(); }
Source:
<code>public Organisation approveOrganisation(@ApiParam(hidden = true) @Auth User user, @ApiParam(value = "Organisation ID.", required = true) @PathParam("organisationId") Long id) { Organisation organisation = organisationDAO.findById(id); if (organisation == null) { String msg = "Organisation not found"; LOG.info(msg); throw new CustomWebApplicationException(msg, HttpStatus.SC_BAD_REQUEST); } organisation.setApproved(true); <START> Event createOrganisationEvent = new Event(null, organisation, null, null, null, user, Event.EventType.APPROVE_ORG); <END> eventDAO.create(createOrganisationEvent); return organisationDAO.findById(id); }</code><technical_language>a builder pattern (and for other code calling Event constructor), this is quickly get unwieldy (or is for matter)</technical_language>

Target:
public Organisation approveOrganisation(@ApiParam(hidden = true) @Auth User user, @ApiParam(value = "Organisation ID.", required = true) @PathParam("organisationId") Long id) { Organisation organisation = organisationDAO.findById(id); if (organisation == null) { String msg = "Organisation not found"; LOG.info(msg); throw new CustomWebApplicationException(msg, HttpStatus.SC_NOT_FOUND); } if (!organisation.isApproved()) { organisation.setApproved(true); Event approveOrgEvent = new Event.Builder() .withOrganisation(organisation) .withInitiatorUser(user) .withType(Event.EventType.APPROVE_ORG) .build(); eventDAO.create(approveOrgEvent); } return organisationDAO.findById(id); }
Source:
<code>public void retry(Call failedCall, Throwable throwable) { long now = time.milliseconds(); RetryContext failedCallRetryContext = failedCall.getRetryContext(); this.retryContext.update(failedCallRetryContext); if (this.retryContext.getTries() > maxRetries) { failWithTimeout(now, throwable); return; } <START> if (log.isDebugEnabled()) { <END> log.debug("{} failed: {}. Beginning retry #{}", this, prettyPrintException(throwable), retryContext.getTries()); } runnable.call(this, now); }</code><technical_language>a bit redundant check for log.isDebugEnabled() if logging debug right</technical_language>

Target:
public void retry(Call failedCall, Throwable throwable) { long now = time.milliseconds(); if ((throwable instanceof UnsupportedVersionException) && handleUnsupportedVersionException((UnsupportedVersionException) throwable)) { log.debug("{} attempting protocol downgrade and retrying.", this); runnable.call(this, now); return; } CallRetryContext failedCallRetryContext = failedCall.callRetryContext(); this.callRetryContext.update(failedCallRetryContext); if (this.callRetryContext.tries() <= maxRetries) { log.debug("{} failed: {}. Beginning retry #{}", this, prettyPrintException(throwable), callRetryContext.tries()); runnable.call(this, now); } else { failWithTimeout(now, throwable); } }
Source:
<code>private void parseResourceClasses() { List<IGDBHardwareAndOS.IResourceClass> classes = new ArrayList<IGDBHardwareAndOS.IResourceClass>(); MITuple table = (MITuple)get(getMIOutput(), "OSDataTable"); MIList body = (MIList)get(table, "body"); for (MIResult r: body.getMIResults()) { MITuple row = (MITuple)r.getMIValue(); final String id = getString(row.getMIResults()[0]); <START> final String description = getString(row.getMIResults()[2]); <END> classes.add(new IGDBHardwareAndOS.IResourceClass() { @Override public String getId() { return id; } @Override public String getHunamDescription() { return description; } }); } resourceClasses = classes.toArray(new IGDBHardwareAndOS.IResourceClass[0]); }</code><technical_language>Is future-proof for element? In future MI insert element for. safer for name of field "col0" "col2". assuming MI fields for backwards-compatibility</technical_language>

Target:
private void parseResourceClasses() { List<IGDBHardwareAndOS2.IResourceClass> classes = new ArrayList<IGDBHardwareAndOS2.IResourceClass>(); MITuple table = (MITuple)get(getMIOutput(), "OSDataTable"); MIList body = (MIList)get(table, "body"); for (MIResult r: body.getMIResults()) { MITuple row = (MITuple)r.getMIValue(); final String id = getString(row.getMIResults()[0]); final String description = getString(row.getMIResults()[2]); classes.add(new IGDBHardwareAndOS2.IResourceClass() { @Override public String getId() { return id; } @Override public String getHumanDescription() { return description; } }); } resourceClasses = classes.toArray(new IGDBHardwareAndOS2.IResourceClass[classes.size()]); }
Source:
<code>protected void customizeContainerConfiguration( ContainerConfiguration containerConfiguration ) { super.customizeContainerConfiguration( containerConfiguration ); containerConfiguration.setAutoWiring( true ); <START> containerConfiguration.setClassPathScanning( PlexusConstants.SCANNING_ON ); <END> }</code><technical_language>this change? I remember, Maven do classpath scanning, relies descriptors. @rfscholte correct if I wrong</technical_language>

Target:
protected void customizeContainerConfiguration( ContainerConfiguration containerConfiguration ) { super.customizeContainerConfiguration( containerConfiguration ); containerConfiguration.setAutoWiring( true ); containerConfiguration.setClassPathScanning( PlexusConstants.SCANNING_INDEX ); }
Source:
<code>public List<HostToken> getTokens(Set<Host> activeHosts) { Set<HostToken> allTokens = new HashSet<HostToken>(); <START> Set<Host> remainingHosts = new TreeSet<>(activeHosts); <END> for (Host host : activeHosts) { try { List<HostToken> hostTokens = parseTokenListFromJson(getTopologyJsonPayload((host.getHostAddress()))); for (HostToken hToken : hostTokens) { allTokens.add(hToken); remainingHosts.remove(hToken.getHost()); } if (remainingHosts.size() == 0) { Logger.info("Received token information for " + allTokens.size() + " hosts. Not querying other hosts"); break; } } catch (Exception e) { Logger.warn("Could not get json response for token topology [" + e.getMessage() + "]"); } } return new ArrayList<>(allTokens); }</code><technical_language>change this HashSet TreeSet buy additional</technical_language>

Target:
public List<HostToken> getTokens(Set<Host> activeHosts) { Set<HostToken> allTokens = new HashSet<HostToken>(); Set<Host> remainingHosts = new HashSet<>(activeHosts); for (Host host : activeHosts) { try { List<HostToken> hostTokens = parseTokenListFromJson(getTopologyJsonPayload((host.getHostAddress()))); for (HostToken hToken : hostTokens) { allTokens.add(hToken); remainingHosts.remove(hToken.getHost()); } if (remainingHosts.size() == 0) { Logger.info("Received token information for " + allTokens.size() + " hosts. Not querying other hosts"); break; } } catch (Exception e) { Logger.warn("Could not get json response for token topology [" + e.getMessage() + "]"); } } return new ArrayList<>(allTokens); }
Source:
<code>protected String decryptBytes(@NonNull final Key key, @NonNull final byte[] bytes, @Nullable final DecryptBytesHandler handler) throws GeneralSecurityException, IOException { final Cipher cipher = getCachedInstance(); try { <START> if (null != handler) { handler.initialize(cipher, key, bytes); } <END> byte[] decryptedBytes = cipher.doFinal(bytes, IV.IV_LENGTH, bytes.length - IV.IV_LENGTH); return new String(decryptedBytes, UTF8); } catch (Throwable fail) { Log.w(LOG_TAG, fail.getMessage(), fail); throw fail; } }</code><technical_language>suggestion final IvParameterSpec iv = IV.readIv(bytes); cipher.init(Cipher.DECRYPT_MODE, key, iv); In order handler interface generic. I realise this implementation deviate a bit other CipherStorage classes, this workaround contained possible</technical_language>

Target:
protected String decryptBytes(@NonNull final Key key, @NonNull final byte[] bytes, @Nullable final DecryptBytesHandler handler) throws GeneralSecurityException, IOException { final Cipher cipher = getCachedInstance(); try { final IvParameterSpec iv = IV.readIv(bytes); cipher.init(Cipher.DECRYPT_MODE, key, iv); byte[] decryptedBytes = cipher.doFinal(bytes, IV.IV_LENGTH, bytes.length - IV.IV_LENGTH); return new String(decryptedBytes, UTF8); } catch (Throwable fail) { Log.w(LOG_TAG, fail.getMessage(), fail); throw fail; } }
Source:
<code>public void getLocation(Network network, final LocationProviderCallback callback) { try { String request = Context.getObjectMapper().writeValueAsString(network); Context.getAsyncHttpClient().preparePost(url) .setHeader("Content-Type", "application/json") <START> .setHeader("Content-Length", "" + request.length()) <END> .setBody(request).execute(new AsyncCompletionHandler() { @Override public Object onCompleted(Response response) throws Exception { try (JsonReader reader = Json.createReader(response.getResponseBodyAsStream())) { JsonObject json = reader.readObject(); if (json.containsKey("error")) { callback.onFailure( new GeolocationException(json.getJsonObject("error").getString("message"))); } else { JsonObject location = json.getJsonObject("location"); callback.onSuccess( location.getJsonNumber("lat").doubleValue(), location.getJsonNumber("lng").doubleValue(), json.getJsonNumber("accuracy").doubleValue()); } } return null; } @Override public void onThrowable(Throwable t) { callback.onFailure(t); } }); } catch (JsonProcessingException e) { callback.onFailure(e); } }</code><technical_language>Please String.valueOf instead of this conversion</technical_language>

Target:
public void getLocation(Network network, final LocationProviderCallback callback) { try { String request = Context.getObjectMapper().writeValueAsString(network); Context.getAsyncHttpClient().preparePost(url) .setHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .setHeader(HttpHeaders.CONTENT_LENGTH, String.valueOf(request.length())) .setBody(request).execute(new AsyncCompletionHandler() { @Override public Object onCompleted(Response response) throws Exception { try (JsonReader reader = Json.createReader(response.getResponseBodyAsStream())) { JsonObject json = reader.readObject(); if (json.containsKey("error")) { callback.onFailure( new GeolocationException(json.getJsonObject("error").getString("message"))); } else { JsonObject location = json.getJsonObject("location"); callback.onSuccess( location.getJsonNumber("lat").doubleValue(), location.getJsonNumber("lng").doubleValue(), json.getJsonNumber("accuracy").doubleValue()); } } return null; } @Override public void onThrowable(Throwable t) { callback.onFailure(t); } }); } catch (JsonProcessingException e) { callback.onFailure(e); } }
Source:
<code>public void shouldWriteCompleteRepliesSummaryWhenRepliesFetcherIsProvided() throws IOException { <START> PartialList<Comment> returnedComments = new PartialList<>(Lists.reverse(replies), replies.size()); <END> when(commentManager.getComments(any(CoreSession.class), eq(comment.getId()), eq(1L), eq(0L), eq(false))).thenReturn(returnedComments); JsonAssert json = jsonAssert(comment, context); verify(commentManager).getComments(any(CoreSession.class), eq(comment.getId()), eq(1L), eq(0L), eq(false)); assertCommentProperties(json); assertRepliesSummary(json, true); }</code><technical_language>Collections#reverse instead ? Guava</technical_language>

Target:
public void shouldWriteCompleteRepliesSummaryWhenRepliesFetcherIsProvided() throws IOException { Collections.reverse(replies); when(commentManager.getComments(any(CoreSession.class), eq(comment.getId()), eq(1L), eq(0L), eq(false))).thenReturn(new PartialList<>(replies, replies.size())); JsonAssert json = jsonAssert(comment, context); verify(commentManager).getComments(any(CoreSession.class), eq(comment.getId()), eq(1L), eq(0L), eq(false)); assertCommentProperties(json); assertRepliesSummary(json, true); }
Source:
<code>public boolean hasRequiredPermissionForPermission(String permission, Predicate<String> hasPermissionPredicate) { <START> Config config = Sirius.getSettings().getConfig("security.packages.required-permissions-for-permission"); <END> if (!config.hasPath(permission)) { return true; } String requiredPermission = config.getString(permission); return hasPermissionPredicate.test(requiredPermission); }</code><technical_language>move hasPermission logic of UserInfo (as separate method) apply here)</technical_language>

Target:
public boolean hasRequiredPermissionForPermission(String permission, Predicate<String> hasPermissionPredicate) { Config config = Sirius.getSettings().getConfig("security.packages.required-permissions-for-permission"); if (!config.hasPath(permission)) { return true; } String requiredPermission = config.getString(permission); return Permissions.hasPermission(requiredPermission, hasPermissionPredicate); }
Source:
<code>public Map<?, ?> addArticleLinks(Map<?, ?> searchResults, HttpServletRequest request, Site site, SiteSet siteSet) throws IOException { List<Map> docs = (List<Map>) searchResults.get("docs"); for (Map doc : docs) { String doi = (String) doc.get("id"); List<String> crossPubbedJournals = (List<String>) doc.get("cross_published_journal_key"); Site resultSite = null; for (String journalKey : crossPubbedJournals) { resultSite = site.getTheme().resolveForeignJournalKey(siteSet, journalKey); <START> boolean isCollection = (boolean) resultSite.getTheme().getConfigMap("journal").get("isCollection"); <END> if (!isCollection) { break; } } doc.put("link", resultSite.getRequestScheme().buildLink(request, "/article?id=" + doi)); } return searchResults; }</code><technical_language>This a perfectly correct of cross-theme config values. :+1: A alternative: Ambra schema define a single journal of "original" publication, modeled in a roundabout way. (Brief diversion Rhino land here.) "original" journal is eIssn, defined in ambra.xml, matches article's eIssn value. a free-text field for journal title, is inconsistently populated trusted. (End diversion.) For more general case of cross-publishing, more robust return journal arbitrary non-collection one. require access article metadata Rhino. A query Rhino search result prohibitive performance, I suppose? else add/backfill data Solr index, sounds costly. Solr data includes eIssn, match a journal eIssn right (assuming retrieve journals' eIssn values)? Anyway, call worth it. this is</technical_language>

Target:
public Map<?, ?> addArticleLinks(Map<?, ?> searchResults, HttpServletRequest request, Site site, SiteSet siteSet) throws IOException { initializeEIssnToJournalKeyMap(siteSet, site); List<Map> docs = (List<Map>) searchResults.get("docs"); for (Map doc : docs) { String doi = (String) doc.get("id"); String eIssn = (String) doc.get("eissn"); Site resultSite = site.getTheme().resolveForeignJournalKey(siteSet, eIssnToJournalKey.get(eIssn)); doc.put("link", resultSite.getRequestScheme().buildLink(request, "/article?id=" + doi)); } return searchResults; }
Source:
<code>public static ModelConfig loadModelConfig(String path, SourceType sourceType) throws IOException { ModelConfig modelConfig = loadJSON(path, sourceType, ModelConfig.class); if(modelConfig.getTrain().getGridConfigFile() != null) { <START> modelConfig.getTrain().setGridConfigFileContent(loadFileContent(modelConfig.getTrain().getGridConfigFile(), sourceType)); <END> } return modelConfig; }</code><technical_language>question, if configuration file is in local, file read in HDFS mode. in NNMaster, is run in cluster, read configuration file HDFS</technical_language>

Target:
public static ModelConfig loadModelConfig(String path, SourceType sourceType) throws IOException { ModelConfig modelConfig = loadJSON(path, sourceType, ModelConfig.class); if(modelConfig.getTrain().getGridConfigFile() != null) { String gridConfigPath = modelConfig.getTrain().getGridConfigFile(); if(sourceType == SourceType.HDFS) { gridConfigPath = new PathFinder(modelConfig).getPathBySourceType( gridConfigPath.substring(gridConfigPath.lastIndexOf(File.separator) + 1), SourceType.HDFS); } modelConfig.getTrain().setGridConfigFileContent(loadFileContent(gridConfigPath, sourceType)); } return modelConfig; }
Source:
<code>private MediaModel getMediaModelFromEditorImageMetaData() { MediaModel mediaModel = new MediaModel(); mediaModel.setUrl(mEditorImageMetaData.getSrc()); mediaModel.setTitle(mEditorImageMetaData.getTitle()); mediaModel.setCaption(mEditorImageMetaData.getCaption()); mediaModel.setAlt(mEditorImageMetaData.getAlt()); <START> mediaModel.setFileName(mEditorImageMetaData.getSrc().substring(mEditorImageMetaData.getSrc().lastIndexOf("/") + 1)); <END> mediaModel.setFileExtension(org.wordpress.android.fluxc.utils.MediaUtils.getExtension(mEditorImageMetaData.getSrc())); mediaModel.setWidth(mEditorImageMetaData.getWidthInt()); mediaModel.setHeight(mEditorImageMetaData.getHeightInt()); return mediaModel; }</code><technical_language>null check getSrc() calling substring() it</technical_language>

Target:
private MediaModel getMediaModelFromEditorImageMetaData() { MediaModel mediaModel = new MediaModel(); mediaModel.setUrl(mEditorImageMetaData.getSrc()); mediaModel.setTitle(mEditorImageMetaData.getTitle()); mediaModel.setCaption(mEditorImageMetaData.getCaption()); mediaModel.setAlt(mEditorImageMetaData.getAlt()); if (!TextUtils.isEmpty(mEditorImageMetaData.getSrc())) { mediaModel.setFileName(mEditorImageMetaData.getSrc().substring(mEditorImageMetaData.getSrc().lastIndexOf("/") + 1)); } mediaModel.setFileExtension(org.wordpress.android.fluxc.utils.MediaUtils.getExtension(mEditorImageMetaData.getSrc())); mediaModel.setWidth(mEditorImageMetaData.getWidthInt()); mediaModel.setHeight(mEditorImageMetaData.getHeightInt()); return mediaModel; }
Source:
<code>private SearchResult userRecord(String query) { LdapContext context = getServiceContext(); try { SearchControls controls = new SearchControls(); controls.setSearchScope(SUBTREE_SCOPE); NamingEnumeration<SearchResult> results; try { results = context.search(getConstantsConfig().getDomain(), query, controls); } catch (NamingException e) { logger.info("Failed to search: " + query + "with DN=" + getConstantsConfig().getDomain() + " as the scope.", e); throw new ClientVisibleException(ResponseCodes.INTERNAL_SERVER_ERROR, "LdapConfig", "Organizational Unit not found.", null); } if (!results.hasMoreElements()) { logger.error("Cannot locate user information for " + query); return null; } SearchResult result; try { result = results.next(); <START> logger.trace("Found LDAP SearchResult object: " + result.toString()); <END> if (results.hasMoreElements()) { logger.error("More than one result."); return null; } if (!hasPermission(result.getAttributes())) { return null; } } catch (NamingException e) { logger.error("No results. when searching. " + query); return null; } return result; } finally { if (context != null) { contextPool.returnObject(context); } } }</code><technical_language>call toString()</technical_language>

Target:
private SearchResult userRecord(String query) { LdapContext context = getServiceContext(); try { SearchControls controls = new SearchControls(); controls.setSearchScope(SUBTREE_SCOPE); NamingEnumeration<SearchResult> results; try { results = context.search(getConstantsConfig().getDomain(), query, controls); } catch (NamingException e) { logger.info("Failed to search: " + query + "with DN=" + getConstantsConfig().getDomain() + " as the scope.", e); throw new ClientVisibleException(ResponseCodes.INTERNAL_SERVER_ERROR, "LdapConfig", "Organizational Unit not found.", null); } if (!results.hasMoreElements()) { logger.error("Cannot locate user information for " + query); return null; } SearchResult result; try { result = results.next(); logger.trace("Found LDAP SearchResult object: {}", result); if (results.hasMoreElements()) { logger.error("More than one result."); return null; } if (!hasPermission(result.getAttributes())) { return null; } } catch (NamingException e) { logger.error("No results. when searching. " + query); return null; } return result; } finally { if (context != null) { contextPool.returnObject(context); } } }
Source:
<code>public void showTargetFeedback(Request req) { if <START> (req.getType().equals(org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants.REQ_DROP) <END> || req.getType().equals(REQ_MOVE) || req.getType().equals(REQ_RESIZE) || req.getType().equals(REQ_CLONE) || req.getType().equals(REQ_ADD) || req.getType().equals(REQ_CREATE)) { Integer value; value = (Integer) req.getExtendedData().get(SnapToGeometry.KEY_WEST_ANCHOR); highlightGuide(value, nsewColor, 0); value = (Integer) req.getExtendedData().get(SnapToGeometry.KEY_NORTH_ANCHOR); highlightGuide(value, nsewColor, 1); value = (Integer) req.getExtendedData().get(SnapToGeometry.KEY_EAST_ANCHOR); highlightGuide(value, nsewColor, 2); value = (Integer) req.getExtendedData().get(SnapToGeometry.KEY_SOUTH_ANCHOR); highlightGuide(value, nsewColor, 3); value = (Integer) req.getExtendedData().get(SnapToGuides.KEY_VERTICAL_GUIDE); highlightGuide(value, guideColor, 4); value = (Integer) req.getExtendedData().get(SnapToGuides.KEY_HORIZONTAL_GUIDE); highlightGuide(value, guideColor, 5); } }</code><technical_language>imported a standard import I missed this beginning of review, I ask move class ext.gef plugin</technical_language>

Target:
public void showTargetFeedback(Request req) { if (req.getType().equals(RequestConstants.REQ_DROP) || req.getType().equals(REQ_MOVE) || req.getType().equals(REQ_RESIZE) || req.getType().equals(REQ_CLONE) || req.getType().equals(REQ_ADD) || req.getType().equals(REQ_CREATE)) { Integer value; value = (Integer) req.getExtendedData().get(SnapToGeometry.KEY_WEST_ANCHOR); highlightGuide(value, nsewColor, 0); value = (Integer) req.getExtendedData().get(SnapToGeometry.KEY_NORTH_ANCHOR); highlightGuide(value, nsewColor, 1); value = (Integer) req.getExtendedData().get(SnapToGeometry.KEY_EAST_ANCHOR); highlightGuide(value, nsewColor, 2); value = (Integer) req.getExtendedData().get(SnapToGeometry.KEY_SOUTH_ANCHOR); highlightGuide(value, nsewColor, 3); value = (Integer) req.getExtendedData().get(SnapToGuides.KEY_VERTICAL_GUIDE); highlightGuide(value, guideColor, 4); value = (Integer) req.getExtendedData().get(SnapToGuides.KEY_HORIZONTAL_GUIDE); highlightGuide(value, guideColor, 5); } }
Source:
<code>public void removeTransactionStateFromCache(long startTimestamp) { <START> timestampMap.remove(startTimestamp); <END> }</code><technical_language>Again, this is clear out stale events</technical_language>

Target:
public void removeTransactionStateFromCache(long startTimestamp) { timestampStateStore.remove(startTimestamp); retentionEventsInLog(); }
Source:
<code>public void testSetBrightness() { final int mode = Settings.System.getInt(mContext.getContentResolver(), Settings.System.SCREEN_BRIGHTNESS_MODE, SCREEN_BRIGHTNESS_MODE_AUTOMATIC); <START> if(mode==1) { mDevicePolicyManager.setSystemSetting(ADMIN_RECEIVER_COMPONENT, Settings.System.SCREEN_BRIGHTNESS_MODE, "0"); testSetBrightnessWithValue(TEST_BRIGHTNESS_1); testSetBrightnessWithValue(TEST_BRIGHTNESS_2); mDevicePolicyManager.setSystemSetting(ADMIN_RECEIVER_COMPONENT, Settings.System.SCREEN_BRIGHTNESS_MODE, "1"); } else { testSetBrightnessWithValue(TEST_BRIGHTNESS_1); testSetBrightnessWithValue(TEST_BRIGHTNESS_2); } <END> }</code><technical_language>if (mode == SCREEN_BRIGHTNESS_MODE_AUTOMATIC) { mDevicePolicyManager.setSystemSetting(ADMIN_RECEIVER_COMPONENT, Settings.System.SCREEN_BRIGHTNESS_MODE, "0"); } testSetBrightnessWithValue(TEST_BRIGHTNESS_1); testSetBrightnessWithValue(TEST_BRIGHTNESS_2); mDevicePolicyManager.setSystemSetting(ADMIN_RECEIVER_COMPONENT, Settings.System.SCREEN_BRIGHTNESS_MODE, mode == SCREEN_BRIGHTNESS_MODE_AUTOMATIC? "1" : "0");</technical_language>

Target:
public void testSetBrightness() { final int mode = Settings.System.getInt(mContext.getContentResolver(), Settings.System.SCREEN_BRIGHTNESS_MODE, SCREEN_BRIGHTNESS_MODE_AUTOMATIC); if(mode == SCREEN_BRIGHTNESS_MODE_AUTOMATIC) { mDevicePolicyManager.setSystemSetting(ADMIN_RECEIVER_COMPONENT, Settings.System.SCREEN_BRIGHTNESS_MODE, "0"); testSetBrightnessWithValue(TEST_BRIGHTNESS_1); testSetBrightnessWithValue(TEST_BRIGHTNESS_2); mDevicePolicyManager.setSystemSetting(ADMIN_RECEIVER_COMPONENT, Settings.System.SCREEN_BRIGHTNESS_MODE, mode == SCREEN_BRIGHTNESS_MODE_AUTOMATIC? "1" : "0"); } else { testSetBrightnessWithValue(TEST_BRIGHTNESS_1); testSetBrightnessWithValue(TEST_BRIGHTNESS_2); } }
Source:
<code>public void convertProject(IProject project, IProgressMonitor monitor, String projectID) throws CoreException { SubMonitor progress = SubMonitor.convert(monitor, MakeUIPlugin.getResourceString("WizardMakeProjectConversion.monitor.convertingToMakeProject"), 3); try { super.convertProject(project, progress.split(1), projectID); MakeProjectNature.addNature(project, <START> SubMonitor.convert(monitor, 1)); <END> ScannerConfigNature.addScannerConfigNature(project); ScannerConfigNature.initializeDiscoveryOptions(project); CCorePlugin.getDefault().mapCProjectOwner(project, projectID, true); } finally { monitor.done(); } }</code><technical_language>progress.split(1) ? Interestingly, counts frequently. 2 of 3 ticks consumed. I if intentional</technical_language>

Target:
public void convertProject(IProject project, IProgressMonitor monitor, String projectID) throws CoreException { SubMonitor progress = SubMonitor.convert(monitor, MakeUIPlugin.getResourceString("WizardMakeProjectConversion.monitor.convertingToMakeProject"), 1); try { super.convertProject(project, progress.split(1), projectID); MakeProjectNature.addNature(project, SubMonitor.convert(monitor, 1)); ScannerConfigNature.addScannerConfigNature(project); ScannerConfigNature.initializeDiscoveryOptions(project); CCorePlugin.getDefault().mapCProjectOwner(project, projectID, true); } finally { progress.worked(1); } }
Source:
<code>public void testGenerateGroupId() { String user = System.getProperty("user.name"); String vcloudGroupId = JcloudsLocation.generateGroupId("vcloud"); assertTrue(vcloudGroupId.startsWith("br-")); String fooGroupId = JcloudsLocation.generateGroupId("foo"); <START> if (!"brooklyn".equals(user)) <END> assertTrue(fooGroupId.startsWith("brooklyn-"+user)); }</code><technical_language>if user is "brooklyn"? Is behaviour? Can/should add else block assertion for that</technical_language>

Target:
public void testGenerateGroupId() { String user = System.getProperty("user.name"); String vcloudGroupId = JcloudsLocation.generateGroupId("vcloud"); assertTrue(vcloudGroupId.startsWith("br-")); String fooGroupId = JcloudsLocation.generateGroupId("foo"); if ("brooklyn".equals(user)) { } else { assertTrue(fooGroupId.startsWith("brooklyn-"+user)); } }
Source:
<code>private void configure(IMavenProjectFacade facade) { new WorkspaceJob(NLS.bind("Adding utility facet to project {0}", facade.getProject().getName())) { @Override public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException { try { MavenProject mavenProject = facade.getMavenProject(monitor); ModuleCoreNature.addModuleCoreNatureIfNecessary(facade.getProject(), monitor); addUtilityFacet(mavenProject, facade.getProject(), monitor); <START> if (ModuleUtils.hasModuleCoreNature(project)) { <END> ModuleUtils.addChildModule(facade.getProject(), project, monitor); } unconfiguredDependencies.remove(facade); if (unconfiguredDependencies.isEmpty()) { stop(); } return Status.OK_STATUS; } catch (Exception e) { MavenCoreActivator.logError(e); return StatusFactory.errorStatus(MavenCoreActivator.PLUGIN_ID, NLS.bind("Could not add utility facet to project {0}.", facade.getProject().getName())); } } }.schedule(); }</code><technical_language>this check required longer. if is error (what else error is if set core nature check for 2 lines fails?)</technical_language>

Target:
private void configure(IMavenProjectFacade facade) { new WorkspaceJob(NLS.bind("Adding utility facet to project {0}", facade.getProject().getName())) { @Override public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException { try { MavenProject mavenProject = facade.getMavenProject(monitor); addUtilityFacet(mavenProject, facade.getProject(), monitor); ModuleUtils.addChildModule(facade.getProject(), project, monitor); unconfiguredDependencies.remove(facade); if (unconfiguredDependencies.isEmpty()) { stop(); } return Status.OK_STATUS; } catch (Exception e) { MavenCoreActivator.logError(e); return StatusFactory.errorStatus(MavenCoreActivator.PLUGIN_ID, NLS.bind("Could not add utility facet to project {0}.", facade.getProject().getName())); } } }.schedule(); }
Source:
<code>public JobDetail populatedHostedDB() { if (config.getBoolean(ConfigProperties.STANDALONE)) { <START> log.warn("Ignoring populate DB request due to standalone config."); <END> return null; } return PopulateHostedDBTask.createAsyncTask(); }</code><technical_language>Message is a confusing depending read it. I more lines stated in task itself: "Aborting populate DB task in standalone environment" like: "Ignoring populate DB request in standalone environment"</technical_language>

Target:
public JobDetail populatedHostedDB() { if (config.getBoolean(ConfigProperties.STANDALONE)) { log.warn("Ignoring populate DB request in standalone environment"); return null; } return PopulateHostedDBTask.createAsyncTask(); }
Source:
<code>public DataNode(Datacenter datacenter, JSONObject jsonObject, ClusterMapConfig clusterMapConfig) throws JSONException { if (logger.isTraceEnabled()) { logger.trace("DataNode " + jsonObject.toString()); } this.datacenter = datacenter; this.hostname = getFullyQualifiedDomainName(jsonObject.getString("hostname")); this.port = jsonObject.getInt("port"); <START> this.sslPort = jsonObject.getInt("sslport"); <END> try { ResourceStatePolicyFactory resourceStatePolicyFactory = Utils .getObj(clusterMapConfig.clusterMapResourceStatePolicyFactory, this, HardwareState.valueOf(jsonObject.getString("hardwareState")), clusterMapConfig); this.dataNodeStatePolicy = resourceStatePolicyFactory.getResourceStatePolicy(); } catch (Exception e) { logger.error("Error creating resource state policy when instantiating a datanode " + e); throw new IllegalStateException( "Error creating resource state policy when instantiating a datanode: " + hostname + " " + port, e); } JSONArray diskJSONArray = jsonObject.getJSONArray("disks"); this.disks = new ArrayList<Disk>(diskJSONArray.length()); for (int i = 0; i < diskJSONArray.length(); ++i) { this.disks.add(new Disk(this, diskJSONArray.getJSONObject(i), clusterMapConfig)); } this.rawCapacityInBytes = calculateRawCapacityInBytes(); validate(); }</code><technical_language>nodes necessarily ssl enabled port</technical_language>

Target:
public DataNode(Datacenter datacenter, JSONObject jsonObject, ClusterMapConfig clusterMapConfig) throws JSONException { if (logger.isTraceEnabled()) { logger.trace("DataNode " + jsonObject.toString()); } this.datacenter = datacenter; this.hostname = getFullyQualifiedDomainName(jsonObject.getString("hostname")); this.port = jsonObject.getInt("port"); try { ResourceStatePolicyFactory resourceStatePolicyFactory = Utils .getObj(clusterMapConfig.clusterMapResourceStatePolicyFactory, this, HardwareState.valueOf(jsonObject.getString("hardwareState")), clusterMapConfig); this.dataNodeStatePolicy = resourceStatePolicyFactory.getResourceStatePolicy(); } catch (Exception e) { logger.error("Error creating resource state policy when instantiating a datanode " + e); throw new IllegalStateException( "Error creating resource state policy when instantiating a datanode: " + hostname + " " + port, e); } JSONArray diskJSONArray = jsonObject.getJSONArray("disks"); this.disks = new ArrayList<Disk>(diskJSONArray.length()); for (int i = 0; i < diskJSONArray.length(); ++i) { this.disks.add(new Disk(this, diskJSONArray.getJSONObject(i), clusterMapConfig)); } this.rawCapacityInBytes = calculateRawCapacityInBytes(); this.ports = new HashMap<PortType, Integer>(); this.ports.put(PortType.PLAINTEXT, port); populatePorts(jsonObject); validate(); }
Source:
<code><START> int getRemainingTokens(String license) { <END> return remainingTokens.get(license); }</code><technical_language>suggestion Integer getRemainingTokens(String license) {</technical_language>

Target:
int getRemainingTokens(String license) { if (!remainingTokens.containsKey(license)) { logger.error("License " + license + " does not exist in the remainingTokens map, whereas it should be."); } return remainingTokens.get(license); }
Source:
<code>public void setIssueLabels(String issueKey, List<String> labels) { final IssueInput issueInput = new IssueInputBuilder() .setFieldValue(IssueFieldId.LABELS_FIELD.id, labels) .build(); try { jiraRestClient.getIssueClient().updateIssue(issueKey, issueInput).get(timeout, TimeUnit.SECONDS); } catch (Exception e) { <START> LOGGER.warning("jira rest client update issue error. cause: " + e.getMessage()); <END> } }</code><technical_language>stacktrace in log</technical_language>

Target:
public void setIssueLabels(String issueKey, List<String> labels) { final IssueInput issueInput = new IssueInputBuilder() .setFieldValue(IssueFieldId.LABELS_FIELD.id, labels) .build(); try { jiraRestClient.getIssueClient().updateIssue(issueKey, issueInput).get(timeout, TimeUnit.SECONDS); } catch (Exception e) { LOGGER.log(Level.WARNING, "jira rest client update labels error for issue "+issueKey, e); } }
Source:
<code>public final void uploadFile() throws Exception { File testFile = temporaryFolder.newFile("test.txt"); Files.asCharSink(testFile, StandardCharsets.UTF_8).write("content"); s3Client.putObject(MY_TEST_BUCKET, "file.txt", testFile); List<S3ObjectSummary> summaries = s3Client .listObjects(MY_TEST_BUCKET) .getObjectSummaries(); <START> assertThat(summaries.size()).isEqualTo(1); <END> assertThat(summaries.get(0).getKey()).isEqualTo("file.txt"); assertThat(summaries.get(0).getSize()) .isEqualTo(testFile.length()); }</code><technical_language>java assertThat(summaries).hasSize(1)</technical_language>

Target:
public final void uploadFile() throws Exception { String testInput = "content"; s3Client.putObject(MY_TEST_BUCKET, "file.txt", testInput); List<S3ObjectSummary> summaries = s3Client .listObjects(MY_TEST_BUCKET) .getObjectSummaries(); assertThat(summaries).hasSize(1); assertThat(summaries.get(0).getKey()).isEqualTo("file.txt"); assertThat(summaries.get(0).getSize()).isEqualTo(testInput.length()); }
Source:
<code><START> public static void unparseSpecialSyntax(SqlOperator operator, <END> SqlWriter writer, SqlCall call) { final List<SqlNode> operands = call.getOperandList(); switch (operator.getKind()) { case INSERT: assert operands.size() == 3 || operands.size() == 4; final SqlInsert insert = new SqlInsert(call.getParserPosition(), (SqlNodeList) operands.get(0), operands.get(1), operands.get(2), operands.size() == 3 ? null : (SqlNodeList) call.getOperandList().get(3)); insert.unparse(writer, operator.getLeftPrec(), operator.getRightPrec()); return; default: throw Util.needToImplement(operator); } }</code><technical_language>this name is weird. find a inline implementation in original place instead of here</technical_language>

Target:
public static void unparseSpecialSyntax(SqlOperator operator, SqlWriter writer, SqlCall call) { final List<SqlNode> operands = call.getOperandList(); switch (operator.getKind()) { case INSERT: assert operands.size() == 4; final SqlInsert insert = new SqlInsert(call.getParserPosition(), (SqlNodeList) operands.get(0), operands.get(1), operands.get(2), (SqlNodeList) operands.get(3)); insert.unparse(writer, operator.getLeftPrec(), operator.getRightPrec()); return; default: throw Util.needToImplement(operator); } }