auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public JandexClassFileServices(JandexDiscoveryStrategy strategy) { index = strategy.getCompositeJandexIndex(); if (index == null) { throw CommonLogger.LOG.jandexIndexNotCreated(ClassFileServices.class.getSimpleName()); } this.classLoader = WeldResourceLoader.getClassLoader(); this.annotationClassAnnotationsCache = ComputingCacheBuilder.newBuilder().build(new AnnotationClassAnnotationLoader()); try { <START> Method setFlags = ClassFileInfo.class.getMethod("setFlags"); <END> jandexStaticCheckAvailable = setFlags != null; } catch (NoSuchMethodException e) { jandexStaticCheckAvailable = false; CommonLogger.LOG.usingOldJandexVersion(); } }</code><technical_language>ClassFileInfo org.jboss.jandex.ClassInfo. org.jboss.weld.security.GetDeclaredMethodAction instead of Class.getMethod() (which work ClassInfo.setFlags() is public)</technical_language>

Target:
public JandexClassFileServices(JandexDiscoveryStrategy strategy) { index = strategy.getCompositeJandexIndex(); if (index == null) { throw CommonLogger.LOG.jandexIndexNotCreated(ClassFileServices.class.getSimpleName()); } this.classLoader = WeldResourceLoader.getClassLoader(); this.annotationClassAnnotationsCache = ComputingCacheBuilder.newBuilder().build(new AnnotationClassAnnotationLoader()); }
Source:
<code>public boolean isThereANeedToSetDefaultType(final InterpolationVariable newVar, final InterpolationVariable oldVar) { <START> if (newVar.getDataType().equals(oldVar.getDataType()) <END> && Objects.equals(newVar.getFactType(), oldVar.getFactType()) && Objects.equals(newVar.getFactField(), oldVar.getFactField())) { return false; } else { return true; } }</code><technical_language>surprised @jomarko report this! more consistent Objects.equals(...) checks</technical_language>

Target:
public boolean isThereANeedToSetDefaultType(final InterpolationVariable newVar, final InterpolationVariable oldVar) { if (Objects.equals(newVar.getDataType(), oldVar.getDataType()) && Objects.equals(newVar.getFactType(), oldVar.getFactType()) && Objects.equals(newVar.getFactField(), oldVar.getFactField())) { return false; } else { return true; } }
Source:
<code>public int read() throws IOException { streamPos++; <START> return 0; <END> }</code><technical_language>a bit harsh, guessing TIFF reader a single byte read call</technical_language>

Target:
public int read() throws IOException { byte[] b = new byte[1]; read(b, 0, 1); return b[0]; }
Source:
<code>public EquivalenceUpdatingWorker(ContentResolver contentResolver, LookupEntryStore entryStore, EquivalenceResultStore resultStore, EquivalenceUpdater<Content> equivUpdater, Predicate<Content> filter) { this.contentResolver = checkNotNull(contentResolver); this.entryStore = checkNotNull(entryStore); this.resultStore = checkNotNull(resultStore); this.equivUpdater = checkNotNull(equivUpdater); this.filter = checkNotNull(filter); this.telescopeProxy = OwlTelescopeReporter.create( <START> OwlTelescopeReporters.EQUIVALENCE_UPDATING_WORKER, <END> Event.Type.EQUIVALENCE ); }</code><technical_language>this a single reporter for life of worker (and a single reporter means a single task I think?) I thought talked a new task hour similar</technical_language>

Target:
public EquivalenceUpdatingWorker(ContentResolver contentResolver, LookupEntryStore entryStore, EquivalenceResultStore resultStore, EquivalenceUpdater<Content> equivUpdater, Predicate<Content> filter) { this.contentResolver = checkNotNull(contentResolver); this.entryStore = checkNotNull(entryStore); this.resultStore = checkNotNull(resultStore); this.equivUpdater = checkNotNull(equivUpdater); this.filter = checkNotNull(filter); }
Source:
<code>public void getTest() throws SQLException { String userId = "test"; String classification = "test"; String itemId="test"; final State.Builder state = State.newBuilder(); state.setCompleted(true); state.setStarted(true); state.setGraded(true); IMocksControl control = createControl (); Connection conn = control.createMock (Connection. class); PreparedStatement st = control.createMock (PreparedStatement. class); ResultSet rs = control.createMock (ResultSet. class); final String query = "SELECT * FROM State WHERE UserID=? AND SchoolItemType=? AND SchoolItemID=?;"; expect(conn.prepareStatement(query)).andReturn(st); st.setString(1, userId); st.setString(2, classification); st.setString(3, itemId); expect(st.executeQuery()).andReturn(rs); <START> expect(rs.getBoolean("Completed")).andReturn(true); <END> expect(rs.getBoolean("Started")).andReturn(true); expect(rs.getBoolean("Graded")).andReturn(true); st.close(); rs.close(); control.replay (); State res=null; try { res = SqlStateManager.getState(conn, userId, classification, itemId); } catch (DatabaseAccessException e) { } State expected = state.build(); assertEquals (expected, res); control.verify (); }</code><technical_language>Constants</technical_language>

Target:
public void getTest() throws SQLException { String userId = "test"; String classification = "test"; String itemId="test"; final State.Builder state = State.newBuilder(); state.setCompleted(true); state.setStarted(true); state.setGraded(true); IMocksControl control = createControl (); Connection conn = control.createMock (Connection. class); PreparedStatement st = control.createMock (PreparedStatement. class); ResultSet rs = control.createMock (ResultSet. class); final String query = "SELECT * FROM State WHERE UserID=? AND SchoolItemType=? AND SchoolItemID=?;"; expect(conn.prepareStatement(query)).andReturn(st); st.setString(1, userId); st.setString(2, classification); st.setString(3, itemId); expect(st.executeQuery()).andReturn(rs); expect(rs.getBoolean(DatabaseStringConstants.STATE_COMPLETED)).andReturn(true); expect(rs.getBoolean(DatabaseStringConstants.STATE_STARTED)).andReturn(true); expect(rs.getBoolean(DatabaseStringConstants.STATE_GRADED)).andReturn(true); st.close(); rs.close(); control.replay (); State res=null; try { res = SqlStateManager.getState(conn, userId, classification, itemId); } catch (DatabaseAccessException e) { } State expected = state.build(); assertEquals (expected, res); control.verify (); }
Source:
<code>public List<Modification> modificationsSince(Revision revision) { <START> return gitLog("--date=iso", "--pretty=medium", "--no-decorate", "--no-color", String.format("%s..%s", revision.getRevision(), remoteBranch())); <END> }</code><technical_language>add extra args in method gitLog, hold true for log commands</technical_language>

