auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public Req understand(final Comment.Smart comment, final URI home) throws IOException { final String prefix = String.format("@%s", this.login); final Req req; final Matcher matcher = Pattern.compile( <START> String.format(".*\\b?(%s\\b).*", prefix) <END> ).matcher(comment.body().trim()); if (matcher.matches()) { if (matcher.start(1) == 0) { req = this.origin.understand(comment, home); } else { new Answer(comment).post( true, String.format( QnReferredTo.PHRASES .getString("QnReferredTo.mentioned"), prefix ) ); Logger.info( this, "mention found in #%d", comment.issue().number() ); req = Req.DONE; } } else { Logger.info( this, "comment #%d in %s#%d is not for me (no \"%s\" prefix)", comment.number(), comment.issue().repo().coordinates(), comment.issue().number(), prefix ); req = Req.EMPTY; } return req; }</code><technical_language>@original-brownbear some complex regexp, I test</technical_language>

Target:
public Req understand(final Comment.Smart comment, final URI home) throws IOException { final String prefix = String.format("@%s", this.login); final Req req; final Matcher matcher = Pattern.compile( String.format(QnReferredTo.MENTION_MATCHER, prefix) ).matcher(comment.body().trim()); if (matcher.matches()) { if (matcher.start(1) == 0) { req = this.origin.understand(comment, home); } else { new Answer(comment).post( true, String.format( QnReferredTo.PHRASES.getString( "QnReferredTo.mentioned" ), prefix ) ); Logger.info( this, "mention found in #%d", comment.issue().number() ); req = Req.DONE; } } else { Logger.info( this, "comment #%d in %s#%d is not for me (no \"%s\" prefix)", comment.number(), comment.issue().repo().coordinates(), comment.issue().number(), prefix ); req = Req.EMPTY; } return req; }
Source:
<code>protected void testExecute_getRespondentsInCourse_shouldPass() { InstructorAttributes instructor1OfCourse1 = typicalBundle.instructors.get("instructor1OfCourse1"); loginAsInstructor(instructor1OfCourse1.googleId); testGettingRespondentsInCourse(); StudentAttributes student1InCourse1 = typicalBundle.students.get("student1InCourse1"); <START> loginAsStudent(student1InCourse1.googleId); <END> testGettingRespondentsInCourse(); }</code><technical_language>point of testing student</technical_language>

Target:
protected void testExecute_getRespondentsInCourse_shouldPass() { InstructorAttributes instructor1OfCourse1 = typicalBundle.instructors.get("instructor1OfCourse1"); loginAsInstructor(instructor1OfCourse1.googleId); ______TS("At least 1 respondent"); assertTrue(logic.hasResponsesForCourse(instructor1OfCourse1.getCourseId())); String[] params = new String[] { Const.ParamsNames.COURSE_ID, instructor1OfCourse1.courseId, }; GetHasResponsesAction getHasResponsesAction = getAction(params); JsonResult jsonResult = getJsonResult(getHasResponsesAction); HasResponsesData hasResponsesData = (HasResponsesData) jsonResult.getOutput(); assertEquals(HttpStatus.SC_OK, jsonResult.getStatusCode()); assertTrue(hasResponsesData.hasResponses()); ______TS("Course with 0 respondents"); InstructorAttributes instructor1OfCourse4 = typicalBundle.instructors.get("instructor1OfCourse4"); loginAsInstructor(instructor1OfCourse4.googleId); assertFalse(logic.hasResponsesForCourse(instructor1OfCourse4.getCourseId())); params = new String[] { Const.ParamsNames.COURSE_ID, instructor1OfCourse4.courseId, }; getHasResponsesAction = getAction(params); jsonResult = getJsonResult(getHasResponsesAction); hasResponsesData = (HasResponsesData) jsonResult.getOutput(); assertEquals(HttpStatus.SC_OK, jsonResult.getStatusCode()); assertFalse(hasResponsesData.hasResponses()); }
Source:
<code>protected boolean mustCheckName(DetailAST ast) { final Scope theScope = calculateScope(ast); boolean checkName = true; if (ignoreOverridden && isOverriddenMethod(ast) || ast.getParent().getType() == TokenTypes.LITERAL_CATCH || CheckUtils.isReceiverParameter(ast) <START> || !matchScope(theScope)) { <END> checkName = false; } return checkName; }</code><technical_language>please move calculateScope(ast) expression speedup a bit performance, scope calculation is required</technical_language>

Target:
protected boolean mustCheckName(DetailAST ast) { boolean checkName = true; final boolean isDefault = scope == Scope.ANONINNER && excludeScope == null; if (ignoreOverridden && isOverriddenMethod(ast) || ast.getParent().getType() == TokenTypes.LITERAL_CATCH || CheckUtils.isReceiverParameter(ast) || !isDefault && !matchScope(calculateScope(ast))) { checkName = false; } return checkName; }
Source:
<code>private void rebalance() { if (null != sessionListSubscription) { final List<String> newSessions = sessionListSubscription.getData(); <START> final String newHash = ZkSubscriptionClient.Topology.calculateSessionsHash(newSessions); <END> zkClient.runLocked(() -> { final ZkSubscriptionClient.Topology topology = zkClient.getTopology(); if (!topology.isSameHash(newHash)) { log.info("Performing rebalance, hash changed: {}", newHash); final Partition[] changeset = rebalancer.apply(zkClient.listSessions(), topology.getPartitions()); if (changeset.length > 0) { zkClient.updatePartitionsConfiguration(newHash, changeset); } } else { log.info("Skipping rebalance, because hash is the same: {}", newHash); } }); } }</code><technical_language>enough compare topologies partitions, session event types? additional logic is purpose</technical_language>

