auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void execute(final String[] args) { Opts opts = new Opts(); opts.parseArgs(Initialize.class.getName(), args); try { AccumuloConfiguration acuConf = SiteConfiguration.getInstance(); SecurityUtil.serverLogin(acuConf); Configuration conf = CachedConfiguration.getInstance(); VolumeManager fs = VolumeManagerImpl.get(acuConf); if (opts.resetSecurity) { AccumuloServerContext context = new AccumuloServerContext(new ServerConfigurationFactory(HdfsZooInstance.getInstance())); if (isInitialized(fs)) { if (!opts.forceResetSecurity) { String secret = acuConf.get(Property.INSTANCE_SECRET); ConsoleReader c = getConsoleReader(); <START> String userEnteredSecret = c.readLine("WARNING: This will remove all users from Accumulo! If you wish to proceed enter the instance secret: ", '*'); <END> if (userEnteredSecret != null && !secret.equals(userEnteredSecret)) { log.info("Aborted reset security: Instance secret did not match what is in accumulo-site.xml"); return; } log.info("Beginning user initiated reset security on accumulo."); } final String rootUser = getRootUserName(opts); opts.rootpass = getRootPassword(opts, rootUser); initSecurity(context, opts, HdfsZooInstance.getInstance().getInstanceID(), rootUser); } else { log.error("FATAL: Attempted to reset security on accumulo before it was initialized"); } } if (opts.addVolumes) { addVolumes(fs); } if (!opts.resetSecurity && !opts.addVolumes) if (!doInit(opts, conf, fs)) System.exit(-1); } catch (Exception e) { log.error("Fatal exception", e); throw new RuntimeException(e); } }</code><technical_language>This remove users Accumulo Really, this is removing ZooKeeper data. "user database" in ZooKeeper. a word this</technical_language>

Target:
public void execute(final String[] args) { Opts opts = new Opts(); opts.parseArgs(Initialize.class.getName(), args); try { AccumuloConfiguration acuConf = SiteConfiguration.getInstance(); SecurityUtil.serverLogin(acuConf); Configuration conf = CachedConfiguration.getInstance(); VolumeManager fs = VolumeManagerImpl.get(acuConf); if (opts.resetSecurity) { log.info("Resetting security on accumulo."); Instance instance = HdfsZooInstance.getInstance(); AccumuloServerContext context = new AccumuloServerContext(new ServerConfigurationFactory(instance)); if (isInitialized(fs)) { if (!opts.forceResetSecurity) { ConsoleReader c = getConsoleReader(); String userEnteredName = c.readLine("WARNING: This will remove all users from Accumulo! If you wish to proceed enter the instance name: "); if (userEnteredName != null && !instance.getInstanceName().equals(userEnteredName)) { log.error("Aborted reset security: Instance name did not match current instance."); return; } } final String rootUser = getRootUserName(opts); opts.rootpass = getRootPassword(opts, rootUser); initSecurity(context, opts, HdfsZooInstance.getInstance().getInstanceID(), rootUser); } else { log.error("FATAL: Attempted to reset security on accumulo before it was initialized"); } } if (opts.addVolumes) { addVolumes(fs); } if (!opts.resetSecurity && !opts.addVolumes) if (!doInit(opts, conf, fs)) System.exit(-1); } catch (Exception e) { log.error("Fatal exception", e); throw new RuntimeException(e); } }
Source:
<code>public static void migrateLegacyIdGenerator( @NonNull Context context, @NonNull WorkDatabase workDatabase) { SharedPreferences sharedPreferences = context.getSharedPreferences(PREFERENCE_FILE_KEY, MODE_PRIVATE); if (sharedPreferences.contains(NEXT_JOB_SCHEDULER_ID_KEY) || sharedPreferences.contains(NEXT_JOB_SCHEDULER_ID_KEY)) { int nextJobId = sharedPreferences.getInt(NEXT_JOB_SCHEDULER_ID_KEY, INITIAL_ID); int nextAlarmId = sharedPreferences.getInt(NEXT_ALARM_MANAGER_ID_KEY, INITIAL_ID); workDatabase.beginTransaction(); try { IdGenerator idGenerator = new IdGenerator(workDatabase); idGenerator.update(NEXT_JOB_SCHEDULER_ID_KEY, nextJobId); idGenerator.update(NEXT_ALARM_MANAGER_ID_KEY, nextAlarmId); sharedPreferences.edit() <START> .remove(NEXT_JOB_SCHEDULER_ID_KEY) .remove(NEXT_ALARM_MANAGER_ID_KEY) .apply(); <END> workDatabase.setTransactionSuccessful(); } finally { workDatabase.endTransaction(); } } }</code><technical_language>clear()</technical_language>

Target:
public static void migrateLegacyIdGenerator( @NonNull Context context, @NonNull WorkDatabase workDatabase) { SharedPreferences sharedPreferences = context.getSharedPreferences(PREFERENCE_FILE_KEY, MODE_PRIVATE); if (sharedPreferences.contains(NEXT_JOB_SCHEDULER_ID_KEY) || sharedPreferences.contains(NEXT_JOB_SCHEDULER_ID_KEY)) { int nextJobId = sharedPreferences.getInt(NEXT_JOB_SCHEDULER_ID_KEY, INITIAL_ID); int nextAlarmId = sharedPreferences.getInt(NEXT_ALARM_MANAGER_ID_KEY, INITIAL_ID); workDatabase.beginTransaction(); try { IdGenerator idGenerator = new IdGenerator(workDatabase); idGenerator.update(NEXT_JOB_SCHEDULER_ID_KEY, nextJobId); idGenerator.update(NEXT_ALARM_MANAGER_ID_KEY, nextAlarmId); sharedPreferences.edit() .clear() .apply(); workDatabase.setTransactionSuccessful(); } finally { workDatabase.endTransaction(); } } }
Source:
<code>public UDFCollectionValueField(UDFCollectionDefinition udfDefinition, String sortKey, JSONObject value) { super(udfDefinition.getCollectionKey(), udfDefinition.getLabel()); this.sortKey = sortKey; this.value = value; this.udfDef = udfDefinition; <START> this.nameToType = udfDefinition.groupTypesByName(); <END> }</code><technical_language>this is purely stylistic, in named maps <old_thing>_to_<new_thing> confused, thinking functions</technical_language>

