auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public synchronized void resetServer(CorfuPayloadMsg<SequencerTailsRecoveryMsg> msg, ChannelHandlerContext ctx, IServerRouter r) { long initialToken = msg.getPayload().getGlobalTail(); Map<UUID, Long> streamTails = msg.getPayload().getStreamTails(); long bootstrapMsgEpoch = msg.getPayload().getSequencerEpoch(); final boolean bootstrapWithoutTailsUpdate = msg.getPayload() .getBootstrapWithoutTailsUpdate(); if (bootstrapWithoutTailsUpdate && (sequencerEpoch == Layout.INVALID_EPOCH || bootstrapMsgEpoch != sequencerEpoch + 1)) { log.warn("Cannot update existing sequencer. Require full bootstrap. SequencerEpoch : {}, MsgEpoch : {}", sequencerEpoch, bootstrapMsgEpoch ); r.sendResponse(ctx, msg, CorfuMsgType.NACK.msg()); return; } if (serverContext.getSequencerEpoch() >= bootstrapMsgEpoch) { log.info("Sequencer already bootstrapped at epoch {}. Discarding bootstrap request with epoch {}", sequencerEpoch, bootstrapMsgEpoch ); r.sendResponse(ctx, msg, CorfuMsgType.NACK.msg()); return; } if (!bootstrapWithoutTailsUpdate) { cache.invalidate(); globalLogTail.set(initialToken); cache.updateMaxConflictAddress(initialToken - 1); streamTailToGlobalTailMap.clear(); streamTailToGlobalTailMap.putAll(streamTails); } sequencerEpoch = bootstrapMsgEpoch; serverContext.setSequencerEpoch(bootstrapMsgEpoch); log.info("Sequencer reset with token = {}, size streamTailToGlobalTailMap = {}, sequencerEpoch = {}", globalLogTail.get(), streamTailToGlobalTailMap.size(), streamTailToGlobalTailMap, sequencerEpoch); r.sendResponse(ctx, msg, CorfuMsgType.ACK.msg()); }

Target:
public synchronized void resetServer(CorfuPayloadMsg<SequencerTailsRecoveryMsg> msg, ChannelHandlerContext ctx, IServerRouter r) { final long initialToken = msg.getPayload().getGlobalTail(); final Map<UUID, Long> streamTails = msg.getPayload().getStreamTails(); final long bootstrapMsgEpoch = msg.getPayload().getSequencerEpoch(); final boolean bootstrapWithoutTailsUpdate = msg.getPayload() .getBootstrapWithoutTailsUpdate(); if (bootstrapWithoutTailsUpdate && (sequencerEpoch == Layout.INVALID_EPOCH || bootstrapMsgEpoch != sequencerEpoch + 1)) { log.warn("Cannot update existing sequencer. Require full bootstrap. SequencerEpoch : {}, MsgEpoch : {}", sequencerEpoch, bootstrapMsgEpoch ); r.sendResponse(ctx, msg, CorfuMsgType.NACK.msg()); return; } if (serverContext.getSequencerEpoch() >= bootstrapMsgEpoch) { log.info("Sequencer already bootstrapped at epoch {}. Discarding bootstrap request with epoch {}", sequencerEpoch, bootstrapMsgEpoch ); r.sendResponse(ctx, msg, CorfuMsgType.NACK.msg()); return; } if (!bootstrapWithoutTailsUpdate) { cache.invalidateAll(); globalLogTail.set(initialToken); cache.updateMaxConflictAddress(initialToken - 1); streamTailToGlobalTailMap.clear(); streamTailToGlobalTailMap.putAll(streamTails); } sequencerEpoch = bootstrapMsgEpoch; serverContext.setSequencerEpoch(bootstrapMsgEpoch); log.info("Sequencer reset with token = {}, size streamTailToGlobalTailMap = {}, sequencerEpoch = {}", globalLogTail.get(), streamTailToGlobalTailMap.size(), streamTailToGlobalTailMap, sequencerEpoch); r.sendResponse(ctx, msg, CorfuMsgType.ACK.msg()); }
Source:
void reportMultipleCallInTree(List<Type> expectedExceptions, Tree treeToVisit, Tree reportLocation, String placeToRefactor) { List<Type> checkedTypes = expectedExceptions.stream() .filter(AbstractOneExpectedExceptionRule::isChecked) .collect(Collectors.toList()); if (checkedTypes.isEmpty()) { return; } MethodInvocationCollector visitor = new MethodInvocationCollector(symbol -> throwExpectedException(symbol, checkedTypes)); treeToVisit.accept(visitor); List<Tree> invocationTree = visitor.invocationTree; if (invocationTree.size() > 1) { reportIssue(reportLocation, String.format("Refactor the %s in order to have only one invocation throwing an expected exception.", placeToRefactor), secondaryLocations(invocationTree), null); } }

Target:
void reportMultipleCallInTree(List<Type> expectedExceptions, Tree treeToVisit, Tree reportLocation, String placeToRefactor) { List<Type> checkedTypes = expectedExceptions.stream() .filter(AbstractOneExpectedExceptionRule::isChecked) .collect(Collectors.toList()); if (checkedTypes.isEmpty()) { return; } MethodInvocationCollector visitor = new MethodInvocationCollector(symbol -> throwExpectedException(symbol, checkedTypes)); treeToVisit.accept(visitor); List<Tree> invocationTree = visitor.invocationTree; if (invocationTree.size() > 1) { reportIssue(reportLocation, String.format("Refactor the %s to have only one invocation throwing an exception.", placeToRefactor), secondaryLocations(invocationTree), null); } }
Source:
public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int position) { switch (viewHolder.getItemViewType()) { case ITEM_NEWS: News news = this.dataset.get(position); NewsViewHolder newsViewHolder = (NewsViewHolder) viewHolder; if (PreferencesUtil.isNewsRead(fragment.getActivity(), news)) { TypedValue dimTitleColor = new TypedValue(); fragment.getActivity().getTheme().resolveAttribute(R.attr.dim_title_color, dimTitleColor, true); newsViewHolder.getTitle().setTextColor(dimTitleColor.data); newsViewHolder.getScore().setTextColor(dimTitleColor.data); } else { TypedValue titleColor = new TypedValue(); fragment.getActivity().getTheme().resolveAttribute(R.attr.title_color, titleColor, true); newsViewHolder.getTitle().setTextColor(titleColor.data); newsViewHolder.getScore().setTextColor(titleColor.data); } newsViewHolder.getTitle().setText(news.getTitle()); newsViewHolder.getSubmitter().setText(news.getBy()); newsViewHolder.getDate().setText(this.dateFormatter.timeAgo(news.getTime())); newsViewHolder.getScore().setText(Integer.toString(news.getScore())); if (news.getUrl() != null && !news.getUrl().isEmpty()) { newsViewHolder.getUrl().setText(Util.getDomainName(news.getUrl())); } else { newsViewHolder.getUrl().setText(""); } Resources r = this.fragment.getActivity().getResources(); int nComment = news.getTotalComments(); String commentCountFormat = r.getQuantityString(R.plurals.comments, nComment, nComment); newsViewHolder.getCommentCount().setText(commentCountFormat); break; case ITEM_LOADING: break; } }