Target:
public List<Modification> modificationsSince(Revision revision) { return gitLog("--date=iso", "--pretty=medium", "--no-color", String.format("%s..%s", revision.getRevision(), remoteBranch())); }
Source:
<code>public List<CatalogProtos.PartitionDescProto> getPartitions(String databaseName, String tableName) throws CatalogException { <START> throw new RuntimeException("not supported!"); <END> }</code><technical_language>MemStore is for tests, need implement this function</technical_language>

Target:
public List<CatalogProtos.PartitionDescProto> getPartitions(String databaseName, String tableName) throws CatalogException { List<CatalogProtos.PartitionDescProto> protos = new ArrayList<CatalogProtos.PartitionDescProto>(); if (partitions.containsKey(tableName)) { for (CatalogProtos.PartitionDescProto proto : partitions.get(tableName).values()) { protos.add(proto); } } return protos; }
Source:
<code>public void render(Context context, GlusterBrickEntity brick, SafeHtmlBuilder sb, String id) { if (brick == null) { return; } GlusterStatus status = brick.getStatus(); ImageResource statusImage = null; switch (status) { case DOWN: statusImage = resources.downImage(); break; case UP: statusImage = resources.upImage(); break; case UNKNOWN: statusImage = resources.questionMarkImage(); break; default: statusImage = resources.downImage(); } SafeHtml statusImageHtml = SafeHtmlUtils.fromTrustedString(AbstractImagePrototype.create(statusImage).getHTML()); <START> if (brick.getUnSyncedEntries() != null && brick.getUnSyncedEntries() > 0) { <END> SafeHtml alertImageHtml = SafeHtmlUtils.fromTrustedString(AbstractImagePrototype.create(resources.alertImage()).getHTML()); sb.append(templates.statusWithAlertTemplate(statusImageHtml, alertImageHtml, id, status.toString())); } else { sb.append(templates.statusTemplate(statusImageHtml, id, status.toString())); } }</code><technical_language>isEmpty instead of > 0 check</technical_language>

Target:
public void render(Context context, GlusterBrickEntity brick, SafeHtmlBuilder sb, String id) { if (brick == null) { return; } GlusterStatus status = brick.getStatus(); ImageResource statusImage = null; switch (status) { case DOWN: statusImage = resources.downImage(); break; case UP: statusImage = resources.upImage(); break; case UNKNOWN: statusImage = resources.questionMarkImage(); break; default: statusImage = resources.downImage(); } SafeHtml statusImageHtml = SafeHtmlUtils.fromTrustedString(AbstractImagePrototype.create(statusImage).getHTML()); if (brick.getUnSyncedEntries() > 0) { SafeHtml alertImageHtml = SafeHtmlUtils.fromTrustedString(AbstractImagePrototype.create(resources.alertImage()).getHTML()); sb.append(templates.statusWithAlertTemplate(statusImageHtml, alertImageHtml, id, status.toString())); } else { sb.append(templates.statusTemplate(statusImageHtml, id, status.toString())); } }
Source:
<code>private static boolean isMessageContinue(@NotNull String messagePart) { <START> return Character.isWhitespace(messagePart.charAt(0)); <END> }</code><technical_language>This is dangerous. 100% empty message here, call charAt(0)</technical_language>

Target:
private static boolean isMessageContinue(@NotNull String messagePart) { return messagePart.isEmpty() || Character.isWhitespace(messagePart.charAt(0)); }
Source:
<code>public MetadataResponse sync(@PathParam("entity") String entity, @PathParam("system") String system, @PathParam("key") String key, @QueryParam("values") String values) { <START> if(entity!=null && entity.length()>0 && <END> system!=null && system.length()>0 && key!=null && key.length()>0 && values!=null && values.length()>0) { String valueArray[] = values.split(","); return client.get().sync(entity, system, key, valueArray); } return null; }</code><technical_language>simplify this parameter checking Apache StringUtils if(StringUtils.isNotBlank(entity) && StringUtils.isNotBlank(system) && StringUtils.isNotBlank(key) && StringUtils.isNotBlank(values)) { ... }</technical_language>

Target:
public MetadataResponse sync(@PathParam("entity") String entity, @PathParam("system") String system, @PathParam("key") String key, @QueryParam("values") String values) { if(StringUtils.isNotBlank(entity) && StringUtils.isNotBlank(system) && StringUtils.isNotBlank(key) && StringUtils.isNotBlank(values)) { String valueArray[] = values.split(","); return client.get().sync(entity, system, key, valueArray); } return null; }
Source:
<code>public HelixTaskResult handleMessage() throws InterruptedException { verifyMessage(_message); HelixTaskResult result = new HelixTaskResult(); assert (_correlationId.equalsIgnoreCase(_message.getCorrelationId())); _logger.info("invoking reply message " + _message.getMsgId() + ", correlationid:" + _correlationId); AsyncCallback callback = _callbackMap.get(_correlationId); if (callback != null) { synchronized (callback) { callback.onReply(_message); if (callback.isDone()) { _logger.info("Removing finished callback, correlationid:" + _correlationId); _callbackMap.remove(_correlationId); } } } else { String msg = "Message " + _message.getMsgId() + " does not have correponding callback. Probably timed out already. Correlation id: " + _correlationId; <START> _logger.warn(msg); <END> } result.setSuccess(true); return result; }</code><technical_language>A question description, if error is logged here, meaning users is a mismatch. If callback is done, able distinguish this error other errors. Is this expected behavior</technical_language>