Target:
public UDFCollectionValueField(UDFCollectionDefinition udfDefinition, String sortKey, JSONObject value) { super(udfDefinition.getCollectionKey(), udfDefinition.getLabel()); this.sortKey = sortKey; this.value = value; this.udfDef = udfDefinition; this.subFieldDefinitionsByName = udfDefinition.groupTypesByName(); }
Source:
<code><START> public void clearCacheForTable(RpcController controller, ClearCacheForTableRequest request, <END> RpcCallback<ClearCacheForTableResponse> done) { ByteString tenantId = request.getTenantId(); ByteString schemaName = request.getSchemaName(); ByteString tableName = request.getTableName(); byte[] tableKey = SchemaUtil.getTableKey(tenantId.toByteArray(), schemaName.toByteArray() , tableName.toByteArray()); ImmutableBytesPtr key = new ImmutableBytesPtr(tableKey); Cache<ImmutableBytesPtr, PTable> metaDataCache = GlobalCache.getInstance(this.env).getMetaDataCache(); PTable table = metaDataCache.getIfPresent(key); long ts = table.getTimeStamp() + 1; HRegion region = env.getRegion(); List<Mutation> mutations = new ArrayList<Mutation>(); Put p = new Put(tableKey); p.add(TABLE_FAMILY_BYTES, QueryConstants.EMPTY_COLUMN_BYTES, ts, ByteUtil.EMPTY_BYTE_ARRAY); mutations.add(p); try { region.mutateRowsWithLocks(mutations, Collections.<byte[]> emptySet()); } catch (Throwable t) { logger.error("clearCacheForTable failed to update the latest ts ", t); ProtobufUtil.setControllerException(controller, ServerUtil.createIOException( SchemaUtil.getTableName(schemaName.toString(), tableName.toString()), t)); } metaDataCache.invalidate(key); }</code><technical_language>This close getTable(RpcController controller, GetTableRequest request, RpcCallback<MetaDataResponse> done);</technical_language>

Target:
public void clearCacheForTable(RpcController controller, ClearCacheForTableRequest request, RpcCallback<ClearCacheForTableResponse> done) { ByteString tenantId = request.getTenantId(); ByteString schemaName = request.getSchemaName(); ByteString tableName = request.getTableName(); byte[] tableKey = SchemaUtil.getTableKey(tenantId.toByteArray(), schemaName.toByteArray(), tableName.toByteArray()); ImmutableBytesPtr key = new ImmutableBytesPtr(tableKey); try { PTable table = doGetTable(tableKey, request.getClientTimestamp()); if (table != null) { Cache<ImmutableBytesPtr, PTable> metaDataCache = GlobalCache.getInstance(this.env).getMetaDataCache(); long ts = table.getTimeStamp() + 1; HRegion region = env.getRegion(); List<Mutation> mutations = new ArrayList<Mutation>(); Put p = new Put(tableKey); p.add(TABLE_FAMILY_BYTES, QueryConstants.EMPTY_COLUMN_BYTES, ts, ByteUtil.EMPTY_BYTE_ARRAY); mutations.add(p); region.mutateRowsWithLocks(mutations, Collections.<byte[]> emptySet()); metaDataCache.invalidate(key); } } catch (Throwable t) { logger.error("clearCacheForTable failed to update the latest ts ", t); ProtobufUtil.setControllerException(controller, ServerUtil.createIOException( SchemaUtil.getTableName(schemaName.toString(), tableName.toString()), t)); } }
Source:
<code>public ApiResponse handleApiAction(String name, JSONObject params) throws ApiException { log.debug("handleApiAction " + name + " " + params.toString()); if (ACTION_DOWNLOAD_LATEST_RELEASE.equals(name)) { if (this.downloadLatestRelease()) { return ApiResponseElement.OK; } else { return ApiResponseElement.FAIL; } } else if (ACTION_INSTALL_ADDON.equals(name)) { String id = params.getString(PARAM_ID); AddOn ao = extension.getAddOn(id); if (ao == null) { throw new ApiException(Type.DOES_NOT_EXIST); } else { Vector<String> v = new Vector<String>(); v.add(id); extension.installAddOns(v); return ApiResponseElement.OK; } } else if (ACTION_UNINSTALL_ADDON.equals(name)) { String id = params.getString(PARAM_ID); AddOn ao = extension.getAddOn(id); <START> if (ao == null || ! extension.getInstalledAddOns().contains(ao)) { <END> throw new ApiException(Type.DOES_NOT_EXIST); } else { Vector<String> v = new Vector<String>(); v.add(id); extension.uninstallAddOns(v); return ApiResponseElement.OK; } } else { throw new ApiException(ApiException.Type.BAD_ACTION); } }</code><technical_language>fail uninstall add-on if installed is newer/older in marketplace (they considered equals of version)</technical_language>

Target:
public ApiResponse handleApiAction(String name, JSONObject params) throws ApiException { log.debug("handleApiAction " + name + " " + params.toString()); if (ACTION_DOWNLOAD_LATEST_RELEASE.equals(name)) { if (this.downloadLatestRelease()) { return ApiResponseElement.OK; } else { return ApiResponseElement.FAIL; } } else if (ACTION_INSTALL_ADDON.equals(name)) { String id = params.getString(PARAM_ID); AddOn ao = extension.getAddOn(id); if (ao == null) { throw new ApiException(Type.DOES_NOT_EXIST); } else { List<String> l = new ArrayList<String>(); l.add(id); String errorMessages = extension.installAddOns(l); if (errorMessages.length() == 0) { return ApiResponseElement.OK; } else { throw new ApiException(ApiException.Type.INTERNAL_ERROR, errorMessages); } } } else if (ACTION_UNINSTALL_ADDON.equals(name)) { String id = params.getString(PARAM_ID); AddOn ao = extension.getLocalVersionInfo().getAddOn(id); if (ao == null) { throw new ApiException(Type.DOES_NOT_EXIST); } else { List<String> l = new ArrayList<String>(); l.add(id); String errorMessages = extension.uninstallAddOns(l); if (errorMessages.length() == 0) { return ApiResponseElement.OK; } else { throw new ApiException(ApiException.Type.INTERNAL_ERROR, errorMessages); } } } else { throw new ApiException(ApiException.Type.BAD_ACTION); } }
Source:
<code>private void onPlaybackParameterChanged(final PlaybackParameters parameters) { if (parameters != null) { if (menu != null && player != null) { <START> MenuItem item = menu.findItem(R.id.action_playback_speed); <END> item.setTitle(formatSpeed(parameters.speed)); } } }</code><technical_language>Please this variable final</technical_language>

Target:
private void onPlaybackParameterChanged(final PlaybackParameters parameters) { if (parameters != null) { if (menu != null && player != null) { final MenuItem item = menu.findItem(R.id.action_playback_speed); item.setTitle(formatSpeed(parameters.speed)); } } }
Source:
<code>private UriSchemeHandlerPreferencePage openPreferenceAndGetPage() { <START> Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); <END> this.dialog = PreferencesUtil.createPreferenceDialogOn(shell, "org.eclipse.ui.preferencePages.General.LinkHandlers", null, null); this.dialog.setBlockOnOpen(false); this.dialog.open(); return (UriSchemeHandlerPreferencePage) this.dialog.getSelectedPage(); }</code><technical_language>try Shell shell = Display.getCurrent().getActiveShell(); instead? need instantiate a Shell yourself. need workspace here, a bad ;)</technical_language>