Target:
public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int position) { switch (viewHolder.getItemViewType()) { case ITEM_NEWS: News news = this.dataset.get(position); NewsViewHolder newsViewHolder = (NewsViewHolder) viewHolder; TypedValue titleColor = new TypedValue(); if (PreferencesUtil.isNewsRead(fragment.getActivity(), news)) { fragment.getActivity().getTheme().resolveAttribute(R.attr.dim_title_color, titleColor, true); } else { fragment.getActivity().getTheme().resolveAttribute(R.attr.title_color, titleColor, true); } newsViewHolder.getTitle().setTextColor(titleColor.data); newsViewHolder.getScore().setTextColor(titleColor.data); newsViewHolder.getTitle().setText(news.getTitle()); newsViewHolder.getSubmitter().setText(news.getBy()); newsViewHolder.getDate().setText(this.dateFormatter.timeAgo(news.getTime())); newsViewHolder.getScore().setText(Integer.toString(news.getScore())); if (news.getUrl() != null && !news.getUrl().isEmpty()) { newsViewHolder.getUrl().setText(Util.getDomainName(news.getUrl())); } else { newsViewHolder.getUrl().setText(""); } Resources r = this.fragment.getActivity().getResources(); int nComment = news.getTotalComments(); String commentCountFormat = r.getQuantityString(R.plurals.comments, nComment, nComment); newsViewHolder.getCommentCount().setText(commentCountFormat); break; case ITEM_LOADING: break; } }
Source:
protected void rollbackStreamUnsafe(ISMRStream stream, long rollbackVersion) { if (stream.pos() <= rollbackVersion) { return; } boolean isHole = false; List<SMREntry> entries = null; try { entries = stream.current(); } catch (HoleInStreamException ex) { isHole = true; } while (isHole || !entries.isEmpty()) { if (!isHole) { if (entries.stream().allMatch(SMREntry::isUndoable)) { ListIterator<SMREntry> it = entries.listIterator(entries.size()); while (it.hasPrevious()) { applyUndoRecordUnsafe(it.previous(), stream); } } else { Optional<SMREntry> entry = entries.stream().findFirst(); if (log.isTraceEnabled()) { log.trace("rollbackStreamUnsafe: one or more stream entries in address @{} are not undoable. " + "Undoable entries: {}/{}", stream.pos(), (int) entries.stream().filter(SMREntry::isUndoable).count(), entries.size()); } throw new NoRollbackException(entry, stream.pos(), rollbackVersion); } } isHole = false; try { entries = stream.previous(); } catch (HoleInStreamException ex) { isHole = true; } if (stream.pos() <= rollbackVersion) { return; } } throw new NoRollbackException(stream.pos(), rollbackVersion); }

Target:
protected void rollbackStreamUnsafe(ISMRStream stream, long rollbackVersion) { if (stream.pos() <= rollbackVersion) { return; } List<SMREntry> entries = stream.current(); while (stream.pos() > rollbackVersion) { if (Address.nonAddress(stream.pos())) { throw new NoRollbackException(stream.pos(), rollbackVersion); } if (entries.stream().allMatch(SMREntry::isUndoable)) { ListIterator<SMREntry> it = entries.listIterator(entries.size()); while (it.hasPrevious()) { applyUndoRecordUnsafe(it.previous(), stream); } } else { Optional<SMREntry> entry = entries.stream().findFirst(); if (log.isTraceEnabled()) { log.trace("rollbackStreamUnsafe: one or more stream entries in address @{} are not undoable. " + "Undoable entries: {}/{}", stream.pos(), (int) entries.stream().filter(SMREntry::isUndoable).count(), entries.size()); } throw new NoRollbackException(entry, stream.pos(), rollbackVersion); } entries = stream.previous(); } }
Source:
public boolean checkMinimumFieldsFilled(Map fieldValues) { final String principalName = (String) fieldValues.get(KIMPropertyConstants.Person.PRINCIPAL_NAME); if (StringUtils.isBlank((String) fieldValues.get(KFSPropertyConstants.VENDOR_NUMBER)) && StringUtils.isBlank((String) fieldValues.get(KIMPropertyConstants.Person.EMPLOYEE_ID)) && StringUtils.isBlank((String) fieldValues.get(KIMPropertyConstants.Person.FIRST_NAME)) && StringUtils.isBlank((String) fieldValues.get(KIMPropertyConstants.Person.LAST_NAME)) && StringUtils.isBlank((String) fieldValues.get(KFSPropertyConstants.VENDOR_NAME)) && StringUtils.isBlank(principalName)) { final String vendorNumberLabel = this.getAttributeLabel(KFSPropertyConstants.VENDOR_NUMBER); final String vendorNameLabel = this.getAttributeLabel(KFSPropertyConstants.VENDOR_NAME); final String firstNameLabel = this.getAttributeLabel(KIMPropertyConstants.Person.FIRST_NAME); final String lastNameLabel = this.getAttributeLabel(KIMPropertyConstants.Person.LAST_NAME); final String employeeIdLabel = this.getAttributeLabel(KIMPropertyConstants.Person.EMPLOYEE_ID); final String principalNameLabel = this.getAttributeLabel(KIMPropertyConstants.Person.PRINCIPAL_NAME); GlobalVariables.getMessageMap().putError(KFSPropertyConstants.VENDOR_NUMBER, KFSKeyConstants.ERROR_DV_LOOKUP_NEEDS_SOME_FIELD, vendorNumberLabel, employeeIdLabel, vendorNameLabel, firstNameLabel, lastNameLabel); return false; } return true; }

