auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private MetricsForStrategy(MetricsManager manager, String strategy, Function<Long, Long> tsToMillis, Clock wallClock, long recomputeMillis) { Map<String, String> tag = ImmutableMap.of(AtlasDbMetricNames.TAG_STRATEGY, strategy); this.manager = manager; enqueuedWrites = register(AtlasDbMetricNames.ENQUEUED_WRITES, TimestampedAccumulatingValueMetric.create(), tag); entriesRead = registerAccumulating(AtlasDbMetricNames.ENTRIES_READ, tag); tombstonesPut = registerAccumulating(AtlasDbMetricNames.TOMBSTONES_PUT, tag); abortedWritesDeleted = registerAccumulating(AtlasDbMetricNames.ABORTED_WRITES_DELETED, tag); sweepTimestamp = register(AtlasDbMetricNames.SWEEP_TS, new CurrentValueMetric<>(), tag); AggregatingVersionedSupplier<Long> lastSweptTsSupplier = new AggregatingVersionedSupplier<>( TargetedSweepMetrics::minimum, recomputeMillis); lastSweptTs = register(AtlasDbMetricNames.LAST_SWEPT_TS, new AggregatingVersionedMetric<>(lastSweptTsSupplier), tag); Supplier<Long> millisSinceLastSweptTs = new CachedComposedSupplier<>( swept -> estimateMillisSinceTs(swept, wallClock, tsToMillis), lastSweptTs::getVersionedValue); register(AtlasDbMetricNames.LAG_MILLIS, millisSinceLastSweptTs::get, tag); }

Target:
private MetricsForStrategy(MetricsManager manager, String strategy, Function<Long, Long> tsToMillis, Clock wallClock, long recomputeMillis) { Map<String, String> tag = ImmutableMap.of(AtlasDbMetricNames.TAG_STRATEGY, strategy); this.manager = manager; enqueuedWrites = register(AtlasDbMetricNames.ENQUEUED_WRITES, TimestampedAccumulatingValueMetric.create(), tag); entriesRead = registerAccumulating(AtlasDbMetricNames.ENTRIES_READ, tag); tombstonesPut = registerAccumulating(AtlasDbMetricNames.TOMBSTONES_PUT, tag); abortedWritesDeleted = registerAccumulating(AtlasDbMetricNames.ABORTED_WRITES_DELETED, tag); sweepTimestamp = register(AtlasDbMetricNames.SWEEP_TS, new CurrentValueMetric<>(), tag); AggregatingVersionedSupplier<Long> lastSweptTsSupplier = new AggregatingVersionedSupplier<>( TargetedSweepMetrics::minimum, recomputeMillis); lastSweptTs = register(AtlasDbMetricNames.LAST_SWEPT_TS, new AggregatingVersionedMetric<>(lastSweptTsSupplier), tag); Supplier<Long> millisSinceLastSweptTs = new CachedComposedSupplier<>( sweptTs -> estimateMillisSinceTs(sweptTs, wallClock, tsToMillis), lastSweptTs::getVersionedValue); register(AtlasDbMetricNames.LAG_MILLIS, millisSinceLastSweptTs::get, tag); }
Source:
public Collection<TopicPartition> onPartitionsAssigned(Collection<TopicPartition> partitions) { return EMPTY_PARTITIONS_SET; }

Target:
public Collection<TopicPartition> onPartitionsAssigned(Collection<TopicPartition> partitions) { return Collections.unmodifiableSet(EMPTY_PARTITIONS_SET); }
Source:
public void testWebpackAmdPattern() { testModules( "test.js", LINE_JOINER.join( "var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;", "!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(2)],", " __WEBPACK_AMD_DEFINE_RESULT__ = function (b, c) {", " console.log(b, c.exportA, c.exportB);", " }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),", " __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));"), LINE_JOINER.join( "goog.provide('module$test');", "var module$test = {};", "var __WEBPACK_AMD_DEFINE_ARRAY__$$module$test;", "!(__WEBPACK_AMD_DEFINE_ARRAY__$$module$test = [__webpack_require__(1), __webpack_require__(2)],", " module$test = function(b,c){console.log(b,c.exportA,c.exportB)}", " .apply(module$test,__WEBPACK_AMD_DEFINE_ARRAY__$$module$test),", " module$test!==undefined && module$test)")); }

Target:
public void testWebpackAmdPattern() { testModules( "test.js", LINE_JOINER.join( "var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;", "!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(2)],", " __WEBPACK_AMD_DEFINE_RESULT__ = function (b, c) {", " console.log(b, c.exportA, c.exportB);", " }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),", " __WEBPACK_AMD_DEFINE_RESULT__ !== undefined", " && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));"), LINE_JOINER.join( "goog.provide('module$test');", "var module$test = {};", "var __WEBPACK_AMD_DEFINE_ARRAY__$$module$test;", "!(__WEBPACK_AMD_DEFINE_ARRAY__$$module$test = ", " [__webpack_require__(1), __webpack_require__(2)],", " module$test = function(b,c){console.log(b,c.exportA,c.exportB)}", " .apply(module$test,__WEBPACK_AMD_DEFINE_ARRAY__$$module$test),", " module$test!==undefined && module$test)")); }
Source:
HandlerFunctionDescription(HandlerFunction<?> handlerFunction) { this.className = handlerFunction.getClass().getName(); }

Target:
HandlerFunctionDescription(HandlerFunction<?> handlerFunction) { this.className = getHandlerFunctionClassName(handlerFunction); }
Source:
private static Term intTerm(String name, int value) { BytesRef bytes = new BytesRef(NumericUtils.BUF_SIZE_INT); BytesRefBuilder builder = new BytesRefBuilder(); builder.append(bytes); NumericUtils.intToPrefixCodedBytes(value, 0, builder); return new Term(name, bytes); }

Target:
private static Term intTerm(String name, int value) { BytesRefBuilder builder = new BytesRefBuilder(); NumericUtils.intToPrefixCodedBytes(value, 0, builder); return new Term(name, builder.get()); }
Source:
public List<Folder> getValidationFolders() { return typeValidateImages ? process.getProject().getFolders().parallelStream() .filter(Folder::isValidateFolder) .collect(Collectors.toList()) : Collections.emptyList(); }

Target:
public List<Folder> getValidationFolders() { List<Folder> validationFolders = typeValidateImages ? process.getProject().getFolders().parallelStream() .filter(Folder::isValidateFolder) .collect(Collectors.toList()) : Collections.emptyList(); return validationFolders; }
Source:
public DataPointGroup aggregate(DataPointGroup dataPointGroup) { if (m_sampling == null) m_sampling = new Sampling(1, TimeUnit.MILLISECONDS); checkNotNull(dataPointGroup); if (m_alignSampling) { m_startTime = alignRangeBoundary(m_startTime); } return (new RangeDataPointAggregator(dataPointGroup, getSubAggregator())); }

