auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public boolean isSymmetric() { if (numRows() == numCols()) { int size = numRows(); for (int i = 0; i < size; i++) { for (int j = i + 1; j < size; j++) { double ratio = elementAt(i, j) / elementAt(j, i); <START> if (Math.abs(ratio - 1) > 1e-6) { <END> return false; } } } } return false; }</code><technical_language>a static final</technical_language>

Target:
public boolean isSymmetric() { if (numRows() == numCols()) { int size = numRows(); for (int i = 0; i < size; i++) { for (int j = i + 1; j < size; j++) { double ratio = elementAt(i, j) / elementAt(j, i); if (Util.closeToZero(ratio - 1)) { return false; } } } } return true; }
Source:
<code>public CustomEvent(CustomTraceDefinition definition, ITmfTrace parentTrace, ITmfTimestamp timestamp, String source, TmfEventType type, String reference) { <START> super(parentTrace, timestamp, source, type, null, reference); <END> fDefinition = definition; fData = new HashMap<String, String>(); }</code><technical_language>I need store relevant parameters in new custom fields, remove constructor (pass null super) solely rely setters. pass null super of option chosen, used..</technical_language>

Target:
public CustomEvent(CustomTraceDefinition definition, ITmfTrace parentTrace, ITmfTimestamp timestamp, String source, TmfEventType type, String reference) { super(parentTrace, null, source, null, null, reference); fDefinition = definition; fData = new HashMap<String, String>(); customEventTimestamp = timestamp; customEventContent = null; customEventType = type; }
Source:
<code>public FluentIterable<ScalingPolicyResponse> apply(HttpResponse from) { Map<String, List<Map<String, Object>>> singleMap = (Map<String, List<Map<String, Object>>>) json.apply(from); List<Map<String, Object>> result = singleMap.get("policies"); List<ScalingPolicyResponse> scalingPoliciesList = Lists.newArrayList(); for(Map<String, Object> scalingPolicyMap : result) { ScalingPolicyTargetType targetType = null; for(String key : scalingPolicyMap.keySet()) { if(ScalingPolicyTargetType.getByValue(key).isPresent()) { targetType = ScalingPolicyTargetType.getByValue(key).get(); break; } } List<Link> links = Lists.newArrayList(); for(Map<String, String> linkMap : (List<Map<String, String>>) scalingPolicyMap.get("links")) { Link link = Link.builder().href(URI.create(linkMap.get("href"))).relation(Relation.fromValue(linkMap.get("rel"))).build(); links.add(link); } Double d = (Double)scalingPolicyMap.get(targetType.toString()); ScalingPolicyResponse scalingPolicyResponse = new ScalingPolicyResponse( (String)scalingPolicyMap.get("name"), ScalingPolicyType.getByValue((String)scalingPolicyMap.get("type")).get(), ((Double)scalingPolicyMap.get("cooldown")).intValue(), Math.floor(d) == d ? Integer.toString(d.intValue()) : Double.toString(d), targetType, ImmutableList.copyOf(links), (String) scalingPolicyMap.get("id") ); <START> scalingPoliciesList.add(scalingPolicyResponse); <END> } return FluentIterable.from(scalingPoliciesList); }</code><technical_language>Ouch! Is get JSON do some of this parsing for us, i.e. domain representation more directly</technical_language>

Target:
public FluentIterable<ScalingPolicyResponse> apply(HttpResponse from) { Map<String, List<Map<String, Object>>> singleMap = (Map<String, List<Map<String, Object>>>) json.apply(from); List<Map<String, Object>> result = singleMap.get("policies"); ImmutableList.Builder<ScalingPolicyResponse> scalingPoliciesList = ImmutableList.builder(); for(Map<String, Object> scalingPolicyMap : result) { ScalingPolicyTargetType targetType = null; for(String key : scalingPolicyMap.keySet()) { if(ScalingPolicyTargetType.getByValue(key).isPresent()) { targetType = ScalingPolicyTargetType.getByValue(key).get(); break; } } ImmutableList.Builder<Link> links = ImmutableList.builder(); for(Map<String, String> linkMap : (List<Map<String, String>>) scalingPolicyMap.get("links")) { Link link = Link.builder().href(URI.create(linkMap.get("href"))).relation(Relation.fromValue(linkMap.get("rel"))).build(); links.add(link); } Double d = (Double)scalingPolicyMap.get(targetType.toString()); ScalingPolicyResponse scalingPolicyResponse = new ScalingPolicyResponse( (String)scalingPolicyMap.get("name"), ScalingPolicyType.getByValue((String)scalingPolicyMap.get("type")).get(), ((Double)scalingPolicyMap.get("cooldown")).intValue(), DoubleMath.isMathematicalInteger(d) ? Integer.toString(d.intValue()) : Double.toString(d), targetType, ImmutableList.copyOf(links.build()), (String) scalingPolicyMap.get("id") ); scalingPoliciesList.add(scalingPolicyResponse); } return FluentIterable.from(scalingPoliciesList.build()); }
Source:
<code>public Map<RGB, Integer> getHistogram() { Map<RGB, Integer> colors = new HashMap<>(); for (int pixel : fPixels) { RGB pixelColor = getRgbFromRGBPixel(pixel); Integer pixelCount = colors.get(pixelColor); <START> Integer val = pixelCount == null ? 1 : Integer.valueOf(pixelCount.intValue() + 1); <END> colors.put(pixelColor, val); } return colors; }</code><technical_language>I do: pixelCount = pixelCount == null ? 1 : pixelCount++;</technical_language>

Target:
public Multiset<RGB> getHistogram() { Multiset<RGB> colors = HashMultiset.create(); for (int pixel : fPixels) { RGB pixelColor = getRgbFromRGBPixel(pixel); colors.add(pixelColor); } return colors; }
Source:
<code>public RecentChangeResponse fetchRecentChanges(Date nextStartTime, Continue lastContinue, int batchSize) throws RetryableException { URI uri = uris.recentChanges(nextStartTime, lastContinue, batchSize); log.debug("Polling for changes from {}", uri); try { return checkApi(getJson(new HttpGet(uri), RecentChangeResponse.class)); } catch (UnknownHostException | SocketException e) { throw new RuntimeException(e); <START> } catch (IOException e) { <END> throw new RetryableException("Error fetching recent changes", e); } }</code><technical_language>catch JsonParseException JsonMappingException upstream? do in RdfRepository.java. Ideally throw out bad batch (and log it) updater fail of it</technical_language>