Target:
public boolean checkMinimumFieldsFilled(Map fieldValues) { final String principalName = (String) fieldValues.get(KIMPropertyConstants.Person.PRINCIPAL_NAME); if (StringUtils.isBlank((String) fieldValues.get(KFSPropertyConstants.VENDOR_NUMBER)) && StringUtils.isBlank((String) fieldValues.get(KIMPropertyConstants.Person.EMPLOYEE_ID)) && StringUtils.isBlank((String) fieldValues.get(KIMPropertyConstants.Person.FIRST_NAME)) && StringUtils.isBlank((String) fieldValues.get(KIMPropertyConstants.Person.LAST_NAME)) && StringUtils.isBlank((String) fieldValues.get(KFSPropertyConstants.VENDOR_NAME)) && StringUtils.isBlank(principalName)) { final String vendorNumberLabel = this.getAttributeLabel(KFSPropertyConstants.VENDOR_NUMBER); final String vendorNameLabel = this.getAttributeLabel(KFSPropertyConstants.VENDOR_NAME); final String firstNameLabel = this.getAttributeLabel(KIMPropertyConstants.Person.FIRST_NAME); final String lastNameLabel = this.getAttributeLabel(KIMPropertyConstants.Person.LAST_NAME); final String employeeIdLabel = this.getAttributeLabel(KIMPropertyConstants.Person.EMPLOYEE_ID); final String principalNameLabel = this.getAttributeLabel(KIMPropertyConstants.Person.PRINCIPAL_NAME); GlobalVariables.getMessageMap().putError(KFSPropertyConstants.VENDOR_NUMBER, KFSKeyConstants.ERROR_DV_LOOKUP_NEEDS_SOME_FIELD, vendorNumberLabel, employeeIdLabel, vendorNameLabel, firstNameLabel, lastNameLabel, principalNameLabel); return false; } return true; }
Source:
protected boolean isDataStall() { boolean result = false; if (!mNetworkCapabilities.hasCapability(NET_CAPABILITY_NOT_METERED) && (SystemClock.elapsedRealtime() - getLastProbeTime() < mDataStallMinEvaluateTime)) { return false; } if (dataStallEvaluateTypeEnabled(DATA_STALL_EVALUATION_TYPE_DNS)) { if (mDnsStallDetector.isDataStallSuspected(mConsecutiveDnsTimeoutThreshold, mDataStallValidDnsTimeThreshold)) { result = true; logNetworkEvent(NetworkEvent.NETWORK_CONSECUTIVE_DNS_TIMEOUT_FOUND); } } if (!result && dataStallEvaluateTypeEnabled(DATA_STALL_EVALUATION_TYPE_TCP)) { if (getTcpSocketTracker().isDataStallSuspected()) { result = true; } } if (VDBG_STALL) { log("isDataStall: result=" + result + ", consecutive dns timeout count=" + mDnsStallDetector.getConsecutiveTimeoutCount()); } return result; }

Target:
protected boolean isDataStall() { boolean result = false; if (!mNetworkCapabilities.hasCapability(NET_CAPABILITY_NOT_METERED) && (SystemClock.elapsedRealtime() - getLastProbeTime() < mDataStallMinEvaluateTime)) { return false; } if (dataStallEvaluateTypeEnabled(DATA_STALL_EVALUATION_TYPE_DNS)) { if (mDnsStallDetector.isDataStallSuspected(mConsecutiveDnsTimeoutThreshold, mDataStallValidDnsTimeThreshold)) { result = true; logNetworkEvent(NetworkEvent.NETWORK_CONSECUTIVE_DNS_TIMEOUT_FOUND); } } if (dataStallEvaluateTypeEnabled(DATA_STALL_EVALUATION_TYPE_TCP)) { if (getTcpSocketTracker().getSentSinceLastRecv() > 0) { result = false; } else if (getTcpSocketTracker().isDataStallSuspected()) { result = true; } } if (VDBG_STALL) { log("isDataStall: result=" + result + ", consecutive dns timeout count=" + mDnsStallDetector.getConsecutiveTimeoutCount() + ", tcp packets received=" + getTcpSocketTracker().getSentSinceLastRecv() + ", tcp fail rate=" + getTcpSocketTracker().getLatestPacketFailRate()); } return result; }
Source:
public String getDescription() { return "Migrates pom.xml files to format required in 7.7.x and later (community)"; }

Target:
public String getDescription() { return "Migrates pom.xml files to format compatible with KIE Maven build."; }
Source:
public static List<Object> map(Package pack) { List<Object> row = Lists.newArrayList(); for (Entry<String, String> entry : PACKAGE_ATTRS.entrySet()) { switch (entry.getKey()) { case EMX_PACKAGE_TAGS: row.add(Streams.stream(pack.getTags()).map(Tag::getId).collect(joining(","))); break; case EMX_PACKAGE_PARENT: Package parent = pack.getParent(); row.add(parent != null ? parent.getId() : ""); break; default: Object value = pack.get(entry.getValue()); row.add(value != null ? value.toString() : ""); } } return row; }

Target:
public static List<Object> map(Package pack) { List<Object> row = new ArrayList<>(PACKAGE_ATTRS.size()); for (Entry<String, String> entry : PACKAGE_ATTRS.entrySet()) { switch (entry.getKey()) { case EMX_PACKAGE_TAGS: row.add(Streams.stream(pack.getTags()).map(Tag::getId).collect(joining(","))); break; case EMX_PACKAGE_PARENT: Package parent = pack.getParent(); row.add(parent != null ? parent.getId() : null); break; default: Object value = pack.get(entry.getValue()); row.add(value != null ? value.toString() : null); } } return row; }
Source:
public void writeEvent(ByteBuffer data) { int timeId = eventTimestamp&((1<<28)-1); timeId |= eventId << 27; data.putInt(timeId); data.putInt(eventContent); }

Target:
public void writeEvent(ByteBuffer data) { int timeId = eventTimestamp << 5; timeId |= eventId & 0x1f; data.putInt(timeId); long ip = 0x0000facedecafe00L + ((data.position() / getSize()) & 0x0F); data.putLong(ip); data.putInt(eventContent); }
Source:
public void visitToken(DetailAST token) { switch (token.getType()) { case TokenTypes.LITERAL_THROW: if (!isValidScope(token)) { return; } log(token, String.format("Directly throwing an exception is disallowed. Replace the throw statement with" + " a call to ''%s''.", LOGGER_LOG_AND_THROW)); break; case TokenTypes.METHOD_CALL: String methodCall = FullIdent.createFullIdent(token.findFirstToken(TokenTypes.DOT)).getText(); if (!LOGGER_LOG_AND_THROW.equals(methodCall)) { return; } if (!isValidScope(token)) { return; } DetailAST exprToken = token.getParent(); if (exprToken.getNextSibling() == null || exprToken.getNextSibling().getNextSibling() == null || exprToken.getNextSibling().getNextSibling().getType() != TokenTypes.LITERAL_RETURN) { log(token, String.format("Always call ''return'' after calling ''%s''.", LOGGER_LOG_AND_THROW)); } break; default: break; } }

