auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code><START> private void initializeFromOldBits(CircularBitSet oldBitSet) { <END> if (oldBitSet.occupiedBits <= size) { for (int i = 0; i < oldBitSet.occupiedBits; i++) setNext(oldBitSet.bitSet.get(i)); } else { int startIndex = oldBitSet.currentIndex - size; for (int i = 0; i < size; i++) { int index = startIndex + i; index = index < 0 ? index + oldBitSet.size : index; setNext(oldBitSet.bitSet.get(index)); } } }</code><technical_language>I simplify this a bit, like: private void initializeFromOldBits(CircularBitSet oldBitSet) { int startIndex = oldBitSet.occupiedBits <= size ? 0 : oldBitSet.occupiedBits - size; for (int i = startIndex; i < oldBitSet.occupiedBits; i++) setNext(oldBitSet.bitSet.get(i)); } do think</technical_language>

Target:
private void initializeFromOldBits(CircularBitSet oldBitSet) { int startIndex = oldBitSet.occupiedBits <= size ? 0 : oldBitSet.occupiedBits - size; for (int i = startIndex; i < oldBitSet.occupiedBits; i++) { setNext(oldBitSet.bitSet.get(i)); } }
Source:
<code>public boolean moveCellsUp() { boolean dirty = false; if (moveCellsUpLoop()) dirty = true; for (int i = 0; i < GRID_WIDTH; i++) { for (int j = 0; j < (GRID_WIDTH - 1); j++) { int nextJ = j + 1; dirty = combineCells(i, nextJ, i, j, dirty); } } if <START> (moveCellsUpLoop()) dirty = true; <END> return dirty; }</code><technical_language>braces</technical_language>

Target:
public boolean moveCellsUp() { boolean dirty = false; if (moveCellsUpLoop()) { dirty = true; } for (int i = 0; i < GRID_WIDTH; i++) { for (int j = 0; j < (GRID_WIDTH - 1); j++) { int nextJ = j + 1; dirty = combineCells(i, nextJ, i, j, dirty); } } if (moveCellsUpLoop()) { dirty = true; } return dirty; }
Source:
<code>public static Slice stConvexHull(@SqlType(GEOMETRY_TYPE_NAME) Slice input) { OGCGeometry geometry = deserialize(input); if (geometry.isEmpty()) { return input; } if (GeometryType.getForEsriGeometryType(geometry.geometryType()) == POINT) { return input; } <START> OGCGeometry convexHull = geometry.convexHull(); <END> return serialize(convexHull); }</code><technical_language>nit: inline this variable</technical_language>

Target:
public static Slice stConvexHull(@SqlType(GEOMETRY_TYPE_NAME) Slice input) { OGCGeometry geometry = deserialize(input); if (geometry.isEmpty()) { return input; } if (GeometryType.getForEsriGeometryType(geometry.geometryType()) == POINT) { return input; } return serialize(geometry.convexHull()); }
Source:
<code>public int hashCode() { int h = 0; if (oldId != null) { h = h * 31 + oldId.hashCode(); } h = h * 31 + newId.hashCode(); h = h * 31 + whitespace.name().hashCode(); <START> h = h * 31 + isRebaseTransparent.hashCode(); <END> return h; }</code><technical_language>h =h * 31 + (isRebaseTransparent ? 1 : 0)</technical_language>

Target:
public int hashCode() { int h = 0; if (oldId != null) { h = h * 31 + oldId.hashCode(); } h = h * 31 + newId.hashCode(); h = h * 31 + whitespace.name().hashCode(); h = h * 31 + (isRebaseTransparent ? 1 : 0); return h; }
Source:
<code>public void rebaseEdit() throws Exception { assertEquals(RefUpdate.Result.NEW, modifier.createEdit( change, ps)); assertEquals(RefUpdate.Result.FORCED, modifier.modifyFile( editUtil.byChange(change).get(), FILE_NAME, CONTENT_NEW)); Optional<ChangeEditData> data = editUtil.dataByChange(change); PatchSet current = getCurrentPatchSet(changeId); assertEquals(current.getPatchSetId(), data.get().getBasePatchSet().getPatchSetId() + 1); <START> modifier.rebaseEdit(data.get(), current); <END> data = editUtil.dataByChange(change); assertEquals(current.getPatchSetId(), data.get().getBasePatchSet().getPatchSetId()); }</code><technical_language>Check contents expect</technical_language>