Target:
public RecentChangeResponse fetchRecentChanges(Date nextStartTime, Continue lastContinue, int batchSize) throws RetryableException { URI uri = uris.recentChanges(nextStartTime, lastContinue, batchSize); log.debug("Polling for changes from {}", uri); try { return checkApi(getJson(new HttpGet(uri), RecentChangeResponse.class)); } catch (UnknownHostException | SocketException e) { throw new RuntimeException(e); } catch (JsonParseException | JsonMappingException e) { throw new RuntimeException(e); } catch (IOException e) { throw new RetryableException("Error fetching recent changes", e); } }
Source:
<code>public Brew(int color, int cost, EffectInstance... effects) { this.color = () -> color; this.cost = cost; <START> this.effects = () -> ImmutableList.copyOf(effects); <END> }</code><technical_language>list return in lambda instead of creating a new copy call lambda</technical_language>

Target:
public Brew(int color, int cost, EffectInstance... effects) { this.color = () -> color; this.cost = cost; List<EffectInstance> savedEffects = ImmutableList.copyOf(effects); this.effects = () -> savedEffects; }
Source:
<code>public static void updateName(final UserProfile profile) { <START> final Site site = profile.getPerson().getHomepage(); <END> if (site != null) { site.setName(new LocalizedString(I18N.getLocale(), profile.getDisplayName())); } }</code><technical_language>reference bellow, a UserProfile a reference a Person, getPerson method return null, lead a new NPE. <LINK_0></technical_language>

Target:
public static void updateName(final UserProfile profile) { final Person person = profile.getPerson(); if (person != null) { final Site site = person.getHomepage(); if (site != null) { site.setName(new LocalizedString(I18N.getLocale(), profile.getDisplayName())); } } }
Source:
<code>public DenseLocalDateDoubleTimeSeries filter(ObjDoublePredicate<LocalDate> predicate) { DoubleStream filtered = IntStream.range(0, points.length) .mapToDouble(i -> isValidPoint(points[i]) && predicate.test(dateCalculation.calculateDateFromPosition(startDate, i), points[i]) ? <START> points[i] : Double.NaN); <END> return DenseLocalDateDoubleTimeSeries.of(startDate, filtered, dateCalculation); }</code><technical_language>Wrapping this hard understand. a helper method method reference</technical_language>

Target:
public LocalDateDoubleTimeSeries filter(ObjDoublePredicate<LocalDate> predicate) { Stream<LocalDateDoublePoint> filteredPoints = stream().filter(pt -> predicate.test(pt.getDate(), pt.getValue())); return new LocalDateDoubleTimeSeriesBuilder(filteredPoints).build(); }
Source:
<code>public void onNext(T t) { List<T> b = buffer; if (b == null) { <START> b = new ArrayList<T>(); <END> buffer = b; } b.add(t); if (b.size() == count) { buffer = null; actual.onNext(b); } }</code><technical_language>want give count capacity hint</technical_language>

Target:
public void onNext(T t) { List<T> b = buffer; if (b == null) { b = new ArrayList<T>(count); buffer = b; } b.add(t); if (b.size() == count) { buffer = null; actual.onNext(b); } }
Source:
<code>public int hashCode() { <START> return ingestionSpec.hashCode(); <END> }</code><technical_language>regenerate equals hashcode add maxSplitSize</technical_language>

Target:
public int hashCode() { int result = ingestionSpec.hashCode(); result = 31 * result + (int) (maxSplitSize ^ (maxSplitSize >>> 32)); result = 31 * result + (segments != null ? segments.hashCode() : 0); return result; }
Source:
<code>public Filter deserialize (JsonParser parser, DeserializationContext context) throws IOException, JsonProcessingException { ObjectMapper mapper = (ObjectMapper) parser.getCodec(); ObjectNode root = mapper.readTree(parser); Class<? extends Filter> filterClass = null; List<String> invalidAttributes = new ArrayList<>(); for (String fieldName: ImmutableList.copyOf(root.fieldNames())) { switch(fieldName) { case LinkAttributeFilter.LINK_ATTRIBUTE: if (null != filterClass) { throw new JsonParseException(parser, PARSE_ERROR_MESSAGE_AMBIGUOUS_FILTER, parser.getCurrentLocation()); } filterClass = LinkAttributeFilter.class; break; case LinkNameFilter.LINK_NAME: if (null != filterClass && !filterClass.equals(LinkNameFilter.class)) { throw new JsonParseException(parser, PARSE_ERROR_MESSAGE_AMBIGUOUS_FILTER, parser.getCurrentLocation()); } filterClass = LinkNameFilter.class; <START> break; <END> case LinkNameFilter.LINK_URL: if (null != filterClass && !filterClass.equals(LinkNameFilter.class)) { throw new JsonParseException(parser, PARSE_ERROR_MESSAGE_AMBIGUOUS_FILTER, parser.getCurrentLocation()); } filterClass = LinkNameFilter.class; break; case Filter.VISIBLE: break; default: invalidAttributes.add(fieldName); } } if (!invalidAttributes.isEmpty()) { throw new JsonParseException(parser, PARSE_ERROR_MESSAGE_INVALID_JSON_TAG + invalidAttributes, parser.getCurrentLocation()); } if (null == filterClass) { filterClass = AcceptAllFilter.class; } return mapper.readValue(root.traverse(), filterClass); }</code><technical_language>LINK_NAME LINK_URL identical branches. please add labels branch instead of duplicating code</technical_language>