Target:
public DataPointGroup aggregate(DataPointGroup dataPointGroup) { checkNotNull(dataPointGroup); if (m_alignSampling) m_startTime = alignRangeBoundary(m_startTime); return (new RangeDataPointAggregator(dataPointGroup, getSubAggregator())); }
Source:
public void testBuildingRtfFromTemplate() { RtfTemplate template = new RtfTemplate.Builder() .withMetacard(mockMetacard) .usingCategories(mockCategories) .build(); assertThat("Template cannot be null", template, notNullValue()); assertThat( "There should be 4 categories", mockCategories.get(0).getAttributes().size(), equalTo(4)); Rtf doc = Rtf.rtf(); Rtf generatedTemplate = template.rtf(doc); assertThat("Rtf template instance cannot be null", generatedTemplate, notNullValue()); String finishedDoc = generatedTemplate.out().toString(); assertThat("RTF output cannot be null", finishedDoc, notNullValue()); assertThat("RTF document must start with {\\rtf1", finishedDoc.startsWith("{\\rtf1"), is(true)); assertThat( String.format("RTF document must contain section with title: %s", METACARD_TITLE), finishedDoc.contains(METACARD_TITLE), is(true)); }

Target:
public void testBuildingRtfFromTemplate() { RtfTemplate template = new RtfTemplate.Builder().withMetacard(mockMetacard).withCategories(mockCategories).build(); assertThat("Template cannot be null", template, notNullValue()); assertThat("There should be 4 categories", mockCategories.get(0).getAttributes(), hasSize(4)); Rtf doc = Rtf.rtf(); Rtf generatedTemplate = template.rtf(doc); assertThat("Rtf template instance cannot be null", generatedTemplate, notNullValue()); String finishedDoc = generatedTemplate.out().toString(); assertThat("RTF output cannot be null", finishedDoc, notNullValue()); assertThat("RTF document must start with {\\rtf1", finishedDoc, startsWith("{\\rtf1")); assertThat( String.format("RTF document must contain section with title: %s", METACARD_TITLE), finishedDoc, containsString(METACARD_TITLE)); }
Source:
public static void setUp() { final Injector injector = GuiceInjectors.makeStartupInjectorWithModules( ImmutableList.of( new Module() { @Override public void configure(Binder binder) { binder.bind(LocalDataSegmentPuller.class); } } ) ); mapper = new DefaultObjectMapper(); mapper.registerModule( new com.fasterxml.jackson.databind.Module() { @Override public String getModuleName() { return "noName"; } @Override public Version version() { return Version.unknownVersion(); } @Override public void setupModule(SetupContext context) { context.registerSubtypes(LocalLoadSpec.class); } } ); mapper.setInjectableValues( new InjectableValues() { @Override public Object findInjectableValue( Object valueId, DeserializationContext ctxt, BeanProperty forProperty, Object beanInstance ) { if (valueId instanceof Key) { return injector.getInstance((Key) valueId); } if (valueId instanceof String) { try { return injector.getInstance(Class.forName((String) valueId)); } catch (ClassNotFoundException e) { throw new IAE(e, "Cannot get class [%s]", valueId); } } throw new IAE("Unknown class type [%s]", valueId.getClass().getCanonicalName()); } } ); }

Target:
public static void setUp() { final Injector injector = GuiceInjectors.makeStartupInjectorWithModules( ImmutableList.of( new Module() { @Override public void configure(Binder binder) { binder.bind(LocalDataSegmentPuller.class); } } ) ); mapper = new DefaultObjectMapper(); mapper.registerModule( new SimpleModule("loadSpecTest").registerSubtypes(LocalLoadSpec.class)); mapper.setInjectableValues(new GuiceInjectableValues(injector)); final GuiceAnnotationIntrospector guiceIntrospector = new GuiceAnnotationIntrospector(); mapper.setAnnotationIntrospectors( new AnnotationIntrospectorPair( guiceIntrospector, mapper.getSerializationConfig().getAnnotationIntrospector() ), new AnnotationIntrospectorPair( guiceIntrospector, mapper.getDeserializationConfig().getAnnotationIntrospector() ) ); }
Source:
public void run() { AbstractPollingEndpoint.this.taskExecutor.execute(() -> { int count = 0; while (AbstractPollingEndpoint.this.initialized && (AbstractPollingEndpoint.this.maxMessagesPerPoll <= 0 || count < AbstractPollingEndpoint.this.maxMessagesPerPoll)) { try { if (!Poller.this.pollingTask.call()) { break; } count++; } catch (Exception e) { if (e instanceof MessagingException) { throw (MessagingException) e; } else { throw new MessagingException(messageHolder.get(), e); } } finally { messageHolder.remove(); } } }); }

Target:
public void run() { AbstractPollingEndpoint.this.taskExecutor.execute(() -> { int count = 0; while (AbstractPollingEndpoint.this.initialized && (AbstractPollingEndpoint.this.maxMessagesPerPoll <= 0 || count < AbstractPollingEndpoint.this.maxMessagesPerPoll)) { try { if (!Poller.this.pollingTask.call()) { break; } count++; } catch (Exception e) { if (e instanceof MessagingException) { throw (MessagingException) e; } else { Message<?> failedMessage = null; if (AbstractPollingEndpoint.this.transactionSynchronizationFactory != null) { Object resource = TransactionSynchronizationManager.getResource(getResourceToBind()); if (resource instanceof IntegrationResourceHolder) { failedMessage = ((IntegrationResourceHolder) resource).getMessage(); } } throw new MessagingException(failedMessage, e); } } finally { if (AbstractPollingEndpoint.this.transactionSynchronizationFactory != null) { Object resource = getResourceToBind(); if (TransactionSynchronizationManager.hasResource(resource)) { TransactionSynchronizationManager.unbindResource(resource); } } } } }); }
Source:
public int hashCode() { return com.google.common.base.Objects.hashCode(context, label, provider); }

Target:
public int hashCode() { return Objects.hash(context, label, provider); }
Source:
public ObjectId insert(int type, long len, InputStream in) throws IOException { byte[] buf = buffer(); if (buf.length < len && len < (10 << 20)) buf = new byte[(int) len]; if (len <= buf.length) { IO.readFully(in, buf, 0, (int) len); return insert(type, buf, 0, (int) len); } long offset = beginObject(type, len); MessageDigest md = digest(); md.update(Constants.encodedTypeString(type)); md.update((byte) ' '); md.update(Constants.encodeASCII(len)); md.update((byte) 0); while (0 < len) { int n = in.read(buf, 0, (int) Math.min(buf.length, len)); if (n <= 0) throw new EOFException(); md.update(buf, 0, n); packOut.compress.write(buf, 0, n); len -= n; } packOut.compress.finish(); return endObject(ObjectId.fromRaw(md.digest()), offset); }

