auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code><START> public static File getFile(Object source, String filename) throws IOException { <END> Class<?> clazz = (source instanceof Class<?>) ? (Class<?>) source : source.getClass(); if (Platform.isRunning()) { ClassLoader classLoader = clazz.getClassLoader(); if (classLoader.getClass().getName().equals("org.eclipse.osgi.internal.loader.ModuleClassLoader")) { return getFileFromClassLoader4Luna(filename, classLoader); } else if (classLoader.getClass() .getName() .equals("org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader")) { return getFileFromClassLoaderBeforeLuna(filename, classLoader); } } else { URL localURL = clazz.getResource(""); String path = URLDecoder.decode(localURL.getFile(), Charset.defaultCharset().name()); int i = path.indexOf("!"); if (i != -1) { int j = path.lastIndexOf(File.separatorChar, i); if (j != -1) { path = path.substring(0, j) + File.separator; } else { throw new AssertionFailedError("Unable to determine location for '" + filename + "' at '" + path + "'"); } if (path.startsWith("file:")) { path = path.substring(5); } return new File(path + filename); } else { String directory = clazz.getName().replaceAll("[^.]", ""); directory = directory.replaceAll(".", "../"); if (path.contains("/bin/")) { directory += "../"; } else if (path.contains("/target/classes/")) { directory += "../../"; } filename = path + (directory + filename).replaceAll("/", Matcher.quoteReplacement(File.separator)); return new File(filename).getCanonicalFile(); } } return null; }</code><technical_language>Do tests for this method</technical_language>

Target:
public static File getFile(Object source, String filename) throws IOException { Class<?> clazz = (source instanceof Class<?>) ? (Class<?>) source : source.getClass(); if (Platform.isRunning()) { ClassLoader classLoader = clazz.getClassLoader(); if (isOsgiVersion310orNewer(classLoader)) { return getFileFromClassLoader4Luna(filename, classLoader); } else if (isOsgiVersion39orOlder(classLoader)) { return getFileFromClassLoaderBeforeLuna(filename, classLoader); } } else { return getFileFromNotRunningPlatform(filename, clazz); } return null; }
Source:
<code>public Boolean insertSingleStat(final AggStats aggStats) { try { final List<AggStats> aggStatsList = Lists.newArrayList(aggStats); final int numSuccess = batchInsert(aggStatsList); if (numSuccess > 0) { <START> LOGGER.debug(""); <END> return Boolean.TRUE; } } catch (AmazonServiceException ase) { LOGGER.error(""); } return Boolean.FALSE; }</code><technical_language>empty debug message</technical_language>

Target:
public Boolean insertSingleStat(final AggStats aggStats) { try { final List<AggStats> aggStatsList = Lists.newArrayList(aggStats); final int numSuccess = batchInsert(aggStatsList); if (numSuccess <= 0) { LOGGER.error("action=fail-aggstat-insert agg_stats={}", aggStats.toString()); return Boolean.FALSE; } return Boolean.TRUE; } catch (AmazonServiceException ase) { LOGGER.error("action=fail-aggstat-insert exception={} agg_stats={}", ase.getMessage(), aggStats.toString()); } return Boolean.FALSE; }
Source:
<code>public @Nullable T resolve(ITmfEvent event) { for (ITmfEventAspect<?> aspect : fAspects) { Object resolve = aspect.resolve(event); if (resolve != null && <START> resolve.getClass().isAssignableFrom(fClazz.getClass())) { <END> return (T) resolve; } } return null; }</code><technical_language>this filter in constructor</technical_language>

Target:
public @Nullable T resolve(ITmfEvent event) { for (ITmfEventAspect<?> aspect : fAspects) { Object resolve = aspect.resolve(event); if (resolve != null) { return (T) resolve; } } return null; }
Source:
<code>private void updateConnectButton() { connectButton.setEnabled(Stream.of( urlValidator.isValid(), usernameValidator.isValid(), passwordValidator.isValid(), usernameAndPasswordValidator.isValid() <START> ).reduce(true, Boolean::logicalAnd)); <END> }</code><technical_language>for if simple Seq(urlValidator, usernameValidator, passwordValidator, usernameAndPasswordValidator).forall(_.isValid)</technical_language>

Target:
private void updateConnectButton() { connectButton.setEnabled(urlValidator.isValid() && usernameValidator.isValid() && passwordValidator.isValid() && usernameAndPasswordValidator.isValid()); }
Source:
<code>public PersonListItem(Person person) { if (person != null) { personId = person.getPersonId(); uuid = person.getUuid(); boolean first = true; for (PersonName pn : person.getNames()) { if (first) { familyName = pn.getFamilyName(); middleName = pn.getMiddleName(); givenName = pn.getGivenName(); first = false; } else { if (!StringUtils.isBlank(otherNames)) otherNames += ","; otherNames += " " + pn.getGivenName() + " " + pn.getMiddleName() + " " + pn.getFamilyName(); } } gender = person.getGender(); birthdate = person.getBirthdate(); birthdateString = Format.format(person.getBirthdate()); birthdateEstimated = person.isBirthdateEstimated(); age = person.getAge(); voided = person.isPersonVoided(); if (person.getDeathDate() != null) { this.deathDateString = Format.format(person.getDeathDate()); } <START> deathdateEstimated = person.isDeathdateEstimated(); <END> for (PersonAttribute attribute : person.getActiveAttributes()) { attributes.put(attribute.getAttributeType().getName(), attribute.toString()); } } }</code><technical_language>person.getDeathdateEstimated()</technical_language>

Target:
public PersonListItem(Person person) { if (person != null) { personId = person.getPersonId(); uuid = person.getUuid(); boolean first = true; for (PersonName pn : person.getNames()) { if (first) { familyName = pn.getFamilyName(); middleName = pn.getMiddleName(); givenName = pn.getGivenName(); first = false; } else { if (!StringUtils.isBlank(otherNames)) otherNames += ","; otherNames += " " + pn.getGivenName() + " " + pn.getMiddleName() + " " + pn.getFamilyName(); } } gender = person.getGender(); birthdate = person.getBirthdate(); birthdateString = Format.format(person.getBirthdate()); birthdateEstimated = person.isBirthdateEstimated(); age = person.getAge(); voided = person.isPersonVoided(); if (person.getDeathDate() != null) { this.deathDateString = Format.format(person.getDeathDate()); } deathdateEstimated = person.getDeathdateEstimated(); for (PersonAttribute attribute : person.getActiveAttributes()) { attributes.put(attribute.getAttributeType().getName(), attribute.toString()); } } }
Source:
<code>public void addMembership(CohortMembership cohortMembership) { <START> getMembers().add(cohortMembership); <END> }</code><technical_language>This add a membership if active exists for patient if patient is voided</technical_language>

