auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected boolean canDoAction() { if (!super.canDoAction()) { return false; } if (Guid.isNullOrEmpty(getParameters().getHookId())) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_HOOK_ID_IS_REQUIRED); return false; } if (getGlusterHook() == null) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_HOOK_DOES_NOT_EXIST); return false; <START> } <END> if (getMissingServerHooks().isEmpty()) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_HOOK_NO_CONFLICT_SERVERS); return false; } return true; }</code><technical_language>checks moved a common parent class, is repeated in GlusterHookStatusChangeCommand well</technical_language>

Target:
protected boolean canDoAction() { if (!super.canDoAction()) { return false; } if (getMissingServerHooks().isEmpty()) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_HOOK_NO_CONFLICT_SERVERS); return false; } return true; }
Source:
<code><START> default void interactBlock(Vector3i position, Direction side) { <END> interactBlock(checkNotNull(position, "position").getX(), position.getY(), position.getZ(), checkNotNull(side, "side")); }</code><technical_language>Return boolean Cancellable</technical_language>

Target:
default boolean interactBlock(Vector3i position, Direction side) { return interactBlock(checkNotNull(position, "position").getX(), position.getY(), position.getZ(), checkNotNull(side, "side")); }
Source:
<code>public LiveData<Boolean> downloadNotifications() { if (notificationDownloadResponse == null) { notificationDownloadResponse = new MutableLiveData<>(); } try { int id = JWTUtils.getIdentity(AuthUtil.getAuthorization()); compositeDisposable.add(APIClient.getOpenEventAPI().getNotifications(id) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe( notifications -> { Timber.i("Downloaded notifications"); realmRepo.saveNotifications(notifications); notificationDownloadResponse.setValue(true); }, throwable -> { Timber.e("Notification download failed"); notificationDownloadResponse.setValue(false); <START> })); <END> } catch (JSONException e) { Timber.e(e); } return notificationDownloadResponse; }</code><technical_language>This abstracted VM, add a NotificationRepository</technical_language>

Target:
public LiveData<Boolean> downloadNotifications() { if (notificationDownloadResponse == null) { notificationDownloadResponse = new MutableLiveData<>(); } Observable<List<Notification>> notificationsObservable = notificationsRepository.downloadNotifications(); if (notificationsObservable != null) { compositeDisposable.add(notificationsObservable.subscribe(notifications -> { Timber.i("Downloaded notifications"); notificationDownloadResponse.setValue(true); }, throwable -> { Timber.e("Notification download failed"); notificationDownloadResponse.setValue(false); })); } return notificationDownloadResponse; }
Source:
<code>Method toMethod() throws ClassNotFoundException, NoSuchMethodException, IllegalClassFormatException { if (method != null) { return method; } String classname = this.classname; int superclassIndex = 0; JavaClass jc = null; do { try { jc = ReplacementFileReader.getJavaClassFromClassname(classname); } catch (Throwable e) { throw new IllegalClassFormatException("Unable to read: " + classname); } if (jc == null) { throw new ClassNotFoundException("Class not found: " + classname); } for (Method m : jc.getMethods()) { if (m.getName().equals(this.name) && Arrays.equals(m.getArgumentTypes(), this.paramTypes)) { this.method = m; return m; } } <START> superclassIndex = jc.getSuperclassNameIndex(); END> classname = jc.getSuperclassName(); } while (superclassIndex != 0); throw new NoSuchMethodException("Method not found: " + this.name); }</code><technical_language>this "0 if superclass is Object"? "if this class is Object"</technical_language>

Target:
Method toMethod() throws ClassNotFoundException, NoSuchMethodException, IllegalClassFormatException { if (method != null) { return method; } String currentClassname = classname; while (true) { JavaClass currentClass; try { currentClass = ReplacementFileReader.getJavaClassFromClassname(currentClassname); } catch (Throwable e) { throw new IllegalClassFormatException("Unable to read: " + currentClassname); } if (currentClass == null) { throw new ClassNotFoundException("Class " + currentClassname + " not found"); } for (Method m : currentClass.getMethods()) { if (m.getName().equals(this.name) && Arrays.equals(m.getArgumentTypes(), this.paramTypes)) { this.method = m; return m; } } if (currentClass.getSuperclassNameIndex() == 0) { throw new NoSuchMethodException("Method " + this.name + " not found"); } currentClassname = currentClass.getSuperclassName(); } }
Source:
<code>protected void fix(TaskListener listener) throws Exception { LOGGER.info("Initiating a re-keying of secrets. See "+getLogFile()); SecretRewriter rewriter = new SecretRewriter(); try { PrintStream log = listener.getLogger(); log.println("Started re-keying " + new Date()); int count = rewriter.rewriteRecursive(Jenkins.get().getRootDir(), listener); log.printf("Completed re-keying %d files on %s\n",count,new Date()); new RekeySecretAdminMonitor().done.on(); <START> LOGGER.finest("Secret re-keying completed"); <END> } catch (Exception e) { LOGGER.log(Level.SEVERE, "Fatal failure in re-keying secrets",e); Functions.printStackTrace(e, listener.error("Fatal failure in rewriting secrets")); } }</code><technical_language>Basically dead code I remember this _forever_, a visible-by-default log message considered helpful</technical_language>

Target:
protected void fix(TaskListener listener) throws Exception { LOGGER.info("Initiating a re-keying of secrets. See "+getLogFile()); SecretRewriter rewriter = new SecretRewriter(); try { PrintStream log = listener.getLogger(); log.println("Started re-keying " + new Date()); int count = rewriter.rewriteRecursive(Jenkins.get().getRootDir(), listener); log.printf("Completed re-keying %d files on %s\n",count,new Date()); new RekeySecretAdminMonitor().done.on(); LOGGER.info("Secret re-keying completed"); } catch (Exception e) { LOGGER.log(Level.SEVERE, "Fatal failure in re-keying secrets",e); Functions.printStackTrace(e, listener.error("Fatal failure in rewriting secrets")); } }
Source:
<code>public Class<? extends ArrayAggregationState> getGroupedStateClass() { if (mode == NEW) { return GroupArrayAggregationState.class; } if (mode == LEGACY) { return LegacyArrayAggregationGroupState.class; } <START> throw new PrestoException(FUNCTION_IMPLEMENTATION_ERROR, format("Unexpected group enum type %s", mode)); <END> }</code><technical_language>switch instead of ifs</technical_language>