Target:
private void rebalance() { if (null != sessionListSubscription) { final List<String> newSessions = sessionListSubscription.getData(); final String sessionsHash = ZkSubscriptionClient.Topology.calculateSessionsHash(newSessions); zkClient.runLocked(() -> { final ZkSubscriptionClient.Topology topology = zkClient.getTopology(); if (!topology.isSameHash(sessionsHash)) { log.info("Performing rebalance, hash changed: {}", sessionsHash); final Collection<Session> newSessionsUnderLock = zkClient.listSessions(); final Partition[] changeset = rebalancer.apply(newSessionsUnderLock, topology.getPartitions()); if (changeset.length > 0) { final String actualHash = ZkSubscriptionClient.Topology.calculateSessionsHash( newSessionsUnderLock.stream().map(Session::getId).collect(Collectors.toList())); zkClient.updatePartitionsConfiguration(actualHash, changeset); } } else { log.info("Skipping rebalance, because hash is the same: {}", sessionsHash); } }); } }
Source:
<code>protected int getParallelHostCount(UpgradeContext ctx, int defaultValue) { if (m_grouping.parallelScheduler != null) { int taskParallelism = m_grouping.parallelScheduler.maxDegreeOfParallelism; if (taskParallelism == ParallelScheduler.DEFAULT_MAX_DEGREE_OF_PARALLELISM) { <START> taskParallelism = ctx.getDefaultMaxDegreeOfParallelism(); <END> } } return defaultValue; }</code><technical_language>I need return taskParallelism b/c if max degree != DEFAULT_MAX_DEGREE_OF_PARALLELISM, return 1, not, 40</technical_language>

Target:
protected int getParallelHostCount(UpgradeContext ctx, int defaultValue) { if (m_grouping.parallelScheduler != null) { int taskParallelism = m_grouping.parallelScheduler.maxDegreeOfParallelism; if (taskParallelism == ParallelScheduler.DEFAULT_MAX_DEGREE_OF_PARALLELISM) { taskParallelism = ctx.getDefaultMaxDegreeOfParallelism(); } return taskParallelism; } return defaultValue; }
Source:
<code>private BufferedReadChannel getChannelForLogId(long entryLogId) throws IOException { BufferedReadChannel brc = getFromChannels(entryLogId); if (brc != null) { return brc; } FileChannel fc = null; try { fc = logid2FileChannel.get(entryLogId); } catch (ExecutionException e){ LOG.error("ExecutionException found in get fileChannel for log in logid2FileChannel cache", entryLogId); <START> throw new IOException(e); <END> } brc = new BufferedReadChannel(fc, conf.getReadBufferBytes()); putInReadChannels(entryLogId, brc); return brc; }</code><technical_language>ExecutionException wrap actual loading file channel. need unwrap this. if (e.getCause() instanceof IOException) { throw (IOException) e.getCause(); } else { throw new IOException("Encountered unknown exception opening read channel for entry log " + entryLogId, e.getCause()); }</technical_language>

Target:
private EntryLogBufferedReadChannel getChannelForLogId(long entryLogId) throws IOException { try { EntryLogBufferedReadChannel brc; do { brc = logid2ReadChannel.get().get(entryLogId); if (!brc.cachedFileChannel.tryRetain()) { if (logid2ReadChannel.get().asMap().remove(entryLogId, brc)){ LOG.error("Dead fileChannel({}) forced out of cache." + "It must have been double-released somewhere.", brc.cachedFileChannel); } brc = null; } } while (brc == null); return brc; } catch (ExecutionException | UncheckedExecutionException ee) { if (ee.getCause() instanceof IOException) { throw (IOException) ee.getCause(); } else { throw new IOException("Failed to load file channel for entrylog " + entryLogId, ee); } } }
Source:
<code>public Collection<CohortMembership> getMemberships() { if (memberships == null) { memberships = new TreeSet<>(); <START> } <END> return memberships; return memberships.stream().filter(m -> !m.isVoided()).collect(Collectors.toList()); }</code><technical_language>I forgotten delete this line</technical_language>

Target:
public Collection<CohortMembership> getMemberships() { if (memberships == null) { memberships = new TreeSet<>(); } return memberships; }
Source:
<code>public void start() { this.logger.info( "The DM is about to be launched." ); DmMessageProcessor messageProcessor = new DmMessageProcessor( this ); this.messagingClient = new RCDm( this ); this.messagingClient.associateMessageProcessor( messageProcessor ); this.timer = new Timer( "Roboconf's Management Timer", false ); this.timer.scheduleAtFixedRate( new CheckerMessagesTask( this, this.messagingClient ), 0, TIMER_PERIOD ); this.timer.scheduleAtFixedRate( new CheckerHeartbeatsTask( this ), 0, Constants.HEARTBEAT_PERIOD ); reconfigure(); try { <START> this.messagingClient.listenToDebugMessages( ListenerCommand.START ); <END> } catch ( IOException e ) { this.logger.log( Level.WARNING, "Cannot start to listen to the debug queue", e ); } this.logger.info( "The DM was launched." ); }</code><technical_language>This done in reconfigure. DM start a wrong messaging configuration. This configuration updated runtime valid. is this moment listen debug messages</technical_language>

Target:
public void start() { this.logger.info( "The DM is about to be launched." ); DmMessageProcessor messageProcessor = new DmMessageProcessor( this ); this.messagingClient = new RCDm( this ); this.messagingClient.associateMessageProcessor( messageProcessor ); this.timer = new Timer( "Roboconf's Management Timer", false ); this.timer.scheduleAtFixedRate( new CheckerMessagesTask( this, this.messagingClient ), 0, TIMER_PERIOD ); this.timer.scheduleAtFixedRate( new CheckerHeartbeatsTask( this ), 0, Constants.HEARTBEAT_PERIOD ); reconfigure(); this.logger.info( "The DM was launched." ); }
Source:
<code><START> public synchronized void pmHealthCheck() { <END> if (!active) { try { log.info("Power Management Health Check started."); active = true; List<VDS> hosts = DbFacade.getInstance().getVdsDao().getAll(); for (VDS host : hosts) { if (host.isPmEnabled()) { pmHealthCheck(host); } } log.info("Power Management Health Check completed."); } finally { active = false; } } }</code><technical_language>Please replace Lock.tryLock() instead of 'active' flag</technical_language>

Target:
public void pmHealthCheck() { Lock lock = new ReentrantLock(); if (lock.tryLock()) { try { log.info("Power Management Health Check started."); List<VDS> hosts = DbFacade.getInstance().getVdsDao().getAll(); for (VDS host : hosts) { if (host.isPmEnabled()) { pmHealthCheck(host); } } log.info("Power Management Health Check completed."); } finally { lock.unlock(); } } }
Source:
<code>private void printArray(PrintStream ps, TaggedValuePointable tvp) { ArrayPointable ap = pp.takeOne(ArrayPointable.class); try { tvp.getValue(ap); int len = ap.getEntryCount(); ps.append('['); for (int i = 0; i < len; i++) { ap.getEntry(i, tvp); print(tvp.getByteArray(), tvp.getStartOffset(), tvp.getLength(), ps); if (i != len - 1) { ps.append(','); } } ps.append(']'); } finally { pp.giveBack(ap); <START> pp.giveBack(tvp); <END> } }</code><technical_language>give tvp in scope is allocated in</technical_language>