Target:
public void addMembership(CohortMembership cohortMembership) { if (!this.contains(cohortMembership.getPatient().getPatientId())) { cohortMembership.setCohort(this); getMembers().add(cohortMembership); } }
Source:
<code><START> public Optional<Entity> spawnEntity(Entity entity) { <END> return this.getExtent().spawnEntity(entity); }</code><technical_language>I allow a break for sugaring in this case</technical_language>

Target:
public boolean spawnEntity(Entity entity) { return this.getExtent().spawnEntity(entity); }
Source:
<code>public void reconfigure(HashMap<String, Object> params) throws RCException { if (storageManagerPreferences == null) { storageManagerPreferences = new StorageManagerPreferences(this); } <START> HashMap<String, Object> caschedParams = (HashMap<String, Object>)storageManagerPreferences.getAllEntries(); <END> caschedParams.putAll(params); RCUtils.validateSettingsParms(caschedParams); this.parameters = JainSipConfiguration.mergeParameters(this.parameters, caschedParams); StorageUtils.saveParams(storageManagerPreferences, parameters); signalingClient.reconfigure(params); registerForPushNotifications(true); }</code><technical_language>fix typo: caschedParams -> cachedParams</technical_language>

Target:
public void reconfigure(HashMap<String, Object> params) throws RCException { if (storageManagerPreferences == null) { storageManagerPreferences = new StorageManagerPreferences(this); } HashMap<String, Object> cachedParams = (HashMap<String, Object>)storageManagerPreferences.getAllEntries(); cachedParams.putAll(params); RCUtils.validateSettingsParms(cachedParams); this.parameters = JainSipConfiguration.mergeParameters(params, cachedParams); StorageUtils.saveParams(storageManagerPreferences, parameters); signalingClient.reconfigure(params); registerForPushNotifications(true); }
Source:
<code>public boolean canPushMerges() { if <START> (this.canPerform(Permission.PUSH_MERGE) <END> && canWrite()) { return true; } else if (projectControl.controlForRef(MagicBranch.NEW_CHANGE + getRefName()) .canPerform(Permission.PUSH_MERGE) && canWrite()) { return true; } return false; }</code><technical_language>explicit this if unnecessary</technical_language>

Target:
public boolean canPushMerges() { if (canPerform(Permission.PUSH_MERGE) && canWrite()) { return true; } else if (projectControl.controlForRef(MagicBranch.NEW_CHANGE + getRefName()) .canPerform(Permission.PUSH_MERGE) && canWrite()) { return true; } return false; }
Source:
<code>public static @NonNull List<MarkerSet> getMarkerSets() { if (!MARKER_CONFIG_FILE.exists()) { <START> return Collections.emptyList(); <END> } List<MarkerSet> set = new ArrayList<>(parse(MARKER_CONFIG_FILE.getAbsolutePath())); Collection<String> extensionPoint = getExtensionDefinitionsPaths(); for (String extensionBookmark : extensionPoint) { set.addAll(parse(extensionBookmark)); } return set; }</code><technical_language>return extension point marker sets if editable marker config file exist</technical_language>

Target:
public static @NonNull List<MarkerSet> getMarkerSets() { List<MarkerSet> markers = new ArrayList<>(); if (MARKER_CONFIG_FILE.exists()) { markers.addAll(parse(MARKER_CONFIG_FILE.getAbsolutePath())); } for (String extensionBookmark : getExtensionDefinitionsPaths()) { markers.addAll(parse(extensionBookmark)); } return markers; }
Source:
<code>public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.welcome); mWelcomeView = (TextView) findViewById(R.id.welcome); String welcome = getString(R.string.welcome, getHotelName()); mWelcomeView.setText(welcome); mEnterButton = (Button) findViewById(R.id.enter_button); mEnterButton.setOnClickListener(new View.OnClickListener() { <START> @Override <END> public void onClick(View arg0) { finish(); } }); }</code><technical_language>remove this Override OnClickListener is interface</technical_language>

Target:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.welcome); View welcomeLayout = findViewById(R.id.layout_welcome); welcomeLayout.getBackground().setAlpha(BACKGROUND_ALPHA); TextView hotelName = (TextView) findViewById(R.id.hotel_name); hotelName.setText(getHotelName()); Button enterButton = (Button) findViewById(R.id.enter_button); enterButton.setOnClickListener(new View.OnClickListener() { public void onClick(View arg0) { finish(); } }); }
Source:
<code>protected void onPushReceive(Context context, Intent intent) { try { CourseUpdateNotificationPayload payload = ParseHandleHelper.extractPayload(intent); if (payload != null && ParseHandleHelper.hasNotificationHash(context, payload.getIdentifier())) return; if (enableFlyinWindow) { Intent intent2 = new Intent(context, NotificationFlyinService.class); intent2.putExtra("com.parse.Data", intent.getExtras().getString("com.parse.Data")); context.startService(intent2); } <START> } catch (Exception ex) { <END> logger.debug(ex.toString()); } super.onPushReceive(context, intent); }</code><technical_language>I get rid of this generic catch block. method throw unchecked exception is extractPayload(), a generic catch block (which converted catching JsonSyntaxException)</technical_language>