Target:
public ObjectId insert(int type, long len, InputStream in) throws IOException { byte[] buf = buffer(); if (buf.length < len && len < db.getReaderOptions().getStreamFileThreshold()) buf = new byte[(int) len]; if (len <= buf.length) { IO.readFully(in, buf, 0, (int) len); return insert(type, buf, 0, (int) len); } long offset = beginObject(type, len); MessageDigest md = digest(); md.update(Constants.encodedTypeString(type)); md.update((byte) ' '); md.update(Constants.encodeASCII(len)); md.update((byte) 0); while (0 < len) { int n = in.read(buf, 0, (int) Math.min(buf.length, len)); if (n <= 0) throw new EOFException(); md.update(buf, 0, n); packOut.compress.write(buf, 0, n); len -= n; } packOut.compress.finish(); return endObject(ObjectId.fromRaw(md.digest()), offset); }
Source:
public boolean shouldAlertUpgrade(ArrayList<RpmVersion> isos, String hostOs) { boolean alert = false; for (RpmVersion iso: isos) { try { String nodeInfo[] = hostOs.split("-"); String formattedISOversion = iso.getValue(); formattedISOversion = formattedISOversion.substring(formattedISOversion.length() - 8); Date dateISO = dateISOformat.parse(formattedISOversion); Date dateNodeISO = dateISOformat.parse(nodeInfo[2].split("\\.")[0].trim()); if (dateISO.compareTo(dateNodeISO)>0) { alert = true; break; } } catch (RuntimeException ex) { getLogger().error("Error while trying to determine host upgrade alert", ex); } } return alert; }

Target:
public boolean shouldAlertUpgrade(ArrayList<RpmVersion> isos, String hostOs) { boolean alert = false; for (RpmVersion iso: isos) { String nodeInfo[] = hostOs.split("-"); String nodeVersion[] = nodeInfo[1].trim().split("\\."); String isoVersion[] = iso.getValue().trim().split("\\."); if (Integer.parseInt(isoVersion[0]) == Integer.parseInt(nodeVersion[0])) { if (Integer.parseInt(isoVersion[1]) > Integer.parseInt(nodeVersion[1]) || Integer.parseInt(isoVersion[2]) > Integer.parseInt(nodeVersion[2])) { alert = true; break; } } } return alert; }
Source:
public synchronized JSONObject getDebugState() { JSONObject debugState = new JSONObject(); debugState.put( "class", VP8AdaptiveTrackProjectionContext.class.getSimpleName()); JSONArray mapSizes = new JSONArray(); int i = 0; for (long ssrc: vp8FrameMaps.keySet()) { JSONObject sizeInfo = new JSONObject(); sizeInfo.put("ssrc", ssrc); sizeInfo.put("size", vp8FrameMaps.get(ssrc).size()); mapSizes.add(sizeInfo); } debugState.put( "vp8FrameMaps", mapSizes); debugState.put("vp8QualityFilter", vp8QualityFilter.getDebugState()); debugState.put("payloadType", payloadType.toString()); return debugState; }

Target:
public synchronized JSONObject getDebugState() { JSONObject debugState = new JSONObject(); debugState.put( "class", VP8AdaptiveTrackProjectionContext.class.getSimpleName()); JSONArray mapSizes = new JSONArray(); int i = 0; for (Map.Entry<Long, VP8FrameMap> entry: vp8FrameMaps.entrySet()) { JSONObject sizeInfo = new JSONObject(); sizeInfo.put("ssrc", entry.getKey()); sizeInfo.put("size", entry.getValue().size()); mapSizes.add(sizeInfo); } debugState.put( "vp8FrameMaps", mapSizes); debugState.put("vp8QualityFilter", vp8QualityFilter.getDebugState()); debugState.put("payloadType", payloadType.toString()); return debugState; }
Source:
public void transferFailed(TransferEvent event) { transferCompleted(event); logger.warn(event.getException().getMessage()); }

Target:
public void transferFailed(TransferEvent event) { transferCompleted(event); logger.warn("Unsuccessful transfer", event.getException()); }
Source:
private String makePattern(String template) { String compilerPatternExtended = getCompilerPatternExtended(); Map<String, String> map = new HashMap<>(); map.put("${COMPILER_PATTERN}", compilerPatternExtended); map.put("${EXTENSIONS_PATTERN}", getPatternFileExtensions()); map.put("${COMPILER_GROUPS+1}", Integer.toString(countGroups(compilerPatternExtended) + 1)); String pattern = replaceFromMap(template, map); return pattern; }

Target:
private String makePattern(String template) { String compilerPatternExtended = getCompilerPatternExtended(); if (replaceMap == null) { replaceMap = new HashMap<>(); replaceMap.put("${COMPILER_PATTERN}", compilerPatternExtended); replaceMap.put("${EXTENSIONS_PATTERN}", getPatternFileExtensions()); replaceMap.put("${COMPILER_GROUPS+1}", Integer.toString(countGroups(compilerPatternExtended) + 1)); } String pattern = replace(template, replaceMap); return pattern; }
Source:
TableMetadata parseVirtualTable( AdminRow tableRow, CqlIdentifier keyspaceId, Map<CqlIdentifier, UserDefinedType> userTypes) { CqlIdentifier tableId = CqlIdentifier.fromInternal( tableRow.getString(rows.isCassandraV3 ? "table_name" : "columnfamily_name")); List<RawColumn> rawColumns = RawColumn.toRawColumns( rows.virtualColumns.getOrDefault(keyspaceId, ImmutableMultimap.of()).get(tableId), keyspaceId, userTypes); if (rawColumns.isEmpty()) { LOG.warn( "[{}] Processing TABLE refresh for {}.{} but found no matching rows, skipping", logPrefix, keyspaceId, tableId); return null; } Collections.sort(rawColumns); ImmutableMap.Builder<CqlIdentifier, ColumnMetadata> allColumnsBuilder = ImmutableMap.builder(); for (RawColumn raw : rawColumns) { DataType dataType = dataTypeParser.parse(keyspaceId, raw.dataType, userTypes, context); ColumnMetadata column = new DefaultColumnMetadata( keyspaceId, tableId, raw.name, dataType, raw.kind == RawColumn.Kind.STATIC); allColumnsBuilder.put(column.getName(), column); } return new DefaultTableMetadata( keyspaceId, tableId, new UUID(0L, 0L), false, Collections.emptyList(), Collections.emptyMap(), allColumnsBuilder.build(), Collections.emptyMap(), Collections.emptyMap()); }

