auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void validateLabelTemplate() { if (XmlUtils.doesNotMatchUsingXsdRegex(LABEL_TEMPLATE_FORMAT_REGEX, labelTemplate)) { addError("labelTemplate", "Invalid label. Label should be composed of alphanumeric text, it should contain " + "the build number (as ${COUNT}), " + "a material revision (e.g. ${git} for the full revision or ${git[:6]} for an truncated one), " + "or use params (as #{<param-name>})."); return; } Set<String> templateVariables = getTemplateVariables(); List<String> materialNames = allowedTemplateVariables(); for (final String templateVariable : templateVariables) { if (!CollectionUtils.exists(materialNames, withNameSameAs(templateVariable))) { addError("labelTemplate", String.format(ERR_TEMPLATE, name(), templateVariable)); } } }

Target:
private void validateLabelTemplate() { if (XmlUtils.doesNotMatchUsingXsdRegex(LABEL_TEMPLATE_FORMAT_REGEX, labelTemplate)) { addError("labelTemplate", LABEL_TEMPLATE_ERROR_MESSAGE); return; } Set<String> templateVariables = getTemplateVariables(); List<String> materialNames = allowedTemplateVariables(); for (final String templateVariable : templateVariables) { if (!CollectionUtils.exists(materialNames, withNameSameAs(templateVariable))) { addError("labelTemplate", String.format(ERR_TEMPLATE, name(), templateVariable)); } } }
Source:
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { if (args.length < 1) { return false; } final StringBuilder tag = new StringBuilder(); for (char c : ChatColor.stripColor(TFM_Util.colorize(StringUtils.join(args, " "))).toCharArray()) { tag.append(TFM_Util.randomChatColor()).append(c); } final TFM_PlayerData data = TFM_PlayerData.getPlayerData(sender_p); data.setTag(tag.toString()); if (!TFM_AdminList.isSuperAdmin(sender)) { for (String word : FORBIDDEN_WORDS) { if (args[0].contains(word)) { playerMsg("That tag contains a forbidden word."); return true; } } } playerMsg("Set tag to " + tag); return true; }

Target:
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { if (args.length < 1) { return false; } final StringBuilder tag = new StringBuilder(); for (char c : ChatColor.stripColor(TFM_Util.colorize(StringUtils.join(args, " "))).toCharArray()) { tag.append(TFM_Util.randomChatColor()).append(c); } final TFM_PlayerData data = TFM_PlayerData.getPlayerData(sender_p); if (!TFM_AdminList.isSuperAdmin(sender)) { for (String word : Command_tag.FORBIDDEN_WORDS) { if (args[0].toLowerCase().contains(word)) { playerMsg("That tag contains a forbidden word (" + args[0] + ")"); return true; } } } data.setTag(tag.toString()); playerMsg("Set tag to " + tag); return true; }
Source:
public String toString() { return "AbstractSequencerReference [id=" + id + ", name=" + name + ", platform=" + (platform == null ? null : platform.getPlatformId()) + ", available=" + available + ", ip=" + (ip == null ? null : ip.toString()) + ", serialNumber=" + serialNumber + ", dateCommissioned=" + (dateCommissioned == null ? null : dateCommissioned.toString()) + ", dateDecommissioned=" + (dateDecommissioned == null ? null : dateDecommissioned.toString()) + ", upgradedSequencerReference=" + (upgradedSequencerReference == null ? null : upgradedSequencerReference.getId()) + "]"; }

Target:
public String toString() { return "AbstractSequencerReference [id=" + id + ", name=" + name + ", platform=" + String.valueOf(platform.getPlatformId()) + ", available=" + available + ", ip=" + String.valueOf(ip) + ", serialNumber=" + serialNumber + ", dateCommissioned=" + String.valueOf(dateCommissioned) + ", dateDecommissioned=" + String.valueOf(dateDecommissioned) + ", upgradedSequencerReference=" + (upgradedSequencerReference == null ? null : upgradedSequencerReference.getId()) + "]"; }
Source:
public <T extends Metric> T register(final String name, T metric) throws IllegalArgumentException { try { return super.register(name, metric); } catch (IllegalArgumentException e) { @SuppressWarnings("unchecked") final T existing = (T) DEFAULT_REGISTRY.getMetrics().get(name); if (metric.getClass().isInstance(existing)) { LOG.warn("Metric has already been registered", name); return existing; } throw e; } }

Target:
public <T extends Metric> T register(final String name, T metric) throws IllegalArgumentException { try { return super.register(name, metric); } catch (IllegalArgumentException e) { @SuppressWarnings("unchecked") final T existing = (T) REGISTRY.getMetrics().get(name); if (metric.getClass().isInstance(existing)) { LOG.warn("Metric has already been registered", name); return existing; } throw e; } }
Source:
public Pipeline pipelineWithPasswordAwareBuildCauseByBuildId(final long buildId) { Pipeline pipeline = pipelineDao.pipelineWithMaterialsAndModsByBuildId(buildId); MaterialRevisions scheduledRevs = pipeline.getBuildCause().getMaterialRevisions(); MaterialConfigs knownMaterials = knownMaterials(pipeline, scheduledRevs); for (MaterialRevision materialRevision : scheduledRevs) { MaterialConfig materialConfig = materialFrom(knownMaterials, materialRevision); Material usedMaterial = materialRevision.getMaterial(); if (materialConfig == null) { final JobInstance jobInstance = jobInstanceService.buildByIdWithTransitions(buildId); scheduleService.failJob(jobInstance); final String message = "Cannot load job '" + jobInstance.buildLocator() + "' because material " + usedMaterial.config() + " was not found in config."; final String description = "Job for pipeline '" + jobInstance.buildLocator() + "' has been failed as one or more material configurations were either changed or removed."; final ServerHealthState error = ServerHealthState.error(message, description, HealthStateType.general(HealthStateScope.forJob(jobInstance.getPipelineName(), jobInstance.getStageName(), jobInstance.getName()))); error.setTimeout(Timeout.FIVE_MINUTES); serverHealthService.update(error); appendToConsoleLog(jobInstance, message, description); throw new StaleMaterialsOnBuildCause(joinTwoStringsWithNewLine(message, description)); } usedMaterial.updateFromConfig(materialConfig); } return pipeline; }