Target:
protected void onPushReceive(Context context, Intent intent) { BaseNotificationPayload payload = ParseHandleHelper.extractPayload(intent); if (payload != null && ParseHandleHelper.hasNotificationHash(context, payload.getIdentifier())) return; super.onPushReceive(context, intent); }
Source:
<code>public static void update(Context context) { class ScanReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { if (Intent.ACTION_MEDIA_SCANNER_FINISHED.equals(intent.getAction())) { context.unregisterReceiver(this); Toast.makeText(context, R.string.scan_index_updated, Toast.LENGTH_SHORT).show(); <START> } else { <END> Toast.makeText(context, R.string.scan_updating_index, Toast.LENGTH_SHORT).show(); } } } IntentFilter filter = new IntentFilter(); filter.addDataScheme("file"); filter.addAction(Intent.ACTION_MEDIA_SCANNER_STARTED); filter.addAction(Intent.ACTION_MEDIA_SCANNER_FINISHED); context.registerReceiver(new ScanReceiver(), filter); Bundle args = new Bundle(); args.putString("volume", "external"); Intent scannerIntent = new Intent("android.media.IMediaScannerService") .setClassName("com.android.providers.media", "com.android.providers.media.MediaScannerService") .putExtras(args); context.startService(scannerIntent); }</code><technical_language>for readability replace else if(Intent.ACTION_MEDIA_SCANNER_STARTED)</technical_language>

Target:
public static void update(Context context) { IntentFilter filter = new IntentFilter(); filter.addDataScheme("file"); filter.addAction(Intent.ACTION_MEDIA_SCANNER_STARTED); filter.addAction(Intent.ACTION_MEDIA_SCANNER_FINISHED); context.registerReceiver(new ScanReceiver(), filter); Bundle args = new Bundle(); args.putString("volume", "external"); Intent scannerIntent = new Intent("android.media.IMediaScannerService") .setClassName("com.android.providers.media", "com.android.providers.media.MediaScannerService") .putExtras(args); context.startService(scannerIntent); }
Source:
<code>public String getToolTipText(Object element) { ITaskReview review = (ITaskReview) element; StringBuilder sb = new StringBuilder(); <START> sb.append("Description: "); <END> sb.append(review.getSummary()); sb.append("\n"); sb.append("Verified: "); if (review.getV() >= 1) { sb.append("YES"); } else { sb.append("NO"); } sb.append("\n"); sb.append("Code Review: "); sb.append(review.getCr()); return sb.toString(); }</code><technical_language>i18n; string Messages</technical_language>

Target:
public String getToolTipText(Object element) { TaskReview review = (TaskReview) element; StringBuilder sb = new StringBuilder(); sb.append("Description: "); sb.append(review.getSummary()); sb.append("\n"); sb.append("Verified: "); if (review.getV() >= 1) { sb.append("YES"); } else { sb.append("NO"); } sb.append("\n"); sb.append("Code Review: "); sb.append(review.getCr()); return sb.toString(); }
Source:
<code>public void sendInitialMessages(DisplayMode mode) { <START> send(new RebuildNormalMessage(position, index, updateInfo, world.getPlayerRepository(), <END> world.getRegionRepository().getXteaRepository(), false)); interfaceSet.openTop(mode); for (TopLevelPosition position : TopLevelPosition.values()) { if (position.getInterfaceId() == -1) { continue; } interfaceSet.openTopLevel(position); } sendMessage("Welcome to RuneScape."); if (isMuted()) { sendMessage("You are currently muted. Other players will not see your chat messages."); } updateAppearance(); send(new ConfigMessage(1737, 1 << 31)); inventory.forceRefresh(); equipment.forceRefresh(); bank.forceRefresh(); skillSet.forceRefresh(); world.submit(new LoginEvent(this)); }</code><technical_language>This is odd pass data for initialization, cc @Major-, need setting player "pre-init" code</technical_language>

Target:
public void sendInitialMessages(DisplayMode mode) { send(new RebuildNormalMessage(position, index, updateInfo, world.getPlayerRepository(), world.getRegionRepository().getXteaRepository(), false)); interfaceSet.openTop(mode); for (TopLevelPosition position : TopLevelPosition.values()) { if (position.getInterfaceId() == -1) { continue; } interfaceSet.openTopLevel(position); } sendMessage("Welcome to RuneScape."); if (isMuted()) { sendMessage("You are currently muted. Other players will not see your chat messages."); } updateAppearance(); send(new ConfigMessage(1737, 1 << 31)); send(new ChatFilterSettingsMessage(chatPrivacy, friendPrivacy)); send(new ChatFilterSettingsMessage(chatPrivacy, friendPrivacy)); inventory.forceRefresh(); equipment.forceRefresh(); bank.forceRefresh(); skillSet.forceRefresh(); world.submit(new LoginEvent(this)); }
Source:
<code>public List<PermissionSubject> getPermissionCheckSubjects() { List<PermissionSubject> permissionList = super.getPermissionCheckSubjects(); <START> if (getParameters().getInterface().isPromisc()) { <END> permissionList.add(new PermissionSubject(getVm().getstorage_pool_id(), VdcObjectType.StoragePool, ActionGroup.PROMISC)); } return permissionList; }</code><technical_language>check getParameters().getInterface() getVm() null, this method is called canDoAction</technical_language>

Target:
public List<PermissionSubject> getPermissionCheckSubjects() { List<PermissionSubject> permissionList = super.getPermissionCheckSubjects(); if (getParameters().getInterface() != null && getVm() != null && getParameters().getInterface().isPromisc()) { permissionList.add(new PermissionSubject(getVm().getstorage_pool_id(), VdcObjectType.StoragePool, ActionGroup.PROMISC)); } return permissionList; }
Source:
<code>public void assignAccessPoints() throws Exception { <START> final List<Object> dto = Lists.<Object>newArrayList("apID1", "apID2", "apID3"); <END> final List<ID> apIDs = Lists.newArrayList(new ID("apID1"), new ID("apID2"), new ID("apID3")); final ID operID = new ID("operID"); context.checking(new Expectations() {{ oneOf(repository).assignAccessPoints(with(matching(operID)) , with(matching(apIDs))); }}); Request request = makeRequestThatContains(dto); Reply<?> reply = service.assignAccessPoints("operID", request); assertThat(reply, isOk()); }</code><technical_language>Lists.<Object></technical_language>