Target:
public Filter deserialize (JsonParser parser, DeserializationContext context) throws IOException, JsonProcessingException { ObjectMapper mapper = (ObjectMapper) parser.getCodec(); ObjectNode root = mapper.readTree(parser); Class<? extends Filter> filterClass = null; List<String> invalidAttributes = new ArrayList<>(); for (String fieldName: ImmutableList.copyOf(root.fieldNames())) { switch(fieldName) { case LinkAttributeFilter.LINK_ATTRIBUTE: if (null != filterClass) { throw new JsonParseException(parser, PARSE_ERROR_MESSAGE_AMBIGUOUS_FILTER, parser.getCurrentLocation()); } filterClass = LinkAttributeFilter.class; break; case LinkNameFilter.LINK_NAME: case LinkNameFilter.LINK_URL: if (null != filterClass && !filterClass.equals(LinkNameFilter.class)) { throw new JsonParseException(parser, PARSE_ERROR_MESSAGE_AMBIGUOUS_FILTER, parser.getCurrentLocation()); } filterClass = LinkNameFilter.class; break; case Filter.VISIBLE: break; default: invalidAttributes.add(fieldName); } } if (!invalidAttributes.isEmpty()) { throw new JsonParseException(parser, PARSE_ERROR_MESSAGE_INVALID_JSON_TAG + invalidAttributes, parser.getCurrentLocation()); } if (null == filterClass) { filterClass = AcceptAllFilter.class; } return mapper.readValue(root.traverse(), filterClass); }
Source:
<code>protected void collectParameters(Consumer<Parameter<?, ?>> parameterCollector) { <START> parameterCollector.accept(requireValidFile); <END> super.collectParameters(parameterCollector); }</code><technical_language>add if getXsdResourcePath() != null</technical_language>

Target:
protected void collectParameters(Consumer<Parameter<?, ?>> parameterCollector) { if (getXsdResourcePath() != null) { parameterCollector.accept(requireValidFile); } super.collectParameters(parameterCollector); }
Source:
<code>public float getRailMaxSpeed(World world, EntityMinecart cart, BlockPos pos) { TileEntity tile = WorldPlugin.getBlockTile(world, pos); if (tile instanceof TileTrackOutfitted) <START> return ((TileTrackOutfitted) tile).getTrackKitInstance().getRailMaxSpeed(world, cart, pos, ((TileTrackOutfitted) tile).getTrackType()); <END> return 0.4f; }</code><technical_language>TrackType parameter needed</technical_language>

Target:
public float getRailMaxSpeed(World world, EntityMinecart cart, BlockPos pos) { TileEntity tile = WorldPlugin.getBlockTile(world, pos); if (tile instanceof TileTrackOutfitted) return ((TileTrackOutfitted) tile).getTrackKitInstance().getRailMaxSpeed(world, cart, pos); return 0.4f; }
Source:
<code>public Collection<Field> getFields() { <START> return fields.values(); <END> }</code><technical_language>This return immutable collection</technical_language>

Target:
public Map<String, Field> getFields() { return fields; }
Source:
<code>protected void doExecute() { for (Stereotype stereotype : stereotypes) { element.unapplyStereotype(stereotype); <START> element.eNotify(new NotificationImpl(Notification.SET, true, true, true)); <END> } }</code><technical_language>checkif remove is a notification service for stereotype</technical_language>

Target:
protected void doExecute() { for (Stereotype stereotype : stereotypes) { element.unapplyStereotype(stereotype); } }
Source:
<code>public static List<String> unwrapJsonishListIfPossible(String input) { try { return unwrapOptionallyQuotedJavaStringList(input); } catch (Exception e) { <START> return MutableList.of(input); <END> } }</code><technical_language>Exceptions.propagateIfFatal() stricter exception catching here</technical_language>

Target:
public static List<String> unwrapJsonishListIfPossible(String input) { try { return unwrapOptionallyQuotedJavaStringList(input); } catch (Exception e) { Exceptions.propagateIfFatal(e); if (e instanceof IllegalArgumentException) { if (log.isDebugEnabled()) log.debug("Unable to parse JSON list '"+input+"' ("+e+"); treating as single-element string list"); } else { log.warn("Unable to parse JSON list '"+input+"' ("+e+"); treating as single-element string list", e); } return MutableList.of(input); } }
Source:
<code>public void setEndTime(LocalDateTime endTime) { this.endTime = endTime; <START> if (dayActivity != null) <END> { dayActivity.resetAggregatesComputed(); } }</code><technical_language>this null</technical_language>

Target:
public void setEndTime(LocalDateTime endTime) { this.endTime = endTime; dayActivity.resetAggregatesComputed(); }
Source:
<code>public void testLockedStream() throws Throwable { for (int i = 0; i < 10; i++) { cache.put(i, "value" + i); } CyclicBarrier barrier = new CyclicBarrier(2); int key = 4; LockedStream<Object, Object> stream = cache.getAdvancedCache().lockedStream(); Future<?> forEachFuture = fork(() -> stream.forEach((c, e) -> { if (e.getKey().equals(key)) { try { barrier.await(10, TimeUnit.SECONDS); assertEquals("value" + key, c.put(e.getKey(), String.valueOf(e.getValue() + "-other"))); barrier.await(10, TimeUnit.SECONDS); } catch (InterruptedException | BrokenBarrierException | TimeoutException e1) { throw new RuntimeException(e1); } } })); barrier.await(10, TimeUnit.SECONDS); Future<Object> putFuture = fork(() -> cache.put(key, "value" + key + "-new")); try { <START> putFuture.get(50, TimeUnit.MILLISECONDS); <END> fail("Test should have thrown TimeoutException"); } catch (TimeoutException e) { } barrier.await(10, TimeUnit.SECONDS); forEachFuture.get(10, TimeUnit.SECONDS); assertEquals("value" + key + "-other", putFuture.get(10, TimeUnit.SECONDS)); assertEquals("value" + key + "-new", cache.get(key)); LockManager lockManager = cache.getAdvancedCache().getComponentRegistry().getComponent(LockManager.class); assertEquals(0, lockManager.getNumberOfLocksHeld()); }</code><technical_language>OK, failing timeout flakiness. expectException anyway, please</technical_language>

Target:
public void testLockedStream() throws Throwable { assertLockStream((c, e) -> assertEquals("value" + e.getKey(), c.put(e.getKey(), String.valueOf(e.getValue() + "-other")))); }
Source:
<code>private void readPushOptions() throws IOException { String pushOption = pckIn.readString(); while (pushOption != null) { <START> pushOptions.add(pushOption); <END> } }</code><technical_language>read next line pushOption = pckIn.readString(); stuck in infinite loop</technical_language>