Target:
public Class<? extends ArrayAggregationState> getGroupedStateClass() { switch (mode) { case NEW: return GroupArrayAggregationState.class; case LEGACY: return LegacyArrayAggregationGroupState.class; default: throw new PrestoException(FUNCTION_IMPLEMENTATION_ERROR, format("Unexpected group enum type %s", mode)); } }
Source:
<code>public String[] getClientAliases(String keyType, Principal[] issuers) { int count = getAliasCount(); if (count == 0) { return null; } String[] aliases = new String[count]; <START> System.arraycopy(this.names, 0, aliases, 0, aliases.length); <END> return aliases; }</code><technical_language>Is this Arrays.copyOf(...)</technical_language>

Target:
public String[] getClientAliases(String keyType, Principal[] issuers) { int count = this.names.length; if (count == 0) { return null; } return Arrays.copyOf(this.names, count); }
Source:
<code>public CommandResult execute() { try { furnace = FurnaceFactory.getInstance(); furnace.setServerMode(true); loadAddons(); try { Future<Furnace> future = furnace.startAsync(); future.get(); } catch (Exception e) { System.out.println("Failed to start "+Util.WINDUP_BRAND_NAME_ACRONYM+"!"); if (e.getMessage() != null) System.out.println("Failure reason: " + e.getMessage()); <START> e.printStackTrace(); <END> } this.analyze(); this.furnace.stop(); } catch (Throwable t) { System.err.println(Util.WINDUP_BRAND_NAME_ACRONYM + " execution failed due to: " + t.getMessage()); t.printStackTrace(); } return null; }</code><technical_language>Printing Stack Trace is printing message , right</technical_language>

Target:
public CommandResult execute() { try { furnace = FurnaceFactory.getInstance(); furnace.setServerMode(true); loadAddons(); try { Future<Furnace> future = furnace.startAsync(); future.get(); } catch (Exception e) { System.out.println("Failed to start "+Util.WINDUP_BRAND_NAME_ACRONYM+"!"); e.printStackTrace(); } this.analyze(); this.furnace.stop(); } catch (Throwable t) { System.err.println(Util.WINDUP_BRAND_NAME_ACRONYM + " execution failed due to: " + t.getMessage()); t.printStackTrace(); } return null; }
Source:
<code>public void stop(boolean stopGracefully) { synchronized (stateChangeLock) { Preconditions.checkState(started, "not started"); log.info("Beginning shutdown of KafkaSupervisor[%s]", dataSource); try { scheduledExec.shutdownNow(); Optional<TaskRunner> taskRunner = taskMaster.getTaskRunner(); if (taskRunner.isPresent()) { taskRunner.get().unregisterListener(supervisorId); } synchronized (stopLock) { if (stopGracefully) { log.info("Posting GracefulShutdownNotice, signalling managed tasks to complete and publish"); notices.add(new GracefulShutdownNotice()); } else { log.info("Posting ShutdownNotice"); notices.add(new ShutdownNotice()); } long endTime = System.currentTimeMillis() + SHUTDOWN_TIMEOUT_MILLIS; while (!stopped) { long sleepTime = endTime - System.currentTimeMillis(); if (sleepTime <= 0) { log.info("Timed out while waiting for shutdown"); stopped = true; break; } stopLock.wait(sleepTime); } } log.info("Shutdown notice handled"); taskClient.close(); <START> workerExec.shutdown(); <END> exec.shutdownNow(); started = false; log.info("KafkaSupervisor[%s] has stopped", dataSource); } catch (Exception e) { log.makeAlert(e, "Exception stopping KafkaSupervisor[%s]", dataSource) .emit(); } } }</code><technical_language>rationale for shutdown shutdownNow here</technical_language>

Target:
public void stop(boolean stopGracefully) { synchronized (stateChangeLock) { Preconditions.checkState(started, "not started"); log.info("Beginning shutdown of KafkaSupervisor[%s]", dataSource); try { scheduledExec.shutdownNow(); Optional<TaskRunner> taskRunner = taskMaster.getTaskRunner(); if (taskRunner.isPresent()) { taskRunner.get().unregisterListener(supervisorId); } synchronized (stopLock) { if (stopGracefully) { log.info("Posting GracefulShutdownNotice, signalling managed tasks to complete and publish"); notices.add(new GracefulShutdownNotice()); } else { log.info("Posting ShutdownNotice"); notices.add(new ShutdownNotice()); } long endTime = System.currentTimeMillis() + SHUTDOWN_TIMEOUT_MILLIS; while (!stopped) { long sleepTime = endTime - System.currentTimeMillis(); if (sleepTime <= 0) { log.info("Timed out while waiting for shutdown"); stopped = true; break; } stopLock.wait(sleepTime); } } log.info("Shutdown notice handled"); taskClient.close(); workerExec.shutdownNow(); exec.shutdownNow(); started = false; log.info("KafkaSupervisor[%s] has stopped", dataSource); } catch (Exception e) { log.makeAlert(e, "Exception stopping KafkaSupervisor[%s]", dataSource) .emit(); } } }
Source:
<code>private void removeAvailablePointsJson(Path projectPath) { <START> File availablePointsJson = new File(projectPath.toAbsolutePath().toString() <END> + "/.available_points.json"); availablePointsJson.delete(); }</code><technical_language>This is work in Windows path separator is \. Consider like: Files.delete(projectPath.resolve(".available_points.json"))</technical_language>

Target:
private void removeAvailablePointsJson(Path projectPath) throws IOException { Files.deleteIfExists(projectPath.resolve(".available_points.json")); }
Source:
<code><START> public XRYKeyValuePair(String key, String value, String namespace) { <END> this.key = key.trim(); this.value = value.trim(); this.namespace = namespace.trim(); }</code><technical_language>public constructor in non-public class</technical_language>

Target:
XRYKeyValuePair(String key, String value, String namespace) { this.key = key.trim(); this.value = value.trim(); this.namespace = namespace.trim(); }
Source:
<code>private int estimateAverageLogicalSizePerRow(Page page) { <START> checkArgument(page.getPositionCount() > 0); <END> Page chunk = page.getRegion(0, Math.min(page.getPositionCount(), 100)); return (int) (chunk.getLogicalSizeInBytes() / chunk.getPositionCount()); }</code><technical_language>add a message, e.g.: "page is empty"</technical_language>