Target:
private void printArray(PrintStream ps, TaggedValuePointable tvp) { ArrayPointable ap = pp.takeOne(ArrayPointable.class); try { tvp.getValue(ap); int len = ap.getEntryCount(); ps.append('['); for (int i = 0; i < len; i++) { ap.getEntry(i, tvp); printJsonValue(ps, tvp); if (i != len - 1) { ps.append(','); } } ps.append(']'); } finally { pp.giveBack(ap); } }
Source:
<code>public void render(FormRenderingContext context) { layoutGenerator.clear(); formContent.clear(); if (context != null) { <START> Panel panel = layoutGenerator.buildLayout(context); <END> formContent.add(panel); } }</code><technical_language>@Christopher-Chianelli a problem forgetting this change, is reason for splitting this lines of code</technical_language>

Target:
public void render(FormRenderingContext context) { layoutGenerator.clear(); formContent.clear(); if (context != null) { formContent.add(layoutGenerator.buildLayout(context)); } }
Source:
<code>public void testWaitUntilJobInitializationFinished_doesNotThrowRuntimeException() throws Exception { final JobVertex testVertex = new JobVertex("testVertex"); testVertex.setInvokableClass(NoOpInvokable.class); JobGraph jobGraph = new JobGraph(TEST_JOB_ID, "testJob", testVertex); TestingDispatcher dispatcher = createAndStartDispatcher(); DispatcherGateway dispatcherGateway = dispatcher.getSelfGateway(DispatcherGateway.class); dispatcherGateway.submitJob(jobGraph, TIMEOUT).get(); ClientUtils.waitUntilJobInitializationFinished(jobGraph.getJobID(), () -> dispatcherGateway.requestJobStatus(jobGraph.getJobID(), TIMEOUT).get(), () -> dispatcherGateway.requestJobResult(jobGraph.getJobID(), TIMEOUT).get(), ClassLoader.getSystemClassLoader()); dispatcher.completeJobExecution( ArchivedExecutionGraph.createFromInitializingJob(TEST_JOB_ID, "test", JobStatus.FAILED, new RuntimeException("yolo"), 1337)); <START> org.apache.flink.runtime.testutils.CommonTestUtils.waitUntilCondition(() -> { JobStatus status = dispatcherGateway.requestJobStatus( jobGraph.getJobID(), TIMEOUT).get(); return status == JobStatus.FAILED; }, Deadline.fromNow( <END> Duration.ofSeconds(10L)), 20L); ClientUtils.waitUntilJobInitializationFinished(jobGraph.getJobID(), () -> dispatcherGateway.requestJobStatus(jobGraph.getJobID(), TIMEOUT).get(), () -> dispatcherGateway.requestJobResult(jobGraph.getJobID(), TIMEOUT).get(), ClassLoader.getSystemClassLoader()); ArchivedExecutionGraph archivedExecutionGraph = dispatcherGateway.requestJob( TEST_JOB_ID, TIMEOUT).get(); Throwable exception = archivedExecutionGraph.getFailureInfo().getException().deserializeError( ClassLoader.getSystemClassLoader()); Assert.assertTrue(exception instanceof RuntimeException); }</code><technical_language>suggestion org.apache.flink.runtime.testutils.CommonTestUtils.waitUntilCondition(() -> dispatcherGateway.requestJobStatus( jobGraph.getJobID(), TIMEOUT).get() == JobStatus.FAILED, Deadline.fromNow(</technical_language>

Target:
public void testWaitUntilJobInitializationFinished_doesNotThrowRuntimeException() throws Exception { Iterator<JobStatus> statusSequenceIterator = Arrays.asList( JobStatus.INITIALIZING, JobStatus.INITIALIZING, JobStatus.FAILED).iterator(); ClientUtils.waitUntilJobInitializationFinished( statusSequenceIterator::next, () -> buildJobResult(new RuntimeException("Err")), ClassLoader.getSystemClassLoader()); }
Source:
<code>Config generateConfig() { Map<String, String> config = new HashMap<>(); StreamSpec spec = getStreamSpec(); config.put(String.format(StreamConfig.SYSTEM_FOR_STREAM_ID(), spec.getId()), spec.getSystemName()); config.put(String.format(StreamConfig.PHYSICAL_NAME_FOR_STREAM_ID(), spec.getId()), spec.getPhysicalName()); if (isIntermediate()) { config.put(String.format(StreamConfig.IS_INTERMEDIATE_FOR_STREAM_ID(), spec.getId()), "true"); config.put(String.format(StreamConfig.CONSUMER_OFFSET_DEFAULT_FOR_STREAM_ID(), spec.getId()), "oldest"); <START> config.put(String.format(StreamConfig.PRIORITY_FOR_STREAM_ID(), spec.getId()), "1"); <END> } if (spec.isBounded()) { config.put(String.format(StreamConfig.IS_BOUNDED_FOR_STREAM_ID(), spec.getId()), "true"); } spec.getConfig().forEach((property, value) -> { config.put(String.format(StreamConfig.STREAM_ID_PREFIX(), spec.getId()) + property, value); }); return new MapConfig(config); }</code><technical_language>If a user prioritized streams, this put intermediate stream priority input?. Alternately, set INT_MAX avoid conflicting configured priorities</technical_language>

Target:
Config generateConfig() { Map<String, String> config = new HashMap<>(); StreamSpec spec = getStreamSpec(); config.put(String.format(StreamConfig.SYSTEM_FOR_STREAM_ID(), spec.getId()), spec.getSystemName()); config.put(String.format(StreamConfig.PHYSICAL_NAME_FOR_STREAM_ID(), spec.getId()), spec.getPhysicalName()); if (isIntermediate()) { config.put(String.format(StreamConfig.IS_INTERMEDIATE_FOR_STREAM_ID(), spec.getId()), "true"); config.put(String.format(StreamConfig.CONSUMER_OFFSET_DEFAULT_FOR_STREAM_ID(), spec.getId()), "oldest"); config.put(String.format(StreamConfig.PRIORITY_FOR_STREAM_ID(), spec.getId()), String.valueOf(Integer.MAX_VALUE)); } if (spec.isBounded()) { config.put(String.format(StreamConfig.IS_BOUNDED_FOR_STREAM_ID(), spec.getId()), "true"); } spec.getConfig().forEach((property, value) -> { config.put(String.format(StreamConfig.STREAM_ID_PREFIX(), spec.getId()) + property, value); }); return new MapConfig(config); }
Source:
<code>public static String getHostHeader(final HttpServletRequest request) { for (int i = 0; i < hostHeaders.length; ++i) { final Enumeration<String> headers = request.getHeaders(hostHeaders[i]); if (headers.hasMoreElements()) { <START> return headers.nextElement(); <END> } } return request.getServerName() + ":" + Integer.toString(request.getServerPort()); }</code><technical_language>behavior appears identical: occurrence of header. I understand of X-Forwarded-Host header (comma separated) values, I this change solves problem</technical_language>

Target:
public static String getHostHeader(final HttpServletRequest request) { for (int i = 0; i < hostHeaders.length; ++i) { final String header = request.getHeader(hostHeaders[i]); if (header != null) { final String[] values = header.split(", *"); if (values.length >= 1) { return values[0]; } } } return request.getServerName() + ":" + Integer.toString(request.getServerPort()); }
Source:
<code>public Map<String, Object> getProperties() { <START> return this.properties; <END> }</code><technical_language>M-m-m. simplify life for Jackson for client afterward return null if properties is empty? add eventually more more here, some cases is empty</technical_language>

Target:
public Map<String, Object> getProperties() { return this.properties.size() == 0 ? null : this.properties; }
Source:
<code>public void apply(final VariantContext variant, final ReadsContext readsContext, final ReferenceContext referenceContext, final FeatureContext featureContext) { <START> if (variant.isFiltered()) return; <END> if (variant.isIndel()) { indelFalsePositiveCount++; } else { snpFalsePositiveCount++; } }</code><technical_language>GATK standard practice is braces for simple ifs. I prefer one-liners, conform</technical_language>

Target:
public void apply(final VariantContext variant, final ReadsContext readsContext, final ReferenceContext referenceContext, final FeatureContext featureContext) { if (variant.isFiltered()) { return; } if (variant.isIndel()) { indelFalsePositiveCount.increment(); } else { snpFalsePositiveCount.increment(); } }
Source:
<code><START> public String toString() { <END> return "GCS File [content type=" + contentType + ", crc32c=" + crc32c + ", etag=" + etag + ", generation=" + generation + ", id=" + id + ", kind=" + kind + ", md5 hash=" + md5Hash + ", name=" + name + ", self link=" + selfLink + ", size=" + size + ", storage class=" + storageClass + ", time created=" + timeCreated + ", time storage class updated=" + timeStorageClassUpdated + "]"; }</code><technical_language>yuck. ;)</technical_language>

Target:
public String toString() { return MoreObjects.toStringHelper(this) .add("content type", contentType) .add("crc32", crc32c) .add("etag", etag) .add("generation", generation) .add("id", id) .add("kind", kind) .add("md5 hash", md5Hash) .add("name", name) .add("self link", selfLink) .add("size", size) .add("storage class", storageClass) .add("time created", timeCreated) .add("time storage class updated", timeStorageClassUpdated) .toString(); }
Source:
<code>public static String prependIfNotBlank(final String str, final String prefix) { <START> return isBlank(str) ? EMPTY : defaultString(prefix) + str; <END> }</code><technical_language>suggestion return isBlank(str) ? str : defaultString(prefix) + str;</technical_language>

Target:
public static String prependIfNotBlank(final String str, final String prefix) { if (isEmpty(prefix) || isBlank(str)) { return str; } return prefix + str; }
Source:
<code>public VdcActionParametersBase getParameters(Watchdog model, VmWatchdog entity) { WatchdogParameters parameters = new WatchdogParameters(); if (model.isSetAction()) { parameters.setAction(WatchdogMapper.map(model.getAction())); } else { parameters.setAction(entity.getAction()); } if (model.isSetModel()) { parameters.setModel(WatchdogMapper.map(model.getModel())); } else { <START> parameters.setAction(entity.getAction()); <END> } parameters.setId(instanceTypeId); parameters.setVm(false); return parameters; }</code><technical_language>a typo, meant: parameters.setModel(entity.getModel());</technical_language>

Target:
public VdcActionParametersBase getParameters(Watchdog model, VmWatchdog entity) { WatchdogParameters parameters = new WatchdogParameters(); if (model.isSetAction()) { parameters.setAction(WatchdogMapper.map(model.getAction())); } else { parameters.setAction(entity.getAction()); } if (model.isSetModel()) { parameters.setModel(WatchdogMapper.map(model.getModel())); } else { parameters.setModel(entity.getModel()); } parameters.setId(instanceTypeId); parameters.setVm(false); return parameters; }
Source:
<code>private static AbstractFileSystem getAbstractFileSystem( UserGroupInformation user, final URI uri, final Configuration conf) throws UnsupportedFileSystemException, IOException { try { return user.doAs(new PrivilegedExceptionAction<AbstractFileSystem>() { @Override public AbstractFileSystem run() throws UnsupportedFileSystemException { return AbstractFileSystem.get(uri, conf); } }); } catch (RuntimeException ex) { Throwable cause = ex.getCause(); if (cause instanceof IOException) { throw (IOException) cause; } else { throw ex; } } catch (InterruptedException ex) { LOG.debug("Error", ex); <START> Thread.currentThread().interrupt(); <END> throw new IOException("Failed to get the AbstractFileSystem for path: " + uri, ex); } }</code><technical_language>L356, InterruptedIOException</technical_language>

Target:
private static AbstractFileSystem getAbstractFileSystem( UserGroupInformation user, final URI uri, final Configuration conf) throws UnsupportedFileSystemException, IOException { try { return user.doAs(new PrivilegedExceptionAction<AbstractFileSystem>() { @Override public AbstractFileSystem run() throws UnsupportedFileSystemException { return AbstractFileSystem.get(uri, conf); } }); } catch (RuntimeException ex) { Throwable cause = ex.getCause(); if (cause instanceof IOException) { throw (IOException) cause; } else { throw ex; } } catch (InterruptedException ex) { LOG.debug("Thread interrupted", ex); Thread.currentThread().interrupt(); throw new InterruptedIOException( "Failed to get the AbstractFileSystem for path: " + uri); } }
Source:
<code>public List<PropertyDto> selectGlobalPropertiesByKeyQuery(DbSession session, String keyQuery) { <START> return getMapper(session).selectGlobalPropertiesByKeyQuery(buildLikeValue(keyQuery, WildcardPosition.BEFORE)); <END> }</code><technical_language>want check keyQuery is null</technical_language>

Target:
public List<PropertyDto> selectGlobalPropertiesByKeyQuery(DbSession session, String keyQuery) { return getMapper(session).selectGlobalPropertiesByKeyQuery(buildLikeValue(keyQuery, WildcardPosition.BEFORE_AND_AFTER)); }
Source:
<code>private <T> T doStorageClientOperation(Callable<T> operation) { int attempts = 0; T result = null; while (attempts <= 1) { attempts++; try { result = operation.call(); break; } catch (BlobStorageException bsEx) { if (attempts == 1 && tryHandleExceptionAndHintRetry(bsEx)) { <START> logger.info("Retrying blob store operation due to expired token"); <END> continue; } throw bsEx; } catch (Exception ex) { throw new IllegalStateException("Unknown blob storage exception", ex); } } return result; }</code><technical_language>base class expired tokens</technical_language>

Target:
private <T> T doStorageClientOperation(Callable<T> operation) { int attempts = 0; T result = null; while (attempts <= 1) { attempts++; try { result = operation.call(); break; } catch (BlobStorageException bsEx) { if (attempts == 1 && handleExceptionAndHintRetry(bsEx)) { logger.info("Retrying blob store operation due to exception: " + bsEx.toString()); azureMetrics.storageClientOperationRetryCount.inc(); continue; } throw bsEx; } catch (Exception ex) { azureMetrics.storageClientOperationExceptionCount.inc(); if (attempts == 1) { azureMetrics.storageClientFailureAfterRetryCount.inc(); } throw new IllegalStateException("Unknown blob storage exception", ex); } } return result; }
Source:
<code>public void setWidth(RealParameter width) { this.width = width == null ? new RealLiteral(0.25) : width; <START> if (width != null) { <END> width.setContext(RealParameterContext.NON_NEGATIVE_CONTEXT); width.setParent(this); } }</code><technical_language>expose default width static field, in unit test</technical_language>

Target:
public void setWidth(RealParameter width) { this.width = width == null ? new RealLiteral(DEFAULT_WIDTH) : width; if (width != null) { width.setContext(RealParameterContext.NON_NEGATIVE_CONTEXT); width.setParent(this); } }
Source:
<code><START> DefaultSaml2AuthenticatedPrincipal(String name, Map<String, List<Object>> attributes) { <END> this.name = name; this.attributes = attributes; }</code><technical_language>thinking constructor public applications in authentication providers</technical_language>

Target:
public DefaultSaml2AuthenticatedPrincipal(String name, Map<String, List<Object>> attributes) { Assert.notNull(name, "name cannot be null"); Assert.notNull(attributes, "attributes cannot be null"); this.name = name; this.attributes = attributes; }
Source:
<code>private void onFragmentLoaded() { if (listAdapter == null) { MainActivity mainActivity = (MainActivity) getActivity(); listAdapter = new AllEpisodesRecycleAdapter(mainActivity, itemAccess, new DefaultActionButtonCallback(mainActivity), showOnlyNewEpisodes()); listAdapter.setHasStableIds(true); recyclerView.setAdapter(listAdapter); } <START> if(episodes == null || episodes.size() == 0) { <END> recyclerView.setVisibility(View.GONE); layoutEmpty.setVisibility(View.VISIBLE); } else { layoutEmpty.setVisibility(View.GONE); recyclerView.setVisibility(View.VISIBLE); } listAdapter.notifyDataSetChanged(); restoreScrollPosition(); getActivity().supportInvalidateOptionsMenu(); updateShowOnlyEpisodesListViewState(); }</code><technical_language>Please a space if opening bracket</technical_language>

Target:
private void onFragmentLoaded() { if (listAdapter == null) { MainActivity mainActivity = (MainActivity) getActivity(); listAdapter = new AllEpisodesRecycleAdapter(mainActivity, itemAccess, new DefaultActionButtonCallback(mainActivity), showOnlyNewEpisodes()); listAdapter.setHasStableIds(true); recyclerView.setAdapter(listAdapter); } if (episodes == null || episodes.size() == 0) { recyclerView.setVisibility(View.GONE); emptyView.setVisibility(View.VISIBLE); } else { emptyView.setVisibility(View.GONE); recyclerView.setVisibility(View.VISIBLE); } listAdapter.notifyDataSetChanged(); restoreScrollPosition(); getActivity().supportInvalidateOptionsMenu(); updateShowOnlyEpisodesListViewState(); }
Source:
<code><START> public void zoomTo() { <END> if (urlParser.isValid() && !zoomedTo) { final Timer timer = new Timer() { @Override public void run() { mapWidget.getMapModel().getMapView().setCurrentScale(urlParser.getR(), MapView.ZoomOption.EXACT); mapWidget.getMapModel().getMapView().setCenterPosition(new Coordinate(urlParser.getX(), urlParser.getY())); this.cancel(); zoomedTo = true; } }; timer.schedule(100); } }</code><technical_language>is this public</technical_language>

Target:
private void zoomTo() { if (urlParser.isValid() && !zoomedTo) { final Timer timer = new Timer() { @Override public void run() { mapWidget.getMapModel().getMapView().setCurrentScale(urlParser.getR(), MapView.ZoomOption.EXACT); mapWidget.getMapModel().getMapView().setCenterPosition(new Coordinate(urlParser.getX(), urlParser.getY())); this.cancel(); zoomedTo = true; } }; timer.schedule(100); } }
Source:
<code>public void init() { if (!isInit) { try { initInternal(); isInit = true; } catch (final AccumuloException | AccumuloSecurityException | TableNotFoundException | TableExistsException | RyaClientException e) { logger.warn("Unable to initialize index. Throwing Runtime Exception. ", e); <START> throw new RuntimeException(e); <END> } } }</code><technical_language>Unfortunately, delete this method. This is initialize Indices created reflection in AccumuloRyaDAO</technical_language>

Target:
public void init() { if (!isInit) { try { initReadWrite(); isInit = true; } catch (final AccumuloException | AccumuloSecurityException | TableNotFoundException | TableExistsException | RyaClientException e) { logger.error("Unable to initialize index. Throwing Runtime Exception. ", e); throw new RuntimeException(e); } } }
Source:
<code>public Optional<ImmutableZkWorker> findWorkerForTask( RemoteTaskRunnerConfig config, ImmutableMap<String, ImmutableZkWorker> zkWorkers, Task task ) { final TreeSet<ImmutableZkWorker> sortedWorkers = Sets.newTreeSet( new Comparator<ImmutableZkWorker>() { @Override public int compare( ImmutableZkWorker zkWorker, ImmutableZkWorker zkWorker2 ) { int comparation = -Ints.compare(zkWorker2.getCurrCapacityUsed(), zkWorker.getCurrCapacityUsed()); if(comparation == 0) { <START> comparation = zkWorker2.getWorker().getIp().compareTo(zkWorker.getWorker().getIp()); <END> } return comparation; } } ); sortedWorkers.addAll(zkWorkers.values()); final String minWorkerVer = config.getMinWorkerVersion(); for (ImmutableZkWorker zkWorker : sortedWorkers) { if (zkWorker.canRunTask(task) && zkWorker.isValidVersion(minWorkerVer)) { return Optional.of(zkWorker); } } return Optional.absent(); }</code><technical_language>comparation = zkWorker.getWorker().getVersion().compareTo(zkWorker2.getWorker().getVersion());</technical_language>

Target:
public Optional<ImmutableZkWorker> findWorkerForTask( RemoteTaskRunnerConfig config, ImmutableMap<String, ImmutableZkWorker> zkWorkers, Task task ) { final TreeSet<ImmutableZkWorker> sortedWorkers = Sets.newTreeSet( new Comparator<ImmutableZkWorker>() { @Override public int compare( ImmutableZkWorker zkWorker, ImmutableZkWorker zkWorker2 ) { int retVal = -Ints.compare(zkWorker2.getCurrCapacityUsed(), zkWorker.getCurrCapacityUsed()); if(retVal == 0) { retVal = zkWorker2.getWorker().getVersion().compareTo(zkWorker.getWorker().getVersion()); } return retVal; } } ); sortedWorkers.addAll(zkWorkers.values()); final String minWorkerVer = config.getMinWorkerVersion(); for (ImmutableZkWorker zkWorker : sortedWorkers) { if (zkWorker.canRunTask(task) && zkWorker.isValidVersion(minWorkerVer)) { return Optional.of(zkWorker); } } return Optional.absent(); }
Source:
<code><START> protected void buildEnvVarsFromActionable(Actionable build, Map<String, String> env) { <END> MercurialTagAction a = findTag(build); if (a != null) { env.put("MERCURIAL_REVISION", a.id); env.put("MERCURIAL_REVISION_SHORT", a.getShortId()); env.put("MERCURIAL_REVISION_NUMBER", a.rev); } }</code><technical_language>package-private. protected implies expect called by, overridden by, subclasses, is case here</technical_language>

Target:
void buildEnvVarsFromActionable(Actionable build, Map<String, String> env) { MercurialTagAction a = findTag(build); if (a != null) { env.put("MERCURIAL_REVISION", a.id); env.put("MERCURIAL_REVISION_SHORT", a.getShortId()); env.put("MERCURIAL_REVISION_NUMBER", a.rev); } }
Source:
<code><START> public boolean equals(Object obj) { return Objects.equals(obj, inputEdge); <END> }</code><technical_language>comparing InputEdge SourceInputConfig here</technical_language>

Target:
public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof SourceInputConfig)) { return false; } SourceInputConfig other = (SourceInputConfig) obj; return Objects.equals(other.inputEdge, inputEdge); }
Source:
<code>public Mono<HttpResponse> process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { <START> context.getHttpRequest().setHeader("Ocp-Apim-Subscription-Key", credential.getSubscriptionKey()); <END> return next.process(); }</code><technical_language>constant defined in this class instead of string</technical_language>