Target:
public HelixTaskResult handleMessage() throws InterruptedException { verifyMessage(_message); HelixTaskResult result = new HelixTaskResult(); assert (_correlationId.equalsIgnoreCase(_message.getCorrelationId())); _logger.info("invoking reply message " + _message.getMsgId() + ", correlationid:" + _correlationId); AsyncCallback callback = _callbackMap.get(_correlationId); synchronized (callback) { callback.onReply(_message); if (callback.isDone()) { _logger.info("Removing finished callback, correlationid:" + _correlationId); _callbackMap.remove(_correlationId); } } result.setSuccess(true); return result; }
Source:
<code>public void add(Event<T> windowEvent) { if (!windowEvent.isWatermark() && !windowEvent.isTimer()) { <START> queue.add(windowEvent); <END> } else { LOG.fine(String.format("Got watermark event with ts %d", windowEvent.getTimestamp())); } track(windowEvent); compactWindow(); }</code><technical_language>log needs handle timer event</technical_language>

Target:
public void add(Event<T> windowEvent) { if (windowEvent.isWatermark()) { LOG.fine(String.format("Got watermark event with ts %d", windowEvent.getTimestamp())); } else if (windowEvent.isTimer()) { LOG.fine(String.format("Got timer event with ts %d", windowEvent.getTimestamp())); } else { queue.add(windowEvent); } track(windowEvent); compactWindow(); }
Source:
<code>public static boolean isBundleClassUri(String uri) { if (uri != null && uri.startsWith(BUNDLECLASS_SCHEMA)) { <START> String[] split = uri.substring(14).split("/"); END> if (split.length == 2) { return true; } ; } return false; }</code><technical_language>I suppose indexOf("/") method instead of split performance a constant for prefix. int indexOf = uri.substring(BUNDLECLASS_PREFIX_LENGTH).indexOf("/"); if(indexOf > 0){ return true; } ...</technical_language>

Target:
public static boolean isBundleClassUri(String uri) { if (uri != null && uri.startsWith(BUNDLECLASS_SCHEMA)) { String[] split = uri.substring(BUNDLECLASS_SCHEMA.length()).split("/"); if (split.length == 2) { return true; } } return false; }
Source:
<code>public Row next() throws IOException { while (true) { try { Row result = currentDelegate.next(); if (result != null) { lastRowKey = result.getKey(); rowCount.incrementAndGet(); currentErrorBackoff = null; <START> timeoutRetryCount.set(0); <END> } return result; } catch (ScanTimeoutException rte) { handleScanTimeout(rte); } catch (IOExceptionWithStatus ioe) { handleIOException(ioe); } } }</code><technical_language>timeoutRetryCount = null is a nanoseconds faster for call .next(). I performance considerations, long rowCount instead of AtomicLong</technical_language>

Target:
public Row next() throws IOException { while (true) { try { Row result = currentDelegate.next(); if (result != null) { lastRowKey = result.getKey(); rowCount++; currentErrorBackoff = null; timeoutRetryCount = null; } return result; } catch (ScanTimeoutException rte) { handleScanTimeout(rte); } catch (IOExceptionWithStatus ioe) { handleIOException(ioe); } } }
Source:
<code>public void registerCustomDataRegistration(SpongeDataRegistration registration) { <START> Preconditions.checkState(SpongeDataManager.allowRegistrations); <END> Preconditions.checkState(registration.key.getNamespace().equals(registration.plugin.getMetadata().getId()), "Registration namespace (%s) is not matching plugin id (%s)", registration.key, registration.plugin.getMetadata().getId()); this.registrations.put(registration.getKey(), registration); this.registrationByPluginContainerId.computeIfAbsent(registration.getPluginContainer().getMetadata().getId(), k -> new ArrayList<>()).add(registration); for (DataStore dataStore : registration.getDataStores()) { this.dataStoreRegistry.register(dataStore, registration.getKeys()); } for (Key key : registration.getKeys()) { this.registerCustomDataProviderForKey(registration, key); } }</code><technical_language>Avoid adding more dependencies/additions Preconditions moving Guava explicitly in aspects. Also, needs error message instead of a random IllegalStateException</technical_language>

Target:
public void registerCustomDataRegistration(SpongeDataRegistration registration) { if (!SpongeDataManager.allowRegistrations) { throw new IllegalStateException("Data Registration is not allowed anymore."); } if (!registration.key.getNamespace().equals(registration.plugin.getMetadata().getId())) { throw new IllegalStateException(String.format("Registration namespace (%s) is not matching plugin id (%s)", registration.key, registration.plugin.getMetadata().getId())); } this.registrations.put(registration.getKey(), registration); this.registrationByPluginContainerId.computeIfAbsent(registration.getPluginContainer().getMetadata().getId(), k -> new ArrayList<>()).add(registration); for (final DataStore dataStore : registration.getDataStores()) { this.dataStoreRegistry.register(dataStore, registration.getKeys()); } for (Key key : registration.getKeys()) { this.registerCustomDataProviderForKey(registration, key); } }
Source:
<code>public void verifyCertificate(CertificateMessage message) throws HandshakeException { if (message.getCertificateChain() != null) { if (certificateVerifier != null) { certificateVerifier.verifyCertificate(message, session); <START> } else { <END> LOGGER.debug("Certificate validation failed: x509 could not be trusted!"); AlertMessage alert = new AlertMessage(AlertLevel.FATAL, AlertDescription.BAD_CERTIFICATE, session.getPeer()); throw new HandshakeException("Trust is not possible!", alert); } } else { RawPublicKeyIdentity rpk = new RawPublicKeyIdentity(message.getPublicKey()); if (!rpkStore.isTrusted(rpk)) { LOGGER.debug("Certificate validation failed: Raw public key is not trusted"); AlertMessage alert = new AlertMessage(AlertLevel.FATAL, AlertDescription.BAD_CERTIFICATE, session.getPeer()); throw new HandshakeException("Raw public key is not trusted", alert); } } }</code><technical_language>A certificate Verifier == null means support X.509 right ? If support X.509, certificate type/cipher suite negotiation failed before. if receive a CertificateMessage a CertificateChain, I if log raise bad certificate. I feel this is more error foreign peer (or a bug negotiation time). HANDSHAKE_FAILURE log "invalid Certifcate message" more appropriate</technical_language>