Target:
private UriSchemeHandlerPreferencePage openPreferenceAndGetPage() { Shell shell = Display.getCurrent().getActiveShell(); this.dialog = PreferencesUtil.createPreferenceDialogOn(shell, "org.eclipse.ui.preferencePages.General.LinkHandlers", null, null); this.dialog.setBlockOnOpen(false); this.dialog.open(); return (UriSchemeHandlerPreferencePage) this.dialog.getSelectedPage(); }
Source:
<code>public static void startup(Properties p) { try { <START> Context.addProxyPrivilege(PrivilegeConstants.MANAGE_SCHEDULER); <END> Context.getSchedulerService().onStartup(); } finally { Context.removeProxyPrivilege(PrivilegeConstants.MANAGE_SCHEDULER); } }</code><technical_language>@dilekamadushan please remove change SchedulerUtil @wluyima mentioned</technical_language>

Target:
public static void startup(Properties p) { String val = p.getProperty("scheduler.username", null); if (val != null) { SchedulerConstants.SCHEDULER_DEFAULT_USERNAME = val; log.warn("Deprecated runtime property: scheduler.username. Value set in global_property in database now."); } val = p.getProperty("scheduler.password", null); if (val != null) { SchedulerConstants.SCHEDULER_DEFAULT_PASSWORD = val; log.warn("Deprecated runtime property: scheduler.username. Value set in global_property in database now."); } try { Context.addProxyPrivilege(PrivilegeConstants.MANAGE_SCHEDULER); Context.getSchedulerService().onStartup(); } finally { Context.removeProxyPrivilege(PrivilegeConstants.MANAGE_SCHEDULER); } }
Source:
<code>public static void replaceFile(File src, File target) throws IOException { if (!src.renameTo(target)) { int retries = 5; while (target.exists() && !target.delete() && retries-- >= 0) { try { Thread.sleep(1000); } catch (InterruptedException e) { Thread.currentThread().interrupt(); <START> throw new IOException("replaceFile interrupted"); <END> } } if (!src.renameTo(target)) { throw new IOException("Unable to rename " + src + " to " + target); } } }</code><technical_language>InterruptedIOException</technical_language>

Target:
public static void replaceFile(File src, File target) throws IOException { if (!src.renameTo(target)) { int retries = 5; while (target.exists() && !target.delete() && retries-- >= 0) { try { Thread.sleep(1000); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new InterruptedIOException("replaceFile interrupted"); } } if (!src.renameTo(target)) { throw new IOException("Unable to rename " + src + " to " + target); } } }
Source:
<code>protected IXYPresentationProvider getPresentationProvider() { IXYPresentationProvider presentationProvider = fXYPresentationProvider.get(getTrace()); if (presentationProvider == null) { <START> return new XYPresentationProvider(); <END> } return presentationProvider; }</code><technical_language>asking, put in map too</technical_language>

Target:
protected IXYPresentationProvider getPresentationProvider() { IXYPresentationProvider presentationProvider = fXYPresentationProvider.get(getTrace()); if (presentationProvider == null) { presentationProvider = new XYPresentationProvider(); fXYPresentationProvider.putIfAbsent(getTrace(), presentationProvider); } return presentationProvider; }
Source:
<code>public int callJavaUserDefinedAggregateCoordinatorEnd() { m_udfBuffer.clear(); m_udfBuffer.getInt(); int functionId = m_udfBuffer.getInt(); UserDefinedAggregateFunctionRunner udafRunner = m_functionManager.getAggregateFunctionRunnerById(functionId); Throwable throwable = null; Object returnValue = null; try { assert(udafRunner != null); returnValue = udafRunner.end(); VoltType returnType = udafRunner.getReturnType(); if (returnType.isVariableLength() && ! VoltType.isVoltNullValue(returnValue)) { int sizeRequired = 1 + 4; switch(returnType) { case VARBINARY: if (returnValue instanceof byte[]) { sizeRequired += ((byte[])returnValue).length; } else if (returnValue instanceof Byte[]) { sizeRequired += ((Byte[])returnValue).length; <START> } <END> break; case STRING: sizeRequired += ((String)returnValue).getBytes(Constants.UTF8ENCODING).length; break; case GEOGRAPHY: sizeRequired += ((GeographyValue)returnValue).getLengthInBytes(); break; default: } if (sizeRequired > m_udfBuffer.capacity()) { resizeUDFBuffer(sizeRequired); } } m_udfBuffer.clear(); UserDefinedFunctionRunner.writeValueToBuffer(m_udfBuffer, returnType, returnValue); return 0; } catch (InvocationTargetException ex1) { throwable = ex1.getCause(); } catch (Throwable ex2) { throwable = ex2; } try { assert(throwable != null); byte[] errorMsg = throwable.toString().getBytes(Constants.UTF8ENCODING); if (errorMsg.length + 4 > m_udfBuffer.capacity()) { resizeUDFBuffer(errorMsg.length + 4); } m_udfBuffer.clear(); SerializationHelper.writeVarbinary(errorMsg, m_udfBuffer); } catch (IOException e) { throw new RuntimeException(e); } return -1; }</code><technical_language>simplify lines sizeRequried += Array.getLength(returnValue);</technical_language>

Target:
public int callJavaUserDefinedAggregateCoordinatorEnd() { UserDefinedAggregateFunctionRunner udafRunner = getUdafRunner(); int udafIndex = m_udfBuffer.getInt(); Object returnValue = null; try { assert(udafRunner != null); returnValue = udafRunner.end(udafIndex); VoltType returnType = udafRunner.getReturnType(); resizeUDAFBuffer(returnValue, returnType); m_udfBuffer.clear(); UserDefinedAggregateFunctionRunner.writeValueToBuffer(m_udfBuffer, returnType, returnValue); return 0; } catch (InvocationTargetException ex1) { handleUDAFError(ex1.getCause()); } catch (Throwable ex2) { handleUDAFError(ex2); } return -1; }
Source:
<code><START> public void beforeTemplating(PreparedStatement stmt, StatementContext ctx) throws SQLException { <END> final Set<String> alreadyDefined = ctx.getAttributes().keySet(); final Binding binding = ctx.getBinding(); final Handler handler = new Handler(); binding.getNames().stream() .filter(name -> !alreadyDefined.contains(name)) .forEach(name -> binding.findForName(name, ctx).ifPresent( a -> handler.define(name, a, ctx))); }</code><technical_language>throws is unused</technical_language>