Target:
TableMetadata parseVirtualTable( AdminRow tableRow, CqlIdentifier keyspaceId, Map<CqlIdentifier, UserDefinedType> userTypes) { CqlIdentifier tableId = CqlIdentifier.fromInternal(tableRow.getString("table_name")); List<RawColumn> rawColumns = RawColumn.toRawColumns( rows.virtualColumns().getOrDefault(keyspaceId, ImmutableMultimap.of()).get(tableId), keyspaceId, userTypes); if (rawColumns.isEmpty()) { LOG.warn( "[{}] Processing TABLE refresh for {}.{} but found no matching rows, skipping", logPrefix, keyspaceId, tableId); return null; } Collections.sort(rawColumns); ImmutableMap.Builder<CqlIdentifier, ColumnMetadata> allColumnsBuilder = ImmutableMap.builder(); ImmutableList.Builder<ColumnMetadata> partitionKeyBuilder = ImmutableList.builder(); ImmutableMap.Builder<ColumnMetadata, ClusteringOrder> clusteringColumnsBuilder = ImmutableMap.builder(); for (RawColumn raw : rawColumns) { DataType dataType = rows.dataTypeParser().parse(keyspaceId, raw.dataType, userTypes, context); ColumnMetadata column = new DefaultColumnMetadata( keyspaceId, tableId, raw.name, dataType, raw.kind.equals(RawColumn.KIND_STATIC)); switch (raw.kind) { case RawColumn.KIND_PARTITION_KEY: partitionKeyBuilder.add(column); break; case RawColumn.KIND_CLUSTERING_COLUMN: clusteringColumnsBuilder.put( column, raw.reversed ? ClusteringOrder.DESC : ClusteringOrder.ASC); break; default: } allColumnsBuilder.put(column.getName(), column); } return new DefaultTableMetadata( keyspaceId, tableId, null, false, true, partitionKeyBuilder.build(), clusteringColumnsBuilder.build(), allColumnsBuilder.build(), Collections.emptyMap(), Collections.emptyMap()); }
Source:
public static List<Event> getUpcomingEvents(Context context) { ContentResolver cr = context.getContentResolver(); Calendar now = Calendar.getInstance(); now.setTime(new Date()); Cursor evtCur = cr.query( CalendarContract.Events.CONTENT_URI, EVENT_PROJECTION, CalendarContract.Events.DTSTART + ">" + now.getTimeInMillis() , null, CalendarContract.Events.DTSTART + " ASC LIMIT 50"); List<Event> events = new ArrayList<Event>(); evtCur.moveToFirst(); for (int i = 0; i < evtCur.getCount(); i++) { events.add(eventFromCusrsor(context, evtCur)); evtCur.moveToNext(); } evtCur.close(); return events; }

Target:
public static List<Event> getUpcomingEvents(Context context) { return getUpcomingEvents(context, 50); }
Source:
private void printIndented(int indent, String format, String... arguments) { if (indent == 0) { stdout.format(format + "%n", (Object[]) arguments); } else { String f = "%" + indent + "s" + format + "%n"; String[] newArgs = new String[arguments.length + 1]; newArgs[0] = " "; int i = 1; for (String arg: arguments ) { newArgs[i] = arg; i++; } stdout.format(f, newArgs); } }

Target:
private void printIndented(int indent, String format, String... arguments) { if (indent == 0) { stdout.format(format + "%n", (Object[]) arguments); } else { String[] newArgs = new String[arguments.length + 1]; newArgs[0] = " "; System.arraycopy(arguments, 0, newArgs, 1, arguments.length); String f = "%" + indent + "s" + format + "%n"; stdout.format(f, newArgs); } }
Source:
public static boolean evaluateNoexceptSpecifier(ICPPEvaluation noexceptSpecifier) { if (noexceptSpecifier == null) return false; else { IntegralValue v = (IntegralValue) noexceptSpecifier.getValue(); return v.numberValue().longValue() == 1; } }

Target:
public static boolean evaluateNoexceptSpecifier(ICPPEvaluation noexceptSpecifier) { if (noexceptSpecifier != null) { IntegralValue v = (IntegralValue) noexceptSpecifier.getValue(); if (v.numberValue() != null) return v.numberValue().longValue() == 1; } return false; }
Source:
private <R> R accessInner(ICorfuSMRAccess<R, T> accessMethod, Object[] conflictObject, boolean isMetricsEnabled) { if (TransactionalContext.isInTransaction()) { try { return TransactionalContext.getCurrentContext() .access(this, accessMethod, conflictObject); } catch (Exception e) { log.error("Access[{}]", this, e); this.abortTransaction(e); } } for (int x = 0; x < rt.getParameters().getTrimRetry(); x++) { final long timestamp = rt.getSequencerView() .query(getStreamID()).getStreamTails().get(0); log.debug("Access[{}] conflictObj={} version={}", this, conflictObject, timestamp); try { return underlyingObject.access(o -> o.getVersionUnsafe() >= timestamp && !o.isOptimisticallyModifiedUnsafe(), o -> o.syncObjectUnsafe(timestamp), o -> accessMethod.access(o)); } catch (TrimmedException te) { log.warn("accessInner: Encountered a trim exception while accessing version on attempt {}", timestamp, x); underlyingObject.update(o -> { o.resetUnsafe(); return null; }); } } throw new TrimmedException(); }