Target:
public void verifyCertificate(CertificateMessage message) throws HandshakeException { if (message.getCertificateChain() != null) { if (certificateVerifier != null) { certificateVerifier.verifyCertificate(message, session); } else { LOGGER.debug("Certificate validation failed: x509 could not be trusted!"); AlertMessage alert = new AlertMessage(AlertLevel.FATAL, AlertDescription.UNEXPECTED_MESSAGE, session.getPeer()); throw new HandshakeException("Trust is not possible!", alert); } } else { RawPublicKeyIdentity rpk = new RawPublicKeyIdentity(message.getPublicKey()); if (!rpkStore.isTrusted(rpk)) { LOGGER.debug("Certificate validation failed: Raw public key is not trusted"); AlertMessage alert = new AlertMessage(AlertLevel.FATAL, AlertDescription.BAD_CERTIFICATE, session.getPeer()); throw new HandshakeException("Raw public key is not trusted", alert); } } }
Source:
<code>private static String urlCombine(final String url, final String... parts) { final StringBuilder sb = new StringBuilder(); sb.append(url); for(final String s : parts) { if (StringUtils.isNotBlank(s)) { <START> if (sb.charAt(sb.length() - 1) != '/') { <END> sb.append("/"); } sb.append(s); } } return sb.toString(); }</code><technical_language>Protect empty url? (If url is blank, this throw IndexOutOfBounds.)</technical_language>

Target:
private static String urlCombine(final String url, final String... parts) { final StringBuilder sb = new StringBuilder(); if (url != null) { sb.append(url); for (final String s : parts) { if (StringUtils.isNotBlank(s)) { if (sb.length() > 0 && sb.charAt(sb.length() - 1) != '/') { sb.append("/"); } sb.append(s); } } } return sb.toString(); }
Source:
<code>public void updateAccount(Account account) { notNull(account, "account"); try { restTemplate.put(account.getUri(), account.createAccountUpdate()); } catch (GoodDataRestException e) { if (HttpStatus.NOT_FOUND.value() == e.getStatusCode()) { throw new AccountNotFoundException(account.getUri(), e); } else { throw e; } } catch (GoodDataException e) { <START> throw new GoodDataException("Unable to remove account", e); <END> } }</code><technical_language>Remove</technical_language>

Target:
public void updateAccount(Account account) { notNull(account, "account"); try { final MappingJacksonValue jacksonValue = new MappingJacksonValue(account); jacksonValue.setSerializationView(Account.UpdateView.class); restTemplate.put(account.getUri(), jacksonValue); } catch (GoodDataRestException e) { if (HttpStatus.NOT_FOUND.value() == e.getStatusCode()) { throw new AccountNotFoundException(account.getUri(), e); } else { throw e; } } catch (GoodDataException e) { throw new GoodDataException("Unable to update account", e); } }
Source:
<code>protected CosmosQuery createQuery(CosmosParameterAccessor accessor) { final CosmosQueryCreator creator = new CosmosQueryCreator(tree, accessor, mappingContext); final CosmosQuery query = creator.createQuery(); <START> query.setTree(tree); <END> return query; }</code><technical_language>pass limit query, instead of passing PartTree object</technical_language>

Target:
protected CosmosQuery createQuery(CosmosParameterAccessor accessor) { final CosmosQueryCreator creator = new CosmosQueryCreator(tree, accessor, mappingContext); final CosmosQuery query = creator.createQuery(); if (tree.isLimiting()) { Integer limit = tree.getMaxResults(); if (limit != null) { query.setLimit(limit); } } return query; }
Source:
<code>public void fill(Control control, MouseEvent event, Point pt) { Chart chart = getChart(); if (chart.getSeriesSet().getSeries().length != 0) { if (event == null || chart.getAxisSet().getXAxes().length == 0 || chart.getAxisSet().getYAxes().length == 0 || getDensityViewer().getControl().getSeriesSet().getSeries().length == 0) { return; } ISeries series = getDensityViewer().getControl().getSeriesSet().getSeries()[0]; chart.getPlotArea().setToolTipText(null); if <START> (series.getXSeries().length <END> < 2) { return; } double delta = series.getXSeries()[1] - series.getXSeries()[0]; double[] xValues = series.getXSeries(); double coords = chart.getAxisSet().getXAxis(0).getDataCoordinate(event.x); int index = Arrays.binarySearch(xValues, coords); if (index < 0) { index = -index - 2; } if (index < 0) { return; } long x2 = (long) series.getXSeries()[index]; long x1 = (long) (x2 - delta); long y = Math.round(series.getYSeries()[index]); if (y > 0) { addItem(Messages.SimpleTooltipProvider_duration, FORMAT.format(x1) + '-' + FORMAT.format(x2)); addItem(null, ToolTipString.fromString(Messages.SimpleTooltipProvider_count), ToolTipString.fromDecimal(y)); } } }</code><technical_language>extract getXSeries local variable? This thread safe</technical_language>

Target:
public void fill(Control control, MouseEvent event, Point pt) { Chart chart = getChart(); if (chart.getSeriesSet().getSeries().length != 0) { if (event == null || chart.getAxisSet().getXAxes().length == 0 || chart.getAxisSet().getYAxes().length == 0 || getDensityViewer().getControl().getSeriesSet().getSeries().length == 0) { return; } ISeries series = getDensityViewer().getControl().getSeriesSet().getSeries()[0]; chart.getPlotArea().setToolTipText(null); double[] xValues = series.getXSeries(); if (xValues.length < 2) { return; } double delta = xValues[1] - xValues[0]; double coords = chart.getAxisSet().getXAxis(0).getDataCoordinate(event.x); int index = Arrays.binarySearch(xValues, coords); if (index < 0) { index = -index - 2; } if (index < 0) { return; } long x2 = (long) xValues[index]; long x1 = (long) (x2 - delta); long y = Math.round(series.getYSeries()[index]); if (y > 0) { addItem(Messages.SimpleTooltipProvider_duration, FORMAT.format(x1) + '-' + FORMAT.format(x2)); addItem(null, ToolTipString.fromString(Messages.SimpleTooltipProvider_count), ToolTipString.fromDecimal(y)); } } }
Source:
<code><START> protected Mono<Void> onAuthenticationSuccess(Authentication authentication, WebFilterExchange webFilterExchange) { <END> final ServerWebExchange exchange = webFilterExchange.getExchange(); final SecurityContextImpl securityContext = new SecurityContextImpl(authentication); return securityContextRepository.save(exchange, securityContext) .then(this.successHandler.onAuthenticationSuccess(webFilterExchange, authentication)) .subscriberContext(ReactiveSecurityContextHolder.withSecurityContext(Mono.just(securityContext))); }</code><technical_language>I this method private. If a user wishes override this behavior supply a custom successHandler. Similar for onAuthenticationFailure</technical_language>