Target:
public Mono<HttpResponse> process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { context.getHttpRequest().setHeader(OCP_APIM_SUBSCRIPTION_KEY, credential.getSubscriptionKey()); return next.process(); }
Source:
<code>public void updateFeaturedImage(long featuredImageId) { EditPostRepository postRepository = getEditPostRepository(); if (postRepository == null) { return; } postRepository.update(postModel -> { postModel.setFeaturedImageId(featuredImageId); updateFeaturedImageView(); <START> if (featuredImageId != 0) { <END> mFeaturedImageHelper.trackFeaturedImageEvent( FeaturedImageHelper.TrackableEvent.IMAGE_PICKED, postModel, OriginType.EDIT_POST_SETTINGS ); } return true; }); }</code><technical_language>updateFeaturedImage is called EditPostActivity 1) media exists in remote selected 2) a media exist in remote uploaded Case 1 is fine, wondering if case 2 is want track. do want track actual click/selection of media - matter upload? Wdyt</technical_language>

Target:
public void updateFeaturedImage(long featuredImageId) { EditPostRepository postRepository = getEditPostRepository(); if (postRepository == null) { return; } postRepository.update(postModel -> { postModel.setFeaturedImageId(featuredImageId); updateFeaturedImageView(); return true; }); }
Source:
<code>private boolean isUnitTest(MethodTree tree) { <START> for (AnnotationTree annotationTree : tree.modifiers().annotations()) { <END> if (annotationTree.symbolType().is("org.junit.Test")) { return true; } } Symbol.TypeSymbol enclosingClass = tree.symbol().enclosingClass(); return enclosingClass != null && enclosingClass.type().isSubtypeOf("junit.framework.TestCase") && tree.simpleName().name().startsWith("test"); }</code><technical_language>is fine do syntax (so know) rely semantic metadata of method symbol check annotation. (you end code)</technical_language>