Target:
private void readPushOptions() throws IOException { String pushOption = pckIn.readString(); while (pushOption != null) { pushOptions.add(pushOption); pushOption = pckIn.readString(); } }
Source:
<code>private static void setClientCallOptions(Configuration configuration, BigtableOptions.Builder bigtableOptionsBuilder) { CallOptionsConfig.Builder clientCallOptionsBuilder = new CallOptionsConfig.Builder(); clientCallOptionsBuilder .setUseTimeout(configuration.getBoolean(BIGTABLE_USE_TIMEOUTS_KEY, USE_TIMEOUT_DEFAULT)); <START> clientCallOptionsBuilder.setShortRpcTimeoutMs( <END> configuration.getInt(BIGTABLE_RPC_TIMEOUT_MS_KEY, SHORT_TIMEOUT_MS_DEFAULT)); clientCallOptionsBuilder.setLongRpcTimeoutMs( configuration.getInt(BIGTABLE_LONG_RPC_TIMEOUT_MS_KEY, LONG_TIMEOUT_MS_DEFAULT)); bigtableOptionsBuilder.setCallOptionsConfig(clientCallOptionsBuilder.build()); }</code><technical_language>please separate out BigtableOptionsFactory.java changes a PR</technical_language>

Target:
private static void setClientCallOptions(Configuration configuration, BigtableOptions.Builder bigtableOptionsBuilder) { CallOptionsConfig.Builder clientCallOptionsBuilder = new CallOptionsConfig.Builder(); clientCallOptionsBuilder .setUseTimeout(configuration.getBoolean(BIGTABLE_USE_TIMEOUTS_KEY, USE_TIMEOUT_DEFAULT)); if (configuration.get(BIGTABLE_RPC_TIMEOUT_MS_KEY) != null) { clientCallOptionsBuilder.setShortRpcTimeoutMs( configuration.getInt(BIGTABLE_RPC_TIMEOUT_MS_KEY, SHORT_TIMEOUT_MS_DEFAULT)); } else { clientCallOptionsBuilder.setShortRpcTimeoutMs( configuration.getInt(HConstants.HBASE_CLIENT_OPERATION_TIMEOUT, SHORT_TIMEOUT_MS_DEFAULT)); } if (configuration.get(BIGTABLE_LONG_RPC_TIMEOUT_MS_KEY) != null) { clientCallOptionsBuilder.setLongRpcTimeoutMs( configuration.getInt(BIGTABLE_LONG_RPC_TIMEOUT_MS_KEY, LONG_TIMEOUT_MS_DEFAULT)); } else { clientCallOptionsBuilder.setLongRpcTimeoutMs(configuration .getInt(HConstants.HBASE_CLIENT_SCANNER_TIMEOUT_PERIOD, LONG_TIMEOUT_MS_DEFAULT)); } bigtableOptionsBuilder.setCallOptionsConfig(clientCallOptionsBuilder.build()); }
Source:
<code>public boolean isStale(GerritConfig cfg) { return lastUpdated > cfg.getCreationTime() <START> || (refreshConfig && site.gerrit_config.lastModified() > cfg.getCreationTime()); <END> }</code><technical_language>wrap this line</technical_language>

Target:
public boolean isStale(GerritConfig cfg) { return refreshConfig && site.gerrit_config.lastModified() > cfg.getCreationTime(); }
Source:
<code>public int open() { <START> setTitle("Rename representation"); <END> text.setText(oldName); text.selectAll(); final Button okButton = getButton(IDialogConstants.OK_ID); status = new Status(IStatus.OK, SiriusTransPlugin.PLUGIN_ID, IStatus.OK, "", null); updateStatus(status); okButton.setEnabled(false); return super.open(); }</code><technical_language>This call modified too. prevent users modify title, moved "set default title" else where</technical_language>

Target:
public int open() { textChanged(newName); text.selectAll(); return super.open(); }
Source:
<code>public void testChronologizeWithStartTimestampAndEndTimestampAfterAnyValuesChangeInKeyInRecord() { long record = Variables.register("record", client.create()); String key = Variables.register("key", TestData.getString()); int testSize = Variables.register("testSize", 5); Set<Object> initValues = Variables.register("initValues", Sets.newHashSet()); for (int i = 0; i < testSize; i++) { Object value = null; while (value == null || initValues.contains(value)) { value = TestData.getObject(); } initValues.add(value); client.add(key, value, record); } Timestamp startTimestamp = Variables.register("startTimestamp", Timestamp.now()); <START> for (int i = 0; i < 100000000; i++); <END> for (int i = 0; i < testSize; i++) { Object value = null; while (value == null || initValues.contains(value)) { value = TestData.getObject(); } initValues.add(value); client.add(key, value, record); } Timestamp endTimestamp = Variables.register("endTimestamp", Timestamp.now()); for (int i = 0; i < 100000000; i++); for (int i = 0; i < testSize; i++) { Object value = null; while (value == null || initValues.contains(value)) { value = TestData.getObject(); } initValues.add(value); client.add(key, value, record); } Map<Timestamp, Set<Object>> result = client.chronologize( key, record, startTimestamp, endTimestamp); Set<Object> lastResultSet = Iterables.getLast( result.values()); assertEquals(testSize+1, result.size()); assertEquals(testSize*2, lastResultSet.size()); }</code><technical_language>StandardActions.wait(int, TimeUnit) introduce a delay in tests</technical_language>

Target:
public void testChronologizeWithStartTimestampAndEndTimestampAfterAnyValuesChangeInKeyInRecord() { long record = Variables.register("record", client.create()); String key = Variables.register("key", TestData.getString()); int testSize = Variables.register("testSize", 5); Set<Object> initValues = Variables.register("initValues", Sets.newHashSet()); for (int i = 0; i < testSize; i++) { Object value = null; while (value == null || initValues.contains(value)) { value = TestData.getObject(); } initValues.add(value); client.add(key, value, record); } Timestamp startTimestamp = Variables.register("startTimestamp", Timestamp.now()); StandardActions.wait(200, TimeUnit.MILLISECONDS); for (int i = 0; i < testSize; i++) { Object value = null; while (value == null || initValues.contains(value)) { value = TestData.getObject(); } initValues.add(value); client.add(key, value, record); } Timestamp endTimestamp = Variables.register("endTimestamp", Timestamp.now()); StandardActions.wait(200, TimeUnit.MILLISECONDS); for (int i = 0; i < testSize; i++) { Object value = null; while (value == null || initValues.contains(value)) { value = TestData.getObject(); } initValues.add(value); client.add(key, value, record); } Map<Timestamp, Set<Object>> result = client.chronologize(key, record, startTimestamp, endTimestamp); Set<Object> lastResultSet = Iterables.getLast(result.values()); assertEquals(testSize + 1, result.size()); assertEquals(testSize * 2, lastResultSet.size()); }
Source:
<code>public String verifyCaptureSubmittedEvent() throws JsonProcessingException { ChargeEntity charge = ChargeEntityFixture.aValidChargeEntity() .withTransactionId("gateway_transaction_id") .withCorporateSurcharge(55L) .withCardDetails(anAuthCardDetails().getCardDetailsEntity()) .build(); CaptureSubmitted captureSubmittedEvent = new CaptureSubmitted( resourceId, <START> PaymentDetailsEnteredEventDetails.from(charge), <END> ZonedDateTime.now() ); return captureSubmittedEvent.toJsonString(); }</code><technical_language>PaymentDetailsEnteredEventDetails is</technical_language>