Target:
private Mono<Void> onAuthenticationSuccess(Authentication authentication, WebFilterExchange webFilterExchange) { final ServerWebExchange exchange = webFilterExchange.getExchange(); final SecurityContextImpl securityContext = new SecurityContextImpl(authentication); return securityContextRepository.save(exchange, securityContext) .then(this.successHandler.onAuthenticationSuccess(webFilterExchange, authentication)) .subscriberContext(ReactiveSecurityContextHolder.withSecurityContext(Mono.just(securityContext))); }
Source:
<code>static Collection<RouteInfo> getRoutesFromTrafficSelectors( List<IkeTrafficSelector> trafficSelectors) { <START> final HashSet<IpPrefix> prefixes = new HashSet<>(); <END> final HashSet<RouteInfo> routes = new HashSet<>(); for (final IkeTrafficSelector selector : trafficSelectors) { for (final IpPrefix prefix : new IpRange(selector.startingAddress, selector.endingAddress).asIpPrefixes()) { routes.add(new RouteInfo(prefix, null)); } } return routes; }</code><technical_language>unused</technical_language>

Target:
static Collection<RouteInfo> getRoutesFromTrafficSelectors( List<IkeTrafficSelector> trafficSelectors) { final HashSet<RouteInfo> routes = new HashSet<>(); for (final IkeTrafficSelector selector : trafficSelectors) { for (final IpPrefix prefix : new IpRange(selector.startingAddress, selector.endingAddress).asIpPrefixes()) { routes.add(new RouteInfo(prefix, null)); } } return routes; }
Source:
<code>public void remove() throws BlogServiceException{ if(StringUtil.isNotEmpty(getBlogHandle())){ getService().removeBlogPost(getPostUuid(), getBlogHandle()); } else{ <START> getService().removeBlogPost(getPostUuid(), getAsString(BlogXPath.handle)); <END> } }</code><technical_language>this logic part of getBlogHandle function</technical_language>

Target:
public void remove() throws BlogServiceException{ getService().removeBlogPost(getPostUuid(), getBlogHandle()); }
Source:
<code>public void addFileSystemBind(final String hostPath, final String containerPath, final BindMode mode, final SelinuxContext selinuxContext) { final MountableFile mountableFile = MountableFile.forHostPath(hostPath); binds.add(new Bind(mountableFile.getFilesystemPath(), new Volume(containerPath), mode.accessMode, selinuxContext.selContext)); <START> } <END></code><technical_language>resolvedPath unpacks resource if is in a JAR file, replace getFilesystemPath()</technical_language>

Target:
public void addFileSystemBind(final String hostPath, final String containerPath, final BindMode mode, final SelinuxContext selinuxContext) { final MountableFile mountableFile = MountableFile.forHostPath(hostPath); binds.add(new Bind(mountableFile.getMountablePath(), new Volume(containerPath), mode.accessMode, selinuxContext.selContext)); }
Source:
<code>private int indexOfBatchChunkSizeParameter(Method method) { Annotation[][] parameterAnnotations = method.getParameterAnnotations(); <START> for (int i = 0; i < parameterAnnotations.length; i++) { <END> if (Stream.of(parameterAnnotations[i]).anyMatch(BatchChunkSize.class::isInstance)) { return i; } } return -1; }</code><technical_language>If do streams, hog? single element Stream approach is idiomatic... java return IntStream.range(0, parameterAnnotations.length) .filter(i -> parameterAnnotations[i].annotationType().isAssignableFrom(BatchChunkSize.class)) .findFirst().orElse(-1);</technical_language>

Target:
private int indexOfBatchChunkSizeParameter(Method method) { Annotation[][] parameterAnnotations = method.getParameterAnnotations(); return IntStream.range(0, parameterAnnotations.length) .filter(i -> Stream.of(parameterAnnotations[i]).anyMatch(BatchChunkSize.class::isInstance)) .findFirst() .orElse(-1); }
Source:
<code>protected void createStatesGroup(Composite composite) { String stateTypeName = fProvider.getStateTypeName(); StringBuilder buffer = new StringBuilder(); if (!stateTypeName.isEmpty()) { buffer.append(stateTypeName); buffer.append(" "); } buffer.append(Messages.TmfTimeLegend_StateTypeName); StateItem[] stateTable = fProvider.getStateTable(); List<StateItem> stateItems = stateTable != null ? Arrays.asList(stateTable) : Collections.emptyList(); Multimap<String, StateItem> groupedStateItems = <START> ArrayListMultimap.create(); <END> for (StateItem stateItem : stateItems) { if (!isLinkState(stateItem)) { Object group = stateItem.getStyleMap().get(ITimeEventStyleStrings.group()); if (group instanceof String) { groupedStateItems.put((String) group, stateItem); } else { groupedStateItems.put(buffer.toString(), stateItem); } } } for (String groupedStateLabel : groupedStateItems.keySet()) { Group gs = new Group(composite, SWT.NONE); gs.setText(groupedStateLabel); GridLayout layout = new GridLayout(); layout.marginWidth = 20; layout.marginBottom = 10; gs.setLayout(layout); GridData gridData = new GridData(); gridData.verticalAlignment = SWT.TOP; gs.setLayoutData(gridData); for (StateItem stateItem : groupedStateItems.get(groupedStateLabel)) { new LegendEntry(gs, stateItem); } } }</code><technical_language>This Multimap preserve order of keys. LinkedHashMultimap</technical_language>