Target:
public void assignAccessPoints() throws Exception { final List<String> dto = Lists.newArrayList("apID1", "apID2", "apID3"); final List<ID> apIDs = Lists.newArrayList(new ID("apID1"), new ID("apID2"), new ID("apID3")); final ID operID = new ID("operID"); context.checking(new Expectations() {{ oneOf(repository).assignAccessPoints(with(matching(operID)) , with(matching(apIDs))); }}); Request request = makeRequestThatContains(dto); Reply<?> reply = service.assignAccessPoints("operID", request); assertThat(reply, isOk()); }
Source:
<code>protected StorageFileItem retrieveFromRemoteIfExists( final MavenProxyRepository mavenProxyRepository, final String path ) throws IOException { final ResourceStoreRequest request = new ResourceStoreRequest( path ); request.setRequestRemoteOnly( true ); request.getRequestContext().put( Manager.ROUTING_INITIATED_FILE_OPERATION_FLAG_KEY, Boolean.TRUE ); <START> if ( ChecksumPolicy.STRICT == mavenProxyRepository.getChecksumPolicy() ) <END> { request.getRequestContext().put( ChecksumPolicy.REQUEST_CHECKSUM_POLICY_KEY, ChecksumPolicy.STRICT_IF_EXISTS ); } final boolean presentRemotely = mavenProxyRepository.getRemoteStorage().containsItem( mavenProxyRepository, request ); if ( !presentRemotely ) { return null; } mavenProxyRepository.removeFromNotFoundCache( request ); try { @SuppressWarnings( "deprecation" ) final StorageItem item = mavenProxyRepository.retrieveItem( true, request ); if ( item instanceof StorageFileItem ) { return (StorageFileItem) item; } else { return null; } } catch ( IllegalOperationException e ) { return null; } catch ( ItemNotFoundException e ) { mavenProxyRepository.removeFromNotFoundCache( request ); return null; } }</code><technical_language>unconditionally ChecksumPolicy.IGNORE? a big deal, extra remote request for SHA1/MD5 files do add if are, pointless</technical_language>

Target:
protected StorageFileItem retrieveFromRemoteIfExists( final MavenProxyRepository mavenProxyRepository, final String path ) throws IOException { final ResourceStoreRequest request = new ResourceStoreRequest( path ); request.setRequestRemoteOnly( true ); request.getRequestContext().put( Manager.ROUTING_INITIATED_FILE_OPERATION_FLAG_KEY, Boolean.TRUE ); request.getRequestContext().put( ChecksumPolicy.REQUEST_CHECKSUM_POLICY_KEY, ChecksumPolicy.IGNORE ); final boolean presentRemotely = mavenProxyRepository.getRemoteStorage().containsItem( mavenProxyRepository, request ); if ( !presentRemotely ) { return null; } mavenProxyRepository.removeFromNotFoundCache( request ); try { @SuppressWarnings( "deprecation" ) final StorageItem item = mavenProxyRepository.retrieveItem( true, request ); if ( item instanceof StorageFileItem ) { return (StorageFileItem) item; } else { return null; } } catch ( IllegalOperationException e ) { return null; } catch ( ItemNotFoundException e ) { mavenProxyRepository.removeFromNotFoundCache( request ); return null; } }
Source:
<code>public GsUploadManager(SecorConfig config) throws Exception { super(config); <START> String credentialPath = System.getenv("GOOGLE_APPLICATION_CREDENTIALS"); <END> if (credentialPath == null) { credentialPath = mConfig.getGsCredentialsPath(); } mClient = getService(credentialPath); }</code><technical_language>priorities reversed: get creds properties fall env</technical_language>

Target:
public GsUploadManager(SecorConfig config) throws Exception { super(config); mClient = getService(mConfig.getGsCredentialsPath()); }
Source:
<code>public void close() { Misc.free(writerPool); Misc.free(readerPool); <START> if (null != backupWriterPool) { <END> Misc.free(backupWriterPool); } }</code><technical_language>Misc.free() null check</technical_language>

Target:
public void close() { Misc.free(writerPool); Misc.free(readerPool); }
Source:
<code>public CompletableFuture<Void> prepareSnapshot( ChannelStateWriter channelStateWriter, <START> long checkpointId) throws IOException { <END> throw new UnsupportedOperationException("Checkpoints are not supported for sorting inputs"); }</code><technical_language>IDE is warning a bunch of exceptions declared thrown in methods</technical_language>

Target:
public CompletableFuture<Void> prepareSnapshot( ChannelStateWriter channelStateWriter, long checkpointId) { throw new UnsupportedOperationException("Checkpoints are not supported for sorting inputs"); }
Source:
<code>private void fetchUsersForCurrentMapPosition() { if (mLastPosition.zoom < getResources().getInteger(R.integer.map_zoom_min_load)) { sendMessage(R.string.users_dont_load); } else { sendMessage(R.string.loading_users); getResumePauseDisposable().add( mUserRepository.searchByLocation(mMap.getBoundingBox()) .observeOn(AndroidSchedulers.mainThread()) <START> .filter(list -> !list.isEmpty()) <END> .subscribe(searchResult -> { for (UserSearchByLocationResponse.User user : searchResult) { addUserToCluster(user.toSimpleUser()); } mMarkerClusterer.invalidate(); mMap.invalidate(); }, throwable -> { Log.e(TAG, throwable.getMessage()); })); } }</code><technical_language>Move this line do need change main thread in case filter apply</technical_language>

Target:
private void fetchUsersForCurrentMapPosition() { if (mLastPosition.zoom < mMapZoomMinLoad) { sendMessage(R.string.users_dont_load); } else { mProgressLoadingUsers.setVisibility(View.VISIBLE); getResumePauseDisposable().add( mUserRegionalCache.searchByLocation(mMap.getBoundingBox()) .observeOn(AndroidSchedulers.mainThread()) .doFinally(() -> mProgressLoadingUsers.setVisibility(View.GONE)) .filter(searchResult -> !searchResult.isEmpty()) .subscribe(searchResult -> { for (UserSearchByLocationResponse.User user : searchResult) { addUserToCluster(user.toSimpleUser()); } mMarkerClusterer.invalidate(); mMap.invalidate(); }, throwable -> { Log.e(TAG, throwable.getMessage()); sendMessage(R.string.http_server_access_failure); })); } }
Source:
<code>public Statement apply(Statement base, Description description) { <START> if (isDebugging() && !fEnableWhenDebugging) { <END> return base; } return new FailOnTimeout(base, fTimeout, fTimeUnit, fLookForStuckThread); }</code><technical_language>reverse ordering of this expression? of time, fEnableWhenDebugging true</technical_language>