Target:
private boolean isUnitTest(MethodTree tree) { if (tree.symbol().metadata().isAnnotatedWith("org.junit.Test")) { return true; } Symbol.TypeSymbol enclosingClass = tree.symbol().enclosingClass(); return enclosingClass != null && enclosingClass.type().isSubtypeOf("junit.framework.TestCase") && tree.simpleName().name().startsWith("test"); }
Source:
<code>public static boolean containsErrors(Comparison comparison) { boolean isError = false; Diagnostic diagnostic = comparison.getDiagnostic(); if (diagnostic != null) { <START> return diagnostic.getSeverity() > Diagnostic.WARNING; <END> } return isError; }</code><technical_language>variable isError ? is assigned false returned is. 'return false' end method, assign isError here. BTW, variable renamed containsError hasError 'isError' is proper english</technical_language>

Target:
public static boolean containsErrors(Comparison comparison) { Diagnostic diagnostic = comparison.getDiagnostic(); if (diagnostic != null) { return diagnostic.getSeverity() > Diagnostic.WARNING; } return false; }
Source:
<code>public Object apply(ConfigResource rsrc, Input input) throws AuthException, ResourceNotFoundException, BadRequestException { if (input == null || input.operation == null) { throw new BadRequestException("operation must be specified"); } switch (input.operation) { case FLUSH_ALL: for (DynamicMap.Entry<Cache<?, ?>> e : cacheMap) { CacheResource cacheResource = new CacheResource(e.getPluginName(), e.getExportName(), e.getProvider()); if (FlushCache.WEB_SESSIONS.equals(cacheResource.getName())) { continue; } flushCache.apply(cacheResource, <START> new FlushCache.Input()); <END> } return Response.ok("ok"); default: throw new BadRequestException("unsupported operation: " + input.operation); } }</code><technical_language>a bad rebase, is new for constant object in a loop</technical_language>