Target:
public void visitToken(DetailAST token) { switch (token.getType()) { case TokenTypes.CLASS_DEF: DetailAST modifiersToken = token.findFirstToken(TokenTypes.MODIFIERS); classStaticDeque.addLast(modifiersToken.branchContains(TokenTypes.LITERAL_STATIC)); break; case TokenTypes.CTOR_DEF: isInConstructor = true; break; case TokenTypes.METHOD_DEF: DetailAST methodModifiersToken = token.findFirstToken(TokenTypes.MODIFIERS); methodStaticDeque.addLast(methodModifiersToken.branchContains(TokenTypes.LITERAL_STATIC)); break; case TokenTypes.LITERAL_THROW: if (classStaticDeque.isEmpty() || classStaticDeque.peekLast() || isInConstructor || methodStaticDeque.isEmpty() || methodStaticDeque.peekLast()) { return; } DetailAST methodCallToken = token.findFirstToken(TokenTypes.EXPR).findFirstToken(TokenTypes.METHOD_CALL); if (methodCallToken == null) { log(token, String.format(THROW_LOGGER_EXCEPTION_MESSAGE, LOGGER_LOG_EXCEPTION_AS_ERROR, LOGGER_LOG_EXCEPTION_AS_WARNING)); return; } String methodCallName = FullIdent.createFullIdent(methodCallToken.findFirstToken(TokenTypes.DOT)).getText(); if (!LOGGER_LOG_EXCEPTION_AS_ERROR.equals(methodCallName) && !LOGGER_LOG_EXCEPTION_AS_WARNING.equals(methodCallName)) { log(token, String.format(THROW_LOGGER_EXCEPTION_MESSAGE, LOGGER_LOG_EXCEPTION_AS_ERROR, LOGGER_LOG_EXCEPTION_AS_WARNING)); } break; default: break; } }
Source:
public void onPost(String triggeredByUser) { onPost(SCMEvent.originOf(Stapler.getCurrentRequest()), triggeredByUser); }

Target:
public void onPost(String triggeredByUser) { onPost(GitHubTriggerEvent.create() .withOrigin(SCMEvent.originOf(Stapler.getCurrentRequest())) .withTriggeredByUser(triggeredByUser) .build() ); }
Source:
private String stateToString(State state) { String value; if (state instanceof DecimalType) { value = ((DecimalType) state).toBigDecimal().toString(); } else if (state instanceof PercentType) { value = ((PercentType) state).toBigDecimal().toString(); } else if (state instanceof OnOffType) { value = ((OnOffType) state) == OnOffType.ON ? DIGITAL_VALUE_ON : DIGITAL_VALUE_OFF; } else if (state instanceof OpenClosedType) { value = ((OpenClosedType) state) == OpenClosedType.OPEN ? DIGITAL_VALUE_OPEN : DIGITAL_VALUE_CLOSED; } else if (state instanceof HSBType) { value = ((HSBType) state).getConstituents().toString(); } else if (state instanceof DateTimeType) { value = String.valueOf(((DateTimeType) state).getCalendar().getTime().getTime()); } else if (state instanceof PointType) { value = ((PointType) state).getConstituents().toString(); } else { value = state.toString(); } return value; }

Target:
private String stateToString(State state) { String value; if (state instanceof DecimalType) { value = ((DecimalType) state).toBigDecimal().toString(); } else if (state instanceof OnOffType) { value = ((OnOffType) state) == OnOffType.ON ? DIGITAL_VALUE_ON : DIGITAL_VALUE_OFF; } else if (state instanceof OpenClosedType) { value = ((OpenClosedType) state) == OpenClosedType.OPEN ? DIGITAL_VALUE_ON : DIGITAL_VALUE_OFF; } else if (state instanceof HSBType) { value = ((HSBType) state).toString(); } else if (state instanceof DateTimeType) { value = ((DateTimeType) state).toString(); } else { value = state.toString(); } return value; }
Source:
public Page<CommunityRest> getSubcommunities(@Nullable HttpServletRequest request, UUID communityId, @Nullable Pageable optionalPageable, Projection projection) { try { Context context = obtainContext(); Community community = communityService.find(context, communityId); if (community == null) { throw new ResourceNotFoundException("No such community: " + communityId); } Pageable pageable = utils.getPageable(optionalPageable); List<Community> publicSubcommunities = new LinkedList<Community>(); IndexObjectFactoryFactory indexObjectFactory = IndexObjectFactoryFactory.getInstance(); IndexableObject scopeObject = indexObjectFactory.getIndexableObjects(context, community).get(0); DiscoverQuery discoverQuery = new DiscoverQuery(); discoverQuery.setQuery("*:*"); discoverQuery.setDSpaceObjectFilter(IndexableCommunity.TYPE); discoverQuery.setStart(Math.toIntExact(pageable.getOffset())); discoverQuery.setMaxResults(pageable.getPageSize()); DiscoverResult resp = searchService.search(context, scopeObject, discoverQuery); long tot = resp.getTotalSearchResults(); for (IndexableObject solrCommunities : resp.getIndexableObjects()) { Community c = ((IndexableCommunity) solrCommunities).getIndexedObject(); publicSubcommunities.add(c); } return converter.toRestPage(publicSubcommunities, pageable, tot, utils.obtainProjection()); } catch (SQLException | SearchServiceException e) { throw new RuntimeException(e.getMessage(), e); } }

Target:
public Page<CommunityRest> getSubcommunities(@Nullable HttpServletRequest request, UUID communityId, @Nullable Pageable optionalPageable, Projection projection) { try { Context context = obtainContext(); Community community = communityService.find(context, communityId); if (community == null) { throw new ResourceNotFoundException("No such community: " + communityId); } Pageable pageable = utils.getPageable(optionalPageable); List<Community> publicSubcommunities = new LinkedList<Community>(); IndexObjectFactoryFactory indexObjectFactory = IndexObjectFactoryFactory.getInstance(); IndexableObject scopeObject = indexObjectFactory.getIndexableObjects(context, community).get(0); DiscoverQuery discoverQuery = new DiscoverQuery(); discoverQuery.setQuery("*:*"); discoverQuery.setDSpaceObjectFilter(IndexableCommunity.TYPE); discoverQuery.addFilterQueries("location.parent:" + communityId); discoverQuery.setStart(Math.toIntExact(pageable.getOffset())); discoverQuery.setMaxResults(pageable.getPageSize()); DiscoverResult resp = searchService.search(context, scopeObject, discoverQuery); long tot = resp.getTotalSearchResults(); for (IndexableObject solrCommunities : resp.getIndexableObjects()) { Community c = ((IndexableCommunity) solrCommunities).getIndexedObject(); publicSubcommunities.add(c); } return converter.toRestPage(publicSubcommunities, pageable, tot, utils.obtainProjection()); } catch (SQLException | SearchServiceException e) { throw new RuntimeException(e.getMessage(), e); } }
Source:
public List<Update> parse(final UpdateContext updateContext, final List<ContentWithCredentials> contentWithCredentials) { final List<Paragraph> paragraphs = Lists.newArrayList(); for (final ContentWithCredentials next : contentWithCredentials) { paragraphs.addAll(createParagraphs(next, updateContext)); } final List<Update> updates = Lists.newArrayList(); for (final Paragraph paragraph : paragraphs) { String content = paragraph.getContent(); Operation operation = Operation.UNSPECIFIED; List<String> deleteReasons = Lists.newArrayList(); final Matcher matcher = DELETE_PATTERN.matcher(content); while (matcher.find()) { operation = Operation.DELETE; deleteReasons.add(matcher.group(1).trim()); } if (operation == Operation.DELETE) { content = matcher.reset().replaceAll(""); } try { if (content.length() > MAXIMUM_OBJECT_SIZE) { updateContext.ignore(paragraph); updateContext.addGlobalMessage(UpdateMessages.maximumObjectSizeExceeded(content.length(), MAXIMUM_OBJECT_SIZE)); } else { updates.add(createUpdate(paragraph, operation, deleteReasons, content, updateContext)); } } catch (IllegalArgumentException e) { updateContext.ignore(paragraph); } } return updates; }