Target:
public Statement apply(Statement base, Description description) { if (!enableWhenDebugging && isDebugging()) { return new FailOnTimeout(base, 0, timeUnit, lookForStuckThread); } return new FailOnTimeout(base, timeout, timeUnit, lookForStuckThread); }
Source:
<code>public boolean updateVolumeId(long srcVolId, long destVolId) { TransactionLegacy txn = TransactionLegacy.currentTxn(); try { VolumeDataStoreVO volumeDataStoreVO = findByVolume(srcVolId); if(volumeDataStoreVO != null) { txn.start(); volumeDataStoreVO.setVolumeId(destVolId); update(volumeDataStoreVO.getId(), volumeDataStoreVO); txn.commit(); } <START> } catch (Exception e) { <END> throw new CloudRuntimeException("Unable to update the volume id for volume store ref"); } return true; }</code><technical_language>please catch more specific/explicit exceptions. In this case original exception is passed embedded is totally lost</technical_language>

Target:
public boolean updateVolumeId(long srcVolId, long destVolId) { TransactionLegacy txn = TransactionLegacy.currentTxn(); try { VolumeDataStoreVO volumeDataStoreVO = findByVolume(srcVolId); if(volumeDataStoreVO != null) { txn.start(); volumeDataStoreVO.setVolumeId(destVolId); update(volumeDataStoreVO.getId(), volumeDataStoreVO); txn.commit(); } } catch (Exception e) { throw new CloudRuntimeException("Unable to update the volume id for volume store ref", e); } return true; }
Source:
<code>public PopupMenuAddFormhandlerParam() { super(Constant.messages.getString("formhandler.popup.menu.params.add.label")); <START> this.addActionListener(new java.awt.event.ActionListener() { <END> @Override public void actionPerformed(java.awt.event.ActionEvent e) { HtmlParameterStats hps = ((ParamsTableModel) paramTable.getModel()).getHtmlParameterStatsAtRow(paramTable.getSelectedRow()); popupDialogAddField = new PopupDialogAddField(View.getSingleton().getOptionsDialog(null), hps.getName(), hps.getValuesSummary().split(",")); popupDialogAddField.setVisible(true); } }); }</code><technical_language>a lambda, code indentation</technical_language>

Target:
public PopupMenuAddFormhandlerParam() { super(Constant.messages.getString("formhandler.popup.menu.params.add.label")); this.addActionListener(e -> { PopupDialogAddField popupDialogAddField = null; HtmlParameterStats hps = ((ParamsTableModel) paramTable.getModel()) .getHtmlParameterStatsAtRow(paramTable.getSelectedRow()); popupDialogAddField = new PopupDialogAddField(View.getSingleton().getOptionsDialog(null), hps.getName(), hps.getValues()); popupDialogAddField.setVisible(true); }); }
Source:
<code>public String getWholeText(){ final StringBuilder accum = new StringBuilder(); new NodeTraversor(new NodeVisitor() { public void head(Node node, int depth) { if (node instanceof TextNode) { TextNode textNode = (TextNode) node; accum.append(textNode.getWholeText()); } } public void tail(Node node, int depth) { } }).traverse(this); <START> return accum.toString().trim(); <END> }</code><technical_language>trim()? if <p> Hello\nthere </p>, I want <p> is html node</technical_language>

Target:
public String getWholeText(){ final StringBuilder accum = new StringBuilder(); new NodeTraversor(new NodeVisitor() { public void head(Node node, int depth) { if (node instanceof TextNode) { TextNode textNode = (TextNode) node; accum.append(textNode.getWholeText()); } } public void tail(Node node, int depth) { } }).traverse(this); return accum.toString(); }
Source:
<code>protected Map<String, String> getPersistenceProperties(KieServerConfig config) { Map<String, String> persistenceProperties = new HashMap<String, String>(); persistenceProperties.put("hibernate.dialect", config.getConfigItemValue(KieServerConstants.CFG_PERSISTANCE_DIALECT, "org.hibernate.dialect.H2Dialect")); persistenceProperties.put("hibernate.default_schema", config.getConfigItemValue(KieServerConstants.CFG_PERSISTANCE_DEFAULT_SCHEMA)); persistenceProperties.put("hibernate.transaction.jta.platform", config.getConfigItemValue(KieServerConstants.CFG_PERSISTANCE_TM, "org.hibernate.service.jta.platform.internal.JBossAppServerJtaPlatform")); persistenceProperties.put("javax.persistence.jtaDataSource", config.getConfigItemValue(KieServerConstants.CFG_PERSISTANCE_DS, "java:jboss/datasources/ExampleDS")); System.getProperties().stringPropertyNames() .stream() <START> .filter(name -> name.startsWith("hibernate.") || name.startsWith("javax.persistence")) <END> .forEach(name -> persistenceProperties.put(name, System.getProperty(name))); return persistenceProperties; }</code><technical_language>I a method based filter, for example: .filter(JbpmKieServerExtension::isValidPersistenceKey) reused other places if needed</technical_language>

Target:
protected Map<String, String> getPersistenceProperties(KieServerConfig config) { Map<String, String> persistenceProperties = new HashMap<String, String>(); persistenceProperties.put("hibernate.dialect", config.getConfigItemValue(KieServerConstants.CFG_PERSISTANCE_DIALECT, "org.hibernate.dialect.H2Dialect")); persistenceProperties.put("hibernate.default_schema", config.getConfigItemValue(KieServerConstants.CFG_PERSISTANCE_DEFAULT_SCHEMA)); persistenceProperties.put("hibernate.transaction.jta.platform", config.getConfigItemValue(KieServerConstants.CFG_PERSISTANCE_TM, "org.hibernate.service.jta.platform.internal.JBossAppServerJtaPlatform")); persistenceProperties.put("javax.persistence.jtaDataSource", config.getConfigItemValue(KieServerConstants.CFG_PERSISTANCE_DS, "java:jboss/datasources/ExampleDS")); System.getProperties().stringPropertyNames() .stream() .filter(PersistenceUnitInfoLoader::isValidPersistenceKey) .forEach(name -> persistenceProperties.put(name, System.getProperty(name))); return persistenceProperties; }
Source:
<code>public void flush() { <START> } <END></code><technical_language>add command</technical_language>

