id int32 0 165k | repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 |
|---|---|---|---|---|---|---|---|---|---|---|---|
126,200 | alibaba/ARouter | arouter-compiler/src/main/java/com/alibaba/android/arouter/compiler/utils/TypeUtils.java | TypeUtils.typeExchange | public int typeExchange(Element element) {
TypeMirror typeMirror = element.asType();
// Primitive
if (typeMirror.getKind().isPrimitive()) {
return element.asType().getKind().ordinal();
}
switch (typeMirror.toString()) {
case BYTE:
return ... | java | public int typeExchange(Element element) {
TypeMirror typeMirror = element.asType();
// Primitive
if (typeMirror.getKind().isPrimitive()) {
return element.asType().getKind().ordinal();
}
switch (typeMirror.toString()) {
case BYTE:
return ... | [
"public",
"int",
"typeExchange",
"(",
"Element",
"element",
")",
"{",
"TypeMirror",
"typeMirror",
"=",
"element",
".",
"asType",
"(",
")",
";",
"// Primitive",
"if",
"(",
"typeMirror",
".",
"getKind",
"(",
")",
".",
"isPrimitive",
"(",
")",
")",
"{",
"re... | Diagnostics out the true java type
@param element Raw type
@return Type class of java | [
"Diagnostics",
"out",
"the",
"true",
"java",
"type"
] | 1a06912a6e14a57112db1204b43f81c43d721732 | https://github.com/alibaba/ARouter/blob/1a06912a6e14a57112db1204b43f81c43d721732/arouter-compiler/src/main/java/com/alibaba/android/arouter/compiler/utils/TypeUtils.java#L48-L87 |
126,201 | alibaba/ARouter | arouter-annotation/src/main/java/com/alibaba/android/arouter/facade/model/RouteMeta.java | RouteMeta.build | public static RouteMeta build(RouteType type, Class<?> destination, String path, String group, int priority, int extra) {
return new RouteMeta(type, null, destination, null, path, group, null, priority, extra);
} | java | public static RouteMeta build(RouteType type, Class<?> destination, String path, String group, int priority, int extra) {
return new RouteMeta(type, null, destination, null, path, group, null, priority, extra);
} | [
"public",
"static",
"RouteMeta",
"build",
"(",
"RouteType",
"type",
",",
"Class",
"<",
"?",
">",
"destination",
",",
"String",
"path",
",",
"String",
"group",
",",
"int",
"priority",
",",
"int",
"extra",
")",
"{",
"return",
"new",
"RouteMeta",
"(",
"type... | For versions of 'compiler' less than 1.0.7, contain 1.0.7
@param type type
@param destination destination
@param path path
@param group group
@param priority priority
@param extra extra
@return this | [
"For",
"versions",
"of",
"compiler",
"less",
"than",
"1",
".",
"0",
".",
"7",
"contain",
"1",
".",
"0",
".",
"7"
] | 1a06912a6e14a57112db1204b43f81c43d721732 | https://github.com/alibaba/ARouter/blob/1a06912a6e14a57112db1204b43f81c43d721732/arouter-annotation/src/main/java/com/alibaba/android/arouter/facade/model/RouteMeta.java#L45-L47 |
126,202 | alibaba/ARouter | arouter-api/src/main/java/com/alibaba/android/arouter/utils/TextUtils.java | TextUtils.formatStackTrace | public static String formatStackTrace(StackTraceElement[] stackTrace) {
StringBuilder sb = new StringBuilder();
for (StackTraceElement element : stackTrace) {
sb.append(" at ").append(element.toString());
sb.append("\n");
}
return sb.toString();
} | java | public static String formatStackTrace(StackTraceElement[] stackTrace) {
StringBuilder sb = new StringBuilder();
for (StackTraceElement element : stackTrace) {
sb.append(" at ").append(element.toString());
sb.append("\n");
}
return sb.toString();
} | [
"public",
"static",
"String",
"formatStackTrace",
"(",
"StackTraceElement",
"[",
"]",
"stackTrace",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"StackTraceElement",
"element",
":",
"stackTrace",
")",
"{",
"sb",
".",... | Print thread stack | [
"Print",
"thread",
"stack"
] | 1a06912a6e14a57112db1204b43f81c43d721732 | https://github.com/alibaba/ARouter/blob/1a06912a6e14a57112db1204b43f81c43d721732/arouter-api/src/main/java/com/alibaba/android/arouter/utils/TextUtils.java#L25-L32 |
126,203 | alibaba/ARouter | arouter-api/src/main/java/com/alibaba/android/arouter/utils/TextUtils.java | TextUtils.splitQueryParameters | public static Map<String, String> splitQueryParameters(Uri rawUri) {
String query = rawUri.getEncodedQuery();
if (query == null) {
return Collections.emptyMap();
}
Map<String, String> paramMap = new LinkedHashMap<>();
int start = 0;
do {
int next... | java | public static Map<String, String> splitQueryParameters(Uri rawUri) {
String query = rawUri.getEncodedQuery();
if (query == null) {
return Collections.emptyMap();
}
Map<String, String> paramMap = new LinkedHashMap<>();
int start = 0;
do {
int next... | [
"public",
"static",
"Map",
"<",
"String",
",",
"String",
">",
"splitQueryParameters",
"(",
"Uri",
"rawUri",
")",
"{",
"String",
"query",
"=",
"rawUri",
".",
"getEncodedQuery",
"(",
")",
";",
"if",
"(",
"query",
"==",
"null",
")",
"{",
"return",
"Collecti... | Split query parameters
@param rawUri raw uri
@return map with params | [
"Split",
"query",
"parameters"
] | 1a06912a6e14a57112db1204b43f81c43d721732 | https://github.com/alibaba/ARouter/blob/1a06912a6e14a57112db1204b43f81c43d721732/arouter-api/src/main/java/com/alibaba/android/arouter/utils/TextUtils.java#L39-L69 |
126,204 | apache/incubator-zipkin | zipkin/src/main/java/zipkin2/internal/DateUtil.java | DateUtil.midnightUTC | public static long midnightUTC(long epochMillis) {
Calendar day = Calendar.getInstance(UTC);
day.setTimeInMillis(epochMillis);
day.set(Calendar.MILLISECOND, 0);
day.set(Calendar.SECOND, 0);
day.set(Calendar.MINUTE, 0);
day.set(Calendar.HOUR_OF_DAY, 0);
return day.getTimeInMillis();
} | java | public static long midnightUTC(long epochMillis) {
Calendar day = Calendar.getInstance(UTC);
day.setTimeInMillis(epochMillis);
day.set(Calendar.MILLISECOND, 0);
day.set(Calendar.SECOND, 0);
day.set(Calendar.MINUTE, 0);
day.set(Calendar.HOUR_OF_DAY, 0);
return day.getTimeInMillis();
} | [
"public",
"static",
"long",
"midnightUTC",
"(",
"long",
"epochMillis",
")",
"{",
"Calendar",
"day",
"=",
"Calendar",
".",
"getInstance",
"(",
"UTC",
")",
";",
"day",
".",
"setTimeInMillis",
"(",
"epochMillis",
")",
";",
"day",
".",
"set",
"(",
"Calendar",
... | For bucketed data floored to the day. For example, dependency links. | [
"For",
"bucketed",
"data",
"floored",
"to",
"the",
"day",
".",
"For",
"example",
"dependency",
"links",
"."
] | 89b2fab983fc626b3be32ce9d7cf64b3f01f1a87 | https://github.com/apache/incubator-zipkin/blob/89b2fab983fc626b3be32ce9d7cf64b3f01f1a87/zipkin/src/main/java/zipkin2/internal/DateUtil.java#L30-L38 |
126,205 | apache/incubator-zipkin | zipkin-junit/src/main/java/zipkin2/junit/ZipkinRule.java | ZipkinRule.storeSpans | public ZipkinRule storeSpans(List<Span> spans) {
try {
storage.accept(spans).execute();
} catch (IOException e) {
throw Platform.get().uncheckedIOException(e);
}
return this;
} | java | public ZipkinRule storeSpans(List<Span> spans) {
try {
storage.accept(spans).execute();
} catch (IOException e) {
throw Platform.get().uncheckedIOException(e);
}
return this;
} | [
"public",
"ZipkinRule",
"storeSpans",
"(",
"List",
"<",
"Span",
">",
"spans",
")",
"{",
"try",
"{",
"storage",
".",
"accept",
"(",
"spans",
")",
".",
"execute",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"Platform",
".",... | Stores the given spans directly, to setup preconditions for a test.
<p>For example, if you are testing what happens when instrumentation adds a child to a trace,
you'd add the parent here. | [
"Stores",
"the",
"given",
"spans",
"directly",
"to",
"setup",
"preconditions",
"for",
"a",
"test",
"."
] | 89b2fab983fc626b3be32ce9d7cf64b3f01f1a87 | https://github.com/apache/incubator-zipkin/blob/89b2fab983fc626b3be32ce9d7cf64b3f01f1a87/zipkin-junit/src/main/java/zipkin2/junit/ZipkinRule.java#L102-L109 |
126,206 | apache/incubator-zipkin | zipkin-junit/src/main/java/zipkin2/junit/ZipkinRule.java | ZipkinRule.getTrace | @Nullable
public List<Span> getTrace(String traceId) {
try {
return storage.spanStore().getTrace(traceId).execute();
} catch (IOException e) {
throw Platform.get().assertionError("I/O exception in in-memory storage", e);
}
} | java | @Nullable
public List<Span> getTrace(String traceId) {
try {
return storage.spanStore().getTrace(traceId).execute();
} catch (IOException e) {
throw Platform.get().assertionError("I/O exception in in-memory storage", e);
}
} | [
"@",
"Nullable",
"public",
"List",
"<",
"Span",
">",
"getTrace",
"(",
"String",
"traceId",
")",
"{",
"try",
"{",
"return",
"storage",
".",
"spanStore",
"(",
")",
".",
"getTrace",
"(",
"traceId",
")",
".",
"execute",
"(",
")",
";",
"}",
"catch",
"(",
... | Retrieves a trace by ID which zipkin server has received, or null if not present. | [
"Retrieves",
"a",
"trace",
"by",
"ID",
"which",
"zipkin",
"server",
"has",
"received",
"or",
"null",
"if",
"not",
"present",
"."
] | 89b2fab983fc626b3be32ce9d7cf64b3f01f1a87 | https://github.com/apache/incubator-zipkin/blob/89b2fab983fc626b3be32ce9d7cf64b3f01f1a87/zipkin-junit/src/main/java/zipkin2/junit/ZipkinRule.java#L133-L140 |
126,207 | apache/incubator-zipkin | zipkin-autoconfigure/collector-scribe/src/main/java/zipkin2/autoconfigure/collector/scribe/ZipkinScribeCollectorAutoConfiguration.java | ZipkinScribeCollectorAutoConfiguration.scribe | @Bean(initMethod = "start")
ScribeCollector scribe(
ZipkinScribeCollectorProperties scribe,
CollectorSampler sampler,
CollectorMetrics metrics,
StorageComponent storage) {
return scribe.toBuilder().sampler(sampler).metrics(metrics).storage(storage).build();
} | java | @Bean(initMethod = "start")
ScribeCollector scribe(
ZipkinScribeCollectorProperties scribe,
CollectorSampler sampler,
CollectorMetrics metrics,
StorageComponent storage) {
return scribe.toBuilder().sampler(sampler).metrics(metrics).storage(storage).build();
} | [
"@",
"Bean",
"(",
"initMethod",
"=",
"\"start\"",
")",
"ScribeCollector",
"scribe",
"(",
"ZipkinScribeCollectorProperties",
"scribe",
",",
"CollectorSampler",
"sampler",
",",
"CollectorMetrics",
"metrics",
",",
"StorageComponent",
"storage",
")",
"{",
"return",
"scrib... | The init method will block until the scribe port is listening, or crash on port conflict | [
"The",
"init",
"method",
"will",
"block",
"until",
"the",
"scribe",
"port",
"is",
"listening",
"or",
"crash",
"on",
"port",
"conflict"
] | 89b2fab983fc626b3be32ce9d7cf64b3f01f1a87 | https://github.com/apache/incubator-zipkin/blob/89b2fab983fc626b3be32ce9d7cf64b3f01f1a87/zipkin-autoconfigure/collector-scribe/src/main/java/zipkin2/autoconfigure/collector/scribe/ZipkinScribeCollectorAutoConfiguration.java#L38-L45 |
126,208 | apache/incubator-zipkin | zipkin-collector/core/src/main/java/zipkin2/collector/Collector.java | Collector.newBuilder | public static Builder newBuilder(Class<?> loggingClass) {
if (loggingClass == null) throw new NullPointerException("loggingClass == null");
return new Builder(Logger.getLogger(loggingClass.getName()));
} | java | public static Builder newBuilder(Class<?> loggingClass) {
if (loggingClass == null) throw new NullPointerException("loggingClass == null");
return new Builder(Logger.getLogger(loggingClass.getName()));
} | [
"public",
"static",
"Builder",
"newBuilder",
"(",
"Class",
"<",
"?",
">",
"loggingClass",
")",
"{",
"if",
"(",
"loggingClass",
"==",
"null",
")",
"throw",
"new",
"NullPointerException",
"(",
"\"loggingClass == null\"",
")",
";",
"return",
"new",
"Builder",
"("... | Needed to scope this to the correct logging category | [
"Needed",
"to",
"scope",
"this",
"to",
"the",
"correct",
"logging",
"category"
] | 89b2fab983fc626b3be32ce9d7cf64b3f01f1a87 | https://github.com/apache/incubator-zipkin/blob/89b2fab983fc626b3be32ce9d7cf64b3f01f1a87/zipkin-collector/core/src/main/java/zipkin2/collector/Collector.java#L44-L47 |
126,209 | apache/incubator-zipkin | zipkin-collector/core/src/main/java/zipkin2/collector/Collector.java | Collector.errorStoringSpans | RuntimeException errorStoringSpans(List<Span> spans, Throwable e) {
metrics.incrementSpansDropped(spans.size());
// The exception could be related to a span being huge. Instead of filling logs,
// print trace id, span id pairs
StringBuilder msg = appendSpanIds(spans, new StringBuilder("Cannot store span... | java | RuntimeException errorStoringSpans(List<Span> spans, Throwable e) {
metrics.incrementSpansDropped(spans.size());
// The exception could be related to a span being huge. Instead of filling logs,
// print trace id, span id pairs
StringBuilder msg = appendSpanIds(spans, new StringBuilder("Cannot store span... | [
"RuntimeException",
"errorStoringSpans",
"(",
"List",
"<",
"Span",
">",
"spans",
",",
"Throwable",
"e",
")",
"{",
"metrics",
".",
"incrementSpansDropped",
"(",
"spans",
".",
"size",
"(",
")",
")",
";",
"// The exception could be related to a span being huge. Instead o... | When storing spans, an exception can be raised before or after the fact. This adds context of
span ids to give logs more relevance. | [
"When",
"storing",
"spans",
"an",
"exception",
"can",
"be",
"raised",
"before",
"or",
"after",
"the",
"fact",
".",
"This",
"adds",
"context",
"of",
"span",
"ids",
"to",
"give",
"logs",
"more",
"relevance",
"."
] | 89b2fab983fc626b3be32ce9d7cf64b3f01f1a87 | https://github.com/apache/incubator-zipkin/blob/89b2fab983fc626b3be32ce9d7cf64b3f01f1a87/zipkin-collector/core/src/main/java/zipkin2/collector/Collector.java#L211-L217 |
126,210 | apache/incubator-zipkin | zipkin/src/main/java/zipkin2/internal/DelayLimiter.java | DelayLimiter.shouldInvoke | public boolean shouldInvoke(C context) {
cleanupExpiredSuppressions();
if (cache.containsKey(context)) return false;
Suppression<C> suppression = new Suppression<>(ticker, context, ticker.read() + ttlNanos);
if (cache.putIfAbsent(context, suppression) != null) return false; // lost race
suppress... | java | public boolean shouldInvoke(C context) {
cleanupExpiredSuppressions();
if (cache.containsKey(context)) return false;
Suppression<C> suppression = new Suppression<>(ticker, context, ticker.read() + ttlNanos);
if (cache.putIfAbsent(context, suppression) != null) return false; // lost race
suppress... | [
"public",
"boolean",
"shouldInvoke",
"(",
"C",
"context",
")",
"{",
"cleanupExpiredSuppressions",
"(",
")",
";",
"if",
"(",
"cache",
".",
"containsKey",
"(",
"context",
")",
")",
"return",
"false",
";",
"Suppression",
"<",
"C",
">",
"suppression",
"=",
"ne... | Returns true if a given context should be invoked. | [
"Returns",
"true",
"if",
"a",
"given",
"context",
"should",
"be",
"invoked",
"."
] | 89b2fab983fc626b3be32ce9d7cf64b3f01f1a87 | https://github.com/apache/incubator-zipkin/blob/89b2fab983fc626b3be32ce9d7cf64b3f01f1a87/zipkin/src/main/java/zipkin2/internal/DelayLimiter.java#L91-L106 |
126,211 | apache/incubator-zipkin | zipkin-collector/core/src/main/java/zipkin2/collector/CollectorSampler.java | CollectorSampler.isSampled | public boolean isSampled(String hexTraceId, boolean debug) {
if (Boolean.TRUE.equals(debug)) return true;
long traceId = HexCodec.lowerHexToUnsignedLong(hexTraceId);
// The absolute value of Long.MIN_VALUE is larger than a long, so Math.abs returns identity.
// This converts to MAX_VALUE to avoid always... | java | public boolean isSampled(String hexTraceId, boolean debug) {
if (Boolean.TRUE.equals(debug)) return true;
long traceId = HexCodec.lowerHexToUnsignedLong(hexTraceId);
// The absolute value of Long.MIN_VALUE is larger than a long, so Math.abs returns identity.
// This converts to MAX_VALUE to avoid always... | [
"public",
"boolean",
"isSampled",
"(",
"String",
"hexTraceId",
",",
"boolean",
"debug",
")",
"{",
"if",
"(",
"Boolean",
".",
"TRUE",
".",
"equals",
"(",
"debug",
")",
")",
"return",
"true",
";",
"long",
"traceId",
"=",
"HexCodec",
".",
"lowerHexToUnsignedL... | Returns true if spans with this trace ID should be recorded to storage.
<p>Zipkin v1 allows storage-layer sampling, which can help prevent spikes in traffic from
overloading the system. Debug spans are always stored.
<p>This uses only the lower 64 bits of the trace ID as instrumentation still send mixed trace
ID widt... | [
"Returns",
"true",
"if",
"spans",
"with",
"this",
"trace",
"ID",
"should",
"be",
"recorded",
"to",
"storage",
"."
] | 89b2fab983fc626b3be32ce9d7cf64b3f01f1a87 | https://github.com/apache/incubator-zipkin/blob/89b2fab983fc626b3be32ce9d7cf64b3f01f1a87/zipkin-collector/core/src/main/java/zipkin2/collector/CollectorSampler.java#L66-L73 |
126,212 | apache/incubator-zipkin | zipkin/src/main/java/zipkin2/internal/JsonEscaper.java | JsonEscaper.jsonEscape | public static CharSequence jsonEscape(CharSequence v) {
int length = v.length();
if (length == 0) return v;
int afterReplacement = 0;
StringBuilder builder = null;
for (int i = 0; i < length; i++) {
char c = v.charAt(i);
String replacement;
if (c < 0x80) {
replacement = RE... | java | public static CharSequence jsonEscape(CharSequence v) {
int length = v.length();
if (length == 0) return v;
int afterReplacement = 0;
StringBuilder builder = null;
for (int i = 0; i < length; i++) {
char c = v.charAt(i);
String replacement;
if (c < 0x80) {
replacement = RE... | [
"public",
"static",
"CharSequence",
"jsonEscape",
"(",
"CharSequence",
"v",
")",
"{",
"int",
"length",
"=",
"v",
".",
"length",
"(",
")",
";",
"if",
"(",
"length",
"==",
"0",
")",
"return",
"v",
";",
"int",
"afterReplacement",
"=",
"0",
";",
"StringBui... | Exposed for ElasticSearch HttpBulkIndexer | [
"Exposed",
"for",
"ElasticSearch",
"HttpBulkIndexer"
] | 89b2fab983fc626b3be32ce9d7cf64b3f01f1a87 | https://github.com/apache/incubator-zipkin/blob/89b2fab983fc626b3be32ce9d7cf64b3f01f1a87/zipkin/src/main/java/zipkin2/internal/JsonEscaper.java#L21-L54 |
126,213 | apache/incubator-zipkin | zipkin/src/main/java/zipkin2/storage/QueryRequest.java | QueryRequest.annotationQueryString | @Nullable public String annotationQueryString() {
StringBuilder result = new StringBuilder();
for (Iterator<Map.Entry<String, String>> i = annotationQuery().entrySet().iterator();
i.hasNext(); ) {
Map.Entry<String, String> next = i.next();
result.append(next.getKey());
if (!next.getValu... | java | @Nullable public String annotationQueryString() {
StringBuilder result = new StringBuilder();
for (Iterator<Map.Entry<String, String>> i = annotationQuery().entrySet().iterator();
i.hasNext(); ) {
Map.Entry<String, String> next = i.next();
result.append(next.getKey());
if (!next.getValu... | [
"@",
"Nullable",
"public",
"String",
"annotationQueryString",
"(",
")",
"{",
"StringBuilder",
"result",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"Iterator",
"<",
"Map",
".",
"Entry",
"<",
"String",
",",
"String",
">",
">",
"i",
"=",
"annot... | Corresponds to query parameter "annotationQuery". Ex. "http.method=GET and error"
@see QueryRequest.Builder#parseAnnotationQuery(String) | [
"Corresponds",
"to",
"query",
"parameter",
"annotationQuery",
".",
"Ex",
".",
"http",
".",
"method",
"=",
"GET",
"and",
"error"
] | 89b2fab983fc626b3be32ce9d7cf64b3f01f1a87 | https://github.com/apache/incubator-zipkin/blob/89b2fab983fc626b3be32ce9d7cf64b3f01f1a87/zipkin/src/main/java/zipkin2/storage/QueryRequest.java#L125-L137 |
126,214 | apache/incubator-zipkin | zipkin-storage/cassandra/src/main/java/zipkin2/storage/cassandra/DefaultSessionFactory.java | DefaultSessionFactory.create | @Override
public Session create(CassandraStorage cassandra) {
Closer closer = Closer.create();
try {
Cluster cluster = closer.register(buildCluster(cassandra));
cluster.register(new QueryLogger.Builder().build());
Session session;
String keyspace = cassandra.keyspace();
if (cassa... | java | @Override
public Session create(CassandraStorage cassandra) {
Closer closer = Closer.create();
try {
Cluster cluster = closer.register(buildCluster(cassandra));
cluster.register(new QueryLogger.Builder().build());
Session session;
String keyspace = cassandra.keyspace();
if (cassa... | [
"@",
"Override",
"public",
"Session",
"create",
"(",
"CassandraStorage",
"cassandra",
")",
"{",
"Closer",
"closer",
"=",
"Closer",
".",
"create",
"(",
")",
";",
"try",
"{",
"Cluster",
"cluster",
"=",
"closer",
".",
"register",
"(",
"buildCluster",
"(",
"ca... | Creates a session and ensures schema if configured. Closes the cluster and session if any
exception occurred. | [
"Creates",
"a",
"session",
"and",
"ensures",
"schema",
"if",
"configured",
".",
"Closes",
"the",
"cluster",
"and",
"session",
"if",
"any",
"exception",
"occurred",
"."
] | 89b2fab983fc626b3be32ce9d7cf64b3f01f1a87 | https://github.com/apache/incubator-zipkin/blob/89b2fab983fc626b3be32ce9d7cf64b3f01f1a87/zipkin-storage/cassandra/src/main/java/zipkin2/storage/cassandra/DefaultSessionFactory.java#L53-L80 |
126,215 | apache/incubator-zipkin | zipkin-storage/cassandra/src/main/java/zipkin2/storage/cassandra/DefaultSessionFactory.java | DefaultSessionFactory.findConnectPort | static int findConnectPort(List<InetSocketAddress> contactPoints) {
Set<Integer> ports = Sets.newLinkedHashSet();
for (InetSocketAddress contactPoint : contactPoints) {
ports.add(contactPoint.getPort());
}
return ports.size() == 1 ? ports.iterator().next() : 9042;
} | java | static int findConnectPort(List<InetSocketAddress> contactPoints) {
Set<Integer> ports = Sets.newLinkedHashSet();
for (InetSocketAddress contactPoint : contactPoints) {
ports.add(contactPoint.getPort());
}
return ports.size() == 1 ? ports.iterator().next() : 9042;
} | [
"static",
"int",
"findConnectPort",
"(",
"List",
"<",
"InetSocketAddress",
">",
"contactPoints",
")",
"{",
"Set",
"<",
"Integer",
">",
"ports",
"=",
"Sets",
".",
"newLinkedHashSet",
"(",
")",
";",
"for",
"(",
"InetSocketAddress",
"contactPoint",
":",
"contactP... | Returns the consistent port across all contact points or 9042 | [
"Returns",
"the",
"consistent",
"port",
"across",
"all",
"contact",
"points",
"or",
"9042"
] | 89b2fab983fc626b3be32ce9d7cf64b3f01f1a87 | https://github.com/apache/incubator-zipkin/blob/89b2fab983fc626b3be32ce9d7cf64b3f01f1a87/zipkin-storage/cassandra/src/main/java/zipkin2/storage/cassandra/DefaultSessionFactory.java#L138-L144 |
126,216 | apache/incubator-zipkin | zipkin/src/main/java/zipkin2/internal/Proto3SpanWriter.java | Proto3SpanWriter.writeList | public byte[] writeList(List<Span> spans) {
int lengthOfSpans = spans.size();
if (lengthOfSpans == 0) return EMPTY_ARRAY;
if (lengthOfSpans == 1) return write(spans.get(0));
int sizeInBytes = 0;
int[] sizeOfValues = new int[lengthOfSpans];
for (int i = 0; i < lengthOfSpans; i++) {
int siz... | java | public byte[] writeList(List<Span> spans) {
int lengthOfSpans = spans.size();
if (lengthOfSpans == 0) return EMPTY_ARRAY;
if (lengthOfSpans == 1) return write(spans.get(0));
int sizeInBytes = 0;
int[] sizeOfValues = new int[lengthOfSpans];
for (int i = 0; i < lengthOfSpans; i++) {
int siz... | [
"public",
"byte",
"[",
"]",
"writeList",
"(",
"List",
"<",
"Span",
">",
"spans",
")",
"{",
"int",
"lengthOfSpans",
"=",
"spans",
".",
"size",
"(",
")",
";",
"if",
"(",
"lengthOfSpans",
"==",
"0",
")",
"return",
"EMPTY_ARRAY",
";",
"if",
"(",
"lengthO... | Encodes per ListOfSpans data wireType, where field one is repeated spans | [
"Encodes",
"per",
"ListOfSpans",
"data",
"wireType",
"where",
"field",
"one",
"is",
"repeated",
"spans"
] | 89b2fab983fc626b3be32ce9d7cf64b3f01f1a87 | https://github.com/apache/incubator-zipkin/blob/89b2fab983fc626b3be32ce9d7cf64b3f01f1a87/zipkin/src/main/java/zipkin2/internal/Proto3SpanWriter.java#L43-L59 |
126,217 | apache/incubator-zipkin | zipkin/src/main/java/zipkin2/internal/Proto3SpanWriter.java | Proto3SpanWriter.writeSpan | void writeSpan(Span span, int sizeOfSpan, Buffer result) {
result.writeByte(SPAN.key);
result.writeVarint(sizeOfSpan); // length prefix
SPAN.writeValue(result, span);
} | java | void writeSpan(Span span, int sizeOfSpan, Buffer result) {
result.writeByte(SPAN.key);
result.writeVarint(sizeOfSpan); // length prefix
SPAN.writeValue(result, span);
} | [
"void",
"writeSpan",
"(",
"Span",
"span",
",",
"int",
"sizeOfSpan",
",",
"Buffer",
"result",
")",
"{",
"result",
".",
"writeByte",
"(",
"SPAN",
".",
"key",
")",
";",
"result",
".",
"writeVarint",
"(",
"sizeOfSpan",
")",
";",
"// length prefix",
"SPAN",
"... | prevents resizing twice | [
"prevents",
"resizing",
"twice"
] | 89b2fab983fc626b3be32ce9d7cf64b3f01f1a87 | https://github.com/apache/incubator-zipkin/blob/89b2fab983fc626b3be32ce9d7cf64b3f01f1a87/zipkin/src/main/java/zipkin2/internal/Proto3SpanWriter.java#L69-L73 |
126,218 | apache/incubator-zipkin | zipkin-junit/src/main/java/zipkin2/junit/HttpFailure.java | HttpFailure.sendErrorResponse | public static HttpFailure sendErrorResponse(int code, String body) {
return new HttpFailure(new MockResponse().setResponseCode(code).setBody(body));
} | java | public static HttpFailure sendErrorResponse(int code, String body) {
return new HttpFailure(new MockResponse().setResponseCode(code).setBody(body));
} | [
"public",
"static",
"HttpFailure",
"sendErrorResponse",
"(",
"int",
"code",
",",
"String",
"body",
")",
"{",
"return",
"new",
"HttpFailure",
"(",
"new",
"MockResponse",
"(",
")",
".",
"setResponseCode",
"(",
"code",
")",
".",
"setBody",
"(",
"body",
")",
"... | Ex code 400 when the server cannot read the spans | [
"Ex",
"code",
"400",
"when",
"the",
"server",
"cannot",
"read",
"the",
"spans"
] | 89b2fab983fc626b3be32ce9d7cf64b3f01f1a87 | https://github.com/apache/incubator-zipkin/blob/89b2fab983fc626b3be32ce9d7cf64b3f01f1a87/zipkin-junit/src/main/java/zipkin2/junit/HttpFailure.java#L36-L38 |
126,219 | apache/incubator-zipkin | zipkin-server/src/main/java/zipkin2/server/internal/ZipkinHttpCollector.java | ZipkinHttpCollector.validateAndStoreSpans | HttpResponse validateAndStoreSpans(SpanBytesDecoder decoder, byte[] serializedSpans) {
// logging already handled upstream in UnzippingBytesRequestConverter where request context exists
if (serializedSpans.length == 0) return HttpResponse.of(HttpStatus.ACCEPTED);
try {
SpanBytesDecoderDetector.decoder... | java | HttpResponse validateAndStoreSpans(SpanBytesDecoder decoder, byte[] serializedSpans) {
// logging already handled upstream in UnzippingBytesRequestConverter where request context exists
if (serializedSpans.length == 0) return HttpResponse.of(HttpStatus.ACCEPTED);
try {
SpanBytesDecoderDetector.decoder... | [
"HttpResponse",
"validateAndStoreSpans",
"(",
"SpanBytesDecoder",
"decoder",
",",
"byte",
"[",
"]",
"serializedSpans",
")",
"{",
"// logging already handled upstream in UnzippingBytesRequestConverter where request context exists",
"if",
"(",
"serializedSpans",
".",
"length",
"=="... | This synchronously decodes the message so that users can see data errors. | [
"This",
"synchronously",
"decodes",
"the",
"message",
"so",
"that",
"users",
"can",
"see",
"data",
"errors",
"."
] | 89b2fab983fc626b3be32ce9d7cf64b3f01f1a87 | https://github.com/apache/incubator-zipkin/blob/89b2fab983fc626b3be32ce9d7cf64b3f01f1a87/zipkin-server/src/main/java/zipkin2/server/internal/ZipkinHttpCollector.java#L111-L137 |
126,220 | apache/incubator-zipkin | zipkin-storage/elasticsearch/src/main/java/zipkin2/elasticsearch/internal/JsonReaders.java | JsonReaders.enterPath | @Nullable
public static JsonReader enterPath(JsonReader reader, String path1, String path2)
throws IOException {
return enterPath(reader, path1) != null ? enterPath(reader, path2) : null;
} | java | @Nullable
public static JsonReader enterPath(JsonReader reader, String path1, String path2)
throws IOException {
return enterPath(reader, path1) != null ? enterPath(reader, path2) : null;
} | [
"@",
"Nullable",
"public",
"static",
"JsonReader",
"enterPath",
"(",
"JsonReader",
"reader",
",",
"String",
"path1",
",",
"String",
"path2",
")",
"throws",
"IOException",
"{",
"return",
"enterPath",
"(",
"reader",
",",
"path1",
")",
"!=",
"null",
"?",
"enter... | This saves you from having to define nested types to read a single value
<p>Instead of defining two types like this, and double-checking null..
<pre>{@code
class Response {
Message message;
}
class Message {
String status;
}
JsonAdapter<Response> adapter = moshi.adapter(Response.class);
Message message = adapter.from... | [
"This",
"saves",
"you",
"from",
"having",
"to",
"define",
"nested",
"types",
"to",
"read",
"a",
"single",
"value"
] | 89b2fab983fc626b3be32ce9d7cf64b3f01f1a87 | https://github.com/apache/incubator-zipkin/blob/89b2fab983fc626b3be32ce9d7cf64b3f01f1a87/zipkin-storage/elasticsearch/src/main/java/zipkin2/elasticsearch/internal/JsonReaders.java#L54-L58 |
126,221 | apache/incubator-zipkin | zipkin-storage/elasticsearch/src/main/java/zipkin2/elasticsearch/VersionSpecificTemplates.java | VersionSpecificTemplates.spanIndexTemplate | String spanIndexTemplate() {
String result =
"{\n"
+ " \"TEMPLATE\": \"${__INDEX__}:"
+ SPAN
+ "-*\",\n"
+ " \"settings\": {\n"
+ " \"index.number_of_shards\": ${__NUMBER_OF_SHARDS__},\n"
+ " \"index.number_of_replicas\": ${__NU... | java | String spanIndexTemplate() {
String result =
"{\n"
+ " \"TEMPLATE\": \"${__INDEX__}:"
+ SPAN
+ "-*\",\n"
+ " \"settings\": {\n"
+ " \"index.number_of_shards\": ${__NUMBER_OF_SHARDS__},\n"
+ " \"index.number_of_replicas\": ${__NU... | [
"String",
"spanIndexTemplate",
"(",
")",
"{",
"String",
"result",
"=",
"\"{\\n\"",
"+",
"\" \\\"TEMPLATE\\\": \\\"${__INDEX__}:\"",
"+",
"SPAN",
"+",
"\"-*\\\",\\n\"",
"+",
"\" \\\"settings\\\": {\\n\"",
"+",
"\" \\\"index.number_of_shards\\\": ${__NUMBER_OF_SHARDS__},\\n\""... | Templatized due to version differences. Only fields used in search are declared | [
"Templatized",
"due",
"to",
"version",
"differences",
".",
"Only",
"fields",
"used",
"in",
"search",
"are",
"declared"
] | 89b2fab983fc626b3be32ce9d7cf64b3f01f1a87 | https://github.com/apache/incubator-zipkin/blob/89b2fab983fc626b3be32ce9d7cf64b3f01f1a87/zipkin-storage/elasticsearch/src/main/java/zipkin2/elasticsearch/VersionSpecificTemplates.java#L64-L154 |
126,222 | apache/incubator-zipkin | zipkin-server/src/main/java/zipkin2/server/internal/prometheus/ZipkinPrometheusMetricsConfiguration.java | ZipkinPrometheusMetricsConfiguration.notFoundMetricCollector | @Bean
@Order(1)
ArmeriaServerConfigurator notFoundMetricCollector() {
// Use glob instead of catch-all to avoid adding it to the trie router.
return sb -> sb.service(PathMapping.ofGlob("/**"), (ctx, req) -> HttpResponse.of(HttpStatus.NOT_FOUND));
} | java | @Bean
@Order(1)
ArmeriaServerConfigurator notFoundMetricCollector() {
// Use glob instead of catch-all to avoid adding it to the trie router.
return sb -> sb.service(PathMapping.ofGlob("/**"), (ctx, req) -> HttpResponse.of(HttpStatus.NOT_FOUND));
} | [
"@",
"Bean",
"@",
"Order",
"(",
"1",
")",
"ArmeriaServerConfigurator",
"notFoundMetricCollector",
"(",
")",
"{",
"// Use glob instead of catch-all to avoid adding it to the trie router.",
"return",
"sb",
"->",
"sb",
".",
"service",
"(",
"PathMapping",
".",
"ofGlob",
"("... | service is handled by this. | [
"service",
"is",
"handled",
"by",
"this",
"."
] | 89b2fab983fc626b3be32ce9d7cf64b3f01f1a87 | https://github.com/apache/incubator-zipkin/blob/89b2fab983fc626b3be32ce9d7cf64b3f01f1a87/zipkin-server/src/main/java/zipkin2/server/internal/prometheus/ZipkinPrometheusMetricsConfiguration.java#L75-L80 |
126,223 | apache/incubator-zipkin | zipkin-server/src/main/java/zipkin2/server/internal/prometheus/ZipkinPrometheusMetricsConfiguration.java | ZipkinPrometheusMetricsConfiguration.uri | private static Tag uri(RequestLog requestLog) {
int status = requestLog.statusCode();
if (status > 299 && status < 400) return URI_REDIRECTION;
if (status == 404) return URI_NOT_FOUND;
String uri = getPathInfo(requestLog);
if (uri.startsWith("/zipkin")) {
if (uri.equals("/zipkin/") || uri.equ... | java | private static Tag uri(RequestLog requestLog) {
int status = requestLog.statusCode();
if (status > 299 && status < 400) return URI_REDIRECTION;
if (status == 404) return URI_NOT_FOUND;
String uri = getPathInfo(requestLog);
if (uri.startsWith("/zipkin")) {
if (uri.equals("/zipkin/") || uri.equ... | [
"private",
"static",
"Tag",
"uri",
"(",
"RequestLog",
"requestLog",
")",
"{",
"int",
"status",
"=",
"requestLog",
".",
"statusCode",
"(",
")",
";",
"if",
"(",
"status",
">",
"299",
"&&",
"status",
"<",
"400",
")",
"return",
"URI_REDIRECTION",
";",
"if",
... | Ensure metrics cardinality doesn't blow up on variables | [
"Ensure",
"metrics",
"cardinality",
"doesn",
"t",
"blow",
"up",
"on",
"variables"
] | 89b2fab983fc626b3be32ce9d7cf64b3f01f1a87 | https://github.com/apache/incubator-zipkin/blob/89b2fab983fc626b3be32ce9d7cf64b3f01f1a87/zipkin-server/src/main/java/zipkin2/server/internal/prometheus/ZipkinPrometheusMetricsConfiguration.java#L141-L163 |
126,224 | apache/incubator-zipkin | zipkin-server/src/main/java/zipkin2/server/internal/prometheus/ZipkinPrometheusMetricsConfiguration.java | ZipkinPrometheusMetricsConfiguration.getPathInfo | static String getPathInfo(RequestLog requestLog) {
String uri = requestLog.path();
if (!StringUtils.hasText(uri)) return "/";
return uri.replaceAll("//+", "/")
.replaceAll("/$", "");
} | java | static String getPathInfo(RequestLog requestLog) {
String uri = requestLog.path();
if (!StringUtils.hasText(uri)) return "/";
return uri.replaceAll("//+", "/")
.replaceAll("/$", "");
} | [
"static",
"String",
"getPathInfo",
"(",
"RequestLog",
"requestLog",
")",
"{",
"String",
"uri",
"=",
"requestLog",
".",
"path",
"(",
")",
";",
"if",
"(",
"!",
"StringUtils",
".",
"hasText",
"(",
"uri",
")",
")",
"return",
"\"/\"",
";",
"return",
"uri",
... | from io.micrometer.spring.web.servlet.WebMvcTags | [
"from",
"io",
".",
"micrometer",
".",
"spring",
".",
"web",
".",
"servlet",
".",
"WebMvcTags"
] | 89b2fab983fc626b3be32ce9d7cf64b3f01f1a87 | https://github.com/apache/incubator-zipkin/blob/89b2fab983fc626b3be32ce9d7cf64b3f01f1a87/zipkin-server/src/main/java/zipkin2/server/internal/prometheus/ZipkinPrometheusMetricsConfiguration.java#L166-L171 |
126,225 | apache/incubator-zipkin | zipkin/src/main/java/zipkin2/internal/Dependencies.java | Dependencies.fromThrift | public static Dependencies fromThrift(ByteBuffer bytes) {
long startTs = 0L;
long endTs = 0L;
List<DependencyLink> links = Collections.emptyList();
while (true) {
ThriftField thriftField = ThriftField.read(bytes);
if (thriftField.type == TYPE_STOP) break;
if (thriftField.isEqualTo(ST... | java | public static Dependencies fromThrift(ByteBuffer bytes) {
long startTs = 0L;
long endTs = 0L;
List<DependencyLink> links = Collections.emptyList();
while (true) {
ThriftField thriftField = ThriftField.read(bytes);
if (thriftField.type == TYPE_STOP) break;
if (thriftField.isEqualTo(ST... | [
"public",
"static",
"Dependencies",
"fromThrift",
"(",
"ByteBuffer",
"bytes",
")",
"{",
"long",
"startTs",
"=",
"0L",
";",
"long",
"endTs",
"=",
"0L",
";",
"List",
"<",
"DependencyLink",
">",
"links",
"=",
"Collections",
".",
"emptyList",
"(",
")",
";",
... | Reads from bytes serialized in TBinaryProtocol | [
"Reads",
"from",
"bytes",
"serialized",
"in",
"TBinaryProtocol"
] | 89b2fab983fc626b3be32ce9d7cf64b3f01f1a87 | https://github.com/apache/incubator-zipkin/blob/89b2fab983fc626b3be32ce9d7cf64b3f01f1a87/zipkin/src/main/java/zipkin2/internal/Dependencies.java#L49-L75 |
126,226 | apache/incubator-zipkin | zipkin/src/main/java/zipkin2/internal/Dependencies.java | Dependencies.toThrift | public ByteBuffer toThrift() {
Buffer buffer = Buffer.allocate(sizeInBytes());
write(buffer);
return ByteBuffer.wrap(buffer.toByteArray());
} | java | public ByteBuffer toThrift() {
Buffer buffer = Buffer.allocate(sizeInBytes());
write(buffer);
return ByteBuffer.wrap(buffer.toByteArray());
} | [
"public",
"ByteBuffer",
"toThrift",
"(",
")",
"{",
"Buffer",
"buffer",
"=",
"Buffer",
".",
"allocate",
"(",
"sizeInBytes",
"(",
")",
")",
";",
"write",
"(",
"buffer",
")",
";",
"return",
"ByteBuffer",
".",
"wrap",
"(",
"buffer",
".",
"toByteArray",
"(",
... | Writes the current instance in TBinaryProtocol | [
"Writes",
"the",
"current",
"instance",
"in",
"TBinaryProtocol"
] | 89b2fab983fc626b3be32ce9d7cf64b3f01f1a87 | https://github.com/apache/incubator-zipkin/blob/89b2fab983fc626b3be32ce9d7cf64b3f01f1a87/zipkin/src/main/java/zipkin2/internal/Dependencies.java#L78-L82 |
126,227 | apache/incubator-zipkin | zipkin/src/main/java/zipkin2/internal/Dependencies.java | Dependencies.create | public static Dependencies create(long startTs, long endTs, List<DependencyLink> links) {
return new Dependencies(startTs, endTs, links);
} | java | public static Dependencies create(long startTs, long endTs, List<DependencyLink> links) {
return new Dependencies(startTs, endTs, links);
} | [
"public",
"static",
"Dependencies",
"create",
"(",
"long",
"startTs",
",",
"long",
"endTs",
",",
"List",
"<",
"DependencyLink",
">",
"links",
")",
"{",
"return",
"new",
"Dependencies",
"(",
"startTs",
",",
"endTs",
",",
"links",
")",
";",
"}"
] | timestamps are in epoch milliseconds | [
"timestamps",
"are",
"in",
"epoch",
"milliseconds"
] | 89b2fab983fc626b3be32ce9d7cf64b3f01f1a87 | https://github.com/apache/incubator-zipkin/blob/89b2fab983fc626b3be32ce9d7cf64b3f01f1a87/zipkin/src/main/java/zipkin2/internal/Dependencies.java#L107-L109 |
126,228 | apache/incubator-zipkin | zipkin/src/main/java/zipkin2/Call.java | Call.propagateIfFatal | public static void propagateIfFatal(Throwable t) {
if (t instanceof VirtualMachineError) {
throw (VirtualMachineError) t;
} else if (t instanceof ThreadDeath) {
throw (ThreadDeath) t;
} else if (t instanceof LinkageError) {
throw (LinkageError) t;
}
} | java | public static void propagateIfFatal(Throwable t) {
if (t instanceof VirtualMachineError) {
throw (VirtualMachineError) t;
} else if (t instanceof ThreadDeath) {
throw (ThreadDeath) t;
} else if (t instanceof LinkageError) {
throw (LinkageError) t;
}
} | [
"public",
"static",
"void",
"propagateIfFatal",
"(",
"Throwable",
"t",
")",
"{",
"if",
"(",
"t",
"instanceof",
"VirtualMachineError",
")",
"{",
"throw",
"(",
"VirtualMachineError",
")",
"t",
";",
"}",
"else",
"if",
"(",
"t",
"instanceof",
"ThreadDeath",
")",... | Taken from RxJava throwIfFatal, which was taken from scala | [
"Taken",
"from",
"RxJava",
"throwIfFatal",
"which",
"was",
"taken",
"from",
"scala"
] | 89b2fab983fc626b3be32ce9d7cf64b3f01f1a87 | https://github.com/apache/incubator-zipkin/blob/89b2fab983fc626b3be32ce9d7cf64b3f01f1a87/zipkin/src/main/java/zipkin2/Call.java#L139-L147 |
126,229 | apache/incubator-zipkin | zipkin/src/main/java/zipkin2/storage/InMemoryStorage.java | ServiceNameToTraceIds.removeServiceIfTraceId | Set<String> removeServiceIfTraceId(String lowTraceId) {
Set<String> result = new LinkedHashSet<>();
for (Map.Entry<String, Collection<String>> entry : delegate.entrySet()) {
Collection<String> lowTraceIds = entry.getValue();
if (lowTraceIds.remove(lowTraceId) && lowTraceIds.isEmpty()) {
... | java | Set<String> removeServiceIfTraceId(String lowTraceId) {
Set<String> result = new LinkedHashSet<>();
for (Map.Entry<String, Collection<String>> entry : delegate.entrySet()) {
Collection<String> lowTraceIds = entry.getValue();
if (lowTraceIds.remove(lowTraceId) && lowTraceIds.isEmpty()) {
... | [
"Set",
"<",
"String",
">",
"removeServiceIfTraceId",
"(",
"String",
"lowTraceId",
")",
"{",
"Set",
"<",
"String",
">",
"result",
"=",
"new",
"LinkedHashSet",
"<>",
"(",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"Collection",
"<",
"... | Returns service names orphaned by removing the trace ID | [
"Returns",
"service",
"names",
"orphaned",
"by",
"removing",
"the",
"trace",
"ID"
] | 89b2fab983fc626b3be32ce9d7cf64b3f01f1a87 | https://github.com/apache/incubator-zipkin/blob/89b2fab983fc626b3be32ce9d7cf64b3f01f1a87/zipkin/src/main/java/zipkin2/storage/InMemoryStorage.java#L453-L463 |
126,230 | apache/incubator-zipkin | zipkin/src/main/java/zipkin2/internal/Buffer.java | Buffer.utf8SizeInBytes | public static int utf8SizeInBytes(CharSequence string) {
int sizeInBytes = 0;
for (int i = 0, len = string.length(); i < len; i++) {
char ch = string.charAt(i);
if (ch < 0x80) {
sizeInBytes++; // 7-bit ASCII character
// This could be an ASCII run, or possibly entirely ASCII
... | java | public static int utf8SizeInBytes(CharSequence string) {
int sizeInBytes = 0;
for (int i = 0, len = string.length(); i < len; i++) {
char ch = string.charAt(i);
if (ch < 0x80) {
sizeInBytes++; // 7-bit ASCII character
// This could be an ASCII run, or possibly entirely ASCII
... | [
"public",
"static",
"int",
"utf8SizeInBytes",
"(",
"CharSequence",
"string",
")",
"{",
"int",
"sizeInBytes",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"len",
"=",
"string",
".",
"length",
"(",
")",
";",
"i",
"<",
"len",
";",
"i",
"++",
... | This returns the bytes needed to transcode a UTF-16 Java String to UTF-8 bytes.
<p>Originally based on
http://stackoverflow.com/questions/8511490/calculating-length-in-utf-8-of-java-string-without-actually-encoding-it
<p>Later, ASCII run and malformed surrogate logic borrowed from okio.Utf8 | [
"This",
"returns",
"the",
"bytes",
"needed",
"to",
"transcode",
"a",
"UTF",
"-",
"16",
"Java",
"String",
"to",
"UTF",
"-",
"8",
"bytes",
"."
] | 89b2fab983fc626b3be32ce9d7cf64b3f01f1a87 | https://github.com/apache/incubator-zipkin/blob/89b2fab983fc626b3be32ce9d7cf64b3f01f1a87/zipkin/src/main/java/zipkin2/internal/Buffer.java#L42-L71 |
126,231 | apache/incubator-zipkin | zipkin/src/main/java/zipkin2/internal/Buffer.java | Buffer.asciiSizeInBytes | public static int asciiSizeInBytes(long v) {
if (v == 0) return 1;
if (v == Long.MIN_VALUE) return 20;
boolean negative = false;
if (v < 0) {
v = -v; // making this positive allows us to compare using less-than
negative = true;
}
int width =
v < 100000000L
? v < 10000L... | java | public static int asciiSizeInBytes(long v) {
if (v == 0) return 1;
if (v == Long.MIN_VALUE) return 20;
boolean negative = false;
if (v < 0) {
v = -v; // making this positive allows us to compare using less-than
negative = true;
}
int width =
v < 100000000L
? v < 10000L... | [
"public",
"static",
"int",
"asciiSizeInBytes",
"(",
"long",
"v",
")",
"{",
"if",
"(",
"v",
"==",
"0",
")",
"return",
"1",
";",
"if",
"(",
"v",
"==",
"Long",
".",
"MIN_VALUE",
")",
"return",
"20",
";",
"boolean",
"negative",
"=",
"false",
";",
"if",... | Binary search for character width which favors matching lower numbers.
<p>Adapted from okio.Buffer | [
"Binary",
"search",
"for",
"character",
"width",
"which",
"favors",
"matching",
"lower",
"numbers",
"."
] | 89b2fab983fc626b3be32ce9d7cf64b3f01f1a87 | https://github.com/apache/incubator-zipkin/blob/89b2fab983fc626b3be32ce9d7cf64b3f01f1a87/zipkin/src/main/java/zipkin2/internal/Buffer.java#L78-L100 |
126,232 | apache/incubator-zipkin | zipkin/src/main/java/zipkin2/internal/Buffer.java | Buffer.writeUtf8 | public void writeUtf8(CharSequence string) {
for (int i = 0, len = string.length(); i < len; i++) {
char ch = string.charAt(i);
if (ch < 0x80) { // 7-bit ASCII character
writeByte(ch);
// This could be an ASCII run, or possibly entirely ASCII
while (i < len - 1) {
ch = ... | java | public void writeUtf8(CharSequence string) {
for (int i = 0, len = string.length(); i < len; i++) {
char ch = string.charAt(i);
if (ch < 0x80) { // 7-bit ASCII character
writeByte(ch);
// This could be an ASCII run, or possibly entirely ASCII
while (i < len - 1) {
ch = ... | [
"public",
"void",
"writeUtf8",
"(",
"CharSequence",
"string",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"len",
"=",
"string",
".",
"length",
"(",
")",
";",
"i",
"<",
"len",
";",
"i",
"++",
")",
"{",
"char",
"ch",
"=",
"string",
".",
"cha... | This transcodes a UTF-16 Java String to UTF-8 bytes.
<p>This looks most similar to {@code io.netty.buffer.ByteBufUtil.writeUtf8(AbstractByteBuf,
int, CharSequence, int)} v4.1, modified including features to address ASCII runs of text. | [
"This",
"transcodes",
"a",
"UTF",
"-",
"16",
"Java",
"String",
"to",
"UTF",
"-",
"8",
"bytes",
"."
] | 89b2fab983fc626b3be32ce9d7cf64b3f01f1a87 | https://github.com/apache/incubator-zipkin/blob/89b2fab983fc626b3be32ce9d7cf64b3f01f1a87/zipkin/src/main/java/zipkin2/internal/Buffer.java#L160-L203 |
126,233 | apache/incubator-zipkin | zipkin/src/main/java/zipkin2/internal/Buffer.java | Buffer.writeAscii | public void writeAscii(long v) {
if (v == 0) {
writeByte('0');
return;
}
if (v == Long.MIN_VALUE) {
writeAscii("-9223372036854775808");
return;
}
if (v < 0) {
writeByte('-');
v = -v; // needs to be positive so we can use this for an array index
}
writeB... | java | public void writeAscii(long v) {
if (v == 0) {
writeByte('0');
return;
}
if (v == Long.MIN_VALUE) {
writeAscii("-9223372036854775808");
return;
}
if (v < 0) {
writeByte('-');
v = -v; // needs to be positive so we can use this for an array index
}
writeB... | [
"public",
"void",
"writeAscii",
"(",
"long",
"v",
")",
"{",
"if",
"(",
"v",
"==",
"0",
")",
"{",
"writeByte",
"(",
"'",
"'",
")",
";",
"return",
";",
"}",
"if",
"(",
"v",
"==",
"Long",
".",
"MIN_VALUE",
")",
"{",
"writeAscii",
"(",
"\"-9223372036... | Adapted from okio.Buffer.writeDecimalLong | [
"Adapted",
"from",
"okio",
".",
"Buffer",
".",
"writeDecimalLong"
] | 89b2fab983fc626b3be32ce9d7cf64b3f01f1a87 | https://github.com/apache/incubator-zipkin/blob/89b2fab983fc626b3be32ce9d7cf64b3f01f1a87/zipkin/src/main/java/zipkin2/internal/Buffer.java#L206-L223 |
126,234 | apache/incubator-zipkin | zipkin/src/main/java/zipkin2/internal/Buffer.java | Buffer.readVarint32 | int readVarint32() {
byte b; // negative number implies MSB set
if ((b = readByte()) >= 0) {
return b;
}
int result = b & 0x7f;
if ((b = readByte()) >= 0) {
return result | b << 7;
}
result |= (b & 0x7f) << 7;
if ((b = readByte()) >= 0) {
return result | b << 14;
... | java | int readVarint32() {
byte b; // negative number implies MSB set
if ((b = readByte()) >= 0) {
return b;
}
int result = b & 0x7f;
if ((b = readByte()) >= 0) {
return result | b << 7;
}
result |= (b & 0x7f) << 7;
if ((b = readByte()) >= 0) {
return result | b << 14;
... | [
"int",
"readVarint32",
"(",
")",
"{",
"byte",
"b",
";",
"// negative number implies MSB set",
"if",
"(",
"(",
"b",
"=",
"readByte",
"(",
")",
")",
">=",
"0",
")",
"{",
"return",
"b",
";",
"}",
"int",
"result",
"=",
"b",
"&",
"0x7f",
";",
"if",
"(",... | included in the main api as this is used commonly, for example reading proto tags | [
"included",
"in",
"the",
"main",
"api",
"as",
"this",
"is",
"used",
"commonly",
"for",
"example",
"reading",
"proto",
"tags"
] | 89b2fab983fc626b3be32ce9d7cf64b3f01f1a87 | https://github.com/apache/incubator-zipkin/blob/89b2fab983fc626b3be32ce9d7cf64b3f01f1a87/zipkin/src/main/java/zipkin2/internal/Buffer.java#L288-L315 |
126,235 | apache/incubator-zipkin | zipkin/src/main/java/zipkin2/storage/StrictTraceId.java | StrictTraceId.filterTraces | public static Call.Mapper<List<List<Span>>, List<List<Span>>> filterTraces(QueryRequest request) {
return new FilterTracesIfClashOnLowerTraceId(request);
} | java | public static Call.Mapper<List<List<Span>>, List<List<Span>>> filterTraces(QueryRequest request) {
return new FilterTracesIfClashOnLowerTraceId(request);
} | [
"public",
"static",
"Call",
".",
"Mapper",
"<",
"List",
"<",
"List",
"<",
"Span",
">",
">",
",",
"List",
"<",
"List",
"<",
"Span",
">",
">",
">",
"filterTraces",
"(",
"QueryRequest",
"request",
")",
"{",
"return",
"new",
"FilterTracesIfClashOnLowerTraceId"... | Filters the mutable input client-side when there's a clash on lower 64-bits of a trace ID.
@see FilterTraces | [
"Filters",
"the",
"mutable",
"input",
"client",
"-",
"side",
"when",
"there",
"s",
"a",
"clash",
"on",
"lower",
"64",
"-",
"bits",
"of",
"a",
"trace",
"ID",
"."
] | 89b2fab983fc626b3be32ce9d7cf64b3f01f1a87 | https://github.com/apache/incubator-zipkin/blob/89b2fab983fc626b3be32ce9d7cf64b3f01f1a87/zipkin/src/main/java/zipkin2/storage/StrictTraceId.java#L42-L44 |
126,236 | apache/incubator-zipkin | zipkin/src/main/java/zipkin2/storage/StrictTraceId.java | StrictTraceId.hasClashOnLowerTraceId | static boolean hasClashOnLowerTraceId(List<List<Span>> input) {
int traceCount = input.size();
if (traceCount <= 1) return false;
// NOTE: It is probably more efficient to do clever sorting and peeking here, but the call site
// is query side, which is not in the critical path of user code. A set is mu... | java | static boolean hasClashOnLowerTraceId(List<List<Span>> input) {
int traceCount = input.size();
if (traceCount <= 1) return false;
// NOTE: It is probably more efficient to do clever sorting and peeking here, but the call site
// is query side, which is not in the critical path of user code. A set is mu... | [
"static",
"boolean",
"hasClashOnLowerTraceId",
"(",
"List",
"<",
"List",
"<",
"Span",
">",
">",
"input",
")",
"{",
"int",
"traceCount",
"=",
"input",
".",
"size",
"(",
")",
";",
"if",
"(",
"traceCount",
"<=",
"1",
")",
"return",
"false",
";",
"// NOTE:... | necessary is also more efficient. | [
"necessary",
"is",
"also",
"more",
"efficient",
"."
] | 89b2fab983fc626b3be32ce9d7cf64b3f01f1a87 | https://github.com/apache/incubator-zipkin/blob/89b2fab983fc626b3be32ce9d7cf64b3f01f1a87/zipkin/src/main/java/zipkin2/storage/StrictTraceId.java#L72-L88 |
126,237 | apache/incubator-zipkin | zipkin/src/main/java/zipkin2/Span.java | Builder.clear | public Builder clear() {
traceId = null;
parentId = null;
id = null;
kind = null;
name = null;
timestamp = 0L;
duration = 0L;
localEndpoint = null;
remoteEndpoint = null;
if (annotations != null) annotations.clear();
if (tags != null) tags.clear();
... | java | public Builder clear() {
traceId = null;
parentId = null;
id = null;
kind = null;
name = null;
timestamp = 0L;
duration = 0L;
localEndpoint = null;
remoteEndpoint = null;
if (annotations != null) annotations.clear();
if (tags != null) tags.clear();
... | [
"public",
"Builder",
"clear",
"(",
")",
"{",
"traceId",
"=",
"null",
";",
"parentId",
"=",
"null",
";",
"id",
"=",
"null",
";",
"kind",
"=",
"null",
";",
"name",
"=",
"null",
";",
"timestamp",
"=",
"0L",
";",
"duration",
"=",
"0L",
";",
"localEndpo... | bit field for timestamp and duration | [
"bit",
"field",
"for",
"timestamp",
"and",
"duration"
] | 89b2fab983fc626b3be32ce9d7cf64b3f01f1a87 | https://github.com/apache/incubator-zipkin/blob/89b2fab983fc626b3be32ce9d7cf64b3f01f1a87/zipkin/src/main/java/zipkin2/Span.java#L298-L312 |
126,238 | apache/incubator-zipkin | zipkin/src/main/java/zipkin2/Span.java | Builder.merge | public Builder merge(Span source) {
if (traceId == null) traceId = source.traceId;
if (id == null) id = source.id;
if (parentId == null) parentId = source.parentId;
if (kind == null) kind = source.kind;
if (name == null) name = source.name;
if (timestamp == 0L) timestamp = source.tim... | java | public Builder merge(Span source) {
if (traceId == null) traceId = source.traceId;
if (id == null) id = source.id;
if (parentId == null) parentId = source.parentId;
if (kind == null) kind = source.kind;
if (name == null) name = source.name;
if (timestamp == 0L) timestamp = source.tim... | [
"public",
"Builder",
"merge",
"(",
"Span",
"source",
")",
"{",
"if",
"(",
"traceId",
"==",
"null",
")",
"traceId",
"=",
"source",
".",
"traceId",
";",
"if",
"(",
"id",
"==",
"null",
")",
"id",
"=",
"source",
".",
"id",
";",
"if",
"(",
"parentId",
... | Used to merge multiple incomplete spans representing the same operation on the same host. Do
not use this to merge spans that occur on different hosts. | [
"Used",
"to",
"merge",
"multiple",
"incomplete",
"spans",
"representing",
"the",
"same",
"operation",
"on",
"the",
"same",
"host",
".",
"Do",
"not",
"use",
"this",
"to",
"merge",
"spans",
"that",
"occur",
"on",
"different",
"hosts",
"."
] | 89b2fab983fc626b3be32ce9d7cf64b3f01f1a87 | https://github.com/apache/incubator-zipkin/blob/89b2fab983fc626b3be32ce9d7cf64b3f01f1a87/zipkin/src/main/java/zipkin2/Span.java#L360-L390 |
126,239 | apache/incubator-zipkin | zipkin/src/main/java/zipkin2/Span.java | Builder.traceId | public Builder traceId(long high, long low) {
if (high == 0L && low == 0L) throw new IllegalArgumentException("empty trace ID");
char[] result = new char[high != 0L ? 32 : 16];
int pos = 0;
if (high != 0L) {
writeHexLong(result, pos, high);
pos += 16;
}
writeHexLong(r... | java | public Builder traceId(long high, long low) {
if (high == 0L && low == 0L) throw new IllegalArgumentException("empty trace ID");
char[] result = new char[high != 0L ? 32 : 16];
int pos = 0;
if (high != 0L) {
writeHexLong(result, pos, high);
pos += 16;
}
writeHexLong(r... | [
"public",
"Builder",
"traceId",
"(",
"long",
"high",
",",
"long",
"low",
")",
"{",
"if",
"(",
"high",
"==",
"0L",
"&&",
"low",
"==",
"0L",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"empty trace ID\"",
")",
";",
"char",
"[",
"]",
"result",
... | Encodes 64 or 128 bits from the input into a hex trace ID.
@param high Upper 64bits of the trace ID. Zero means the trace ID is 64-bit.
@param low Lower 64bits of the trace ID.
@throws IllegalArgumentException if both values are zero | [
"Encodes",
"64",
"or",
"128",
"bits",
"from",
"the",
"input",
"into",
"a",
"hex",
"trace",
"ID",
"."
] | 89b2fab983fc626b3be32ce9d7cf64b3f01f1a87 | https://github.com/apache/incubator-zipkin/blob/89b2fab983fc626b3be32ce9d7cf64b3f01f1a87/zipkin/src/main/java/zipkin2/Span.java#L416-L427 |
126,240 | apache/incubator-zipkin | zipkin/src/main/java/zipkin2/internal/FilterTraces.java | FilterTraces.create | public static Call.Mapper<List<List<Span>>, List<List<Span>>> create(QueryRequest request) {
return new FilterTraces(request);
} | java | public static Call.Mapper<List<List<Span>>, List<List<Span>>> create(QueryRequest request) {
return new FilterTraces(request);
} | [
"public",
"static",
"Call",
".",
"Mapper",
"<",
"List",
"<",
"List",
"<",
"Span",
">",
">",
",",
"List",
"<",
"List",
"<",
"Span",
">",
">",
">",
"create",
"(",
"QueryRequest",
"request",
")",
"{",
"return",
"new",
"FilterTraces",
"(",
"request",
")"... | Filters the mutable input based on the query | [
"Filters",
"the",
"mutable",
"input",
"based",
"on",
"the",
"query"
] | 89b2fab983fc626b3be32ce9d7cf64b3f01f1a87 | https://github.com/apache/incubator-zipkin/blob/89b2fab983fc626b3be32ce9d7cf64b3f01f1a87/zipkin/src/main/java/zipkin2/internal/FilterTraces.java#L27-L29 |
126,241 | apache/incubator-zipkin | zipkin-storage/cassandra/src/main/java/zipkin2/storage/cassandra/CassandraSpanStore.java | CassandraSpanStore.initialiseSelectTraceIdsFromSpan | static SelectTraceIdsFromSpan.Factory initialiseSelectTraceIdsFromSpan(Session session) {
try {
return new SelectTraceIdsFromSpan.Factory(session);
} catch (DriverException ex) {
LOG.warn("failed to prepare annotation_query index statements: " + ex.getMessage());
return null;
}
} | java | static SelectTraceIdsFromSpan.Factory initialiseSelectTraceIdsFromSpan(Session session) {
try {
return new SelectTraceIdsFromSpan.Factory(session);
} catch (DriverException ex) {
LOG.warn("failed to prepare annotation_query index statements: " + ex.getMessage());
return null;
}
} | [
"static",
"SelectTraceIdsFromSpan",
".",
"Factory",
"initialiseSelectTraceIdsFromSpan",
"(",
"Session",
"session",
")",
"{",
"try",
"{",
"return",
"new",
"SelectTraceIdsFromSpan",
".",
"Factory",
"(",
"session",
")",
";",
"}",
"catch",
"(",
"DriverException",
"ex",
... | This makes it possible to safely drop the annotations_query SASI.
<p>If dropped, trying to search by annotation in the UI will throw an IllegalStateException. | [
"This",
"makes",
"it",
"possible",
"to",
"safely",
"drop",
"the",
"annotations_query",
"SASI",
"."
] | 89b2fab983fc626b3be32ce9d7cf64b3f01f1a87 | https://github.com/apache/incubator-zipkin/blob/89b2fab983fc626b3be32ce9d7cf64b3f01f1a87/zipkin-storage/cassandra/src/main/java/zipkin2/storage/cassandra/CassandraSpanStore.java#L105-L112 |
126,242 | apache/incubator-zipkin | zipkin-storage/cassandra/src/main/java/zipkin2/storage/cassandra/CassandraSpanStore.java | CassandraSpanStore.getTraces | @Override
public Call<List<List<Span>>> getTraces(QueryRequest request) {
if (!searchEnabled) return Call.emptyList();
TimestampRange timestampRange = timestampRange(request);
// If we have to make multiple queries, over fetch on indexes as they don't return distinct
// (trace id, timestamp) rows. Th... | java | @Override
public Call<List<List<Span>>> getTraces(QueryRequest request) {
if (!searchEnabled) return Call.emptyList();
TimestampRange timestampRange = timestampRange(request);
// If we have to make multiple queries, over fetch on indexes as they don't return distinct
// (trace id, timestamp) rows. Th... | [
"@",
"Override",
"public",
"Call",
"<",
"List",
"<",
"List",
"<",
"Span",
">",
">",
">",
"getTraces",
"(",
"QueryRequest",
"request",
")",
"{",
"if",
"(",
"!",
"searchEnabled",
")",
"return",
"Call",
".",
"emptyList",
"(",
")",
";",
"TimestampRange",
"... | This fans out into a number of requests corresponding to query input. In simplest case, there
is less than a day of data queried, and only one expression. This implies one call to fetch
trace IDs and another to retrieve the span details.
<p>The amount of backend calls increase in dimensions of query complexity, days o... | [
"This",
"fans",
"out",
"into",
"a",
"number",
"of",
"requests",
"corresponding",
"to",
"query",
"input",
".",
"In",
"simplest",
"case",
"there",
"is",
"less",
"than",
"a",
"day",
"of",
"data",
"queried",
"and",
"only",
"one",
"expression",
".",
"This",
"... | 89b2fab983fc626b3be32ce9d7cf64b3f01f1a87 | https://github.com/apache/incubator-zipkin/blob/89b2fab983fc626b3be32ce9d7cf64b3f01f1a87/zipkin-storage/cassandra/src/main/java/zipkin2/storage/cassandra/CassandraSpanStore.java#L125-L165 |
126,243 | apache/incubator-zipkin | zipkin-storage/cassandra/src/main/java/zipkin2/storage/cassandra/CassandraSpanStore.java | CassandraSpanStore.newBucketedTraceIdCall | Call<Map<String, Long>> newBucketedTraceIdCall(
QueryRequest request, TimestampRange timestampRange, int traceIndexFetchSize) {
// trace_by_service_span adds special empty-string span name in order to search by all
String spanName = null != request.spanName() ? request.spanName() : "";
Long minDuration ... | java | Call<Map<String, Long>> newBucketedTraceIdCall(
QueryRequest request, TimestampRange timestampRange, int traceIndexFetchSize) {
// trace_by_service_span adds special empty-string span name in order to search by all
String spanName = null != request.spanName() ? request.spanName() : "";
Long minDuration ... | [
"Call",
"<",
"Map",
"<",
"String",
",",
"Long",
">",
">",
"newBucketedTraceIdCall",
"(",
"QueryRequest",
"request",
",",
"TimestampRange",
"timestampRange",
",",
"int",
"traceIndexFetchSize",
")",
"{",
"// trace_by_service_span adds special empty-string span name in order t... | and speculatively query those first. | [
"and",
"speculatively",
"query",
"those",
"first",
"."
] | 89b2fab983fc626b3be32ce9d7cf64b3f01f1a87 | https://github.com/apache/incubator-zipkin/blob/89b2fab983fc626b3be32ce9d7cf64b3f01f1a87/zipkin-storage/cassandra/src/main/java/zipkin2/storage/cassandra/CassandraSpanStore.java#L181-L255 |
126,244 | apache/incubator-zipkin | zipkin/src/main/java/zipkin2/internal/ThriftCodec.java | ThriftCodec.listSizeInBytes | static <T> int listSizeInBytes(Buffer.Writer<T> writer, List<T> values) {
int sizeInBytes = 5;
for (int i = 0, length = values.size(); i < length; i++) {
sizeInBytes += writer.sizeInBytes(values.get(i));
}
return sizeInBytes;
} | java | static <T> int listSizeInBytes(Buffer.Writer<T> writer, List<T> values) {
int sizeInBytes = 5;
for (int i = 0, length = values.size(); i < length; i++) {
sizeInBytes += writer.sizeInBytes(values.get(i));
}
return sizeInBytes;
} | [
"static",
"<",
"T",
">",
"int",
"listSizeInBytes",
"(",
"Buffer",
".",
"Writer",
"<",
"T",
">",
"writer",
",",
"List",
"<",
"T",
">",
"values",
")",
"{",
"int",
"sizeInBytes",
"=",
"5",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"length",
"=",
... | Encoding overhead is thrift type plus 32-bit length prefix | [
"Encoding",
"overhead",
"is",
"thrift",
"type",
"plus",
"32",
"-",
"bit",
"length",
"prefix"
] | 89b2fab983fc626b3be32ce9d7cf64b3f01f1a87 | https://github.com/apache/incubator-zipkin/blob/89b2fab983fc626b3be32ce9d7cf64b3f01f1a87/zipkin/src/main/java/zipkin2/internal/ThriftCodec.java#L61-L67 |
126,245 | apache/incubator-zipkin | zipkin/src/main/java/zipkin2/internal/HexCodec.java | HexCodec.lowerHexToUnsignedLong | public static long lowerHexToUnsignedLong(String lowerHex) {
int length = lowerHex.length();
if (length < 1 || length > 32) throw isntLowerHexLong(lowerHex);
// trim off any high bits
int beginIndex = length > 16 ? length - 16 : 0;
return lowerHexToUnsignedLong(lowerHex, beginIndex);
} | java | public static long lowerHexToUnsignedLong(String lowerHex) {
int length = lowerHex.length();
if (length < 1 || length > 32) throw isntLowerHexLong(lowerHex);
// trim off any high bits
int beginIndex = length > 16 ? length - 16 : 0;
return lowerHexToUnsignedLong(lowerHex, beginIndex);
} | [
"public",
"static",
"long",
"lowerHexToUnsignedLong",
"(",
"String",
"lowerHex",
")",
"{",
"int",
"length",
"=",
"lowerHex",
".",
"length",
"(",
")",
";",
"if",
"(",
"length",
"<",
"1",
"||",
"length",
">",
"32",
")",
"throw",
"isntLowerHexLong",
"(",
"l... | Parses a 1 to 32 character lower-hex string with no prefix into an unsigned long, tossing any
bits higher than 64. | [
"Parses",
"a",
"1",
"to",
"32",
"character",
"lower",
"-",
"hex",
"string",
"with",
"no",
"prefix",
"into",
"an",
"unsigned",
"long",
"tossing",
"any",
"bits",
"higher",
"than",
"64",
"."
] | 89b2fab983fc626b3be32ce9d7cf64b3f01f1a87 | https://github.com/apache/incubator-zipkin/blob/89b2fab983fc626b3be32ce9d7cf64b3f01f1a87/zipkin/src/main/java/zipkin2/internal/HexCodec.java#L25-L33 |
126,246 | apache/incubator-zipkin | zipkin/src/main/java/zipkin2/internal/HexCodec.java | HexCodec.lowerHexToUnsignedLong | public static long lowerHexToUnsignedLong(String lowerHex, int index) {
long result = 0;
for (int endIndex = Math.min(index + 16, lowerHex.length()); index < endIndex; index++) {
char c = lowerHex.charAt(index);
result <<= 4;
if (c >= '0' && c <= '9') {
result |= c - '0';
} else ... | java | public static long lowerHexToUnsignedLong(String lowerHex, int index) {
long result = 0;
for (int endIndex = Math.min(index + 16, lowerHex.length()); index < endIndex; index++) {
char c = lowerHex.charAt(index);
result <<= 4;
if (c >= '0' && c <= '9') {
result |= c - '0';
} else ... | [
"public",
"static",
"long",
"lowerHexToUnsignedLong",
"(",
"String",
"lowerHex",
",",
"int",
"index",
")",
"{",
"long",
"result",
"=",
"0",
";",
"for",
"(",
"int",
"endIndex",
"=",
"Math",
".",
"min",
"(",
"index",
"+",
"16",
",",
"lowerHex",
".",
"len... | Parses a 16 character lower-hex string with no prefix into an unsigned long, starting at the
spe index. | [
"Parses",
"a",
"16",
"character",
"lower",
"-",
"hex",
"string",
"with",
"no",
"prefix",
"into",
"an",
"unsigned",
"long",
"starting",
"at",
"the",
"spe",
"index",
"."
] | 89b2fab983fc626b3be32ce9d7cf64b3f01f1a87 | https://github.com/apache/incubator-zipkin/blob/89b2fab983fc626b3be32ce9d7cf64b3f01f1a87/zipkin/src/main/java/zipkin2/internal/HexCodec.java#L39-L53 |
126,247 | apache/incubator-zipkin | zipkin/src/main/java/zipkin2/internal/Trace.java | Trace.compareEndpoint | static int compareEndpoint(Endpoint left, Endpoint right) {
if (left == null) { // nulls first
return (right == null) ? 0 : -1;
} else if (right == null) {
return 1;
}
int byService = nullSafeCompareTo(left.serviceName(), right.serviceName(), false);
if (byService != 0) return byService;... | java | static int compareEndpoint(Endpoint left, Endpoint right) {
if (left == null) { // nulls first
return (right == null) ? 0 : -1;
} else if (right == null) {
return 1;
}
int byService = nullSafeCompareTo(left.serviceName(), right.serviceName(), false);
if (byService != 0) return byService;... | [
"static",
"int",
"compareEndpoint",
"(",
"Endpoint",
"left",
",",
"Endpoint",
"right",
")",
"{",
"if",
"(",
"left",
"==",
"null",
")",
"{",
"// nulls first",
"return",
"(",
"right",
"==",
"null",
")",
"?",
"0",
":",
"-",
"1",
";",
"}",
"else",
"if",
... | Put spans with null endpoints first, so that their data can be attached to the first span with
the same ID and endpoint. It is possible that a server can get the same request on a different
port. Not addressing this. | [
"Put",
"spans",
"with",
"null",
"endpoints",
"first",
"so",
"that",
"their",
"data",
"can",
"be",
"attached",
"to",
"the",
"first",
"span",
"with",
"the",
"same",
"ID",
"and",
"endpoint",
".",
"It",
"is",
"possible",
"that",
"a",
"server",
"can",
"get",
... | 89b2fab983fc626b3be32ce9d7cf64b3f01f1a87 | https://github.com/apache/incubator-zipkin/blob/89b2fab983fc626b3be32ce9d7cf64b3f01f1a87/zipkin/src/main/java/zipkin2/internal/Trace.java#L144-L155 |
126,248 | apache/incubator-zipkin | zipkin/src/main/java/zipkin2/internal/JsonCodec.java | JsonCodec.write | public static <T> byte[] write(Buffer.Writer<T> writer, T value) {
Buffer b = Buffer.allocate(writer.sizeInBytes(value));
try {
writer.write(value, b);
} catch (RuntimeException e) {
byte[] bytes = b.toByteArray();
int lengthWritten = bytes.length;
for (int i = 0; i < bytes.length; i... | java | public static <T> byte[] write(Buffer.Writer<T> writer, T value) {
Buffer b = Buffer.allocate(writer.sizeInBytes(value));
try {
writer.write(value, b);
} catch (RuntimeException e) {
byte[] bytes = b.toByteArray();
int lengthWritten = bytes.length;
for (int i = 0; i < bytes.length; i... | [
"public",
"static",
"<",
"T",
">",
"byte",
"[",
"]",
"write",
"(",
"Buffer",
".",
"Writer",
"<",
"T",
">",
"writer",
",",
"T",
"value",
")",
"{",
"Buffer",
"b",
"=",
"Buffer",
".",
"allocate",
"(",
"writer",
".",
"sizeInBytes",
"(",
"value",
")",
... | Inability to encode is a programming bug. | [
"Inability",
"to",
"encode",
"is",
"a",
"programming",
"bug",
"."
] | 89b2fab983fc626b3be32ce9d7cf64b3f01f1a87 | https://github.com/apache/incubator-zipkin/blob/89b2fab983fc626b3be32ce9d7cf64b3f01f1a87/zipkin/src/main/java/zipkin2/internal/JsonCodec.java#L171-L207 |
126,249 | apache/incubator-zipkin | zipkin-server/src/main/java/zipkin2/server/internal/ZipkinQueryApiV2.java | ZipkinQueryApiV2.writeTraces | static byte[] writeTraces(SpanBytesEncoder codec, List<List<zipkin2.Span>> traces) {
// Get the encoded size of the nested list so that we don't need to grow the buffer
int length = traces.size();
int sizeInBytes = 2; // []
if (length > 1) sizeInBytes += length - 1; // comma to join elements
for (i... | java | static byte[] writeTraces(SpanBytesEncoder codec, List<List<zipkin2.Span>> traces) {
// Get the encoded size of the nested list so that we don't need to grow the buffer
int length = traces.size();
int sizeInBytes = 2; // []
if (length > 1) sizeInBytes += length - 1; // comma to join elements
for (i... | [
"static",
"byte",
"[",
"]",
"writeTraces",
"(",
"SpanBytesEncoder",
"codec",
",",
"List",
"<",
"List",
"<",
"zipkin2",
".",
"Span",
">",
">",
"traces",
")",
"{",
"// Get the encoded size of the nested list so that we don't need to grow the buffer",
"int",
"length",
"=... | This is inlined here as there isn't enough re-use to warrant it being in the zipkin2 library | [
"This",
"is",
"inlined",
"here",
"as",
"there",
"isn",
"t",
"enough",
"re",
"-",
"use",
"to",
"warrant",
"it",
"being",
"in",
"the",
"zipkin2",
"library"
] | 89b2fab983fc626b3be32ce9d7cf64b3f01f1a87 | https://github.com/apache/incubator-zipkin/blob/89b2fab983fc626b3be32ce9d7cf64b3f01f1a87/zipkin-server/src/main/java/zipkin2/server/internal/ZipkinQueryApiV2.java#L193-L218 |
126,250 | apache/incubator-zipkin | zipkin-server/src/main/java/zipkin2/server/internal/MetricsHealthController.java | MetricsHealthController.fetchMetricsFromMicrometer | @Get("/metrics")
@ProducesJson
public ObjectNode fetchMetricsFromMicrometer() {
ObjectNode metricsJson = factory.objectNode();
// Get the Zipkin Custom meters for constructing the Metrics endpoint
for (Meter meter : meterRegistry.getMeters()) {
String name = meter.getId().getName();
if (!nam... | java | @Get("/metrics")
@ProducesJson
public ObjectNode fetchMetricsFromMicrometer() {
ObjectNode metricsJson = factory.objectNode();
// Get the Zipkin Custom meters for constructing the Metrics endpoint
for (Meter meter : meterRegistry.getMeters()) {
String name = meter.getId().getName();
if (!nam... | [
"@",
"Get",
"(",
"\"/metrics\"",
")",
"@",
"ProducesJson",
"public",
"ObjectNode",
"fetchMetricsFromMicrometer",
"(",
")",
"{",
"ObjectNode",
"metricsJson",
"=",
"factory",
".",
"objectNode",
"(",
")",
";",
"// Get the Zipkin Custom meters for constructing the Metrics end... | Extracts Zipkin metrics to provide backward compatibility | [
"Extracts",
"Zipkin",
"metrics",
"to",
"provide",
"backward",
"compatibility"
] | 89b2fab983fc626b3be32ce9d7cf64b3f01f1a87 | https://github.com/apache/incubator-zipkin/blob/89b2fab983fc626b3be32ce9d7cf64b3f01f1a87/zipkin-server/src/main/java/zipkin2/server/internal/MetricsHealthController.java#L65-L86 |
126,251 | apache/incubator-zipkin | zipkin-server/src/main/java/zipkin2/server/internal/MetricsHealthController.java | MetricsHealthController.getHealth | @Get("/health")
public HttpResponse getHealth() throws JsonProcessingException {
Health health = healthEndpoint.health();
Map<String, Object> healthJson = new LinkedHashMap<>();
healthJson.put("status", health.getStatus().getCode());
healthJson.put("zipkin", health.getDetails().get("zipkin"));
by... | java | @Get("/health")
public HttpResponse getHealth() throws JsonProcessingException {
Health health = healthEndpoint.health();
Map<String, Object> healthJson = new LinkedHashMap<>();
healthJson.put("status", health.getStatus().getCode());
healthJson.put("zipkin", health.getDetails().get("zipkin"));
by... | [
"@",
"Get",
"(",
"\"/health\"",
")",
"public",
"HttpResponse",
"getHealth",
"(",
")",
"throws",
"JsonProcessingException",
"{",
"Health",
"health",
"=",
"healthEndpoint",
".",
"health",
"(",
")",
";",
"Map",
"<",
"String",
",",
"Object",
">",
"healthJson",
"... | in future in favour of Actuator endpoints | [
"in",
"future",
"in",
"favour",
"of",
"Actuator",
"endpoints"
] | 89b2fab983fc626b3be32ce9d7cf64b3f01f1a87 | https://github.com/apache/incubator-zipkin/blob/89b2fab983fc626b3be32ce9d7cf64b3f01f1a87/zipkin-server/src/main/java/zipkin2/server/internal/MetricsHealthController.java#L90-L103 |
126,252 | apache/incubator-zipkin | zipkin-storage/cassandra/src/main/java/zipkin2/storage/cassandra/internal/HostAndPort.java | HostAndPort.fromString | public static HostAndPort fromString(String hostPort, int defaultPort) {
if (hostPort == null) throw new NullPointerException("hostPort == null");
String host = hostPort;
int endHostIndex = hostPort.length();
if (hostPort.startsWith("[")) { // Bracketed IPv6
endHostIndex = hostPort.lastIndexOf(']... | java | public static HostAndPort fromString(String hostPort, int defaultPort) {
if (hostPort == null) throw new NullPointerException("hostPort == null");
String host = hostPort;
int endHostIndex = hostPort.length();
if (hostPort.startsWith("[")) { // Bracketed IPv6
endHostIndex = hostPort.lastIndexOf(']... | [
"public",
"static",
"HostAndPort",
"fromString",
"(",
"String",
"hostPort",
",",
"int",
"defaultPort",
")",
"{",
"if",
"(",
"hostPort",
"==",
"null",
")",
"throw",
"new",
"NullPointerException",
"(",
"\"hostPort == null\"",
")",
";",
"String",
"host",
"=",
"ho... | Constructs a host-port pair from the given string, defaulting to the indicated port if absent | [
"Constructs",
"a",
"host",
"-",
"port",
"pair",
"from",
"the",
"given",
"string",
"defaulting",
"to",
"the",
"indicated",
"port",
"if",
"absent"
] | 89b2fab983fc626b3be32ce9d7cf64b3f01f1a87 | https://github.com/apache/incubator-zipkin/blob/89b2fab983fc626b3be32ce9d7cf64b3f01f1a87/zipkin-storage/cassandra/src/main/java/zipkin2/storage/cassandra/internal/HostAndPort.java#L64-L91 |
126,253 | apache/incubator-zipkin | zipkin-storage/elasticsearch/src/main/java/zipkin2/elasticsearch/EnsureIndexTemplate.java | EnsureIndexTemplate.apply | static void apply(HttpCall.Factory callFactory, String name, String indexTemplate)
throws IOException {
HttpUrl templateUrl = callFactory.baseUrl.newBuilder("_template").addPathSegment(name).build();
Request getTemplate = new Request.Builder().url(templateUrl).tag("get-template").build();
try {
... | java | static void apply(HttpCall.Factory callFactory, String name, String indexTemplate)
throws IOException {
HttpUrl templateUrl = callFactory.baseUrl.newBuilder("_template").addPathSegment(name).build();
Request getTemplate = new Request.Builder().url(templateUrl).tag("get-template").build();
try {
... | [
"static",
"void",
"apply",
"(",
"HttpCall",
".",
"Factory",
"callFactory",
",",
"String",
"name",
",",
"String",
"indexTemplate",
")",
"throws",
"IOException",
"{",
"HttpUrl",
"templateUrl",
"=",
"callFactory",
".",
"baseUrl",
".",
"newBuilder",
"(",
"\"_templat... | This is a blocking call, used inside a lazy. That's because no writes should occur until the
template is available. | [
"This",
"is",
"a",
"blocking",
"call",
"used",
"inside",
"a",
"lazy",
".",
"That",
"s",
"because",
"no",
"writes",
"should",
"occur",
"until",
"the",
"template",
"is",
"available",
"."
] | 89b2fab983fc626b3be32ce9d7cf64b3f01f1a87 | https://github.com/apache/incubator-zipkin/blob/89b2fab983fc626b3be32ce9d7cf64b3f01f1a87/zipkin-storage/elasticsearch/src/main/java/zipkin2/elasticsearch/EnsureIndexTemplate.java#L32-L47 |
126,254 | apache/incubator-zipkin | zipkin-storage/cassandra-v1/src/main/java/zipkin2/storage/cassandra/v1/CassandraUtil.java | CassandraUtil.annotationKeys | static Set<String> annotationKeys(Span span) {
Set<String> annotationKeys = new LinkedHashSet<>();
String localServiceName = span.localServiceName();
if (localServiceName == null) return Collections.emptySet();
for (Annotation a : span.annotations()) {
// don't index core annotations as they aren'... | java | static Set<String> annotationKeys(Span span) {
Set<String> annotationKeys = new LinkedHashSet<>();
String localServiceName = span.localServiceName();
if (localServiceName == null) return Collections.emptySet();
for (Annotation a : span.annotations()) {
// don't index core annotations as they aren'... | [
"static",
"Set",
"<",
"String",
">",
"annotationKeys",
"(",
"Span",
"span",
")",
"{",
"Set",
"<",
"String",
">",
"annotationKeys",
"=",
"new",
"LinkedHashSet",
"<>",
"(",
")",
";",
"String",
"localServiceName",
"=",
"span",
".",
"localServiceName",
"(",
")... | Returns keys that concatenate the serviceName associated with an annotation or tag.
@see QueryRequest#annotationQuery() | [
"Returns",
"keys",
"that",
"concatenate",
"the",
"serviceName",
"associated",
"with",
"an",
"annotation",
"or",
"tag",
"."
] | 89b2fab983fc626b3be32ce9d7cf64b3f01f1a87 | https://github.com/apache/incubator-zipkin/blob/89b2fab983fc626b3be32ce9d7cf64b3f01f1a87/zipkin-storage/cassandra-v1/src/main/java/zipkin2/storage/cassandra/v1/CassandraUtil.java#L78-L94 |
126,255 | apache/incubator-zipkin | zipkin/src/main/java/zipkin2/internal/SpanNode.java | SpanNode.addChild | SpanNode addChild(SpanNode child) {
if (child == null) throw new NullPointerException("child == null");
if (child == this) throw new IllegalArgumentException("circular dependency on " + this);
if (children.equals(Collections.emptyList())) children = new ArrayList<>();
children.add(child);
child.pare... | java | SpanNode addChild(SpanNode child) {
if (child == null) throw new NullPointerException("child == null");
if (child == this) throw new IllegalArgumentException("circular dependency on " + this);
if (children.equals(Collections.emptyList())) children = new ArrayList<>();
children.add(child);
child.pare... | [
"SpanNode",
"addChild",
"(",
"SpanNode",
"child",
")",
"{",
"if",
"(",
"child",
"==",
"null",
")",
"throw",
"new",
"NullPointerException",
"(",
"\"child == null\"",
")",
";",
"if",
"(",
"child",
"==",
"this",
")",
"throw",
"new",
"IllegalArgumentException",
... | Adds the child IFF it isn't already a child. | [
"Adds",
"the",
"child",
"IFF",
"it",
"isn",
"t",
"already",
"a",
"child",
"."
] | 89b2fab983fc626b3be32ce9d7cf64b3f01f1a87 | https://github.com/apache/incubator-zipkin/blob/89b2fab983fc626b3be32ce9d7cf64b3f01f1a87/zipkin/src/main/java/zipkin2/internal/SpanNode.java#L117-L124 |
126,256 | apache/incubator-zipkin | zipkin-storage/elasticsearch/src/main/java/zipkin2/elasticsearch/internal/HttpBulkIndexer.java | HttpBulkIndexer.newCall | public HttpCall<Void> newCall() {
HttpUrl url =
pipeline != null
? http.baseUrl.newBuilder("_bulk").addQueryParameter("pipeline", pipeline).build()
: http.baseUrl.resolve("_bulk");
Request request =
new Request.Builder()
.url(url)
.tag(tag)
... | java | public HttpCall<Void> newCall() {
HttpUrl url =
pipeline != null
? http.baseUrl.newBuilder("_bulk").addQueryParameter("pipeline", pipeline).build()
: http.baseUrl.resolve("_bulk");
Request request =
new Request.Builder()
.url(url)
.tag(tag)
... | [
"public",
"HttpCall",
"<",
"Void",
">",
"newCall",
"(",
")",
"{",
"HttpUrl",
"url",
"=",
"pipeline",
"!=",
"null",
"?",
"http",
".",
"baseUrl",
".",
"newBuilder",
"(",
"\"_bulk\"",
")",
".",
"addQueryParameter",
"(",
"\"pipeline\"",
",",
"pipeline",
")",
... | Creates a bulk request when there is more than one object to store | [
"Creates",
"a",
"bulk",
"request",
"when",
"there",
"is",
"more",
"than",
"one",
"object",
"to",
"store"
] | 89b2fab983fc626b3be32ce9d7cf64b3f01f1a87 | https://github.com/apache/incubator-zipkin/blob/89b2fab983fc626b3be32ce9d7cf64b3f01f1a87/zipkin-storage/elasticsearch/src/main/java/zipkin2/elasticsearch/internal/HttpBulkIndexer.java#L114-L128 |
126,257 | apache/incubator-zipkin | zipkin-storage/mysql-v1/src/main/java/zipkin2/storage/mysql/v1/Schema.java | Schema.list | static <T> List<T> list(T... elements) {
return new ArrayList<>(Arrays.asList(elements));
} | java | static <T> List<T> list(T... elements) {
return new ArrayList<>(Arrays.asList(elements));
} | [
"static",
"<",
"T",
">",
"List",
"<",
"T",
">",
"list",
"(",
"T",
"...",
"elements",
")",
"{",
"return",
"new",
"ArrayList",
"<>",
"(",
"Arrays",
".",
"asList",
"(",
"elements",
")",
")",
";",
"}"
] | Returns a mutable list | [
"Returns",
"a",
"mutable",
"list"
] | 89b2fab983fc626b3be32ce9d7cf64b3f01f1a87 | https://github.com/apache/incubator-zipkin/blob/89b2fab983fc626b3be32ce9d7cf64b3f01f1a87/zipkin-storage/mysql-v1/src/main/java/zipkin2/storage/mysql/v1/Schema.java#L107-L109 |
126,258 | apache/incubator-zipkin | zipkin-storage/mysql-v1/src/main/java/zipkin2/storage/mysql/v1/Schema.java | Schema.maybeGet | static <T> T maybeGet(Record record, TableField<Record, T> field, T defaultValue) {
if (record.fieldsRow().indexOf(field) < 0) {
return defaultValue;
} else {
T result = record.get(field);
return result != null ? result : defaultValue;
}
} | java | static <T> T maybeGet(Record record, TableField<Record, T> field, T defaultValue) {
if (record.fieldsRow().indexOf(field) < 0) {
return defaultValue;
} else {
T result = record.get(field);
return result != null ? result : defaultValue;
}
} | [
"static",
"<",
"T",
">",
"T",
"maybeGet",
"(",
"Record",
"record",
",",
"TableField",
"<",
"Record",
",",
"T",
">",
"field",
",",
"T",
"defaultValue",
")",
"{",
"if",
"(",
"record",
".",
"fieldsRow",
"(",
")",
".",
"indexOf",
"(",
"field",
")",
"<"... | returns the default value if the column doesn't exist or the result was null | [
"returns",
"the",
"default",
"value",
"if",
"the",
"column",
"doesn",
"t",
"exist",
"or",
"the",
"result",
"was",
"null"
] | 89b2fab983fc626b3be32ce9d7cf64b3f01f1a87 | https://github.com/apache/incubator-zipkin/blob/89b2fab983fc626b3be32ce9d7cf64b3f01f1a87/zipkin-storage/mysql-v1/src/main/java/zipkin2/storage/mysql/v1/Schema.java#L157-L164 |
126,259 | google/flatbuffers | java/com/google/flatbuffers/Table.java | Table.__string | protected String __string(int offset) {
offset += bb.getInt(offset);
int length = bb.getInt(offset);
return utf8.decodeUtf8(bb, offset + SIZEOF_INT, length);
} | java | protected String __string(int offset) {
offset += bb.getInt(offset);
int length = bb.getInt(offset);
return utf8.decodeUtf8(bb, offset + SIZEOF_INT, length);
} | [
"protected",
"String",
"__string",
"(",
"int",
"offset",
")",
"{",
"offset",
"+=",
"bb",
".",
"getInt",
"(",
"offset",
")",
";",
"int",
"length",
"=",
"bb",
".",
"getInt",
"(",
"offset",
")",
";",
"return",
"utf8",
".",
"decodeUtf8",
"(",
"bb",
",",
... | Create a Java `String` from UTF-8 data stored inside the FlatBuffer.
This allocates a new string and converts to wide chars upon each access,
which is not very efficient. Instead, each FlatBuffer string also comes with an
accessor based on __vector_as_bytebuffer below, which is much more efficient,
assuming your Java ... | [
"Create",
"a",
"Java",
"String",
"from",
"UTF",
"-",
"8",
"data",
"stored",
"inside",
"the",
"FlatBuffer",
"."
] | 6cc30b3272d79c85db7d4871ac0aa69541dc89de | https://github.com/google/flatbuffers/blob/6cc30b3272d79c85db7d4871ac0aa69541dc89de/java/com/google/flatbuffers/Table.java#L93-L97 |
126,260 | google/flatbuffers | java/com/google/flatbuffers/Table.java | Table.__vector_len | protected int __vector_len(int offset) {
offset += bb_pos;
offset += bb.getInt(offset);
return bb.getInt(offset);
} | java | protected int __vector_len(int offset) {
offset += bb_pos;
offset += bb.getInt(offset);
return bb.getInt(offset);
} | [
"protected",
"int",
"__vector_len",
"(",
"int",
"offset",
")",
"{",
"offset",
"+=",
"bb_pos",
";",
"offset",
"+=",
"bb",
".",
"getInt",
"(",
"offset",
")",
";",
"return",
"bb",
".",
"getInt",
"(",
"offset",
")",
";",
"}"
] | Get the length of a vector.
@param offset An `int` index into the Table's ByteBuffer.
@return Returns the length of the vector whose offset is stored at `offset`. | [
"Get",
"the",
"length",
"of",
"a",
"vector",
"."
] | 6cc30b3272d79c85db7d4871ac0aa69541dc89de | https://github.com/google/flatbuffers/blob/6cc30b3272d79c85db7d4871ac0aa69541dc89de/java/com/google/flatbuffers/Table.java#L105-L109 |
126,261 | google/flatbuffers | java/com/google/flatbuffers/Table.java | Table.__vector_as_bytebuffer | protected ByteBuffer __vector_as_bytebuffer(int vector_offset, int elem_size) {
int o = __offset(vector_offset);
if (o == 0) return null;
ByteBuffer bb = this.bb.duplicate().order(ByteOrder.LITTLE_ENDIAN);
int vectorstart = __vector(o);
bb.position(vectorstart);
bb.limit(vectorstart + __vector_l... | java | protected ByteBuffer __vector_as_bytebuffer(int vector_offset, int elem_size) {
int o = __offset(vector_offset);
if (o == 0) return null;
ByteBuffer bb = this.bb.duplicate().order(ByteOrder.LITTLE_ENDIAN);
int vectorstart = __vector(o);
bb.position(vectorstart);
bb.limit(vectorstart + __vector_l... | [
"protected",
"ByteBuffer",
"__vector_as_bytebuffer",
"(",
"int",
"vector_offset",
",",
"int",
"elem_size",
")",
"{",
"int",
"o",
"=",
"__offset",
"(",
"vector_offset",
")",
";",
"if",
"(",
"o",
"==",
"0",
")",
"return",
"null",
";",
"ByteBuffer",
"bb",
"="... | Get a whole vector as a ByteBuffer.
This is efficient, since it only allocates a new {@link ByteBuffer} object,
but does not actually copy the data, it still refers to the same bytes
as the original ByteBuffer. Also useful with nested FlatBuffers, etc.
@param vector_offset The position of the vector in the byte buffe... | [
"Get",
"a",
"whole",
"vector",
"as",
"a",
"ByteBuffer",
"."
] | 6cc30b3272d79c85db7d4871ac0aa69541dc89de | https://github.com/google/flatbuffers/blob/6cc30b3272d79c85db7d4871ac0aa69541dc89de/java/com/google/flatbuffers/Table.java#L133-L141 |
126,262 | google/flatbuffers | java/com/google/flatbuffers/Table.java | Table.__vector_in_bytebuffer | protected ByteBuffer __vector_in_bytebuffer(ByteBuffer bb, int vector_offset, int elem_size) {
int o = this.__offset(vector_offset);
if (o == 0) return null;
int vectorstart = __vector(o);
bb.rewind();
bb.limit(vectorstart + __vector_len(o) * elem_size);
bb.position(vectorstart);
return bb;
... | java | protected ByteBuffer __vector_in_bytebuffer(ByteBuffer bb, int vector_offset, int elem_size) {
int o = this.__offset(vector_offset);
if (o == 0) return null;
int vectorstart = __vector(o);
bb.rewind();
bb.limit(vectorstart + __vector_len(o) * elem_size);
bb.position(vectorstart);
return bb;
... | [
"protected",
"ByteBuffer",
"__vector_in_bytebuffer",
"(",
"ByteBuffer",
"bb",
",",
"int",
"vector_offset",
",",
"int",
"elem_size",
")",
"{",
"int",
"o",
"=",
"this",
".",
"__offset",
"(",
"vector_offset",
")",
";",
"if",
"(",
"o",
"==",
"0",
")",
"return"... | Initialize vector as a ByteBuffer.
This is more efficient than using duplicate, since it doesn't copy the data
nor allocattes a new {@link ByteBuffer}, creating no garbage to be collected.
@param bb The {@link ByteBuffer} for the array
@param vector_offset The position of the vector in the byte buffer
@param elem_siz... | [
"Initialize",
"vector",
"as",
"a",
"ByteBuffer",
"."
] | 6cc30b3272d79c85db7d4871ac0aa69541dc89de | https://github.com/google/flatbuffers/blob/6cc30b3272d79c85db7d4871ac0aa69541dc89de/java/com/google/flatbuffers/Table.java#L154-L162 |
126,263 | google/flatbuffers | java/com/google/flatbuffers/Table.java | Table.__union | protected Table __union(Table t, int offset) {
offset += bb_pos;
t.bb_pos = offset + bb.getInt(offset);
t.bb = bb;
t.vtable_start = t.bb_pos - bb.getInt(t.bb_pos);
t.vtable_size = bb.getShort(t.vtable_start);
return t;
} | java | protected Table __union(Table t, int offset) {
offset += bb_pos;
t.bb_pos = offset + bb.getInt(offset);
t.bb = bb;
t.vtable_start = t.bb_pos - bb.getInt(t.bb_pos);
t.vtable_size = bb.getShort(t.vtable_start);
return t;
} | [
"protected",
"Table",
"__union",
"(",
"Table",
"t",
",",
"int",
"offset",
")",
"{",
"offset",
"+=",
"bb_pos",
";",
"t",
".",
"bb_pos",
"=",
"offset",
"+",
"bb",
".",
"getInt",
"(",
"offset",
")",
";",
"t",
".",
"bb",
"=",
"bb",
";",
"t",
".",
"... | Initialize any Table-derived type to point to the union at the given `offset`.
@param t A `Table`-derived type that should point to the union at `offset`.
@param offset An `int` index into the Table's ByteBuffer.
@return Returns the Table that points to the union at `offset`. | [
"Initialize",
"any",
"Table",
"-",
"derived",
"type",
"to",
"point",
"to",
"the",
"union",
"at",
"the",
"given",
"offset",
"."
] | 6cc30b3272d79c85db7d4871ac0aa69541dc89de | https://github.com/google/flatbuffers/blob/6cc30b3272d79c85db7d4871ac0aa69541dc89de/java/com/google/flatbuffers/Table.java#L171-L178 |
126,264 | google/flatbuffers | java/com/google/flatbuffers/Table.java | Table.sortTables | protected void sortTables(int[] offsets, final ByteBuffer bb) {
Integer[] off = new Integer[offsets.length];
for (int i = 0; i < offsets.length; i++) off[i] = offsets[i];
java.util.Arrays.sort(off, new java.util.Comparator<Integer>() {
public int compare(Integer o1, Integer o2) {
return keysCo... | java | protected void sortTables(int[] offsets, final ByteBuffer bb) {
Integer[] off = new Integer[offsets.length];
for (int i = 0; i < offsets.length; i++) off[i] = offsets[i];
java.util.Arrays.sort(off, new java.util.Comparator<Integer>() {
public int compare(Integer o1, Integer o2) {
return keysCo... | [
"protected",
"void",
"sortTables",
"(",
"int",
"[",
"]",
"offsets",
",",
"final",
"ByteBuffer",
"bb",
")",
"{",
"Integer",
"[",
"]",
"off",
"=",
"new",
"Integer",
"[",
"offsets",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
... | Sort tables by the key.
@param offsets An 'int' indexes of the tables into the bb.
@param bb A {@code ByteBuffer} to get the tables. | [
"Sort",
"tables",
"by",
"the",
"key",
"."
] | 6cc30b3272d79c85db7d4871ac0aa69541dc89de | https://github.com/google/flatbuffers/blob/6cc30b3272d79c85db7d4871ac0aa69541dc89de/java/com/google/flatbuffers/Table.java#L204-L213 |
126,265 | google/flatbuffers | java/com/google/flatbuffers/Table.java | Table.compareStrings | protected static int compareStrings(int offset_1, int offset_2, ByteBuffer bb) {
offset_1 += bb.getInt(offset_1);
offset_2 += bb.getInt(offset_2);
int len_1 = bb.getInt(offset_1);
int len_2 = bb.getInt(offset_2);
int startPos_1 = offset_1 + SIZEOF_INT;
int startPos_2 = offset_2 + SIZEOF_INT;
... | java | protected static int compareStrings(int offset_1, int offset_2, ByteBuffer bb) {
offset_1 += bb.getInt(offset_1);
offset_2 += bb.getInt(offset_2);
int len_1 = bb.getInt(offset_1);
int len_2 = bb.getInt(offset_2);
int startPos_1 = offset_1 + SIZEOF_INT;
int startPos_2 = offset_2 + SIZEOF_INT;
... | [
"protected",
"static",
"int",
"compareStrings",
"(",
"int",
"offset_1",
",",
"int",
"offset_2",
",",
"ByteBuffer",
"bb",
")",
"{",
"offset_1",
"+=",
"bb",
".",
"getInt",
"(",
"offset_1",
")",
";",
"offset_2",
"+=",
"bb",
".",
"getInt",
"(",
"offset_2",
"... | Compare two strings in the buffer.
@param offset_1 An 'int' index of the first string into the bb.
@param offset_2 An 'int' index of the second string into the bb.
@param bb A {@code ByteBuffer} to get the strings. | [
"Compare",
"two",
"strings",
"in",
"the",
"buffer",
"."
] | 6cc30b3272d79c85db7d4871ac0aa69541dc89de | https://github.com/google/flatbuffers/blob/6cc30b3272d79c85db7d4871ac0aa69541dc89de/java/com/google/flatbuffers/Table.java#L231-L244 |
126,266 | google/flatbuffers | java/com/google/flatbuffers/Table.java | Table.compareStrings | protected static int compareStrings(int offset_1, byte[] key, ByteBuffer bb) {
offset_1 += bb.getInt(offset_1);
int len_1 = bb.getInt(offset_1);
int len_2 = key.length;
int startPos_1 = offset_1 + Constants.SIZEOF_INT;
int len = Math.min(len_1, len_2);
for (int i = 0; i < len; i++) {
if (b... | java | protected static int compareStrings(int offset_1, byte[] key, ByteBuffer bb) {
offset_1 += bb.getInt(offset_1);
int len_1 = bb.getInt(offset_1);
int len_2 = key.length;
int startPos_1 = offset_1 + Constants.SIZEOF_INT;
int len = Math.min(len_1, len_2);
for (int i = 0; i < len; i++) {
if (b... | [
"protected",
"static",
"int",
"compareStrings",
"(",
"int",
"offset_1",
",",
"byte",
"[",
"]",
"key",
",",
"ByteBuffer",
"bb",
")",
"{",
"offset_1",
"+=",
"bb",
".",
"getInt",
"(",
"offset_1",
")",
";",
"int",
"len_1",
"=",
"bb",
".",
"getInt",
"(",
... | Compare string from the buffer with the 'String' object.
@param offset_1 An 'int' index of the first string into the bb.
@param key Second string as a byte array.
@param bb A {@code ByteBuffer} to get the first string. | [
"Compare",
"string",
"from",
"the",
"buffer",
"with",
"the",
"String",
"object",
"."
] | 6cc30b3272d79c85db7d4871ac0aa69541dc89de | https://github.com/google/flatbuffers/blob/6cc30b3272d79c85db7d4871ac0aa69541dc89de/java/com/google/flatbuffers/Table.java#L253-L264 |
126,267 | google/flatbuffers | java/com/google/flatbuffers/Utf8Old.java | Utf8Old.encodedLength | @Override
public int encodedLength(CharSequence in) {
final Cache cache = CACHE.get();
int estimated = (int) (in.length() * cache.encoder.maxBytesPerChar());
if (cache.lastOutput == null || cache.lastOutput.capacity() < estimated) {
cache.lastOutput = ByteBuffer.allocate(Math.max(128, estimated));
... | java | @Override
public int encodedLength(CharSequence in) {
final Cache cache = CACHE.get();
int estimated = (int) (in.length() * cache.encoder.maxBytesPerChar());
if (cache.lastOutput == null || cache.lastOutput.capacity() < estimated) {
cache.lastOutput = ByteBuffer.allocate(Math.max(128, estimated));
... | [
"@",
"Override",
"public",
"int",
"encodedLength",
"(",
"CharSequence",
"in",
")",
"{",
"final",
"Cache",
"cache",
"=",
"CACHE",
".",
"get",
"(",
")",
";",
"int",
"estimated",
"=",
"(",
"int",
")",
"(",
"in",
".",
"length",
"(",
")",
"*",
"cache",
... | the length of the encoded string. | [
"the",
"length",
"of",
"the",
"encoded",
"string",
"."
] | 6cc30b3272d79c85db7d4871ac0aa69541dc89de | https://github.com/google/flatbuffers/blob/6cc30b3272d79c85db7d4871ac0aa69541dc89de/java/com/google/flatbuffers/Utf8Old.java#L51-L71 |
126,268 | google/flatbuffers | java/com/google/flatbuffers/ByteBufferUtil.java | ByteBufferUtil.removeSizePrefix | public static ByteBuffer removeSizePrefix(ByteBuffer bb) {
ByteBuffer s = bb.duplicate();
s.position(s.position() + SIZE_PREFIX_LENGTH);
return s;
} | java | public static ByteBuffer removeSizePrefix(ByteBuffer bb) {
ByteBuffer s = bb.duplicate();
s.position(s.position() + SIZE_PREFIX_LENGTH);
return s;
} | [
"public",
"static",
"ByteBuffer",
"removeSizePrefix",
"(",
"ByteBuffer",
"bb",
")",
"{",
"ByteBuffer",
"s",
"=",
"bb",
".",
"duplicate",
"(",
")",
";",
"s",
".",
"position",
"(",
"s",
".",
"position",
"(",
")",
"+",
"SIZE_PREFIX_LENGTH",
")",
";",
"retur... | Create a duplicate of a size-prefixed `ByteBuffer` that has its position
advanced just past the size prefix.
@param bb a size-prefixed buffer
@return a new buffer on the same underlying data that has skipped the
size prefix | [
"Create",
"a",
"duplicate",
"of",
"a",
"size",
"-",
"prefixed",
"ByteBuffer",
"that",
"has",
"its",
"position",
"advanced",
"just",
"past",
"the",
"size",
"prefix",
"."
] | 6cc30b3272d79c85db7d4871ac0aa69541dc89de | https://github.com/google/flatbuffers/blob/6cc30b3272d79c85db7d4871ac0aa69541dc89de/java/com/google/flatbuffers/ByteBufferUtil.java#L50-L54 |
126,269 | apereo/cas | core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/serialization/AbstractJacksonBackedStringSerializer.java | AbstractJacksonBackedStringSerializer.readJsonFrom | protected String readJsonFrom(final InputStream json) throws IOException {
return isJsonFormat()
? JsonValue.readHjson(IOUtils.toString(json, StandardCharsets.UTF_8)).toString()
: String.join("\n", IOUtils.readLines(json, StandardCharsets.UTF_8));
} | java | protected String readJsonFrom(final InputStream json) throws IOException {
return isJsonFormat()
? JsonValue.readHjson(IOUtils.toString(json, StandardCharsets.UTF_8)).toString()
: String.join("\n", IOUtils.readLines(json, StandardCharsets.UTF_8));
} | [
"protected",
"String",
"readJsonFrom",
"(",
"final",
"InputStream",
"json",
")",
"throws",
"IOException",
"{",
"return",
"isJsonFormat",
"(",
")",
"?",
"JsonValue",
".",
"readHjson",
"(",
"IOUtils",
".",
"toString",
"(",
"json",
",",
"StandardCharsets",
".",
"... | Read json from stream.
@param json the json
@return the string
@throws IOException the io exception | [
"Read",
"json",
"from",
"stream",
"."
] | b4b306433a8782cef803a39bea5b1f96740e0e9b | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/serialization/AbstractJacksonBackedStringSerializer.java#L124-L128 |
126,270 | apereo/cas | core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/serialization/AbstractJacksonBackedStringSerializer.java | AbstractJacksonBackedStringSerializer.configureObjectMapper | protected void configureObjectMapper(final ObjectMapper mapper) {
mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false)
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
mapper.setSerializationInclusion(JsonInclude.Include.NON_EMPTY);
mapper.setVisibi... | java | protected void configureObjectMapper(final ObjectMapper mapper) {
mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false)
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
mapper.setSerializationInclusion(JsonInclude.Include.NON_EMPTY);
mapper.setVisibi... | [
"protected",
"void",
"configureObjectMapper",
"(",
"final",
"ObjectMapper",
"mapper",
")",
"{",
"mapper",
".",
"configure",
"(",
"SerializationFeature",
".",
"FAIL_ON_EMPTY_BEANS",
",",
"false",
")",
".",
"configure",
"(",
"DeserializationFeature",
".",
"FAIL_ON_UNKNO... | Configure mapper.
@param mapper the mapper | [
"Configure",
"mapper",
"."
] | b4b306433a8782cef803a39bea5b1f96740e0e9b | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/serialization/AbstractJacksonBackedStringSerializer.java#L200-L213 |
126,271 | apereo/cas | core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/serialization/AbstractJacksonBackedStringSerializer.java | AbstractJacksonBackedStringSerializer.readObjectFromString | protected T readObjectFromString(final String jsonString) {
try {
LOGGER.trace("Attempting to consume [{}]", jsonString);
return this.objectMapper.readValue(jsonString, getTypeToSerialize());
} catch (final Exception e) {
LOGGER.error("Cannot read/parse [{}] to deseri... | java | protected T readObjectFromString(final String jsonString) {
try {
LOGGER.trace("Attempting to consume [{}]", jsonString);
return this.objectMapper.readValue(jsonString, getTypeToSerialize());
} catch (final Exception e) {
LOGGER.error("Cannot read/parse [{}] to deseri... | [
"protected",
"T",
"readObjectFromString",
"(",
"final",
"String",
"jsonString",
")",
"{",
"try",
"{",
"LOGGER",
".",
"trace",
"(",
"\"Attempting to consume [{}]\"",
",",
"jsonString",
")",
";",
"return",
"this",
".",
"objectMapper",
".",
"readValue",
"(",
"jsonS... | Read object from json.
@param jsonString the json string
@return the type | [
"Read",
"object",
"from",
"json",
"."
] | b4b306433a8782cef803a39bea5b1f96740e0e9b | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/serialization/AbstractJacksonBackedStringSerializer.java#L229-L242 |
126,272 | apereo/cas | support/cas-server-support-actions/src/main/java/org/apereo/cas/web/flow/login/RedirectUnauthorizedServiceUrlAction.java | RedirectUnauthorizedServiceUrlAction.determineUnauthorizedServiceRedirectUrl | protected URI determineUnauthorizedServiceRedirectUrl(final RequestContext context) {
val redirectUrl = WebUtils.getUnauthorizedRedirectUrlFromFlowScope(context);
val currentEvent = context.getCurrentEvent();
val eventAttributes = currentEvent.getAttributes();
LOGGER.debug("Finalizing th... | java | protected URI determineUnauthorizedServiceRedirectUrl(final RequestContext context) {
val redirectUrl = WebUtils.getUnauthorizedRedirectUrlFromFlowScope(context);
val currentEvent = context.getCurrentEvent();
val eventAttributes = currentEvent.getAttributes();
LOGGER.debug("Finalizing th... | [
"protected",
"URI",
"determineUnauthorizedServiceRedirectUrl",
"(",
"final",
"RequestContext",
"context",
")",
"{",
"val",
"redirectUrl",
"=",
"WebUtils",
".",
"getUnauthorizedRedirectUrlFromFlowScope",
"(",
"context",
")",
";",
"val",
"currentEvent",
"=",
"context",
".... | Determine unauthorized service redirect url.
@param context the context
@return the uri | [
"Determine",
"unauthorized",
"service",
"redirect",
"url",
"."
] | b4b306433a8782cef803a39bea5b1f96740e0e9b | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-actions/src/main/java/org/apereo/cas/web/flow/login/RedirectUnauthorizedServiceUrlAction.java#L56-L63 |
126,273 | apereo/cas | support/cas-server-support-saml-idp-web/src/main/java/org/apereo/cas/support/saml/web/idp/profile/builders/nameid/SamlProfileSamlNameIdBuilder.java | SamlProfileSamlNameIdBuilder.getSupportedNameIdFormats | protected static List<String> getSupportedNameIdFormats(final SamlRegisteredService service,
final SamlRegisteredServiceServiceProviderMetadataFacade adaptor) {
val supportedNameFormats = adaptor.getSupportedNameIdFormats();
LOGGER.debug("Metad... | java | protected static List<String> getSupportedNameIdFormats(final SamlRegisteredService service,
final SamlRegisteredServiceServiceProviderMetadataFacade adaptor) {
val supportedNameFormats = adaptor.getSupportedNameIdFormats();
LOGGER.debug("Metad... | [
"protected",
"static",
"List",
"<",
"String",
">",
"getSupportedNameIdFormats",
"(",
"final",
"SamlRegisteredService",
"service",
",",
"final",
"SamlRegisteredServiceServiceProviderMetadataFacade",
"adaptor",
")",
"{",
"val",
"supportedNameFormats",
"=",
"adaptor",
".",
"... | Gets supported name id formats.
@param service the service
@param adaptor the adaptor
@return the supported name id formats | [
"Gets",
"supported",
"name",
"id",
"formats",
"."
] | b4b306433a8782cef803a39bea5b1f96740e0e9b | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-saml-idp-web/src/main/java/org/apereo/cas/support/saml/web/idp/profile/builders/nameid/SamlProfileSamlNameIdBuilder.java#L60-L75 |
126,274 | apereo/cas | support/cas-server-support-saml-idp-web/src/main/java/org/apereo/cas/support/saml/web/idp/profile/builders/nameid/SamlProfileSamlNameIdBuilder.java | SamlProfileSamlNameIdBuilder.finalizeNameId | protected NameID finalizeNameId(final NameID nameid,
final RequestAbstractType authnRequest,
final Object assertion,
final List<String> supportedNameFormats,
final SamlRegister... | java | protected NameID finalizeNameId(final NameID nameid,
final RequestAbstractType authnRequest,
final Object assertion,
final List<String> supportedNameFormats,
final SamlRegister... | [
"protected",
"NameID",
"finalizeNameId",
"(",
"final",
"NameID",
"nameid",
",",
"final",
"RequestAbstractType",
"authnRequest",
",",
"final",
"Object",
"assertion",
",",
"final",
"List",
"<",
"String",
">",
"supportedNameFormats",
",",
"final",
"SamlRegisteredService"... | Finalize name id name id.
@param nameid the nameid
@param authnRequest the authn request
@param assertion the assertion
@param supportedNameFormats the supported name formats
@param service the service
@param adaptor the adaptor
@return the name id | [
"Finalize",
"name",
"id",
"name",
"id",
"."
] | b4b306433a8782cef803a39bea5b1f96740e0e9b | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-saml-idp-web/src/main/java/org/apereo/cas/support/saml/web/idp/profile/builders/nameid/SamlProfileSamlNameIdBuilder.java#L158-L178 |
126,275 | apereo/cas | support/cas-server-support-saml-idp-web/src/main/java/org/apereo/cas/support/saml/web/idp/profile/builders/nameid/SamlProfileSamlNameIdBuilder.java | SamlProfileSamlNameIdBuilder.validateRequiredNameIdFormatIfAny | protected void validateRequiredNameIdFormatIfAny(final RequestAbstractType authnRequest,
final SamlRegisteredServiceServiceProviderMetadataFacade adaptor,
final List<String> supportedNameFormats,
... | java | protected void validateRequiredNameIdFormatIfAny(final RequestAbstractType authnRequest,
final SamlRegisteredServiceServiceProviderMetadataFacade adaptor,
final List<String> supportedNameFormats,
... | [
"protected",
"void",
"validateRequiredNameIdFormatIfAny",
"(",
"final",
"RequestAbstractType",
"authnRequest",
",",
"final",
"SamlRegisteredServiceServiceProviderMetadataFacade",
"adaptor",
",",
"final",
"List",
"<",
"String",
">",
"supportedNameFormats",
",",
"final",
"Strin... | Validate required name id format if any.
@param authnRequest the authn request
@param adaptor the adaptor
@param supportedNameFormats the supported name formats
@param requiredNameFormat the required name format | [
"Validate",
"required",
"name",
"id",
"format",
"if",
"any",
"."
] | b4b306433a8782cef803a39bea5b1f96740e0e9b | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-saml-idp-web/src/main/java/org/apereo/cas/support/saml/web/idp/profile/builders/nameid/SamlProfileSamlNameIdBuilder.java#L188-L200 |
126,276 | apereo/cas | support/cas-server-support-saml-idp-web/src/main/java/org/apereo/cas/support/saml/web/idp/profile/builders/nameid/SamlProfileSamlNameIdBuilder.java | SamlProfileSamlNameIdBuilder.getRequiredNameIdFormatIfAny | protected static String getRequiredNameIdFormatIfAny(final RequestAbstractType authnRequest) {
val nameIDPolicy = getNameIDPolicy(authnRequest);
val requiredNameFormat = nameIDPolicy != null ? nameIDPolicy.getFormat() : null;
LOGGER.debug("AuthN request indicates [{}] is the required NameID form... | java | protected static String getRequiredNameIdFormatIfAny(final RequestAbstractType authnRequest) {
val nameIDPolicy = getNameIDPolicy(authnRequest);
val requiredNameFormat = nameIDPolicy != null ? nameIDPolicy.getFormat() : null;
LOGGER.debug("AuthN request indicates [{}] is the required NameID form... | [
"protected",
"static",
"String",
"getRequiredNameIdFormatIfAny",
"(",
"final",
"RequestAbstractType",
"authnRequest",
")",
"{",
"val",
"nameIDPolicy",
"=",
"getNameIDPolicy",
"(",
"authnRequest",
")",
";",
"val",
"requiredNameFormat",
"=",
"nameIDPolicy",
"!=",
"null",
... | Gets required name id format if any.
@param authnRequest the authn request
@return the required name id format if any | [
"Gets",
"required",
"name",
"id",
"format",
"if",
"any",
"."
] | b4b306433a8782cef803a39bea5b1f96740e0e9b | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-saml-idp-web/src/main/java/org/apereo/cas/support/saml/web/idp/profile/builders/nameid/SamlProfileSamlNameIdBuilder.java#L208-L213 |
126,277 | apereo/cas | support/cas-server-support-saml-idp-web/src/main/java/org/apereo/cas/support/saml/web/idp/profile/builders/nameid/SamlProfileSamlNameIdBuilder.java | SamlProfileSamlNameIdBuilder.determineNameId | protected NameID determineNameId(final RequestAbstractType authnRequest,
final Object assertion,
final List<String> supportedNameFormats,
final SamlRegisteredService service,
... | java | protected NameID determineNameId(final RequestAbstractType authnRequest,
final Object assertion,
final List<String> supportedNameFormats,
final SamlRegisteredService service,
... | [
"protected",
"NameID",
"determineNameId",
"(",
"final",
"RequestAbstractType",
"authnRequest",
",",
"final",
"Object",
"assertion",
",",
"final",
"List",
"<",
"String",
">",
"supportedNameFormats",
",",
"final",
"SamlRegisteredService",
"service",
",",
"final",
"SamlR... | Determine name id name id.
@param authnRequest the authn request
@param assertion the assertion
@param supportedNameFormats the supported name formats
@param service the service
@param adaptor the adaptor
@return the name id | [
"Determine",
"name",
"id",
"name",
"id",
"."
] | b4b306433a8782cef803a39bea5b1f96740e0e9b | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-saml-idp-web/src/main/java/org/apereo/cas/support/saml/web/idp/profile/builders/nameid/SamlProfileSamlNameIdBuilder.java#L232-L247 |
126,278 | apereo/cas | support/cas-server-support-saml-idp-web/src/main/java/org/apereo/cas/support/saml/web/idp/profile/builders/nameid/SamlProfileSamlNameIdBuilder.java | SamlProfileSamlNameIdBuilder.encodeNameIdBasedOnNameFormat | protected NameID encodeNameIdBasedOnNameFormat(final RequestAbstractType authnRequest,
final Object assertion,
final String nameFormat,
final SamlRegisteredService ser... | java | protected NameID encodeNameIdBasedOnNameFormat(final RequestAbstractType authnRequest,
final Object assertion,
final String nameFormat,
final SamlRegisteredService ser... | [
"protected",
"NameID",
"encodeNameIdBasedOnNameFormat",
"(",
"final",
"RequestAbstractType",
"authnRequest",
",",
"final",
"Object",
"assertion",
",",
"final",
"String",
"nameFormat",
",",
"final",
"SamlRegisteredService",
"service",
",",
"final",
"SamlRegisteredServiceServ... | Encode name id based on name format name id.
@param authnRequest the authn request
@param assertion the assertion
@param nameFormat the name format
@param service the service
@param adaptor the adaptor
@return the name id | [
"Encode",
"name",
"id",
"based",
"on",
"name",
"format",
"name",
"id",
"."
] | b4b306433a8782cef803a39bea5b1f96740e0e9b | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-saml-idp-web/src/main/java/org/apereo/cas/support/saml/web/idp/profile/builders/nameid/SamlProfileSamlNameIdBuilder.java#L259-L283 |
126,279 | apereo/cas | support/cas-server-support-saml-idp-web/src/main/java/org/apereo/cas/support/saml/web/idp/profile/builders/nameid/SamlProfileSamlNameIdBuilder.java | SamlProfileSamlNameIdBuilder.prepareNameIdAttribute | protected IdPAttribute prepareNameIdAttribute(final Object casAssertion,
final String nameFormat,
final SamlRegisteredServiceServiceProviderMetadataFacade adaptor) {
val assertion = Assertion.class.cast(casAssert... | java | protected IdPAttribute prepareNameIdAttribute(final Object casAssertion,
final String nameFormat,
final SamlRegisteredServiceServiceProviderMetadataFacade adaptor) {
val assertion = Assertion.class.cast(casAssert... | [
"protected",
"IdPAttribute",
"prepareNameIdAttribute",
"(",
"final",
"Object",
"casAssertion",
",",
"final",
"String",
"nameFormat",
",",
"final",
"SamlRegisteredServiceServiceProviderMetadataFacade",
"adaptor",
")",
"{",
"val",
"assertion",
"=",
"Assertion",
".",
"class"... | Prepare name id attribute id p attribute.
@param casAssertion the assertion
@param nameFormat the name format
@param adaptor the adaptor
@return the idp attribute | [
"Prepare",
"name",
"id",
"attribute",
"id",
"p",
"attribute",
"."
] | b4b306433a8782cef803a39bea5b1f96740e0e9b | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-saml-idp-web/src/main/java/org/apereo/cas/support/saml/web/idp/profile/builders/nameid/SamlProfileSamlNameIdBuilder.java#L293-L307 |
126,280 | apereo/cas | support/cas-server-support-saml-idp-web/src/main/java/org/apereo/cas/support/saml/web/idp/profile/builders/nameid/SamlProfileSamlNameIdBuilder.java | SamlProfileSamlNameIdBuilder.prepareNameIdEncoder | protected static SAML2StringNameIDEncoder prepareNameIdEncoder(final RequestAbstractType authnRequest,
final String nameFormat,
final IdPAttribute attribute,
... | java | protected static SAML2StringNameIDEncoder prepareNameIdEncoder(final RequestAbstractType authnRequest,
final String nameFormat,
final IdPAttribute attribute,
... | [
"protected",
"static",
"SAML2StringNameIDEncoder",
"prepareNameIdEncoder",
"(",
"final",
"RequestAbstractType",
"authnRequest",
",",
"final",
"String",
"nameFormat",
",",
"final",
"IdPAttribute",
"attribute",
",",
"final",
"SamlRegisteredService",
"service",
",",
"final",
... | Prepare name id encoder saml 2 string name id encoder.
@param authnRequest the authn request
@param nameFormat the name format
@param attribute the attribute
@param service the service
@param adaptor the adaptor
@return the saml 2 string name id encoder | [
"Prepare",
"name",
"id",
"encoder",
"saml",
"2",
"string",
"name",
"id",
"encoder",
"."
] | b4b306433a8782cef803a39bea5b1f96740e0e9b | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-saml-idp-web/src/main/java/org/apereo/cas/support/saml/web/idp/profile/builders/nameid/SamlProfileSamlNameIdBuilder.java#L330-L343 |
126,281 | apereo/cas | support/cas-server-support-actions/src/main/java/org/apereo/cas/web/flow/login/GenericSuccessViewAction.java | GenericSuccessViewAction.getAuthenticationPrincipal | public Principal getAuthenticationPrincipal(final String ticketGrantingTicketId) {
try {
val ticketGrantingTicket = this.centralAuthenticationService.getTicket(ticketGrantingTicketId, TicketGrantingTicket.class);
return ticketGrantingTicket.getAuthentication().getPrincipal();
} c... | java | public Principal getAuthenticationPrincipal(final String ticketGrantingTicketId) {
try {
val ticketGrantingTicket = this.centralAuthenticationService.getTicket(ticketGrantingTicketId, TicketGrantingTicket.class);
return ticketGrantingTicket.getAuthentication().getPrincipal();
} c... | [
"public",
"Principal",
"getAuthenticationPrincipal",
"(",
"final",
"String",
"ticketGrantingTicketId",
")",
"{",
"try",
"{",
"val",
"ticketGrantingTicket",
"=",
"this",
".",
"centralAuthenticationService",
".",
"getTicket",
"(",
"ticketGrantingTicketId",
",",
"TicketGrant... | Gets authentication principal.
@param ticketGrantingTicketId the ticket granting ticket id
@return the authentication principal, or {@link NullPrincipal}
if none was available. | [
"Gets",
"authentication",
"principal",
"."
] | b4b306433a8782cef803a39bea5b1f96740e0e9b | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-actions/src/main/java/org/apereo/cas/web/flow/login/GenericSuccessViewAction.java#L56-L66 |
126,282 | apereo/cas | support/cas-server-support-token-tickets/src/main/java/org/apereo/cas/token/authentication/principal/TokenWebApplicationServiceResponseBuilder.java | TokenWebApplicationServiceResponseBuilder.generateToken | @SneakyThrows
protected String generateToken(final Service service, final Map<String, String> parameters) {
val ticketId = parameters.get(CasProtocolConstants.PARAMETER_TICKET);
return this.tokenTicketBuilder.build(ticketId, service);
} | java | @SneakyThrows
protected String generateToken(final Service service, final Map<String, String> parameters) {
val ticketId = parameters.get(CasProtocolConstants.PARAMETER_TICKET);
return this.tokenTicketBuilder.build(ticketId, service);
} | [
"@",
"SneakyThrows",
"protected",
"String",
"generateToken",
"(",
"final",
"Service",
"service",
",",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"parameters",
")",
"{",
"val",
"ticketId",
"=",
"parameters",
".",
"get",
"(",
"CasProtocolConstants",
".",... | Generate token string.
@param service the service
@param parameters the parameters
@return the jwt | [
"Generate",
"token",
"string",
"."
] | b4b306433a8782cef803a39bea5b1f96740e0e9b | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-token-tickets/src/main/java/org/apereo/cas/token/authentication/principal/TokenWebApplicationServiceResponseBuilder.java#L69-L73 |
126,283 | apereo/cas | support/cas-server-support-oidc-core-api/src/main/java/org/apereo/cas/oidc/jwks/OidcJsonWebKeySetUtils.java | OidcJsonWebKeySetUtils.getJsonWebKeySet | public static Optional<JsonWebKeySet> getJsonWebKeySet(final OidcRegisteredService service) {
try {
LOGGER.trace("Loading JSON web key from [{}]", service.getJwks());
val resource = getJsonWebKeySetResource(service);
val jsonWebKeySet = buildJsonWebKeySet(resource);
... | java | public static Optional<JsonWebKeySet> getJsonWebKeySet(final OidcRegisteredService service) {
try {
LOGGER.trace("Loading JSON web key from [{}]", service.getJwks());
val resource = getJsonWebKeySetResource(service);
val jsonWebKeySet = buildJsonWebKeySet(resource);
... | [
"public",
"static",
"Optional",
"<",
"JsonWebKeySet",
">",
"getJsonWebKeySet",
"(",
"final",
"OidcRegisteredService",
"service",
")",
"{",
"try",
"{",
"LOGGER",
".",
"trace",
"(",
"\"Loading JSON web key from [{}]\"",
",",
"service",
".",
"getJwks",
"(",
")",
")",... | Gets json web key set.
@param service the service
@return the json web key set | [
"Gets",
"json",
"web",
"key",
"set",
"."
] | b4b306433a8782cef803a39bea5b1f96740e0e9b | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-oidc-core-api/src/main/java/org/apereo/cas/oidc/jwks/OidcJsonWebKeySetUtils.java#L38-L72 |
126,284 | apereo/cas | support/cas-server-support-oidc-core-api/src/main/java/org/apereo/cas/oidc/jwks/OidcJsonWebKeySetUtils.java | OidcJsonWebKeySetUtils.getJsonWebKeyFromJsonWebKeySet | public static RsaJsonWebKey getJsonWebKeyFromJsonWebKeySet(final JsonWebKeySet jwks) {
if (jwks.getJsonWebKeys().isEmpty()) {
LOGGER.warn("No JSON web keys are available in the keystore");
return null;
}
val key = (RsaJsonWebKey) jwks.getJsonWebKeys().get(0);
if ... | java | public static RsaJsonWebKey getJsonWebKeyFromJsonWebKeySet(final JsonWebKeySet jwks) {
if (jwks.getJsonWebKeys().isEmpty()) {
LOGGER.warn("No JSON web keys are available in the keystore");
return null;
}
val key = (RsaJsonWebKey) jwks.getJsonWebKeys().get(0);
if ... | [
"public",
"static",
"RsaJsonWebKey",
"getJsonWebKeyFromJsonWebKeySet",
"(",
"final",
"JsonWebKeySet",
"jwks",
")",
"{",
"if",
"(",
"jwks",
".",
"getJsonWebKeys",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
"{",
"LOGGER",
".",
"warn",
"(",
"\"No JSON web keys are av... | Gets json web key from jwks.
@param jwks the jwks
@return the json web key from jwks | [
"Gets",
"json",
"web",
"key",
"from",
"jwks",
"."
] | b4b306433a8782cef803a39bea5b1f96740e0e9b | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-oidc-core-api/src/main/java/org/apereo/cas/oidc/jwks/OidcJsonWebKeySetUtils.java#L80-L99 |
126,285 | apereo/cas | api/cas-server-core-api-util/src/main/java/org/apereo/cas/DistributedCacheObject.java | DistributedCacheObject.getProperty | public <T> T getProperty(final String name, final Class<T> clazz) {
if (containsProperty(name)) {
val item = this.properties.get(name);
if (item == null) {
return null;
}
if (!clazz.isAssignableFrom(item.getClass())) {
throw new Cla... | java | public <T> T getProperty(final String name, final Class<T> clazz) {
if (containsProperty(name)) {
val item = this.properties.get(name);
if (item == null) {
return null;
}
if (!clazz.isAssignableFrom(item.getClass())) {
throw new Cla... | [
"public",
"<",
"T",
">",
"T",
"getProperty",
"(",
"final",
"String",
"name",
",",
"final",
"Class",
"<",
"T",
">",
"clazz",
")",
"{",
"if",
"(",
"containsProperty",
"(",
"name",
")",
")",
"{",
"val",
"item",
"=",
"this",
".",
"properties",
".",
"ge... | Gets property.
@param <T> the type parameter
@param name the name
@param clazz the clazz
@return the property | [
"Gets",
"property",
"."
] | b4b306433a8782cef803a39bea5b1f96740e0e9b | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/api/cas-server-core-api-util/src/main/java/org/apereo/cas/DistributedCacheObject.java#L44-L56 |
126,286 | apereo/cas | support/cas-server-support-saml-idp-web/src/main/java/org/apereo/cas/support/saml/web/idp/profile/builders/response/BaseSamlProfileSamlResponseBuilder.java | BaseSamlProfileSamlResponseBuilder.encodeFinalResponse | protected T encodeFinalResponse(final HttpServletRequest request,
final HttpServletResponse response,
final SamlRegisteredService service,
final SamlRegisteredServiceServiceProviderMetadataFacade adaptor,
... | java | protected T encodeFinalResponse(final HttpServletRequest request,
final HttpServletResponse response,
final SamlRegisteredService service,
final SamlRegisteredServiceServiceProviderMetadataFacade adaptor,
... | [
"protected",
"T",
"encodeFinalResponse",
"(",
"final",
"HttpServletRequest",
"request",
",",
"final",
"HttpServletResponse",
"response",
",",
"final",
"SamlRegisteredService",
"service",
",",
"final",
"SamlRegisteredServiceServiceProviderMetadataFacade",
"adaptor",
",",
"fina... | Encode final response.
@param request the request
@param response the response
@param service the service
@param adaptor the adaptor
@param finalResponse the final response
@param binding the binding
@param authnRequest the authn request
@param assertion the assertion
@param m... | [
"Encode",
"final",
"response",
"."
] | b4b306433a8782cef803a39bea5b1f96740e0e9b | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-saml-idp-web/src/main/java/org/apereo/cas/support/saml/web/idp/profile/builders/response/BaseSamlProfileSamlResponseBuilder.java#L81-L100 |
126,287 | apereo/cas | support/cas-server-support-saml-idp-web/src/main/java/org/apereo/cas/support/saml/web/idp/profile/builders/response/BaseSamlProfileSamlResponseBuilder.java | BaseSamlProfileSamlResponseBuilder.buildSamlAssertion | protected Assertion buildSamlAssertion(final RequestAbstractType authnRequest,
final HttpServletRequest request,
final HttpServletResponse response,
final Object casAssertion,
... | java | protected Assertion buildSamlAssertion(final RequestAbstractType authnRequest,
final HttpServletRequest request,
final HttpServletResponse response,
final Object casAssertion,
... | [
"protected",
"Assertion",
"buildSamlAssertion",
"(",
"final",
"RequestAbstractType",
"authnRequest",
",",
"final",
"HttpServletRequest",
"request",
",",
"final",
"HttpServletResponse",
"response",
",",
"final",
"Object",
"casAssertion",
",",
"final",
"SamlRegisteredService"... | Build saml assertion assertion.
@param authnRequest the authn request
@param request the request
@param response the response
@param casAssertion the cas assertion
@param service the service
@param adaptor the adaptor
@param binding the binding
@param messageContext the message co... | [
"Build",
"saml",
"assertion",
"assertion",
"."
] | b4b306433a8782cef803a39bea5b1f96740e0e9b | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-saml-idp-web/src/main/java/org/apereo/cas/support/saml/web/idp/profile/builders/response/BaseSamlProfileSamlResponseBuilder.java#L115-L125 |
126,288 | apereo/cas | support/cas-server-support-saml-idp-web/src/main/java/org/apereo/cas/support/saml/web/idp/profile/builders/response/BaseSamlProfileSamlResponseBuilder.java | BaseSamlProfileSamlResponseBuilder.buildSamlResponseIssuer | protected Issuer buildSamlResponseIssuer(final String entityId) {
val issuer = newIssuer(entityId);
issuer.setFormat(Issuer.ENTITY);
return issuer;
} | java | protected Issuer buildSamlResponseIssuer(final String entityId) {
val issuer = newIssuer(entityId);
issuer.setFormat(Issuer.ENTITY);
return issuer;
} | [
"protected",
"Issuer",
"buildSamlResponseIssuer",
"(",
"final",
"String",
"entityId",
")",
"{",
"val",
"issuer",
"=",
"newIssuer",
"(",
"entityId",
")",
";",
"issuer",
".",
"setFormat",
"(",
"Issuer",
".",
"ENTITY",
")",
";",
"return",
"issuer",
";",
"}"
] | Build entity issuer issuer.
@param entityId the entity id
@return the issuer | [
"Build",
"entity",
"issuer",
"issuer",
"."
] | b4b306433a8782cef803a39bea5b1f96740e0e9b | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-saml-idp-web/src/main/java/org/apereo/cas/support/saml/web/idp/profile/builders/response/BaseSamlProfileSamlResponseBuilder.java#L158-L162 |
126,289 | apereo/cas | support/cas-server-support-saml-idp-web/src/main/java/org/apereo/cas/support/saml/web/idp/profile/builders/response/BaseSamlProfileSamlResponseBuilder.java | BaseSamlProfileSamlResponseBuilder.encryptAssertion | @SneakyThrows
protected SAMLObject encryptAssertion(final Assertion assertion,
final HttpServletRequest request,
final HttpServletResponse response,
final SamlRegisteredService service,
... | java | @SneakyThrows
protected SAMLObject encryptAssertion(final Assertion assertion,
final HttpServletRequest request,
final HttpServletResponse response,
final SamlRegisteredService service,
... | [
"@",
"SneakyThrows",
"protected",
"SAMLObject",
"encryptAssertion",
"(",
"final",
"Assertion",
"assertion",
",",
"final",
"HttpServletRequest",
"request",
",",
"final",
"HttpServletResponse",
"response",
",",
"final",
"SamlRegisteredService",
"service",
",",
"final",
"S... | Encrypt assertion.
@param assertion the assertion
@param request the request
@param response the response
@param service the service
@param adaptor the adaptor
@return the saml object
@throws SamlException the saml exception | [
"Encrypt",
"assertion",
"."
] | b4b306433a8782cef803a39bea5b1f96740e0e9b | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-saml-idp-web/src/main/java/org/apereo/cas/support/saml/web/idp/profile/builders/response/BaseSamlProfileSamlResponseBuilder.java#L200-L214 |
126,290 | apereo/cas | core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/RegexUtils.java | RegexUtils.isValidRegex | public static boolean isValidRegex(final String pattern) {
try {
if (pattern != null) {
Pattern.compile(pattern);
return true;
}
} catch (final PatternSyntaxException exception) {
LOGGER.debug("Pattern [{}] is not a valid regex.", patte... | java | public static boolean isValidRegex(final String pattern) {
try {
if (pattern != null) {
Pattern.compile(pattern);
return true;
}
} catch (final PatternSyntaxException exception) {
LOGGER.debug("Pattern [{}] is not a valid regex.", patte... | [
"public",
"static",
"boolean",
"isValidRegex",
"(",
"final",
"String",
"pattern",
")",
"{",
"try",
"{",
"if",
"(",
"pattern",
"!=",
"null",
")",
"{",
"Pattern",
".",
"compile",
"(",
"pattern",
")",
";",
"return",
"true",
";",
"}",
"}",
"catch",
"(",
... | Check to see if the specified pattern is a valid regular expression.
@param pattern the pattern
@return whether this is a valid regex or not | [
"Check",
"to",
"see",
"if",
"the",
"specified",
"pattern",
"is",
"a",
"valid",
"regular",
"expression",
"."
] | b4b306433a8782cef803a39bea5b1f96740e0e9b | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/RegexUtils.java#L34-L44 |
126,291 | apereo/cas | core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/RegexUtils.java | RegexUtils.concatenate | public static Pattern concatenate(final Collection<?> requiredValues, final boolean caseInsensitive) {
val pattern = requiredValues
.stream()
.map(Object::toString)
.collect(Collectors.joining("|", "(", ")"));
return createPattern(pattern, caseInsensitive ? Pattern.CA... | java | public static Pattern concatenate(final Collection<?> requiredValues, final boolean caseInsensitive) {
val pattern = requiredValues
.stream()
.map(Object::toString)
.collect(Collectors.joining("|", "(", ")"));
return createPattern(pattern, caseInsensitive ? Pattern.CA... | [
"public",
"static",
"Pattern",
"concatenate",
"(",
"final",
"Collection",
"<",
"?",
">",
"requiredValues",
",",
"final",
"boolean",
"caseInsensitive",
")",
"{",
"val",
"pattern",
"=",
"requiredValues",
".",
"stream",
"(",
")",
".",
"map",
"(",
"Object",
"::"... | Concatenate all elements in the given collection to form a regex pattern.
@param requiredValues the required values
@param caseInsensitive the case insensitive
@return the pattern | [
"Concatenate",
"all",
"elements",
"in",
"the",
"given",
"collection",
"to",
"form",
"a",
"regex",
"pattern",
"."
] | b4b306433a8782cef803a39bea5b1f96740e0e9b | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/RegexUtils.java#L53-L59 |
126,292 | apereo/cas | core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/RegexUtils.java | RegexUtils.createPattern | public static Pattern createPattern(final String pattern, final int flags) {
if (pattern == null) {
LOGGER.debug("Pattern cannot be null");
return MATCH_NOTHING_PATTERN;
}
try {
return Pattern.compile(pattern, flags);
} catch (final PatternSyntaxExcept... | java | public static Pattern createPattern(final String pattern, final int flags) {
if (pattern == null) {
LOGGER.debug("Pattern cannot be null");
return MATCH_NOTHING_PATTERN;
}
try {
return Pattern.compile(pattern, flags);
} catch (final PatternSyntaxExcept... | [
"public",
"static",
"Pattern",
"createPattern",
"(",
"final",
"String",
"pattern",
",",
"final",
"int",
"flags",
")",
"{",
"if",
"(",
"pattern",
"==",
"null",
")",
"{",
"LOGGER",
".",
"debug",
"(",
"\"Pattern cannot be null\"",
")",
";",
"return",
"MATCH_NOT... | Creates the pattern with the given flags.
@param pattern the pattern, may be null.
@param flags the flags
@return the compiled pattern or {@link RegexUtils#MATCH_NOTHING_PATTERN} if pattern is null or invalid. | [
"Creates",
"the",
"pattern",
"with",
"the",
"given",
"flags",
"."
] | b4b306433a8782cef803a39bea5b1f96740e0e9b | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/RegexUtils.java#L80-L91 |
126,293 | apereo/cas | core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/RegexUtils.java | RegexUtils.matches | public static boolean matches(final Pattern pattern, final String value, final boolean completeMatch) {
val matcher = pattern.matcher(value);
LOGGER.debug("Matching value [{}] against pattern [{}]", value, pattern.pattern());
if (completeMatch) {
return matcher.matches();
}
... | java | public static boolean matches(final Pattern pattern, final String value, final boolean completeMatch) {
val matcher = pattern.matcher(value);
LOGGER.debug("Matching value [{}] against pattern [{}]", value, pattern.pattern());
if (completeMatch) {
return matcher.matches();
}
... | [
"public",
"static",
"boolean",
"matches",
"(",
"final",
"Pattern",
"pattern",
",",
"final",
"String",
"value",
",",
"final",
"boolean",
"completeMatch",
")",
"{",
"val",
"matcher",
"=",
"pattern",
".",
"matcher",
"(",
"value",
")",
";",
"LOGGER",
".",
"deb... | Matches boolean.
@param pattern the pattern
@param value the value
@param completeMatch the complete match
@return the boolean | [
"Matches",
"boolean",
"."
] | b4b306433a8782cef803a39bea5b1f96740e0e9b | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/RegexUtils.java#L113-L120 |
126,294 | apereo/cas | core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/RegexUtils.java | RegexUtils.find | public static boolean find(final String pattern, final String string) {
return createPattern(pattern, Pattern.CASE_INSENSITIVE).matcher(string).find();
} | java | public static boolean find(final String pattern, final String string) {
return createPattern(pattern, Pattern.CASE_INSENSITIVE).matcher(string).find();
} | [
"public",
"static",
"boolean",
"find",
"(",
"final",
"String",
"pattern",
",",
"final",
"String",
"string",
")",
"{",
"return",
"createPattern",
"(",
"pattern",
",",
"Pattern",
".",
"CASE_INSENSITIVE",
")",
".",
"matcher",
"(",
"string",
")",
".",
"find",
... | Attempts to find the next sub-sequence of the input sequence that matches the pattern.
@param pattern the pattern
@param string the string
@return the boolean | [
"Attempts",
"to",
"find",
"the",
"next",
"sub",
"-",
"sequence",
"of",
"the",
"input",
"sequence",
"that",
"matches",
"the",
"pattern",
"."
] | b4b306433a8782cef803a39bea5b1f96740e0e9b | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/RegexUtils.java#L141-L143 |
126,295 | apereo/cas | support/cas-server-support-validation/src/main/java/org/apereo/cas/web/AbstractServiceValidateController.java | AbstractServiceValidateController.verifyRegisteredServiceProperties | private static void verifyRegisteredServiceProperties(final RegisteredService registeredService, final Service service) {
if (registeredService == null) {
val msg = String.format("Service [%s] is not found in service registry.", service.getId());
LOGGER.warn(msg);
throw new U... | java | private static void verifyRegisteredServiceProperties(final RegisteredService registeredService, final Service service) {
if (registeredService == null) {
val msg = String.format("Service [%s] is not found in service registry.", service.getId());
LOGGER.warn(msg);
throw new U... | [
"private",
"static",
"void",
"verifyRegisteredServiceProperties",
"(",
"final",
"RegisteredService",
"registeredService",
",",
"final",
"Service",
"service",
")",
"{",
"if",
"(",
"registeredService",
"==",
"null",
")",
"{",
"val",
"msg",
"=",
"String",
".",
"forma... | Ensure that the service is found and enabled in the service registry.
@param registeredService the located entry in the registry
@param service authenticating service
@throws UnauthorizedServiceException if service is determined to be unauthorized | [
"Ensure",
"that",
"the",
"service",
"is",
"found",
"and",
"enabled",
"in",
"the",
"service",
"registry",
"."
] | b4b306433a8782cef803a39bea5b1f96740e0e9b | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-validation/src/main/java/org/apereo/cas/web/AbstractServiceValidateController.java#L67-L78 |
126,296 | apereo/cas | support/cas-server-support-validation/src/main/java/org/apereo/cas/web/AbstractServiceValidateController.java | AbstractServiceValidateController.getServiceCredentialsFromRequest | protected Credential getServiceCredentialsFromRequest(final WebApplicationService service, final HttpServletRequest request) {
val pgtUrl = request.getParameter(CasProtocolConstants.PARAMETER_PROXY_CALLBACK_URL);
if (StringUtils.isNotBlank(pgtUrl)) {
try {
val registeredServi... | java | protected Credential getServiceCredentialsFromRequest(final WebApplicationService service, final HttpServletRequest request) {
val pgtUrl = request.getParameter(CasProtocolConstants.PARAMETER_PROXY_CALLBACK_URL);
if (StringUtils.isNotBlank(pgtUrl)) {
try {
val registeredServi... | [
"protected",
"Credential",
"getServiceCredentialsFromRequest",
"(",
"final",
"WebApplicationService",
"service",
",",
"final",
"HttpServletRequest",
"request",
")",
"{",
"val",
"pgtUrl",
"=",
"request",
".",
"getParameter",
"(",
"CasProtocolConstants",
".",
"PARAMETER_PRO... | Overrideable method to determine which credentials to use to grant a
proxy granting ticket. Default is to use the pgtUrl.
@param service the webapp service requesting proxy
@param request the HttpServletRequest object.
@return the credentials or null if there was an error or no credentials
provided. | [
"Overrideable",
"method",
"to",
"determine",
"which",
"credentials",
"to",
"use",
"to",
"grant",
"a",
"proxy",
"granting",
"ticket",
".",
"Default",
"is",
"to",
"use",
"the",
"pgtUrl",
"."
] | b4b306433a8782cef803a39bea5b1f96740e0e9b | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-validation/src/main/java/org/apereo/cas/web/AbstractServiceValidateController.java#L89-L101 |
126,297 | apereo/cas | support/cas-server-support-validation/src/main/java/org/apereo/cas/web/AbstractServiceValidateController.java | AbstractServiceValidateController.initBinder | protected void initBinder(final HttpServletRequest request, final ServletRequestDataBinder binder) {
if (serviceValidateConfigurationContext.isRenewEnabled()) {
binder.setRequiredFields(CasProtocolConstants.PARAMETER_RENEW);
}
} | java | protected void initBinder(final HttpServletRequest request, final ServletRequestDataBinder binder) {
if (serviceValidateConfigurationContext.isRenewEnabled()) {
binder.setRequiredFields(CasProtocolConstants.PARAMETER_RENEW);
}
} | [
"protected",
"void",
"initBinder",
"(",
"final",
"HttpServletRequest",
"request",
",",
"final",
"ServletRequestDataBinder",
"binder",
")",
"{",
"if",
"(",
"serviceValidateConfigurationContext",
".",
"isRenewEnabled",
"(",
")",
")",
"{",
"binder",
".",
"setRequiredFiel... | Initialize the binder with the required fields.
@param request the request
@param binder the binder | [
"Initialize",
"the",
"binder",
"with",
"the",
"required",
"fields",
"."
] | b4b306433a8782cef803a39bea5b1f96740e0e9b | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-validation/src/main/java/org/apereo/cas/web/AbstractServiceValidateController.java#L109-L113 |
126,298 | apereo/cas | support/cas-server-support-validation/src/main/java/org/apereo/cas/web/AbstractServiceValidateController.java | AbstractServiceValidateController.handleProxyGrantingTicketDelivery | public TicketGrantingTicket handleProxyGrantingTicketDelivery(final String serviceTicketId, final Credential credential)
throws AuthenticationException, AbstractTicketException {
val serviceTicket = serviceValidateConfigurationContext.getCentralAuthenticationService().getTicket(serviceTicketId, ServiceT... | java | public TicketGrantingTicket handleProxyGrantingTicketDelivery(final String serviceTicketId, final Credential credential)
throws AuthenticationException, AbstractTicketException {
val serviceTicket = serviceValidateConfigurationContext.getCentralAuthenticationService().getTicket(serviceTicketId, ServiceT... | [
"public",
"TicketGrantingTicket",
"handleProxyGrantingTicketDelivery",
"(",
"final",
"String",
"serviceTicketId",
",",
"final",
"Credential",
"credential",
")",
"throws",
"AuthenticationException",
",",
"AbstractTicketException",
"{",
"val",
"serviceTicket",
"=",
"serviceVali... | Handle proxy granting ticket delivery.
@param serviceTicketId the service ticket id
@param credential the service credential
@return the ticket granting ticket
@throws AuthenticationException the authentication exception
@throws AbstractTicketException the abstract ticket exception | [
"Handle",
"proxy",
"granting",
"ticket",
"delivery",
"."
] | b4b306433a8782cef803a39bea5b1f96740e0e9b | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-validation/src/main/java/org/apereo/cas/web/AbstractServiceValidateController.java#L124-L133 |
126,299 | apereo/cas | support/cas-server-support-validation/src/main/java/org/apereo/cas/web/AbstractServiceValidateController.java | AbstractServiceValidateController.handleTicketValidation | protected ModelAndView handleTicketValidation(final HttpServletRequest request, final WebApplicationService service, final String serviceTicketId) {
var proxyGrantingTicketId = (TicketGrantingTicket) null;
val serviceCredential = getServiceCredentialsFromRequest(service, request);
if (serviceCre... | java | protected ModelAndView handleTicketValidation(final HttpServletRequest request, final WebApplicationService service, final String serviceTicketId) {
var proxyGrantingTicketId = (TicketGrantingTicket) null;
val serviceCredential = getServiceCredentialsFromRequest(service, request);
if (serviceCre... | [
"protected",
"ModelAndView",
"handleTicketValidation",
"(",
"final",
"HttpServletRequest",
"request",
",",
"final",
"WebApplicationService",
"service",
",",
"final",
"String",
"serviceTicketId",
")",
"{",
"var",
"proxyGrantingTicketId",
"=",
"(",
"TicketGrantingTicket",
"... | Handle ticket validation model and view.
@param request the request
@param service the service
@param serviceTicketId the service ticket id
@return the model and view | [
"Handle",
"ticket",
"validation",
"model",
"and",
"view",
"."
] | b4b306433a8782cef803a39bea5b1f96740e0e9b | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-validation/src/main/java/org/apereo/cas/web/AbstractServiceValidateController.java#L176-L216 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.