Target:
private int estimateAverageLogicalSizePerRow(Page page) { checkArgument(page.getPositionCount() > 0, "page is empty"); Page chunk = page.getRegion(0, min(page.getPositionCount(), 100)); return toIntExact(chunk.getLogicalSizeInBytes() / chunk.getPositionCount()); }
Source:
<code>public void execute(Runnable command) { <START> if (DsfDebugOptions.DEBUG && DsfDebugOptions.DEBUG_EXECUTOR && command instanceof DsfExecutable) { <END> assert !((DsfExecutable)command).getSubmitted() : "Executable was previously executed."; ((DsfExecutable)command).setSubmitted(); } command.run(); }</code><technical_language>Remove chedk for DEBUG part of DsfDebugOptions</technical_language>

Target:
public void execute(Runnable command) { if (DsfDebugOptions.DEBUG_EXECUTOR && command instanceof DsfExecutable) { assert !((DsfExecutable)command).getSubmitted() : "Executable was previously executed."; ((DsfExecutable)command).setSubmitted(); } command.run(); }
Source:
<code>private CallExpression rewriteCast(CallExpression call) { if (call.getArguments().get(0) instanceof CallExpression) { CallExpression innerCall = (CallExpression) call.getArguments().get(0); if (innerCall.getSignature().getName().equals("json_parse")) { checkArgument(innerCall.getType().equals(JSON)); checkArgument(innerCall.getArguments().size() == 1); TypeSignature returnType = call.getSignature().getReturnType(); <START> if (returnType.getBase().equals(ARRAY)) { <END> return call( functionManager.lookupCast( JSON_TO_ARRAY_CAST, parseTypeSignature(VARCHAR), returnType).getSignature(), call.getType(), innerCall.getArguments()); } if (returnType.getBase().equals(MAP)) { return call( functionManager.lookupCast( JSON_TO_MAP_CAST, parseTypeSignature(VARCHAR), returnType).getSignature(), call.getType(), innerCall.getArguments()); } if (returnType.getBase().equals(ROW)) { return call( functionManager.lookupCast( JSON_TO_ROW_CAST, parseTypeSignature(VARCHAR), returnType).getSignature(), call.getType(), innerCall.getArguments()); } } } return call( functionManager.lookupCast( CastType.CAST, call.getArguments().get(0).getType().getTypeSignature(), call.getType().getTypeSignature()).getSignature(), call.getType(), call.getArguments()); }</code><technical_language>This is great :) understand wrote this a fixed internalScalarFunction ..</technical_language>

Target:
private CallExpression rewriteCast(CallExpression call) { if (call.getArguments().get(0) instanceof CallExpression) { CallExpression innerCall = (CallExpression) call.getArguments().get(0); if (innerCall.getFunctionHandle().getSignature().getName().equals("json_parse")) { checkArgument(innerCall.getType().equals(JSON)); checkArgument(innerCall.getArguments().size() == 1); TypeSignature returnType = call.getFunctionHandle().getSignature().getReturnType(); if (returnType.getBase().equals(ARRAY)) { return call( functionManager.lookupCast( JSON_TO_ARRAY_CAST, parseTypeSignature(VARCHAR), returnType), call.getType(), innerCall.getArguments()); } if (returnType.getBase().equals(MAP)) { return call( functionManager.lookupCast( JSON_TO_MAP_CAST, parseTypeSignature(VARCHAR), returnType), call.getType(), innerCall.getArguments()); } if (returnType.getBase().equals(ROW)) { return call( functionManager.lookupCast( JSON_TO_ROW_CAST, parseTypeSignature(VARCHAR), returnType), call.getType(), innerCall.getArguments()); } } } return call( functionManager.lookupCast( CAST, call.getArguments().get(0).getType().getTypeSignature(), call.getType().getTypeSignature()), call.getType(), call.getArguments()); }
Source:
<code>public Flux<ByteBuffer> query(String expression) { throw logger.logExceptionAsError(new UnsupportedOperationException( <START> "Cannot query a client side encrypted client")); <END> }</code><technical_language>rephrase this "Cannot query data encrypted client side"</technical_language>

Target:
public Flux<ByteBuffer> query(String expression) { throw logger.logExceptionAsError(new UnsupportedOperationException( "Cannot query data encrypted on client side")); }
Source:
<code>public SingleNodeIntegrationTestSupport(SingleNodeApplication application) { <START> this(application, "classpath:/module"); <END> }</code><technical_language>WOW, this utterly wrong..</technical_language>

Target:
public SingleNodeIntegrationTestSupport(SingleNodeApplication application) { Assert.notNull(application, "SingleNodeApplication must not be null"); this.application = application; streamDefinitionRepository = application.pluginContext().getBean(StreamDefinitionRepository.class); jobDefinitionRepository = application.pluginContext().getBean(JobDefinitionRepository.class); streamRepository = application.pluginContext().getBean(StreamRepository.class); jobRepository = application.pluginContext().getBean(JobRepository.class); streamResourceStateVerifier = new ResourceStateVerifier(streamRepository, streamDefinitionRepository); jobResourceStateVerifier = new ResourceStateVerifier(jobRepository, jobDefinitionRepository); streamDeployer = application.adminContext().getBean(StreamDeployer.class); messageBus = application.pluginContext().getBean(MessageBusSupport.class); zooKeeperConnection = application.adminContext().getBean(ZooKeeperConnection.class); moduleDeployer = application.containerContext().getBean(ModuleDeployer.class); }
Source:
<code><START> private static final Execution getExecution() { <END> return Utils.getComponent(Execution.class); }</code><technical_language>needs this method static</technical_language>

Target:
private final Execution getExecution() { return Utils.getComponent(Execution.class); }
Source:
<code>public static BlockBuilder quantileBoundsToArray(double lowerQuantile, double upperQuantile) { <START> QuantileDigestFunctions.validateQuantileRange(lowerQuantile, upperQuantile); <END> BlockBuilder blockBuilder = DOUBLE.createBlockBuilder(null, 2); DOUBLE.writeDouble(blockBuilder, lowerQuantile); DOUBLE.writeDouble(blockBuilder, upperQuantile); return blockBuilder; }</code><technical_language>static import validateQuantileRange</technical_language>

