auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void testAutocreateFailsOnMultipleMatchingOrigins() throws Exception { File repoRootTemp = tempFolder.newFolder(); GitClient gitClientTemp = Git.with(TaskListener.NULL, new EnvVars()).in(repoRootTemp).using(gitImplName).getClient(); gitClientTemp.init(); <START> gitClientTemp.clone_().url("file://" + repoRootTemp.getPath()).execute(); <END> final URIish remote = new URIish(Constants.DEFAULT_REMOTE_NAME); try ( FileRepository repo = new FileRepository(repoRootTemp)) { StoredConfig config = repo.getConfig(); config.setString("remote", "upstream", "url", "file://" + repoRootTemp.getPath()); config.setString("remote", "upstream", "fetch", "+refs/heads/*:refs/remotes/upstream/*"); config.save(); } List<RefSpec> refspecs = Collections.singletonList(new RefSpec( "refs/heads/*:refs/remotes/origin/*")); gitClientTemp.fetch_().from(remote, refspecs).execute(); refspecs = Collections.singletonList(new RefSpec( "refs/heads/*:refs/remotes/upstream/*")); gitClientTemp.fetch_().from(remote, refspecs).execute(); try { gitClientTemp.checkout().ref(Constants.MASTER).execute(); fail("GitException expected"); } catch (GitException e) { } }</code><technical_language>I understand purpose of this command. cloning repoRootTemp repoRootTemp. created a cycle remote origin points itself. I done in test previously, understand either. person wrote test, odd me. check a debugger if original test this rewrite of creating a cycle remote name origin refers git repository created in this test</technical_language>

Target:
public void testAutocreateFailsOnMultipleMatchingOrigins() throws Exception { File repoRootTemp = tempFolder.newFolder(); GitClient gitClientTemp = Git.with(TaskListener.NULL, new EnvVars()).in(repoRootTemp).using(gitImplName).getClient(); gitClientTemp.init(); FilePath gitClientFilePath = gitClientTemp.getWorkTree(); FilePath gitClientTempFile = gitClientFilePath.createTextTempFile("aPre", ".txt", "file contents"); gitClientTemp.add("."); gitClientTemp.commit("Added " + gitClientTempFile.toURI().toString()); gitClient.clone_().url("file://" + repoRootTemp.getPath()).execute(); final URIish remote = new URIish(Constants.DEFAULT_REMOTE_NAME); try ( FileRepository repo = new FileRepository(new File(repoRoot, ".git"))) { StoredConfig config = repo.getConfig(); config.setString("remote", "upstream", "url", "file://" + repoRootTemp.getPath()); config.setString("remote", "upstream", "fetch", "+refs/heads/*:refs/remotes/upstream/*"); config.save(); } List<RefSpec> refspecs = Collections.singletonList(new RefSpec( "refs/heads/*:refs/remotes/origin/*")); gitClient.fetch_().from(remote, refspecs).execute(); refspecs = Collections.singletonList(new RefSpec( "refs/heads/*:refs/remotes/upstream/*")); gitClient.fetch_().from(remote, refspecs).execute(); try { gitClient.checkout().ref(Constants.MASTER).execute(); } catch (GitException e) { Set<String> refNames = gitClient.getRefNames("refs/heads/"); assertFalse("RefNames will not contain master", refNames.contains("refs/heads/master")); } }
Source:
<code><START> public static void eventuallyEquals(String message, long expected, LongSupplier supplier) { <END> eventually(() -> message + " expected:<" + expected + ">, got:<" + supplier.getAsLong() + ">", () -> expected == supplier.getAsLong()); }</code><technical_language>I mixing static non-static methods in class, especially similar names, move a separate class, e.g. Eventually. Or, if want affect core tests, replace TestingUtil AbstractStatisticsTest extending AbstractInfinispanTest</technical_language>

Target:
protected void eventuallyEquals(String message, long expected, LongSupplier supplier) { eventually(() -> message + " expected:<" + expected + ">, got:<" + supplier.getAsLong() + ">", () -> expected == supplier.getAsLong()); }
Source:
<code><START> public CompatibilityModeConfiguration(boolean enabled, Marshaller marshaller) { <END> this.enabled = enabled; this.marshaller = marshaller; }</code><technical_language>If this constructor is called builder, remove public modifier</technical_language>