Target:
public Pipeline pipelineWithPasswordAwareBuildCauseByBuildId(final long buildId) { Pipeline pipeline = pipelineDao.pipelineWithMaterialsAndModsByBuildId(buildId); MaterialRevisions scheduledRevs = pipeline.getBuildCause().getMaterialRevisions(); MaterialConfigs knownMaterials = knownMaterials(pipeline, scheduledRevs); for (MaterialRevision materialRevision : scheduledRevs) { MaterialConfig materialConfig = materialFrom(knownMaterials, materialRevision); Material usedMaterial = materialRevision.getMaterial(); if (materialConfig == null) { final JobInstance jobInstance = jobInstanceService.buildByIdWithTransitions(buildId); scheduleService.failJob(jobInstance); final String message = "Cannot load job '" + jobInstance.buildLocator() + "' because material " + usedMaterial.config() + " was not found in config."; final String description = "Job for pipeline '" + jobInstance.buildLocator() + "' has been failed as one or more material configurations were either changed or removed."; transactionSynchronizationManager.registerSynchronization(new TransactionSynchronizationAdapter() { @Override public void afterCommit() { final ServerHealthState error = ServerHealthState.error(message, description, HealthStateType.general(HealthStateScope.forJob(jobInstance.getPipelineName(), jobInstance.getStageName(), jobInstance.getName()))); error.setTimeout(Timeout.FIVE_MINUTES); serverHealthService.update(error); appendToConsoleLog(jobInstance, message); appendToConsoleLog(jobInstance, description); } }); throw new StaleMaterialsOnBuildCause(message); } usedMaterial.updateFromConfig(materialConfig); } return pipeline; }
Source:
public SyndFeed renderFeed(List<CompositeEvent> events) { SyndFeed feed = new SyndFeedImpl(); feed.setFeedType("rss_2.0"); feed.setTitle(this.contextualLocalizationManager.getTranslationPlain("notifications.rss.feedTitle")); feed.setLink(this.modelBridge.getDocumentURL( this.documentReferenceResolver.resolve("XWiki.Notifications.Code.NotificationRSSService"), "get", "outputSyntax=plain")); feed.setDescription(this.contextualLocalizationManager.getTranslationPlain( "notifications.rss.feedDescription")); List<SyndEntry> entries = new ArrayList<>(); for (CompositeEvent event : events) { try { NotificationRSSRenderer renderer = this.getRenderer(event); if (renderer != null) { entries.add(renderer.renderNotification(event)); } else { entries.add(defaultNotificationRSSRenderer.renderNotification(event)); } } catch (NotificationException e) { this.logger.warn( String.format("Unable to render RSS entry for CompositeEvent : %s", e.getMessage())); } } feed.setEntries(entries); return feed; }

Target:
public SyndFeed renderFeed(List<CompositeEvent> events) { SyndFeed feed = new SyndFeedImpl(); feed.setFeedType("rss_2.0"); feed.setTitle(this.contextualLocalizationManager.getTranslationPlain("notifications.rss.feedTitle")); feed.setLink(this.modelBridge.getDocumentURL( new DocumentReference(wikiDescriptorManager.getCurrentWikiId(), Arrays.asList("XWiki", "Notifications", "Code"), "NotificationRSSService"), "get", "outputSyntax=plain")); feed.setDescription(this.contextualLocalizationManager.getTranslationPlain( "notifications.rss.feedDescription")); List<SyndEntry> entries = new ArrayList<>(); for (CompositeEvent event : events) { try { NotificationRSSRenderer renderer = this.getRenderer(event); if (renderer != null) { entries.add(renderer.renderNotification(event)); } else { entries.add(defaultNotificationRSSRenderer.renderNotification(event)); } } catch (NotificationException e) { this.logger.warn( String.format("Unable to render RSS entry for CompositeEvent : %s", e.getMessage())); } } feed.setEntries(entries); return feed; }
Source:
public BBContainer poll(OutputContainerFactory ocf, boolean checkCRC) throws IOException { synchronized (PersistentBinaryDeque.this) { if (m_closed) { throw new IOException("PBD.ReadCursor.poll(): " + m_cursorId + " - Reader has been closed"); } assertions(); moveToValidSegment(); PBDSegmentReader segmentReader = m_segment.getReader(m_cursorId); if (segmentReader == null) { segmentReader = m_segment.openForRead(m_cursorId); } long lastSegmentId = peekLastSegment().segmentIndex(); while (!segmentReader.hasMoreEntries()) { if (m_segment.segmentIndex() == lastSegmentId) { segmentReader.close(); return null; } segmentReader.close(); m_segment = m_segments.higherEntry(m_segment.segmentIndex()).getValue(); segmentReader = m_segment.getReader(m_cursorId); if (segmentReader == null) segmentReader = m_segment.openForRead(m_cursorId); } BBContainer retcont = segmentReader.poll(ocf, checkCRC); m_numRead++; assertions(); assert (retcont.b() != null); return wrapRetCont(m_segment, retcont); } }

Target:
public BBContainer poll(OutputContainerFactory ocf, boolean checkCRC) throws IOException { synchronized (PersistentBinaryDeque.this) { if (m_closed) { throw new IOException("PBD.ReadCursor.poll(): " + m_cursorId + " - Reader has been closed"); } assertions(); moveToValidSegment(); PBDSegmentReader segmentReader = m_segment.getReader(m_cursorId); if (segmentReader == null) { segmentReader = m_segment.openForRead(m_cursorId); } long lastSegmentId = peekLastSegment().segmentIndex(); while (!segmentReader.hasMoreEntries()) { if (m_segment.segmentIndex() == lastSegmentId) { return null; } segmentReader.close(); m_segment = m_segments.higherEntry(m_segment.segmentIndex()).getValue(); segmentReader = m_segment.getReader(m_cursorId); if (segmentReader == null) { segmentReader = m_segment.openForRead(m_cursorId); } } BBContainer retcont = segmentReader.poll(ocf, checkCRC); if (retcont == null) { return null; } m_numRead++; assertions(); assert (retcont.b() != null); return wrapRetCont(m_segment, retcont); } }
Source:
public Group updateParentGroupId(PerunSession sess, Group group) throws InternalErrorException { Utils.notNull(group.getName(), "group.getName()"); Group dbGroup; try { dbGroup = this.getGroupById(sess, group.getId()); } catch (GroupNotExistsException e) { throw new InternalErrorException("Group existence was checked at the higher level",e); } if (group.getParentGroupId() != null && !group.getParentGroupId().equals(dbGroup.getParentGroupId())) { dbGroup.setParentGroupId(group.getParentGroupId()); try { jdbc.update("update groups set parent_group_id=?,modified_by=?, modified_by_uid=?, modified_at=" + Compatibility.getSysdate() + " where id=?", dbGroup.getParentGroupId(), sess.getPerunPrincipal().getActor(), sess.getPerunPrincipal().getUserId(), dbGroup.getId()); } catch (RuntimeException e) { throw new InternalErrorException(e); } } return dbGroup; }