Target:
public static BlockBuilder quantileBoundsToArray(double lowerQuantile, double upperQuantile) { validateQuantileRange(lowerQuantile, upperQuantile); BlockBuilder blockBuilder = DOUBLE.createBlockBuilder(null, 2); DOUBLE.writeDouble(blockBuilder, lowerQuantile); DOUBLE.writeDouble(blockBuilder, upperQuantile); return blockBuilder; }
Source:
<code>public boolean isFull() { <START> return chunks.size() == chunks.get(0).getObject().getAtomicUpdateGroupSize(); <END> }</code><technical_language>this check chunks.get(0) exists</technical_language>

Target:
public boolean isFull() { return !isEmpty() && chunks.size() == chunks.get(0).getObject().getAtomicUpdateGroupSize(); }
Source:
<code>private void setValidMongoOnlyNoCollections(){ <START> jsonConfig = "{\"mongo\":{\"uri\":\"mongodb://user:pass@test.com/cgm_data\"}}"; <END> setBarcode(); }</code><technical_language>single quotes for JSON quotation marks, instead of \"</technical_language>

Target:
private void setValidMongoOnlyNoCollections() { jsonConfig = "{'mongo':{'uri':'mongodb://user:pass@test.com/cgm_data'}}"; setBarcode(); }
Source:
<code>public void execute(IProgressMonitor m) throws CoreException { IProgressMonitor monitor; if (m == null) monitor = new NullProgressMonitor(); else monitor = m; IWorkspaceRunnable action = new IWorkspaceRunnable() { public void run(IProgressMonitor actMonitor) throws CoreException { final String taskName = NLS.bind( CoreText.RenameRemoteOperation_TaskName, oldName, newName); actMonitor.beginTask(taskName, 1); try { final String REMOTE = "remote"; final <START> StoredConfig config <END> = repository.getConfig(); final Set<String> names = config.getNames(REMOTE, oldName); if (names.size() == 0) throw new IOException("Remote not found"); for (String name : names) { config.setString(REMOTE, newName, name, config.getString(REMOTE, oldName, name)); config.unset(REMOTE, oldName, name); } config.unsetSection(REMOTE, oldName); config.save(); } catch (IOException e) { throw new CoreException(Activator.error(e.getMessage(), e)); } actMonitor.worked(1); actMonitor.done(); } }; ResourcesPlugin.getWorkspace().run(action, getSchedulingRule(), IWorkspace.AVOID_UPDATE, monitor); }</code><technical_language>RemoteConfig parse a remote section - need enhance RemoteConfig support renaming</technical_language>

Target:
public void execute(IProgressMonitor m) throws CoreException { IProgressMonitor monitor; if (m == null) monitor = new NullProgressMonitor(); else monitor = m; IWorkspaceRunnable action = new IWorkspaceRunnable() { public void run(IProgressMonitor actMonitor) throws CoreException { final String taskName = NLS.bind( CoreText.RenameRemoteOperation_TaskName, oldName, newName); actMonitor.beginTask(taskName, 1); try { new Git(repository).remoteRename().setOldName(oldName) .setNewName(newName).call(); repository.getConfig().save(); } catch (Exception e) { throw new CoreException(Activator.error(e.getMessage(), e)); } actMonitor.worked(1); actMonitor.done(); } }; ResourcesPlugin.getWorkspace().run(action, monitor); }
Source:
<code>public void setLoadMeterTimerPeriod(int p) { <START> assert (p > m_LoadMeterTimerPeriodMin); <END> m_LoadMeterTimerPeriod = p; disposeLoadMeterTimer(); initializeLoadMeterTimer(); }</code><technical_language>=</technical_language>

Target:
public void setLoadMeterTimerPeriod(int p) { if (m_loadMeterTimerPeriod == p) return; m_loadMeterTimerPeriod = p > LOAD_METER_TIMER_MIN ? p : LOAD_METER_TIMER_MIN; disposeLoadMeterTimer(); initializeLoadMeterTimer(); }
Source:
<code>public void onUpdate() { if (!firstUpdate && !this.onGround) { float f = 0.98F; this.motionX = this.motionX / f; this.motionY = this.motionY / f; this.motionZ = this.motionZ / f; } firstUpdate = false; <START> <END> super.onUpdate(); }</code><technical_language>supposed isDead, more sensible. Basically, purpose of this code super.onUpdate handle state changes, overwrite movement own. Restoring motion update leads numerical errors, mismatch canon targeting algorithm (not super precise in place though)</technical_language>

Target:
public void onUpdate() { super.onUpdate(); if (!this.onGround) { double f = 0.98F; this.motionX = this.motionX / f; this.motionY = this.motionY / f; this.motionZ = this.motionZ / f; } }
Source:
<code>@Test public void testIntersectToIntersect0() { final String mv = "" + "select \"deptno\" from\n" <START> + "\"emps\" intersect select \"deptno\" from \"depts\""; <END> final String query = "" + "select \"deptno\" from\n" + "\"depts\" intersect select \"deptno\" from \"emps\""; checkMaterialize(mv, query, true); }</code><technical_language>Redundant spaces</technical_language>

Target:
@Test public void testIntersectToIntersect0() { final String mv = "" + "select \"deptno\" from \"emps\"\n" + "intersect\n" + "select \"deptno\" from \"depts\""; final String query = "" + "select \"deptno\" from \"depts\"\n" + "intersect\n" + "select \"deptno\" from \"emps\""; checkMaterialize(mv, query, true); }
Source:
<code>public boolean shouldBlockFeedbackPrompt(@NonNull final Long cachedEventValue, @NonNull final Context applicationContext) { <START> return cachedEventValue == Long.MAX_VALUE || (System.currentTimeMillis() - cachedEventValue) < TimeUnit.DAYS.toMillis(cooldownPeriodDays); <END> }</code><technical_language>This block if event happened is want! (We do want for warmup event though)</technical_language>