Target:
CompatibilityModeConfiguration(boolean enabled, Marshaller marshaller) { this.enabled = enabled; this.marshaller = marshaller; }
Source:
<code>public org.eclipse.swt.graphics.Rectangle calculateImageRectangle(List editparts) { org.eclipse.swt.graphics.Rectangle sourceRect = super.calculateImageRectangle(editparts); return new <START> org.eclipse.swt.graphics.Rectangle(sourceRect.x, sourceRect.y, scaleAsInt(sourceRect.width), <END> scaleAsInt(sourceRect.height)); }</code><technical_language>in getDiagramPartInfo x y coordinates scaled here. Is expected</technical_language>

Target:
public org.eclipse.swt.graphics.Rectangle calculateImageRectangle(List editparts) { org.eclipse.swt.graphics.Rectangle sourceRect = super.calculateImageRectangle(editparts); return new org.eclipse.swt.graphics.Rectangle(scaleAsInt(sourceRect.x), scaleAsInt(sourceRect.y), scaleAsInt(sourceRect.width), scaleAsInt(sourceRect.height)); }
Source:
<code>private void logError(EndPoint endPoint, Throwable exception) { <START> logger.debug("[{}] Error querying {}", id, endPoint, exception); <END> if (errors == null) { synchronized (RequestHandler.this) { if (errors == null) { errors = new ConcurrentHashMap<EndPoint, Throwable>(); } } } errors.put(endPoint, exception); }</code><technical_language>I leave this as-is, I want spam debug logs for "normal" server error responses. error is surfaced errors map anyway, if wants inspect it</technical_language>

Target:
private void logError(EndPoint endPoint, Throwable exception) { logger.debug("[{}] Error querying : {}", id, endPoint, exception.toString()); if (errors == null) { synchronized (RequestHandler.this) { if (errors == null) { errors = new ConcurrentHashMap<EndPoint, Throwable>(); } } } errors.put(endPoint, exception); }
Source:
<code>private void startScanTask(long pollingInterval) { status = Status.RUNNING; this.pollingInterval = pollingInterval; timer = new Timer(true); <START> timer.schedule(new ScanTask(this), pollingInterval, pollingInterval); <END> }</code><technical_language>ScanTask is a non-static class, a reference this is necessary pass it</technical_language>

Target:
private void startScanTask(long pollingInterval) { status = Status.RUNNING; this.pollingInterval = pollingInterval; timer = new Timer(true); timer.schedule(new ScanTask(), pollingInterval, pollingInterval); }
Source:
<code>public void start() throws ReplicationException { <START> if (persistor != null) { <END> this.scheduler.scheduleAtFixedRate(persistor, replicationConfig.replicationTokenFlushDelaySeconds, replicationConfig.replicationTokenFlushIntervalSeconds, TimeUnit.SECONDS); } }</code><technical_language>null more</technical_language>

Target:
public void start() throws ReplicationException { virtualReplicatorCluster.addListener(new VirtualReplicatorClusterListener() { @Override public void onPartitionAdded(PartitionId partitionId) { try { addPartition(partitionId); } catch (ReplicationException e) { vcrMetrics.addPartitionErrorCount.inc(); logger.error("Exception on adding partition {}: ", partitionId, e); } catch (Exception e) { vcrMetrics.addPartitionErrorCount.inc(); logger.error("Unknown Exception on adding partition {}: ", partitionId, e); } } @Override public void onPartitionRemoved(PartitionId partitionId) { try { PartitionInfo partitionInfo = partitionToPartitionInfo.remove(partitionId); if (partitionInfo == null) { logger.error("PartitionId not exist when remove from {}: ", partitionId, dataNodeId); vcrMetrics.removePartitionErrorCount.inc(); return; } removeRemoteReplicaInfoFromReplicaThread(partitionInfo.getRemoteReplicaInfos()); if (replicationConfig.replicationPersistTokenOnShutdownOrReplicaRemove) { try { persistor.write(partitionInfo.getLocalReplicaId().getMountPath(), false); } catch (IOException | ReplicationException e) { logger.error("Exception on token write when remove partition {}: ", partitionId, e); vcrMetrics.removePartitionErrorCount.inc(); } } } catch (Exception e) { vcrMetrics.removePartitionErrorCount.inc(); logger.error("Unknown Exception on removing partition {}: ", partitionId, e); } } }); try { virtualReplicatorCluster.participate(InstanceType.PARTICIPANT); } catch (Exception e) { throw new ReplicationException("Cluster participate failed.", e); } scheduler.scheduleAtFixedRate(persistor, replicationConfig.replicationTokenFlushDelaySeconds, replicationConfig.replicationTokenFlushIntervalSeconds, TimeUnit.SECONDS); }
Source:
<code>protected Object transformFromMessage(Message source, String outputEncoding) throws IOException, JMSException { if (logger.isDebugEnabled()) { logger.debug("Message type received is: " + <START> ClassUtils.getSimpleName(source.getClass())); <END> } String jmsSpec = JmsConstants.JMS_SPECIFICATION_102B; if (endpoint != null) { Connector connector = endpoint.getConnector(); if (connector instanceof JmsConnector) { jmsSpec = ((JmsConnector) connector).getSpecification(); } } return JmsMessageUtils.toObject(source, jmsSpec, outputEncoding); }</code><technical_language>static import</technical_language>