Target:
public String verifyCaptureSubmittedEvent() throws JsonProcessingException { ChargeEventEntity chargeEventEntity = ChargeEventEntityFixture .aValidChargeEventEntity() .withGatewayEventDate(ZonedDateTime.now()) .build(); CaptureSubmitted captureSubmittedEvent = new CaptureSubmitted( resourceId, CaptureSubmittedEventDetails.from(chargeEventEntity), ZonedDateTime.now() ); return captureSubmittedEvent.toJsonString(); }
Source:
<code>public <T> String urlFor(final Class<T> type, final Method method, Object... params) { final Class<?> rawtype = proxifier.isProxyType(type) ? type.getSuperclass() : type; final Invocation invocation = new Invocation(rawtype, method); Route route = cache.fetch(invocation, new Callable<Route>() { @Override public Route call() throws Exception { Collection<Route> matches = Collections2.filter(routes, canHandle(rawtype, method)); logger.debug("Routes matched for is {}", method, matches); return Iterables.getFirst(matches, NULL); } }); logger.debug("Selected route for is {}", method, route); <START> if (route == null || route.equals(NULL)) { <END> throw new RouteNotFoundException("The selected route is invalid for redirection: " + rawtype.getName() + "." + method.getName()); } String url = route.urlFor(type, method, params); logger.debug("Returning URL for {}", url, route); return url; }</code><technical_language>is a benefit equals here, instead of instanceOf</technical_language>

Target:
public <T> String urlFor(final Class<T> type, final Method method, Object... params) { final Class<?> rawtype = proxifier.isProxyType(type) ? type.getSuperclass() : type; final Invocation invocation = new Invocation(rawtype, method); Route route = cache.fetch(invocation, new Callable<Route>() { @Override public Route call() throws Exception { Collection<Route> matches = Collections2.filter(routes, canHandle(rawtype, method)); logger.debug("Routes matched for is {}", method, matches); return Iterables.getFirst(matches, NULL); } }); logger.debug("Selected route for is {}", method, route); if (route == NULL) { throw new RouteNotFoundException("The selected route is invalid for redirection: " + rawtype.getName() + "." + method.getName()); } String url = route.urlFor(type, method, params); logger.debug("Returning URL for {}", url, route); return url; }
Source:
<code><START> public String getXPathNodeName() { <END> return toString(); }</code><technical_language>this method log WARNING people override this method. new PMDVersion.getNextMajor() people do 7.0.0 is out. flag this method for removal release</technical_language>

Target:
public String getXPathNodeName() { LOG.warning("getXPathNodeName should be overriden in classes derived from AbstractNode. " + "The implementation is provided for compatibility with existing implementors," + "but could be declared abstract as soon as release " + PMDVersion.getNextMajorRelease() + "."); return toString(); }
Source:
<code>public boolean remove(Runnable task) { Future<?> future = futures.get(task); if (future != null && future.cancel(false)) { <START> running.remove(future); <END> } futures.remove(task); return super.remove(task); }</code><technical_language>I be: java @Override public boolean remove(Runnable task) { Future<?> future = futures.get(task); if (future != null && future.cancel(false)) { futures.remove(future); } running.remove(task); return super.remove(task); } running holds Runnables</technical_language>

Target:
public boolean remove(Runnable task) { Future<?> future = futures.get(task); if (future != null && future.cancel(false)) { running.remove(future); } futures.remove(task); return super.remove((Runnable) future); }
Source:
<code>public double get(double q) { rotate(); CKMSQuantiles currentBucket; do { currentBucket = buckets.peek(); <START> } while (currentBucket == null); <END> return currentBucket.get(q); }</code><technical_language>fine suspend thread busy waiting Thread.yield()</technical_language>

Target:
public double get(double q) { return getCurrentBucket().get(q); }
Source:
<code>private Jep createJEPInstance() { JepConfig config = new JepConfig(); Jep jep = null; boolean success = false; try { File delftPath = new File(GrobidProperties.getInstance().getDeLFTFilePath()); if (!delftPath.exists()) { throw new GrobidResourceException("DeLFT installation path does not exist"); } if (!delftPath.isDirectory()) { throw new GrobidResourceException("DeLFT installation path is not a directory"); } config.addIncludePaths(delftPath.getAbsolutePath()); config.setClassLoader(Thread.currentThread().getContextClassLoader()); jep = new Jep(config); jepInstances.put(Thread.currentThread().getId(), jep); jep.eval("import os"); <START> jep.eval("import numpy as np"); <END> jep.eval("import keras.backend as K"); jep.eval("os.chdir('" + delftPath.getAbsolutePath() + "')"); jep.eval("from delft.utilities.Embeddings import Embeddings"); jep.eval("import delft.sequenceLabelling"); jep.eval("from delft.sequenceLabelling import Sequence"); jep.eval("from delft.sequenceLabelling.reader import load_data_and_labels_crf_file"); jep.eval("from delft.sequenceLabelling.reader import load_data_crf_string"); jep.eval("from sklearn.model_selection import train_test_split"); success = true; return jep; } catch(JepException e) { LOGGER.error("JEP initialization failed", e); throw new RuntimeException("JEP initialization failed", e); } catch(GrobidResourceException e) { LOGGER.error("DeLFT installation path invalid, JEP initialization failed", e); throw new RuntimeException("DeLFT installation path invalid, JEP initialization failed", e); } finally { if (!success) { try { jep.close(); } catch (JepException e) { LOGGER.error("failed to close JEP instance", e); } } } }</code><technical_language>yes, I reviewed branch</technical_language>