Target:
public void flush() { for (ExtensionProxy extension : getExtensions()) { extension.invoke(new ExtMap() .mput(Base.InvokeKeys.COMMAND, Logger.InvokeCommands.FLUSH)); } }
Source:
<code>protected Response performAction(VdcActionType task, VdcActionParametersBase params, Action action) { try { if (QueryHelper.hasMatrixParam(getUriInfo(), ASYNC_CONSTRAINT) || expectNonBlocking()) { getCurrent().get(MetaData.class).set("async", true); <START> return performNonBlockingAction(task, params); <END> } else { doAction(task, params); if (action!=null) { action.setStatus(StatusUtils.create(CreationStatus.COMPLETE)); return Response.ok().entity(action).build(); } else { return Response.ok().build(); } } } catch (Exception e) { return handleError(Response.class, e, false); } }</code><technical_language>treating this use-case</technical_language>

Target:
protected Response performAction(VdcActionType task, VdcActionParametersBase params, Action action) { try { if (QueryHelper.hasMatrixParam(getUriInfo(), ASYNC_CONSTRAINT) || expectNonBlocking()) { getCurrent().get(MetaData.class).set("async", true); return performNonBlockingAction(task, params, action); } else { doAction(task, params); if (action!=null) { action.setStatus(StatusUtils.create(CreationStatus.COMPLETE)); return Response.ok().entity(action).build(); } else { return Response.ok().build(); } } } catch (Exception e) { return handleError(Response.class, e, false); } }
Source:
<code>public void setWhiteListContexts(List<String> whiteListContexts) { if (whiteListContexts == null) { return; } for (String entry : whiteListContexts) { String[] split = entry.split("="); if (split.length == 2) { <START> SYSTEM_PROTECTION_WHITELIST.add(split[0], split[1]); <END> } } }</code><technical_language>trim values</technical_language>

Target:
public void setWhiteListContexts(List<String> whiteListContexts) { if (whiteListContexts == null) { return; } SYSTEM_PROTECTION_WHITELIST.clear(); for (String entry : whiteListContexts) { String[] split = entry.split("="); if (split.length == 2) { Pattern existingPattern = SYSTEM_PROTECTION_WHITELIST .keySet() .stream() .filter(regex -> regex.toString().equals(split[0].trim())) .findFirst() .orElse(null); if (existingPattern == null) { existingPattern = Pattern.compile(split[0].trim()); } SYSTEM_PROTECTION_WHITELIST.add(existingPattern, split[1].trim()); } } }
Source:
<code>private void initializeFromLocalSearch(LocalSearch search) { this.search = search; if (search.searchAllAccounts()) { List<Account> accounts = preferences.getAccounts(); singleAccountMode = (accounts.size() == 1); if (singleAccountMode) { account = accounts.get(0); } } else { String[] accountUuids = search.getAccountUuids(); singleAccountMode = (accountUuids.length == 1); if (singleAccountMode) { account = preferences.getAccount(accountUuids[0]); } } List<String> folderServerIds = search.getFolderServerIds(); singleFolderMode = singleAccountMode && folderServerIds.size() == 1; if (drawer == null) { <START> return; <END> } else if (singleFolderMode) { drawer.selectFolder(folderServerIds.get(0)); } else if (search.getId().equals(SearchAccount.UNIFIED_INBOX)) { drawer.selectUnifiedInbox(); } else { drawer.selectFolder(null); } actionBarSubTitle.setVisibility((!singleFolderMode) ? View.GONE : View.VISIBLE); }</code><technical_language>This skips line of method unrelated drawer. suggestion is extract drawer-related code a separate method do null check there</technical_language>

Target:
private void initializeFromLocalSearch(LocalSearch search) { this.search = search; if (search.searchAllAccounts()) { List<Account> accounts = preferences.getAccounts(); singleAccountMode = (accounts.size() == 1); if (singleAccountMode) { account = accounts.get(0); } } else { String[] accountUuids = search.getAccountUuids(); singleAccountMode = (accountUuids.length == 1); if (singleAccountMode) { account = preferences.getAccount(accountUuids[0]); } } List<String> folderServerIds = search.getFolderServerIds(); singleFolderMode = singleAccountMode && folderServerIds.size() == 1; actionBarSubTitle.setVisibility((!singleFolderMode) ? View.GONE : View.VISIBLE); if (drawer == null) { return; } else if (singleFolderMode) { drawer.selectFolder(folderServerIds.get(0)); } else if (search.getId().equals(SearchAccount.UNIFIED_INBOX)) { drawer.selectUnifiedInbox(); } else { drawer.selectFolder(null); } }
Source:
<code><START> long getHammingDistance() { <END> IntPredicate areNotEqual = index -> leftStrand.charAt(index) != rightStrand.charAt(index); return IntStream.range(0, leftStrand.length()).filter(areNotEqual).count(); }</code><technical_language>reason changed this long? match starter implementation</technical_language>

Target:
int getHammingDistance() { return hammingDistance; }
Source:
<code>public StyledString buildTextFromEventIndex(int index, ITaskAttachment attachment) { StyledString text = new StyledString(); switch (index) { case 0: if (AttachmentUtil.isContext(attachment)) { text.append(Messages.AttachmentTableLabelProvider_Task_Context); } else if (attachment.isPatch()) { text.append(Messages.AttachmentTableLabelProvider_Patch); } else { text.append(" " + attachment.getFileName()); } break; case 1: if (attachment.getDescription() != null) { text.append(attachment.getDescription()); } break; case 2: <START> Long length = attachment.getLength(); <END> if (length < 0) { text.append("-"); } text.append(sizeFormatter.format(length)); break; case 3: String autherText = (attachment.getAuthor() != null) ? attachment.getAuthor().toString() : ""; String[] autherPart = autherText.split(" <"); text.append(autherPart[0] + " ", StyledString.COUNTER_STYLER); if (autherPart.length > 1) { text.append("<" + autherPart[1], StyledString.COUNTER_STYLER); } break; case 4: text.append((attachment.getCreationDate() != null) ? EditorUtil.formatDateTime(attachment.getCreationDate()) : ""); break; case 5: text.append(getAttachmentId(attachment)); break; default: text.append("unrecognized column"); break; } return text; }</code><technical_language>this null</technical_language>