Target:
public Group updateParentGroupId(PerunSession sess, Group group) throws InternalErrorException { Utils.notNull(group, "group"); Group dbGroup; try { dbGroup = this.getGroupById(sess, group.getId()); } catch (GroupNotExistsException e) { throw new InternalErrorException("Group existence was checked at the higher level",e); } if ((group.getParentGroupId() != null && !group.getParentGroupId().equals(dbGroup.getParentGroupId())) || (group.getParentGroupId() == null && dbGroup.getParentGroupId() != null)) { dbGroup.setParentGroupId(group.getParentGroupId()); try { jdbc.update("update groups set parent_group_id=?,modified_by=?, modified_by_uid=?, modified_at=" + Compatibility.getSysdate() + " where id=?", dbGroup.getParentGroupId(), sess.getPerunPrincipal().getActor(), sess.getPerunPrincipal().getUserId(), dbGroup.getId()); } catch (RuntimeException e) { throw new InternalErrorException(e); } } return dbGroup; }
Source:
public void finishJavadocTree(DetailNode rootAst) { moduleDetails.setDescription(getDescriptionText()); if (isTopLevelClassJavadoc()) { try { new XmlMetaWriter().write(moduleDetails); } catch (TransformerException | ParserConfigurationException ex) { log.debug("Exception occured while writing metadata of" + getModuleSimpleName() + " into XML files: ", ex); } } }

Target:
public void finishJavadocTree(DetailNode rootAst) { moduleDetails.setDescription(getDescriptionText()); if (isTopLevelClassJavadoc()) { try { XmlMetaWriter.write(moduleDetails); } catch (TransformerException | ParserConfigurationException ex) { throw new IllegalStateException("Failed to write metadata into XML file for " + "module: " + getModuleSimpleName(), ex); } } }
Source:
public void setHidden(File path, boolean hidden) throws IOException { super.setHidden(path, hidden); }

Target:
public void setHidden(File path, boolean hidden) throws IOException { }
Source:
private MethodHandle findAccessor(Class<?> refc, String name, Class<?> type, int kind) throws NoSuchFieldException, IllegalAccessException { final Field field = refc.getField(name); checkAccess(refc, field.getDeclaringClass(), field.getModifiers(), field.getName()); final Class<?> fieldType = field.getType(); if (fieldType != type) { throw new NoSuchFieldException( "Field has wrong type: " + fieldType + " != " + type); } final boolean isStaticKind = kind == MethodHandle.SGET || kind == MethodHandle.SPUT; final int modifiers = field.getModifiers(); if (Modifier.isStatic(modifiers) != isStaticKind) { String reason = "Field " + field + " is " + (isStaticKind ? "not " : "") + "static"; throw new IllegalAccessException(reason); } final boolean isSetterKind = kind == MethodHandle.IPUT || kind == MethodHandle.SPUT; if (Modifier.isFinal(modifiers) && isSetterKind) { throw new IllegalAccessException("Field " + field + " is final"); } final MethodType methodType; switch (kind) { case MethodHandle.SGET: methodType = MethodType.methodType(fieldType); break; case MethodHandle.SPUT: methodType = MethodType.methodType(void.class, fieldType); break; case MethodHandle.IGET: methodType = MethodType.methodType(fieldType, refc); break; case MethodHandle.IPUT: methodType = MethodType.methodType(void.class, refc, fieldType); break; default: throw new IllegalArgumentException("kind"); } return new MethodHandleImpl(field.getArtField(), kind, methodType); }

Target:
private MethodHandle findAccessor(Class<?> refc, String name, Class<?> type, int kind) throws NoSuchFieldException, IllegalAccessException { final Field field = refc.getField(name); checkAccess(refc, field.getDeclaringClass(), field.getModifiers(), field.getName()); final Class<?> fieldType = field.getType(); if (fieldType != type) { throw new NoSuchFieldException( "Field has wrong type: " + fieldType + " != " + type); } final boolean isStaticKind = kind == MethodHandle.SGET || kind == MethodHandle.SPUT; final int modifiers = field.getModifiers(); if (Modifier.isStatic(modifiers) != isStaticKind) { String reason = "Field " + field + " is " + (isStaticKind ? "not " : "") + "static"; throw new IllegalAccessException(reason); } final boolean isSetterKind = kind == MethodHandle.IPUT || kind == MethodHandle.SPUT; if (Modifier.isFinal(modifiers) && isSetterKind) { throw new IllegalAccessException("Field " + field + " is final"); } final MethodType methodType; switch (kind) { case MethodHandle.SGET: methodType = MethodType.methodType(fieldType); break; case MethodHandle.SPUT: methodType = MethodType.methodType(void.class, fieldType); break; case MethodHandle.IGET: methodType = MethodType.methodType(fieldType, refc); break; case MethodHandle.IPUT: methodType = MethodType.methodType(void.class, refc, fieldType); break; default: throw new IllegalArgumentException("Invalid kind " + kind); } return new MethodHandleImpl(field.getArtField(), kind, methodType); }
Source:
private BBContainer wrapRetCont(PBDSegment<M> segment, int entryNumber, final BBContainer retcont) { return new BBContainer(retcont.b()) { @Override public void discard() { synchronized(PersistentBinaryDeque.this) { checkDoubleFree(); retcont.discard(); boolean isBusted = ! (m_cursorClosed || m_segments.containsKey(segment.segmentIndex())); if (isBusted) { m_usageSpecificLog.info("Trying to free segment " + segment.file() + " m_cursorClosed: " + m_cursorClosed + ", m_segments.containsKey: " + m_segments.containsKey(segment.segmentIndex())); assert !isBusted; } if (m_cursorClosed || m_segments.size() == 1 || (entryNumber != 1 && m_rewoundFromId != segment.m_id) || !canDeleteSegmentsBefore(segment)) { return; } if (m_rewoundFromId == segment.m_id) { m_rewoundFromId = -1; } try { Iterator<PBDSegment<M>> iter = m_segments.headMap(segment.segmentIndex(), false).values() .iterator(); while (iter.hasNext()) { PBDSegment<M> earlierSegment = iter.next(); iter.remove(); if (m_usageSpecificLog.isDebugEnabled()) { m_usageSpecificLog.debug("Segment " + earlierSegment.file() + " has been closed and deleted after discarding last buffer"); } closeAndDeleteSegment(earlierSegment); } } catch (IOException e) { m_usageSpecificLog.error("Exception closing and deleting PBD segment", e); } } } }; }