Target:
public boolean shouldBlockFeedbackPrompt(@NonNull final Long cachedEventValue, @NonNull final Context applicationContext) { return (System.currentTimeMillis() - cachedEventValue) < TimeUnit.DAYS.toMillis(cooldownPeriodDays); }
Source:
<code>public Object[][] provideScenarios() { try { List<Object[]> scenarios = new ArrayList<>(); List<CucumberFeature> features = getFeatures(); for (CucumberFeature feature : features) { for (PickleEvent pickle : feature.getPickles()) { if (filters.test(pickle)) { scenarios.add(new Object[]{new PickleEventWrapperImpl(pickle), new CucumberFeatureWrapperImpl(feature)}); <START> } <END> } } return scenarios.toArray(new Object[][]{}); } catch (CucumberException e) { return new Object[][]{new Object[]{new CucumberExceptionWrapper(e), null}}; } }</code><technical_language>This done a stream</technical_language>

Target:
public Object[][] provideScenarios() { try { return getFeatures().stream() .flatMap(feature -> feature.getPickles().stream() .filter(filters) .map(pickle -> new Object[]{ new PickleEventWrapperImpl(pickle), new CucumberFeatureWrapperImpl(feature)})) .collect(toList()) .toArray(new Object[0][0]); } catch (CucumberException e) { return new Object[][]{new Object[]{new CucumberExceptionWrapper(e), null}}; } }
Source:
<code>public static List<DataSegment> getPublishedSegments(HadoopDruidIndexerConfig config) { <START> final Configuration conf = JobHelper.injectJobProperties(JobHelper.injectSystemProperties(new Configuration()), config); <END> final ObjectMapper jsonMapper = HadoopDruidIndexerConfig.JSON_MAPPER; ImmutableList.Builder<DataSegment> publishedSegmentsBuilder = ImmutableList.builder(); final Path descriptorInfoDir = config.makeDescriptorInfoDir(); try { FileSystem fs = descriptorInfoDir.getFileSystem(conf); for (FileStatus status : fs.listStatus(descriptorInfoDir)) { final DataSegment segment = jsonMapper.readValue(fs.open(status.getPath()), DataSegment.class); publishedSegmentsBuilder.add(segment); log.info("Adding segment %s to the list of published segments", segment.getIdentifier()); } } catch (FileNotFoundException e) { log.error( "[%s] SegmentDescriptorInfo is not found usually when indexing process did not produce any segments meaning" + " either there was no input data to process or all the input events were discarded due to some error", e.getMessage() ); Throwables.propagate(e); } catch (IOException e) { throw Throwables.propagate(e); } List<DataSegment> publishedSegments = publishedSegmentsBuilder.build(); return publishedSegments; }</code><technical_language>add a method injectSystemAndJobProperties(Configuration, HadoopDruidIndexerConfig)</technical_language>

Target:
public static List<DataSegment> getPublishedSegments(HadoopDruidIndexerConfig config) { final Configuration conf = JobHelper.injectSystemProperties(new Configuration()); config.addJobProperties(conf); final ObjectMapper jsonMapper = HadoopDruidIndexerConfig.JSON_MAPPER; ImmutableList.Builder<DataSegment> publishedSegmentsBuilder = ImmutableList.builder(); final Path descriptorInfoDir = config.makeDescriptorInfoDir(); try { FileSystem fs = descriptorInfoDir.getFileSystem(conf); for (FileStatus status : fs.listStatus(descriptorInfoDir)) { final DataSegment segment = jsonMapper.readValue(fs.open(status.getPath()), DataSegment.class); publishedSegmentsBuilder.add(segment); log.info("Adding segment %s to the list of published segments", segment.getIdentifier()); } } catch (FileNotFoundException e) { log.error( "[%s] SegmentDescriptorInfo is not found usually when indexing process did not produce any segments meaning" + " either there was no input data to process or all the input events were discarded due to some error", e.getMessage() ); Throwables.propagate(e); } catch (IOException e) { throw Throwables.propagate(e); } List<DataSegment> publishedSegments = publishedSegmentsBuilder.build(); return publishedSegments; }
Source:
<code>protected boolean parseArgs(final String[] argv) { <START> commandLineParser = determineArgParser(argv); <END> boolean ret; try { ret = commandLineParser.parseArguments(System.err, argv); } catch (CommandLineException e) { System.err.println(commandLineParser.usage(false,false)); System.err.println(e.getMessage()); ret = false; } commandLine = commandLineParser.getCommandLine(); if (!ret) { return false; } REFERENCE_SEQUENCE = referenceSequence.getReferenceFile(); final String[] customErrorMessages = customCommandLineValidation(); if (customErrorMessages != null) { System.err.print(commandLineParser.usage(false, false)); for (final String msg : customErrorMessages) { System.err.println(msg); } return false; } return true; }</code><technical_language>code is a bit sloppy regard commandLineParser is initialized. a call chains getCommandLineParser() is called, immediately obvious this line occur other call getCommandLineParser() occurs. if control place this is initialized field in other places, clear this initialization occur first</technical_language>

Target:
protected boolean parseArgs(final String[] argv) { commandLineParser = getCommandLineParserForArgs(argv); boolean ret; try { ret = commandLineParser.parseArguments(System.err, argv); } catch (CommandLineException e) { System.err.println(commandLineParser.usage(false,false)); System.err.println(e.getMessage()); ret = false; } commandLine = commandLineParser.getCommandLine(); if (!ret) { return false; } REFERENCE_SEQUENCE = referenceSequence.getReferenceFile(); final String[] customErrorMessages = customCommandLineValidation(); if (customErrorMessages != null) { System.err.print(commandLineParser.usage(false, false)); for (final String msg : customErrorMessages) { System.err.println(msg); } return false; } return true; }
Source:
<code>private BufferIndexed singleThreadedVersionOne() { final ByteBuffer copyBuffer = firstValueBuffer.asReadOnlyBuffer(); return new BufferIndexed() { @Override public T get(final int index) { checkIndex(index); final int startOffset; final int endOffset; <START> <END> if (index == 0) { startOffset = Ints.BYTES; endOffset = headerBuffer.getInt(0); } else { int headerPosition = (index - 1) * Ints.BYTES; startOffset = headerBuffer.getInt(headerPosition) + Ints.BYTES; endOffset = headerBuffer.getInt(headerPosition + Ints.BYTES); } return bufferedIndexedGet(copyBuffer, startOffset, endOffset); } @Override public void inspectRuntimeShape(RuntimeShapeInspector inspector) { inspector.visit("headerBuffer", headerBuffer); inspector.visit("copyBuffer", copyBuffer); inspector.visit("strategy", strategy); } }; }</code><technical_language>Integer</technical_language>