Target:
public void rebaseEdit() throws Exception { assertEquals(RefUpdate.Result.NEW, modifier.createEdit( change, ps)); assertEquals(RefUpdate.Result.FORCED, modifier.modifyFile( editUtil.byChange(change).get(), FILE_NAME, CONTENT_NEW)); ChangeEdit edit = editUtil.byChange(change).get(); PatchSet current = getCurrentPatchSet(changeId); assertEquals(current.getPatchSetId() - 1, edit.getBasePatchSet().getPatchSetId()); Date beforeRebase = edit.getEditCommit().getCommitterIdent().getWhen(); Thread.sleep(1000L); modifier.rebaseEdit(edit, current); edit = editUtil.byChange(change).get(); assertArrayEquals(CONTENT_NEW, toBytes(fileUtil.getContent(edit.getChange().getProject(), edit.getRevision().get(), FILE_NAME))); assertArrayEquals(CONTENT_NEW2, toBytes(fileUtil.getContent(edit.getChange().getProject(), edit.getRevision().get(), FILE_NAME2))); assertEquals(current.getPatchSetId(), edit.getBasePatchSet().getPatchSetId()); Date afterRebase = edit.getEditCommit().getCommitterIdent().getWhen(); assertFalse(beforeRebase.equals(afterRebase)); }
Source:
<code>public static void beforeClass() { cluster = PassthroughTestHelpers.createActiveOnly("stripe", server -> { server.registerClientEntityService(new LeaseAcquirerClientService()); server.registerServerEntityService(new LeaseAcquirerServerService()); <START> server.registerOverrideServiceProvider(new LeaseServiceProvider(), new LeaseConfigurationImpl(500L)); <END> }); cluster.startAllServers(); }</code><technical_language>this rename necessary - causing a bit of noise</technical_language>

Target:
public static void beforeClass() { cluster = PassthroughTestHelpers.createActiveOnly("stripe", server -> { server.registerClientEntityService(new LeaseAcquirerClientService()); server.registerServerEntityService(new LeaseAcquirerServerService()); server.registerOverrideServiceProvider(new LeaseServiceProvider(), new LeaseConfiguration(500L)); }); cluster.startAllServers(); }
Source:
<code>protected static void validateCommandLineParameters(CommandLineArgs args) { String testClasses = args.testClass; List<String> testNgXml = args.suiteFiles; String testJar = args.testJar; String slave = args.slave; List<String> methods = args.commandLineMethods; if (testClasses == null && slave == null && testJar == null && (testNgXml == null || testNgXml.isEmpty()) && (methods == null || methods.isEmpty())) { throw new ParameterException("You need to specify at least one testng.xml, one class" + " or one method"); } String groups = args.groups; String excludedGroups = args.excludedGroups; if (testJar == null && (null != groups || null != excludedGroups) && testClasses == null && (testNgXml == null || testNgXml.isEmpty())) { throw new ParameterException("Groups option should be used with testclass option"); } <START> if (args.slave != null && args.master != null) { <END> throw new ParameterException(CommandLineArgs.SLAVE + " can't be combined with " + CommandLineArgs.MASTER); } Boolean junit = args.junit; Boolean mixed = args.mixed; if (junit && mixed) { throw new ParameterException(CommandLineArgs.MIXED + " can't be combined with " + CommandLineArgs.JUNIT); } }</code><technical_language>remote package moved <LINK_0> in PR #953</technical_language>