Target:
protected Object transformFromMessage(Message source, String outputEncoding) throws IOException, JMSException { if (logger.isDebugEnabled()) { logger.debug("Message type received is: " + getSimpleName(source.getClass())); } String jmsSpec = JmsConstants.JMS_SPECIFICATION_102B; if (endpoint != null) { Connector connector = endpoint.getConnector(); if (connector instanceof JmsConnector) { jmsSpec = ((JmsConnector) connector).getSpecification(); } } return JmsMessageUtils.toObject(source, jmsSpec, outputEncoding); }
Source:
<code>public static boolean isGlobalIndexCheckerEnabled(PhoenixConnection connection, PName index) throws SQLException { <START> TableDescriptor desc = desc = connection.getQueryServices().getTableDescriptor(index.getBytes()); <END> if (desc != null) { if (desc.hasCoprocessor(GlobalIndexChecker.class.getName())) { return true; } } return false; }</code><technical_language>This is called generateIndexData high-traffic. perf implications of grabbing table descriptor frequently, do need caching? this creates HTable time in turn a remote call Master time @gokceni @kadirozde</technical_language>

Target:
public static boolean isGlobalIndexCheckerEnabled(PhoenixConnection connection, PName index) throws SQLException { String indexName = index.getString(); Boolean entry = indexNameGlobalIndexCheckerEnabledMap.getIfPresent(indexName); if (entry != null){ return entry; } boolean result = false; try { TableDescriptor desc = connection.getQueryServices().getTableDescriptor(index.getBytes()); if (desc != null) { if (desc.hasCoprocessor(GlobalIndexChecker.class.getName())) { result = true; } } indexNameGlobalIndexCheckerEnabledMap.put(indexName, result); } catch (TableNotFoundException ex) { } return result; }
Source:
<code>public void run() { AccountTransaction accountTransaction = transaction.getTransaction(); if (AccountTransaction.Type.DEPOSIT.equals(accountTransaction.getType()) || AccountTransaction.Type.FEES_REFUND.equals(accountTransaction.getType()) || AccountTransaction.Type.TAX_REFUND.equals(accountTransaction.getType()) || AccountTransaction.Type.INTEREST.equals(accountTransaction.getType())) accountTransaction.setType(AccountTransaction.Type.DEPOSIT); <START> else if (AccountTransaction.Type.REMOVAL.equals(accountTransaction.getType()) <END> || AccountTransaction.Type.FEES.equals(accountTransaction.getType()) || AccountTransaction.Type.TAXES.equals(accountTransaction.getType()) || AccountTransaction.Type.INTEREST_CHARGE.equals(accountTransaction.getType())) accountTransaction.setType(AccountTransaction.Type.REMOVAL); else throw new IllegalArgumentException(); client.markDirty(); }</code><technical_language>REMOVAL is converted REMOVAL? is kind of unnecessary, it</technical_language>

