auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static Optional<AddOn> createAddOn(Path file) { try { return Optional.of(new AddOn(file)); } catch (AddOn.InvalidAddOnException e) { if (logger.isDebugEnabled() || Constant.isDevMode()) { logger.warn("Invalid add-on: " + file.toString(), e); } else { <START> logger.warn("Invalid add-on: " + file.toString()); <END> } } catch (Exception e) { logger.error("Failed to create an add-on from: " + file.toString(), e); } return Optional.empty(); }</code><technical_language>Worth including exception's message in this case. common message extracted avoid duplication</technical_language>

Target:
public static Optional<AddOn> createAddOn(Path file) { try { return Optional.of(new AddOn(file)); } catch (AddOn.InvalidAddOnException e) { String logMessage = "Invalid add-on: " + file.toString() + "."; if (logger.isDebugEnabled() || Constant.isDevMode()) { logger.warn(logMessage, e); } else { logger.warn(logMessage + " " + e.getMessage()); } } catch (Exception e) { logger.error("Failed to create an add-on from: " + file.toString(), e); } return Optional.empty(); }
Source:
<code><START> public StatusDTO setKeycloakAuthUrl(String keycloakAuthUrl) { <END> this.keycloakAuthUrl = keycloakAuthUrl; return this; }</code><technical_language>KeycloakStatusDTO</technical_language>

Target:
public KeycloakStatusDTO setKeycloakAuthUrl(String keycloakAuthUrl) { this.keycloakAuthUrl = keycloakAuthUrl; return this; }
Source:
<code>private String extractArchive(String fileName, File outputDirectory) { if (StringUtils.isEmpty(fileName)) { return null; } LOGGER.info(NLS.bind("Extracting OpenShift archive {0}.", fileName)); String extractedDirectory = null; if (fileName.endsWith(SUFFIX_ZIP)) { extractedDirectory = StringUtils.chomp(fileName, SUFFIX_ZIP); <START> FileHelper.createDirectory(new File(extractedDirectory)); <END> FileHelper.unzipFile(new File(fileName), new File(extractedDirectory)); } else if (fileName.endsWith(SUFFIX_TAR_GZ)) { extractedDirectory = StringUtils.chomp(fileName, SUFFIX_TAR_GZ); FileHelper.extractTarGz(new File(fileName), outputDirectory); } return extractedDirectory; }</code><technical_language>source of FileHelper, change required. I this fixed in FileHelper though, making unzip un-targz behave - creating destination directory if doesnt</technical_language>