Target:
public List<Update> parse(final UpdateContext updateContext, final List<ContentWithCredentials> contentWithCredentials) { final List<Paragraph> paragraphs = Lists.newArrayList(); for (final ContentWithCredentials next : contentWithCredentials) { paragraphs.addAll(createParagraphs(next, updateContext)); } final List<Update> updates = Lists.newArrayList(); for (final Paragraph paragraph : paragraphs) { String content = paragraph.getContent(); Operation operation = Operation.UNSPECIFIED; List<String> deleteReasons = Lists.newArrayList(); final Matcher matcher = DELETE_PATTERN.matcher(content); while (matcher.find()) { operation = Operation.DELETE; deleteReasons.add(matcher.group(1).trim()); } if (operation == Operation.DELETE) { content = matcher.reset().replaceAll(""); } if (content.length() > maximumObjectSize) { updateContext.ignore(paragraph); updateContext.addGlobalMessage(UpdateMessages.maximumObjectSizeExceeded(content.length(), maximumObjectSize)); continue; } try { updates.add(createUpdate(paragraph, operation, deleteReasons, content, updateContext)); } catch (IllegalArgumentException e) { updateContext.ignore(paragraph); } } return updates; }
Source:
public AbstractServo(String n, String id) { super(n, id); subscribeToRuntime("registered"); targetPos = rest; if (encoder == null) { encoder = new TimeEncoder(this); Double savedPos = encoder.getPos(); if (savedPos != null) { log.info("found previous values for setting initial position to {}", getName(), savedPos); currentOutputPos = targetPos = savedPos; } } currentOutputPos = mapper.calcOutput(targetPos); autoDisable = autoDisableDefault; }

Target:
public AbstractServo(String n, String id) { super(n, id); subscribeToRuntime("registered"); targetPos = rest; if (encoder == null) { encoder = new TimeEncoder(this); Double savedPos = encoder.getPos(); if (savedPos != null) { log.info("found previous values for setting initial position to {}", getName(), savedPos); currentOutputPos = targetPos = savedPos; } } currentOutputPos = mapper.calcOutput(targetPos); }
Source:
public ChatPrefs() { timeFormat = new SimpleObjectProperty<>(TimeInfo.AUTO); maxMessages = new SimpleIntegerProperty(500); zoom = new SimpleDoubleProperty(1); learnedAutoComplete = new SimpleBooleanProperty(false); previewImageUrls = new SimpleBooleanProperty(true); hideFoeMessages = new SimpleBooleanProperty(true); channelTabScrollPaneWidth = new SimpleIntegerProperty(250); userToColor = new SimpleMapProperty<>(FXCollections.observableHashMap()); chatColorMode = new SimpleObjectProperty<>(CUSTOM); idleThreshold = new SimpleIntegerProperty(10); chatFormat = new SimpleObjectProperty<>(ChatFormat.COMPACT); autoJoinChannels = new SimpleListProperty<>(FXCollections.observableArrayList()); String localeLanguage = Locale.getDefault().getLanguage(); Optional<OfficialLanguageChannel> languageChannel = OfficialLanguageChannel.getChannelName(localeLanguage); languageChannel.ifPresent(channel -> autoJoinChannels.get().add(channel.getChannelName())); }

Target:
public ChatPrefs() { timeFormat = new SimpleObjectProperty<>(TimeInfo.AUTO); maxMessages = new SimpleIntegerProperty(500); zoom = new SimpleDoubleProperty(1); learnedAutoComplete = new SimpleBooleanProperty(false); previewImageUrls = new SimpleBooleanProperty(true); hideFoeMessages = new SimpleBooleanProperty(true); channelTabScrollPaneWidth = new SimpleIntegerProperty(250); userToColor = new SimpleMapProperty<>(FXCollections.observableHashMap()); chatColorMode = new SimpleObjectProperty<>(CUSTOM); idleThreshold = new SimpleIntegerProperty(10); chatFormat = new SimpleObjectProperty<>(ChatFormat.COMPACT); autoJoinChannels = new SimpleListProperty<>(FXCollections.observableArrayList()); Locale localeLanguage = new Locale(Locale.getDefault().getLanguage()); Optional.ofNullable(LOCALE_LANGUAGES_TO_CHANNELS.get(localeLanguage)) .ifPresent(channel -> autoJoinChannels.get().add(channel.getChannelName())); }
Source:
void testNoDataFieldsSucceeds() { Compilation compilation = helper.compile(Inputs.NO_DATAFIELDS.get()); assertDefaultsPresent(compilation); }

Target:
void testNoDataFieldsSucceeds() { Compilation compilation = helper.compile(Inputs.NO_DATAFIELDS.get()); assertThat(compilation).succeededWithoutWarnings(); assertDefaultsPresent(compilation); }
Source:
public QueryEngine buildQueryEngine(EntityManagerFactory entityManagerFactory, ObjectProvider<ElideDynamicEntityCompiler> dynamicCompiler, ElideConfigProperties settings) throws ClassNotFoundException { MetaDataStore metaDataStore = new MetaDataStore(); if (settings.getDynamicConfig().isEnabled()) { ElideDynamicEntityCompiler compiler = dynamicCompiler.getIfAvailable(); Set<Class<?>> annotatedClass = findAnnotatedClasses(compiler, FromTable.class); annotatedClass.addAll(findAnnotatedClasses(compiler, FromSubquery.class)); metaDataStore.populateEntityDictionary(annotatedClass); } return new SQLQueryEngine(metaDataStore, entityManagerFactory); }

