auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private Object getLock(ObjectName objectName) { if (locks.get(objectName) == null) { locks.putIfAbsent(objectName, new Object()); } <START> return locks.get(objectName); <END> }</code><technical_language>computeIfAbsent instead</technical_language>

Target:
private Object getLock(ObjectName objectName) { return locks.computeIfAbsent(objectName, k -> new Object()); }
Source:
<code>ConstantPool(DataInput data) throws IOException { super(); int count = data.readUnsignedShort(); types = new byte[count]; values = new Object[count]; for (int i = 1; i < count; i++) { byte type = data.readByte(); types[i] = type; switch (type) { case UTF8 : values[i] = data.readUTF(); break; case INTEGER : case FIELDREF : case METHODREF : case INTERFACEMETHODREF : case NAMEANDTYPE : values[i] = data.readInt(); break; case FLOAT : values[i] = data.readFloat(); break; case LONG : values[i] = data.readLong(); ++i; break; case DOUBLE : values[i] = data.readDouble(); ++i; break; case CLASS : case STRING : values[i] = data.readUnsignedShort(); break; <START> case UNUSED : <END> default: } } }</code><technical_language>note a pattern here, Personally I do cases fall default case</technical_language>

Target:
ConstantPool(DataInput data) throws IOException { super(); int count = data.readUnsignedShort(); types = new byte[count]; values = new Object[count]; for (int i = 1; i < count; i++) { byte type = data.readByte(); types[i] = type; switch (type) { case UTF8 : values[i] = data.readUTF(); break; case UNUSED : break; case INTEGER : case FIELDREF : case METHODREF : case INTERFACEMETHODREF : case NAMEANDTYPE : values[i] = data.readInt(); break; case FLOAT : values[i] = data.readFloat(); break; case LONG : values[i] = data.readLong(); ++i; break; case DOUBLE : values[i] = data.readDouble(); ++i; break; case CLASS : case STRING : values[i] = data.readUnsignedShort(); break; default: } } }
Source:
<code><START> public static Namespace of(String... values) { <END> List<String> list = Lists.newArrayList(values); return new Namespace(list); }</code><technical_language>need change this class ? I find a reason</technical_language>

Target:
public static Namespace of(String... values) { return of(Lists.newArrayList(values)); }
Source:
<code>public long getTimeUntilNextRun() { long now = timeProvider.getTime(); List<Requester> dueRequesters = getDueRequesters(now); if (dueRequesters.isEmpty()) { return WAKEUP_INTERVAL_MILLIS; } else { if (logger.isTraceEnabled()) { Requester nextDueRequester = dueRequesters.get(0); logger.trace(hashCode() + ": Next nack is scheduled for ssrc " + nextDueRequester.ssrc + " at " + Math.max(nextDueRequester.nextRequestAt, 0) + ". (current time is " + now + ")"); } <START> return Math.max(dueRequesters.get(0).nextRequestAt - now, 0); <END> } }</code><technical_language>I getDueRequesters order of requesters receives, I want min requesters. I add a method iterates returns minimum int avoid creating a list time</technical_language>

Target:
public long getTimeUntilNextRun() { long now = timeProvider.currentTimeMillis(); Requester nextDueRequester = getNextDueRequester(); if (nextDueRequester == null) { return WAKEUP_INTERVAL_MILLIS; } else { if (logger.isTraceEnabled()) { logger.trace(hashCode() + ": Next nack is scheduled for ssrc " + nextDueRequester.ssrc + " at " + Math.max(nextDueRequester.nextRequestAt, 0) + ". (current time is " + now + ")"); } return Math.max(nextDueRequester.nextRequestAt - now, 0); } }
Source:
<code>long windowProc (long hwnd, int msg, long wParam, long lParam) { if (handle == 0) return <START> 0; <END> if (hwnd == toolTipHandle || hwnd == balloonTipHandle || hwnd == menuItemToolTipHandle) { switch (msg) { case OS.WM_TIMER: { if (wParam != ToolTip.TIMER_ID) break; ToolTip tip = getCurrentToolTip (hwnd); if (tip != null && tip.autoHide) { tip.setVisible (false); } break; } case OS.WM_LBUTTONDOWN: { ToolTip tip = getCurrentToolTip (hwnd); if (tip != null) { tip.setVisible (false); tip.sendSelectionEvent (SWT.Selection); } break; } } return callWindowProc (hwnd, msg, wParam, lParam); } return super.windowProc (hwnd, msg, wParam, lParam); }</code><technical_language>SWT.NO_MOVE + SWT.TITLE style combination work Windows well, please add line @2099 if((style & SWT.NO_MOVE) != 0 && msg == OS.WM_NCLBUTTONDOWN && wParam == OS.HTCAPTION) return 0;</technical_language>

Target:
long windowProc (long hwnd, int msg, long wParam, long lParam) { if (handle == 0) return 0; if((style & SWT.NO_MOVE) != 0 && msg == OS.WM_NCLBUTTONDOWN && wParam == OS.HTCAPTION) return 0; if (hwnd == toolTipHandle || hwnd == balloonTipHandle || hwnd == menuItemToolTipHandle) { switch (msg) { case OS.WM_TIMER: { if (wParam != ToolTip.TIMER_ID) break; ToolTip tip = getCurrentToolTip (hwnd); if (tip != null && tip.autoHide) { tip.setVisible (false); } break; } case OS.WM_LBUTTONDOWN: { ToolTip tip = getCurrentToolTip (hwnd); if (tip != null) { tip.setVisible (false); tip.sendSelectionEvent (SWT.Selection); } break; } } return callWindowProc (hwnd, msg, wParam, lParam); } return super.windowProc (hwnd, msg, wParam, lParam); }
Source:
<code>private boolean canUpdateCompatibilityVersionOrCpu() { allForCluster = vdsDao.getAllForCluster(oldCluster.getId()); List<VDS> upVdss = allForCluster.stream() .filter(v -> v.getStatus() == VDSStatus.Up) .collect(Collectors.toList()); boolean valid = true; String lowerVersionHosts = ""; String lowCpuHosts = ""; String incompatibleEmulatedMachineHosts = ""; for (VDS vds : upVdss) { if (!VersionSupport.checkClusterVersionSupported( getCluster().getCompatibilityVersion(), vds)) { valid = false; lowerVersionHosts = lowerVersionHosts.concat(vds.getName() + ", "); } if (getCluster().supportsVirtService() && missingServerCpuFlags(vds) != null) { valid = false; lowCpuHosts = lowCpuHosts.concat(vds.getName() + ", "); } if (!isSupportedEmulatedMachinesMatchClusterLevel(vds)) { valid = false; incompatibleEmulatedMachineHosts = incompatibleEmulatedMachineHosts.concat(vds.getName() + ", "); } } if (!lowerVersionHosts.isEmpty()) { addValidationVarAndMessage("host", <START> lowerVersionHosts, <END> EngineMessage.CLUSTER_CANNOT_UPDATE_COMPATIBILITY_VERSION_WITH_LOWER_HOSTS); } if (!lowCpuHosts.isEmpty()) { addValidationVarAndMessage("host", lowCpuHosts, EngineMessage.CLUSTER_CANNOT_UPDATE_CPU_WITH_LOWER_HOSTS); } if (!lowerVersionHosts.isEmpty()) { addValidationVarAndMessage("host", lowerVersionHosts, EngineMessage.CLUSTER_CANNOT_UPDATE_COMPATIBILITY_VERSION_WITH_INCOMPATIBLE_EMULATED_MACHINE); } return valid; }</code><technical_language>lowerVersionHosts , lowCpuHosts incompatibleEmulatedMachineHosts is extra "," end, removed</technical_language>