Target:
public void run() { AccountTransaction accountTransaction = transaction.getTransaction(); if (AccountTransaction.Type.FEES_REFUND.equals(accountTransaction.getType()) || AccountTransaction.Type.TAX_REFUND.equals(accountTransaction.getType()) || AccountTransaction.Type.INTEREST.equals(accountTransaction.getType())) accountTransaction.setType(AccountTransaction.Type.DEPOSIT); else if (AccountTransaction.Type.FEES.equals(accountTransaction.getType()) || AccountTransaction.Type.TAXES.equals(accountTransaction.getType()) || AccountTransaction.Type.INTEREST_CHARGE.equals(accountTransaction.getType())) accountTransaction.setType(AccountTransaction.Type.REMOVAL); else throw new IllegalArgumentException(); client.markDirty(); }
Source:
<code>public void testToJsonWithLengthLimitSimple() throws JsonLengthLimitExceededException { JsonCodec<ImmutablePerson> jsonCodec = jsonCodec(ImmutablePerson.class); ImmutablePerson person = new ImmutablePerson(Strings.repeat("a", 1000), false); try { jsonCodec.toJsonWithLengthLimit(person, 1011); <START> fail("expected IllegalArgumentException"); <END> } catch (JsonLengthLimitExceededException e) jsonCodec.toJsonWithLengthLimit(person, 1036); }</code><technical_language>string is wrong</technical_language>

Target:
public void testToJsonWithLengthLimitSimple() { JsonCodec<ImmutablePerson> jsonCodec = jsonCodec(ImmutablePerson.class); ImmutablePerson person = new ImmutablePerson(Strings.repeat("a", 1000), false); assertFalse(jsonCodec.toJsonWithLengthLimit(person, 0).isPresent()); assertFalse(jsonCodec.toJsonWithLengthLimit(person, 1000).isPresent()); assertFalse(jsonCodec.toJsonWithLengthLimit(person, 1035).isPresent()); jsonCodec.toJsonWithLengthLimit(person, 1036); }
Source:
<code>public static LabelVote parse(String text) { checkArgument(!Strings.isNullOrEmpty(text), "Empty label vote"); if (text.charAt(0) == '-') { return new LabelVote(text.substring(1), (short) 0); } short sign = 0; int i; for (i = text.length() - 1; i >= 0; i--) { int c = text.charAt(i); if (c == '-') { sign = (short) -1; break; } else if (c == '+') { sign = (short) 1; break; } else if <START> (!(c >= '0' && c <= '9')) <END> { break; } } if (sign == 0) { return new LabelVote(text, (short) 1); } return new LabelVote(text.substring(0, i), (short)(sign * Short.parseShort(text.substring(i + 1)))); }</code><technical_language>'0' <= c && c <= '9'</technical_language>