Target:
public QueryEngine buildQueryEngine(EntityManagerFactory entityManagerFactory, ObjectProvider<ElideDynamicEntityCompiler> dynamicCompiler, ElideConfigProperties settings) throws ClassNotFoundException { MetaDataStore metaDataStore = null; if (settings.getDynamicConfig().isEnabled()) { metaDataStore = new MetaDataStore(dynamicCompiler.getIfAvailable()); } else { metaDataStore = new MetaDataStore(); } return new SQLQueryEngine(metaDataStore, entityManagerFactory, null); }
Source:
private boolean processBasicMetadata( Node sequencedNode, Binary binaryValue ) throws RepositoryException { EpubMetadata metadata = null; try (InputStream stream = binaryValue.getStream()) { metadata = new EpubMetadata(stream); if (metadata.check()) { addEpubMetadataProperties(sequencedNode, EpubMetadataLexicon.TITLE, metadata.getTitle()); addEpubMetadataProperties(sequencedNode, EpubMetadataLexicon.CREATOR, metadata.getCreator()); addEpubMetadataProperties(sequencedNode, EpubMetadataLexicon.CONTRIBUTOR, metadata.getContributor()); addEpubMetadataProperties(sequencedNode, EpubMetadataLexicon.LANGUAGE, metadata.getLanguage()); addEpubMetadataProperties(sequencedNode, EpubMetadataLexicon.IDENTIFIER, metadata.getIdentifier()); addEpubMetadataProperties(sequencedNode, EpubMetadataLexicon.DESCRIPTION, metadata.getDescription()); addEpubMetadataProperties(sequencedNode, EpubMetadataLexicon.PUBLISHER, metadata.getPublisher()); addEpubMetadataProperties(sequencedNode, EpubMetadataLexicon.DATE, metadata.getDate()); addEpubMetadataProperties(sequencedNode, EpubMetadataLexicon.RIGHTS, metadata.getRights()); return true; } } catch (Exception e) { getLogger().debug(e, "Couldn't process stream."); } return false; }

Target:
private boolean processBasicMetadata( Node sequencedNode, Binary binaryValue ) throws RepositoryException { EpubMetadata metadata = null; try (InputStream stream = binaryValue.getStream()) { metadata = new EpubMetadata(stream); if (metadata.check()) { addEpubMetadataProperties(sequencedNode, EpubMetadataLexicon.TITLE, metadata.getTitle()); addEpubMetadataProperties(sequencedNode, EpubMetadataLexicon.CREATOR, metadata.getCreator()); addEpubMetadataProperties(sequencedNode, EpubMetadataLexicon.CONTRIBUTOR, metadata.getContributor()); addEpubMetadataProperties(sequencedNode, EpubMetadataLexicon.LANGUAGE, metadata.getLanguage()); addEpubMetadataProperties(sequencedNode, EpubMetadataLexicon.IDENTIFIER, metadata.getIdentifier()); addEpubMetadataProperties(sequencedNode, EpubMetadataLexicon.DESCRIPTION, metadata.getDescription()); addEpubMetadataProperties(sequencedNode, EpubMetadataLexicon.PUBLISHER, metadata.getPublisher()); addEpubMetadataProperties(sequencedNode, EpubMetadataLexicon.DATE, metadata.getDate()); addEpubMetadataProperties(sequencedNode, EpubMetadataLexicon.RIGHTS, metadata.getRights()); return true; } } catch (Exception e) { getLogger().error(e, "Couldn't process stream."); } return false; }
Source:
private String getZeppelinHome() throws IOException { String zeppelinHome = ""; if (System.getenv("ZEPPELIN_HOME") != null) { zeppelinHome = System.getenv("ZEPPELIN_HOME"); } if (StringUtils.isBlank(zeppelinHome)) { zeppelinHome = zconf.getString(ZeppelinConfiguration.ConfVars.ZEPPELIN_HOME); } if (StringUtils.isBlank(zeppelinHome)) { zeppelinHome = getClassPath(DockerInterpreterProcess.class); zeppelinHome = zeppelinHome.replace("/plugins/Launcher/DockerInterpreterLauncher", ""); } File fileZeppelinHome = new File(zeppelinHome); if (fileZeppelinHome.exists() && fileZeppelinHome.isDirectory()) { return zeppelinHome; } throw new IOException("Can't find zeppelin home path!"); }

Target:
private String getZeppelinHome() throws IOException { String zeppelinHome = zconf.getZeppelinHome(); if (System.getenv("ZEPPELIN_HOME") != null) { zeppelinHome = System.getenv("ZEPPELIN_HOME"); } File fileZeppelinHome = new File(zeppelinHome); if (fileZeppelinHome.exists() && fileZeppelinHome.isDirectory()) { return zeppelinHome; } throw new IOException("Can't find zeppelin home path!"); }
Source:
protected CompletableFuture<ClientCoordinationResponseBody> handleRequest( @Nonnull HandlerRequest<ClientCoordinationRequestBody, ClientCoordinationMessageParameters> request, @Nonnull RestfulGateway gateway) throws RestHandlerException { JobID jobId = request.getPathParameter(JobIDPathParameter.class); OperatorID operatorId = request.getPathParameter(OperatorIDPathParameter.class); SerializedValue<CoordinationRequest> serializedRequest = request.getRequestBody().getSerializedCoordinationRequest(); CompletableFuture<CoordinationResponse> responseFuture = gateway.deliverCoordinationRequestToCoordinator(jobId, operatorId, serializedRequest, timeout); return responseFuture.thenApply( coordinationResponse -> { try { return new ClientCoordinationResponseBody(new SerializedValue<>(coordinationResponse)); } catch (IOException e) { throw new RuntimeException("Failed to construct response body", e); } }); }