Target:
public void beforeTemplating(PreparedStatement stmt, StatementContext ctx) { final Set<String> alreadyDefined = ctx.getAttributes().keySet(); final Binding binding = ctx.getBinding(); final SetNullHandler handler = new SetNullHandler(); binding.getNames().stream() .filter(name -> !alreadyDefined.contains(name)) .forEach(name -> binding.findForName(name, ctx).ifPresent( a -> handler.define(name, a, ctx))); }
Source:
<code>public Object perform(InvocationContext ctx) throws Throwable { Configuration cacheConfig = null; if (cacheConfigurationName != null) { cacheConfig = cacheManager.getCacheConfiguration(cacheConfigurationName); if (cacheConfig == null) { if (MapReduceTask.DEFAULT_TMP_CACHE_CONFIGURATION_NAME.equals(cacheConfigurationName)) { cacheConfig = new ConfigurationBuilder().unsafe().unreliableReturnValues(true).clustering() .cacheMode(CacheMode.DIST_SYNC).hash().numOwners(2).sync().build(); log.debugf("Using default tmp cache configuration, defined as ", cacheNameToCreate); } else { throw new IllegalStateException("Cache configuration " + cacheConfigurationName + " is not defined on node " + this.cacheManager.getAddress()); } } } cacheManager.defineConfiguration(cacheNameToCreate, cacheConfig); cacheManager.getCache(cacheNameToCreate); final long startTime = System.nanoTime(); final long maxRunTime = TimeUnit.MILLISECONDS.toNanos(cacheConfig.clustering().stateTransfer().timeout()); int expectedSize = cacheManager.getTransport().getMembers().size(); while (stm.getCacheTopology().getMembers().size() != expectedSize && stm.getCacheTopology().getPendingCH() != null) { Thread.sleep(50); long estimatedRunTime = System.nanoTime() - startTime; if (estimatedRunTime > maxRunTime) { String message = String.format( "Creating tmp cache %s timed out waiting for rebalancing to complete on node %s ", cacheNameToCreate, cacheManager.getAddress()); <START> log.error(message); <END> throw new RuntimeException(message); } } log.debugf("Defined and started cache %s", cacheNameToCreate); return true; }</code><technical_language>this a Log method</technical_language>

Target:
public Object perform(InvocationContext ctx) throws Throwable { Configuration cacheConfig = null; if (cacheConfigurationName != null) { cacheConfig = cacheManager.getCacheConfiguration(cacheConfigurationName); if (cacheConfig == null) { if (MapReduceTask.DEFAULT_TMP_CACHE_CONFIGURATION_NAME.equals(cacheConfigurationName)) { cacheConfig = new ConfigurationBuilder().unsafe().unreliableReturnValues(true).clustering() .cacheMode(CacheMode.DIST_SYNC).hash().numOwners(2).sync().build(); log.debugf("Using default tmp cache configuration, defined as ", cacheNameToCreate); } else { throw new IllegalStateException("Cache configuration " + cacheConfigurationName + " is not defined on node " + this.cacheManager.getAddress()); } } } cacheManager.defineConfiguration(cacheNameToCreate, cacheConfig); cacheManager.getCache(cacheNameToCreate); final long startTime = System.nanoTime(); final long maxRunTime = TimeUnit.MILLISECONDS.toNanos(cacheConfig.clustering().stateTransfer().timeout()); int expectedSize = cacheManager.getTransport().getMembers().size(); while (stm.getCacheTopology().getMembers().size() != expectedSize && stm.getCacheTopology().getPendingCH() != null) { Thread.sleep(50); long estimatedRunTime = System.nanoTime() - startTime; if (estimatedRunTime > maxRunTime) { throw log.creatingTmpCacheTimedOut(cacheNameToCreate, cacheManager.getAddress()); } } log.debugf("Defined and started cache %s", cacheNameToCreate); return true; }
Source:
<code>public void networkNameTakenByVdsmName() { when(network.getName()).thenReturn("vdsm-name"); when(network.getId()).thenReturn(DEFAULT_GUID); Network network2 = new Network(); <START> network2.setVdsmName("vdsm-name"); <END> network2.setId(OTHER_GUID); when(networkDao.getAllForDataCenter(any())).thenReturn(Arrays.asList(network, network2)); assertThat(validator.networkNameNotUsedAsVdsmName(), failsWith(EngineMessage.NETWORK_NAME_USED_AS_INTERFACE_NAME)); }</code><technical_language>set name: network2.setName('something'), validate this is get in Validation result? Name (not vdsm-name) is want in message, I wrong here</technical_language>

Target:
public void networkNameTakenByVdsmName() { when(network.getName()).thenReturn("vdsm-name"); when(network.getId()).thenReturn(DEFAULT_GUID); Network network2 = new Network(); network2.setVdsmName("vdsm-name"); network2.setId(OTHER_GUID); when(networkDao.getAllForDataCenter(any())).thenReturn(Arrays.asList(network, network2)); assertThat(validator.networkNameNotUsedAsVdsmName(), failsWith(EngineMessage.NETWORK_NAME_USED_AS_VDSM_INTERFACE_NAME)); }
Source:
<code>private boolean checkClusterFeaturesSupported(List<VDS> vdss, Set<SupportedAdditionalClusterFeature> newFeaturesEnabled) { Set<String> featuresNamesEnabled = new HashSet<>(); for (SupportedAdditionalClusterFeature feature : newFeaturesEnabled) { featuresNamesEnabled.add(feature.getFeature().getName()); } for (VDS vds : vdss) { Set<String> featuresSupportedByVds = vdsDynamicDao.getSupportedHostFeaturesByVdsId(vds.getId()); if (!featuresSupportedByVds.containsAll(featuresNamesEnabled)) { return false; } } return true; <START> <END> }</code><technical_language>please remove this empty line</technical_language>