Target:
public static LabelVote parse(String text) { checkArgument(!Strings.isNullOrEmpty(text), "Empty label vote"); if (text.charAt(0) == '-') { return new LabelVote(text.substring(1), (short) 0); } short sign = 0; int i; for (i = text.length() - 1; i >= 0; i--) { int c = text.charAt(i); if (c == '-') { sign = (short) -1; break; } else if (c == '+') { sign = (short) 1; break; } else if (!('0' <= c && c <= '9')) { break; } } if (sign == 0) { return new LabelVote(text, (short) 1); } return new LabelVote(text.substring(0, i), (short)(sign * Short.parseShort(text.substring(i + 1)))); }
Source:
<code>public void render(Response response) { CharSequence js = getJavaScript(); if (Strings.isEmpty(js) == false) { JavaScriptUtils.writeJavaScript(response, <START> "var f = function() {" + js + ";};\nif ('loading' !== document.readyState) f(); else document.addEventListener('DOMContentLoaded', f);"); <END> } }</code><technical_language>I change this code be: { //scope const f = function() {" + js + ";}; .... } This multiple OnDomReadyHeader items work expected in deferred mode WDYT</technical_language>

Target:
public void render(Response response) { CharSequence js = getJavaScript(); if (Strings.isEmpty(js) == false) { JavaScriptUtils.writeJavaScript(response, "(function() {var f = function() {" + js + ";};\nif ('loading' !== document.readyState) f(); else document.addEventListener('DOMContentLoaded', f);})();"); } }
Source:
<code>private void loadImage() { int width = DisplayUtils.getDisplayPixelWidth(this); int height = DisplayUtils.getDisplayPixelHeight(this); int size = Math.max(width, height); String mediaUri; if (isVideo()) { mediaUri = mMedia.getThumbnailUrl(); } else { mediaUri = mMedia.getUrl(); } if (TextUtils.isEmpty(mediaUri)) { if (isVideo()) { downloadVideoThumbnail(); } else { ToastUtils.showToast(this, R.string.error_media_load); } return; } showProgress(true); String imageUrl = mediaUri; if (SiteUtils.isPhotonCapable(mSite)) { imageUrl = PhotonUtils.getPhotonImageUrl(mediaUri, size, 0); } showProgress(true); mImageManager.load(mImageView, ImageType.FULLSCREEN_PHOTO, imageUrl, ScaleType.CENTER, new RequestListener() { @Override <START> public void onResourceReady(@org.jetbrains.annotations.Nullable Drawable resource) { <END> if (!isFinishing()) { if (resource != null) { showProgress(false); if (isMediaFromEditor()) { showImageDimensions(resource.getIntrinsicWidth(), resource.getIntrinsicHeight()); } } else { AppLog.e(T.MEDIA, "Loading image preview failed - resource is null"); } } } @Override public void onLoadFailed(@Nullable Exception e) { if (!isFinishing()) { AppLog.e(T.MEDIA, e); showProgress(false); delayedFinishWithError(); } } }); }</code><technical_language>change this @Nullable</technical_language>

Target:
private void loadImage() { int width = DisplayUtils.getDisplayPixelWidth(this); int height = DisplayUtils.getDisplayPixelHeight(this); int size = Math.max(width, height); String mediaUri; if (isVideo()) { mediaUri = mMedia.getThumbnailUrl(); } else { mediaUri = mMedia.getUrl(); } if (TextUtils.isEmpty(mediaUri)) { if (isVideo()) { downloadVideoThumbnail(); } else { ToastUtils.showToast(this, R.string.error_media_load); } return; } showProgress(true); String imageUrl = mediaUri; if (SiteUtils.isPhotonCapable(mSite)) { imageUrl = PhotonUtils.getPhotonImageUrl(mediaUri, size, 0); } showProgress(true); mImageManager.load(mImageView, ImageType.FULLSCREEN_PHOTO, imageUrl, ScaleType.CENTER, new RequestListener() { @Override public void onResourceReady(@NotNull Drawable resource) { if (!isFinishing()) { showProgress(false); if (isMediaFromEditor()) { showImageDimensions(resource.getIntrinsicWidth(), resource.getIntrinsicHeight()); } } } @Override public void onLoadFailed(@Nullable Exception e) { if (!isFinishing()) { AppLog.e(T.MEDIA, e); showProgress(false); delayedFinishWithError(); } } }); }
Source:
<code><START> public final void addMessages(SortedSet<LocalizedMessage> messages) { <END> messageCollector.addAll(messages); }</code><technical_language>public? I external calls in this PR</technical_language>

Target:
protected final void addMessages(SortedSet<LocalizedMessage> messages) { messageCollector.addAll(messages); }
Source:
<code>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, <START> String.format("Refactor the %s in order to have only one invocation throwing an expected exception.", placeToRefactor), <END> secondaryLocations(invocationTree), null); } }</code><technical_language>well, "an expected" feels bad. happen once, is tested, so, "the expected exception", "the exception"</technical_language>

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:
<code>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)) { <START> TypedValue dimTitleColor = new TypedValue(); <END> 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; } }</code><technical_language>I save a lines extracting newsViewHolder.getTitle().setTextColor(titleColor.data); newsViewHolder.getScore().setTextColor(titleColor.data); if part determines titleColor is R.attr.dim_title_color R.attr.title_color</technical_language>

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:
<code>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; } <START> 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); <END> } } isHole = false; try { entries = stream.previous(); } catch (HoleInStreamException ex) { isHole = true; } if (stream.pos() <= rollbackVersion) { return; } } throw new NoRollbackException(stream.pos(), rollbackVersion); }</code><technical_language>I cleaner SMR is a is undoable. applyUndoRecordUnsafe is called, results in a no-op</technical_language>

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:
<code>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, <START> vendorNameLabel, firstNameLabel, lastNameLabel); <END> return false; } return true; }</code><technical_language>"principalNameLabel" variable needs added this argument list, preserve customization for it</technical_language>

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:
<code>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)) { <START> result = true; <END> 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; }</code><technical_language>Do want evaluate TCP stall if a DNS stall</technical_language>

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:
<code>public String getDescription() { <START> return "Migrates pom.xml files to format required in 7.7.x and later (community)"; <END> }</code><technical_language>remove references versions here? change this to: "Migrates pom.xml files format compatible KIE Maven build." @porcelli WDYT</technical_language>