Target:
protected void createStatesGroup(Composite composite) { String stateTypeName = fProvider.getStateTypeName(); StringBuilder buffer = new StringBuilder(); if (!stateTypeName.isEmpty()) { buffer.append(stateTypeName); buffer.append(" "); } buffer.append(Messages.TmfTimeLegend_StateTypeName); StateItem[] stateTable = fProvider.getStateTable(); List<StateItem> stateItems = stateTable != null ? Arrays.asList(stateTable) : Collections.emptyList(); Multimap<String, StateItem> groupedStateItems = LinkedHashMultimap.create(); for (StateItem stateItem : stateItems) { if (!isLinkState(stateItem)) { Object group = stateItem.getStyleMap().get(ITimeEventStyleStrings.group()); if (group instanceof String) { groupedStateItems.put((String) group, stateItem); } else { groupedStateItems.put(buffer.toString(), stateItem); } } } for (String groupedStateLabel : groupedStateItems.keySet()) { Group gs = new Group(composite, SWT.NONE); gs.setText(groupedStateLabel); GridLayout layout = new GridLayout(); layout.marginWidth = 20; layout.marginBottom = 10; gs.setLayout(layout); GridData gridData = new GridData(); gridData.verticalAlignment = SWT.TOP; gs.setLayoutData(gridData); for (StateItem stateItem : groupedStateItems.get(groupedStateLabel)) { new LegendEntry(gs, stateItem); } } }
Source:
<code>public Response seedNodes() { StringWriter sw = new StringWriter(); try { CassandraFrameworkProtos.CassandraFrameworkConfiguration configuration = cluster.getConfiguration().get(); JsonFactory factory = new JsonFactory(); JsonGenerator json = factory.createGenerator(sw); json.setPrettyPrinter(new DefaultPrettyPrinter()); json.writeStartObject(); <START> json.writeNumberField("native_port", CassandraCluster.getPortMapping(configuration, CassandraCluster.PORT_NATIVE)); <END> json.writeNumberField("rpc_port", CassandraCluster.getPortMapping(configuration, CassandraCluster.PORT_RPC)); writeSeedIps(json); json.writeEndObject(); json.close(); } catch (Exception e) { LOGGER.error("Failed to build seed list", e); return Response.serverError().build(); } return Response.ok(sw.toString(), "application/json").build(); }</code><technical_language>Please update json properties camel case instead of snake case. This is nice JS side of in a UI stick camel case convention accessing properties</technical_language>

Target:
public Response seedNodes() { StringWriter sw = new StringWriter(); try { CassandraFrameworkProtos.CassandraFrameworkConfiguration configuration = cluster.getConfiguration().get(); JsonFactory factory = new JsonFactory(); JsonGenerator json = factory.createGenerator(sw); json.setPrettyPrinter(new DefaultPrettyPrinter()); json.writeStartObject(); json.writeNumberField("nativePort", CassandraCluster.getPortMapping(configuration, CassandraCluster.PORT_NATIVE)); json.writeNumberField("rpcPort", CassandraCluster.getPortMapping(configuration, CassandraCluster.PORT_RPC)); writeSeedIps(json); json.writeEndObject(); json.close(); } catch (Exception e) { LOGGER.error("Failed to build seed list", e); return Response.serverError().build(); } return Response.ok(sw.toString(), "application/json").build(); }
Source:
<code>public void checkNameProjectTest() throws Exception { driver.navigate().to(swaggerUrl); <START> Assert.assertTrue(swagger.getWsNamesFromWorkspacePage().contains(workspace.getName())); <END> }</code><technical_language>Code clear if static import of **Asser.assertTrue** here</technical_language>

Target:
public void checkNameProjectTest() throws Exception { driver.navigate().to(swaggerUrl); assertTrue(swagger.getWsNamesFromWorkspacePage().contains(workspace.getName())); }
Source:
<code>public void testScriptTaskFEEL() throws Exception { KieBase kbase = createKnowledgeBase("BPMN2-ScriptTaskFEEL.bpmn2"); ksession = createKnowledgeSession(kbase); TestWorkItemHandler handler = new TestWorkItemHandler(); ksession.getWorkItemManager().registerWorkItemHandler("Human Task", handler); Map<String, Object> params = new HashMap<String, Object>(); params.put("name", "krisv"); Person person = new Person(); person.setName("krisv"); params.put("person", person); WorkflowProcessInstance processInstance = (WorkflowProcessInstance) ksession.startProcess("ScriptTask", params); assertEquals("Entry", processInstance.getVariable("x")); assertNull(processInstance.getVariable("y")); ksession.getWorkItemManager().completeWorkItem(handler.getWorkItem().getId(), null); assertEquals("Exit", getProcessVarValue(processInstance, "y")); <START> assertEquals("tester", processInstance.getVariable("surname")); <END> }</code><technical_language>do if right sequence flow? x = Entry if sequence flow</technical_language>

Target:
public void testScriptTaskFEEL() throws Exception { KieBase kbase = createKnowledgeBase("BPMN2-ScriptTaskFEEL.bpmn2"); ksession = createKnowledgeSession(kbase); TestWorkItemHandler handler = new TestWorkItemHandler(); ksession.getWorkItemManager().registerWorkItemHandler("Human Task", handler); Map<String, Object> params = new HashMap<String, Object>(); params.put("name", "krisv"); Person person = new Person(); person.setName("krisv"); params.put("person", person); WorkflowProcessInstance processInstance = (WorkflowProcessInstance) ksession.startProcess("ScriptTask", params); assertEquals("Entry", processInstance.getVariable("x")); assertNull(processInstance.getVariable("y")); ksession.getWorkItemManager().completeWorkItem(handler.getWorkItem().getId(), null); assertEquals("Exit", getProcessVarValue(processInstance, "y")); assertEquals("tester", processInstance.getVariable("surname")); assertNodeTriggered(processInstance.getId(), "Script1"); }
Source:
<code>public Optional<String> getCloseArgString() { <START> return Optional.ofNullable(closeArg); <END> }</code><technical_language>this</technical_language>