Target:
private boolean checkClusterFeaturesSupported(List<VDS> vdss, Set<SupportedAdditionalClusterFeature> newFeaturesEnabled) { Set<String> featuresNamesEnabled = new HashSet<>(); for (SupportedAdditionalClusterFeature feature : newFeaturesEnabled) { featuresNamesEnabled.add(feature.getFeature().getName()); } for (VDS vds : vdss) { Set<String> featuresSupportedByVds = hostFeatureDao.getSupportedHostFeaturesByHostId(vds.getId()); if (!featuresSupportedByVds.containsAll(featuresNamesEnabled)) { return false; } } return true; }
Source:
<code>public void updateUserId(String id,String newEmail) { try { List<String> locksSucceeded = new ArrayList<String>(); List<String> locks = new ArrayList<String>(); locks.add(SECURE_UPDATE_USER_ANY); locks.add(SECURE_UPDATE_USER_OWN); locks.add(SECURE_UPDATE_USER_OWN_EMAIL); locksSucceeded = unlock(locks, userReference(id)); if(locksSucceeded.contains(SECURE_UPDATE_USER_ANY) || locksSucceeded.contains(SECURE_UPDATE_USER_OWN_EMAIL )|| locksSucceeded.contains(SECURE_UPDATE_USER_OWN)) { UserEdit user = m_storage.edit(id); if (user == null) { M_log.error("Unexpected error when trying to validate the user"); return; } user.setEid(newEmail); user.setEmail(newEmail); commitEdit(user); } else { M_log.error("User edit did not pass permission checks"); return; } } catch (UserAlreadyDefinedException e) { <START> M_log.error(e.getStackTrace()); <END> } catch (UserPermissionException e) { M_log.error(e.getStackTrace()); } }</code><technical_language>errors pass stack trace in parameter</technical_language>

Target:
public boolean updateUserId(String id,String newEmail) { try { List<String> locksSucceeded = new ArrayList<String>(); List<String> locks = new ArrayList<String>(); locks.add(SECURE_UPDATE_USER_ANY); locks.add(SECURE_UPDATE_USER_OWN); locks.add(SECURE_UPDATE_USER_OWN_EMAIL); locksSucceeded = unlock(locks, userReference(id)); if(!locksSucceeded.isEmpty()) { UserEdit user = m_storage.edit(id); if (user == null) { M_log.warn("Can't find user " + id + " when trying to update email address"); return false; } user.setEid(newEmail); user.setEmail(newEmail); commitEdit(user); return true; } else { M_log.warn("User with id: "+id+" failed permission checks" ); return false; } } catch (UserPermissionException e) { M_log.warn("You do not have sufficient permission to edit the user with Id: "+id, e); return false; } catch (UserAlreadyDefinedException e) { M_log.error("A users already exists with EID of: "+id +"having email :"+ newEmail, e); return false; } }
Source:
<code>void onResponseReceive() { <START> networkMetrics.requestResponseRoundTripTime.update(System.currentTimeMillis() - requestSentTimeMs); <END> networkMetrics.requestResponseTotalTime.update(System.currentTimeMillis() - requestQueuedTimeMs); }</code><technical_language>router tracks requestLatency a function of this requestQueuedTime I think. noting, is useful track this</technical_language>

Target:
void onResponseReceive() { networkMetrics.requestResponseRoundTripTime.update(System.currentTimeMillis() - requestDequeuedAtMs); networkMetrics.requestResponseTotalTime.update(System.currentTimeMillis() - requestQueuedAtMs); }
Source:
<code>protected GoVisitor buildGoVisitor(@NotNull final ProblemsHolder holder, @NotNull LocalInspectionToolSession session) { return new GoVisitor() { @Override public void visitIndexOrSliceExpr(@NotNull GoIndexOrSliceExpr o) { Trinity<GoExpression, GoExpression, GoExpression> indexes = o.getIndices(); if (indexes.third == null && indexes.second instanceof GoCallExpr && o.getExpression() != null && o.getExpression().getReference() != null) { if (o.getExpression() instanceof GoReferenceExpression && ((GoReferenceExpression)o.getExpression()).getQualifier() != null) { return; } GoCallExpr callExpr = (GoCallExpr)indexes.second; <START> if (callExpr.getExpression().textMatches("len") && <END> callExpr.getArgumentList().getExpressionList().size() == 1) { GoExpression secondRightExpr = callExpr.getArgumentList().getExpressionList().get(0); if (secondRightExpr.getReference() != null && o.getExpression().getReference().resolve() == secondRightExpr.getReference().resolve()) { holder.registerProblem(callExpr, "Redundant index", ProblemHighlightType.LIKE_UNUSED_SYMBOL, DELETE_REDUNDANT_INDEX_QUICK_FIX); } } } } }; }</code><technical_language>check call expr is resolved builtin len function. GoPsiImplUtil.builtin(psiElement) GoReferenceExpression#resolve. E.g. com/goide/highlighting/GoAnnotator.java:137</technical_language>

Target:
protected GoVisitor buildGoVisitor(@NotNull final ProblemsHolder holder, @NotNull LocalInspectionToolSession session) { return new GoVisitor() { @Override public void visitIndexOrSliceExpr(@NotNull GoIndexOrSliceExpr o) { if (!(o.getExpression() instanceof GoReferenceExpression) || o.getExpression().getReference() == null || ((GoReferenceExpression)o.getExpression()).getQualifier() != null) { return; } Trinity<GoExpression, GoExpression, GoExpression> indexes = o.getIndices(); if (indexes.third == null && indexes.second instanceof GoCallExpr) { GoCallExpr callExpr = (GoCallExpr)indexes.second; GoExpression function = callExpr.getExpression(); if (function.textMatches("len") && function instanceof GoReferenceExpression && GoPsiImplUtil.builtin(((GoReferenceExpression)function).resolve()) && callExpr.getArgumentList().getExpressionList().size() == 1) { GoExpression secondRightExpr = callExpr.getArgumentList().getExpressionList().get(0); if (secondRightExpr.getReference() != null && o.getExpression().getReference().resolve() == secondRightExpr.getReference().resolve()) { holder.registerProblem(callExpr, "Redundant index", ProblemHighlightType.LIKE_UNUSED_SYMBOL, DELETE_REDUNDANT_INDEX_QUICK_FIX); } } } } }; }
Source:
<code>public void copy(IFileStore destination, int options, IProgressMonitor monitor) throws CoreException { SubMonitor <START> subMonitor = <END> SubMonitor.convert(monitor, 1); final IFileInfo sourceInfo = fetchInfo(EFS.NONE, null); if (sourceInfo.isDirectory()) { copyDirectory(sourceInfo, destination, options, subMonitor.split(1)); } else { copyFile(sourceInfo, destination, options, subMonitor.split(1)); } }</code><technical_language>submonitor is needed in this method. original monitor passed mutually exclusive method calls is</technical_language>