Target:
private <R> R accessInner(ICorfuSMRAccess<R, T> accessMethod, Object[] conflictObject, boolean isMetricsEnabled) { if (TransactionalContext.isInTransaction()) { try { return TransactionalContext.getCurrentContext() .access(this, accessMethod, conflictObject); } catch (Exception e) { log.error("Access[{}]", this, e); this.abortTransaction(e); } } for (int x = 0; x < rt.getParameters().getTrimRetry(); x++) { final long timestamp = rt.getSequencerView() .query(getStreamID()); log.debug("Access[{}] conflictObj={} version={}", this, conflictObject, timestamp); try { return underlyingObject.access(o -> o.getVersionUnsafe() >= timestamp && !o.isOptimisticallyModifiedUnsafe(), o -> o.syncObjectUnsafe(timestamp), o -> accessMethod.access(o)); } catch (TrimmedException te) { log.warn("accessInner: Encountered a trim exception while accessing version on attempt {}", timestamp, x); underlyingObject.update(o -> { o.resetUnsafe(); return null; }); } } throw new TrimmedException(); }
Source:
void testInsertEntry() throws SQLException { dbmsProcessor.setupSharedDatabase(); BibEntry expectedEntry = getBibEntryExample(); dbmsProcessor.insertEntry(expectedEntry); BibEntry emptyEntry = new BibEntry(); emptyEntry.getSharedBibEntryData().setSharedID(1); dbmsProcessor.insertEntry(emptyEntry); Map<String, String> actualFieldMap = new HashMap<>(); try (ResultSet entryResultSet = selectFrom("ENTRY", dbmsConnection, dbmsProcessor)) { assertTrue(entryResultSet.next()); assertEquals(1, entryResultSet.getInt("SHARED_ID")); assertEquals("inproceedings", entryResultSet.getString("TYPE")); assertEquals(1, entryResultSet.getInt("VERSION")); assertFalse(entryResultSet.next()); try (ResultSet fieldResultSet = selectFrom("FIELD", dbmsConnection, dbmsProcessor)) { while (fieldResultSet.next()) { actualFieldMap.put(fieldResultSet.getString("NAME"), fieldResultSet.getString("VALUE")); } } } Map<String, String> expectedFieldMap = expectedEntry.getFieldMap().entrySet().stream().collect(Collectors.toMap((entry) -> entry.getKey().getName(), Map.Entry::getValue)); assertEquals(expectedFieldMap, actualFieldMap); }

Target:
void testInsertEntry() throws SQLException { BibEntry expectedEntry = getBibEntryExample(); dbmsProcessor.insertEntry(expectedEntry); BibEntry emptyEntry = new BibEntry(); emptyEntry.getSharedBibEntryData().setSharedID(1); dbmsProcessor.insertEntry(emptyEntry); Map<String, String> actualFieldMap = new HashMap<>(); try (ResultSet entryResultSet = selectFrom("ENTRY", dbmsConnection, dbmsProcessor)) { assertTrue(entryResultSet.next()); assertEquals(1, entryResultSet.getInt("SHARED_ID")); assertEquals("inproceedings", entryResultSet.getString("TYPE")); assertEquals(1, entryResultSet.getInt("VERSION")); assertFalse(entryResultSet.next()); try (ResultSet fieldResultSet = selectFrom("FIELD", dbmsConnection, dbmsProcessor)) { while (fieldResultSet.next()) { actualFieldMap.put(fieldResultSet.getString("NAME"), fieldResultSet.getString("VALUE")); } } } Map<String, String> expectedFieldMap = expectedEntry.getFieldMap().entrySet().stream().collect(Collectors.toMap((entry) -> entry.getKey().getName(), Map.Entry::getValue)); assertEquals(expectedFieldMap, actualFieldMap); }
Source:
Set<SubscriptionName> decode(byte[] data) { MessageHeaderDecoder header = new MessageHeaderDecoder(); AssignmentsDecoder body = new AssignmentsDecoder(); UnsafeBuffer buffer = new UnsafeBuffer(data); header.wrap(buffer, 0); if (header.templateId() != AssignmentsDecoder.TEMPLATE_ID) { throw new IllegalStateException(String.format("AssignmentsDecoder TEMPLATE_ID=%d does not match encoded TEMPLATE_ID=%d", AssignmentsDecoder.TEMPLATE_ID, header.templateId())); } body.wrap(buffer, header.encodedLength(), header.blockLength(), header.version()); Set<SubscriptionName> subscriptions = new HashSet<>(); for (AssignmentsDecoder.SubscriptionsDecoder subscriptionDecoder : body.subscriptions()) { long id = subscriptionDecoder.id(); subscriptionIds.getSubscriptionId(id) .map(SubscriptionId::getSubscriptionName) .ifPresent(subscriptions::add); } return subscriptions; }

Target:
Set<SubscriptionName> decode(byte[] data) { MessageHeaderDecoder header = new MessageHeaderDecoder(); AssignmentsDecoder body = new AssignmentsDecoder(); UnsafeBuffer buffer = new UnsafeBuffer(data); header.wrap(buffer, 0); if (header.schemaId() != AssignmentsDecoder.SCHEMA_ID || header.templateId() != AssignmentsDecoder.TEMPLATE_ID) { logger.warn("Unable to decode assignments, schema or template id mismatch. " + "Required by decoder: [schema id={}, template id={}], " + "encoded in payload: [schema id={}, template id={}]", AssignmentsDecoder.SCHEMA_ID, AssignmentsDecoder.TEMPLATE_ID, header.schemaId(), header.templateId()); return Collections.emptySet(); } body.wrap(buffer, header.encodedLength(), header.blockLength(), header.version()); Set<SubscriptionName> subscriptions = new HashSet<>(); for (AssignmentsDecoder.SubscriptionsDecoder subscriptionDecoder : body.subscriptions()) { long id = subscriptionDecoder.id(); subscriptionIds.getSubscriptionId(id) .map(SubscriptionId::getSubscriptionName) .ifPresent(subscriptions::add); } return subscriptions; }
Source:
private void setKernelEnablements(KernelGroupEnum group) { fAllActivateButton.setSelection(group == KernelGroupEnum.ALL); fTracepointsActivateButton.setSelection(group == KernelGroupEnum.TRACEPOINTS); fTracepointsViewer.getTree().setEnabled(group == KernelGroupEnum.TRACEPOINTS); fSpecificEventActivateButton.setSelection(group == KernelGroupEnum.SPECIFICEVENT); fSpecificEventText.setEnabled(group == KernelGroupEnum.SPECIFICEVENT); fSysCallsActivateButton.setSelection(group == KernelGroupEnum.SYSCALLS); fProbeActivateButton.setSelection(group == KernelGroupEnum.PROBE); fProbeEventNameText.setEnabled(group == KernelGroupEnum.PROBE); fProbeText.setEnabled(group == KernelGroupEnum.PROBE); fFunctionActivateButton.setSelection(group == KernelGroupEnum.FUNCTION); fFunctionEventNameText.setEnabled(group == KernelGroupEnum.FUNCTION); fFunctionText.setEnabled(group == KernelGroupEnum.FUNCTION); }