Target:
private BufferIndexed singleThreadedVersionOne() { final ByteBuffer copyBuffer = firstValueBuffer.asReadOnlyBuffer(); return new BufferIndexed() { @Override public T get(final int index) { checkIndex(index); final int startOffset; final int endOffset; if (index == 0) { startOffset = Integer.BYTES; endOffset = headerBuffer.getInt(0); } else { int headerPosition = (index - 1) * Integer.BYTES; startOffset = headerBuffer.getInt(headerPosition) + Integer.BYTES; endOffset = headerBuffer.getInt(headerPosition + Integer.BYTES); } return bufferedIndexedGet(copyBuffer, startOffset, endOffset); } @Override public void inspectRuntimeShape(RuntimeShapeInspector inspector) { inspector.visit("headerBuffer", headerBuffer); inspector.visit("copyBuffer", copyBuffer); inspector.visit("strategy", strategy); } }; }
Source:
<code><START> public void addMetadataRecord(InputStream stream, String name) throws DataStoreException { <END> }</code><technical_language>Need implement</technical_language>

Target:
public void addMetadataRecord(InputStream stream, String name) throws DataStoreException { if (null == stream) { throw new IllegalArgumentException("Input stream must not be null"); } File tmpFile = null; try { tmpFile = File.createTempFile("compositeds-temp", null); try (FileOutputStream out = new FileOutputStream(tmpFile)) { IOUtils.copy(stream, out); } addMetadataRecord(tmpFile, name); } catch (IOException e) { throw new DataStoreException(e); } finally { if (null != tmpFile) { tmpFile.delete(); } } }
Source:
<code>SnapshotFileSender localSnapshotSender(String snpName) throws IgniteCheckedException { File snpLocDir = snapshotLocalDir(snpName); return new LocalSnapshotFileSender(log, snpRunner, <START> () -> { <END> String dbNodePath = relativeNodePath(cctx.kernalContext().pdsFolderResolver().resolveFolders()); return U.resolveWorkDirectory(snpLocDir.getAbsolutePath(), dbNodePath, false); }, ioFactory, storeFactory, types -> cctx.kernalContext() .cacheObjects() .saveMetadata(types, snpLocDir), mappings -> saveMappings(cctx.kernalContext(), mappings, snpLocDir), pageSize); }</code><technical_language>do need a Supplier here? pass File a parameter</technical_language>

Target:
SnapshotSender localSnapshotSender(String snpName) { return new LocalSnapshotSender(snpName); }
Source:
<code>public Response toResponse(CreateChargeConnectorErrorResponseException exception) { int errorStatus = exception.getErrorStatus(); if (errorStatus == NOT_FOUND.getStatusCode()) { LOGGER.warn("Authorization succeeded but Gateway account was not found in Connector", errorStatus); <START> return P0199.response(); <END> } LOGGER.info("Error response from Connector unrecognised. status {}, body {}", errorStatus, exception.getErrorBody()); return P0198.response(); }</code><technical_language>is logger.warn good enough for this, I this a rare severe exception deal with, error, fatal</technical_language>

Target:
public Response toResponse(CreateChargeConnectorErrorResponseException exception) { int errorStatus = exception.getErrorStatus(); if (errorStatus == NOT_FOUND.getStatusCode()) { LOGGER.error("Authorization succeeded but Gateway account was not found in Connector", errorStatus); return P0199.response(); } LOGGER.info("Error response from Connector unrecognised. status {}, body {}", errorStatus, exception.getErrorBody()); return P0198.response(); }
Source:
<code>public void validate(Class<?> originalType) { boolean implementsInterceptor = Interceptor.class.isAssignableFrom(originalType); boolean containsIntercepts = originalType.isAnnotationPresent(Intercepts.class); if (implementsInterceptor || containsIntercepts) { applyNewInterceptorValidationRules(originalType, implementsInterceptor); } else { throw new VRaptorException(format("Annotation @%s found in %s, " <START> + "but it is neither an Interceptor nor an InterceptorSequence.", <END> Intercepts.class.getSimpleName(), originalType)); } }</code><technical_language>remove InterceptorSequence this message, exist anymore</technical_language>

Target:
public void validate(Class<?> originalType) { boolean implementsInterceptor = Interceptor.class.isAssignableFrom(originalType); boolean containsIntercepts = originalType.isAnnotationPresent(Intercepts.class); if (implementsInterceptor || containsIntercepts) { applyNewInterceptorValidationRules(originalType, implementsInterceptor); } else { throw new IllegalStateException(format("Annotation @Intercepts found in %s, " + "but it is not an Interceptor.", originalType)); } }
Source:
<code>public DelegatingResourceDescription getRepresentationDescription(Representation rep) { if (rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) { DelegatingResourceDescription description = new DelegatingResourceDescription(); description.addProperty("uuid"); description.addProperty("name"); <START> description.addProperty("javaClassName"); <END> description.addProperty("retired"); description.addProperty("description"); description.addSelfLink(); if (rep instanceof DefaultRepresentation) { description.addLink("full", ".?v=" + RestConstants.REPRESENTATION_FULL); } else { description.addProperty("auditInfo", findMethod("getAuditInfo")); } return description; } return null; }</code><technical_language>Missing parent concept classes, ref representation</technical_language>

Target:
public DelegatingResourceDescription getRepresentationDescription(Representation rep) { if (rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) { DelegatingResourceDescription description = new DelegatingResourceDescription(); description.addProperty("uuid"); description.addProperty("name"); description.addProperty("javaClassName"); description.addProperty("retired"); description.addProperty("description"); description.addProperty("conceptClasses"); description.addProperty("parent"); description.addSelfLink(); if (rep instanceof DefaultRepresentation) { description.addLink("full", ".?v=" + RestConstants.REPRESENTATION_FULL); } else { description.addProperty("auditInfo", findMethod("getAuditInfo")); } return description; } return null; }
Source:
<code>private static boolean shouldIgnore( Symbol.MethodSymbol methodSymbol, LambdaExpressionTree root, MethodInvocationTree methodInvocation) { if (!methodSymbol.isStatic()) { if (root.getParameters().size() == 1) { Symbol paramSymbol = ASTHelpers.getSymbol(Iterables.getOnlyElement(root.getParameters())); Symbol receiverSymbol = ASTHelpers.getSymbol(ASTHelpers.getReceiver(methodInvocation)); return !paramSymbol.equals(receiverSymbol); } return true; } <START> return false; <END> }</code><technical_language>suggestion return !root.getParameters().isEmpty();</technical_language>