Target:
public String getDescription() { return "Migrates pom.xml files to format compatible with KIE Maven build."; }
Source:
<code>public static List<Object> map(Package pack) { <START> List<Object> row = Lists.newArrayList(); <END> 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; }</code><technical_language>suggestion List<Object> row = new ArrayList<>(PACKAGE_ATTRS.size());</technical_language>

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:
<code>public void writeEvent(ByteBuffer data) { <START> int timeId = eventTimestamp&((1<<28)-1); <END> timeId |= eventId << 27; data.putInt(timeId); data.putInt(eventContent); }</code><technical_language>timeID int timeID = (timestamp << 5 | (0x1F&id));</technical_language>

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:
<code>public void visitToken(DetailAST token) { switch (token.getType()) { case TokenTypes.LITERAL_THROW: <START> if (!isValidScope(token)) { <END> 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; } }</code><technical_language>feels subverting visitor pattern in isValidScope tree traversal yourself. save states in logger. 1. a class def, is this class publicly visible? 2. a method def, is this method publicly visible? 3. I encountered a "throw", is method class is publicly visible(checked in previous steps)? If so, log</technical_language>

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:
<code>public void onPost(String triggeredByUser) { <START> onPost(SCMEvent.originOf(Stapler.getCurrentRequest()), triggeredByUser); <END> }</code><technical_language>call Stapler.getCurrentRequest() in GitHubTrigger implementation, thread</technical_language>

Target:
public void onPost(String triggeredByUser) { onPost(GitHubTriggerEvent.create() .withOrigin(SCMEvent.originOf(Stapler.getCurrentRequest())) .withTriggeredByUser(triggeredByUser) .build() ); }
Source:
<code>private String stateToString(State state) { String value; if (state instanceof DecimalType) { value = ((DecimalType) state).toBigDecimal().toString(); } else if (state instanceof PercentType) { <START> value = ((PercentType) state).toBigDecimal().toString(); <END> } 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; }</code><technical_language>PercentType is a DecimalType for DecimalType calling toString() is right thing</technical_language>

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:
<code>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 { <START> if (content.length() > MAXIMUM_OBJECT_SIZE) { <END> 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; }</code><technical_language>minor suggestion move length check unrelated try-catch, put in a continue statement instead</technical_language>

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:
<code>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); <START> autoDisable = autoDisableDefault; <END> }</code><technical_language>delete this</technical_language>

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:
<code>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(); <START> Optional<OfficialLanguageChannel> languageChannel = OfficialLanguageChannel.getChannelName(localeLanguage); <END> languageChannel.ifPresent(channel -> autoJoinChannels.get().add(channel.getChannelName())); }</code><technical_language>Skip variable assignment, if is unused call ifPresent (but a linebreak for ifPresent)</technical_language>

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:
<code>void testNoDataFieldsSucceeds() { Compilation compilation = helper.compile(Inputs.NO_DATAFIELDS.get()); <START> <END> assertDefaultsPresent(compilation); }</code><technical_language>get rid of this please</technical_language>

Target:
void testNoDataFieldsSucceeds() { Compilation compilation = helper.compile(Inputs.NO_DATAFIELDS.get()); assertThat(compilation).succeededWithoutWarnings(); assertDefaultsPresent(compilation); }
Source:
<code>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)); <START> metaDataStore.populateEntityDictionary(annotatedClass); <END> } return new SQLQueryEngine(metaDataStore, entityManagerFactory); }</code><technical_language>Pass compiler MetaDataStore constructor initialize internal dictionary in constructor instead of this initialization here</technical_language>

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:
<code>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) { <START> getLogger().debug(e, "Couldn't process stream."); <END> } return false; }</code><technical_language>this debug-level error-level</technical_language>

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:
<code>private String getZeppelinHome() throws IOException { String zeppelinHome = ""; if (System.getenv("ZEPPELIN_HOME") != null) { zeppelinHome = System.getenv("ZEPPELIN_HOME"); } <START> if (StringUtils.isBlank(zeppelinHome)) { <END> 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!"); }</code><technical_language>In case ZEPPELIN_HOME</technical_language>

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