Target:
private void setKernelEnablements(KernelGroupEnum group) { fAllActivateButton.setSelection(group == KernelGroupEnum.ALL); fTracepointsActivateButton.setSelection(group == KernelGroupEnum.TRACEPOINTS); fTracepointsViewer.getTree().setEnabled(group == KernelGroupEnum.TRACEPOINTS); fSpecificEventText.setEnabled(group == KernelGroupEnum.TRACEPOINTS); fSysCallsActivateButton.setSelection(group == KernelGroupEnum.SYSCALLS); fProbeActivateButton.setSelection(group == KernelGroupEnum.PROBE); fProbeEventNameText.setEnabled(group == KernelGroupEnum.PROBE); fProbeText.setEnabled(group == KernelGroupEnum.PROBE); fFunctionActivateButton.setSelection(group == KernelGroupEnum.FUNCTION); fFunctionEventNameText.setEnabled(group == KernelGroupEnum.FUNCTION); fFunctionText.setEnabled(group == KernelGroupEnum.FUNCTION); }
Source:
public void onDeleteSelectedColumns() { assertNotReadOnly(); final Set<Integer> selectedColumnIndexes = getSelectedColumnIndexes(); final Set<BaseColumn> columnsToDelete = new HashSet<>(); for ( int selectedColumnIndex : selectedColumnIndexes ) { final int columnIndex = findUiColumnIndex( selectedColumnIndex ); final BaseColumn column = model.getExpandedColumns().get( columnIndex ); if ( column instanceof AttributeCol52 ) { columnsToDelete.add( column ); } else if ( column instanceof MetadataCol52 ) { columnsToDelete.add( column ); } else if ( column instanceof ConditionCol52 ) { columnsToDelete.add( column ); } else if ( column instanceof ActionCol52 ) { columnsToDelete.add( column ); } } for ( BaseColumn columnToDelete : columnsToDelete ) { if ( columnToDelete instanceof AttributeCol52 ) { deleteColumn( (AttributeCol52) columnToDelete ); } else if ( columnToDelete instanceof MetadataCol52 ) { deleteColumn( (MetadataCol52) columnToDelete ); } else if ( columnToDelete instanceof ConditionCol52 ) { deleteColumn( (ConditionCol52) columnToDelete ); } else if ( columnToDelete instanceof ActionCol52 ) { deleteColumn( (ActionCol52) columnToDelete ); } } }

Target:
public void onDeleteSelectedColumns() { assertNotReadOnly(); final Set<Integer> selectedColumnIndexes = getSelectedColumnIndexes(); final Set<BaseColumn> columnsToDelete = new HashSet<>(); for ( int selectedColumnIndex : selectedColumnIndexes ) { final int columnIndex = findUiColumnIndex( selectedColumnIndex ); final BaseColumn column = model.getExpandedColumns().get( columnIndex ); if ( !( column instanceof RowNumberCol52 || column instanceof DescriptionCol52 ) ) { columnsToDelete.add( column ); } } for ( BaseColumn columnToDelete : columnsToDelete ) { if ( columnToDelete instanceof AttributeCol52 ) { deleteColumn( (AttributeCol52) columnToDelete ); } else if ( columnToDelete instanceof MetadataCol52 ) { deleteColumn( (MetadataCol52) columnToDelete ); } else if ( columnToDelete instanceof ConditionCol52 ) { deleteColumn( (ConditionCol52) columnToDelete ); } else if ( columnToDelete instanceof ActionCol52 ) { deleteColumn( (ActionCol52) columnToDelete ); } } }
Source:
public void close() { Config.getInstance().soundManager.stopAllPlaylists(); primaryStage.close(); }

Target:
public void close() { Platform.exit(); System.exit(0); }
Source:
private String countHashSum(VirtualFile virtualFile, HashFunction hashFunction) throws ServerException { final PathLockFactory.PathLock lock = pathLockFactory.getLock(virtualFile.getVirtualFilePath(), false).acquire(LOCK_FILE_TIMEOUT); try { return ByteSource.concat().hash(hashFunction).toString(); } catch (IOException e) { throw new ServerException(e); } finally { lock.release(); } }

Target:
private String countHashSum(VirtualFile virtualFile, HashFunction hashFunction) throws ServerException { final PathLockFactory.PathLock lock = pathLockFactory.getLock(virtualFile.getVirtualFilePath(), false).acquire(LOCK_FILE_TIMEOUT); try (InputStream contentStream = virtualFile.getContent().getStream()) { return ByteSource.wrap(ByteStreams.toByteArray(contentStream)).hash(hashFunction).toString(); } catch (ForbiddenException e) { throw new ServerException(e.getServiceError()); } catch (IOException e) { throw new ServerException(e); } finally { lock.release(); } }
Source:
public void test_none_duplicate_responses() throws InterruptedException{ Microservices gateway = Microservices.builder() .build(); Microservices node = Microservices.builder() .seeds(gateway.cluster().address()) .services(new SimpleGenerator()) .build(); GeneratorService service = gateway.proxy().api(GeneratorService.class).create(); List<String> results = new ArrayList<String>(); service.generate().subscribe(r ->results.add("s1: " + r.data)); service.generate().subscribe(r ->results.add("s2: " + r.data)); TimeUnit.SECONDS.sleep(5); assertEquals(results.get(0),"s1: 1 => 1"); assertEquals(results.get(1),"s2: 2 => 1"); assertEquals(results.get(2),"s1: 1 => 2"); assertEquals(results.get(3),"s2: 2 => 2"); assertEquals(results.get(4),"s1: 1 => 3"); assertEquals(results.get(5),"s2: 2 => 3"); }

Target:
public void test_none_duplicate_responses() throws InterruptedException { Microservices gateway = Microservices.builder() .build(); Microservices node = Microservices.builder() .seeds(gateway.cluster().address()) .services(new SimpleGenerator()) .build(); GeneratorService service = gateway.proxy().api(GeneratorService.class).create(); Map<String, String> results = new ConcurrentHashMap<>(); CountDownLatch latch = new CountDownLatch(7); Subscription subscription1 = service.generate().serialize().subscribe(r -> { results.put(r.data, "s1"); latch.countDown(); }); Subscription subscription2 = service.generate().serialize().subscribe(r -> { latch.countDown(); results.put(r.data, "s2"); }); latch.await(2, TimeUnit.SECONDS); assertEquals("s1", results.get("1 => 1")); assertEquals("s2", results.get("2 => 1")); assertEquals("s1", results.get("1 => 2")); assertEquals("s2", results.get("2 => 2")); assertEquals("s1", results.get("1 => 3")); assertEquals("s2", results.get("2 => 3")); subscription1.unsubscribe(); subscription2.unsubscribe(); node.shutdown(); gateway.shutdown(); }
Source:
public TraceContext(NodeBuilder rootNode, long startTime, TraceReporter reporter) { this.rootNode = rootNode; trace = new Trace(); trace.setId(UUID.randomUUID().toString()); trace.setStartTime(startTime); rootNode.setNodePath(String.format("%s:0", trace.getId())); this.reporter = reporter; }