Target:
private static boolean shouldIgnore( Symbol.MethodSymbol methodSymbol, LambdaExpressionTree root, MethodInvocationTree methodInvocation) { if (!methodSymbol.isStatic()) { if (root.getParameters().size() == 1) { Symbol paramSymbol = ASTHelpers.getSymbol(Iterables.getOnlyElement(root.getParameters())); Symbol receiverSymbol = ASTHelpers.getSymbol(ASTHelpers.getReceiver(methodInvocation)); return !paramSymbol.equals(receiverSymbol); } return true; } return !root.getParameters().isEmpty(); }
Source:
<code>public void setup() { country.add(PRESIDENT, REAGAN); state.add(GOVERNOR, SCHWARZENEGGER); <START> county.add(MAYOR, EASTWOOD); <END> country.add(ACTOR, EASTWOOD); state.add(ACTOR, SCHWARZENEGGER); county.add(ACTOR, REAGAN); }</code><technical_language>Eastwood briefly mayor of Carmel-by-the-sea, California, is a city a county. Recommend replacing changing county city = new HierarchicalMap(state)</technical_language>

Target:
public void setup() { country.add(PRESIDENT, REAGAN); state.add(GOVERNOR, SCHWARZENEGGER); city.add(MAYOR, EASTWOOD); country.add(ACTOR, EASTWOOD); state.add(ACTOR, SCHWARZENEGGER); city.add(ACTOR, REAGAN); }
Source:
<code>public Response getSearchResponse(Account account, Map<String, String> queryParams) { if (account.getPaymentType().equals(TokenPaymentType.DIRECT_DEBIT)) { throw new BadRequestException(PaymentError <START> .aPaymentError(PaymentError.Code.SEARCH_PAYMENTS_VALIDATION_ERROR, "agreement_id")); <END> } String url = uriGenerator.refundsURIWithParams(account, queryParams); Response connectorResponse = client .target(url) .request() .header(HttpHeaders.ACCEPT, APPLICATION_JSON) .get(); logger.info("response from connector for refunds search: " + connectorResponse); if (connectorResponse.getStatus() == SC_OK) { return processResponse(account.getAccountId(), connectorResponse); } throw new SearchRefundsException(connectorResponse); }</code><technical_language>I this error, this return a message "wrong field: agreement_id", is checking gateway account is direct debit. if searches for a dd account, complaining agreement id, is intuitive. I create return a new error "Refunds supported for direct debit"</technical_language>

Target:
public Response getSearchResponse(Account account, Map<String, String> queryParams) { validateSupportedSearchParams(queryParams); String url = connectorUriGenerator.refundsURIWithParams(account, queryParams); Response connectorResponse = client .target(url) .request() .header(HttpHeaders.ACCEPT, APPLICATION_JSON) .get(); logger.info("response from connector for refunds search: " + connectorResponse); if (connectorResponse.getStatus() == SC_OK) { return processResponse(connectorResponse); } throw new SearchRefundsException(connectorResponse); }
Source:
<code>public void visitClassPropertyDeclaration(ClassPropertyDeclarationTree tree) { <START> if (tree.hasModifiers("private")) { <END> tree.declarations().forEach(varDec -> privateProperties.add(varDec.identifier().text())); } }</code><technical_language>@ivandalbosco this call check tree 1 modifier, is private. private combined smth else</technical_language>

Target:
public void visitClassPropertyDeclaration(ClassPropertyDeclarationTree tree) { }
Source:
<code>public String toShellString() { <START> ArrayList<Character> escapeList = Lists.newArrayList('"', '\\', '\''); <END> ArrayList<String> componentStrings = Lists.newArrayList(); for (Object component : mComponentValues) { if (component == null) { componentStrings.add("null"); } else { String unescapedString = component.toString(); ArrayList<Character> escapedString = Lists.newArrayList(); for (char c: unescapedString.toCharArray()) { if (escapeList.contains(c)) { escapedString.add('\\'); } escapedString.add(c); } if (getType(component) == ComponentType.STRING) { componentStrings.add(String.format("'%s'", StringUtils.join(escapedString, ""))); } else { componentStrings.add(component.toString()); } } } return "[" + StringUtils.join(componentStrings, ", ") + "]"; }</code><technical_language>Technically want a Charset that. contains arraylist theoretically involve iterating it(though compiler get rid of it)</technical_language>

Target:
public String toShellString() { HashSet<Character> escapeSet = Sets.newHashSet('"', '\\', '\''); ArrayList<String> componentStrings = Lists.newArrayList(); for (Object component : mComponentValues) { if (component == null) { componentStrings.add("null"); } else { String unescapedString = component.toString(); ArrayList<Character> escapedString = Lists.newArrayList(); for (char c: unescapedString.toCharArray()) { if (escapeSet.contains(c)) { escapedString.add('\\'); } escapedString.add(c); } if (getType(component) == ComponentType.STRING) { componentStrings.add(String.format("'%s'", StringUtils.join(escapedString, ""))); } else { componentStrings.add(component.toString()); } } } return "[" + StringUtils.join(componentStrings, ", ") + "]"; }
Source:
<code>public IDescriptionPreprocessor getDescriptionPreprocessor(EObject description) { <START> if (!this.hasReadDescriptionPreprocessorRegistry) { this.descriptionPreprocessorListener.readRegistry(Platform.getExtensionRegistry()); this.hasReadDescriptionPreprocessorRegistry = true; } <END> IDescriptionPreprocessor preprocessor = null; List<IItemDescriptor<IDescriptionPreprocessor>> itemDescriptors = this.descriptionPreprocessorRegistry.getItemDescriptors(); for (IItemDescriptor<IDescriptionPreprocessor> itemDescriptor : itemDescriptors) { IDescriptionPreprocessor descriptionPreprocessor = itemDescriptor.getItem(); if (descriptionPreprocessor.canHandle(description)) { preprocessor = descriptionPreprocessor; break; } } if (preprocessor == null) { PropertiesDescriptionPreprocessorSwitch descriptionPreprocessorSwitch = new PropertiesDescriptionPreprocessorSwitch(); preprocessor = descriptionPreprocessorSwitch.doSwitch(description); } return preprocessor; }</code><technical_language>configure this pattern for other extension points, please :)</technical_language>