Target:
public StyledString buildTextFromEventIndex(int index, ITaskAttachment attachment) { StyledString text = new StyledString(); switch (index) { case 0: if (AttachmentUtil.isContext(attachment)) { text.append(Messages.AttachmentTableLabelProvider_Task_Context); } else if (attachment.isPatch()) { text.append(Messages.AttachmentTableLabelProvider_Patch); } else { text.append(" " + attachment.getFileName()); } break; case 1: if (attachment.getDescription() != null) { text.append(attachment.getDescription()); } break; case 2: long length = attachment.getLength(); if (length < 0) { text.append("-"); } text.append(sizeFormatter.format(length)); break; case 3: String autherText = (attachment.getAuthor() != null) ? attachment.getAuthor().toString() : ""; String[] autherPart = autherText.split(" <"); text.append(autherPart[0] + " ", StyledString.COUNTER_STYLER); if (autherPart.length > 1) { text.append("<" + autherPart[1], StyledString.COUNTER_STYLER); } break; case 4: text.append((attachment.getCreationDate() != null) ? EditorUtil.formatDateTime(attachment.getCreationDate()) : ""); break; case 5: text.append(getAttachmentId(attachment)); break; default: text.append("unrecognized column"); break; } return text; }
Source:
<code>public void setGetterName(String name) { Assert.isNotNull(fGetterName); fGetterName= name; <START> fCreateGetter= !fGetterName.isEmpty(); <END> }</code><technical_language>This assert is invalid get passed. Encapsulate Field dialog allow empty string shows error (though message is properly referenced shows id instead of message)</technical_language>

Target:
public void setGetterName(String name) { Assert.isNotNull(name); fGetterName= name; fCreateGetter = !name.isEmpty(); }
Source:
<code>public void afterPropertiesSet() throws Exception { Map<String, StreamListenerParameterAdapter> parameterAdapterMap = BeanFactoryUtils .beansOfTypeIncludingAncestors(this.applicationContext, StreamListenerParameterAdapter.class); for (StreamListenerParameterAdapter parameterAdapter : parameterAdapterMap.values()) { this.streamListenerParameterAdapters.add(parameterAdapter); } Map<String, StreamListenerResultAdapter> resultAdapterMap = BeanFactoryUtils .beansOfTypeIncludingAncestors(this.applicationContext, StreamListenerResultAdapter.class); this.streamListenerResultAdapters.add(new MessageChannelStreamListenerResultAdapter()); <START> for (StreamListenerResultAdapter resultAdapter : resultAdapterMap.values()) { <END> this.streamListenerResultAdapters.add(resultAdapter); } }</code><technical_language>picky, this is unsafe cast. Consider adding assertion ensure AC is instance of ConfigurableApplicationContext. safe bootstrap is public class all</technical_language>

Target:
public void afterPropertiesSet() throws Exception { Map<String, StreamListenerParameterAdapter> parameterAdapterMap = BeanFactoryUtils .beansOfTypeIncludingAncestors(this.applicationContext, StreamListenerParameterAdapter.class); parameterAdapterMap.values().iterator().forEachRemaining(this.streamListenerParameterAdapters::add); Map<String, StreamListenerResultAdapter> resultAdapterMap = BeanFactoryUtils .beansOfTypeIncludingAncestors(this.applicationContext, StreamListenerResultAdapter.class); this.streamListenerResultAdapters.add(new MessageChannelStreamListenerResultAdapter()); resultAdapterMap.values().iterator().forEachRemaining(this.streamListenerResultAdapters::add); }
Source:
<code>private static PerformanceReportParser getParserUsingAntPatternAbsolutePath(Run<?, ?> build, FilePath wsp, PrintStream logger, File path) throws InterruptedException { try { File parent = path.getParentFile(); FilePath workspace = new FilePath(wsp.getChannel(), parent.getAbsolutePath()); while (!workspace.exists()) { parent = parent.getParentFile(); if (parent != null) { workspace = new FilePath(wsp.getChannel(), parent.getAbsolutePath()); } else { return null; } } String glob = path.getAbsolutePath().substring(parent.getAbsolutePath().length() + 1); FilePath[] pathList = workspace.list(glob); for (FilePath src : pathList) { final File localReport = new File(build.getRootDir(), "/temp/" + src.getName()); if (src.isDirectory()) { logger.println("Performance: File '" + src.getName() + "' is a directory, not a Performance Report"); continue; } src.copyTo(new FilePath(localReport)); return getParser(ParserDetector.detect(localReport.getPath()), localReport.getPath()); } <START> } catch (IOException ignored) { <END> } return null; }</code><technical_language>write some log</technical_language>

Target:
private static PerformanceReportParser getParserUsingAntPatternAbsolutePath(Run<?, ?> build, FilePath wsp, PrintStream logger, File path) throws InterruptedException { try { File parent = path.getParentFile(); FilePath workspace = new FilePath(wsp.getChannel(), parent.getAbsolutePath()); while (!workspace.exists()) { parent = parent.getParentFile(); if (parent != null) { workspace = new FilePath(wsp.getChannel(), parent.getAbsolutePath()); } else { return null; } } String glob = path.getAbsolutePath().substring(parent.getAbsolutePath().length() + 1); FilePath[] pathList = workspace.list(glob); for (FilePath src : pathList) { final File localReport = new File(build.getRootDir(), "/temp/" + src.getName()); if (src.isDirectory()) { logger.println("Performance: File '" + src.getName() + "' is a directory, not a Performance Report"); continue; } src.copyTo(new FilePath(localReport)); return getParser(ParserDetector.detect(localReport.getPath()), localReport.getPath()); } } catch (IOException ignored) { LOGGER.log(Level.FINE, "Cannot find report file using Ant pattern", ignored); } return null; }
Source:
<code>public void showPermanently(String arrowCharacter) { <START> super.setText(arrowCharacter); <END> getHandler().removeCallbacks(clearTextRunnable); }</code><technical_language>is need for super</technical_language>

Target:
public void showPermanently(String arrowCharacter) { setText(arrowCharacter); getHandler().removeCallbacks(clearTextRunnable); }
Source:
<code>private void doTaskEnd() { if(started) { this.taskExecution.setEndTime(new Date()); this.taskExecution.setExitCode(0); taskRepository.update(taskExecution); } else { <START> logger.warn("An event to end a task has been received for a task that has " + <END> "not yet started."); } }</code><technical_language>log error possibly? Thoughts</technical_language>