Target:
public String getCloseArgString() { return this.closeArg; }
Source:
<code>public void shouldCreateNewVisitWithVisitType() throws Exception { Patient patient = new Patient(); Location visitLocation = new Location(); String successMessage = "Success message"; String formattedPatient = "Patient name"; when(uiUtils.format(patient)).thenReturn(formattedPatient); when(uiUtils.message("coreapps.visit.createQuickVisit.successMessage", formattedPatient)).thenReturn(successMessage); <START> <END> HttpSession session = mock(HttpSession.class); HttpServletRequest request = mock(HttpServletRequest.class); when(request.getSession()).thenReturn(session); Visit visit = createVisit(); List<VisitType> visitTypes = visitService.getAllVisitTypes(); VisitType visitType = null; if(visitTypes.size() > 0){ visitType = visitTypes.get(0); } when(adtService.ensureVisit(eq(patient), any(Date.class), eq(visitLocation))).thenReturn(visit); FragmentActionResult result = controller.create(adtService, patient, visitLocation, uiUtils, visitType, emrContext, request); verify(session).setAttribute(AppUiConstants.SESSION_ATTRIBUTE_INFO_MESSAGE, successMessage); verify(session).setAttribute(AppUiConstants.SESSION_ATTRIBUTE_TOAST_MESSAGE, "true"); assertThat(result, is(CoreMatchers.any(FragmentActionResult.class))); }</code><technical_language>I lots of changes in this pull request expect a bit more tests. :)</technical_language>

Target:
public void shouldCreateNewVisitWithVisitType() throws Exception { Patient patient = new Patient(); Location visitLocation = new Location(); String successMessage = "Success message"; String formattedPatient = "Patient name"; when(uiUtils.format(patient)).thenReturn(formattedPatient); when(uiUtils.message("coreapps.visit.createQuickVisit.successMessage", formattedPatient)).thenReturn(successMessage); HttpSession session = mock(HttpSession.class); HttpServletRequest request = mock(HttpServletRequest.class); when(request.getSession()).thenReturn(session); Visit visit = createVisit(); VisitType visitType = new VisitType(); visitType.setId(1); visitType.setName("Outpatient"); when(visitService.saveVisitType(visitType)).thenReturn(visitType); when(adtService.ensureVisit(eq(patient), any(Date.class), eq(visitLocation))).thenReturn(visit); FragmentActionResult result = controller.create(adtService, visitService, patient, visitLocation, uiUtils, visitType, emrContext, request); verify(session).setAttribute(AppUiConstants.SESSION_ATTRIBUTE_INFO_MESSAGE, successMessage); verify(session).setAttribute(AppUiConstants.SESSION_ATTRIBUTE_TOAST_MESSAGE, "true"); assertThat(result, is(CoreMatchers.any(FragmentActionResult.class))); }
Source:
<code><START> @Test public void queryParamsSkippedIfConvertedToNull() throws IOException, InterruptedException { <END> class Example { @POST("/query") Call<String> queryPath(@Query("a") Object a) { return null; } } Retrofit.Builder retrofitBuilder = new Retrofit.Builder() .baseUrl("<LINK_0>") .addConverterFactory(new NullObjectConverterFactory()); Request request = buildRequest(Example.class, retrofitBuilder, "Ignored"); if(request.url().toString().contains("Ignored")){ fail(); } }</code><technical_language>throws Exception save fingers some typing. :)</technical_language>

Target:
@Test public void queryParamsSkippedIfConvertedToNull() throws IOException, InterruptedException { class Example { @POST("/query") Call<String> queryPath(@Query("a") Object a) { return null; } } Retrofit.Builder retrofitBuilder = new Retrofit.Builder() .baseUrl("<LINK_0>") .addConverterFactory(new NullObjectConverterFactory()); Request request = buildRequest(Example.class, retrofitBuilder, "Ignored"); assertThat(request.url().toString()).doesNotContain("Ignored"); }
Source:
<code><START> public UserPrivate getUserPrivate() <END> { CryptoSession.getCurrent().setInitializationVector(initializationVector); return userPrivate; }</code><technical_language>do this for? Currently, User hides existence of UserPrivate</technical_language>

Target:
private UserPrivate getUserPrivate() { CryptoSession.getCurrent().setInitializationVector(initializationVector); return userPrivate; }
Source:
<code><START> private Object getElementForView(ViewGroup parentView, View view) { <END> if (view == null) { return null; } Object element = mViewToElementMap.get(view); if (element != null) { if (view.getParent() == parentView) { return element; } mViewToElementMap.remove(view); } Object fragment = FragmentCompatUtil.findFragmentForView(view); if (fragment != null) { mViewToElementMap.put(view, fragment); return fragment; } else { mViewToElementMap.put(view, view); return view; } }</code><technical_language>@Nullable actually, allow null here</technical_language>

Target:
private Object getElementForView(ViewGroup parentView, View view) { Object element = mViewToElementMap.get(view); if (element != null) { if (view.getParent() == parentView) { return element; } mViewToElementMap.remove(view); } Object fragment = FragmentCompatUtil.findFragmentForView(view); if (fragment != null) { mViewToElementMap.put(view, fragment); return fragment; } else { mViewToElementMap.put(view, view); return view; } }
Source:
<code>public static synchronized UserContainer getInstance() { if (container != null && <START> initialized == false) { <END> List<User> users = Collections.emptyList(); UserService userService = UserServices.getUserService(); if (userService != null) { users = userService.getUsers(); } container.addContainerProperty(User.PROPERTY_FIRSTNAME, String.class, null); container.addContainerProperty(User.PROPERTY_LASTNAME, String.class, null); container.addContainerProperty(User.PROPERTY_EMAIL, String.class, null); container.addContainerProperty(User.PROPERTY_DISPLAY_NAME, String.class, null); container.addContainerProperty(PROPERTY_USER, User.class, null); for (User user : users) { container.addItem(user); } initialized = true; } return container; }</code><technical_language>!initialized</technical_language>