Target:
private BBContainer wrapRetCont(PBDSegment<M> segment, int entryNumber, final BBContainer retcont) { return new BBContainer(retcont.b()) { @Override public void discard() { synchronized(PersistentBinaryDeque.this) { checkDoubleFree(); retcont.discard(); assert m_cursorClosed || m_segments.containsKey(segment.segmentIndex()); if (m_cursorClosed || m_segments.size() == 1 || (entryNumber != 1 && m_rewoundFromId != segment.m_id) || !canDeleteSegmentsBefore(segment)) { return; } if (m_rewoundFromId == segment.m_id) { m_rewoundFromId = -1; } try { Iterator<PBDSegment<M>> iter = m_segments.headMap(segment.segmentIndex(), false).values() .iterator(); while (iter.hasNext()) { PBDSegment<M> earlierSegment = iter.next(); iter.remove(); if (m_usageSpecificLog.isDebugEnabled()) { m_usageSpecificLog.debug("Segment " + earlierSegment.file() + " has been closed and deleted after discarding last buffer"); } closeAndDeleteSegment(earlierSegment); } } catch (IOException e) { m_usageSpecificLog.error("Exception closing and deleting PBD segment", e); } } } }; }
Source:
public void testSave() { presenter.onStartup(XLSPath, mock(PlaceRequest.class)); doReturn(Optional.of(mock(WorkspaceProject.class))).when(workbenchContext).getActiveWorkspaceProject(); doReturn(promises.resolve(false)).when(projectController).canUpdateProject(any()); presenter.save("saving"); verify(metadataService).saveMetadata(any(Path.class), any(Metadata.class), eq("saving")); }

Target:
public void testSave() { final ObservablePath path = mock(ObservablePath.class); doReturn(path).when(versionRecordManager).getCurrentPath(); presenter.onStartup(XLSPath, mock(PlaceRequest.class)); doReturn(Optional.of(mock(WorkspaceProject.class))).when(workbenchContext).getActiveWorkspaceProject(); doReturn(promises.resolve(false)).when(projectController).canUpdateProject(any()); presenter.save("saving"); verify(metadataService).saveMetadata(eq(path), eq(metadata), eq("saving")); }
Source:
void expandWeakenedAlternativeConstraints(PBody body) { Set<TypeJudgement> allJudgements = new HashSet<TypeJudgement>(); Set<TypeJudgement> newConstraintsToAdd = new HashSet<TypeJudgement>(); Queue<TypeJudgement> judgementsToProcess = new LinkedList<TypeJudgement>(); Map<TypeJudgement, PConstraint> traceability = new HashMap<TypeJudgement, PConstraint>(); for (ITypeConstraint typeConstraint : body.getConstraintsOfType(ITypeConstraint.class)) { TypeJudgement equivalentJudgement = typeConstraint.getEquivalentJudgement(); judgementsToProcess.add(equivalentJudgement); allJudgements.add(equivalentJudgement); traceability.put(equivalentJudgement, typeConstraint); } while (!judgementsToProcess.isEmpty()) { TypeJudgement judgement = judgementsToProcess.poll(); for (TypeJudgement alternativeJudgement : judgement.getWeakenedAlternativeJudgements(context)) { if (allJudgements.add(alternativeJudgement)) { newConstraintsToAdd.add(alternativeJudgement); judgementsToProcess.add(alternativeJudgement); traceability.put(alternativeJudgement, traceability.get(judgement)); } } } for (TypeJudgement typeJudgement : newConstraintsToAdd) { PConstraint newConstraint = typeJudgement.createConstraintFor(body); addTrace(newConstraint, traceability.get(typeJudgement)); } }

Target:
void expandWeakenedAlternativeConstraints(PBody body) { Set<TypeJudgement> allJudgements = new HashSet<TypeJudgement>(); Set<TypeJudgement> newJudgementsToAdd = new HashSet<TypeJudgement>(); Queue<TypeJudgement> judgementsToProcess = new LinkedList<TypeJudgement>(); Multimap<TypeJudgement, PConstraint> traceability = HashMultimap.create(); for (ITypeConstraint typeConstraint : body.getConstraintsOfType(ITypeConstraint.class)) { TypeJudgement equivalentJudgement = typeConstraint.getEquivalentJudgement(); judgementsToProcess.add(equivalentJudgement); allJudgements.add(equivalentJudgement); traceability.put(equivalentJudgement, typeConstraint); } while (!judgementsToProcess.isEmpty()) { TypeJudgement judgement = judgementsToProcess.poll(); for (TypeJudgement alternativeJudgement : judgement.getWeakenedAlternativeJudgements(context)) { if (allJudgements.add(alternativeJudgement)) { newJudgementsToAdd.add(alternativeJudgement); judgementsToProcess.add(alternativeJudgement); traceability.putAll(alternativeJudgement, traceability.get(judgement)); } } } for (TypeJudgement typeJudgement : newJudgementsToAdd) { PConstraint newConstraint = typeJudgement.createConstraintFor(body); for (PConstraint source : traceability.get(typeJudgement)) { addTrace(source, newConstraint); } } }
Source:
public void setup() { initMocks(this); doReturn(2).when(fakeList).size(); doReturn(fakeList).when(layout).getNodePositions(); doReturn("id").when(v1).getId(); doReturn("id").when(v2).getId(); doReturn(v1).when(fakeList).get(0); doReturn(v2).when(fakeList).get(1); doReturn(node).when(graph).getNode(any()); executor = spy(new UndoableLayoutExecutor(canvasHandler, commandManager)); }