Target:
private void doTaskEnd() { if(started) { this.taskExecution.setEndTime(new Date()); this.taskExecution.setExitCode(0); taskRepository.update(taskExecution); } else { logger.error("An event to end a task has been received for a task that has " + "not yet started."); } }
Source:
<code>private Connection<ShuffleControlMessage> getConnection(final String endPointId) { if (connectionFactory == null) { connectionFactory = networkSetup.getControlConnectionFactory(); } <START> <END> synchronized (connectionMap) { if (!connectionMap.containsKey(endPointId)) { connectionMap.put(endPointId, connectionFactory.newConnection(idFactory.getNewInstance(endPointId))); } return connectionMap.get(endPointId); } }</code><technical_language>moving this constructor</technical_language>

Target:
private Connection<ShuffleControlMessage> getConnection(final String endPointId) { synchronized (connectionMap) { if (!connectionMap.containsKey(endPointId)) { connectionMap.put(endPointId, connectionFactory.newConnection(idFactory.getNewInstance(endPointId))); } return connectionMap.get(endPointId); } }
Source:
<code>public ParametersDefinitionProperty(@Nonnull List<ParameterDefinition> parameterDefinitions) { <START> this.parameterDefinitions = parameterDefinitions != null ? parameterDefinitions : new ArrayList(); <END> }</code><technical_language>this Java-7 typed collection syntax: > new ArrayList<>() instead of earlier syntax: > new ArrayList()</technical_language>

Target:
public ParametersDefinitionProperty(@Nonnull List<ParameterDefinition> parameterDefinitions) { this.parameterDefinitions = parameterDefinitions != null ? parameterDefinitions : new ArrayList<>(); }
Source:
<code>@Override public void injectMembers(Set<T> t) { <START> throw new UnsupportedOperationException(); END> }</code><technical_language>Similarly</technical_language>

Target:
@Override public void injectMembers(Set<T> t) { throw new UnsupportedOperationException("Cannot inject into a multi-binder Set"); }
Source:
<code>public PhoneAccountHandle getSensibleAccountHandle(String dialNumber) { TelecomManager telecomManager = TelecomManager.from(mContext); <START> <END> List<PhoneAccountHandle> availablePhoneAccounts = telecomManager.getPhoneAccountsSupportingScheme(PhoneAccount.SCHEME_TEL); PhoneAccountHandle defaultPhoneAccount = telecomManager.getDefaultOutgoingPhoneAccount(PhoneAccount.SCHEME_TEL); PhoneAccountHandle phoneAccountFromNumber = getAccountHandleFromNumber(dialNumber); if (phoneAccountFromNumber != null && availablePhoneAccounts.contains(phoneAccountFromNumber)) { return phoneAccountFromNumber; } else if (defaultPhoneAccount != null && availablePhoneAccounts.contains(defaultPhoneAccount)) { return defaultPhoneAccount; } else if (availablePhoneAccounts.size() >= 1) { return availablePhoneAccounts.get(0); } return null; }</code><technical_language>unnecessary empty line</technical_language>

Target:
public PhoneAccountHandle getSensibleAccountHandle(String dialNumber) { TelecomManager telecomManager = TelecomManager.from(mContext); List<PhoneAccountHandle> availablePhoneAccounts = telecomManager.getPhoneAccountsSupportingScheme(PhoneAccount.SCHEME_TEL); PhoneAccountHandle defaultPhoneAccount = telecomManager.getDefaultOutgoingPhoneAccount(PhoneAccount.SCHEME_TEL); PhoneAccountHandle phoneAccountFromNumber = getAccountHandleFromNumber(dialNumber); if (phoneAccountFromNumber != null && availablePhoneAccounts.contains(phoneAccountFromNumber)) { return phoneAccountFromNumber; } else if (defaultPhoneAccount != null && availablePhoneAccounts.contains(defaultPhoneAccount)) { return defaultPhoneAccount; } else if (!availablePhoneAccounts.isEmpty()) { return availablePhoneAccounts.get(0); } return null; }
Source:
<code>public final void synch() { try { checkOpenness(); stateLock.acquireReadLock(); try { final long timer = Orient.instance().getProfiler().startChrono(); final long lockId = atomicOperationsManager.freezeAtomicOperations(null, null); try { checkOpenness(); if (jvmError.get() == null) { for (final OBaseIndexEngine indexEngine : indexEngines) { try { if (indexEngine != null) { indexEngine.flush(); } } catch (final Throwable t) { <START> OLogManager.instance().error(this, "Error while flushing index via index emakeFullCheckpointngine of class %s.", t, <END> indexEngine.getClass().getSimpleName()); } } makeFullCheckpoint(); } else { OLogManager.instance().errorNoDb(this, "Sync can not be performed because of JVM error on storage", null); } } finally { atomicOperationsManager.releaseAtomicOperations(lockId); Orient.instance().getProfiler().stopChrono("db." + name + ".synch", "Synch a database", timer, "db.*.synch"); } } finally { stateLock.releaseReadLock(); } } catch (final RuntimeException ee) { throw logAndPrepareForRethrow(ee); } catch (final Error ee) { throw logAndPrepareForRethrow(ee); } catch (final Throwable t) { throw logAndPrepareForRethrow(t); } }</code><technical_language>I suppose meant, in message</technical_language>

Target:
public final void synch() { try { checkOpenness(); stateLock.acquireReadLock(); try { final long timer = Orient.instance().getProfiler().startChrono(); final long lockId = atomicOperationsManager.freezeAtomicOperations(null, null); try { checkOpenness(); if (jvmError.get() == null) { for (final OBaseIndexEngine indexEngine : indexEngines) { try { if (indexEngine != null) { indexEngine.flush(); } } catch (final Throwable t) { OLogManager.instance().error(this, "Error while flushing index via index engine of class %s.", t, indexEngine.getClass().getSimpleName()); } } makeFullCheckpoint(); } else { OLogManager.instance().errorNoDb(this, "Sync can not be performed because of JVM error on storage", null); } } finally { atomicOperationsManager.releaseAtomicOperations(lockId); Orient.instance().getProfiler().stopChrono("db." + name + ".synch", "Synch a database", timer, "db.*.synch"); } } finally { stateLock.releaseReadLock(); } } catch (final RuntimeException ee) { throw logAndPrepareForRethrow(ee); } catch (final Error ee) { throw logAndPrepareForRethrow(ee); } catch (final Throwable t) { throw logAndPrepareForRethrow(t); } }