Target:
public Object apply(ConfigResource rsrc, Input input) throws AuthException, ResourceNotFoundException, BadRequestException { if (input == null || input.operation == null) { throw new BadRequestException("operation must be specified"); } switch (input.operation) { case FLUSH_ALL: for (DynamicMap.Entry<Cache<?, ?>> e : cacheMap) { CacheResource cacheResource = new CacheResource(e.getPluginName(), e.getExportName(), e.getProvider()); if (FlushCache.WEB_SESSIONS.equals(cacheResource.getName())) { continue; } flushCache.apply(cacheResource, null); } return Response.ok(""); default: throw new BadRequestException("unsupported operation: " + input.operation); } }
Source:
<code>private void createRootExtensionsDirectory(File atLocation) { if (!atLocation.mkdirs()) { <START> throw new RuntimeException( <END> String.format( "Unable to create extensions directory at [%s]", atLocation.getAbsolutePath() ) ); } }</code><technical_language>IOException</technical_language>

Target:
private void createRootExtensionsDirectory(File atLocation) { if (!atLocation.mkdirs()) { throw new ISE( String.format( "Unable to create extensions directory at [%s]", atLocation.getAbsolutePath() ) ); } }
Source:
<code>private Response processMessage(final Message message) { if (message == null) { throw new IllegalArgumentException("Cannot notify listeners for null message"); } Class<? extends Message> messageType = message.getClass(); Response finalResponse = Response.empty(); synchronized (messageHandlers) { List<MessageHandler> handlers = messageHandlers.get(messageType); if (handlers != null) { for (MessageHandler handler : handlers) { try { Response response = processMessage(handler, message); finalResponse = finalResponse.combine(response); } catch (Exception e) { <START> LOGGER.log(Level.WARNING, "Exception while processing message", e); <END> } } } } return finalResponse; }</code><technical_language>add some message info</technical_language>