Target:
private Jep createJEPInstance() { Jep jep = null; boolean success = false; try { File delftPath = this.getAndValidateDelftPath(); JepConfig config = this.getJepConfig( delftPath, PythonEnvironmentConfig.getInstance().getSitePackagesPath() ); jep = new Jep(config); this.initializeJepInstance(jep, delftPath); success = true; return jep; } catch(JepException e) { LOGGER.error("JEP initialization failed", e); throw new RuntimeException("JEP initialization failed", e); } catch(GrobidResourceException e) { LOGGER.error("DeLFT installation path invalid, JEP initialization failed", e); throw new RuntimeException("DeLFT installation path invalid, JEP initialization failed", e); } finally { if (!success && (jep != null)) { try { jep.close(); } catch (JepException e) { LOGGER.error("failed to close JEP instance", e); } } } }
Source:
<code>public void run() { this.logVersion(); this.logTruncatorProperties(); int retryCounter = 0; while (retryCounter < truncatorMaxRetries) { try { this.truncate(); this.restoreControllers(); return; } catch (Exception e) { <START> log.error("truncation failed on retry " + retryCounter + " of " + truncatorMaxRetries); <END> retryCounter++; if (retryCounter >= truncatorMaxRetries) { e.printStackTrace(); return; } } } this.restoreControllers(); }</code><technical_language>want move retryCounter++ line this, I > truncation failed retry 0 of 5 log is retry 4 of 5, weird</technical_language>

Target:
public void run() { this.logVersion(); this.logTruncatorProperties(); int retryCounter = 0; while (retryCounter < truncatorMaxRetries) { try { this.truncate(); break; } catch (Exception e) { retryCounter++; log.error("truncation failed on retry " + retryCounter + " of " + truncatorMaxRetries + ", retry again in " + truncatorMaxDelay + "seconds."); if (retryCounter >= truncatorMaxRetries) { e.printStackTrace(); break; } try { Thread.sleep(truncatorMaxDelay); } catch (InterruptedException ie) { break; } } } this.restoreControllers(); }
Source:
<code>public void save(AuditLog event) { <START> Map<String, Object> returnVal = null; <END> if (event.isExternal()) { returnVal = getCallsHandler().executeModification("InsertExternalAuditLog", getExternalEventSqlMapper(event)); } else { returnVal = getCallsHandler().executeModification("InsertAuditLog", getSqlMapper(event)); } event.setAuditLogId((Integer) returnVal.get("audit_log_id")); }</code><technical_language>need set null ..</technical_language>

Target:
public void save(AuditLog event) { if (event.isExternal()) { getCallsHandler().executeModification("InsertExternalAuditLog", getExternalEventSqlMapper(event)); } else { getCallsHandler().executeModification("InsertAuditLog", getSqlMapper(event)); } }
Source:
<code>public Map<String, String> getProperties() { <START> return unmodifiableMap(properties .entrySet() .stream() .collect( Collectors.toMap(Map.Entry::getKey, e -> e.getValue().property) )); <END> }</code><technical_language>suggestion return unmodifiableMap(properties.entrySet().stream().collect( toMap(Map.Entry::getKey, e -> e.getValue().property))); needs toMap imported statically</technical_language>

Target:
public Map<String, String> getProperties() { return unmodifiableMap(properties.entrySet().stream() .collect(toMap(Map.Entry::getKey, e -> e.getValue().propertyValue))); }
Source:
<code>public void doSetUserClaimValuesWithID(String userID, Map<String, List<String>> multiValuedClaimsToAdd, Map<String, List<String>> multiValuedClaimsToDelete, Map<String, List<String>> claimsExcludingMultiValuedClaims, String profileName) throws NotImplementedException { <START> throw new NotImplementedException("This functionality is not yet implemented for JDBC userstores."); <END> }</code><technical_language>this is uniqueId JDBC</technical_language>

Target:
public void doSetUserClaimValuesWithID(String userID, Map<String, List<String>> multiValuedClaimsToAdd, Map<String, List<String>> multiValuedClaimsToDelete, Map<String, List<String>> claimsExcludingMultiValuedClaims, String profileName) throws NotImplementedException { throw new NotImplementedException("This functionality is not yet implemented for UniqueID JDBC userstores."); }
Source:
<code>public String url(Map<String, ?> parametersMap) { <START> String safeQueryString = ""; <END> for (String parameter : parametersMap.keySet()) { String cleanParameter = this.url(parameter); Object mapValues = parametersMap.get(parameter); if (mapValues.getClass().isArray()) { Object[] values = (Object[]) mapValues; for (Object value : values) { String valueAsString = String.valueOf(value); String cleanValue = this.url(valueAsString); if (!safeQueryString.equals("")) { safeQueryString += AND; } safeQueryString += cleanParameter + EQUALS + cleanValue; } } else if (Collection.class.isAssignableFrom(mapValues.getClass())) { Collection<?> values = (Collection<?>) mapValues; for (Object value : values) { String valueAsString = String.valueOf(value); String cleanValue = this.url(valueAsString); if (!safeQueryString.equals("")) { safeQueryString += AND; } safeQueryString += cleanParameter + EQUALS + cleanValue; } } else { String valueAsString = String.valueOf(mapValues); String cleanValue = this.url(valueAsString); if (!safeQueryString.equals("")) { safeQueryString += AND; } safeQueryString += cleanParameter + EQUALS + cleanValue; } } return safeQueryString; }</code><technical_language>a StringBuilder</technical_language>