Target:
public void copy(IFileStore destination, int options, IProgressMonitor monitor) throws CoreException { final IFileInfo sourceInfo = fetchInfo(EFS.NONE, null); if (sourceInfo.isDirectory()) { copyDirectory(sourceInfo, destination, options, monitor); } else { copyFile(sourceInfo, destination, options, monitor); } }
Source:
<code>public static TimeZoneKey getTimeZoneKeyForOffset(long offsetMinutes) { if (offsetMinutes == 0) { return UTC_KEY; } if (offsetMinutes < OFFSET_TIME_ZONE_MIN || offsetMinutes > OFFSET_TIME_ZONE_MAX) { <START> throw new PrestoException(INVALID_FUNCTION_ARGUMENT, "Invalid offset minutes " + offsetMinutes); <END> } TimeZoneKey timeZoneKey = OFFSET_TIME_ZONE_KEYS[((int) offsetMinutes) - OFFSET_TIME_ZONE_MIN]; if (timeZoneKey == null) { throw new TimeZoneNotSupportedException(zoneIdForOffset(offsetMinutes)); } return timeZoneKey; }</code><technical_language>this exception raised here. Note for example 5 lines throw TimeZoneNotSupportedException a PrestoException. do offsetMinutes is some Presto function's argument some intermediate calculation</technical_language>

Target:
public static TimeZoneKey getTimeZoneKeyForOffset(long offsetMinutes) { if (offsetMinutes == 0) { return UTC_KEY; } checkArgument(offsetMinutes >= OFFSET_TIME_ZONE_MIN && offsetMinutes <= OFFSET_TIME_ZONE_MAX, "Invalid offset minutes %s", offsetMinutes); TimeZoneKey timeZoneKey = OFFSET_TIME_ZONE_KEYS[((int) offsetMinutes) - OFFSET_TIME_ZONE_MIN]; if (timeZoneKey == null) { throw new TimeZoneNotSupportedException(zoneIdForOffset(offsetMinutes)); } return timeZoneKey; }
Source:
<code>public Map<String, String> getEventHoverToolTipInfo(ITimeEvent event, long hoverTime) { AggregatedCalledFunctionStatistics statistics=((FlamegraphEvent) event).getStatistics(); ImmutableMap.Builder<String, String> builder = new ImmutableMap.Builder<>(); builder.put(String.valueOf(Messages.FlameGraph_Duration), String.format("%s", FORMATTER.format(event.getDuration()))); builder.put(String.valueOf(Messages.FlameGraph_SelfTime), String.format("%s", FORMATTER.format(((FlamegraphEvent) event).getSelfTime()))); builder.put(String.valueOf(Messages.FlameGraph_NbCalls), String.valueOf(NumberFormat.getIntegerInstance().format(statistics.getNbCalls()))); builder.put(String.valueOf(Messages.FlameGraph_MaxDuration), String.format("%s", FORMATTER.format((statistics.getMaxDuration())))); builder.put(String.valueOf(Messages.FlameGraph_MinDuration), String.format("%s", FORMATTER.format(statistics.getMinDuration()))); builder.put(String.valueOf(Messages.FlameGraph_AverageDuration), String.format("%s", FORMATTER.format(statistics.getAverage()))); builder.put(String.valueOf(Messages.FlameGraph_MaxSelfTime), String.format("%s", FORMATTER.format(statistics.getMaxSelfTime()))); builder.put(String.valueOf(Messages.FlameGraph_MinSelfTime), String.format("%s", FORMATTER.format(statistics.getMinSelfTime()))); <START> if(statistics.getStdDev()!= Double.NaN){ <END> builder.put(String.valueOf(Messages.FlameGraph_MinSelfTime+1), String.format("%s", FORMATTER.format(statistics.getStdDev()))); } return builder.build(); }</code><technical_language>space if !=</technical_language>

Target:
public Map<String, String> getEventHoverToolTipInfo(ITimeEvent event, long hoverTime) { AggregatedCalledFunctionStatistics statistics = ((FlamegraphEvent) event).getStatistics(); ImmutableMap.Builder<String, String> builder = new ImmutableMap.Builder<>(); builder.put(String.valueOf(Messages.FlameGraph_Duration), String.format("%s", FORMATTER.format(event.getDuration()))); builder.put(String.valueOf(Messages.FlameGraph_SelfTime), String.format("%s", FORMATTER.format(((FlamegraphEvent) event).getSelfTime()))); builder.put(String.valueOf(Messages.FlameGraph_NbCalls), String.valueOf(NumberFormat.getIntegerInstance().format(statistics.getNbCalls()))); builder.put(String.valueOf(Messages.FlameGraph_MaxDuration), String.format("%s", FORMATTER.format((statistics.getMaxDuration())))); builder.put(String.valueOf(Messages.FlameGraph_MinDuration), String.format("%s", FORMATTER.format(statistics.getMinDuration()))); builder.put(String.valueOf(Messages.FlameGraph_AverageDuration), String.format("%s", FORMATTER.format(statistics.getAverage()))); builder.put(String.valueOf(Messages.FlameGraph_MaxSelfTime), String.format("%s", FORMATTER.format(statistics.getMaxSelfTime()))); builder.put(String.valueOf(Messages.FlameGraph_MinSelfTime), String.format("%s", FORMATTER.format(statistics.getMinSelfTime()))); builder.put(String.valueOf(Messages.FlameGraph_Deviation), String.format("%s", FORMATTER.format(statistics.getStdDev()))); return builder.build(); }
Source:
<code>private static JMXServer startJMXServerWithPortRanges(Iterator<Integer> ports) { JMXServer successfullyStartedServer = null; while (ports.hasNext() && successfullyStartedServer == null) { JMXServer server = new JMXServer(); int port = ports.next(); if (port == 0) { <START> port = tryPokeForNewPort(); <END> } try { server.start(port); LOG.info("Started JMX server on port " + port + "."); successfullyStartedServer = server; } catch (IOException ioe) { LOG.debug("Could not start JMX server on port " + port + ".", ioe); try { server.stop(); } catch (Exception e) { LOG.debug("Could not stop JMX server.", e); } } } return successfullyStartedServer; }</code><technical_language>NetUtils#getAvailablePort instead; note this approach is inherently unreliable</technical_language>

Target:
private static JMXServer startJMXServerWithPortRanges(Iterator<Integer> ports) { JMXServer successfullyStartedServer = null; while (ports.hasNext() && successfullyStartedServer == null) { JMXServer server = new JMXServer(); int port = ports.next(); try { server.start(port); LOG.info("Started JMX server on port " + port + "."); successfullyStartedServer = server; } catch (IOException ioe) { LOG.debug("Could not start JMX server on port " + port + ".", ioe); try { server.stop(); } catch (Exception e) { LOG.debug("Could not stop JMX server.", e); } } } return successfullyStartedServer; }
Source:
<code>public EntrySplitter build() { <START> return new EntrySplitter(this); <END> }</code><technical_language>validate key separator entry separator chars</technical_language>