Target:
private Response processMessage(final Message message) { if (message == null) { throw new IllegalArgumentException("Cannot notify listeners for null message"); } Class<? extends Message> messageType = message.getClass(); Response finalResponse = Response.empty(); synchronized (messageHandlers) { List<MessageHandler> handlers = messageHandlers.get(messageType); if (handlers != null) { for (MessageHandler handler : handlers) { try { Response response = processMessage(handler, message); finalResponse = finalResponse.combine(response); } catch (Exception e) { LOGGER.log(Level.WARNING, "Exception while processing message " + message, e); } } } } return finalResponse; }
Source:
<code>public boolean apply(@Nullable Entity input) { if (input == null) return false; <START> for (Class<?> cls : ClassUtils.getAllInterfaces(input.getClass())) { <END> if (pattern.matcher(cls.getName()).matches()) { return true; } } return false; }</code><technical_language>brooklyn.util.javalang.Reflections.getAllInterfaces(Class), in ClassUtils. If dependency apache-commons lang3, delete brooklyn code! (Or more specifically deprecate it, impl delegate lang3 version). for this PR</technical_language>

Target:
public boolean apply(@Nullable Entity input) { if (input == null) return false; for (Class<?> cls : Reflections.getAllInterfaces(input.getClass())) { if (pattern.matcher(cls.getName()).matches()) { return true; } } return false; }
Source:
<code>Map<String, Object> parse(Map<String, String> substitutions, Properties props, List<String> moduleArgs) { ArgumentsParser parser = new ArgumentsParser(props, moduleArgs.remove(0)); parser.getSubstitutions().putAll(substitutions); parser.parse(moduleArgs); Map<String, Object> argMap = parser.getParsedArgs(); if((Boolean)argMap.get("help")) { System.out.format("Usage: %s", parser.getUsage()); throw new ExitException("Help", 0); } if(!parser.getErrors().isEmpty()) { for(Throwable t : parser.getErrors()) { <START> System.err.format("FATAL: %s%n", t.getMessage()); <END> } throw new ExitException("Parsing error", 1); } return argMap; }</code><technical_language>some of failures in log error level some in sys.err</technical_language>