Target:
private boolean canUpdateCompatibilityVersionOrCpu() { allForCluster = vdsDao.getAllForCluster(oldCluster.getId()); List<VDS> upVdss = allForCluster.stream() .filter(v -> v.getStatus() == VDSStatus.Up) .collect(Collectors.toList()); boolean valid = true; String lowerVersionHosts = ""; String lowCpuHosts = ""; String incompatibleEmulatedMachineHosts = ""; for (VDS vds : upVdss) { if (!VersionSupport.checkClusterVersionSupported( getCluster().getCompatibilityVersion(), vds)) { valid = false; lowerVersionHosts = lowerVersionHosts.concat(vds.getName() + ", "); } if (getCluster().supportsVirtService() && missingServerCpuFlags(vds) != null) { valid = false; lowCpuHosts = lowCpuHosts.concat(vds.getName() + ", "); } if (!isSupportedEmulatedMachinesMatchClusterLevel(vds)) { valid = false; incompatibleEmulatedMachineHosts = incompatibleEmulatedMachineHosts.concat(vds.getName() + ", "); } } if (!lowerVersionHosts.isEmpty()) { addValidationVarAndMessage("host", lowerVersionHosts.replaceAll(", $", ""), EngineMessage.CLUSTER_CANNOT_UPDATE_COMPATIBILITY_VERSION_WITH_LOWER_HOSTS); } if (!lowCpuHosts.isEmpty()) { addValidationVarAndMessage("host", lowCpuHosts.replaceAll(", $", ""), EngineMessage.CLUSTER_CANNOT_UPDATE_CPU_WITH_LOWER_HOSTS); } if (!incompatibleEmulatedMachineHosts.isEmpty()) { addValidationVarAndMessage("host", incompatibleEmulatedMachineHosts.replaceAll(", $", ""), EngineMessage.CLUSTER_CANNOT_UPDATE_COMPATIBILITY_VERSION_WITH_INCOMPATIBLE_EMULATED_MACHINE); } return valid; }
Source:
<code>private void initCodeReviewCategory(ProjectConfig c) { LabelType type = new LabelType("Code-Review", ImmutableList.of( new LabelValue((short) 2, "Looks good to me, approved"), new LabelValue((short) 1, "Looks good to me, but someone else must approve"), new LabelValue((short) 0, "No score"), new LabelValue((short) -1, "I would prefer that you didn't submit this"), new LabelValue((short) -2, "Do not submit"))); <START> type.setAbbreviatedName("R"); <END> type.setCopyMinScore(true); c.getLabelSections().put(type.getName(), type); }</code><technical_language>Lets initialize new installations default abbreviation of CR</technical_language>

Target:
private void initCodeReviewCategory(ProjectConfig c) { LabelType type = new LabelType("Code-Review", ImmutableList.of( new LabelValue((short) 2, "Looks good to me, approved"), new LabelValue((short) 1, "Looks good to me, but someone else must approve"), new LabelValue((short) 0, "No score"), new LabelValue((short) -1, "I would prefer that you didn't submit this"), new LabelValue((short) -2, "Do not submit"))); type.setAbbreviatedName("CR"); type.setCopyMinScore(true); c.getLabelSections().put(type.getName(), type); }
Source:
<code>static LiteralText of(String content) { <START> return Sponge.getRegistry().getTextFactory().literal(content); <END> }</code><technical_language>This honestly feels static builder individualized texts other builders instead of a factory</technical_language>

Target:
static LiteralText of(String content) { return Sponge.getRegistry().createBuilder(LiteralText.Builder.class).content(content).build(); }
Source:
<code>public ErrorReportResponse uploadErrorReport( @Context final HttpServletRequest request, final ErrorReportRequest errorReport) { if (errorReport.getBody() == null || errorReport.getTitle() == null) { throw new IllegalArgumentException("Missing error report body and/or title"); } return errorReportIngestion.apply( <START> org.triplea.server.error.reporting.ErrorReportRequest.builder() <END> .clientIp(IpAddressExtractor.extractClientIp(request)) .errorReport(errorReport) .build()); }</code><technical_language>2 ErrorReportRequest classes</technical_language>

Target:
public ErrorReportResponse uploadErrorReport( @Context final HttpServletRequest request, final ErrorReportRequest errorReport) { if (errorReport.getBody() == null || errorReport.getTitle() == null) { throw new IllegalArgumentException("Missing error report body and/or title"); } return errorReportIngestion.apply(IpAddressExtractor.extractClientIp(request), errorReport); }
Source:
<code>private void setupBitmapLayout() { int parentWidth = parentRight - parentLeft; int parentHeight = parentBottom - parentTop; float anchorX = parentLeft + (parentWidth * cuePosition); float anchorY = parentTop + (parentHeight * cueLine); int width = Math.round(parentWidth * cueSize); <START> int height = Math.round(width * ((float) cueBitmap.getHeight() / cueBitmap.getWidth()) / (((float) parentWidth / parentHeight) / cueSar)); <END> int x = Math.round(cueLineAnchor == Cue.ANCHOR_TYPE_END ? (anchorX - width) : cueLineAnchor == Cue.ANCHOR_TYPE_MIDDLE ? (anchorX - (width / 2)) : anchorX); int y = Math.round(cuePositionAnchor == Cue.ANCHOR_TYPE_END ? (anchorY - height) : cuePositionAnchor == Cue.ANCHOR_TYPE_MIDDLE ? (anchorY - (height / 2)) : anchorY); bitmapRect = new Rect(x, y, x + width, y + height); }</code><technical_language>I a bit confused work out SAR :). In case, this does, feels simpler if Cue instead field: /** * bitmap height a fraction of of viewport size, -1 if bitmap * displayed natural height for {@link #size}. */ public final float bitmapHeight; do: int height = cueBitmapHeight != -1 ? Math.round(parentWidth * cueBitmapHeight) : [what-was-here-before];</technical_language>