Target:
protected static void validateCommandLineParameters(CommandLineArgs args) { String testClasses = args.testClass; List<String> testNgXml = args.suiteFiles; String testJar = args.testJar; List<String> methods = args.commandLineMethods; if (testClasses == null && testJar == null && (testNgXml == null || testNgXml.isEmpty()) && (methods == null || methods.isEmpty())) { throw new ParameterException("You need to specify at least one testng.xml, one class" + " or one method"); } String groups = args.groups; String excludedGroups = args.excludedGroups; if (testJar == null && (null != groups || null != excludedGroups) && testClasses == null && (testNgXml == null || testNgXml.isEmpty())) { throw new ParameterException("Groups option should be used with testclass option"); } Boolean junit = args.junit; Boolean mixed = args.mixed; if (junit && mixed) { throw new ParameterException(CommandLineArgs.MIXED + " can't be combined with " + CommandLineArgs.JUNIT); } }
Source:
<code>private void validateLabelTemplate() { if (XmlUtils.doesNotMatchUsingXsdRegex(LABEL_TEMPLATE_FORMAT_REGEX, labelTemplate)) { <START> addError("labelTemplate", <END> "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)); } } }</code><technical_language>message this long? do somethingelse</technical_language>

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:
<code>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) { <START> if (args[0].contains(word)) <END> { playerMsg("That tag contains a forbidden word."); return true; } } } playerMsg("Set tag to " + tag); return true; }</code><technical_language>This case insensitive</technical_language>

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:
<code>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()) <START> + ", upgradedSequencerReference=" + (upgradedSequencerReference == null ? null : upgradedSequencerReference.getId()) + "]"; <END> }</code><technical_language>If get String of want null friendly try this: java String s = String.valueOf(obj); I String.valueOf(obj) this hood: java public static String valueOf(Object obj) { return (obj == null) ? "null" : obj.toString(); } Applies file wide :neckbeard: #notadealbreaker</technical_language>

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:
<code>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; } <START> throw e; <END> } }</code><technical_language>if metric is MetricSet, issue code</technical_language>

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:
<code>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( <START> this.documentReferenceResolver.resolve("XWiki.Notifications.Code.NotificationRSSService"), <END> "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; }</code><technical_language>reference is main wiki</technical_language>

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:
<code><START> public BBContainer poll(OutputContainerFactory ocf, boolean checkCRC) throws IOException { <END> 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); } }</code><technical_language>is logic bypasses checks if segment file is finalized</technical_language>

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:
<code>public Group updateParentGroupId(PerunSession sess, Group group) throws InternalErrorException { <START> Utils.notNull(group.getName(), "group.getName()"); <END> 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; }</code><technical_language>Is this check necessary ? Technically, name exists, do check other params do work group name in this method</technical_language>

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:
<code>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" <START> + getModuleSimpleName() + " into XML files: ", ex); <END> } } }</code><technical_language>wrap exception in runtime exception rethrow it</technical_language>

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:
<code>public void setHidden(File path, boolean hidden) throws IOException { <START> super.setHidden(path, hidden); <END> }</code><technical_language>instead of delegating super class I instead override this method in this subclass</technical_language>