Target:
Map<String, Object> parse(Map<String, String> substitutions, Properties props, List<String> moduleArgs) { ArgumentsParser parser = new ArgumentsParser(props, moduleArgs.remove(0)); parser.getSubstitutions().putAll(substitutions); parser.parse(moduleArgs); Map<String, Object> argMap = parser.getParsedArgs(); if((Boolean)argMap.get("help")) { System.out.format("Usage: %s", parser.getUsage()); throw new ExitException("Help", 0); } if(!parser.getErrors().isEmpty()) { for(Throwable t : parser.getErrors()) { log.error(t.getMessage()); } throw new ExitException("Parsing error", 1); } if (moduleArgs.size() != 0) { log.error("Extra parameters in command-line"); throw new ExitException("Parsing error", 1); } return argMap; }
Source:
<code>public void testAllowNonRBAC() throws Exception { KernelServicesBuilder builder = createKernelServicesBuilder(TestModelType.DOMAIN) .setXmlResource("domain-transform-no-rbac-provider.xml"); builder.createLegacyKernelServicesBuilder(modelVersion, testControllerVersion).skipReverseControllerCheck(); KernelServices mainServices = builder.build(); Assert.assertTrue(mainServices.isSuccessfulBoot()); KernelServices legacyServices = mainServices.getLegacyServices(modelVersion); Assert.assertTrue(legacyServices.isSuccessfulBoot()); ModelFixer fixer = new RbacModelFixer(modelVersion) { @Override public ModelNode fixModel(ModelNode modelNode) { <START> System.out.println("Running for " + modelVersion); <END> return super.fixModel(modelNode); } }; if (modelVersion.getMajor() == 4) { checkCoreModelTransformation(mainServices, modelVersion, fixer, null); } mainServices.shutdown(); }</code><technical_language>removed</technical_language>

Target:
public void testAllowNonRBAC() throws Exception { KernelServicesBuilder builder = createKernelServicesBuilder(TestModelType.DOMAIN) .setXmlResource("domain-transform-no-rbac-provider.xml"); builder.createLegacyKernelServicesBuilder(modelVersion, testControllerVersion).skipReverseControllerCheck(); KernelServices mainServices = builder.build(); Assert.assertTrue(mainServices.isSuccessfulBoot()); KernelServices legacyServices = mainServices.getLegacyServices(modelVersion); Assert.assertTrue(legacyServices.isSuccessfulBoot()); checkCoreModelTransformation(mainServices, modelVersion, new RbacModelFixer(modelVersion), null); mainServices.shutdown(); }
Source:
<code>@Override boolean replIsCompactionDisabledForDatabase(String dbName) throws TException { try { Database database = rs.getDatabase(getDefaultCatalog(conf), dbName); if (database != null) { return !ReplUtils.isFirstIncDone(database.getParameters()); } <START> LOG.info("Unable to find database " + dbName); <END> return true; } catch (NoSuchObjectException e) { LOG.info("Unable to find database " + dbName); return true; } }</code><technical_language>2 flows for database case</technical_language>

Target:
@Override boolean replIsCompactionDisabledForDatabase(String dbName) throws TException { try { Database database = rs.getDatabase(getDefaultCatalog(conf), dbName); return ReplUtils.isFirstIncPending(database.getParameters()); } catch (NoSuchObjectException e) { LOG.info("Unable to find database " + dbName); return true; } }
Source:
<code>public String getName() { <START> return "COLLATION_KEY"; <END> }</code><technical_language>CollationKeyFunction.NAME instead of repeating string constant</technical_language>

Target:
public String getName() { return NAME; }
Source:
<code>abstract ActionResult getCachedActionResult(DigestUtil.ActionKey actionKey) throws IOException, InterruptedException; <START> abstract public boolean isGrpcBlobStore(); <END> abstract void upload( DigestUtil.ActionKey actionKey, Action action, Command command, Path execRoot, Collection<Path> files, FileOutErr outErr) throws ExecException, IOException, InterruptedException; protected abstract ListenableFuture<Void> downloadBlob(Digest digest, OutputStream out); public ListenableFuture<byte[]> downloadBlob(Digest digest) { if (digest.getSizeBytes() == 0) { return EMPTY_BYTES; } ByteArrayOutputStream bOut = new ByteArrayOutputStream((int) digest.getSizeBytes()); SettableFuture<byte[]> outerF = SettableFuture.create(); Futures.addCallback( downloadBlob(digest, bOut), new FutureCallback<Void>() { @Override public void onSuccess(Void aVoid) { outerF.set(bOut.toByteArray()); } @Override public void onFailure(Throwable t) { outerF.setException(t); } }, directExecutor()); return outerF; }</code><technical_language>suggestion: rename supportsRemoteExecution isRemoteExecutionCompatible? cleaner easier understand this method is in _any_ cache</technical_language>

Target:
abstract ActionResult getCachedActionResult(DigestUtil.ActionKey actionKey) throws IOException, InterruptedException; abstract public boolean supportsRemoteExecution(); abstract void upload( DigestUtil.ActionKey actionKey, Action action, Command command, Path execRoot, Collection<Path> files, FileOutErr outErr) throws ExecException, IOException, InterruptedException; protected abstract ListenableFuture<Void> downloadBlob(Digest digest, OutputStream out); public ListenableFuture<byte[]> downloadBlob(Digest digest) { if (digest.getSizeBytes() == 0) { return EMPTY_BYTES; } ByteArrayOutputStream bOut = new ByteArrayOutputStream((int) digest.getSizeBytes()); SettableFuture<byte[]> outerF = SettableFuture.create(); Futures.addCallback( downloadBlob(digest, bOut), new FutureCallback<Void>() { @Override public void onSuccess(Void aVoid) { outerF.set(bOut.toByteArray()); } @Override public void onFailure(Throwable t) { outerF.setException(t); } }, directExecutor()); return outerF; }
Source:
<code>public void matchesEmptyType() throws IOException { MatcherAssert.assertThat( new FkContentType( "*/*", FkContentTypeTest.createTakeWithEmptyResponse() <START> ).route( <END> new RqWithHeader( new RqFake(), FkContentTypeTest.CONTENT_TYPE, "" ) ).has(), Matchers.is(true) ); }</code><technical_language>@dalifreire 4 spaces</technical_language>

Target:
public void matchesEmptyType() throws IOException { MatcherAssert.assertThat( new FkContentType( "*/*", FkContentTypeTest.emptyResponse() ).route( new RqWithHeader( new RqFake(), FkContentTypeTest.CONTENT_TYPE, "" ) ).has(), Matchers.is(true) ); }
Source:
<code>private String getTokenValue(int length) { lastTokenType = TOKEN_VALUE; lastTokenValue = builder.substring(0, length); <START> builder = new StringBuilder(BUFFER_SIZE); <END> return lastTokenValue; }</code><technical_language>builder.setLength(0) here, avoid reallocating (long) buffer time</technical_language>

Target:
private String getTokenValue(int length) { lastTokenType = TOKEN_VALUE; lastTokenValue = builder.toString(); builder.setLength(0); return lastTokenValue; }