Target:
public TraceContext(NodeBuilder rootNode, long startTime, TraceReporter reporter) { this.rootNode = rootNode; this.reporter = reporter; trace = new Trace(); trace.setId(UUID.randomUUID().toString()); trace.setStartTime(startTime); rootNode.setNodePath(String.format("%s:0", trace.getId())); }
Source:
public Reporter<Span> reporter(ReporterMetrics reporterMetrics, ZipkinProperties zipkin, @Qualifier(SENDER_BEAN_NAME) Sender sender) { AsyncReporter<Span> asyncReporter = AsyncReporter.builder(sender) .queuedMaxSpans(1000) .messageTimeout(zipkin.getMessageTimeout(), TimeUnit.SECONDS) .metrics(reporterMetrics).build(zipkin.getEncoder()); CheckResult checkResult = checkResult(asyncReporter); if (log.isDebugEnabled()) { log.debug("Check result of the async reporter is [" + checkResult + "]"); } return asyncReporter; }

Target:
public Reporter<Span> reporter(ReporterMetrics reporterMetrics, ZipkinProperties zipkin, @Qualifier(SENDER_BEAN_NAME) Sender sender) { AsyncReporter<Span> asyncReporter = AsyncReporter.builder(sender) .queuedMaxSpans(1000) .messageTimeout(zipkin.getMessageTimeout(), TimeUnit.SECONDS) .metrics(reporterMetrics).build(zipkin.getEncoder()); CheckResult checkResult = checkResult(asyncReporter); logCheckResult(asyncReporter, checkResult); return asyncReporter; }
Source:
public HiveOrcLocalMemoryContext(LocalMemoryContext delegate) { this.delegate = delegate; }

Target:
HiveOrcLocalMemoryContext(LocalMemoryContext delegate) { this.delegate = requireNonNull(delegate, "delegate is null"); }
Source:
public void testTemplateOverridingStoreByValue() throws Exception { cacheManager = cachingProvider.getCacheManager( getClass().getResource("/org/ehcache/docs/ehcache-jsr107-template-override.xml").toURI(), getClass().getClassLoader()); MutableConfiguration<Long, String> mutableConfiguration = new MutableConfiguration<Long, String>(); mutableConfiguration.setTypes(Long.class, String.class); Cache<Long, String> myCache = null; myCache = cacheManager.createCache("anyCache", mutableConfiguration); myCache.put(1L, "foo"); assertNotSame("foo", myCache.get(1L)); myCache = cacheManager.createCache("byRefCache", mutableConfiguration); myCache.put(1L, "foo"); assertSame("foo", myCache.get(1L)); myCache = cacheManager.createCache("weirdCache", mutableConfiguration); myCache.put(1L, "foo"); assertNotSame("foo", myCache.get(1L)); }

Target:
public void testTemplateOverridingStoreByValue() throws Exception { cacheManager = cachingProvider.getCacheManager( getClass().getResource("/org/ehcache/docs/ehcache-jsr107-template-override.xml").toURI(), getClass().getClassLoader()); MutableConfiguration<Long, String> mutableConfiguration = new MutableConfiguration<Long, String>(); mutableConfiguration.setTypes(Long.class, String.class); Cache<Long, String> myCache = null; myCache = cacheManager.createCache("anyCache", mutableConfiguration); myCache.put(1L, "foo"); assertNotSame("foo", myCache.get(1L)); assertTrue(myCache.getConfiguration(Configuration.class).isStoreByValue()); myCache = cacheManager.createCache("byRefCache", mutableConfiguration); myCache.put(1L, "foo"); assertSame("foo", myCache.get(1L)); assertFalse(myCache.getConfiguration(Configuration.class).isStoreByValue()); myCache = cacheManager.createCache("weirdCache1", mutableConfiguration); myCache.put(1L, "foo"); assertNotSame("foo", myCache.get(1L)); assertTrue(myCache.getConfiguration(Configuration.class).isStoreByValue()); myCache = cacheManager.createCache("weirdCache2", mutableConfiguration); myCache.put(1L, "foo"); assertSame("foo", myCache.get(1L)); assertFalse(myCache.getConfiguration(Configuration.class).isStoreByValue()); }
Source:
public GitUser getUser() { String name = null; String email = null; try { Map<String, String> preferences = requestFactory.fromUrl(preferencessUrl) .useGetMethod() .addQueryParam("filter", "git.committer.\\w+") .request() .asProperties(); name = preferences.get("git.committer.name"); email = preferences.get("git.committer.email"); } catch (ServerException | IOException | ForbiddenException | BadRequestException | ConflictException | NotFoundException | UnauthorizedException e) { LOG.error(e.getLocalizedMessage(), e); } GitUser gitUser = newDto(GitUser.class); if (!isNullOrEmpty(name)) { gitUser.setName(name); } if (!isNullOrEmpty(email)) { gitUser.setEmail(email); } return gitUser; }

Target:
public GitUser getUser() { String name = null; String email = null; try { Map<String, String> preferences = requestFactory.fromUrl(apiUrl + "/preferences") .useGetMethod() .addQueryParam("filter", "git.committer.\\w+") .request() .asProperties(); name = preferences.get("git.committer.name"); email = preferences.get("git.committer.email"); } catch (ApiException | IOException e) { LOG.error(e.getLocalizedMessage(), e); } GitUser gitUser = newDto(GitUser.class); if (!isNullOrEmpty(name)) { gitUser.setName(name); } if (!isNullOrEmpty(email)) { gitUser.setEmail(email); } return gitUser; }
Source:
public void resultsAreReadable() throws IOException { List<ReadRowsResponse> responses = generateReadRowsResponses("rowKey-%s", 3); List<Row> rows = TO_ROWS_LIST_FUNCTION.apply(responses); checkKeysAreEqual(responses, rows); }

Target:
public void resultsAreReadable() throws IOException { List<ReadRowsResponse> responses = generateReadRowsResponses("rowKey-%s", 3); List<Row> rows = new ArrayList<>(); Iterator<ReadRowsResponse> iterator = responses.iterator(); while (iterator.hasNext()) { rows.add(RowMerger.readNextRow(iterator)); } Assert.assertEquals(responses.size(), rows.size()); for (int i = 0; i < responses.size(); i++) { Assert.assertEquals(responses.get(i).getRowKey(), rows.get(i).getKey()); } }
Source:
public void testEmpty2DQuery() throws IndexOutOfBoundsException, TimeRangeException, StateSystemDisposedException { ITmfStateSystem ss = fStateSystem; assertNotNull(ss); Collection<Long> times = Collections.singleton(Long.valueOf(77)); Iterable<ITmfStateInterval> iterable = ss.query2D(Collections.emptyList(), times); assertNotNull(iterable); }