Target:
public EntrySplitter build() { if (entrySeparator == keyValueSeparator) { throw new IllegalArgumentException("entrySeparator == keyValueSeparator"); } return new EntrySplitter(this); }
Source:
<code>public void executeJsTests() { int totalCases = page.getTotalCases(); int failedCases = page.getFailedCases(); print("Executed " + totalCases + " JavaScript Unit tests..."); int expectedFailedCases = "firefox".equals(TestProperties.BROWSER) ? 0 : 4; assertEquals(expectedFailedCases, failedCases); assertTrue(totalCases != 0); <START> print("As expected, 0 failed tests out of " + totalCases + " tests."); <END> float coverage = page.getCoverage(); print(coverage + "% of scripts covered, the minimum requirement is " + MIN_COVERAGE_REQUIREMENT + "%"); assertTrue(coverage >= MIN_COVERAGE_REQUIREMENT); }</code><technical_language>change this print statement? 0 failed test cases anymore (funny part is issue change this 0 previously)</technical_language>

Target:
public void executeJsTests() { int totalCases = page.getTotalCases(); int failedCases = page.getFailedCases(); print("Executed " + totalCases + " JavaScript Unit tests..."); int expectedFailedCases = "firefox".equals(TestProperties.BROWSER) ? 0 : 4; assertEquals(expectedFailedCases, failedCases); assertTrue(totalCases != 0); print("As expected, " + expectedFailedCases + " failed tests out of " + totalCases + " tests."); float coverage = page.getCoverage(); print(coverage + "% of scripts covered, the minimum requirement is " + MIN_COVERAGE_REQUIREMENT + "%"); assertTrue(coverage >= MIN_COVERAGE_REQUIREMENT); }
Source:
<code><START> public Connection createConnection(String userName, String password) throws JMSException { <END> Connection connection = null; try { if (JMSConstants.JMS_SPEC_VERSION_1_1.equals(jmsSpec)) { if (this.destinationType.equals(JMSConstants.JMSDestinationType.QUEUE)) { connection = ((QueueConnectionFactory) (this.connectionFactory)) .createQueueConnection(userName, password); } else if (this.destinationType.equals(JMSConstants.JMSDestinationType.TOPIC)) { connection = ((TopicConnectionFactory) (this.connectionFactory)) .createTopicConnection(userName, password); if (isDurable) { connection.setClientID(clientId); } } return connection; } else { QueueConnectionFactory qConFac = null; TopicConnectionFactory tConFac = null; if (this.destinationType.equals(JMSConstants.JMSDestinationType.QUEUE)) { qConFac = (QueueConnectionFactory) this.connectionFactory; } else { tConFac = (TopicConnectionFactory) this.connectionFactory; } if (null != qConFac) { connection = qConFac.createQueueConnection(userName, password); } else if (null != tConFac) { connection = tConFac.createTopicConnection(userName, password); } if (isDurable && !isSharedSubscription) { connection.setClientID(clientId); } return connection; } } catch (JMSException e) { logger.error( "JMS Exception while creating connection through factory '" + this.connectionFactoryString + "' " + e.getMessage(), e); if (null != connection) { try { connection.close(); } catch (Exception ex) { logger.error("Error while closing the connection", ex); } } throw e; } }</code><technical_language>Added inheritDoc 718ced728f50191b9b9c3f5ce584fcfdfb52108b</technical_language>

Target:
public Connection createConnection(String userName, String password) throws JMSException { Connection connection = null; try { if (JMSConstants.JMS_SPEC_VERSION_1_1.equals(jmsSpec)) { if (this.destinationType.equals(JMSConstants.JMSDestinationType.QUEUE)) { connection = ((QueueConnectionFactory) (this.connectionFactory)) .createQueueConnection(userName, password); } else if (this.destinationType.equals(JMSConstants.JMSDestinationType.TOPIC)) { connection = ((TopicConnectionFactory) (this.connectionFactory)) .createTopicConnection(userName, password); if (isDurable) { connection.setClientID(clientId); } } return connection; } else { QueueConnectionFactory qConFac = null; TopicConnectionFactory tConFac = null; if (this.destinationType.equals(JMSConstants.JMSDestinationType.QUEUE)) { qConFac = (QueueConnectionFactory) this.connectionFactory; } else { tConFac = (TopicConnectionFactory) this.connectionFactory; } if (null != qConFac) { connection = qConFac.createQueueConnection(userName, password); } else if (null != tConFac) { connection = tConFac.createTopicConnection(userName, password); } if (isDurable && !isSharedSubscription) { connection.setClientID(clientId); } return connection; } } catch (JMSException e) { if (null != connection) { try { connection.close(); } catch (Exception ex) { logger.error("Error while closing the connection", ex); } } throw e; } }
Source:
<code>private Result runJUnit(final String... args) { <START> return jUnitCore.runMain(new RealSystem(), args); <END> }</code><technical_language>I want RealSystem() here; call System.exit()</technical_language>

Target:
private Result runJUnit(final String... args) { return jUnitCore.runMain(new TestSystem(), args); }
Source:
<code>public ScalarFunctionImplementation specialize(BoundVariables boundVariables, int arity, TypeManager typeManager, FunctionManager functionManager) { Type keyType = boundVariables.getTypeVariable("K"); Type valueType = boundVariables.getTypeVariable("V"); MethodHandle methodHandle; if (keyType.getJavaType() == boolean.class) { methodHandle = METHOD_HANDLE_BOOLEAN; } else if (keyType.getJavaType() == long.class) { methodHandle = METHOD_HANDLE_LONG; } else if (keyType.getJavaType() == double.class) { methodHandle = METHOD_HANDLE_DOUBLE; } else if (keyType.getJavaType() == Slice.class) { methodHandle = METHOD_HANDLE_SLICE; } else { methodHandle = METHOD_HANDLE_OBJECT; } methodHandle = MethodHandles.insertArguments(methodHandle, 0, legacyMissingKey); MissingKeyExceptionFactory missingKeyExceptionFactory = new MissingKeyExceptionFactory(functionManager, keyType); <START> methodHandle = methodHandle.bindTo(missingKeyExceptionFactory).bindTo(keyType).bindTo(valueType); <END> methodHandle = methodHandle.asType(methodHandle.type().changeReturnType(Primitives.wrap(valueType.getJavaType()))); return new ScalarFunctionImplementation( true, ImmutableList.of( valueTypeArgumentProperty(RETURN_NULL_ON_NULL), valueTypeArgumentProperty(RETURN_NULL_ON_NULL)), methodHandle, isDeterministic()); }</code><technical_language>methodHandle = methodHandle.bindTo(missingKeyExceptionFactory).bindTo(valueType); is good enough</technical_language>