Target:
protected CompletableFuture<ClientCoordinationResponseBody> handleRequest( @Nonnull HandlerRequest<ClientCoordinationRequestBody, ClientCoordinationMessageParameters> request, @Nonnull RestfulGateway gateway) throws RestHandlerException { JobID jobId = request.getPathParameter(JobIDPathParameter.class); OperatorID operatorId = request.getPathParameter(OperatorIDPathParameter.class); SerializedValue<CoordinationRequest> serializedRequest = request.getRequestBody().getSerializedCoordinationRequest(); CompletableFuture<CoordinationResponse> responseFuture = gateway.deliverCoordinationRequestToCoordinator(jobId, operatorId, serializedRequest, timeout); return responseFuture.thenApply( coordinationResponse -> { try { return new ClientCoordinationResponseBody(new SerializedValue<>(coordinationResponse)); } catch (IOException e) { throw new CompletionException( new RestHandlerException( "Failed to serialize coordination response", HttpResponseStatus.INTERNAL_SERVER_ERROR, e)); } }); }
Source:
private static String getHeaderValue(String urlBase, String filter, int page, int perPage, boolean showArchived, long totalRecords, String orderBy, OrderDirection direction) { List<String> links = new ArrayList<>(); links.add(StringUtil.format(LINK_TEMPLATE, map( "URL", getUrl(urlBase, filter, FIRST_PAGE_INDEX, perPage, showArchived, orderBy, direction), "relValue", FIRST_REL_VALUE ))); int lastPage = (int) (Math.ceil((double) totalRecords/perPage)); links.add(StringUtil.format(LINK_TEMPLATE, map( "URL", getUrl(urlBase, filter, lastPage, perPage, showArchived, orderBy, direction), "relValue", LAST_REL_VALUE ))); links.add(StringUtil.format(LINK_TEMPLATE, map( "URL", getUrl(urlBase, filter, -1, perPage, showArchived, orderBy, direction), "relValue", PAGE_REL_VALUE ))); int next = page + 1; if (next <= lastPage){ links.add(StringUtil.format(LINK_TEMPLATE, map( "URL", getUrl(urlBase, filter, next, perPage, showArchived, orderBy, direction), "relValue", NEXT_REL_VALUE ))); } int prev = page - 1; if (prev > 0){ links.add(StringUtil.format(LINK_TEMPLATE, map( "URL", getUrl(urlBase, filter, prev, perPage, showArchived, orderBy, direction), "relValue", PREV_REL_VALUE ))); } return String.join(",", links); }

Target:
private static String getHeaderValue(String urlBase, String filter, int page, int perPage, boolean showArchived, long totalRecords, String orderBy, OrderDirection direction) { final List<String> links = new ArrayList<>(); links.add(StringUtil.format(LINK_TEMPLATE, map( "URL", getUrl(urlBase, filter, FIRST_PAGE_INDEX, perPage, showArchived, orderBy, direction), "relValue", FIRST_REL_VALUE ))); int lastPage = (int) (Math.ceil((double) totalRecords/perPage)); links.add(StringUtil.format(LINK_TEMPLATE, map( "URL", getUrl(urlBase, filter, lastPage, perPage, showArchived, orderBy, direction), "relValue", LAST_REL_VALUE ))); links.add(StringUtil.format(LINK_TEMPLATE, map( "URL", getUrl(urlBase, filter, -1, perPage, showArchived, orderBy, direction), "relValue", PAGE_REL_VALUE ))); int next = page + 1; if (next <= lastPage){ links.add(StringUtil.format(LINK_TEMPLATE, map( "URL", getUrl(urlBase, filter, next, perPage, showArchived, orderBy, direction), "relValue", NEXT_REL_VALUE ))); } int prev = page - 1; if (prev > 0){ links.add(StringUtil.format(LINK_TEMPLATE, map( "URL", getUrl(urlBase, filter, prev, perPage, showArchived, orderBy, direction), "relValue", PREV_REL_VALUE ))); } return String.join(",", links); }
Source:
private String getLocalised(Map<String, Object> source, String fieldName, String lang) { final Map<String, String> map = (Map<String, String>) source.get(fieldName); if (map == null) return null; if (map.get(lang) != null) { return map.get(lang); } if (!map.containsKey("default")) { return map.get(map.keySet().toArray()[0]); } return map.get("default"); }

Target:
private String getLocalised(Map<String, Object> source, String fieldName, String lang) { final Map<String, String> map = (Map<String, String>) source.get(fieldName); if (map == null) return null; if (map.get(lang) != null) { return map.get(lang); } if (fieldName.equals("name")) { for (String key : NAME_PRECEDENCE) { if (map.containsKey(key)) return map.get(key); } } return map.get("default"); }
Source:
private String formatPrefix(Factory formatFactory, ConfigOption<String> formatOption) { String identifier = formatFactory.factoryIdentifier(); if (formatOption.key().equals(FORMAT_KEY) || formatOption.equals(KEY_FORMAT) || formatOption.equals(VALUE_FORMAT)) { return identifier + "."; } else if (formatOption.key().endsWith(FORMAT_SUFFIX)) { String keyPrefix = formatOption.key().substring(0, formatOption.key().length() - FORMAT_SUFFIX.length()); return keyPrefix + "." + identifier + "."; } else { throw new ValidationException( "Format identifier key should be 'format' or suffix with '.format', " + "don't support format identifier key '" + formatOption.key() + "'."); } }

Target:
private String formatPrefix(Factory formatFactory, ConfigOption<String> formatOption) { String identifier = formatFactory.factoryIdentifier(); if (formatOption.key().equals(FORMAT.key())) { return identifier + "."; } else if (formatOption.key().endsWith(FORMAT_SUFFIX)) { String keyPrefix = formatOption.key().substring(0, formatOption.key().length() - FORMAT_SUFFIX.length()); return keyPrefix + "." + identifier + "."; } else { throw new ValidationException( "Format identifier key should be 'format' or suffix with '.format', " + "don't support format identifier key '" + formatOption.key() + "'."); } }
Source:
public int compareTo(Object o) { if (!(o instanceof FileEntry)) throw new ClassCastException(); if (this == o) return 0; FileEntry fe = (FileEntry) o; int diff = size - fe.size; return (diff != 0) ? diff : offset > fe.offset ? 1 : -1; }

Target:
public int compareTo(Object o) { FileEntry fe = (FileEntry) o; if (this == fe) return 0; int diff = size - fe.size; return (diff != 0) ? diff : offset > fe.offset ? 1 : -1; }
Source:
private void checkClosingTag(Element element) { XmlTextRange startLocation = XmlFile.startLocation(element); XmlTextRange endLocation = XmlFile.endLocation(element); if (!isSelfClosing(element) && startLocation.getEndLine() != endLocation.getStartLine()) { if (!needToCheckIndentation(element)) { return; } int startIndent = startIndent(element.getPreviousSibling()); int endIndent = startIndent(element.getLastChild()); if (startIndent != endIndent) { reportIssue(endLocation, startIndent); } } }

Target:
private void checkClosingTag(Element element) { if (isSelfClosing(element)) { return; } XmlTextRange startLocation = XmlFile.startLocation(element); XmlTextRange endLocation = XmlFile.endLocation(element); if (startLocation.getEndLine() != endLocation.getStartLine()) { if (!needToCheckIndentation(element)) { return; } int startIndent = startIndent(element.getPreviousSibling()); int endIndent = startIndent(element.getLastChild()); if (startIndent != endIndent) { reportIssue(endLocation, startIndent); } } }
Source:
public static Location getContextStartLocation(ParserRuleContext ctx) { return new Location(ctx.getStart().getLine(), ctx.getStart().getCharPositionInLine() + 1); }