Target:
public void setup() { initMocks(this); when(fakeList.size()).thenReturn(2); when(layout.getNodePositions()).thenReturn(fakeList); when(v1.getId()).thenReturn("id"); when(v2.getId()).thenReturn("id"); when(fakeList.get(0)).thenReturn(v1); when(fakeList.get(1)).thenReturn(v2); when(graph.getNode(any())).thenReturn(node); executor = spy(new UndoableLayoutExecutor(canvasHandler, commandManager)); }
Source:
public static String getErrorPageURL(String errorCode, String errorMessage, String appName, String redirectUri) { String errorPageUrl; if (redirectUri != null && !"".equals(redirectUri)) { errorPageUrl = redirectUri; } else { errorPageUrl = CarbonUIUtil.getAdminConsoleURL("/") + "../authenticationendpoint/oauth2_error.do"; } try { errorPageUrl += "?" + OAuthConstants.OAUTH_ERROR_CODE + "=" + URLEncoder.encode(errorCode, "UTF-8") + "&" + OAuthConstants.OAUTH_ERROR_MESSAGE + "=" + URLEncoder.encode(errorMessage, "UTF-8"); } catch (UnsupportedEncodingException e) { log.error("Error while encoding the error page url", e); } if (appName != null) { try { errorPageUrl += "application" + "=" + URLEncoder.encode(appName, "UTF-8"); } catch (UnsupportedEncodingException e) { log.error("Error while encoding the error page url", e); } } return errorPageUrl; }

Target:
public static String getErrorPageURL(String errorCode, String errorMessage, String appName, String redirectUri) { String errorPageUrl; if (redirectUri != null && !"".equals(redirectUri)) { errorPageUrl = redirectUri; } else { errorPageUrl = CarbonUIUtil.getAdminConsoleURL("/") + "../authenticationendpoint/oauth2_error.do"; } try { errorPageUrl += "?" + OAuthConstants.OAUTH_ERROR_CODE + "=" + URLEncoder.encode(errorCode, "UTF-8") + "&" + OAuthConstants.OAUTH_ERROR_MESSAGE + "=" + URLEncoder.encode(errorMessage, "UTF-8"); } catch (UnsupportedEncodingException e) { if (log.isDebugEnabled()){ log.debug("Error while encoding the error page url", e); } } if (appName != null) { try { errorPageUrl += "application" + "=" + URLEncoder.encode(appName, "UTF-8"); } catch (UnsupportedEncodingException e) { if (log.isDebugEnabled()){ log.debug("Error while encoding the error page url", e); } } } return errorPageUrl; }
Source:
public void testCreateTopic() throws NotFoundException { Branch branch = createBranch(); when(userService.getCurrentUser()).thenReturn(user); createTopicStubs(branch); Topic dto = createTopic(); Topic createdTopic = topicService.createTopic(dto, ANSWER_BODY); Post createdPost = createdTopic.getFirstPost(); createTopicAssertions(branch, createdTopic, createdPost); createTopicVerifications(createdTopic); }

Target:
public void testCreateTopic() throws NotFoundException { Branch branch = createBranch(); createTopicStubs(); Topic dto = createTopic(); Topic createdTopic = topicService.createTopic(dto, ANSWER_BODY); Post createdPost = createdTopic.getFirstPost(); createTopicAssertions(branch, createdTopic, createdPost); createTopicVerifications(createdTopic); }
Source:
private List<String> findOldRecords() throws SQLException { List<String> matchingRecords = new ArrayList<>(); try (Connection connection = getConnection(); PreparedStatement lookupStatement = connection.prepareStatement(LOOKUP_STATEMENT)) { long ageMillis = System.currentTimeMillis() - thresholdMillis; lookupStatement.setLong(1, ageMillis); try (ResultSet rs = lookupStatement.executeQuery()) { while (rs.next()) { matchingRecords.add(rs.getString(1)); } } } return matchingRecords; }

Target:
private List<String> findOldRecords() throws SQLException { List<String> matchingRecords = new ArrayList<>(); try (Connection connection = getConnection(); PreparedStatement lookupStatement = connection.prepareStatement(LOOKUP_STATEMENT)) { long ageMillis = System.currentTimeMillis() - thresholdMillis; lookupStatement.setLong(LOOKUP_STATEMENT_TIMESTAMP_PARAM_INDEX, ageMillis); try (ResultSet rs = lookupStatement.executeQuery()) { while (rs.next()) { matchingRecords.add(rs.getString(LOOKUP_STATEMENT_REQUEST_ID_COLUMN_INDEX)); } } } return matchingRecords; }
Source:
private void addNewDataNodes() { for (Datacenter dc : staticClusterMap.hardwareLayout.getDatacenters()) { HelixAdmin dcAdmin = adminForDc.get(dc.getName()); for (DataNode node : dc.getDataNodes()) { String instanceName = node.getHostname() + "_" + node.getPort(); if (!dcAdmin.getInstancesInCluster(clusterName).contains(instanceName)) { InstanceConfig instanceConfig = new InstanceConfig(instanceName); instanceConfig.setHostName(node.getHostname()); instanceConfig.setPort(Integer.toString(node.getPort())); Map<String, Map<String, String>> diskInfos = new HashMap<>(); for (Disk disk : node.getDisks()) { Map<String, String> diskInfo = new HashMap<>(); diskInfo.put(CAPACITY_STR, Long.toString(disk.getRawCapacityInBytes())); diskInfo.put(REPLICAS_STR, ""); diskInfos.put(disk.getMountPath(), diskInfo); } instanceConfig.getRecord().setMapFields(diskInfos); instanceConfig.getRecord().setSimpleField(SSLPORT_STR, Integer.toString(node.getSSLPort())); instanceConfig.getRecord().setSimpleField(DATACENTER_STR, node.getDatacenterName()); instanceConfig.getRecord().setSimpleField(RACKID_STR, Long.toString(node.getRackId())); instanceConfig.getRecord().setListField(SEALED_STR, new ArrayList<String>()); dcAdmin.addInstance(clusterName, instanceConfig); } } } }

Target:
private void addNewDataNodes() { for (Datacenter dc : staticClusterMap.hardwareLayout.getDatacenters()) { HelixAdmin dcAdmin = adminForDc.get(dc.getName()); for (DataNode node : dc.getDataNodes()) { String instanceName = getInstanceName(node); if (!dcAdmin.getInstancesInCluster(clusterName).contains(instanceName)) { InstanceConfig instanceConfig = new InstanceConfig(instanceName); instanceConfig.setHostName(node.getHostname()); instanceConfig.setPort(Integer.toString(node.getPort())); Map<String, Map<String, String>> diskInfos = new HashMap<>(); for (Disk disk : node.getDisks()) { Map<String, String> diskInfo = new HashMap<>(); diskInfo.put(CAPACITY_STR, Long.toString(disk.getRawCapacityInBytes())); diskInfo.put(REPLICAS_STR, ""); diskInfos.put(disk.getMountPath(), diskInfo); } instanceConfig.getRecord().setMapFields(diskInfos); instanceConfig.getRecord().setSimpleField(SSLPORT_STR, Integer.toString(node.getSSLPort())); instanceConfig.getRecord().setSimpleField(DATACENTER_STR, node.getDatacenterName()); instanceConfig.getRecord().setSimpleField(RACKID_STR, Long.toString(node.getRackId())); instanceConfig.getRecord().setListField(SEALED_STR, new ArrayList<String>()); dcAdmin.addInstance(clusterName, instanceConfig); } } } }
Source:
public void handleStatement(Statement statement) throws RDFHandlerException { Resource subject = statement.getSubject(); Value object = statement.getObject(); if (subject.stringValue().contains("ontology-0.0.1")) { subject = new URIImpl(subject.stringValue().replace("ontology-0.0.1", "ontology")); } if (object.stringValue().contains("ontology-0.0.1")) { object = new URIImpl(object.stringValue().replace("ontology-0.0.1", "ontology")); } if (subject != statement.getSubject() || object != statement.getObject()) { statement = new StatementImpl(subject, statement.getPredicate(), object); } super.handleStatement(statement); }