Target:
public static synchronized IndexedUserContainer getInstance() { return container; }
Source:
<code>public void disconnected(SchedulerDriver driver) { <START> getMainThreadExecutor().executeWithoutFencing(() -> MesosResourceManagerDriver.this.disconnected(new Disconnected())); <END> }</code><technical_language>I fully understand this message needs executed fencing. If I mistaken, do stop supporting actors scheduler if MesosResourceManagerDriver loses leadership. Moreover, gaining leadership create new actors a SchedulerDriver</technical_language>

Target:
public void disconnected(SchedulerDriver driver) { getMainThreadExecutor().execute(() -> MesosResourceManagerDriver.this.disconnected(new Disconnected())); }
Source:
<code><START> ReleasedMessage(int id, String name) { <END> assert name != null; this.name = name; cacheId(id); }</code><technical_language>public</technical_language>

Target:
private ReleasedMessage(int id, String name) { assert name != null; this.name = name; cacheId(id); }
Source:
<code>public void resendPhoneVerificationNoStudy() throws Exception { mockPlayContextWithJson(new Identifier((StudyIdentifier) null, TestConstants.PHONE)); controller.resendPhoneVerification(); <START> } <END></code><technical_language>currently tests verifyPhone(). tests verifyPhone()</technical_language>

Target:
public void resendPhoneVerificationNoStudy() throws Exception { String json = TestUtils.createJson("{'phone':{'number':'4082588569','regionCode':'US'}}"); mockPlayContextWithJson(json); controller.resendPhoneVerification(); }
Source:
<code><START> public void setId(String id) { <END> this.id = id; }</code><technical_language>setters public</technical_language>

Target:
void setId(String id) { this.id = id; }
Source:
<code>public void configure(Binder binder) { JsonConfigProvider.bind(binder, "druid.publish", SegmentPublisherProvider.class); <START> JsonConfigProvider.bind(binder, "druid.db.tables", DbSegmentPublisherConfig.class); <END> binder.bind(SegmentPublisher.class).toProvider(SegmentPublisherProvider.class); JsonConfigProvider.bind(binder, "druid.realtime", RealtimeManagerConfig.class); binder.bind(RealtimeManager.class).toProvider(RealtimeManagerProvider.class).in(ManageLifecycle.class); }</code><technical_language>DbSegmentPublisherConfig appears Config stuff. Also, "druid.db.tables" is property of tables set it. If this config is largely providing table names, DbSegmentPublisher shoudl changed depend DbTablesConfig instead of duplicating load</technical_language>

Target:
public void configure(Binder binder) { JsonConfigProvider.bind(binder, "druid.publish", SegmentPublisherProvider.class); binder.bind(SegmentPublisher.class).toProvider(SegmentPublisherProvider.class); JsonConfigProvider.bind(binder, "druid.realtime", RealtimeManagerConfig.class); binder.bind( new TypeLiteral<List<FireDepartment>>() { } ).toProvider(FireDepartmentsProvider.class); binder.bind(RealtimeManager.class).in(ManageLifecycle.class); }
Source:
<code>public final boolean eq( Object other ) { if ( other == null ) { return false; } if ( other instanceof SequenceValue ) { return this.equals( (SequenceValue) other ); } <START> return other instanceof Value && equals( (Value) other ); <END> }</code><technical_language>ArrayValue equal is another array instance of SequenceValue? I assume this row returns false</technical_language>

Target:
public final boolean eq( Object other ) { if ( other == null ) { return false; } return other instanceof SequenceValue && this.equals( (SequenceValue) other ); }
Source:
<code>public List<String> getAllTagStrings(User user, String query) { List<String> allString = new ArrayList<>(); for (Tag each : getAllTags(user, query)) { allString.add(each.getTagValue()); <START> } <END> Collections.sort(allString); return allString; }</code><technical_language>stream here</technical_language>

Target:
public List<String> getAllTagStrings(User user, String query) { return getAllTags(user, query).stream() .map(Tag::getTagValue) .sorted() .collect(toList()); }
Source:
<code>public Future<RecordMetadata> send(ProducerRecord<K, V> record, Callback callback) { Span span = tracing.tracer().nextSpan(); span.tag(KAFKA_TOPIC_TAG, record.topic()); <START> span.tag(KAFKA_KEY_TAG, record.key().toString()); <END> injector.inject(span.context(), record.headers()); Future<RecordMetadata> recordMetadataFuture = wrappedProducer.send(record, callback); span.kind(Kind.CLIENT).start().flush(); return recordMetadataFuture; }</code><technical_language>key null? start topic? get input others key</technical_language>

Target:
public Future<RecordMetadata> send(ProducerRecord<K, V> record, Callback callback) { Span span = tracing.tracer().nextSpan(); span.tag(KAFKA_TOPIC_TAG, record.topic()); injector.inject(span.context(), record.headers()); Future<RecordMetadata> recordMetadataFuture = wrappedProducer.send(record, callback); span.kind(Kind.CLIENT).start().flush(); return recordMetadataFuture; }
Source:
<code>private Tuple2<Integer, Integer> readLength(MemorySegment segment, int segmentPosition, int segmentRemaining) throws IOException { int numBytes = min(lengthBuffer.remaining(), segmentRemaining); segment.get(segmentPosition, lengthBuffer, numBytes); if (lengthBuffer.hasRemaining()) { <START> return POSITION_AND_SIZE_IF_LENGTH_NOT_FULLY_READ; <END> } else { updateLength(lengthBuffer.getInt(0)); return Tuple2.of(segmentPosition + numBytes, segmentRemaining - numBytes); } }</code><technical_language>is a constant? anywhere. of is workaround problem of unnamed fields of Tuple2</technical_language>

Target:
private int readLength(MemorySegment segment, int segmentPosition, int segmentRemaining) throws IOException { int bytesToRead = min(lengthBuffer.remaining(), segmentRemaining); segment.get(segmentPosition, lengthBuffer, bytesToRead); if (!lengthBuffer.hasRemaining()) { updateLength(lengthBuffer.getInt(0)); } return bytesToRead; }