Target:
private void setupBitmapLayout() { int parentWidth = parentRight - parentLeft; int parentHeight = parentBottom - parentTop; float anchorX = parentLeft + (parentWidth * cuePosition); float anchorY = parentTop + (parentHeight * cueLine); int width = Math.round(parentWidth * cueSize); int height = cueBitmapHeight != -1 ? Math.round(parentHeight * cueBitmapHeight) : Math.round(width * ((float) cueBitmap.getHeight() / cueBitmap.getWidth())); int x = Math.round(cueLineAnchor == Cue.ANCHOR_TYPE_END ? (anchorX - width) : cueLineAnchor == Cue.ANCHOR_TYPE_MIDDLE ? (anchorX - (width / 2)) : anchorX); int y = Math.round(cuePositionAnchor == Cue.ANCHOR_TYPE_END ? (anchorY - height) : cuePositionAnchor == Cue.ANCHOR_TYPE_MIDDLE ? (anchorY - (height / 2)) : anchorY); bitmapRect = new Rect(x, y, x + width, y + height); }
Source:
<code>private CloseableHttpResponse execute(URI requestUri) throws IOException { CloseableHttpResponse response; ProxyConfig.Proxy proxy = proxyConfig .getProxyForUrl(requestUri.toString()); if (proxy != null) { <START> getLogger().info("Downloading via proxy {}", proxy.toString()); <END> return executeViaProxy(proxy, requestUri); } else { getLogger().info("No proxy was configured, downloading directly"); if (StringUtils.isNotEmpty(userName) && StringUtils .isNotEmpty(password)) { getLogger().info("Using credentials ({}) from settings.xml", userName); URL aURL = requestUri.toURL(); HttpClientContext localContext = makeLocalContext(aURL); CredentialsProvider credentialsProvider = makeCredentialsProvider( aURL.getHost(), aURL.getPort(), userName, password); response = buildHttpClient(credentialsProvider) .execute(new HttpGet(requestUri), localContext); } else { response = buildHttpClient(null) .execute(new HttpGet(requestUri)); } } return response; }</code><technical_language>![MAJOR](<LINK_0> 'Severity: MAJOR') Invoke method(s) conditionally. [![rule](<LINK_1>](<LINK_2></technical_language>

Target:
private CloseableHttpResponse execute(URI requestUri) throws IOException { CloseableHttpResponse response; ProxyConfig.Proxy proxy = proxyConfig .getProxyForUrl(requestUri.toString()); if (proxy != null) { getLogger().info("Downloading via proxy {}", proxy.toString()); return executeViaProxy(proxy, requestUri); } else { getLogger().info("No proxy was configured, downloading directly"); if (StringUtils.isNotEmpty(userName) && StringUtils .isNotEmpty(password)) { getLogger().info("Using credentials ({})", userName); URL aURL = requestUri.toURL(); HttpClientContext localContext = makeLocalContext(aURL); CredentialsProvider credentialsProvider = makeCredentialsProvider( aURL.getHost(), aURL.getPort(), userName, password); response = buildHttpClient(credentialsProvider) .execute(new HttpGet(requestUri), localContext); } else { response = buildHttpClient(null) .execute(new HttpGet(requestUri)); } } return response; }
Source:
<code>public Iterable<TmfAnalysisRequirement> getAnalysisRequirements() { List<TmfAnalysisRequirement> requirements = new ArrayList<>(); List<String> eventNames = new ArrayList<>(); eventNames.add(LttngStrings.EXIT_SYSCALL); eventNames.add(LttngStrings.IRQ_HANDLER_ENTRY); eventNames.add(LttngStrings.IRQ_HANDLER_EXIT); eventNames.add(LttngStrings.SOFTIRQ_ENTRY); eventNames.add(LttngStrings.SOFTIRQ_EXIT); eventNames.add(LttngStrings.SOFTIRQ_RAISE); eventNames.add(LttngStrings.SCHED_SWITCH); eventNames.add(LttngStrings.SCHED_PROCESS_FORK); eventNames.add(LttngStrings.SCHED_PROCESS_EXIT); eventNames.add(LttngStrings.SCHED_PROCESS_FREE); eventNames.add(LttngStrings.STATEDUMP_PROCESS_STATE); eventNames.add(LttngStrings.SCHED_WAKEUP); eventNames.add(LttngStrings.SCHED_WAKEUP_NEW); eventNames.add(LttngStrings.SYSCALL_PREFIX); <START> requirements.add(new TmfAnalysisRequirement(SessionConfigStrings.CONFIG_ELEMENT_EVENT, eventNames, AnalysisRequirementValueLevel.MANDATORY)); <END> return requirements; }</code><technical_language>removed domain requirement type. Why</technical_language>

Target:
public Iterable<TmfAnalysisRequirement> getAnalysisRequirements() { List<TmfAnalysisRequirement> requirements = new LinkedList<>(); List<String> eventNames = new LinkedList<>(); eventNames.add(LttngStrings.EXIT_SYSCALL); eventNames.add(LttngStrings.IRQ_HANDLER_ENTRY); eventNames.add(LttngStrings.IRQ_HANDLER_EXIT); eventNames.add(LttngStrings.SOFTIRQ_ENTRY); eventNames.add(LttngStrings.SOFTIRQ_EXIT); eventNames.add(LttngStrings.SOFTIRQ_RAISE); eventNames.add(LttngStrings.SCHED_SWITCH); eventNames.add(LttngStrings.SCHED_PROCESS_FORK); eventNames.add(LttngStrings.SCHED_PROCESS_EXIT); eventNames.add(LttngStrings.SCHED_PROCESS_FREE); eventNames.add(LttngStrings.STATEDUMP_PROCESS_STATE); eventNames.add(LttngStrings.SCHED_WAKEUP); eventNames.add(LttngStrings.SCHED_WAKEUP_NEW); eventNames.add(LttngStrings.SYSCALL_PREFIX); TmfAnalysisRequirement domainReq = new TmfAnalysisRequirement(SessionConfigStrings.CONFIG_ELEMENT_DOMAIN); domainReq.addValue(SessionConfigStrings.CONFIG_ELEMENT_DOMAIN_TYPE_KERNEL, AnalysisRequirementValueLevel.MANDATORY); requirements.add(domainReq); requirements.add(new TmfAnalysisRequirement(SessionConfigStrings.CONFIG_ELEMENT_EVENT, eventNames, AnalysisRequirementValueLevel.MANDATORY)); return requirements; }
Source:
<code>public DecoratedCache(AdvancedCache<K, V> delegate, Object lockOwner, Flag... flags) { super(delegate); if (flags == null) <START> throw new IllegalArgumentException("There is no point in using a DecoratedCache if Flags are set."); <END> if (flags.length == 0) this.flags = EnumUtil.EMPTY_BIT_SET; else { this.flags = EnumUtil.bitSetOf(flags); } this.lockOwner = lockOwner; cacheImplementation = (CacheImpl<K, V>) delegate; }</code><technical_language>Hmm, call this ctor null flags (besides reflection)? If any, new Flag[0], if set null param, get null flag..</technical_language>

Target:
public DecoratedCache(AdvancedCache<K, V> delegate, Object lockOwner, Flag... flags) { super(delegate); if (flags.length == 0) this.flags = EnumUtil.EMPTY_BIT_SET; else { this.flags = EnumUtil.bitSetOf(flags); } this.lockOwner = lockOwner; cacheImplementation = (CacheImpl<K, V>) delegate; }
Source:
<code>public void setOptions(@NonNull EnumSet<PhotoPickerOption> options) { mAllowMultiSelect = options.contains(PhotoPickerOption.ALLOW_MULTI_SELECT); <START> mPhotosOnly = options.contains(PhotoPickerOption.PHOTOS_ONLY); <END> if (hasAdapter()) { getAdapter().setAllowMultiSelect(mAllowMultiSelect); getAdapter().setShowPhotosOnly(mPhotosOnly); } }</code><technical_language>I wrong, mDeviceOnly is missing here. Minor: Wondering is this method refresh/set Fragment parameters. Is a switch picker mode creation? I main activity in onCreate, fragment is available</technical_language>

Target:
public void setOptions(@NonNull EnumSet<PhotoPickerOption> options) { mAllowMultiSelect = options.contains(PhotoPickerOption.ALLOW_MULTI_SELECT); mPhotosOnly = options.contains(PhotoPickerOption.PHOTOS_ONLY); mDeviceOnly = options.contains(PhotoPickerOption.DEVICE_ONLY); if (hasAdapter()) { getAdapter().setAllowMultiSelect(mAllowMultiSelect); getAdapter().setShowPhotosOnly(mPhotosOnly); } }
Source:
<code>public String getText(final Object element) { Item item = (Item) element; <START> String label = item.getLabel(); if (label == null || label.trim().length() == 0) { label = item.getViewpoint().getName(); } <END> return label; }</code><technical_language>This handled in item.getLabel()</technical_language>

Target:
public String getText(final Object element) { Item item = (Item) element; return item.getLabel(); }
Source:
<code>public void registerAnimationCallback(@NonNull Animatable2.AnimationCallback callback) { if (mAnimationCallbacks == null) { mAnimationCallbacks = new ArrayList<>(); } if (mAnimationCallbacks.contains(callback)) { return; } mAnimationCallbacks.add(callback); if (mAnimatorListener == null) { mAnimatorListener = new AnimatorListenerAdapter() { @Override public void onAnimationStart(@NonNull Animator animation) { ArrayList<Animatable2.AnimationCallback> tmpCallbacks = new ArrayList<>(mAnimationCallbacks); int size = tmpCallbacks.size(); for (int i = 0; i < size; i++) { tmpCallbacks.get(i).onAnimationStart(SeekableAnimatedVectorDrawable.this); } } @Override public void onAnimationEnd(@NonNull Animator animation) { ArrayList<Animatable2.AnimationCallback> tmpCallbacks = new ArrayList<>(mAnimationCallbacks); int size = tmpCallbacks.size(); for (int i = 0; i < size; i++) { tmpCallbacks.get(i).onAnimationEnd(SeekableAnimatedVectorDrawable.this); } } }; } <START> mAnimatedVectorState.mAnimatorSet.addListener(mAnimatorListener); <END> }</code><technical_language>Nit: This adds mAnimatorListener registered callback? assume AnimatorSet check for duplicated listeners. move this 2 lines up, null check</technical_language>

Target:
public void registerAnimationCallback(@NonNull Animatable2.AnimationCallback callback) { if (mAnimationCallbacks == null) { mAnimationCallbacks = new ArrayList<>(); } if (mAnimationCallbacks.contains(callback)) { return; } mAnimationCallbacks.add(callback); if (mAnimatorListener == null) { mAnimatorListener = new AnimatorListenerAdapter() { @Override public void onAnimationStart(@NonNull Animator animation) { ArrayList<Animatable2.AnimationCallback> tmpCallbacks = new ArrayList<>(mAnimationCallbacks); int size = tmpCallbacks.size(); for (int i = 0; i < size; i++) { tmpCallbacks.get(i).onAnimationStart(SeekableAnimatedVectorDrawable.this); } } @Override public void onAnimationEnd(@NonNull Animator animation) { ArrayList<Animatable2.AnimationCallback> tmpCallbacks = new ArrayList<>(mAnimationCallbacks); int size = tmpCallbacks.size(); for (int i = 0; i < size; i++) { tmpCallbacks.get(i).onAnimationEnd(SeekableAnimatedVectorDrawable.this); } } }; mAnimatedVectorState.mAnimatorSet.addListener(mAnimatorListener); } }
Source:
<code>private boolean uploadIfNotExists(BlobId blobId, long inputLength, CloudBlobMetadata cloudBlobMetadata, InputStream blobInputStream) throws StorageException, URISyntaxException, IOException { BlobRequestOptions options = null; AccessCondition condition = AccessCondition.generateIfNoneMatchCondition("*"); Timer.Context storageTimer = azureMetrics.blobUploadTime.time(); try { CloudBlobContainer azureContainer = getContainer(blobId, true); String azureBlobName = getAzureBlobName(blobId); CloudBlockBlob azureBlob = azureContainer.getBlockBlobReference(azureBlobName); azureBlob.setMetadata(getMetadataMap(cloudBlobMetadata)); azureBlob.upload(blobInputStream, inputLength, condition, options, blobOpContext); logger.debug("Uploaded blob to Azure container {}.", blobId, azureContainer.getName()); return true; } catch (StorageException sex) { if (sex.getHttpStatusCode() == HttpURLConnection.HTTP_CONFLICT) { logger.debug("Skipped upload of existing blob {}.", blobId); <START> azureMetrics.blobUploadSkippedCount.inc(); <END> return false; } else { throw sex; } } finally { storageTimer.stop(); } }</code><technical_language>rename blobUploadConflictCount is a name metric in vcrMetrics.blobUploadSkippedCount. things</technical_language>

Target:
private boolean uploadIfNotExists(BlobId blobId, long inputLength, CloudBlobMetadata cloudBlobMetadata, InputStream blobInputStream) throws StorageException, URISyntaxException, IOException { BlobRequestOptions options = null; AccessCondition condition = AccessCondition.generateIfNoneMatchCondition("*"); Timer.Context storageTimer = azureMetrics.blobUploadTime.time(); try { CloudBlobContainer azureContainer = getContainer(blobId, true); String azureBlobName = getAzureBlobName(blobId); CloudBlockBlob azureBlob = azureContainer.getBlockBlobReference(azureBlobName); azureBlob.setMetadata(getMetadataMap(cloudBlobMetadata)); azureBlob.upload(blobInputStream, inputLength, condition, options, blobOpContext); logger.debug("Uploaded blob to Azure container {}.", blobId, azureContainer.getName()); return true; } catch (StorageException sex) { if (sex.getHttpStatusCode() == HttpURLConnection.HTTP_CONFLICT) { logger.debug("Skipped upload of existing blob {}.", blobId); azureMetrics.blobUploadConflictCount.inc(); return false; } else { throw sex; } } finally { storageTimer.stop(); } }
Source:
<code>public QueryResult<ChannelSchedule> execute(ScheduleQuery query) throws QueryExecutionException { List<Channel> channels = resolveChannels(query); if(!query.getEnd().isPresent()) { <START> throw new UnsupportedOperationException("ScheduleResolverBackedScheduleQueryExecutor doesn't support 'count' queries. Please specify 'to' parameter in your request"); <END> } ListenableFuture<Schedule> schedule = scheduleResolver.resolve( channels, new Interval(query.getStart(), query.getEnd().get()), query.getSource() ); if (query.isMultiChannel()) { return QueryResult.listResult(channelSchedules(schedule, query), query.getContext()); } return QueryResult.singleResult(Iterables.getOnlyElement(channelSchedules(schedule, query)), query.getContext()); }</code><technical_language>ScheduleResolverBackedScheduleQueryExecutor means 99% of people read error message</technical_language>

Target:
public QueryResult<ChannelSchedule> execute(ScheduleQuery query) throws QueryExecutionException { List<Channel> channels = resolveChannels(query); if(!query.getEnd().isPresent()) { throw new UnsupportedOperationException("'count' parameter not supported in non-equivalent schedule store. Please specify 'to' parameter in your request"); } ListenableFuture<Schedule> schedule = scheduleResolver.resolve( channels, new Interval(query.getStart(), query.getEnd().get()), query.getSource() ); if (query.isMultiChannel()) { return QueryResult.listResult(channelSchedules(schedule, query), query.getContext()); } return QueryResult.singleResult(Iterables.getOnlyElement(channelSchedules(schedule, query)), query.getContext()); }
Source:
<code>public void testEquals() throws Exception { RedisConnectionFactory connectionFactory = this.getConnectionFactoryForTest(); RedisLockRegistry registry1 = new RedisLockRegistry(connectionFactory, "rlrTests"); RedisLockRegistry registry2 = new RedisLockRegistry(connectionFactory, "rlrTests"); RedisLockRegistry registry3 = new RedisLockRegistry(connectionFactory, "rlrTests2"); Lock lock1 = registry1.obtain("foo"); Lock lock2 = registry1.obtain("foo"); assertEquals(lock1, lock2); lock1.lock(); lock2.lock(); assertEquals(lock1, lock2); lock1.unlock(); lock2.unlock(); assertEquals(lock1, lock2); lock1 = registry1.obtain("foo"); lock2 = registry2.obtain("foo"); assertNotEquals(lock1, lock2); lock1.lock(); assertFalse(lock2.tryLock()); lock1.unlock(); lock1 = registry1.obtain("foo"); lock2 = registry3.obtain("foo"); assertNotEquals(lock1, lock2); lock1.lock(); lock2.lock(); lock1.unlock(); <START> lock2.unlock(); <END> }</code><technical_language>is some point showing some inconsistency In this testEquals(): lock1 = registry1.obtain("foo"); lock2 = registry2.obtain("foo"); assertNotEquals(lock1, lock2); lock1.lock(); assertFalse(lock2.tryLock()); lock lock2, equal. developing HazelcastLockRegistry shows lock registries for key equal :smile:</technical_language>

Target:
public void testEquals() throws Exception { RedisConnectionFactory connectionFactory = this.getConnectionFactoryForTest(); RedisLockRegistry registry1 = new RedisLockRegistry(connectionFactory, "rlrTests"); registry1.setUseWeakReferences(true); RedisLockRegistry registry2 = new RedisLockRegistry(connectionFactory, "rlrTests"); RedisLockRegistry registry3 = new RedisLockRegistry(connectionFactory, "rlrTests2"); Lock lock1 = registry1.obtain("foo"); Lock lock2 = registry1.obtain("foo"); assertEquals(lock1, lock2); lock1.lock(); lock2.lock(); assertEquals(lock1, lock2); lock1.unlock(); lock2.unlock(); assertEquals(lock1, lock2); lock1 = registry1.obtain("foo"); lock2 = registry2.obtain("foo"); assertNotEquals(lock1, lock2); lock1.lock(); assertFalse(lock2.tryLock()); lock1.unlock(); lock1 = registry1.obtain("foo"); lock2 = registry3.obtain("foo"); assertNotEquals(lock1, lock2); lock1.lock(); lock2.lock(); lock1.unlock(); lock2.unlock(); }
Source:
<code>public NakadiCursor unshiftCursor(final ShiftedNakadiCursor cursor) throws InvalidCursorOperation { if (cursor.getShift() < 0) { return moveCursorBackwards(cursor.getTopic(), cursor.getTimeline(), cursor.getPartition(), <START> parse(cursor.getOffset()), cursor.getShift()); <END> } else { return moveCursorForward(cursor.getTopic(), cursor.getTimeline(), cursor.getPartition(), parse(cursor.getOffset()), cursor.getShift()); } }</code><technical_language>hmm, this parse work for version-zero cursors. For version fail offset is a number</technical_language>

Target:
public NakadiCursor unshiftCursor(final ShiftedNakadiCursor cursor) throws InvalidCursorOperation { if (cursor.getShift() < 0) { return moveCursorBackwards(cursor.getEventType(), cursor.getTimeline(), cursor.getPartition(), numberOfEventsBeforeCursor(cursor), cursor.getShift()); } else if (cursor.getShift() > 0) { return moveCursorForward(cursor.getEventType(), cursor.getTimeline(), cursor.getPartition(), numberOfEventsBeforeCursor(cursor), cursor.getShift()); } else { return new NakadiCursor(cursor.getTimeline(), cursor.getPartition(), cursor.getOffset()); } }
Source:
<code>public static ChecksumType getChecksumType(Configuration conf) { <START> String checksumName = conf.get(HConstants.CHECKSUM_TYPE_NAME); <END> return checksumName == null ? ChecksumType.getDefaultChecksumType() : ChecksumType.nameToType(checksumName); }</code><technical_language>want do get return ChecksymType.nameToType(conf.get(HConstants.CHECKSUM_TYPE_NAME, DEFAULT_WHATEVER_IT_IS)); Is this a candidate for StoreContext? (Perhaps if called frequently). StoreContext is this is used</technical_language>

Target:
public static ChecksumType getChecksumType(Configuration conf) { return ChecksumType.nameToType( conf.get(HConstants.CHECKSUM_TYPE_NAME, ChecksumType.getDefaultChecksumType().getName())); }
Source:
<code>protected void executeCommand() { ManagedBlockStorage managedBlockStorage = cinderStorageDao.get(getParameters().getStorageDomainId()); List<String> extraParams = new ArrayList<>(); extraParams.add(getParameters().getVolumeId().toString()); extraParams.add(getParameters().getImageId().toString()); CinderlibReturnValue returnValue; try { CinderlibCommandParameters params = new CinderlibCommandParameters(JsonHelper.mapToJson( managedBlockStorage.getAllDriverOptions(), false), extraParams); returnValue = cinderlibExecutor.runCommand(CinderlibExecutor.CinderlibCommand.CREATE_VOLUME_FROM_SNAPSHOT, params); Guid clonedVolumeGuid = <START> Guid.createGuidFromString(returnValue.getOutput()); <END> getParameters().setDestinationImageId(clonedVolumeGuid); } catch (Exception e) { log.error("Failed executing creating volume from snapshot", e); return; } if (!returnValue.getSucceed()) { return; } createVolumeFromSnapshotInDB(); setSucceeded(true); persistCommandIfNeeded(); }</code><technical_language>creating guid check operation succeded</technical_language>

Target:
protected void executeCommand() { ManagedBlockStorage managedBlockStorage = cinderStorageDao.get(getParameters().getStorageDomainId()); List<String> extraParams = new ArrayList<>(); extraParams.add(getParameters().getVolumeId().toString()); extraParams.add(getParameters().getImageId().toString()); CinderlibReturnValue returnValue; try { CinderlibCommandParameters params = new CinderlibCommandParameters(JsonHelper.mapToJson( managedBlockStorage.getAllDriverOptions(), false), extraParams); returnValue = cinderlibExecutor.runCommand(CinderlibExecutor.CinderlibCommand.CREATE_VOLUME_FROM_SNAPSHOT, params); if (!returnValue.getSucceed()) { return; } Guid clonedVolumeGuid = Guid.createGuidFromString(returnValue.getOutput()); getParameters().setDestinationImageId(clonedVolumeGuid); } catch (Exception e) { log.error("Failed executing creating volume from snapshot", e); return; } createVolumeFromSnapshotInDB(); setSucceeded(true); persistCommandIfNeeded(); }
Source:
<code>private ClientRuntimeError createOnErrorHandler(final Throwable throwable, final String name, final Package projectPkg){ <START> String FileAlreadyExistsExceptionClassName = "org.uberfire.java.nio.file.FileAlreadyExistsException"; <END> if(throwable.getClass().getCanonicalName().equals(FileAlreadyExistsExceptionClassName)){ String message = translationService.getValue(StunnerProjectClientMessages.BUSINESS_PROCESS_ALREADY_EXISTS, name, projectPkg.getPackageName()); return new ClientRuntimeError(message, throwable); }else{ return new ClientRuntimeError(throwable); } }</code><technical_language>ok good, butr if some point org.uberfire.java.nio.file.FileAlreadyExistsException refactored, this code broken.. results more safe for future updates instanceof operator Class object instead, as: String fileAlreadyExistsExceptionClassName = FileAlreadyExistsException.class.getName();</technical_language>

Target:
private ClientRuntimeError createOnErrorHandler(final Throwable throwable, final String name, final Package projectPkg){ String FileAlreadyExistsExceptionClassName = "org.uberfire.java.nio.file.FileAlreadyExistsException"; if(throwable.getClass().getCanonicalName().equals(FileAlreadyExistsExceptionClassName)){ String message = translationService.getValue(StunnerProjectClientMessages.BUSINESS_PROCESS_ALREADY_EXISTS, projectPkg.getPackageName()+"."+name); return new ClientRuntimeError(message, throwable); }else{ return new ClientRuntimeError(throwable); } }
Source:
<code>private void addWorkPackageCriteria() { if (isWorkPackageSpecified()) { ArtifactId workPackArt = atsApi.getQueryService().getArtifact(workPackageId); if (isColorTeamMatch(workPackArt)) { if <START> (workPackArt != <END> null) { queryAnd(AtsAttributeTypes.WorkPackageReference, workPackArt.getIdString()); } } } }</code><technical_language>this atsApi.getQueryService().getArtifactOrSentinel(), checked for validity instead of null</technical_language>

Target:
private void addWorkPackageCriteria() { if (isWorkPackageSpecified()) { ArtifactId workPackArt = atsApi.getQueryService().getArtifactOrSentinel(workPackageId); if (isColorTeamMatch(workPackArt)) { if (workPackArt.isValid()) { queryAnd(AtsAttributeTypes.WorkPackageReference, workPackArt.getIdString()); } } } }
Source:
<code><START> public void onResourceChanged(ResourceChangedEvent event) { <END> ResourceDelta delta = event.getDelta(); Resource resource = delta.getResource(); if (resource.isProject() && resource.getLocation().segmentCount() == 1) { if (isProjectUnderGit(resource.asProject())) { if (delta.getKind() == ResourceDelta.ADDED) { if ((delta.getFlags() & (MOVED_FROM | MOVED_TO)) != 0) { String oldProjectName = delta.getFromPath().segment(0); String newProjectName = delta.getToPath().segment(0); MutableAlteredFiles alteredFiles = new MutableAlteredFiles( findProjectByName(newProjectName), changes.remove(oldProjectName)); changes.put(newProjectName, alteredFiles); view.renameRepository(oldProjectName, newProjectName); } else { changes.put(resource.getName(), new MutableAlteredFiles(resource.asProject())); view.addRepository(resource.getName()); } } else if (delta.getKind() == ResourceDelta.REMOVED) { changes.remove(resource.getName()); view.removeRepository(resource.getName()); } } } else { if (delta.getKind() == ResourceDelta.REMOVED) { String pathToItem = delta.getResource().getLocation().toString(); String projectName = extractProjectName(pathToItem); MutableAlteredFiles alteredFiles = changes.get(projectName); if (alteredFiles == null) { return; } String itemRelativePath = removeProjectName(pathToItem); if (alteredFiles.getStatusByFilePath(itemRelativePath) != Status.ADDED) { alteredFiles.addFile(itemRelativePath, Status.DELETED); } else { alteredFiles.removeFile(itemRelativePath); } view.updateRepositoryChanges(projectName, alteredFiles.getFilesQuantity()); if (projectName.equals(selectedProjectName)) { updateChangedFiles(alteredFiles); } } } }</code><technical_language>Simplify method</technical_language>

Target:
public void onResourceChanged(ResourceChangedEvent event) { ResourceDelta delta = event.getDelta(); Resource resource = delta.getResource(); if (resource.isProject() && resource.getLocation().segmentCount() == 1) { if (isProjectUnderGit(resource.asProject())) { if (delta.getKind() == ResourceDelta.ADDED) { if ((delta.getFlags() & (MOVED_FROM | MOVED_TO)) != 0) { String oldProjectName = delta.getFromPath().segment(0); String newProjectName = delta.getToPath().segment(0); MutableAlteredFiles alteredFiles = new MutableAlteredFiles( findProjectByName(newProjectName), changes.remove(oldProjectName)); changes.put(newProjectName, alteredFiles); view.renameRepository(oldProjectName, newProjectName); } else { changes.put(resource.getName(), new MutableAlteredFiles(resource.asProject())); view.addRepository(resource.getName()); } } else if (delta.getKind() == ResourceDelta.REMOVED) { changes.remove(resource.getName()); view.removeRepository(resource.getName()); } } } else { if (delta.getKind() == ResourceDelta.REMOVED) { onItemDeleted(delta); } } }
Source:
<code>public Collection<Class<? extends DataProvider>> getRequiredDataProviders(StepEngineSettings.StepDefinition stepDefinition) { <START> String visualizationIdentifier = stepDefinition.getConfig(ShowAction.Config.class).getVisualizationIdentifier(); <END> return VisualizationRegistry.INSTANCE.getRequiredDataProviders(visualizationIdentifier); }</code><technical_language>ShowAction? simply Config HideAction</technical_language>

Target:
public Collection<Class<? extends DataProvider>> getRequiredDataProviders(StepEngineSettings.StepDefinition stepDefinition) { String visualizationIdentifier = stepDefinition.getConfig(Config.class).getVisualizationIdentifier(); return VisualizationRegistry.INSTANCE.getRequiredDataProviders(visualizationIdentifier); }
Source:
<code>private void setupPrivacyDisclosures(TextView footerText) { final String verifyPhoneButtonText = getString(R.string.fui_verify_phone_number); final String multipleProviderFlowText = getString(R.string.fui_sms_terms_of_service, verifyPhoneButtonText); FlowParameters flowParameters = getFlowParams(); PrivacyDisclosureUtils.setupTermsOfServiceAndPrivacyPolicySmsText(getContext(), flowParameters, mSmsTermsText, multipleProviderFlowText); <START> if (!flowParameters.isSingleProviderFlow()) { <END> PrivacyDisclosureUtils.setupTermsOfServiceFooter(getContext(), flowParameters, footerText); } }</code><technical_language>if this **is** a single provider flow big text footer? If case (maybe previous method some internal switching) clearer if / else of PrivacyDisclosureUtils classes runs</technical_language>

Target:
private void setupPrivacyDisclosures(TextView footerText) { final String verifyPhoneButtonText = getString(R.string.fui_verify_phone_number); final String multipleProviderFlowText = getString(R.string.fui_sms_terms_of_service, verifyPhoneButtonText); FlowParameters flowParameters = getFlowParams(); if (flowParameters.isSingleProviderFlow()) { PrivacyDisclosureUtils.setupTermsOfServiceAndPrivacyPolicySmsText(getContext(), flowParameters, mSmsTermsText); } else { PrivacyDisclosureUtils.setupTermsOfServiceFooter(getContext(), flowParameters, footerText); mSmsTermsText.setText(multipleProviderFlowText); } }
Source:
<code>private Set<FilterResult> filterNode(StructuralNode node) { <START> Set<FilterResult> filterResults = new HashSet<>(); <END> for (ScanFilter scanFilter : parentScanner.getScanFilters()) { FilterResult filterResult = scanFilter.isFiltered(node); if (!filterResult.isFiltered()) { filterResults.add(filterResult); } } return filterResults; }</code><technical_language>IMO need check filters, is enough filter a message. is more useful in UI/API show user filters apply a message</technical_language>

Target:
private boolean filterNode(StructuralNode node) { for (ScanFilter scanFilter : parentScanner.getScanFilters()) { try { FilterResult filterResult = scanFilter.isFiltered(node); if (filterResult.isFiltered()) { if (log.isDebugEnabled()) { log.debug( "Ignoring filtered node: " + node.getName() + " Reason: " + filterResult.getReason()); } return true; } } catch (Exception ex) { log.error(ex.getMessage(), ex); } } return false; }
Source:
<code>private ListenableFuture scheduleTaskShutdown(ThreadingTaskRunnerWorkItem taskInfo) { synchronized (tasks) { if (taskInfo.shutdownFuture != null) { return taskInfo.shutdownFuture; } ListenableFuture shutdownFuture = controlThreadExecutor.submit( new Callable<Void>() { @Override public Void call() { LOGGER.info("Stopping thread for task: %s", taskInfo.getTaskId()); taskInfo.getTask().stopGracefully(taskConfig); try { TaskStatus status = taskInfo.getResult().get( taskConfig.getGracefulShutdownTimeout().toStandardDuration().getMillis(), TimeUnit.MILLISECONDS ); if (status == null) { if (taskInfo.thread != null) { <START> taskInfo.thread.interrupt(); <END> } } } catch (Exception e) { LOGGER.info(e, "Encountered exception while waiting for task [%s] shutdown", taskInfo.getTaskId()); if (taskInfo.thread != null) { taskInfo.thread.interrupt(); } } return null; } } ); taskInfo.shutdownFuture = shutdownFuture; return shutdownFuture; } }</code><technical_language>is interrupt status of thread is cleared this task if blocked waiting something. in case thread interrupt status set pick a new task</technical_language>

Target:
private ListenableFuture scheduleTaskShutdown(ThreadingTaskRunnerWorkItem taskInfo) { synchronized (tasks) { if (taskInfo.shutdownFuture != null) { return taskInfo.shutdownFuture; } taskInfo.shutdownFuture = controlThreadExecutor.submit( new Callable<Void>() { @Override public Void call() { LOGGER.info("Stopping thread for task: %s", taskInfo.getTaskId()); taskInfo.getTask().stopGracefully(taskConfig); try { taskInfo.getResult().get( taskConfig.getGracefulShutdownTimeout().toStandardDuration().getMillis(), TimeUnit.MILLISECONDS ); } catch (TimeoutException e) { taskInfo.getResult().cancel(true); } catch (Exception e) { LOGGER.info(e, "Encountered exception while waiting for task [%s] shutdown", taskInfo.getTaskId()); if (taskInfo.shutdownFuture != null) { taskInfo.shutdownFuture.cancel(true); } } return null; } } ); return taskInfo.shutdownFuture; } }
Source:
<code>public String getString(String key) { <START> String envName = key.toUpperCase().replaceAll("\\.", "_"); <END> String envValue = System.getenv(envName); if (StringUtils.isNotBlank(envValue)) { return envValue; } return properties.getProperty(key); }</code><technical_language>Replacing regular expressions is a pretty heavy operation. I some global flag server consider environment variables. config. Also, nice add underscore words in camel-case parameters. For example database.ignoreUnknown converted DATABASE_IGNORE_UNKNOWN</technical_language>

Target:
public String getString(String key) { if (useEnvVars) { String envValue = System.getenv(getEnvVarName(key)); if (envValue != null && !envValue.isEmpty()) { return envValue; } } return properties.getProperty(key); }
Source:
<code>public List<String> getLossVariables(){ <START> return this.lossVariables; <END> }</code><technical_language>do want return a mutable version of list here</technical_language>

Target:
public List<String> getLossVariables(){ return Collections.unmodifiableList(this.lossVariables); }
Source:
<code>public boolean offer(E e) { <START> throw new NotImplementedException(); <END> }</code><technical_language>support add offer</technical_language>

Target:
public boolean offer(E e) { if (this.underlyingQueue.offer(new ThroughputElement<E>(e))) { internalAddElement(); return true; } return false; }
Source:
<code>public String getFaviconPath() { File favicon = new File(filePath + "/favicon.ico"); <START> if (favicon.exists()) { <END> return path + "/favicon.ico"; } return null; }</code><technical_language>I check if file is readable existing</technical_language>

Target:
public String getFaviconPath() { String faviconFile = brandingProperties.getProperty(FAVICON_KEY); if (faviconFile != null) { File favicon = new File(filePath + "/" + faviconFile); if (favicon.exists()) { return path + "/" + faviconFile; } } return null; }
Source:
<code>public void writeTo(final Object data, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException { InputStream templateStream = null; try { String xslName = "/" + type.getSimpleName() + "AsPdf.xsl"; templateStream = type.getResourceAsStream(xslName); <START> if (templateStream != null) { <END> StreamSource transformSource = new StreamSource(templateStream); Method factoryMethod = null; for (Method currentMethod : objectFactory.getClass().getDeclaredMethods()) { Class<?>[] parameterTypes = currentMethod.getParameterTypes(); if (parameterTypes.length == 1 && parameterTypes[0] == type) { factoryMethod = currentMethod; break; } } if (data != null && factoryMethod != null) { JAXBElement<?> element = (JAXBElement<?>) factoryMethod.invoke(objectFactory, data); Source source = new JAXBSource(jaxbContext, element); Transformer xslfoTransformer = transfact.newTransformer(transformSource); Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, entityStream); Result res = new SAXResult(fop.getDefaultHandler()); xslfoTransformer.transform(source, res); } else { log.error("No profile data is available for the selected volume"); } } else { log.error("Error while generating PDF.Null InputStream"); } } catch (Exception e) { log.error("Error while generating PDF.", e); } finally { if (templateStream != null) { templateStream.close(); } } }</code><technical_language>try-with-resources syntax here</technical_language>

Target:
public void writeTo(final Object data, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException { String xslName = "/" + type.getSimpleName() + "AsPdf.xsl"; try (InputStream templateStream = type.getResourceAsStream(xslName)) { if (templateStream != null) { StreamSource transformSource = new StreamSource(templateStream); Method factoryMethod = null; for (Method currentMethod : objectFactory.getClass().getDeclaredMethods()) { Class<?>[] parameterTypes = currentMethod.getParameterTypes(); if (parameterTypes.length == 1 && parameterTypes[0] == type) { factoryMethod = currentMethod; break; } } if (data != null && factoryMethod != null) { JAXBElement<?> element = (JAXBElement<?>) factoryMethod.invoke(objectFactory, data); Source source = new JAXBSource(jaxbContext, element); Transformer xslfoTransformer = transfact.newTransformer(transformSource); Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, entityStream); Result res = new SAXResult(fop.getDefaultHandler()); xslfoTransformer.transform(source, res); } else { log.error("Data not available"); } } else { log.error("Error while generating PDF. Null InputStream"); } } catch (Exception e) { log.error("Error while generating PDF. ", e); } }
Source:
<code>public boolean supportsSingleValuedAssociationNaturalIdExpressions() { return false; <START> } <END></code><technical_language>major == 5 && minor >= 4</technical_language>

Target:
public boolean supportsSingleValuedAssociationNaturalIdExpressions() { return supportsSingleValuedAssociationNaturalIdExpressions; }
Source:
<code><START> public URL getFileUrl() throws MalformedURLException { <END> return new URL(azureFileStorageClient.url()); }</code><technical_language>catch exception return a RuntimeException instead, this happen checked URL is valid building client</technical_language>

Target:
public URL getFileUrl() { try { return new URL(azureFileStorageClient.url()); } catch (MalformedURLException e) { throw new RuntimeException(String.format("Invalid URL on %s: %s" + getClass().getSimpleName(), azureFileStorageClient.url()), e); } }
Source:
<code>public void modify(final Object element, final String property, final Object value) { TableItem tableItem = (TableItem) element; Compiler data = (Compiler) tableItem.getData(); <START> Command cmd = null; cmd = getModifcationCommand(property, value, data); <END> if (null != cmd) { executeCommand(cmd); compilerViewer.refresh(data); } }</code><technical_language>is this split lines</technical_language>

Target:
public void modify(final Object element, final String property, final Object value) { TableItem tableItem = (TableItem) element; Compiler data = (Compiler) tableItem.getData(); Command cmd = getModificationCommand(property, value, data); if (null != cmd) { executeCommand(cmd); compilerViewer.refresh(data); } }