Target:
public void handleStatement(Statement statement) throws RDFHandlerException { Resource subject = statement.getSubject(); URI predicate = statement.getPredicate(); Value object = statement.getObject(); if (subject.stringValue().contains("ontology-0.0.1")) { subject = new URIImpl(subject.stringValue().replace("ontology-0.0.1", "ontology")); } if (predicate.stringValue().contains("ontology-0.0.1")) { predicate = new URIImpl(predicate.stringValue().replace("ontology-0.0.1", "ontology")); } if (object.stringValue().contains("ontology-0.0.1")) { object = new URIImpl(object.stringValue().replace("ontology-0.0.1", "ontology")); } if (subject != statement.getSubject() || predicate != statement.getPredicate() || object != statement.getObject()) { statement = new StatementImpl(subject, predicate, object); } super.handleStatement(statement); }
Source:
protected ExportRowData decodeRow(byte[] rowData) throws IOException { ExportRow row = ExportRow.decodeRow(null, getPartition(), m_startTS, rowData); return new ExportRowData(row.values, row.partitionValue, row.partitionId); }

Target:
protected ExportRowData decodeRow(byte[] rowData) throws IOException { ExportRow row = ExportRow.decodeRow(m_legacyRow, getPartition(), m_startTS, rowData); return new ExportRowData(row.values, row.partitionValue, row.partitionId); }
Source:
private void verifyRegionSize(boolean isClient, int expectedNum) { GeodeAwaitility.await().atMost(10, SECONDS) .untilAsserted(() -> assertThat(getRegion(isClient).size()).isEqualTo(expectedNum)); }

Target:
private void verifyRegionSize(boolean isClient, int expectedNum) { GeodeAwaitility.await() .untilAsserted(() -> assertThat(getRegion(isClient).size()).isEqualTo(expectedNum)); }
Source:
private boolean isStringAttributeChange(Diff diff) { return diff instanceof AttributeChange && EcorePackage.eINSTANCE.getEString().equals( ((AttributeChange)diff).getAttribute().getEType()); }

Target:
private boolean isStringAttributeChange(Diff diff) { return diff instanceof AttributeChange && ((AttributeChange)diff).getAttribute().getEAttributeType().getInstanceClass() == String.class; }
Source:
void should_fail_if_object_is_null() { AssertionInfo info = someInfo(); String specificLabel = "specific label"; assertThatExceptionOfType(AssertionError.class) .isThrownBy(() -> objects.assertNotNull(info, null, specificLabel)); verify(failures).failure(info, ShouldNotBeNull.of(specificLabel)); }

Target:
void should_fail_if_object_is_null() { AssertionInfo info = someInfo(); String specificLabel = "specific label"; assertThatAssertionErrorIsThrownBy(() -> objects.assertNotNull(info, null, specificLabel)); verify(failures).failure(info, shouldNotBeNull(specificLabel)); }
Source:
public void addFlagToCurrentBus(IFlag flag) { if (currentBus != null) { IWaftAdapter waftAdapter = ApiAdapterFactory.createWaftAdapter(); waftAdapter.flagBus(this.currentBus, flag); waftAdapter.flagBus(new Bus("", "", "", "", new ArrayList<IFlag>()), flag); } }

Target:
public void addFlagToCurrentBus(IFlag flag) { if (currentBus != null) { IWaftAdapter waftAdapter = ApiAdapterFactory.createWaftAdapter(); waftAdapter.flagBus(this.currentBus, flag); } }
Source:
protected ClientResource sendActivationRequest(String username){ String url = activationUrl + "?username=" + username; ClientResource clientResource = createClientResource(url, false); if (!StringUtils.isAnyBlank(login, password)) { clientResource.setChallengeResponse(ChallengeScheme.HTTP_BASIC, login, password); } writeRequestInfoToLog(clientResource); try { clientResource.get(); } catch (ResourceException e) { logger.debug("Poulpe activation request error: {}", e.getStatus()); } return clientResource; }

Target:
protected ClientResource sendActivationRequest(String username){ String url = activationUrl + "?username=" + username; ClientResource clientResource = createClientResource(url, false); addCredentialsIfAny(clientResource); writeRequestInfoToLog(clientResource); try { clientResource.get(); } catch (ResourceException e) { logger.warn("Poulpe activation request error: {}", e.getStatus()); } return clientResource; }
Source:
public void deleteAllFromRevision() throws ConflictException { for (int i=0;i<10;i++) { Map m = new HashMap<String, Object>(); m.put("name", "conflicted"); m.put("timestamp", System.currentTimeMillis()); DocumentBody body = DocumentBodyFactory.create(m); DocumentRevisionBuilder builder = new DocumentRevisionBuilder(); builder.setDocId(saved.getId()); String newRev = "2-conflict-"+i; builder.setRevId(newRev); builder.setDeleted(false); builder.setBody(body); datastore.forceInsert(builder.build(), saved.getRevision(), newRev); } Assert.assertEquals("Expected 10 leaves", 10, datastore.getAllRevisionsOfDocument(saved.getId()).leafs().size()); for(DocumentRevision rev : datastore.getAllRevisionsOfDocument(saved.getId()).leafRevisions()) { Assert.assertTrue("Expected rev to not be deleted", !rev.isDeleted()); } List<DocumentRevision> deleted = datastore.deleteDocument(saved.getId()); Assert.assertEquals("Expected 10 leaves", 10, deleted.size()); for(DocumentRevision rev : deleted) { Assert.assertTrue("Expected rev to be deleted", rev.isDeleted()); } for(DocumentRevision rev : datastore.getAllRevisionsOfDocument(saved.getId()).leafRevisions()) { Assert.assertTrue("Expected rev to be deleted", rev.isDeleted()); } }