Target:
public void testEmpty2DQuery() throws IndexOutOfBoundsException, TimeRangeException, StateSystemDisposedException { ITmfStateSystem ss = fStateSystem; assertNotNull(ss); Iterable<ITmfStateInterval> iterable = ss.query2D(Collections.emptyList(), Collections.singleton(77L)); assertNotNull(iterable); assertTrue(Iterables.isEmpty(iterable)); iterable = ss.query2D(Collections.singleton(0), Collections.emptyList()); assertNotNull(iterable); assertTrue(Iterables.isEmpty(iterable)); iterable = ss.query2D(Collections.emptyList(), 77L, 78L); assertNotNull(iterable); assertTrue(Iterables.isEmpty(iterable)); }
Source:
public void shouldNotifyEventWhenCreateAnnotation() { captureAndVerifyAnnotationEventNotification(() -> { Annotation createdAnnotation = createAnnotationAndAddSubscription("CommentAdded", "Creation"); return session.getDocument(new IdRef(createdAnnotation.getId())); }, COMMENT_ADDED, DOCUMENT_CREATED, 2); }

Target:
public void shouldNotifyEventWhenCreateAnnotation() { captureAndVerifyAnnotationEventNotification(() -> { Annotation createdAnnotation = createAnnotationAndAddSubscription("CommentAdded", "Creation"); return session.getDocument(new IdRef(createdAnnotation.getId())); }, COMMENT_ADDED, DOCUMENT_CREATED); }
Source:
public CacheGroupMetricsImpl(CacheGroupContext ctx) { this.ctx = ctx; MetricRegistry mreg = ctx.shared().kernalContext().metric().registry(metricGroupName()); mreg.register("Caches", this::getCaches, List.class, null); storageSize = mreg.register("StorageSize", () -> database().forGroupPageStores(ctx, PageStore::size), "Storage space allocated for group, in bytes."); sparseStorageSize = mreg.register("SparseStorageSize", () -> database().forGroupPageStores(ctx, PageStore::getSparseSize), "Storage space allocated for group adjusted for possible sparsity, in bytes."); idxBuildCntPartitionsLeft = mreg.longMetric("IndexBuildCountPartitionsLeft", "Number of partitions need processed for finished indexes create or rebuilding."); DataRegion region = ctx.dataRegion(); if (region != null) { DataRegionMetricsImpl dataRegionMetrics = ctx.dataRegion().memoryMetrics(); grpPageAllocationTracker = dataRegionMetrics.getOrAllocateGroupPageAllocationTracker(ctx.cacheOrGroupName()); } else grpPageAllocationTracker = new LongAdderMetric("NO_OP", null); }

Target:
public CacheGroupMetricsImpl(CacheGroupContext ctx) { this.ctx = ctx; CacheConfiguration cacheCfg = ctx.config(); DataStorageConfiguration dsCfg = ctx.shared().kernalContext().config().getDataStorageConfiguration(); boolean persistentEnabled = CU.isPersistentCache(cacheCfg, dsCfg); MetricRegistry mreg = ctx.shared().kernalContext().metric().registry(metricGroupName()); mreg.register("Caches", this::getCaches, List.class, null); storageSize = mreg.register("StorageSize", () -> persistentEnabled ? database().forGroupPageStores(ctx, PageStore::size) : 0, "Storage space allocated for group, in bytes."); sparseStorageSize = mreg.register("SparseStorageSize", () -> persistentEnabled ? database().forGroupPageStores(ctx, PageStore::getSparseSize) : 0, "Storage space allocated for group adjusted for possible sparsity, in bytes."); idxBuildCntPartitionsLeft = mreg.longMetric("IndexBuildCountPartitionsLeft", "Number of partitions need processed for finished indexes create or rebuilding."); DataRegion region = ctx.dataRegion(); if (region != null) { DataRegionMetricsImpl dataRegionMetrics = ctx.dataRegion().memoryMetrics(); grpPageAllocationTracker = dataRegionMetrics.getOrAllocateGroupPageAllocationTracker(ctx.cacheOrGroupName()); } else grpPageAllocationTracker = new LongAdderMetric("NO_OP", null); }
Source:
public DefaultSocks5CommandRequest( Socks5CommandType type, Socks5AddressType dstAddrType, String dstAddr, int dstPort) { ObjectUtil.checkNotNull(dstAddrType, "dstAddrType"); ObjectUtil.checkNotNull(dstAddr, "dstAddr"); if (dstAddrType == Socks5AddressType.IPv4) { if (!NetUtil.isValidIpV4Address(dstAddr)) { throw new IllegalArgumentException("dstAddr: " + dstAddr + " (expected: a valid IPv4 address)"); } } else if (dstAddrType == Socks5AddressType.DOMAIN) { dstAddr = IDN.toASCII(dstAddr); if (dstAddr.length() > 255) { throw new IllegalArgumentException("dstAddr: " + dstAddr + " (expected: less than 256 chars)"); } } else if (dstAddrType == Socks5AddressType.IPv6) { if (!NetUtil.isValidIpV6Address(dstAddr)) { throw new IllegalArgumentException("dstAddr: " + dstAddr + " (expected: a valid IPv6 address"); } } if (dstPort < 0 || dstPort > 65535) { throw new IllegalArgumentException("dstPort: " + dstPort + " (expected: 0~65535)"); } this.type = ObjectUtil.checkNotNull(type, "type"); this.dstAddrType = dstAddrType; this.dstAddr = dstAddr; this.dstPort = dstPort; }

Target:
public DefaultSocks5CommandRequest( Socks5CommandType type, Socks5AddressType dstAddrType, String dstAddr, int dstPort) { this.type = ObjectUtil.checkNotNull(type, "type"); ObjectUtil.checkNotNull(dstAddrType, "dstAddrType"); ObjectUtil.checkNotNull(dstAddr, "dstAddr"); if (dstAddrType == Socks5AddressType.IPv4) { if (!NetUtil.isValidIpV4Address(dstAddr)) { throw new IllegalArgumentException("dstAddr: " + dstAddr + " (expected: a valid IPv4 address)"); } } else if (dstAddrType == Socks5AddressType.DOMAIN) { dstAddr = IDN.toASCII(dstAddr); if (dstAddr.length() > 255) { throw new IllegalArgumentException("dstAddr: " + dstAddr + " (expected: less than 256 chars)"); } } else if (dstAddrType == Socks5AddressType.IPv6) { if (!NetUtil.isValidIpV6Address(dstAddr)) { throw new IllegalArgumentException("dstAddr: " + dstAddr + " (expected: a valid IPv6 address"); } } if (dstPort < 0 || dstPort > 65535) { throw new IllegalArgumentException("dstPort: " + dstPort + " (expected: 0~65535)"); } this.dstAddrType = dstAddrType; this.dstAddr = dstAddr; this.dstPort = dstPort; }