Target:
Location getContextStartLocation(ParserRuleContext ctx) { return new Location(ctx.getStart().getLine(), ctx.getStart().getCharPositionInLine() + 1); }
Source:
public void processBindingConfiguration(String context, Item item, String bindingConfig) throws BindingConfigParseException { super.processBindingConfiguration(context, item, bindingConfig); TACmiBindingConfig config = new TACmiBindingConfig(); logger.debug("Processing binding configuration: '{}'", bindingConfig); final String[] configParts = bindingConfig.split("#"); switch (configParts.length) { case 3: config.canNode = configParts[0]; config.portType = configParts[1]; config.portNumber = Integer.parseInt(configParts[2]); break; case 4: config.canNode = configParts[0]; config.portType = configParts[1]; config.portNumber = Integer.parseInt(configParts[2]); config.measureType = TACmiMeasureType.fromString(configParts[3]); break; default: throw new BindingConfigParseException( "A TACmi binding configuration must consist of three or four parts - please verify your *.items file"); } config.configurationString = bindingConfig; logger.debug("Adding binding: {}", config); addBindingConfig(item, config); }

Target:
public void processBindingConfiguration(String context, Item item, String bindingConfig) throws BindingConfigParseException { super.processBindingConfiguration(context, item, bindingConfig); TACmiBindingConfig config = new TACmiBindingConfig(); logger.debug("Processing binding configuration: '{}'", bindingConfig); final String[] configParts = bindingConfig.split("#"); switch (configParts.length) { case 3: config.canNode = configParts[0]; config.portType = configParts[1]; config.portNumber = Integer.parseInt(configParts[2]); break; case 4: config.canNode = configParts[0]; config.portType = configParts[1]; config.portNumber = Integer.parseInt(configParts[2]); config.measureType = TACmiMeasureType.fromString(configParts[3]); break; default: throw new BindingConfigParseException( "A TACmi binding configuration must consist of three or four parts - please verify your *.items file"); } config.configurationString = bindingConfig; logger.debug("Adding Binding configuration: {}", config); addBindingConfig(item, config); }
Source:
public DependencyTypesMapper() { jsonDepsReader = new PomJsonReader(getClass().getClassLoader().getResourceAsStream(JSON_POM_DEPS)); mapping = jsonDepsReader.readDeps(); }

Target:
public DependencyTypesMapper() { PomJsonReaderDefault jsonDepsReader = new PomJsonReaderDefault(getClass().getClassLoader().getResourceAsStream(JSON_POM_DEPS)); mapping = jsonDepsReader.readDeps(); }
Source:
public boolean isEmpty() { if (restoring.isEmpty() && !restoringByPartition.isEmpty()) { log.error("Assigned stream tasks in an inconsistent state: the set of restoring tasks is empty but the " + "restoring by partitions map contained {}", restoringByPartition); return false; } else { return super.isEmpty() && restoring.isEmpty() && restoringByPartition.isEmpty() && restoredPartitions.isEmpty() && suspended.isEmpty(); } }

Target:
public boolean isEmpty() throws IllegalStateException { if (restoring.isEmpty() && !restoringByPartition.isEmpty()) { log.error("Assigned stream tasks in an inconsistent state: the set of restoring tasks is empty but the " + "restoring by partitions map contained {}", restoringByPartition); throw new IllegalStateException("Found inconsistent state: no tasks restoring but nonempty restoringByPartition"); } else { return super.isEmpty() && restoring.isEmpty() && restoringByPartition.isEmpty() && restoredPartitions.isEmpty() && suspended.isEmpty(); } }
Source:
public okhttp3.Request authenticate(Route route, okhttp3.Response response) throws IOException { this.userSessionInfoProvider.removeSession(userSession); this.userSession = null; if (tryCount >= MAX_TRIES) { LOG.info("Maximum retries reached"); this.tryCount = 0; return null; } tryCount++; try { userSession = userSessionInfoProvider.retrieveSession(signIn); } catch (ConsentRequiredException e) { LOG.debug("Ignoring 412 during auto-authentication"); } return addBridgeHeaders(response.request()); }

Target:
public okhttp3.Request authenticate(Route route, okhttp3.Response response) throws IOException { this.userSessionInfoProvider.removeSession(userSession); this.userSession = null; if (tryCount >= MAX_TRIES) { LOG.info("Maximum retries reached"); this.tryCount = 0; return null; } tryCount++; userSession = userSessionInfoProvider.retrieveSession(signIn); return addBridgeHeaders(response.request()); }
Source:
public ApplicationStatus status(StreamApplication app) { try { boolean finished = false; boolean unsuccessfulFinish = false; ProcessorGraph processorGraph = getExecutionPlan(app); for (ProcessorNode processor : processorGraph.getProcessorNodes()) { Config processorConfig = processor.generateConfig(); JobRunner runner = new JobRunner(processorConfig); ApplicationStatus status = runner.status(); log.debug("Status is for processor with config {}", new Object[]{status, processor.getId(), processorConfig}); switch (status) { case Running: return ApplicationStatus.Running; case UnsuccessfulFinish: unsuccessfulFinish = true; case SuccessfulFinish: finished = true; break; default: } } if (unsuccessfulFinish) { return ApplicationStatus.UnsuccessfulFinish; } else if (finished) { return ApplicationStatus.SuccessfulFinish; } return ApplicationStatus.New; } catch (Throwable t) { throw new SamzaException("Failed to get status for application", t); } }

Target:
public ApplicationStatus status(StreamApplication app) { try { boolean finished = false; boolean unsuccessfulFinish = false; ProcessorGraph processorGraph = getExecutionPlan(app); for (ProcessorNode processor : processorGraph.getProcessorNodes()) { Config processorConfig = processor.generateConfig(); JobRunner runner = new JobRunner(processorConfig); ApplicationStatus status = runner.status(); log.debug("Status is for processor {}", new Object[]{status, processor.getId()}); switch (status) { case Running: return ApplicationStatus.Running; case UnsuccessfulFinish: unsuccessfulFinish = true; case SuccessfulFinish: finished = true; break; default: } } if (unsuccessfulFinish) { return ApplicationStatus.UnsuccessfulFinish; } else if (finished) { return ApplicationStatus.SuccessfulFinish; } return ApplicationStatus.New; } catch (Throwable t) { throw new SamzaException("Failed to get status for application", t); } }