Target:
public void deleteAllFromRevision() throws ConflictException { for (int i=0;i<10;i++) { Map m = new HashMap<String, Object>(); m.put("name", "conflicted"); m.put("timestamp", System.currentTimeMillis()); DocumentBody body = DocumentBodyFactory.create(m); DocumentRevisionBuilder builder = new DocumentRevisionBuilder(); builder.setDocId(saved.getId()); String newRev = "2-conflict-"+i; builder.setRevId(newRev); builder.setDeleted(false); builder.setBody(body); datastore.forceInsert(builder.build(), saved.getRevision(), newRev); } Assert.assertEquals("Expected 10 leaves", 10, datastore.getAllRevisionsOfDocument(saved.getId()).leafs().size()); for(BasicDocumentRevision rev : datastore.getAllRevisionsOfDocument(saved.getId()).leafRevisions()) { Assert.assertTrue("Expected rev to not be deleted", !rev.isDeleted()); } List<BasicDocumentRevision> deleted = datastore.deleteDocument(saved.getId()); Assert.assertEquals("Expected 10 leaves", 10, deleted.size()); for(BasicDocumentRevision rev : deleted) { Assert.assertTrue("Expected rev to be deleted", rev.isDeleted()); } for(BasicDocumentRevision rev : datastore.getAllRevisionsOfDocument(saved.getId()).leafRevisions()) { Assert.assertTrue("Expected rev to be deleted", rev.isDeleted()); } }
Source:
protected void processAttributesAfterRetrieval(String userName, Map<String, String> userStorePropertyValues, String profileName) { String timestampAttributesProperty = Optional.ofNullable(realmConfig .getUserStoreProperty(UserStoreConfigConstants.timestampAttributes)).orElse(""); String[] timestampAttributes = StringUtils.split(timestampAttributesProperty, ","); if (logger.isDebugEnabled()) { logger.debug("Active Directory timestamp attributes: " + Arrays.toString(timestampAttributes)); } if (ArrayUtils.isNotEmpty(timestampAttributes)) { if (logger.isDebugEnabled()) { logger.debug("Retrieved user store properties before type conversions: " + userStorePropertyValues); } Map<String, String> convertedTimestampAttributeValues = Arrays.stream(timestampAttributes) .map(StringUtils::trim) .filter(attribute -> userStorePropertyValues.get(attribute) != null) .collect(Collectors.toMap(Function.identity(), attribute -> convertDateFormatFromAD(userStorePropertyValues.get(attribute)))); if (logger.isDebugEnabled()) { logger.debug("Converted timestamp attribute values: " + convertedTimestampAttributeValues); } userStorePropertyValues.putAll(convertedTimestampAttributeValues); if (logger.isDebugEnabled()) { logger.debug("Retrieved user store properties after type conversions: " + userStorePropertyValues); } } }

Target:
protected void processAttributesAfterRetrieval(String userName, Map<String, String> userStorePropertyValues, String profileName) { String timestampAttributesProperty = Optional.ofNullable(realmConfig .getUserStoreProperty(UserStoreConfigConstants.timestampAttributes)).orElse(StringUtils.EMPTY); String[] timestampAttributes = StringUtils.split(timestampAttributesProperty, ","); if (logger.isDebugEnabled()) { logger.debug("Active Directory timestamp attributes: " + Arrays.toString(timestampAttributes)); } if (ArrayUtils.isNotEmpty(timestampAttributes)) { if (logger.isDebugEnabled()) { logger.debug("Retrieved user store properties before type conversions: " + userStorePropertyValues); } Map<String, String> convertedTimestampAttributeValues = Arrays.stream(timestampAttributes) .map(StringUtils::trim) .filter(attribute -> userStorePropertyValues.get(attribute) != null) .collect(Collectors.toMap(Function.identity(), attribute -> convertDateFormatFromAD(userStorePropertyValues.get(attribute)))); if (logger.isDebugEnabled()) { logger.debug("Converted timestamp attribute values: " + convertedTimestampAttributeValues); } userStorePropertyValues.putAll(convertedTimestampAttributeValues); if (logger.isDebugEnabled()) { logger.debug("Retrieved user store properties after type conversions: " + userStorePropertyValues); } } }
Source:
public ImmutableList<SchedulePeriod> getRegularPeriods() { if (isTerm()) { return periods; } Optional<SchedulePeriod> initialStub = getInitialStub(); Optional<SchedulePeriod> finalStub = getFinalStub(); if (initialStub.isPresent() && finalStub.isPresent()) { return periods.subList(1, periods.size() - 1); } else if (initialStub.isPresent()) { return periods.subList(1, periods.size()); } else if (finalStub.isPresent()) { return periods.subList(0, periods.size() - 1); } else { return periods; } }

Target:
public ImmutableList<SchedulePeriod> getRegularPeriods() { if (isTerm()) { return periods; } int startStub = isInitialStub() ? 1 : 0; int endStub = isFinalStub() ? 1 : 0; return (startStub == 0 && endStub == 0 ? periods : periods.subList(startStub, periods.size() - endStub)); }
Source:
public VnicProfile update(VnicProfile resource) { if (resource.isSetPassthrough()) { validateEnum(VnicPassthrough.class, resource.getPassthrough().toUpperCase()); } return performUpdate(resource, new QueryIdResolver<>(VdcQueryType.GetVnicProfileById, IdQueryParameters.class), VdcActionType.UpdateVnicProfile, new UpdateParametersProvider()); }

Target:
public VnicProfile update(VnicProfile resource) { validateEnums(VnicProfile.class, resource); return performUpdate(resource, new QueryIdResolver<>(VdcQueryType.GetVnicProfileById, IdQueryParameters.class), VdcActionType.UpdateVnicProfile, new UpdateParametersProvider()); }
Source:
public JavaLanguageExtensionServiceClient( RequestTransmitter requestTransmitter, RequestHandlerConfigurator configurator, RequestTransmitter transmitter, AppContext appContext, EventBus eventBus) { this.requestTransmitter = requestTransmitter; this.configurator = configurator; this.transmitter = transmitter; this.appContext = appContext; eventBus.addHandler( WorkspaceReadyEvent.getType(), e -> { subscribe(); hasJDTLSInstallerAdded = checkJDTLSInstaller(); initializeJDTLS(); }); }