Target:
public String url(Map<String, ?> parametersMap) { StringBuilder queryStringBuilder = new StringBuilder(); for (Map.Entry<String, ?> entry : parametersMap.entrySet()) { String cleanKey = this.url(entry.getKey()); Object mapValues = entry.getValue(); if (mapValues.getClass().isArray()) { Object[] values = (Object[]) mapValues; for (Object value : values) { addQueryStringPair(cleanKey, value, queryStringBuilder); } } else if (Collection.class.isAssignableFrom(mapValues.getClass())) { Collection<?> values = (Collection<?>) mapValues; for (Object value : values) { addQueryStringPair(cleanKey, value, queryStringBuilder); } } else { addQueryStringPair(cleanKey, mapValues, queryStringBuilder); } } return queryStringBuilder.toString(); }
Source:
<code>private boolean isInEmulator() { return Build.FINGERPRINT.startsWith("generic") || Build.FINGERPRINT.startsWith("unknown") || Build.MODEL.contains("google_sdk") || Build.MODEL.contains("Emulator") || Build.MODEL.contains("Android SDK built for x86") || Build.MANUFACTURER.contains("Genymotion") || (Build.BRAND.startsWith("generic") && Build.DEVICE.startsWith("generic")) <START> || "google_sdk".equals(Build.PRODUCT); <END> }</code><technical_language>revert this Build.PRODUCT.equals("google_sdk)"</technical_language>

Target:
private boolean isInEmulator() { return Build.FINGERPRINT.startsWith("generic") || Build.FINGERPRINT.startsWith("unknown") || Build.MODEL.contains("google_sdk") || Build.MODEL.contains("Emulator") || Build.MODEL.contains("Android SDK built for x86") || Build.MANUFACTURER.contains("Genymotion") || (Build.BRAND.startsWith("generic") && Build.DEVICE.startsWith("generic")) || Build.PRODUCT.equals("google_sdk"); }
Source:
<code>void delete(@Nonnull UnionVFile file) throws CannotDeleteFileException { if (!file.isWritable()) { throw new CannotDeleteFileException(file.getLocation()); } else { <START> file.getWrappedFiles().get(0).delete(); <END> } }</code><technical_language>Strange. Is delete supported? For me, delete remove file unionvfs, vfs</technical_language>

Target:
void delete(@Nonnull UnionVFile file) throws CannotDeleteFileException { if (!isWritable()) { throw new UnsupportedOperationException(); } try { UnionVDir parent = (UnionVDir) file.getParent(); parent.internalDelete(file.getName()); } catch (UnsupportedOperationException e) { throw new AssertionError(e); } }
Source:
<code>public void setupBackdrop(Provider provider){ identifierTv = findViewById(R.id.provider_dashboard_identifier_tv); editProviderIv = findViewById(R.id.provider_dashboard_edit_iv); <START> if(provider != null){ <END> String display = provider.getPerson().getDisplay(); if(display == null){ display = provider.getPerson().getName().getNameString(); } setTitle(display); identifierTv.setText(provider.getIdentifier()); } editProviderIv.setOnClickListener(v -> { Intent intent = new Intent(ProviderDashboardActivity.this, AddProviderActivity.class); intent.putExtra(ApplicationConstants.BundleKeys.PROVIDER_ID_BUNDLE, provider); startActivityForResult(intent, EDIT_PROVIDER_REQ_CODE); }); }</code><technical_language>Format this file</technical_language>

Target:
public void setupBackdrop(Provider provider) { identifierTv = findViewById(R.id.provider_dashboard_identifier_tv); editProviderIv = findViewById(R.id.provider_dashboard_edit_iv); if (provider != null) { String display = provider.getPerson().getDisplay(); if (display == null) { display = provider.getPerson().getName().getNameString(); } setTitle(display); identifierTv.setText(provider.getIdentifier()); } editProviderIv.setOnClickListener(view -> { Intent intent = new Intent(ProviderDashboardActivity.this, AddProviderActivity.class); intent.putExtra(ApplicationConstants.BundleKeys.PROVIDER_ID_BUNDLE, provider); startActivityForResult(intent, EDIT_PROVIDER_REQ_CODE); }); }
Source:
<code>private void setLength( PageCursor cursor, long length ) throws IOException { if ( !cursor.next( (length - 1) / entriesPerPage ) ) { <START> throw new IllegalStateException(); <END> } }</code><technical_language>Exception some details length related size understand problem pop</technical_language>

Target:
private void setLength( PageCursor cursor, long length ) throws IOException { if ( !cursor.next( (length - 1) / entriesPerPage ) ) { throw new IllegalStateException( String.format( "Unable to extend the backing file %s to desired size %d.", pagedFile, length ) ); } }
Source:
<code>public static EC2HardwareBuilder t3_nano() { return new EC2HardwareBuilder(InstanceType.T3_NANO).t1() .ram(512) <START> .processors(ImmutableList.of(new Processor(2.0, 1.0))); <END> }</code><technical_language>AWS Instance Type reference page: <LINK_0></technical_language>

Target:
public static EC2HardwareBuilder t3_nano() { return new EC2HardwareBuilder(InstanceType.T3_NANO).t1() .ram(512) .processors(ImmutableList.of(new Processor(2.0, 2.5))); }
Source:
<code>private SessionFactory initABasicSessionFactory() { backendMock.expectSchema( AutomaticIndexingBasicIT.IndexedEntity.INDEX, b -> b .field( "indexedField", String.class ) .field( "noReindexOnUpdateField", String.class ) .field( "indexedElementCollectionField", String.class ) .field( "noReindexOnUpdateElementCollectionField", String.class ) ); SessionFactory factory = ormSetupHelper.withBackendMock( backendMock ) <START> .setup( AutomaticIndexingBasicIT.IndexedEntity.class ); <END> backendMock.verifyExpectationsMet(); return factory; }</code><technical_language>Do reuse entity another test, create test class. simple this: @Entity(name = "indexed") @Indexed(name = IndexedEntity.INDEX) public static class IndexedEntity { public static String INDEX = "IndexedEntity"; @Id Integer id; @Id public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } } ... please, reuse entity classes tests. I want changing class in test affect other tests..</technical_language>