Target:
public Optional<IDescriptionPreprocessor> getDescriptionPreprocessor(EObject description) { if (!this.hasReadDescriptionPreprocessorRegistry) { this.descriptionPreprocessorListener.readRegistry(Platform.getExtensionRegistry()); this.hasReadDescriptionPreprocessorRegistry = true; } List<IItemDescriptor<IDescriptionPreprocessor>> itemDescriptors = this.descriptionPreprocessorRegistry.getItemDescriptors(); Optional<IDescriptionPreprocessor> preprocessor = itemDescriptors.stream().map(IItemDescriptor::getItem).filter(descriptionPreprocessor -> descriptionPreprocessor.canHandle(description)) .findFirst(); if (!preprocessor.isPresent()) { PropertiesDescriptionPreprocessorSwitch descriptionPreprocessorSwitch = new PropertiesDescriptionPreprocessorSwitch(); preprocessor = descriptionPreprocessorSwitch.doSwitch(description); } return preprocessor; }
Source:
<code>private List<Matches> findMatch(final String uri) throws DotDataException { for (final String backendFilter : CMSUrlUtil.BACKEND_FILTERED_LIST_ARRAY) { if (uri.startsWith(backendFilter)) { <START> return new ArrayList<>(); <END> } } if (this.shouldLoadPatterns()) { this.loadPatterns(); } List<Matches> foundMatches = new ArrayList<>(); final String url = !uri.endsWith(StringPool.FORWARD_SLASH) ? uri + StringPool.FORWARD_SLASH : uri; for (final ContentTypeURLPattern contentTypeURLPattern : this.patternsCache) { final List<RegExMatch> matches = RegEX .findForUrlMap(url, contentTypeURLPattern.getRegEx()); if (matches != null && !matches.isEmpty()) { for (RegExMatch regExMatch : matches) { if (regExMatch.getMatch().equals(url)) { foundMatches.add(new Matches(contentTypeURLPattern, matches)); } } } } return foundMatches; }</code><technical_language>if do need mod, Collections.empyList()</technical_language>

Target:
private List<Matches> findMatch(final String uri) throws DotDataException { final boolean filtered = CMSUrlUtil.BACKEND_FILTERED_COLLECTION.stream() .anyMatch(uri::startsWith); if (filtered) { return Collections.emptyList(); } if (this.shouldLoadPatterns()) { this.loadPatterns(); } final List<Matches> foundMatches = new ArrayList<>(); final String url = !uri.endsWith(StringPool.FORWARD_SLASH) ? uri + StringPool.FORWARD_SLASH : uri; for (final ContentTypeURLPattern contentTypeURLPattern : this.patternsCache) { final List<RegExMatch> matches = RegEX .findForUrlMap(url, contentTypeURLPattern.getRegEx()); if (matches != null && !matches.isEmpty()) { for (final RegExMatch regExMatch : matches) { if (regExMatch.getMatch().equals(url)) { foundMatches.add(new Matches(contentTypeURLPattern, matches)); } } } } return foundMatches; }
Source:
<code>public static RequestOptions getDefault() { <START> return new RequestOptions(Stripe.apiKey, Stripe.apiVersion, Stripe.getApiBase()); <END> }</code><technical_language>IRL, I meant uploadApiBase. This is fine too, unrelated</technical_language>

Target:
public static RequestOptions getDefault() { return new RequestOptions(Stripe.apiKey, Stripe.apiVersion); }
Source:
<code>public void startingServerInstance(DesiredCapabilities iosCaps, DesiredCapabilities androidCaps) throws Exception { if (prop.getProperty("APP_TYPE").equalsIgnoreCase("web")) { driver = new AndroidDriver<>(appiumMan.getAppiumUrl(), androidWeb()); } else { if (System.getProperty("os.name").toLowerCase().contains("mac")) { <START> if (iosDevice.checkiOSDevice(device_udid)) { <END> if (iosCaps == null) { iosCaps = iosNative(); } driver = new IOSDriver<>(appiumMan.getAppiumUrl(), iosCaps); } else if (!iosDevice.checkiOSDevice(device_udid)) { if (androidCaps == null) { androidCaps = androidNative(); } checkSelendroid(androidCaps); driver = new AndroidDriver<>(appiumMan.getAppiumUrl(), androidCaps); } } else { if (androidCaps == null) { androidCaps = androidNative(); } checkSelendroid(androidCaps); driver = new AndroidDriver<>(appiumMan.getAppiumUrl(), androidCaps); } } }</code><technical_language>@brtu check if IOS_APP_PATH is null, consider a case, CI machine ios android devices connected users is running for android providing androidNative() caps, changes android caps get ios if this check</technical_language>

Target:
public void startingServerInstance(DesiredCapabilities iosCaps, DesiredCapabilities androidCaps) throws Exception { if (prop.getProperty("APP_TYPE").equalsIgnoreCase("web")) { driver = new AndroidDriver<>(appiumMan.getAppiumUrl(), androidWeb()); } else { if (System.getProperty("os.name").toLowerCase().contains("mac")) { if (prop.getProperty("IOS_APP_PATH") != null && iosDevice.checkiOSDevice(device_udid)) { if (iosCaps == null) { iosCaps = iosNative(); } driver = new IOSDriver<>(appiumMan.getAppiumUrl(), iosCaps); } else if (!iosDevice.checkiOSDevice(device_udid)) { if (androidCaps == null) { androidCaps = androidNative(); } checkSelendroid(androidCaps); driver = new AndroidDriver<>(appiumMan.getAppiumUrl(), androidCaps); } } else { if (androidCaps == null) { androidCaps = androidNative(); } checkSelendroid(androidCaps); driver = new AndroidDriver<>(appiumMan.getAppiumUrl(), androidCaps); } } }