Target:
public JavaLanguageExtensionServiceClient( RequestTransmitter requestTransmitter, RequestHandlerConfigurator configurator, RequestTransmitter transmitter, AppContext appContext, EventBus eventBus) { this.requestTransmitter = requestTransmitter; this.configurator = configurator; this.transmitter = transmitter; this.appContext = appContext; eventBus.addHandler(WorkspaceReadyEvent.getType(), e -> subscribe()); }
Source:
public void attachContainer(String container, MessageProcessor<LogMessage> containerLogsProcessor, boolean stream) throws IOException { final List<Pair<String, ?>> headers = new ArrayList<>(2); headers.add(Pair.of("Content-Type", "text/plain")); headers.add(Pair.of("Content-Length", 0)); try (DockerConnection connection = openConnection(dockerDaemonUri).method("POST") .path("/containers/" + container + "/attach") .query("stream", (stream ? 1 : 0)) .query("logs", (stream ? 0 : 1)) .query("stdout", 1) .query("stderr", 1) .headers(headers)) { final DockerResponse response = connection.request(); final int status = response.getStatus(); if (200 != status) { throw new DockerException(getDockerExceptionMessage(response), status); } try (InputStream responseStream = response.getInputStream()) { new LogMessagePumper(responseStream, containerLogsProcessor).start(); } } }

Target:
public void attachContainer(String container, MessageProcessor<LogMessage> containerLogsProcessor, boolean stream) throws IOException { final List<Pair<String, ?>> headers = new ArrayList<>(2); headers.add(Pair.of("Content-Type", MediaType.TEXT_PLAIN)); headers.add(Pair.of("Content-Length", 0)); try (DockerConnection connection = openConnection(dockerDaemonUri).method("POST") .path("/containers/" + container + "/attach") .query("stream", (stream ? 1 : 0)) .query("logs", (stream ? 0 : 1)) .query("stdout", 1) .query("stderr", 1) .headers(headers)) { final DockerResponse response = connection.request(); final int status = response.getStatus(); if (OK.getStatusCode() != status) { throw new DockerException(getDockerExceptionMessage(response), status); } try (InputStream responseStream = response.getInputStream()) { new LogMessagePumper(responseStream, containerLogsProcessor).start(); } } }
Source:
public Node getNodeByUniqueId(String nodeId) { Optional<Node> node = this.nodes.values().stream().filter(e -> e.getNodeUniqueId().equals(nodeId)).findFirst(); return node.isPresent() ? node.get() : null; }

Target:
public Node getNodeByUniqueId(String nodeId) { Optional<Node> node = this.nodes.values().stream().filter(e -> e.getNodeUniqueId().equals(nodeId)).findFirst(); return node.orElse(null); }
Source:
public static AnnotationSpec get(Annotation annotation, boolean includeDefaultValues) { Builder builder = builder(annotation.annotationType()); try { Method[] methods = annotation.annotationType().getDeclaredMethods(); Arrays.sort(methods, new Comparator<Method>() { @Override public int compare(Method m1, Method m2) { return m1.getName().compareTo(m2.getName()); } }); for (Method method : methods) { Object value = method.invoke(annotation); if (!includeDefaultValues) { if (Objects.deepEquals(value, method.getDefaultValue())) { continue; } } if (value.getClass().isArray()) { for (int i = 0; i < Array.getLength(value); i++) { addAnnotationValue(builder, method.getName(), Array.get(value, i)); } continue; } if (value instanceof Annotation) { AnnotationSpec nested = get((Annotation) value); if (nested.members.isEmpty()) { builder.addMember(method.getName(), "@$T", nested.type); } else { String s = nested.toString(); s = s.substring(s.indexOf('(') + 1, s.lastIndexOf(')')); builder.addMember(method.getName(), "@$T($L)", nested.type, s); } continue; } addAnnotationValue(builder, method.getName(), value); } } catch (Exception e) { throw new RuntimeException("Reflecting " + annotation + " failed!", e); } return builder.build(); }

Target:
public static AnnotationSpec get(Annotation annotation, boolean includeDefaultValues) { Builder builder = builder(annotation.annotationType()); try { Method[] methods = annotation.annotationType().getDeclaredMethods(); Arrays.sort(methods, new Comparator<Method>() { @Override public int compare(Method m1, Method m2) { return m1.getName().compareTo(m2.getName()); } }); for (Method method : methods) { Object value = method.invoke(annotation); if (!includeDefaultValues) { if (Objects.deepEquals(value, method.getDefaultValue())) { continue; } } if (value.getClass().isArray()) { for (int i = 0; i < Array.getLength(value); i++) { addAnnotationValue(builder, method.getName(), Array.get(value, i)); } continue; } if (value instanceof Annotation) { builder.addMember(method.getName(), "$L", get((Annotation) value)); continue; } addAnnotationValue(builder, method.getName(), value); } } catch (Exception e) { throw new RuntimeException("Reflecting " + annotation + " failed!", e); } return builder.build(); }
Source:
private IStatus getErrorList(Map<String, MergeFailureReason> failingPaths) { MultiStatus result = new MultiStatus(Activator.getPluginId(), IStatus.ERROR, UIText.CherryPickHandler_CherryPickFailedMessage, null); for (String path : failingPaths.keySet()) { String reason = getReason(failingPaths.get(path)); String errorMessage = path + SPACE + reason; result.add(Activator.createErrorStatus(errorMessage)); } return result; }

Target:
private IStatus getErrorList(Map<String, MergeFailureReason> failingPaths) { MultiStatus result = new MultiStatus(Activator.getPluginId(), IStatus.ERROR, UIText.CherryPickHandler_CherryPickFailedMessage, null); for (String path : failingPaths.keySet()) { String reason = getReason(failingPaths.get(path)); String errorMessage = NLS.bind( UIText.CherryPickHandler_ErrorMsgTemplate, path, reason); result.add(Activator.createErrorStatus(errorMessage)); } return result; }
Source:
public static Method getFunction(String functionName) { Method method = functionMap.get(functionName); if (method != null) { return method; } String nameLower = functionName.toLowerCase(Locale.US); if (nameLower == functionName) { return null; } method = functionMap.get(nameLower); if (method != null) { if (functionMap.size() < 1000) { functionMap.put(nameLower, method); } return method; } return null; }

Target:
public static Method getFunction(String functionName) { return functionMap.get("sql" + functionName.toLowerCase(Locale.US)); }