Target:
public ScalarFunctionImplementation specialize(BoundVariables boundVariables, int arity, TypeManager typeManager, FunctionManager functionManager) { Type keyType = boundVariables.getTypeVariable("K"); Type valueType = boundVariables.getTypeVariable("V"); MethodHandle methodHandle; if (keyType.getJavaType() == boolean.class) { methodHandle = METHOD_HANDLE_BOOLEAN; } else if (keyType.getJavaType() == long.class) { methodHandle = METHOD_HANDLE_LONG; } else if (keyType.getJavaType() == double.class) { methodHandle = METHOD_HANDLE_DOUBLE; } else if (keyType.getJavaType() == Slice.class) { methodHandle = METHOD_HANDLE_SLICE; } else { methodHandle = METHOD_HANDLE_OBJECT; } methodHandle = MethodHandles.insertArguments(methodHandle, 0, legacyMissingKey); MissingKeyExceptionFactory missingKeyExceptionFactory = new MissingKeyExceptionFactory(functionManager, keyType); methodHandle = methodHandle.bindTo(missingKeyExceptionFactory).bindTo(valueType); methodHandle = methodHandle.asType(methodHandle.type().changeReturnType(Primitives.wrap(valueType.getJavaType()))); return new ScalarFunctionImplementation( true, ImmutableList.of( valueTypeArgumentProperty(RETURN_NULL_ON_NULL), valueTypeArgumentProperty(RETURN_NULL_ON_NULL)), methodHandle, isDeterministic()); }
Source:
<code>public Mono<Response<BlockBlobItem>> uploadWithResponse(BlobParallelUploadOptions options) { try { <START> Objects.requireNonNull(options); <END> final Map<String, String> metadataFinal = options.getMetadata() == null ? new HashMap<>() : options.getMetadata(); options.setMetadata(metadataFinal); Flux<ByteBuffer> data = options.getDataFlux() == null ? Utility.convertStreamToByteBuffer( options.getDataStream(), options.getLength(), BLOB_DEFAULT_UPLOAD_BLOCK_SIZE) : options.getDataFlux(); Mono<Flux<ByteBuffer>> dataFinal = prepareToSendEncryptedRequest(data, metadataFinal); return dataFinal.flatMap(df -> super.uploadWithResponse(new BlobParallelUploadOptions(df) .setParallelTransferOptions(options.getParallelTransferOptions()).setHeaders(options.getHeaders()) .setMetadata(options.getMetadata()).setTags(options.getTags()).setTier(options.getTier()) .setRequestConditions(options.getRequestConditions()).setTimeout(options.getTimeout()))); } catch (RuntimeException ex) { return monoError(logger, ex); } }</code><technical_language>"utils" for that</technical_language>

Target:
public Mono<Response<BlockBlobItem>> uploadWithResponse(BlobParallelUploadOptions options) { try { StorageImplUtils.assertNotNull("options", options); final Map<String, String> metadataFinal = options.getMetadata() == null ? new HashMap<>() : options.getMetadata(); Flux<ByteBuffer> data = options.getDataFlux() == null ? Utility.convertStreamToByteBuffer( options.getDataStream(), options.getLength(), BLOB_DEFAULT_UPLOAD_BLOCK_SIZE) : options.getDataFlux(); Mono<Flux<ByteBuffer>> dataFinal = prepareToSendEncryptedRequest(data, metadataFinal); return dataFinal.flatMap(df -> super.uploadWithResponse(new BlobParallelUploadOptions(df) .setParallelTransferOptions(options.getParallelTransferOptions()).setHeaders(options.getHeaders()) .setMetadata(metadataFinal).setTags(options.getTags()).setTier(options.getTier()) .setRequestConditions(options.getRequestConditions()))); } catch (RuntimeException ex) { return monoError(logger, ex); } }
Source:
<code>public void deleteAllCoursesCascade(List<InstructorAttributes> instructorList) { Assumption.assertNotNull("Supplied parameter was null", instructorList); List<String> recoveryCourseIdList = new ArrayList<>(); for (InstructorAttributes instructor : instructorList) { <START> if (coursesDb.getCourse(instructor.courseId).isCourseDeleted()) { <END> recoveryCourseIdList.add(instructor.courseId); } } for (String courseId : recoveryCourseIdList) { studentsLogic.deleteStudentsForCourse(courseId); instructorsLogic.deleteInstructorsForCourse(courseId); feedbackSessionsLogic.deleteFeedbackSessionsForCourseCascade(courseId); coursesDb.deleteCourse(courseId); } }</code><technical_language>Streams</technical_language>

Target:
public void deleteAllCoursesCascade(List<InstructorAttributes> instructorList) { Assumption.assertNotNull("Supplied parameter was null", instructorList); List<String> recoveryCourseIdList = instructorList.stream() .filter(instructor -> coursesDb.getCourse(instructor.courseId).isCourseDeleted()) .map(InstructorAttributes::getCourseId) .collect(Collectors.toList()); for (String courseId : recoveryCourseIdList) { deleteCourseCascade(courseId); } }
Source:
<code>public MiscOkResponse(String content) { <START> super("\\"); <END> this.content = content; }</code><technical_language>URL instead</technical_language>

Target:
public MiscOkResponse(String content) { super(URL); this.content = content; }
Source:
<code>public boolean isSyncCommand(String command) { Vector<Entry> entries = this.getEntriesForCommand(command); <START> return entries.size() == 1 && entries.elementAt(0) instanceof SyncEntry; <END> }</code><technical_language>Is a reason this a type check a polymorphic check(IE: "entries.elementAt(0).isSync() (0).getCommandType().equals(TYPE_SYNC))? more "Best practice"y</technical_language>

Target:
public boolean isSyncCommand(String command) { Vector<Entry> entries = this.getEntriesForCommand(command); return entries.size() == 1 && entries.elementAt(0).isSync(); }
Source:
<code>public boolean isConnectionValid( Connection connection, int timeout ) throws SQLException { if (jdbcDriverInfo().jdbcMajorVersion() >= 4) { return connection.isValid(timeout); } String query = checkConnectionQuery(); if (query != null) { try (Statement statement = connection.createStatement()) { boolean hasResultSet = statement.execute(query); if (hasResultSet) { statement.getResultSet().close(); } } } <START> return true; <END> }</code><technical_language>Confused return of this method. results of connection-checking query influence return value? is strategy perform query return true matter what, assuming a SQLException thrown if connection valid</technical_language>

Target:
public boolean isConnectionValid( Connection connection, int timeout ) throws SQLException { if (jdbcDriverInfo().jdbcMajorVersion() >= 4) { return connection.isValid(timeout); } String query = checkConnectionQuery(); if (query != null) { try (Statement statement = connection.createStatement()) { if (statement.execute(query)) { try (ResultSet rs = statement.getResultSet()) { } } } } return true; }