Target:
public void setHidden(File path, boolean hidden) throws IOException { }
Source:
<code>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 <START> IllegalArgumentException("kind"); <END> } return new MethodHandleImpl(field.getArtField(), kind, methodType); }</code><technical_language>include |kind| in message. "Invalid kind " + kind</technical_language>

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:
<code>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) { <START> m_usageSpecificLog.info("Trying to free segment " + segment.file() <END> + " 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); } } } }; }</code><technical_language>This error is fatal apprunner</technical_language>

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:
<code>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"); <START> verify(metadataService).saveMetadata(any(Path.class), any(Metadata.class), <END> eq("saving")); }</code><technical_language>please replace any() eq() do in <LINK_0></technical_language>

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:
<code>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); <START> addTrace(newConstraint, traceability.get(typeJudgement)); <END> } }</code><technical_language>order of arguments of addTrace reversed. declaration of method: IRewriterTraceCollector.addTrace(PConstraint origin, PConstraint derivative)</technical_language>

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:
<code>public void setup() { initMocks(this); <START> doReturn(2).when(fakeList).size(); <END> 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)); }</code><technical_language>hard learnt experience; doReturn(xx).when(mock).blah() is dealing a spy. If dealing a mock when(mock.blah()).thenReturn(xx) is is type-safe is detected do in future break type compatibility</technical_language>

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:
<code>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) { <START> log.error("Error while encoding the error page url", e); <END> } 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; }</code><technical_language>log exceptions in debug level</technical_language>

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:
<code>public void testCreateTopic() throws NotFoundException { Branch branch = createBranch(); <START> when(userService.getCurrentUser()).thenReturn(user); <END> createTopicStubs(branch); Topic dto = createTopic(); Topic createdTopic = topicService.createTopic(dto, ANSWER_BODY); Post createdPost = createdTopic.getFirstPost(); createTopicAssertions(branch, createdTopic, createdPost); createTopicVerifications(createdTopic); }</code><technical_language>Duplicates in createTopicStubs</technical_language>

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:
<code>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()) { <START> matchingRecords.add(rs.getString(1)); <END> } } } return matchingRecords; }</code><technical_language>Magic number</technical_language>

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:
<code>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())); <START> instanceConfig.getRecord().setListField(SEALED_STR, new ArrayList<String>()); <END> dcAdmin.addInstance(clusterName, instanceConfig); } } } }</code><technical_language>is this a simple field</technical_language>

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:
<code>public void handleStatement(Statement statement) throws RDFHandlerException { Resource subject = statement.getSubject(); Value object = statement.getObject(); <START> if (subject.stringValue().contains("ontology-0.0.1")) { <END> 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); }</code><technical_language>ontology-beta (but ontology done). I know, annoying</technical_language>

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:
<code>protected ExportRowData decodeRow(byte[] rowData) throws IOException { <START> ExportRow row = ExportRow.decodeRow(null, getPartition(), m_startTS, rowData); <END> return new ExportRowData(row.values, row.partitionValue, row.partitionId); }</code><technical_language>null here? guarantee schema in rowData</technical_language>

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:
<code>private void verifyRegionSize(boolean isClient, int expectedNum) { <START> GeodeAwaitility.await().atMost(10, SECONDS) <END> .untilAsserted(() -> assertThat(getRegion(isClient).size()).isEqualTo(expectedNum)); }</code><technical_language>reason for overriding default GeodeAwaitility timeout?, leave default avoid flakiness (for cases a resource contention while running tests)?</technical_language>

Target:
private void verifyRegionSize(boolean isClient, int expectedNum) { GeodeAwaitility.await() .untilAsserted(() -> assertThat(getRegion(isClient).size()).isEqualTo(expectedNum)); }
Source:
<code>private boolean isStringAttributeChange(Diff diff) { return diff instanceof AttributeChange && EcorePackage.eINSTANCE.getEString().equals( <START> ((AttributeChange)diff).getAttribute().getEType()); <END> }</code><technical_language>This test work for basic of cases. I checking for attribute type's java class : diff instanceof AttributeChange && ((AttributeChange)diff).getAttribute().getEAttributeType().getInstanceClass() == String.class</technical_language>

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

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:
<code>public void addFlagToCurrentBus(IFlag flag) { if (currentBus != null) { IWaftAdapter waftAdapter = ApiAdapterFactory.createWaftAdapter(); waftAdapter.flagBus(this.currentBus, flag); <START> waftAdapter.flagBus(new Bus("", "", "", "", new ArrayList<IFlag>()), flag); <END> } }</code><technical_language>is here? add? Assuming is for debug reasons</technical_language>

Target:
public void addFlagToCurrentBus(IFlag flag) { if (currentBus != null) { IWaftAdapter waftAdapter = ApiAdapterFactory.createWaftAdapter(); waftAdapter.flagBus(this.currentBus, flag); } }
Source:
<code>protected ClientResource sendActivationRequest(String username){ String url = activationUrl + "?username=" + username; ClientResource clientResource = createClientResource(url, false); <START> if (!StringUtils.isAnyBlank(login, password)) { <END> 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; }</code><technical_language>repeated times. addCredentialsIfAny(clientResource)</technical_language>

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:
<code>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()); } <START> } <END></code><technical_language>Again, tests for nil, non-existent revision ID other failure cases</technical_language>

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:
<code>protected void processAttributesAfterRetrieval(String userName, Map<String, String> userStorePropertyValues, String profileName) { String timestampAttributesProperty = Optional.ofNullable(realmConfig <START> .getUserStoreProperty(UserStoreConfigConstants.timestampAttributes)).orElse(""); <END> 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); } } }</code><technical_language>constant in stringutils</technical_language>

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); } } }