Target:
private SessionFactory initABasicSessionFactory() { backendMock.expectAnySchema( IndexedEntity.INDEX ); SessionFactory factory = ormSetupHelper.withBackendMock( backendMock ) .setup( IndexedEntity.class ); backendMock.verifyExpectationsMet(); return factory; }
Source:
<code>public void testRetriesCorrectNumberOfTimesAndFindsRandomBackoffWithInExponentialInterval() throws Exception { Random random = mock(Random.class); ExponentialBackoff backoff = new ExponentialBackoff(3, ONE_SECOND, random); when(random.nextDouble()).thenReturn(1.0); assertThat(backoff.nextBackoff()).contains(ONE_SECOND.multipliedBy(2)); when(random.nextDouble()).thenReturn(1.0); assertThat(backoff.nextBackoff()).contains(ONE_SECOND.multipliedBy(4)); <START> when(random.nextDouble()).thenReturn(1.0); <END> assertThat(backoff.nextBackoff()).contains(ONE_SECOND.multipliedBy(8)); assertThat(backoff.nextBackoff()).isEmpty(); }</code><technical_language>vary random number returned</technical_language>

Target:
public void testRetriesCorrectNumberOfTimesAndFindsRandomBackoffWithInExponentialInterval() throws Exception { Random random = mock(Random.class); ExponentialBackoff backoff = new ExponentialBackoff(3, ONE_SECOND, random); when(random.nextDouble()).thenReturn(1.0); assertThat(backoff.nextBackoff()).contains(ONE_SECOND.multipliedBy(2)); when(random.nextDouble()).thenReturn(1.0); assertThat(backoff.nextBackoff()).contains(ONE_SECOND.multipliedBy(4)); when(random.nextDouble()).thenReturn(0.5); assertThat(backoff.nextBackoff()).contains(ONE_SECOND.multipliedBy(4 )); assertThat(backoff.nextBackoff()).isEmpty(); }
Source:
<code><START> @Deprecated public EmailDeviceInfoLens(Context context, String[] addresses, String subject, <END> String version, int versionCode) { this(context, subject, version, versionCode, addresses); }</code><technical_language>This, too</technical_language>

Target:
public EmailDeviceInfoLens(Context context, String[] addresses, String subject, String version, int versionCode) { this(context, subject, version, versionCode, addresses); }
Source:
<code>public Response getDatasourceRuleHistory( @PathParam("dataSourceName") final String dataSourceName, @QueryParam("interval") final String interval, @QueryParam("count") final Integer count ) { Interval theInterval = interval == null ? null : new Interval(interval); <START> if (theInterval == null && count != null && count > 0) { <END> return Response.ok(auditManager.fetchAuditHistory(dataSourceName, "rules", count)) .build(); } return Response.ok(auditManager.fetchAuditHistory(dataSourceName, "rules", theInterval)) .build(); }</code><technical_language>count</technical_language>

Target:
public Response getDatasourceRuleHistory( @PathParam("dataSourceName") final String dataSourceName, @QueryParam("interval") final String interval, @QueryParam("count") final Integer count ) { Interval theInterval = interval == null ? null : new Interval(interval); if (theInterval == null && count != null) { try { return Response.ok(auditManager.fetchAuditHistory(dataSourceName, "rules", count)) .build(); } catch (IllegalArgumentException e) { return Response.status(Response.Status.BAD_REQUEST) .entity(ImmutableMap.<String, Object>of("error", e.getMessage())) .build(); } } return Response.ok(auditManager.fetchAuditHistory(dataSourceName, "rules", theInterval)) .build(); }
Source:
<code>public static String getSpaceGroupId(String categoryId) { <START> String categoryPath = ""; <END> String spaceGroupId = ""; String rootCatId = categoryId; try { FAQService faqService = CommonsUtils.getService(FAQService.class); Category category = faqService.getCategoryById(categoryId); categoryPath = category.getPath(); if (categoryPath.indexOf(Utils.CATE_SPACE_ID_PREFIX) >= 0){ rootCatId = categoryPath.split("/")[1]; } } catch (Exception e) { e.printStackTrace(); } if (rootCatId.indexOf(Utils.CATE_SPACE_ID_PREFIX) < 0) return ""; String prettyname = rootCatId.split(Utils.CATE_SPACE_ID_PREFIX)[1]; spaceGroupId = SpaceUtils.SPACE_GROUP + CommonUtils.SLASH + prettyname; return spaceGroupId; }</code><technical_language>Remove line 44 move line 51: String categoryPath = category.getPath();</technical_language>

Target:
public static String getSpaceGroupId(String categoryId) { String spaceGroupId = ""; String spaceCateId = categoryId; try { FAQService faqService = CommonsUtils.getService(FAQService.class); Category category = faqService.getCategoryById(categoryId); String categoryPath = category.getPath(); if (categoryPath.indexOf(Utils.CATE_SPACE_ID_PREFIX) >= 0){ spaceCateId = categoryPath.split("/")[1]; } } catch (Exception e) { LOG.warn("Get category id failed.", e); } if (spaceCateId.indexOf(Utils.CATE_SPACE_ID_PREFIX) < 0) return ""; String prettyname = spaceCateId.split(Utils.CATE_SPACE_ID_PREFIX)[1]; spaceGroupId = SpaceUtils.SPACE_GROUP + CommonUtils.SLASH + prettyname; return spaceGroupId; }
Source:
<code>private List<EntitySkinnable> getNearbySkinnableNPCs(Player player) { List<EntitySkinnable> results = new ArrayList<EntitySkinnable>(); for (NPC npc : getAllNPCs()) { Entity npcEntity = npc.getEntity(); if (npcEntity instanceof Player && player.canSee((Player) npcEntity) && player.getWorld().equals(npcEntity.getWorld()) && player.getLocation().distanceSquared(npcEntity.getLocation()) < 100 * 100) { EntitySkinnable skinnable = NMS.getSkinnableNPC(npcEntity); <START> assert skinnable != null; <END> results.add(skinnable); } } return results; }</code><technical_language>Asserts disabled JVMs. this is necessary in release build</technical_language>

Target:
private List<SkinnableEntity> getNearbySkinnableNPCs(Player player) { List<SkinnableEntity> results = new ArrayList<SkinnableEntity>(); double viewDistance = Setting.NPC_SKIN_VIEW_DISTANCE.asDouble(); viewDistance *= viewDistance; for (NPC npc : getAllNPCs()) { Entity npcEntity = npc.getEntity(); if (npcEntity instanceof Player && player.canSee((Player) npcEntity) && player.getWorld().equals(npcEntity.getWorld()) && player.getLocation(CACHE_LOCATION) .distanceSquared(npc.getStoredLocation()) < viewDistance) { SkinnableEntity skinnable = NMS.getSkinnable(npcEntity); results.add(skinnable); } } return results; }