Target:
private String extractArchive(String fileName, File outputDirectory) { if (StringUtils.isEmpty(fileName)) { return null; } LOGGER.info(NLS.bind("Extracting OpenShift archive {0}.", fileName)); String extractedDirectory = null; if (fileName.endsWith(SUFFIX_ZIP)) { extractedDirectory = StringUtils.chomp(fileName, SUFFIX_ZIP); FileHelper.unzipFile(new File(fileName), outputDirectory); } else if (fileName.endsWith(SUFFIX_TAR_GZ)) { extractedDirectory = StringUtils.chomp(fileName, SUFFIX_TAR_GZ); FileHelper.extractTarGz(new File(fileName), outputDirectory); } return extractedDirectory; }
Source:
<code>private void requestLocationUpdates(Set<String> providers) { Context context = CommCareApplication._().getApplicationContext(); if (providers.isEmpty() && (ContextCompat.checkSelfPermission(context, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED || ContextCompat.checkSelfPermission(context, Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED)) { mLocationManager.removeUpdates(PollSensorAction.this); return; } for (String provider : providers) { if ((provider.equals(LocationManager.GPS_PROVIDER) && ContextCompat.checkSelfPermission(context, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) || (provider.equals(LocationManager.NETWORK_PROVIDER) && ContextCompat.checkSelfPermission(context, Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED)) { <START> mLocationManager.requestLocationUpdates(provider, 0, 0, PollSensorAction.this); <END> } } Timer timeout = new Timer(); timeout.schedule(new StopPollingTask(), GeoUtils.MAXIMUM_WAIT); }</code><technical_language>this skipping of background provider accepted GPS permissions instead of asking users do them</technical_language>

Target:
private void requestLocationUpdates(Set<String> providers) { if (providers.isEmpty() && hasLocationPerms()) { mLocationManager.removeUpdates(PollSensorAction.this); return; } for (String provider : providers) { if (hasLocationPerms()) { mLocationManager.requestLocationUpdates(provider, 0, 0, PollSensorAction.this); } } Timer timeout = new Timer(); timeout.schedule(new StopPollingTask(), GeoUtils.MAXIMUM_WAIT); }
Source:
<code>public List<ServiceTaskSummary> getEnabledServiceTasks() { return repoService.getServices().stream() .filter(service -> service.isEnabled()) .map(repoData -> new ServiceTaskSummary(repoData.getId(), "fa fa-cogs", repoData.getName(), repoData.getDescription(), repoData.getActiontitle(), repoData.isEnabled(), repoData.getInstalledOn())) .collect(Collectors.toList()); <START> } <END></code><technical_language>sorting</technical_language>

Target:
public List<ServiceTaskSummary> getEnabledServiceTasks() { return repoService.getServices().stream() .filter(service -> service.isEnabled()) .map(repoData -> new ServiceTaskSummary(repoData.getId(), "fa fa-cogs", repoData.getName(), repoData.getDescription(), repoData.getActiontitle(), repoData.isEnabled(), repoData.getInstalledOn())) .sorted((service, service2) -> service.getName().compareTo(service2.getName())) .collect(Collectors.toList()); }
Source:
<code>protected void createAndDispatchStackFrameSwitchedEvent(String tid, String frameId) { IContainerDMContext parentContainer = fProcesses.createContainerContextFromThreadId(fCommandControl.getContext(), tid); IProcessDMContext processDmc = DMContexts.getAncestorOfType(parentContainer, IProcessDMContext.class); IThreadDMContext threadDmc = fProcesses.createThreadContext(processDmc, tid); IExecutionDMContext execDmc = fProcesses.createExecutionContext(parentContainer, threadDmc, tid); IFrameDMContext frameDmc = ((MIStack)(stackService)).createFrameDMContext(execDmc, Integer.parseInt(frameId)); AbstractDMEvent<IFrameDMContext> event = null; event = new StackFrameSwitchedEvent(frameDmc); <START> fCommandControl.getSession().dispatchEvent(event, fCommandControl.getProperties()); <END> }</code><technical_language>need define create "event" separate lines, simply new ..Event disptatchEvent</technical_language>

Target:
protected void createAndDispatchStackFrameSwitchedEvent(String tid, String frameId) { IContainerDMContext parentContainer = fProcesses.createContainerContextFromThreadId(fCommandControl.getContext(), tid); IProcessDMContext processDmc = DMContexts.getAncestorOfType(parentContainer, IProcessDMContext.class); IThreadDMContext threadDmc = fProcesses.createThreadContext(processDmc, tid); IExecutionDMContext execDmc = fProcesses.createExecutionContext(parentContainer, threadDmc, tid); IFrameDMContext frameDmc = ((MIStack)(stackService)).createFrameDMContext(execDmc, Integer.parseInt(frameId)); fCommandControl.getSession().dispatchEvent(new StackFrameSwitchedEvent(frameDmc), fCommandControl.getProperties()); }
Source:
<code>public static Map<String, SavedAttachment> findExistingAttachments( Map<String, ? extends Attachment> attachments) { <START> Map<String, SavedAttachment> list = new HashMap<String, SavedAttachment>(); <END> for (Map.Entry<String, ? extends Attachment> a : attachments.entrySet()) { if (a instanceof SavedAttachment) { list.put(a.getKey(), (SavedAttachment)a.getValue()); } } return list; }</code><technical_language>field name list is a bit confusing now, this a List more. massively concerned this method is concise is clear is on, named existingAttachments attachments</technical_language>

Target:
public static Map<String, SavedAttachment> findExistingAttachments( Map<String, ? extends Attachment> attachments) { Map<String, SavedAttachment> existingAttachments = new HashMap<String, SavedAttachment>(); for (Map.Entry<String, ? extends Attachment> a : attachments.entrySet()) { if (a instanceof SavedAttachment) { existingAttachments.put(a.getKey(), (SavedAttachment)a.getValue()); } } return existingAttachments; }
Source:
<code>private void visitProperties(ObjectType objType, boolean isStatic, Set<String> skipNames) { boolean hasPrivateProps = false; for (String propName : getSortedPropertyNames(objType)) { if (skipNames.contains(propName)) continue; if ("prototype".equals(propName) || "superClass_".equals(propName) || "constructor".equals(propName)) { continue; } if (isPrivate(objType.getOwnPropertyJSDocInfo(propName))) { hasPrivateProps = true; <START> continue; <END> } visitProperty(propName, objType, isStatic); } if (hasPrivateProps) { if (isStatic) { emit("private static noClassSideStructuralTyping_: any;"); } else { emit("private noStructuralTyping_: any;"); } emitBreak(); } }</code><technical_language>safe continue visitProperty call, private property check. if need modify emit private properties check place. visitProperties is concerned emitting no*Typing props</technical_language>

Target:
private void visitProperties(ObjectType objType, boolean isStatic, Set<String> skipNames) { for (String propName : getSortedPropertyNames(objType)) { if (skipNames.contains(propName)) continue; if ("prototype".equals(propName) || "superClass_".equals(propName) || "constructor".equals(propName)) { continue; } visitProperty(propName, objType, isStatic); } }
Source:
<code>public boolean getWifiOnlySync() { <START> return mSharedPreferences.getBoolean(Pref.ENABLE_WIFI_SYNC_ONLY, false); <END> }</code><technical_language>this enabled default maybe? @dschuermann thoughts</technical_language>

Target:
public boolean getWifiOnlySync() { return mSharedPreferences.getBoolean(Pref.ENABLE_WIFI_SYNC_ONLY, true); }
Source:
<code>public void onCompletion(BlobInfo result, Exception exception) { ReadableStreamChannel response = null; try { restResponseChannel.setHeader(RestUtils.Headers.DATE, new GregorianCalendar().getTime()); if (exception == null && result != null) { <START> setBlobPropertiesResponseHeaders(result); <END> Map<String, String> userMetadata = RestUtils.buildUserMetadata(result.getUserMetadata()); if (userMetadata == null) { restResponseChannel.setHeader(RestUtils.Headers.CONTENT_TYPE, "application/octet-stream"); restResponseChannel.setHeader(RestUtils.Headers.CONTENT_LENGTH, result.getUserMetadata().length); response = new ByteBufferRSC(ByteBuffer.wrap(result.getUserMetadata())); } else { setUserMetadataHeaders(userMetadata, restResponseChannel); restResponseChannel.setHeader(RestUtils.Headers.CONTENT_LENGTH, 0); response = new ByteBufferRSC(MockBlobStorageService.EMPTY_BUFFER); } } else if (exception != null && exception instanceof RouterException) { exception = new RestServiceException(exception, RestServiceErrorCode.getRestServiceErrorCode(((RouterException) exception).getErrorCode())); } } catch (Exception e) { exception = exception == null ? e : exception; } finally { mockBlobStorageService.handleResponse(restRequest, restResponseChannel, response, exception); } }</code><technical_language>here. Remove user metadata out of HEAD. HEAD responses a body</technical_language>

Target:
public void onCompletion(BlobInfo result, Exception exception) { ReadableStreamChannel response = null; try { restResponseChannel.setHeader(RestUtils.Headers.DATE, new GregorianCalendar().getTime()); if (exception == null && result != null) { setBlobPropertiesResponseHeaders(result); } else if (exception != null && exception instanceof RouterException) { exception = new RestServiceException(exception, RestServiceErrorCode.getRestServiceErrorCode(((RouterException) exception).getErrorCode())); } } catch (Exception e) { exception = exception == null ? e : exception; } finally { mockBlobStorageService.handleResponse(restRequest, restResponseChannel, response, exception); } }
Source:
<code>public EnsembleProvider makeEnsembleProvider(CuratorConfig config, ExhibitorConfig exConfig) { if (exConfig.getHosts().isEmpty()) { return new FixedEnsembleProvider(config.getZkHosts()); } final Function<Void, Void> exitFunction = new Function<Void, Void>() { @Override public Void apply(Void aVoid) { log.error("Zookeeper can't be reached, forcefully stopping virtual machine..."); System.exit(1); return null; } }; return new ExhibitorEnsembleProvider( new Exhibitors( exConfig.getHosts(), exConfig.getRestPort(), newBackupProvider(config.getZkHosts()) ), new DefaultExhibitorRestClient(exConfig.getUseSsl()), exConfig.getRestUriPath(), exConfig.getPollingMs(), <START> config.getQuitOnConnectFail() ? new BoundedExponentialBackoffRetryWithQuit(exitFunction, BASE_SLEEP_TIME_MS, MAX_SLEEP_TIME_MS, MAX_RETRIES) : new BoundedExponentialBackoffRetry(BASE_SLEEP_TIME_MS, MAX_SLEEP_TIME_MS, MAX_RETRIES) <END> ) { @Override public void start() throws Exception { log.info("Poll the list of zookeeper servers for initial ensemble"); this.pollForInitialEnsemble(); super.start(); } }; }</code><technical_language>Line longer 120 cols. Extract a variable</technical_language>

Target:
public EnsembleProvider makeEnsembleProvider(CuratorConfig config, ExhibitorConfig exConfig) { if (exConfig.getHosts().isEmpty()) { return new FixedEnsembleProvider(config.getZkHosts()); } RetryPolicy retryPolicy; if (config.getTerminateDruidProcessOnConnectFail()) { final Runnable exitRunner = () -> { try { log.error("Zookeeper can't be reached, forcefully stopping virtual machine..."); } finally { System.exit(1); } }; retryPolicy = new BoundedExponentialBackoffRetryWithQuit( exitRunner, BASE_SLEEP_TIME_MS, MAX_SLEEP_TIME_MS, MAX_RETRIES ); } else { retryPolicy = new BoundedExponentialBackoffRetry(BASE_SLEEP_TIME_MS, MAX_SLEEP_TIME_MS, MAX_RETRIES); } return new ExhibitorEnsembleProvider( new Exhibitors( exConfig.getHosts(), exConfig.getRestPort(), newBackupProvider(config.getZkHosts()) ), new DefaultExhibitorRestClient(exConfig.getUseSsl()), exConfig.getRestUriPath(), exConfig.getPollingMs(), retryPolicy ) { @Override public void start() throws Exception { log.info("Poll the list of zookeeper servers for initial ensemble"); this.pollForInitialEnsemble(); super.start(); } }; }
Source:
<code>public ActionModeWrapper performGoBack() { onView(withId(R.id.action_mode_close_button)).perform(click()); <START> return this; <END> }</code><technical_language>i wouldnt return actionbar done anymore this object</technical_language>

Target:
public void performGoBack() { onView(NAVIGATE_UP_MATCHER).perform(click()); }
Source:
<code>private void <START> setToolbarForCurrentFragment() <END> { Fragment fragment = ((NavTabViewPagerAdapter) viewPager.getAdapter()).getCurrentFragment(); if (fragment instanceof MainActivityToolbarProvider) { getAppCompatActivity().setSupportActionBar(((MainActivityToolbarProvider) fragment).getToolbar()); toolbarContainer.setVisibility(View.GONE); } else { toolbarContainer.setVisibility(View.VISIBLE); getAppCompatActivity().setSupportActionBar(toolbar); } getAppCompatActivity().getSupportActionBar().setDisplayHomeAsUpEnabled(false); if (fragment instanceof HistoryFragment) { toolbar.setTitle(R.string.nav_item_history); } else if (fragment instanceof ReadingListsFragment) { toolbar.setTitle(R.string.nav_item_reading_lists); } else if (fragment instanceof NearbyFragment) { toolbar.setTitle(R.string.nav_item_nearby); } }</code><technical_language>consider another placement for this method? in OverhaulActivity wants do action bar in NavTabViewPagerAdapter wants do current tab? if fill moment I do implementer of MainActivityToolbarProvider a good time move around. callback for OverhaulActivity approach like: public interface Callback { void onTab(@NonNull NavTab tab); } private onTab(@NonNull NavTab tab) { Callback callback = callback(); if (callback != null) { callback.onTab(tab); } } @Nullable private Callback callback() { return FragmentUtil.getCallback(this, Callback.class); } private class NavTabChangeListener extends ViewPager.SimpleOnPageChangeListener { @Override public void onPageSelected(int pos) { onTab(NavTab.of(pos)); } }</technical_language>

Target:
private void setToolbarForCurrentFragment() { Fragment fragment = ((NavTabViewPagerAdapter) viewPager.getAdapter()).getCurrentFragment(); if (fragment instanceof MainActivityToolbarProvider) { getAppCompatActivity().setSupportActionBar(((MainActivityToolbarProvider) fragment).getToolbar()); toolbarContainer.setVisibility(View.GONE); } else { toolbarContainer.setVisibility(View.VISIBLE); getAppCompatActivity().setSupportActionBar(toolbar); } getAppCompatActivity().getSupportActionBar().setDisplayHomeAsUpEnabled(false); }
Source:
<code>protected DataInfo buildInference(float confidenceLevel, String inferenceProvenance) throws TrustLevelThresholdExceededException { <START> float currentTrustLevel = new ConfidenceLevelConverter().convertToTrustLevel(confidenceLevel); <END> if (trustLevelThreshold == null || currentTrustLevel >= trustLevelThreshold) { if (StringUtils.isNotBlank(inferenceProvenance)) { return buildInferenceForTrustLevel(BuilderModuleHelper.getDecimalFormat().format(currentTrustLevel), inferenceProvenance); } else { return buildInferenceForTrustLevel(BuilderModuleHelper.getDecimalFormat().format(currentTrustLevel)); } } else { throw new TrustLevelThresholdExceededException(); } }</code><technical_language>static method in similar cases. If agree rely a static conversion factor need instantiate immutable object for a simple task</technical_language>

Target:
protected DataInfo buildInference(float confidenceLevel, String inferenceProvenance) throws TrustLevelThresholdExceededException { float currentTrustLevel = ConfidenceAndTrustLevelConversionUtils.confidenceLevelToTrustLevel(confidenceLevel); if (trustLevelThreshold == null || currentTrustLevel >= trustLevelThreshold) { if (StringUtils.isNotBlank(inferenceProvenance)) { return buildInferenceForTrustLevel(BuilderModuleHelper.getDecimalFormat().format(currentTrustLevel), inferenceProvenance); } else { return buildInferenceForTrustLevel(BuilderModuleHelper.getDecimalFormat().format(currentTrustLevel)); } } else { throw new TrustLevelThresholdExceededException(); } }
Source:
<code>public void onEventMainThread(DiscussionCommentPostedEvent event) { if (!hasMorePages) { if (null != event.getParent() && event.getParent().getIdentifier().equals(discussionResponse.getIdentifier())) { <START> ((BaseFragmentActivity)getActivity()).showInfoMessage(getString(R.string.discussion_comment_posted)); <END> discussionCommentsAdapter.insertCommentAtEnd(event.getComment()); discussionCommentsListView.smoothScrollToPosition(discussionCommentsAdapter.getItemCount() - 1); } } }</code><technical_language>message shown if more pages load yet. In fact, is scenario needs shown :stuck_out_tongue: If item is displayed, dispense it</technical_language>

Target:
public void onEventMainThread(DiscussionCommentPostedEvent event) { if (null != event.getParent() && event.getParent().getIdentifier().equals(discussionResponse.getIdentifier())) { ((BaseFragmentActivity) getActivity()).showInfoMessage(getString(R.string.discussion_comment_posted)); if (!hasMorePages) { discussionCommentsAdapter.insertCommentAtEnd(event.getComment()); discussionCommentsListView.smoothScrollToPosition(discussionCommentsAdapter.getItemCount() - 1); } } }
Source:
<code>public boolean compatibleWith(Version that) { if (that == null) return false; String[] thisParts = this.version.split("\\."); String[] thatParts = that.version.split("\\."); int length = Math.max(thisParts.length, thatParts.length); for (int i = 0; i < length; i++) { int thisPart = i < thisParts.length ? Integer.parseInt(thisParts[i]) : 0; int thatPart = i < thatParts.length ? Integer.parseInt(thatParts[i]) : 0; switch (i) { case 0: { if (thisPart != thatPart) return false; <START> } <END> case 1: { if (thisPart < thatPart) return false; } case 2: { } } } return true; }</code><technical_language>Note Java switch statements fall hit a return a break. So, if major case (0) is hit, parts equal, fall execute code in minor case (1). Now... impossible for a part == > time, patch case (2) is empty, this logic works as-written, but... _looks_ a bug, I in order show intent, a break end of case 0 case 1</technical_language>

Target:
public boolean compatibleWith(Version that) { if (that == null) return false; String[] thisParts = this.version.split("\\."); String[] thatParts = that.version.split("\\."); int length = Math.max(thisParts.length, thatParts.length); for (int i = 0; i < length; i++) { int thisPart = i < thisParts.length ? Integer.parseInt(thisParts[i]) : 0; int thatPart = i < thatParts.length ? Integer.parseInt(thatParts[i]) : 0; switch (i) { case 0: { if (thisPart != thatPart) return false; } break; case 1: { if (thisPart < thatPart) return false; } break; case 2: { } break; } } return true; }
Source:
<code>public void enableWifiConnectivityManager(boolean enabled) { enforceConnectivityInternalPermission(); <START> mLog.trace("enableWifiConnectivityManager uid=%").c(Binder.getCallingUid()).flush(); <END> mWifiStateMachine.enableWifiConnectivityManager(enabled); }</code><technical_language>param</technical_language>

Target:
public void enableWifiConnectivityManager(boolean enabled) { enforceConnectivityInternalPermission(); mLog.trace("enableWifiConnectivityManager uid=% enabled=%") .c(Binder.getCallingUid()) .c(enabled ? "true" : "false").flush(); mWifiStateMachine.enableWifiConnectivityManager(enabled); }
Source:
<code>private void updatePortDecoration() { if (portWarningDecorator == null) { Image fieldDecorationWarningImage = FieldDecorationRegistry.getDefault() .getFieldDecoration(FieldDecorationRegistry.DEC_WARNING).getImage(); portWarningDecorator = new ControlDecoration(portText.getTextControl(), SWT.RIGHT | SWT.CENTER); portWarningDecorator.setMarginWidth(1); portWarningDecorator.setImage(fieldDecorationWarningImage); portWarningDecorator.setDescriptionText(Messages.getString("CassandraConnForm.port.instruction")); } if (CassandraConnectionUtil.isOldVersion(getConnection())) { portWarningDecorator.hide(); } else { portWarningDecorator.show(); } String dbVersion = getConnection().getAttributes().get(INoSQLCommonAttributes.DB_VERSION); <START> if (ICassandraConstants.DBVERSIONS[2].equals(dbVersion)) { <END> if (ICassandraConstants.API_TYPES[0].equals(repositoryTranslator.getLabel(apiTypeCombo.getText()))) { portText.setText(ICassandraConstants.DATASTAX_PORT); } else { portText.setText(ICassandraConstants.DEFAULT_PORT); } } else if (ICassandraConstants.DBVERSIONS[0].equals(dbVersion) || ICassandraConstants.DBVERSIONS[1].equals(dbVersion)) { portText.setText(ICassandraConstants.DATASTAX_PORT); } else { portText.setText(ICassandraConstants.DEFAULT_PORT); } }</code><technical_language>constant instead of index</technical_language>

Target:
private void updatePortDecoration() { if (portWarningDecorator == null) { Image fieldDecorationWarningImage = FieldDecorationRegistry.getDefault() .getFieldDecoration(FieldDecorationRegistry.DEC_WARNING).getImage(); portWarningDecorator = new ControlDecoration(portText.getTextControl(), SWT.RIGHT | SWT.CENTER); portWarningDecorator.setMarginWidth(1); portWarningDecorator.setImage(fieldDecorationWarningImage); portWarningDecorator.setDescriptionText(Messages.getString("CassandraConnForm.port.instruction")); } if (CassandraConnectionUtil.isOldVersion(getConnection())) { portWarningDecorator.hide(); } else { portWarningDecorator.show(); } String dbVersion = getConnection().getAttributes().get(INoSQLCommonAttributes.DB_VERSION); if (ICassandraConstants.DB_VERSION_CASSANDRA_2_0_0.equals(dbVersion)) { if (ICassandraConstants.API_TYPE_DATASTAX.equals(repositoryTranslator.getLabel(apiTypeCombo.getText()))) { portText.setText(ICassandraConstants.DATASTAX_PORT); } else { portText.setText(ICassandraConstants.DEFAULT_PORT); } } else if (ICassandraConstants.DB_VERSION_CASSANDRA_3_0.equals(dbVersion) || ICassandraConstants.DB_VERSION_CASSANDRA_2_2.equals(dbVersion)) { portText.setText(ICassandraConstants.DATASTAX_PORT); } else { portText.setText(ICassandraConstants.DEFAULT_PORT); } }
Source:
<code>public HttpTraceImportOperation(String sourceUrl, TmfTraceFolder destFolder) { fSourceUrl = new ArrayList<>(); <START> fSourceUrl.add(sourceUrl); <END> fDestinationFolder = destFolder; }</code><technical_language>Collections.singletonList</technical_language>

Target:
public HttpTraceImportOperation(String sourceUrl, TmfTraceFolder destFolder) { fSourceUrl = Collections.singletonList(sourceUrl); fDestinationFolder = destFolder; }
Source:
<code>protected IJavaElement[] filter(IJavaElement[] children) { boolean initializers= false; for (IJavaElement child : children) { if (matches(child)) { initializers= true; break; } } if (!initializers) return children; ArrayList<IJavaElement> v= new ArrayList<>(); for (IJavaElement child : children) { if (matches(child)) { continue; } v.add(child); } IJavaElement[] result= new IJavaElement[v.size()]; v.toArray(result); <START> return result; <END> }</code><technical_language>This be: return "v.toArray(new IJavaElement[0])"</technical_language>

Target:
protected IJavaElement[] filter(IJavaElement[] children) { boolean initializers= false; for (IJavaElement child : children) { if (matches(child)) { initializers= true; break; } } if (!initializers) return children; ArrayList<IJavaElement> v= new ArrayList<>(); for (IJavaElement child : children) { if (matches(child)) { continue; } v.add(child); } return v.toArray(new IJavaElement[v.size()]); }
Source:
<code>public void cleanup() throws DBException { <START> super.cleanup(); <END> synchronized (RocksDBClient.class) { try { if (references == 1) { for (final ColumnFamily cf : COLUMN_FAMILIES.values()) { cf.getHandle().close(); } rocksDb.close(); rocksDb = null; dbOptions.close(); dbOptions = null; for (final ColumnFamily cf : COLUMN_FAMILIES.values()) { cf.getOptions().close(); } saveColumnFamilyNames(); COLUMN_FAMILIES.clear(); rocksdbDir = null; } } catch (final IOException e) { throw new DBException(e); } finally { references--; } } }</code><technical_language>AIUI cfNames cfOptionss elements together. Consider explicitly storing a Tuple</technical_language>

Target:
public void cleanup() throws DBException { super.cleanup(); synchronized (RocksDBClient.class) { try { if (references == 1) { for (final ColumnFamily cf : COLUMN_FAMILIES.values()) { cf.getHandle().close(); } rocksDb.close(); rocksDb = null; dbOptions.close(); dbOptions = null; for (final ColumnFamily cf : COLUMN_FAMILIES.values()) { cf.getOptions().close(); } saveColumnFamilyNames(); COLUMN_FAMILIES.clear(); rocksDbDir = null; } } catch (final IOException e) { throw new DBException(e); } finally { references--; } } }
Source:
<code>private List<ResolveInfo> filterResolvedServices(List<ResolveInfo> resolveInfoList, int flags) { if ((flags & PackageManager.MATCH_ALL) == PackageManager.MATCH_ALL) { return resolveInfoList; } resolveInfoList = new ArrayList<>(resolveInfoList); <START> for (Iterator<ResolveInfo> iterator = resolveInfoList.iterator(); iterator.hasNext();) { <END> ResolveInfo resolveInfo = iterator.next(); if ((flags & PackageManager.MATCH_SYSTEM_ONLY) == PackageManager.MATCH_SYSTEM_ONLY) { if (resolveInfo.serviceInfo == null || resolveInfo.serviceInfo.applicationInfo == null) { iterator.remove(); } else { final int applicationFlags = resolveInfo.serviceInfo.applicationInfo.flags; if ((applicationFlags & ApplicationInfo.FLAG_SYSTEM) != ApplicationInfo.FLAG_SYSTEM) { iterator.remove(); } } } else if (((flags & PackageManager.MATCH_DISABLED_COMPONENTS) != PackageManager.MATCH_DISABLED_COMPONENTS) && isValidComponentInfo(resolveInfo.serviceInfo)) { ComponentName componentName = new ComponentName( resolveInfo.serviceInfo.applicationInfo.packageName, resolveInfo.serviceInfo.name); if ((getComponentEnabledSetting(componentName) & PackageManager.COMPONENT_ENABLED_STATE_DISABLED) != 0) { iterator.remove(); } } } return resolveInfoList; }</code><technical_language>worth extracting a method isFlagSet(int flags, int flag) - call</technical_language>

Target:
private List<ResolveInfo> filterResolvedServices(List<ResolveInfo> resolveInfoList, int flags) { if (isFlagSet(flags, PackageManager.MATCH_ALL)) { return resolveInfoList; } resolveInfoList = new ArrayList<>(resolveInfoList); for (Iterator<ResolveInfo> iterator = resolveInfoList.iterator(); iterator.hasNext(); ) { ResolveInfo resolveInfo = iterator.next(); if (isFlagSet(flags, PackageManager.MATCH_SYSTEM_ONLY)) { if (resolveInfo.serviceInfo == null || resolveInfo.serviceInfo.applicationInfo == null) { iterator.remove(); } else { final int applicationFlags = resolveInfo.serviceInfo.applicationInfo.flags; if ((applicationFlags & ApplicationInfo.FLAG_SYSTEM) != ApplicationInfo.FLAG_SYSTEM) { iterator.remove(); } } } else if (!isFlagSet(flags, PackageManager.MATCH_DISABLED_COMPONENTS) && resolveInfo != null && isValidComponentInfo(resolveInfo.serviceInfo)) { ComponentName componentName = new ComponentName( resolveInfo.serviceInfo.applicationInfo.packageName, resolveInfo.serviceInfo.name); if ((getComponentEnabledSetting(componentName) & PackageManager.COMPONENT_ENABLED_STATE_DISABLED) != 0) { iterator.remove(); } } } return resolveInfoList; }
Source:
<code>private Mono<Response<BlockBlobItem>> determineUploadFullOrChunked(final Flux<ByteBuffer> data, final Function<Flux<ByteBuffer>, Mono<Response<BlockBlobItem>>> uploadInChunks, final BiFunction<Flux<ByteBuffer>, Long, Mono<Response<BlockBlobItem>>> uploadFullBlob) { final long chunkedUploadRequirement = 4 * Constants.MB; final long[] bufferedDataSize = {0}; final LinkedList<ByteBuffer> cachedBuffers = new LinkedList<>(); return data .windowUntil(buffer -> { if (bufferedDataSize[0] > chunkedUploadRequirement) { return false; } else { bufferedDataSize[0] += buffer.remaining(); if (bufferedDataSize[0] > chunkedUploadRequirement) { return true; } else { ByteBuffer cachedBuffer = ByteBuffer.allocate(buffer.remaining()).put(buffer); <START> cachedBuffer.position(0); <END> cachedBuffers.add(cachedBuffer); return false; } } }, true) .buffer(2) .next() .flatMap(fluxes -> { if (fluxes.size() == 1) { return uploadFullBlob.apply(Flux.fromIterable(cachedBuffers), bufferedDataSize[0]); } else { return uploadInChunks.apply(dequeuingFlux(cachedBuffers).concatWith(fluxes.get(1))); } }); }</code><technical_language>Consider cachedBuffer.flip() instead. updates state of a - limit, mark position relevant downstream</technical_language>

Target:
private Mono<Response<BlockBlobItem>> determineUploadFullOrChunked(final Flux<ByteBuffer> data, final Function<Flux<ByteBuffer>, Mono<Response<BlockBlobItem>>> uploadInChunks, final BiFunction<Flux<ByteBuffer>, Long, Mono<Response<BlockBlobItem>>> uploadFullBlob) { final long[] bufferedDataSize = {0}; final LinkedList<ByteBuffer> cachedBuffers = new LinkedList<>(); return data .filter(ByteBuffer::hasRemaining) .windowUntil(buffer -> { if (bufferedDataSize[0] > CHUNKED_UPLOAD_REQUIREMENT) { return false; } else { bufferedDataSize[0] += buffer.remaining(); if (bufferedDataSize[0] > CHUNKED_UPLOAD_REQUIREMENT) { return true; } else { ByteBuffer cachedBuffer = ByteBuffer.allocate(buffer.remaining()).put(buffer); cachedBuffer.flip(); cachedBuffers.add(cachedBuffer); return false; } } }, true) .buffer(2) .next() .flatMap(fluxes -> { if (fluxes.size() == 1) { return uploadFullBlob.apply(Flux.fromIterable(cachedBuffers), bufferedDataSize[0]); } else { return uploadInChunks.apply(dequeuingFlux(cachedBuffers).concatWith(fluxes.get(1))); } }) .switchIfEmpty(uploadFullBlob.apply(Flux.empty(), 0L)); }
Source:
<code>public void testContinuousUnary() { Expression expression = new Expression("++1"); <START> Assert.assertEquals(expression.eval().intValue(), 1); <END> expression = new Expression("--1"); Assert.assertEquals(expression.eval().intValue(), 1); expression = new Expression("+-1"); Assert.assertEquals(expression.eval().intValue(), -1); expression = new Expression("-+1"); Assert.assertEquals(expression.eval().intValue(), -1); expression = new Expression("1-+1"); Assert.assertEquals(expression.eval().intValue(), 0); }</code><technical_language>expected/actual arguments swapped tests</technical_language>

Target:
public void testContinuousUnary() { Expression expression = new Expression("++1"); Assert.assertEquals(1, expression.eval().intValue()); expression = new Expression("--1"); Assert.assertEquals(1, expression.eval().intValue()); expression = new Expression("+-1"); Assert.assertEquals(-1, expression.eval().intValue()); expression = new Expression("-+1"); Assert.assertEquals(-1, expression.eval().intValue()); expression = new Expression("1-+1"); Assert.assertEquals(0, expression.eval().intValue()); expression = new Expression("-+---+++--++-1"); Assert.assertEquals(-1, expression.eval().intValue()); expression = new Expression("1--++++---2+-+----1"); Assert.assertEquals(-2, expression.eval().intValue()); }
Source:
<code>private static void dumpRecord(AAAServiceImpl module, ExtMap extMap, List<ExtKey> ignore, String title, String indent) { if (extMap != null) { log.debug("{}{}: {}", indent, title, extMap); <START> Collection<ExtKey> keys = new HashSet(extMap.keySet()); <END> if (module.argModuleMap.get("key") != null) { Collection<ExtKey> k = new HashSet<>(); for (String uuid : (List<String>)module.argModuleMap.get("key")) { k.add(new ExtKey("Unknown", Object.class, uuid)); } keys.retainAll(k); } for (ExtKey key : keys) { if (ignore.contains(key)) { continue; } if ((key.getFlags() & ExtKey.Flags.SKIP_DUMP) != 0) { continue; } module.output( ((String)module.argModuleMap.get("format")).replace( "{key}", key.getUuid().getUuid().toString() ).replace( "{name}", key.getUuid().getName() ).replace( "{value}", (key.getFlags() & ExtKey.Flags.SENSITIVE) != 0 ? "***" : extMap.get(key).toString() ), indent ); } } }</code><technical_language>This generate a new unchecked assignment warning. diamond: Collection<ExtKey> keys = new HashSet<>(...);</technical_language>

Target:
private static void dumpRecord(AAAServiceImpl module, ExtMap extMap, List<ExtKey> ignore, String title, String indent) { if (extMap != null) { log.debug("{}{}: {}", indent, title, extMap); Collection<ExtKey> keys = new HashSet<>(extMap.keySet()); if (module.argModuleMap.get("key") != null) { Collection<ExtKey> k = new HashSet<>(); for (String uuid : (List<String>)module.argModuleMap.get("key")) { k.add(new ExtKey("Unknown", Object.class, uuid)); } keys.retainAll(k); } for (ExtKey key : keys) { if (ignore.contains(key)) { continue; } if ((key.getFlags() & ExtKey.Flags.SKIP_DUMP) != 0) { continue; } module.output( ((String)module.argModuleMap.get("format")).replace( "{key}", key.getUuid().getUuid().toString() ).replace( "{name}", key.getUuid().getName() ).replace( "{value}", (key.getFlags() & ExtKey.Flags.SENSITIVE) != 0 ? "***" : extMap.get(key).toString() ), indent ); } } }
Source:
<code>public void returnsCorrectLengthWithTempFile() throws Exception { final byte[] bytes = new Utf8String("TempFile returnsCorrectLength!").asBytes(); MatcherAssert.assertThat( <START> "TempFile doesn't provide correct number of bytes", <END> new LengthOf( new Body.TempFile(new Body.ByteArray(bytes)) ).intValue(), new IsEqual<>(bytes.length) ); }</code><technical_language>@Serranya here. above</technical_language>

Target:
public void returnsCorrectLengthWithTempFile() throws Exception { final byte[] bytes = new Utf8String("TempFile returnsCorrectLength!").asBytes(); MatcherAssert.assertThat( "Body content of Body.TempFile doesn't have the correct length", new LengthOf( new Body.TempFile(new Body.ByteArray(bytes)) ).intValue(), new IsEqual<>(bytes.length) ); }
Source:
<code>void assertArrayEqualsDifferentNestedObjectArrays() { try { assertArrayEquals( new Object[] { 1, 2, new Object[] { 3, new Object[] { 4, new boolean[] { false, true } } } }, new Object[] { 1, 2, new Object[] { 3, new Object[] { 4, new boolean[] { true, false } } } }); expectAssertionFailedError(); } catch (AssertionFailedError ex) { assertMessageEquals(ex, "array contents differ at index [2][1][1][0], expected: <false> but was: <true>"); } Object[] differentElement = new Object[] {}; try { assertArrayEquals(new Object[] { 1, 2, 3, new Object[] { new Object[] { 4, new Object[] { 5 } } } }, new Object[] { 1, 2, 3, new Object[] { new Object[] { 4, new Object[] { differentElement } } } }); expectAssertionFailedError(); } catch (AssertionFailedError ex) { assertMessageEquals(ex, "array contents differ at index [3][0][1][0], expected: <5> but was: <" <START> + Arrays.toString(differentElement) + ">"); <END> } }</code><technical_language>I more explicit "hard-code" in this case, it? java assertMessageEquals(ex, "array contents differ index [3][0][1][0], expected: <5> was: <[]>");</technical_language>

Target:
void assertArrayEqualsDifferentNestedObjectArrays() { try { assertArrayEquals( new Object[] { 1, 2, new Object[] { 3, new Object[] { 4, new boolean[] { false, true } } } }, new Object[] { 1, 2, new Object[] { 3, new Object[] { 4, new boolean[] { true, false } } } }); expectAssertionFailedError(); } catch (AssertionFailedError ex) { assertMessageEquals(ex, "array contents differ at index [2][1][1][0], expected: <false> but was: <true>"); } try { assertArrayEquals(new Object[] { 1, 2, 3, new Object[] { new Object[] { 4, new Object[] { 5 } } } }, new Object[] { 1, 2, 3, new Object[] { new Object[] { 4, new Object[] { new Object[] } } } }); expectAssertionFailedError(); } catch (AssertionFailedError ex) { assertMessageEquals(ex, "array contents differ at index [3][0][1][0], expected: <5> but was: <[]>"); } }
Source:
<code>public V get(Object key) { V value = super.get(key); if (value == null) { try { Thread.dumpStack(); value = loadFromCacheLoader((K) key); <START> System.out.println(String.format("foobar k: %s v: %s ", key, value)); <END> } catch (ClassCastException ex) { } } return value; }</code><technical_language>this too</technical_language>

Target:
public V get(Object key) { V value = super.get(key); if (value == null) { try { value = loadFromCacheLoader((K) key); } catch (ClassCastException ex) { } } return value; }
Source:
<code><START> public void executeCommand() { <END> boolean mergeSucceeded = false; try { VDSReturnValue vdsReturnValue = runVdsCommand(VDSCommandType.Merge, createVDSParameters()); if (vdsReturnValue.getSucceeded()) { Guid jobId = (Guid) vdsReturnValue.getReturnValue(); persistBlockJobPlaceholder(jobId); getParameters().setVmJobId(jobId); persistCommand(getParameters().getParentCommand(), true); log.debug("Merge started successfully"); mergeSucceeded = true; } else { log.error("Failed to start Merge on VDS"); } } catch (EngineException e) { log.error("Engine exception thrown while sending merge command", e); if (e.getErrorCode() == EngineError.imageErr || e.getErrorCode() == EngineError.mergeErr) { mergeSucceeded = true; } } finally { if (mergeSucceeded) { setSucceeded(true); } else { setCommandStatus(CommandStatus.FAILED); } } }</code><technical_language>supposed force deletion of snapshot</technical_language>

Target:
public void executeCommand() { boolean mergeRunning = false; try { VDSReturnValue vdsReturnValue = runVdsCommand(VDSCommandType.Merge, createVDSParameters()); if (vdsReturnValue.getSucceeded()) { Guid jobId = (Guid) vdsReturnValue.getReturnValue(); persistBlockJobPlaceholder(jobId); getParameters().setVmJobId(jobId); persistCommand(getParameters().getParentCommand(), true); log.debug("Merge started successfully"); mergeRunning = true; } else { log.error("Failed to start Merge on VDS"); } } catch (EngineException e) { log.error("Engine exception thrown while sending merge command", e); if (e.getErrorCode() == EngineError.imageErr || e.getErrorCode() == EngineError.mergeErr) { mergeRunning = true; } } finally { if (mergeRunning) { setSucceeded(true); } else { setCommandStatus(CommandStatus.FAILED); } } }
Source:
<code>getMrrtReportTemplates_shouldReturnAllMrrtReportTemplatesThatMatchGivenLicenseAnywhereInDctermsLicenseInsensitiveToCase() throws Exception { MrrtReportTemplateSearchCriteria searchCriteria = new MrrtReportTemplateSearchCriteria.Builder().withLicense(EXISTING_TEMPLATE_LICENSE) .build(); List<MrrtReportTemplate> templates = mrrtReportTemplateService.getMrrtReportTemplates(searchCriteria); assertNotNull(templates); assertThat(templates.size(), is(1)); assertThat(templates.get(0) .getDcTermsLicense(), <START> is("General Public License")); <END> searchCriteria = new MrrtReportTemplateSearchCriteria.Builder().withLicense("public") .build(); templates = mrrtReportTemplateService.getMrrtReportTemplates(searchCriteria); List<String> licenses = new ArrayList<>(); templates.forEach(template -> licenses.add(template.getDcTermsLicense())); assertNotNull(licenses); assertThat(licenses.size(), is(2)); assertTrue(licenses.contains("Mozilla Public License")); assertTrue(licenses.contains("General Public License")); }</code><technical_language>dont constant EXISTING_TEMPLATE_LICENSE</technical_language>

Target:
getMrrtReportTemplates_shouldReturnAllMrrtReportTemplatesThatMatchGivenLicenseAnywhereInDctermsLicenseInsensitiveToCase() throws Exception { MrrtReportTemplateSearchCriteria searchCriteria = new MrrtReportTemplateSearchCriteria.Builder().withLicense(EXISTING_TEMPLATE_LICENSE) .build(); List<MrrtReportTemplate> templates = mrrtReportTemplateService.getMrrtReportTemplates(searchCriteria); assertNotNull(templates); assertThat(templates.size(), is(1)); assertThat(templates.get(0) .getDcTermsLicense(), is(EXISTING_TEMPLATE_LICENSE)); searchCriteria = new MrrtReportTemplateSearchCriteria.Builder().withLicense("public") .build(); templates = mrrtReportTemplateService.getMrrtReportTemplates(searchCriteria); List<String> licenses = new ArrayList<>(); templates.forEach(template -> licenses.add(template.getDcTermsLicense())); assertNotNull(licenses); assertThat(licenses.size(), is(2)); assertThat(licenses, hasItem("Mozilla Public License")); assertThat(licenses, hasItem("General Public License")); }
Source:
<code>private static ProxyConfiguration asProxyConfiguration(OxdServerConfiguration configuration) { try { JsonNode node = configuration.getProxyConfiguration(); if (node != null) { return Jackson2.createJsonMapper().treeToValue(node, ProxyConfiguration.class); } } catch (Exception e) { LOG.error("Failed to parse ProxyConfiguration.", e); } <START> return new ProxyConfiguration(); <END> }</code><technical_language>return null handle it. Optional<ProxyConfiguration></technical_language>

Target:
private static Optional<ProxyConfiguration> asProxyConfiguration(OxdServerConfiguration configuration) { try { JsonNode node = configuration.getProxyConfiguration(); if (node != null) { return Optional.ofNullable(Jackson2.createJsonMapper().treeToValue(node, ProxyConfiguration.class)); } } catch (Exception e) { LOG.error("Failed to parse ProxyConfiguration.", e); } return Optional.empty(); }
Source:
<code>public TmfExperiment(final Class<? extends ITmfEvent> type, final String path, final ITmfTrace[] traces, final int indexPageSize, IResource resource) { setCacheSize(indexPageSize); setStreamingInterval(0); setIndexer(new TmfCheckpointIndexer(this, indexPageSize)); setParser(this); try { super.initialize(resource, path, type); } catch (TmfTraceException e) { e.printStackTrace(); } fTraces = traces; if (resource != null) { try { this.synchronizeTraces(); } catch (TmfTraceException e) { <START> e.printStackTrace(); <END> } } }</code><technical_language>e.printStackTrace(). logged properly. I "we" done right :-(</technical_language>

Target:
public TmfExperiment(final Class<? extends ITmfEvent> type, final String path, final ITmfTrace[] traces, final int indexPageSize, IResource resource) { setCacheSize(indexPageSize); setStreamingInterval(0); setIndexer(new TmfCheckpointIndexer(this, indexPageSize)); setParser(this); try { super.initialize(resource, path, type); } catch (TmfTraceException e) { e.printStackTrace(); } fTraces = traces; if (resource != null) { try { this.synchronizeTraces(); } catch (TmfTraceException e) { Activator.logError("Error synchronizing experiment", e); } } }
Source:
<code>public AuthenticationManagerResolver<HttpServletRequest> resolver() { return request -> { if (request .getPathInfo() .startsWith("/employee")) <START> return employeesAuthenticationManager(); <END> return customersAuthenticationManager(); }; }</code><technical_language>add curly braces</technical_language>

Target:
public AuthenticationManagerResolver<HttpServletRequest> resolver() { return request -> { if (request .getPathInfo() .startsWith("/employee")) { return employeesAuthenticationManager(); } return customersAuthenticationManager(); }; }
Source:
<code>public long getSizeInBytes() { <START> return INSTANCE_SIZE + IMMUTABLE_LIST_HEADER_SIZE + OBJECT_ARRAY_LIST_INSTANCE_SIZE * channels.size() + <END> channels.stream() .flatMap(List::stream) .mapToLong(Block::getRetainedSizeInBytes) .sum(); }</code><technical_language>format this categorize types of overhead. return INSTANCE_SIZE + IMMUTABLE_LIST_HEADER_SIZE + OBJECT_ARRAY_LIST_INSTANCE_SIZE * channels.size() + channels.stream() .flatMap(List::stream) .mapToLong(Block::getRetainedSizeInBytes) .sum();</technical_language>

Target:
public long getSizeInBytes() { return INSTANCE_SIZE + channels.stream() .flatMap(List::stream) .mapToLong(Block::getRetainedSizeInBytes) .sum(); }
Source:
<code>private String getDeserializerPackageName(JArrayType targetType) { final String compSerializer = serializerCreator.serializerFor(targetType.getComponentType()); <START> if (compSerializer.startsWith(CUSTOM_SERIALIZER_PACKAGE)) <END> return CUSTOM_SERIALIZER_PACKAGE; else return ProxyCreator.synthesizeTopLevelClassName(targetType, DSER_SUFFIX)[0]; }</code><technical_language>stupid, sufficient place ResultDeserializer in package component's JsonSerializer</technical_language>

Target:
private String getDeserializerPackageName(JArrayType targetType) { final String compSerializer = serializerCreator.serializerFor(targetType.getComponentType()); final int end = compSerializer.lastIndexOf('.'); return end >= 0 ? compSerializer.substring(0, end) : ""; }
Source:
<code>public void checkoutEntry(File f, DirCacheEntry entry, boolean config_filemode) throws IOException { ObjectLoader ol = repo.open(entry.getObjectId()); if (ol == null) throw new MissingObjectException(entry.getObjectId(), Constants.TYPE_BLOB); byte[] bytes = ol.getCachedBytes(); File parentDir = f.getParentFile(); File tmpFile = java.io.File <START> .createTempFile("__"+f.getName(), null, parentDir); <END> FileChannel channel = new FileOutputStream(tmpFile).getChannel(); ByteBuffer buffer = ByteBuffer.wrap(bytes); try { int j = channel.write(buffer); if (j != bytes.length) throw new IOException(MessageFormat.format( JGitText.get().couldNotWriteFile, tmpFile)); } finally { channel.close(); } FS fs = repo.getFS(); if (config_filemode && fs.supportsExecute()) { if (FileMode.EXECUTABLE_FILE.equals(entry.getRawMode())) { if (!fs.canExecute(tmpFile)) fs.setExecute(tmpFile, true); } else { if (fs.canExecute(tmpFile)) fs.setExecute(tmpFile, false); } } if (!tmpFile.renameTo(f)) { f.delete(); if (!tmpFile.renameTo(f)) { throw new IOException(MessageFormat.format( JGitText.get().couldNotWriteFile, tmpFile.getPath(), f.getPath())); } } entry.setLastModified(f.lastModified()); entry.setLength((int) ol.getSize()); }</code><technical_language>Style-nit: File.createTempFile() sufficient import java.io.File here. prefer spaces operators +. Finally, "._" instead prefix? temporary file is hidden view a user is ls time a checkout is occurring</technical_language>

Target:
public void checkoutEntry(File f, DirCacheEntry entry, boolean config_filemode) throws IOException { ObjectLoader ol = repo.open(entry.getObjectId()); if (ol == null) throw new MissingObjectException(entry.getObjectId(), Constants.TYPE_BLOB); byte[] bytes = ol.getCachedBytes(); File parentDir = f.getParentFile(); File tmpFile = File.createTempFile("__"+f.getName(), null, parentDir); FileChannel channel = new FileOutputStream(tmpFile).getChannel(); ByteBuffer buffer = ByteBuffer.wrap(bytes); try { int j = channel.write(buffer); if (j != bytes.length) throw new IOException(MessageFormat.format( JGitText.get().couldNotWriteFile, tmpFile)); } finally { channel.close(); } FS fs = repo.getFS(); if (config_filemode && fs.supportsExecute()) { if (FileMode.EXECUTABLE_FILE.equals(entry.getRawMode())) { if (!fs.canExecute(tmpFile)) fs.setExecute(tmpFile, true); } else { if (fs.canExecute(tmpFile)) fs.setExecute(tmpFile, false); } } if (!tmpFile.renameTo(f)) { f.delete(); if (!tmpFile.renameTo(f)) { throw new IOException(MessageFormat.format( JGitText.get().couldNotWriteFile, tmpFile.getPath(), f.getPath())); } } entry.setLastModified(f.lastModified()); entry.setLength((int) ol.getSize()); }