proj_name stringclasses 131
values | relative_path stringlengths 30 228 | class_name stringlengths 1 68 | func_name stringlengths 1 48 | masked_class stringlengths 78 9.82k | func_body stringlengths 46 9.61k | len_input int64 29 2.01k | len_output int64 14 1.94k | total int64 55 2.05k | relevant_context stringlengths 0 38.4k |
|---|---|---|---|---|---|---|---|---|---|
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/search/context/PhraseHighlight.java | PhraseHighlight | merge | class PhraseHighlight {
/**
* a value that has been translated from start offset w.r.t. document
* start to a value w.r.t. line start -- or -1 if not beginning this
* line
*/
private final int lineStart;
/**
* a value that has been translated from start offset w.r.t. document
... |
int mergeStart = Math.min(lineStart, other.lineStart);
int mergeEnd = Math.max(lineEnd, other.lineEnd);
return PhraseHighlight.create(mergeStart, mergeEnd);
| 714 | 55 | 769 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/search/context/PhraseHighlightComparator.java | PhraseHighlightComparator | compare | class PhraseHighlightComparator implements Comparator<PhraseHighlight> {
public static final PhraseHighlightComparator INSTANCE = new PhraseHighlightComparator();
/**
* Compares two {@link PhraseHighlight} instances for order by first
* comparing using {@link Integer#compare(int, int)} the
* {@... |
int cmp;
if (o1.getLineStart() < 0) {
if (o2.getLineStart() >= 0) {
return -1;
}
cmp = 0;
} else if (o2.getLineStart() < 0) {
return 1;
} else {
cmp = Integer.compare(o1.getLineStart(), o2.getLineStart());
... | 321 | 158 | 479 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/search/context/PhraseMatcher.java | PhraseMatcher | match | class PhraseMatcher extends LineMatcher {
private final String[] phraseTerms;
private int cur;
PhraseMatcher(String[] phraseTerms, boolean caseInsensitive) {
super(caseInsensitive);
this.phraseTerms = phraseTerms.clone();
cur = 0;
}
@Override
public int match(String to... |
if (equal(token, phraseTerms[cur])) {
if (cur < phraseTerms.length - 1) {
cur++;
return WAIT; //matching.
}
cur = 0;
return MATCHED; //matched!
} else if (cur > 0) {
cur = 0;
if (equal(token, phraseT... | 107 | 131 | 238 | <methods>public abstract int match(java.lang.String) <variables>public static final int MATCHED,public static final int NOT_MATCHED,public static final int WAIT,private final non-sealed boolean caseInsensitive |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/search/context/PrefixMatcher.java | PrefixMatcher | match | class PrefixMatcher extends LineMatcher {
private final String prefix;
public PrefixMatcher(String prefix, boolean caseInsensitive) {
super(caseInsensitive);
this.prefix = normalizeString(prefix);
}
@Override
public int match(String token) {<FILL_FUNCTION_BODY>}
} |
String tokenToMatch = normalizeString(token);
return tokenToMatch.startsWith(prefix) ? MATCHED : NOT_MATCHED;
| 88 | 40 | 128 | <methods>public abstract int match(java.lang.String) <variables>public static final int MATCHED,public static final int NOT_MATCHED,public static final int WAIT,private final non-sealed boolean caseInsensitive |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/search/context/QueryMatchers.java | QueryMatchers | getWildTerm | class QueryMatchers {
private Set<String> caseSensitiveTerms;
private Set<String> caseInsensitiveTerms;
private List<LineMatcher> matchers;
private Map<String, Boolean> fields;
/**
* Get the terms from a query and returns a list of DFAs which match a stream
* of tokens.
*
* @pa... |
Term term = query.getTerm();
if (useTerm(term)) {
matchers.add(
new WildCardMatcher(term.text(), isCaseInsensitive(term)));
}
| 1,186 | 52 | 1,238 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/search/context/RegexpMatcher.java | RegexpMatcher | match | class RegexpMatcher extends LineMatcher {
private static final Logger LOGGER = LoggerFactory.getLogger(RegexpMatcher.class);
private final Pattern termRegexp;
RegexpMatcher(String term, boolean caseInsensitive) {
super(caseInsensitive);
Pattern regexp;
try {
regexp = P... |
return (termRegexp != null && termRegexp.matcher(line).matches()) ? MATCHED : NOT_MATCHED;
| 212 | 39 | 251 | <methods>public abstract int match(java.lang.String) <variables>public static final int MATCHED,public static final int NOT_MATCHED,public static final int WAIT,private final non-sealed boolean caseInsensitive |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/search/context/StrictLineBreakIterator.java | StrictLineBreakIterator | next | class StrictLineBreakIterator extends BreakIterator {
private final List<Integer> breaks = new ArrayList<>();
private char peekChar = CharacterIterator.DONE;
private CharacterIterator charIt;
private int breakOffset = -1;
public StrictLineBreakIterator() {
charIt = new StringCharacterItera... |
if (breakOffset + 1 < breaks.size()) {
return breaks.get(++breakOffset);
}
char lastChar = CharacterIterator.DONE;
int charOff;
while (true) {
char nextChar;
if (peekChar != CharacterIterator.DONE) {
nextChar = peekChar;
... | 809 | 407 | 1,216 | <methods>public java.lang.Object clone() ,public abstract int current() ,public abstract int first() ,public abstract int following(int) ,public static synchronized java.util.Locale[] getAvailableLocales() ,public static java.text.BreakIterator getCharacterInstance() ,public static java.text.BreakIterator getCharacterI... |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/search/context/WildCardMatcher.java | WildCardMatcher | wildcardEquals | class WildCardMatcher extends LineMatcher {
final String pattern;
public WildCardMatcher(String pattern, boolean caseInsensitive) {
super(caseInsensitive);
this.pattern = normalizeString(pattern);
}
@Override
public int match(String token) {
String tokenToMatch = normalize... |
int p = patternIdx;
for (int s = stringIdx;; ++p, ++s) {
// End of string yet?
boolean sEnd = (s >= string.length());
// End of pattern yet?
boolean pEnd = (p >= pattern.length());
// If we're looking at the end of the string...
... | 532 | 663 | 1,195 | <methods>public abstract int match(java.lang.String) <variables>public static final int MATCHED,public static final int NOT_MATCHED,public static final int WAIT,private final non-sealed boolean caseInsensitive |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/util/AbstractObjectPool.java | AbstractObjectPool | release | class AbstractObjectPool<T> implements ObjectPool<T> {
/**
* Returns the object to the pool.
* The method first validates the object if it is
* re-usable and then puts returns it to the pool.
*
* If the object validation fails,
* {@link #handleInvalidReturn(java.lang.Object)} is calle... |
if (isValid(t)) {
returnToPool(t);
} else {
handleInvalidReturn(t);
}
| 199 | 37 | 236 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/util/BoundedBlockingObjectPool.java | BoundedBlockingObjectPool | handleInvalidReturn | class BoundedBlockingObjectPool<T> extends AbstractObjectPool<T>
implements BlockingObjectPool<T> {
private static final Logger LOGGER = LoggerFactory.getLogger(
BoundedBlockingObjectPool.class);
private final int size;
private final LinkedBlockingDeque<T> objects;
private final Object... |
if (LOGGER.isLoggable(Level.FINE)) {
LOGGER.log(Level.FINE, "createNew() to handle invalid {0}",
t.getClass());
}
t = objectFactory.createNew();
executor.submit(new ObjectReturner<>(objects, t, puttingLast));
| 1,013 | 85 | 1,098 | <methods>public non-sealed void <init>() ,public final void release(T) <variables> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/util/CloseableReentrantReadWriteLock.java | CloseableReentrantReadWriteLock | readLockAsResource | class CloseableReentrantReadWriteLock extends ReentrantReadWriteLock {
private static final long serialVersionUID = 95L;
private transient ResourceLock readUnlocker = newReadUnlocker();
private transient ResourceLock writeUnlocker = newWriteUnlocker();
/**
* @return a defined {@link ResourceLoc... |
/*
* A subclass of ReentrantReadWriteLock is forced to be serializable, so
* we would have to handle where serialization can short-circuit field
* initialization above and leave the instance's fields null.
* Consequently, the fields cannot be final. They are encapsulating
... | 411 | 180 | 591 | <methods>public void <init>() ,public void <init>(boolean) ,public final int getQueueLength() ,public int getReadHoldCount() ,public int getReadLockCount() ,public int getWaitQueueLength(java.util.concurrent.locks.Condition) ,public int getWriteHoldCount() ,public final boolean hasQueuedThread(java.lang.Thread) ,public... |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/util/ColorUtil.java | ColorUtil | fromHex | class ColorUtil {
private ColorUtil() {
}
/**
* Return Color object from string. The following formats are allowed:
* {@code A1B2C3},
* {@code abc123}
*
* @param str hex string
* @return Color object
*/
public static Color fromHex(String str) {<FILL_FUNCTION_BODY>}
... |
if (str.length() != 6) {
throw new IllegalArgumentException("unsupported length:" + str);
}
return new Color(parseHexNumber(str, 0), parseHexNumber(str, 2), parseHexNumber(str, 4));
| 297 | 70 | 367 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/util/CtagsUtil.java | CtagsUtil | canProcessFiles | class CtagsUtil {
private static final Logger LOGGER = LoggerFactory.getLogger(CtagsUtil.class);
public static final String SYSTEM_CTAGS_PROPERTY = "org.opengrok.indexer.analysis.Ctags";
/** Private to enforce static. */
private CtagsUtil() {
}
/**
* Check that {@code ctags} program exi... |
Path inputPath;
try {
inputPath = File.createTempFile("ctagsValidation", ".c", baseDir).toPath();
} catch (IOException e) {
LOGGER.log(Level.WARNING, "cannot create temporary file in ''{0}''", baseDir);
return false;
}
final String resourceFil... | 1,313 | 445 | 1,758 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/util/ErrorMessageCollector.java | ErrorMessageCollector | finisher | class ErrorMessageCollector implements Collector<String, StringJoiner, Optional<String>> {
private final String prefix;
private final String emptyString;
private final boolean returnNullWhenEmpty;
/**
* Creates a collector with given prefix and
* returns optional empty for empty collection.
... |
return stringJoiner ->
Optional.of(stringJoiner.toString())
.filter(msg -> !(msg.isEmpty() && returnNullWhenEmpty));
| 792 | 44 | 836 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/util/Executor.java | SpoolHandler | processStream | class SpoolHandler implements StreamHandler {
private final ByteArrayOutputStream bytes = new ByteArrayOutputStream();
public byte[] getBytes() {
return bytes.toByteArray();
}
@Override
public void processStream(InputStream input) throws IOException {<FILL_FUNCTION... |
BufferedInputStream in = new BufferedInputStream(input);
byte[] buffer = new byte[8092];
int len;
while ((len = in.read(buffer)) != -1) {
if (len > 0) {
bytes.write(buffer, 0, len);
}
}
| 79 | 85 | 164 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/util/FileExtraZipper.java | FileExtraZipper | zip | class FileExtraZipper {
/**
* Merge the specified lists by looking up a possible entry in
* {@code extras} for every element in {@code entries}.
*
* @param entries list of {@link DirectoryEntry} instances
* @param extras some OpenGrok-analyzed extra metadata
*/
public void zip(Li... |
if (extras == null) {
return;
}
Map<String, NullableNumLinesLOC> byName = indexExtraByName(extras);
for (DirectoryEntry entry : entries) {
NullableNumLinesLOC extra = findExtra(byName, entry.getFile());
entry.setExtra(extra);
}
| 305 | 91 | 396 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/util/Getopt.java | Option | parse | class Option {
char optOption;
String argument;
}
private final List<Option> options;
private int current;
private int optind;
private final String[] argv;
private final String opts;
/**
* Creates a new instance of Getopt.
* @param argv argument vector
* @par... |
int ii = 0;
while (ii < argv.length) {
char[] chars = argv[ii].toCharArray();
if (chars.length > 0 && chars[0] == '-') {
if (argv[ii].equals("--")) {
// End of command line options ;)
optind = ii + 1;
b... | 211 | 413 | 624 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/util/HeadHandler.java | HeadHandler | processStream | class HeadHandler implements Executor.StreamHandler {
private final int maxLines;
private final List<String> lines = new ArrayList<>();
private final Charset charset;
private static final int BUFFERED_READER_SIZE = 200;
/**
* Charset of the underlying reader is set to UTF-8.
* @param ma... |
try (BufferedInputStream bufStream = new BufferedInputStream(input);
BufferedReader reader = new BufferedReader(new InputStreamReader(bufStream, this.charset),
BUFFERED_READER_SIZE)) {
int lineNum = 0;
while (lineNum < maxLines) {
String line = re... | 366 | 173 | 539 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/util/HostUtil.java | HostUtil | isReachable | class HostUtil {
private static final Logger LOGGER = LoggerFactory.getLogger(HostUtil.class);
private HostUtil() {
// private to enforce static
}
/**
* @param urlStr URI
* @return port number
* @throws URISyntaxException on error
*/
public static int urlToPort(String ... |
boolean connectWorks = false;
try {
int port = HostUtil.urlToPort(webappURI);
if (port <= 0) {
LOGGER.log(Level.SEVERE, () -> "invalid port number for " + webappURI);
return false;
}
return isWebAppReachable(webappURI, ti... | 679 | 150 | 829 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/util/LazilyInstantiate.java | LazilyInstantiate | swapper | class LazilyInstantiate<T> implements Supplier<T> {
private final Supplier<T> supplier;
private Supplier<T> current;
private volatile boolean active;
public static <T> LazilyInstantiate<T> using(Supplier<T> supplier) {
return new LazilyInstantiate<>(supplier);
}
/**
* Executes th... |
if (!(current instanceof Factory)) {
T obj = supplier.get();
current = new Factory<>(obj);
active = true;
}
return current.get();
| 399 | 48 | 447 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/util/LineBreaker.java | LineBreaker | reset | class LineBreaker {
private static final String RESET_FAILED_MSG = "reset() did not succeed";
private int length;
private int count;
private int[] lineOffsets;
/**
* Calls
* {@link #reset(org.opengrok.indexer.analysis.StreamSource, org.opengrok.indexer.util.ReaderWrapper)}
* with {... |
length = 0;
lineOffsets = null;
List<Long> newOffsets = new ArrayList<>();
LineBreakerScanner scanner = new LineBreakerScanner(reader);
scanner.setTarget(newOffsets);
scanner.consume();
long fullLength = scanner.getLength();
/*
* Lucene cannot g... | 727 | 343 | 1,070 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/util/NumberUtil.java | NumberUtil | tryParseLong | class NumberUtil {
/**
* Parses the specified {@code value} without throwing a checked exception.
*/
public static Long tryParseLong(String value) {<FILL_FUNCTION_BODY>}
/* private to enforce static */
private NumberUtil() {
}
} |
if (value == null) {
return null;
}
try {
return Long.parseLong(value);
} catch (NumberFormatException e) {
return null;
}
| 75 | 53 | 128 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/util/PathUtils.java | PathUtils | getRelativeToCanonical | class PathUtils {
private static final Logger LOGGER =
LoggerFactory.getLogger(PathUtils.class);
/**
* Calls {@link #getRelativeToCanonical(Path, Path, Set, Set)}
* with {@code path}, {@code canonical}, {@code allowedSymlinks=null}, and
* {@code canonicalRoots=null} (to disable validatio... |
if (path.equals(canonical)) {
return "";
}
// The following fixup of \\ is really to allow
// IndexDatabaseTest.testGetDefinitions() to succeed on Linux or macOS.
// That test has an assertion that operation is the "same for windows
// delimiters" and passe... | 1,205 | 696 | 1,901 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/util/Progress.java | Progress | logIt | class Progress implements AutoCloseable {
private final Logger logger;
private final Long totalCount;
private final String suffix;
private final AtomicLong currentCount = new AtomicLong();
private final Map<Level, Integer> levelCountMap = new TreeMap<>(Comparator.comparingInt(Level::intValue).rever... |
if (logger.isLoggable(currentLevel)) {
lastLoggedChunk.put(currentLevel, currentCount / levelCountMap.get(currentLevel));
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("Progress: ");
stringBuilder.append(currentCount);
string... | 1,465 | 170 | 1,635 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/util/RainbowColorGenerator.java | RainbowColorGenerator | generateLinearColorSequence | class RainbowColorGenerator {
private static final int COLORS_BETWEEN_ANCHORS = 4;
private static final Color[] STOP_COLORS = new Color[]{
fromHex("eaffe2"),
fromHex("d9e4f9"),
fromHex("d1d1d1"),
fromHex("fffbcf"),
fromHex("ffbfc3"),
};
priva... |
assert colorsBetweenAnchors >= 0;
if (anchorColors.size() == 1) {
return Collections.singletonList(anchorColors.get(0));
}
int segmentCount = anchorColors.size() - 1;
List<Color> result = new ArrayList<>(anchorColors.size() + segmentCount * colorsBetweenAnchors);
... | 719 | 235 | 954 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/util/SourceSplitter.java | SourceSplitter | reset | class SourceSplitter {
private static final String RESET_FAILED_MSG = "reset() did not succeed";
private int length;
private String[] lines;
private int[] lineOffsets;
/**
* Gets the number of characters in the original source document.
*/
public int originalLength() {
retur... |
if (src == null) {
throw new IllegalArgumentException("`src' is null");
}
SplitterUtil.reset(this::reset, src, wrapper);
| 1,259 | 46 | 1,305 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/util/SplitterUtil.java | SplitterUtil | reset | class SplitterUtil {
@FunctionalInterface
interface Resetter {
void reset(Reader reader) throws IOException;
}
/**
* Find the line index for the specified document offset.
* @param offset greater than or equal to zero and less than
* {@code length}.
* @return -1 if {@code o... |
if (src == null) {
throw new IllegalArgumentException("src is null");
}
try (InputStream in = src.getStream();
Reader rdr = IOUtils.createBOMStrippedReader(in, StandardCharsets.UTF_8.name())) {
Reader intermediate = null;
if (wrapper != null) {
... | 483 | 171 | 654 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/util/Statistics.java | Statistics | logIt | class Statistics {
private final Instant startTime;
public Statistics() {
startTime = Instant.now();
}
/**
* Log a message with duration using provided logger if the supplied log level is active.
* @param logger logger instance
* @param logLevel log level
* @param msg message ... |
if (logger.isLoggable(logLevel)) {
String timeStr = StringUtils.getReadableTime(duration.toMillis());
logger.log(logLevel, String.format("%s (took %s)", launderLog(msg), timeStr));
return true;
}
return false;
| 859 | 80 | 939 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/util/TandemFilename.java | TandemFilename | maybePackSha | class TandemFilename {
private static final int MAX_BYTES = 255;
/**
* One fewer than {@link #MAX_BYTES} as a cap for simple concatenation to
* avoid the possibility of easily fabricating a collision against this
* algorithm. I.e., a 255 byte tandem filename will always include a
* compute... |
byte[] uFilename = filename.getBytes(StandardCharsets.UTF_8);
int nBytes = uFilename.length;
if (nBytes + asciiExtension.length() <= MAX_CAT_BYTES) {
// Here the UTF-8 encoding already allows for the new extension.
return filename + asciiExtension;
}
/*... | 812 | 685 | 1,497 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/util/TandemPath.java | TandemPath | join | class TandemPath {
/** Private to enforce static. */
private TandemPath() {
}
/**
* Appends an ASCII extension to the specified {@code filePath}, truncating
* and packing in a SHA-256 hash if the UTF-8 encoding of the filename
* component of the path would exceed 254 bytes and arriving ... |
File file = new File(filePath);
String newName = TandemFilename.join(file.getName(), asciiExtension);
File newFile = new File(file.getParent(), newName);
return newFile.getPath();
| 258 | 64 | 322 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/util/UriUtils.java | TrimUriResult | trimUri | class TrimUriResult {
private final String uri;
private final int pushBackCount;
TrimUriResult(String uri, int pushBackCount) {
this.uri = uri;
this.pushBackCount = pushBackCount;
}
public String getUri() {
return uri;
}
publ... |
int n = 0;
while (true) {
/*
* An ending-pushback could be present before a collateral capture,
* so detect both in a loop (on a shrinking `url') until no more
* shrinking should occur.
*/
int subN = 0;
if (should... | 344 | 241 | 585 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/util/Version.java | Version | compareTo | class Version implements Comparable<Version> {
private final Integer[] versions;
/**
* Construct the version from integer parts.
* The order is:
* <ol>
* <li>major</li>
* <li>minor</li>
* <li>patch</li>
* <li>... others</li>
* </ol>
*
* @param parts integer val... |
if (o == null) {
return 1;
}
// first different number determines the result
for (int i = 0; i < Math.min(versions.length, o.versions.length); i++) {
if (!versions[i].equals(o.versions[i])) {
return Integer.compare(versions[i], o.versions[i]);
... | 504 | 173 | 677 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/util/WhitelistObjectInputFilter.java | WhitelistObjectInputFilter | checkInput | class WhitelistObjectInputFilter implements ObjectInputFilter {
private final Set<Class<?>> whitelist;
public WhitelistObjectInputFilter(@NotNull final Class<?>... whitelist) {
this.whitelist = Set.of(whitelist);
}
@Override
public Status checkInput(final FilterInfo filterInfo) {<FILL_FUN... |
if (filterInfo.serialClass() == null || whitelist.contains(filterInfo.serialClass())) {
return Status.ALLOWED;
}
return Status.REJECTED;
| 105 | 50 | 155 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/web/ApiUtils.java | ApiUtils | waitForAsyncApi | class ApiUtils {
private static final Logger LOGGER = LoggerFactory.getLogger(ApiUtils.class);
private static final RuntimeEnvironment env = RuntimeEnvironment.getInstance();
private ApiUtils() {
// utility class
}
/**
* Busy waits for API call to complete by repeatedly querying the... |
if (response.getStatus() != Response.Status.ACCEPTED.getStatusCode()) {
LOGGER.log(Level.WARNING, "API request not accepted: {0}", response);
return response;
}
String location = response.getHeaderString(HttpHeaders.LOCATION);
if (location == null) {
... | 265 | 464 | 729 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/web/EftarFile.java | Node | write | class Node {
private final long hash;
private String tag;
private final Map<Long, Node> children;
private long tagOffset;
private long childOffset;
Node(long hash, String tag) {
this.hash = hash;
this.tag = tag;
children = new TreeMap... |
if (n.tag != null) {
out.write(n.tag.getBytes());
offset += n.tag.length();
}
for (Node childNode : n.children.values()) {
out.writeLong(childNode.hash);
if (childNode.children.size() > 0) {
out.writeShort((short) (childNode.childO... | 326 | 270 | 596 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/web/EftarFileReader.java | FNode | get | class FNode {
private final long offset;
private long hash;
private int childOffset;
private int numChildren;
private int tagOffset;
public FNode() throws IOException {
offset = f.getFilePointer();
try {
hash = f.readLong();
... |
f.seek(0);
FNode n = new FNode();
FNode next;
long tagOffset = 0;
int tagLength = 0;
var tokens = Arrays.stream(path.split("/"))
.filter(Objects::nonNull)
.filter(tok -> !tok.isEmpty())
.collect(Collectors.toList());
... | 1,165 | 304 | 1,469 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/web/Laundromat.java | Laundromat | launderLog | class Laundromat {
private static final String ESC_N_R_T_F = "[\\n\\r\\t\\f]";
private static final String ESG_N_R_T_F_1_N = ESC_N_R_T_F + "+";
/**
* Sanitize {@code value} where it will be used in subsequent OpenGrok
* (non-logging) processing.
* @return {@code null} if null or else {@code... |
if (value == null) {
return null;
}
return value.replace("\n", "<LF>").
replace("\r", "<CR>").
replace("\t", "<TAB>").
replace("\f", "<FF>");
| 909 | 69 | 978 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/web/Suggestion.java | Suggestion | isUsable | class Suggestion {
/** index name. */
private final String name;
/** freetext search suggestions. */
private String[] freetext;
/** references search suggestions. */
private String[] refs;
/** definitions search suggestions. */
private String[] defs;
/**
* Create a new suggest... |
return (freetext != null && freetext.length > 0)
|| (defs != null && defs.length > 0)
|| (refs != null && refs.length > 0);
| 334 | 56 | 390 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/web/messages/MessagesUtils.java | TaggedMessagesContainer | messagesToJson | class TaggedMessagesContainer implements JSONable {
private final String tag;
private final SortedSet<MessagesContainer.AcceptedMessage> messages;
TaggedMessagesContainer(String tag, SortedSet<MessagesContainer.AcceptedMessage> messages) {
this.tag = tag;
this.messages ... |
if (Objects.isNull(project)) {
return JSONable.EMPTY;
}
List<String> tags = new ArrayList<>(Arrays.asList(additionalTags));
tags.add(project.getName());
project.getGroups().stream().map(Group::getName).forEach(tags::add);
return messagesToJson(tags);
| 1,112 | 92 | 1,204 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-web/src/main/java/org/opengrok/web/AuthorizationFilter.java | AuthorizationFilter | init | class AuthorizationFilter implements Filter {
private static final Logger LOGGER = LoggerFactory.getLogger(AuthorizationFilter.class);
@Override
public void init(FilterConfig fc) {<FILL_FUNCTION_BODY>}
/**
* All RESTful API requests are allowed here because they go through
* {@link org.open... |
// Empty since there is No specific init configuration.
| 680 | 16 | 696 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-web/src/main/java/org/opengrok/web/CookieFilter.java | CookieFilter | doFilter | class CookieFilter implements Filter {
private FilterConfig fc;
@Override
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain)
throws IOException, ServletException {<FILL_FUNCTION_BODY>}
private String getSuffix() {
StringBuilder sb = new StringBuilder()... |
HttpServletResponse response = (HttpServletResponse) res;
chain.doFilter(req, response);
// Change the existing cookies to use the attributes and values from the configuration.
String cookieName = HttpHeaders.SET_COOKIE;
Collection<String> headers = response.getHeaders(cookie... | 264 | 207 | 471 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-web/src/main/java/org/opengrok/web/GetFile.java | GetFile | service | class GetFile extends HttpServlet {
public static final long serialVersionUID = -1;
@Override
protected void service(final HttpServletRequest request, final HttpServletResponse response) throws IOException {<FILL_FUNCTION_BODY>}
} |
PageConfig cfg = PageConfig.get(request);
cfg.checkSourceRootExistence();
String redir = cfg.canProcess();
if (redir == null || redir.length() > 0) {
if (redir != null) {
response.sendRedirect(redir);
} else {
response.sendError(H... | 62 | 561 | 623 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-web/src/main/java/org/opengrok/web/ResponseHeaderFilter.java | ResponseHeaderFilter | doFilter | class ResponseHeaderFilter implements Filter {
FilterConfig fc;
@Override
public void doFilter(ServletRequest req, ServletResponse res,
FilterChain chain)
throws IOException, ServletException {<FILL_FUNCTION_BODY>}
@Override
public void init(FilterConfig filterConfig) {
thi... |
HttpServletResponse response = (HttpServletResponse) res;
// set the provided HTTP response parameters
for (Enumeration<String> e = fc.getInitParameterNames(); e.hasMoreElements();) {
String headerName = e.nextElement();
if (!response.containsHeader(headerName)) {
... | 117 | 127 | 244 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-web/src/main/java/org/opengrok/web/Scripts.java | FileScript | toHtml | class FileScript extends Script {
public FileScript(String script, int priority) {
super(script, priority);
}
@Override
public String toHtml() {<FILL_FUNCTION_BODY>}
} |
return "\t<script type=\"text/javascript\" src=\"" +
this.getScriptData() +
"\" data-priority=\"" +
this.getPriority() +
"\"></script>\n";
| 61 | 62 | 123 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-web/src/main/java/org/opengrok/web/StatisticsFilter.java | StatisticsFilter | measure | class StatisticsFilter implements Filter {
static final String REQUESTS_METRIC = "requests";
private static final String CATEGORY_TAG = "category";
private final DistributionSummary requests = Metrics.getPrometheusRegistry().summary(REQUESTS_METRIC);
@Override
public void init(FilterConfig fc) th... |
String category;
category = getCategory(httpReq, config);
Timer categoryTimer = Timer.builder("requests.latency").
tags(CATEGORY_TAG, category, "code", String.valueOf(httpResponse.getStatus())).
register(Metrics.getPrometheusRegistry());
categoryTimer.re... | 543 | 268 | 811 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-web/src/main/java/org/opengrok/web/WebappListener.java | WebappListener | indexCheck | class WebappListener implements ServletContextListener, ServletRequestListener {
private static final Logger LOGGER = LoggerFactory.getLogger(WebappListener.class);
private final Timer startupTimer = Timer.builder("webapp.startup.latency").
description("web application startup latency").
... |
try (IndexCheck indexCheck = new IndexCheck(Configuration.read(new File(configPath)))) {
indexCheck.check(IndexCheck.IndexCheckMode.VERSION);
} catch (IOException e) {
LOGGER.log(Level.WARNING, "could not perform index check", e);
} catch (IndexCheckException e) {
... | 1,302 | 225 | 1,527 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-web/src/main/java/org/opengrok/web/api/ApiTask.java | ApiTask | getResponse | class ApiTask {
private static final Logger LOGGER = LoggerFactory.getLogger(ApiTask.class);
private final Callable<Object> callable;
enum ApiTaskState {
INITIAL,
SUBMITTED,
COMPLETED,
}
private ApiTaskState state;
private final UUID uuid;
private final String pat... |
// Avoid thread being blocked in future.get() below.
if (!isDone()) {
throw new IllegalStateException(String.format("task %s not yet done", this));
}
Object obj;
try {
obj = future.get();
} catch (InterruptedException ex) {
return Res... | 1,247 | 199 | 1,446 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-web/src/main/java/org/opengrok/web/api/ApiTaskManager.java | ApiTaskManager | shutdown | class ApiTaskManager {
private static final Logger LOGGER = LoggerFactory.getLogger(ApiTaskManager.class);
private final Map<String, ExecutorService> queues = new ConcurrentHashMap<>(); // queue name -> ExecutorService
private final Map<UUID, ApiTask> apiTasks = new ConcurrentHashMap<>(); // UUID -> ApiTa... |
for (ExecutorService executorService : queues.values()) {
executorService.shutdown();
}
for (Map.Entry<String, ExecutorService> entry : queues.entrySet()) {
boolean shutdownResult = entry.getValue().awaitTermination(60, TimeUnit.SECONDS);
if (!shutdownResult... | 954 | 129 | 1,083 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-web/src/main/java/org/opengrok/web/api/error/GenericExceptionMapper.java | GenericExceptionMapper | toResponse | class GenericExceptionMapper implements ExceptionMapper<Exception> {
private static final Logger logger = LoggerFactory.getLogger(GenericExceptionMapper.class);
@Override
public Response toResponse(final Exception e) {<FILL_FUNCTION_BODY>}
} |
logger.log(Level.WARNING, "Exception while processing request", e);
return ExceptionMapperUtils.toResponse(Response.Status.INTERNAL_SERVER_ERROR, e);
| 68 | 46 | 114 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-web/src/main/java/org/opengrok/web/api/v1/controller/AnnotationController.java | AnnotationDTO | getContent | class AnnotationDTO {
@JsonProperty
private String revision;
@JsonProperty
private String author;
@JsonProperty
private String description;
@JsonProperty
private String version;
// for testing
AnnotationDTO() {
}
Annotatio... |
File file = toFile(path);
Annotation annotation = HistoryGuru.getInstance().annotate(file,
revision == null || revision.isEmpty() ? null : revision);
ArrayList<AnnotationDTO> annotationList = new ArrayList<>();
for (int i = 1; i <= annotation.size(); i++) {
... | 331 | 166 | 497 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-web/src/main/java/org/opengrok/web/api/v1/controller/ConfigurationController.java | ConfigurationController | getConfigurationValueException | class ConfigurationController {
private final RuntimeEnvironment env = RuntimeEnvironment.getInstance();
public static final String PATH = "configuration";
private final SuggesterService suggesterService;
@Inject
public ConfigurationController(SuggesterService suggesterService) {
this.su... |
final IOException[] capture = new IOException[1];
final int IOE_INDEX = 0;
Object result = env.syncReadConfiguration(configuration -> {
try {
return ClassUtil.getFieldValue(configuration, fieldName);
} catch (IOException ex) {
capture[IOE_... | 807 | 142 | 949 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-web/src/main/java/org/opengrok/web/api/v1/controller/DirectoryListingController.java | DirectoryEntryDTO | equals | class DirectoryEntryDTO implements JSONable {
@JsonProperty
String path;
@JsonProperty
Long numLines;
@JsonProperty
Long loc;
@JsonProperty
Date date;
@JsonProperty
String description;
@JsonProperty
String pathDescription;
... |
return Optional.ofNullable(obj)
.filter(other -> getClass() == other.getClass())
.map(DirectoryEntryDTO.class::cast)
.filter(other -> Objects.equals(this.path, other.path))
.filter(other -> Objects.equals(this.date, other.date)... | 461 | 200 | 661 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-web/src/main/java/org/opengrok/web/api/v1/controller/FileController.java | FileController | transfer | class FileController {
public static final String PATH = "file";
private StreamingOutput transfer(File file) throws FileNotFoundException {<FILL_FUNCTION_BODY>}
@GET
@CorsEnable
@PathAuthorized
@Path("/content")
@Produces(MediaType.TEXT_PLAIN)
public StreamingOutput getContentPlain(... |
if (!file.exists()) {
throw new FileNotFoundException(String.format("file %s does not exist", file));
}
return out -> {
try (InputStream in = new FileInputStream(file)) {
byte[] buffer = new byte[1024];
int len = in.read(buffer);
... | 871 | 126 | 997 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-web/src/main/java/org/opengrok/web/api/v1/controller/GroupsController.java | GroupsController | matchProject | class GroupsController {
public static final String GROUPS_PATH = "groups";
private final RuntimeEnvironment env = RuntimeEnvironment.getInstance();
@GET
@Produces(MediaType.APPLICATION_JSON)
public List<String> listGroups() {
if (env.hasGroups()) {
return Objects.requireNonNul... |
// Avoid classification as a taint bug.
final String projectName = Laundromat.launderInput(projectNameParam);
// Avoid classification as a taint bug.
groupName = Laundromat.launderInput(groupName);
Group group;
group = Group.getByName(groupName);
if (group == nu... | 571 | 161 | 732 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-web/src/main/java/org/opengrok/web/api/v1/controller/HistoryController.java | HistoryDTO | equals | class HistoryDTO implements JSONable {
@JsonProperty
private final List<HistoryEntryDTO> entries;
@JsonProperty
private int start;
@JsonProperty
private int count;
@JsonProperty
private int total;
@TestOnly
HistoryDTO() {
this.... |
return Optional.ofNullable(obj)
.filter(other -> getClass() == other.getClass())
.map(HistoryDTO.class::cast)
.filter(other -> Objects.equals(this.entries, other.entries))
.filter(other -> Objects.equals(this.start, other.start... | 237 | 135 | 372 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-web/src/main/java/org/opengrok/web/api/v1/controller/MessagesController.java | MessagesController | removeMessagesWithTag | class MessagesController {
private final RuntimeEnvironment env = RuntimeEnvironment.getInstance();
@POST
@Consumes(MediaType.APPLICATION_JSON)
public Response addMessage(@Valid final Message message) {
env.addMessage(message);
return Response.status(Response.Status.CREATED).build();
... |
if (tag == null) {
throw new WebApplicationException("Message tag has to be specified", Response.Status.BAD_REQUEST);
}
env.removeAnyMessage(Collections.singleton(tag), text);
| 223 | 56 | 279 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-web/src/main/java/org/opengrok/web/api/v1/controller/RepositoriesController.java | RepositoriesController | getRepositoryInfoData | class RepositoriesController {
private final RuntimeEnvironment env = RuntimeEnvironment.getInstance();
private Object getRepositoryInfoData(String repositoryPath) {<FILL_FUNCTION_BODY>}
@GET
@Path("/property/{field}")
@Produces(MediaType.APPLICATION_JSON)
public Object get(@QueryParam("repos... |
for (RepositoryInfo ri : env.getRepositories()) {
if (ri.getDirectoryNameRelative().equals(repositoryPath)) {
return DTOUtil.createDTO(ri);
}
}
return null;
| 186 | 63 | 249 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-web/src/main/java/org/opengrok/web/api/v1/controller/SearchController.java | SearchEngineWrapper | search | class SearchEngineWrapper implements AutoCloseable {
private final SearchEngine engine = new SearchEngine();
private int numResults;
private SearchEngineWrapper(
final String full,
final String def,
final String symbol,
final Str... |
Set<Project> allProjects = PageConfig.get(req).getProjectHelper().getAllProjects();
if (projects == null || projects.isEmpty()) {
numResults = engine.search(new ArrayList<>(allProjects));
} else {
numResults = engine.search(allProjects.stream()
... | 260 | 209 | 469 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-web/src/main/java/org/opengrok/web/api/v1/controller/StatusController.java | StatusController | delete | class StatusController {
public static final String PATH = "status";
private static final Logger LOGGER = LoggerFactory.getLogger(StatusController.class);
@GET
@Path("/{uuid}")
public Response getStatus(@PathParam("uuid") String uuid) {
ApiTask apiTask = ApiTaskManager.getInstance().getAp... |
ApiTask apiTask = ApiTaskManager.getInstance().getApiTask(uuid);
if (apiTask == null) {
return Response.status(Response.Status.NOT_FOUND).build();
}
if (!apiTask.isDone()) {
LOGGER.log(Level.WARNING, "API task {0} not yet done", apiTask);
return Resp... | 217 | 138 | 355 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-web/src/main/java/org/opengrok/web/api/v1/controller/SystemController.java | SystemController | getIndexTime | class SystemController {
public static final String PATH = "system";
private final RuntimeEnvironment env = RuntimeEnvironment.getInstance();
private static final Logger LOGGER = LoggerFactory.getLogger(SystemController.class);
@PUT
@Path("/includes/reload")
public void reloadIncludes() {
... |
Date date = new IndexTimestamp().getDateForLastIndexRun();
ObjectMapper mapper = new ObjectMapper();
// StdDateFormat is ISO8601 since jackson 2.9
mapper.setDateFormat(new StdDateFormat().withColonInTimeZone(true));
return mapper.writeValueAsString(date);
| 358 | 87 | 445 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-web/src/main/java/org/opengrok/web/api/v1/filter/CorsFilter.java | CorsFilter | filter | class CorsFilter implements ContainerResponseFilter {
public static final String ALLOW_CORS_HEADER = "Access-Control-Allow-Origin";
public static final String CORS_REQUEST_HEADER = "Origin";
/**
* Method for ContainerResponseFilter.
*/
@Override
public void filter(ContainerRequestContext... |
// if there is no Origin header, then it is not a
// cross origin request. We don't do anything.
if (request.getHeaderString(CORS_REQUEST_HEADER) == null) {
return;
}
response.getHeaders().add(ALLOW_CORS_HEADER, "*");
| 106 | 84 | 190 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-web/src/main/java/org/opengrok/web/api/v1/filter/IncomingFilter.java | IncomingFilter | filter | class IncomingFilter implements ContainerRequestFilter, ConfigurationChangedListener {
private static final Logger LOGGER = LoggerFactory.getLogger(IncomingFilter.class);
/**
* Endpoint paths that are exempted from this filter.
* @see SearchController#search(HttpServletRequest, String, String, Strin... |
if (request == null) { // happens in tests
return;
}
String path = context.getUriInfo().getPath();
boolean isTokenValid = Optional.ofNullable(request.getHeader(HttpHeaders.AUTHORIZATION))
.filter(authHeaderValue -> authHeaderValue.startsWith(BEARER))
... | 631 | 522 | 1,153 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-web/src/main/java/org/opengrok/web/api/v1/filter/PathAuthorizationFilter.java | PathAuthorizationFilter | isPathAuthorized | class PathAuthorizationFilter implements ContainerRequestFilter {
private static final Logger logger = LoggerFactory.getLogger(PathAuthorizationFilter.class);
private static final RuntimeEnvironment env = RuntimeEnvironment.getInstance();
public static final String PATH_PARAM = "path";
@Context
... |
if (request != null) {
AuthorizationFramework auth = env.getAuthorizationFramework();
if (auth != null) {
Project p = Project.getProject(path.startsWith("/") ? path : "/" + path);
return p == null || auth.isAllowed(request, p);
}
}
... | 343 | 91 | 434 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-web/src/main/java/org/opengrok/web/api/v1/suggester/parser/SuggesterQueryDataParser.java | SuggesterQueryDataParser | getFieldQueries | class SuggesterQueryDataParser {
private static final int IDENTIFIER_LENGTH = 5;
private static final Logger logger = LoggerFactory.getLogger(SuggesterQueryDataParser.class);
private SuggesterQueryDataParser() {
}
/**
* Parses the {@link SuggesterQueryData}.
* @param data data to parse... |
Map<String, String> map = new HashMap<>();
map.put(QueryBuilder.FULL, data.getFull());
map.put(QueryBuilder.DEFS, data.getDefs());
map.put(QueryBuilder.REFS, data.getRefs());
map.put(QueryBuilder.PATH, data.getPath());
map.put(QueryBuilder.HIST, data.getHist());
... | 973 | 127 | 1,100 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-web/src/main/java/org/opengrok/web/api/v1/suggester/provider/filter/AuthorizationFilter.java | AuthorizationFilter | filter | class AuthorizationFilter implements ContainerRequestFilter {
public static final String PROJECTS_PARAM = "projects[]";
private final RuntimeEnvironment env = RuntimeEnvironment.getInstance();
@Context
private HttpServletRequest request;
/**
* Checks if the request contains {@link #PROJECTS... |
if (request == null) { // happens in tests
return;
}
AuthorizationFramework auth = env.getAuthorizationFramework();
if (auth != null) {
String[] projects = request.getParameterValues(PROJECTS_PARAM);
if (projects != null) {
for (String... | 139 | 149 | 288 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-web/src/main/java/org/opengrok/web/api/v1/suggester/query/SuggesterQueryBuilder.java | SuggesterQueryBuilder | buildQuery | class SuggesterQueryBuilder extends QueryBuilder {
private final String suggestField;
private final String identifier;
private SuggesterQueryParser suggesterQueryParser;
/**
* @param suggestField field that contain the {@link SuggesterQuery}
* @param identifier identifier that was inserted ... |
if (field.equals(suggestField)) {
suggesterQueryParser = new SuggesterQueryParser(field, identifier);
return suggesterQueryParser.parse(queryText);
} else {
return new CustomQueryParser(field).parse(queryText);
}
| 274 | 71 | 345 | <methods>public non-sealed void <init>() ,public Query build() throws ParseException,public List<java.lang.String> getContextFields() ,public java.lang.String getDefs() ,public java.lang.String getDirPath() ,public java.lang.String getFreetext() ,public java.lang.String getHist() ,public java.lang.String getPath() ,pub... |
oracle_opengrok | opengrok/opengrok-web/src/main/java/org/opengrok/web/util/DTOUtil.java | DTOUtil | createDTO | class DTOUtil {
private DTOUtil() {
// private to ensure static
}
// ModelMapper is thread-safe and we only need to convert different object types for now
// so it should be safe to reuse its instance.
private static final ModelMapper modelMapper = new ModelMapper();
/**
* Generat... |
// ModelMapper assumes getters/setters so use BeanGenerator to provide them.
BeanGenerator beanGenerator = new BeanGenerator();
for (Field field : object.getClass().getDeclaredFields()) {
if (field.isAnnotationPresent(DTOElement.class)) {
beanGenerator.addProperty(fi... | 178 | 120 | 298 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-web/src/main/java/org/opengrok/web/util/FileUtil.java | FileUtil | toFile | class FileUtil {
private static final RuntimeEnvironment env = RuntimeEnvironment.getInstance();
// private to enforce static
private FileUtil() {
}
/**
* @param path path relative to source root
* @return file object corresponding to the file under source root
* @throws FileNotFou... |
if (path == null) {
throw new NoPathParameterException("Missing path parameter");
}
File file = new File(env.getSourceRootFile(), path);
if (!file.getCanonicalPath().startsWith(env.getSourceRootPath() + File.separator)) {
throw new InvalidPathException(path, "F... | 199 | 134 | 333 | <no_super_class> |
oracle_opengrok | opengrok/plugins/src/main/java/opengrok/auth/entity/LdapUser.java | LdapUser | toString | class LdapUser implements Serializable {
private String dn; // Distinguished Name
private final Map<String, Set<String>> attributes;
private static final long serialVersionUID = 1L;
public LdapUser() {
this(null, null);
}
public LdapUser(String dn, Map<String, Set<String>> attrs) {
... |
return "LdapUser{dn=" + dn + "; attributes=" + attributes + '}';
| 335 | 29 | 364 | <no_super_class> |
oracle_opengrok | opengrok/plugins/src/main/java/opengrok/auth/plugin/LdapAttrPlugin.java | LdapAttrPlugin | init | class LdapAttrPlugin extends AbstractLdapPlugin {
private static final Logger LOGGER = Logger.getLogger(LdapAttrPlugin.class.getName());
/**
* List of configuration names.
* <ul>
* <li><code>attribute</code> is LDAP attribute to check (mandatory)</li>
* <li><code>file</code> whitelist file... |
if ((ldapAttr = (String) parameters.get(ATTR_PARAM)) == null) {
throw new NullPointerException("Missing param [" + ATTR_PARAM + "] in the setup");
}
if ((filePath = (String) parameters.get(FILE_PARAM)) == null) {
throw new NullPointerException("Missing param [" + FILE_P... | 1,392 | 295 | 1,687 | <methods>public abstract boolean checkEntity(HttpServletRequest, org.opengrok.indexer.configuration.Project) ,public abstract boolean checkEntity(HttpServletRequest, org.opengrok.indexer.configuration.Group) ,public abstract void fillSession(HttpServletRequest, opengrok.auth.plugin.entity.User) ,public opengrok.auth.pl... |
oracle_opengrok | opengrok/plugins/src/main/java/opengrok/auth/plugin/LdapFilterPlugin.java | LdapFilterPlugin | load | class LdapFilterPlugin extends AbstractLdapPlugin {
private static final Logger LOGGER = Logger.getLogger(LdapFilterPlugin.class.getName());
protected static final String FILTER_PARAM = "filter";
protected static final String TRANSFORMS_PARAM = "transforms";
private static final String SESSION_ALLOWED... |
super.load(parameters);
if ((ldapFilter = (String) parameters.get(FILTER_PARAM)) == null) {
throw new NullPointerException("Missing param [" + FILTER_PARAM + "] in the setup");
}
String instance = (String) parameters.get(INSTANCE);
if (instance != null) {
... | 1,482 | 211 | 1,693 | <methods>public abstract boolean checkEntity(HttpServletRequest, org.opengrok.indexer.configuration.Project) ,public abstract boolean checkEntity(HttpServletRequest, org.opengrok.indexer.configuration.Group) ,public abstract void fillSession(HttpServletRequest, opengrok.auth.plugin.entity.User) ,public opengrok.auth.pl... |
oracle_opengrok | opengrok/plugins/src/main/java/opengrok/auth/plugin/UserPlugin.java | UserPlugin | load | class UserPlugin implements IAuthorizationPlugin {
private static final Logger LOGGER = Logger.getLogger(UserPlugin.class.getName());
static final String DECODER_CLASS_PARAM = "decoder";
public static final String REQUEST_ATTR = "opengrok-user-plugin-user";
private IUserDecoder decoder;
public ... |
String decoderName;
if ((decoderName = (String) parameters.get(DECODER_CLASS_PARAM)) == null) {
throw new NullPointerException(String.format("missing " +
"parameter '%s' in %s configuration",
DECODER_CLASS_PARAM, UserPlugin.class.getName()));
... | 437 | 177 | 614 | <no_super_class> |
oracle_opengrok | opengrok/plugins/src/main/java/opengrok/auth/plugin/UserWhiteListPlugin.java | UserWhiteListPlugin | load | class UserWhiteListPlugin implements IAuthorizationPlugin {
private static final String CLASS_NAME = UserWhiteListPlugin.class.getName();
private static final Logger LOGGER = Logger.getLogger(CLASS_NAME);
// configuration parameters
static final String FILE_PARAM = "file";
static final String FIELD... |
if (parameters == null) {
throw new IllegalArgumentException("Null parameter");
}
String filePath;
if ((filePath = (String) parameters.get(FILE_PARAM)) == null) {
throw new IllegalArgumentException("Missing parameter [" + FILE_PARAM + "] in the configuration");
... | 482 | 340 | 822 | <no_super_class> |
oracle_opengrok | opengrok/plugins/src/main/java/opengrok/auth/plugin/configuration/Configuration.java | Configuration | encodeObject | class Configuration implements Serializable {
private static final long serialVersionUID = -1;
private List<LdapServer> servers = new ArrayList<>();
private int interval;
private String searchBase;
private WebHooks webHooks;
private int searchTimeout;
private int connectTimeout;
privat... |
try (XMLEncoder e = new XMLEncoder(new BufferedOutputStream(out))) {
e.writeObject(this);
}
| 852 | 41 | 893 | <no_super_class> |
oracle_opengrok | opengrok/plugins/src/main/java/opengrok/auth/plugin/configuration/PluginConfigurationClassLoader.java | PluginConfigurationClassLoader | loadClass | class PluginConfigurationClassLoader extends ClassLoader {
private static final Set<String> allowedClasses = Set.of(
Collections.class,
Configuration.class,
LdapServer.class,
String.class,
WebHook.class,
WebHooks.class,
XMLDecoder.... |
if (!allowedClasses.contains(name)) {
throw new IllegalAccessError(name + " is not allowed to be used in configuration");
}
return getClass().getClassLoader().loadClass(name);
| 135 | 54 | 189 | <methods>public void clearAssertionStatus() ,public final java.lang.Package getDefinedPackage(java.lang.String) ,public final java.lang.Package[] getDefinedPackages() ,public java.lang.String getName() ,public final java.lang.ClassLoader getParent() ,public static java.lang.ClassLoader getPlatformClassLoader() ,public ... |
oracle_opengrok | opengrok/plugins/src/main/java/opengrok/auth/plugin/decoders/MellonHeaderDecoder.java | MellonHeaderDecoder | fromRequest | class MellonHeaderDecoder implements IUserDecoder {
private static final Logger LOGGER = Logger.getLogger(MellonHeaderDecoder.class.getName());
static final String MELLON_EMAIL_HEADER = "MELLON_email";
static final String MELLON_USERNAME_HEADER = "MELLON_username";
@Override
public User fromReque... |
// e-mail is mandatory.
String id = request.getHeader(MELLON_EMAIL_HEADER);
if (id == null || id.isEmpty()) {
LOGGER.log(Level.WARNING,
"Can not construct User object: header ''{1}'' not found in request headers: {0}",
new Object[]{String.join... | 120 | 165 | 285 | <no_super_class> |
oracle_opengrok | opengrok/plugins/src/main/java/opengrok/auth/plugin/decoders/OSSOHeaderDecoder.java | OSSOHeaderDecoder | fromRequest | class OSSOHeaderDecoder implements IUserDecoder {
private static final Logger LOGGER = Logger.getLogger(OSSOHeaderDecoder.class.getName());
protected static final String OSSO_COOKIE_TIMESTAMP_HEADER = "osso-cookie-timestamp";
protected static final String OSSO_TIMEOUT_EXCEEDED_HEADER = "osso-idle-timeout-... |
Date cookieTimestamp = null;
// Avoid classification as a taint bug.
var username = Laundromat.launderInput(request.getHeader(OSSO_USER_DN_HEADER));
var timeouted = Laundromat.launderInput(request.getHeader(OSSO_TIMEOUT_EXCEEDED_HEADER));
var timestamp = Laundromat.launderInput... | 249 | 590 | 839 | <no_super_class> |
oracle_opengrok | opengrok/plugins/src/main/java/opengrok/auth/plugin/decoders/UserPrincipalDecoder.java | UserPrincipalDecoder | fromRequest | class UserPrincipalDecoder implements IUserDecoder {
private static final Logger LOGGER = Logger.getLogger(UserPrincipalDecoder.class.getName());
@Override
public User fromRequest(HttpServletRequest request) {<FILL_FUNCTION_BODY>}
} |
if (request.getUserPrincipal() == null) {
return null;
}
String username = request.getUserPrincipal().getName();
if (username == null || username.isEmpty()) {
LOGGER.log(Level.WARNING,
"Can not construct User object: cannot get user principal... | 72 | 105 | 177 | <no_super_class> |
oracle_opengrok | opengrok/plugins/src/main/java/opengrok/auth/plugin/entity/User.java | User | toString | class User {
private String id;
private String username;
private Date cookieTimestamp;
private boolean timeouted;
private final Map<String, Object> attrs = new HashMap<>();
public User(String username) {
this.username = username;
}
/**
* Construct User object.
* @par... |
return "User{" + "id=" + id + ", username=" + username + ", cookieTimestamp=" + cookieTimestamp +
", timeouted=" + timeouted + ", attrs=" + attrs + '}';
| 454 | 56 | 510 | <no_super_class> |
oracle_opengrok | opengrok/plugins/src/main/java/opengrok/auth/plugin/ldap/FakeLdapFacade.java | FakeLdapFacade | lookupLdapContent | class FakeLdapFacade extends AbstractLdapProvider {
@Override
public LdapSearchResult<Map<String, Set<String>>> lookupLdapContent(String dn, String filter, String[] values) {<FILL_FUNCTION_BODY>}
@Override
public boolean isConfigured() {
return true;
}
@Override
public void close(... |
Map<String, Set<String>> map = new TreeMap<>();
filter = filter == null ? "objectclass=*" : filter;
values = values == null ? new String[]{"dn", "ou"} : values;
if ("objectclass=*".equals(filter)) {
List<String> v = Arrays.asList(values);
if (v.isEmpty()) {
... | 122 | 327 | 449 | <methods>public non-sealed void <init>() ,public abstract void close() ,public abstract boolean isConfigured() ,public LdapSearchResult<Map<java.lang.String,Set<java.lang.String>>> lookupLdapContent(java.lang.String) throws opengrok.auth.plugin.ldap.LdapException,public LdapSearchResult<Map<java.lang.String,Set<java.la... |
oracle_opengrok | opengrok/plugins/src/main/java/opengrok/auth/plugin/ldap/LdapFacade.java | ContentAttributeMapper | isConfigured | class ContentAttributeMapper implements AttributeMapper<Map<String, Set<String>>> {
private final String[] values;
/**
* Create a new mapper which retrieves the given values in the resulting
* set.
*
* @param values include these values in the result
*/
... |
return servers != null && !servers.isEmpty() && searchBase != null && actualServer != -1;
| 1,183 | 30 | 1,213 | <methods>public non-sealed void <init>() ,public abstract void close() ,public abstract boolean isConfigured() ,public LdapSearchResult<Map<java.lang.String,Set<java.lang.String>>> lookupLdapContent(java.lang.String) throws opengrok.auth.plugin.ldap.LdapException,public LdapSearchResult<Map<java.lang.String,Set<java.la... |
oracle_opengrok | opengrok/plugins/src/main/java/opengrok/auth/plugin/util/FilterUtil.java | FilterUtil | replace | class FilterUtil {
private FilterUtil() {
// utility class
}
private static final String LOWER_CASE = "toLowerCase";
private static final String UPPER_CASE = "toUpperCase";
/**
* Verify the names of the transforms in the map.
* @param transforms map of attribute transforms. Vali... |
if (transforms != null) {
String transform;
if ((transform = transforms.get(name)) != null) {
value = doTransform(value, transform);
}
}
return filter.replaceAll("(?<!\\\\)%" + name + "(?<!\\\\)%", value);
| 794 | 86 | 880 | <no_super_class> |
oracle_opengrok | opengrok/plugins/src/main/java/opengrok/auth/plugin/util/RestfulClient.java | RestfulClient | postIt | class RestfulClient {
private static final Logger LOGGER = Logger.getLogger(RestfulClient.class.getName());
private RestfulClient() {
// private to ensure static
}
/**
* Perform HTTP POST request.
* @param uri URI
* @param input JSON string contents
* @return HTTP status or... |
int result;
try {
try (Client client = ClientBuilder.newBuilder().
connectTimeout(RuntimeEnvironment.getInstance().getConnectTimeout(), TimeUnit.SECONDS).build()) {
LOGGER.log(Level.FINEST, "sending REST POST request to {0}: {1}",
... | 120 | 248 | 368 | <no_super_class> |
oracle_opengrok | opengrok/plugins/src/main/java/opengrok/auth/plugin/util/WebHook.java | WebHook | post | class WebHook implements Serializable {
private static final long serialVersionUID = -1;
private String uri;
private String content;
public WebHook() {
}
WebHook(String uri, String content) {
this.uri = uri;
this.content = content;
}
public void setURI(String uri) {
... |
CompletableFuture<String> completableFuture = new CompletableFuture<>();
Executors.newCachedThreadPool(new OpenGrokThreadFactory("webhook-")).submit(() -> {
int status = RestfulClient.postIt(getURI(), getContent());
completableFuture.complete(String.valueOf(status));
... | 180 | 100 | 280 | <no_super_class> |
oracle_opengrok | opengrok/suggester/src/main/java/org/opengrok/suggest/LookupPriorityQueue.java | LookupPriorityQueue | getResult | class LookupPriorityQueue extends PriorityQueue<LookupResultItem> {
private final int maxSize;
LookupPriorityQueue(final int maxSize) {
super(maxSize);
this.maxSize = maxSize;
}
/** {@inheritDoc} */
@Override
protected boolean lessThan(final LookupResultItem item1, final Looku... |
int size = this.size();
LookupResultItem[] res = new LookupResultItem[size];
for (int i = size - 1; i >= 0; i--) { // iterate from top so results are ordered in descending order
res[i] = this.pop();
}
return Arrays.asList(res);
| 286 | 89 | 375 | <no_super_class> |
oracle_opengrok | opengrok/suggester/src/main/java/org/opengrok/suggest/LookupResultItem.java | LookupResultItem | combine | class LookupResultItem implements Comparable<LookupResultItem> {
private final String phrase;
private final Set<String> projects = new HashSet<>();
private long score;
LookupResultItem(final String phrase, final String project, final long score) {
this.phrase = phrase;
this.projects.... |
if (other == null || !canBeCombinedWith(other)) {
throw new IllegalArgumentException("Cannot combine with " + other);
}
projects.addAll(other.projects);
score += other.score;
| 491 | 58 | 549 | <no_super_class> |
oracle_opengrok | opengrok/suggester/src/main/java/org/opengrok/suggest/SuggestResultCollector.java | SuggesterLeafCollector | setScorer | class SuggesterLeafCollector implements LeafCollector {
private final LeafReaderContext context;
private final int docBase;
private SuggesterLeafCollector(LeafReaderContext context) {
this.context = context;
docBase = this.context.docBase;
}
/**
... |
if (leafReaderContext == context) {
if (scorer instanceof PhraseScorer) {
data.scorer = (PhraseScorer) scorer;
} else {
try {
// it is mentioned in the documentation that #getChildren should not be called
... | 427 | 162 | 589 | <no_super_class> |
oracle_opengrok | opengrok/suggester/src/main/java/org/opengrok/suggest/SuggesterUtils.java | SuggesterUtils | intoTerms | class SuggesterUtils {
public static final int NORMALIZED_DOCUMENT_FREQUENCY_MULTIPLIER = 1000;
private static final Logger logger = Logger.getLogger(SuggesterUtils.class.getName());
private static final long DEFAULT_TERM_WEIGHT = 0;
private SuggesterUtils() {
}
/**
* Combines the sugg... |
if (query == null) {
return Collections.emptyList();
}
List<Term> terms = new LinkedList<>();
LinkedList<Query> queue = new LinkedList<>();
queue.add(query);
while (!queue.isEmpty()) {
Query q = queue.poll();
if (q instanceof Boole... | 1,135 | 202 | 1,337 | <no_super_class> |
oracle_opengrok | opengrok/suggester/src/main/java/org/opengrok/suggest/popular/impl/chronicle/BytesRefDataAccess.java | BytesRefDataAccess | getUsing | class BytesRefDataAccess extends AbstractData<BytesRef> implements DataAccess<BytesRef> {
/** Cache field. */
private transient BytesStore<?, ?> bs;
/** State field. */
private transient byte[] array;
public BytesRefDataAccess() {
initTransients();
}
private void initTransients()... |
using = Optional.ofNullable(using)
.orElseGet( () ->
new BytesRef(new byte[array.length])
);
if (using.bytes.length < array.length) {
using.bytes = new byte[array.length];
}
System.arraycopy(array, 0, using.bytes, 0, ar... | 472 | 119 | 591 | <no_super_class> |
oracle_opengrok | opengrok/suggester/src/main/java/org/opengrok/suggest/popular/impl/chronicle/BytesRefSizedReader.java | BytesRefSizedReader | read | class BytesRefSizedReader implements SizedReader<BytesRef>, Marshallable, ReadResolvable<BytesRefSizedReader> {
public static final BytesRefSizedReader INSTANCE = new BytesRefSizedReader();
private BytesRefSizedReader() {
}
@NotNull
@Override
@SuppressWarnings({"rawtypes"})
public BytesRe... |
if (size < 0L || size > Integer.MAX_VALUE) {
throw new IORuntimeException("byte[] size should be non-negative int, " +
size + " given. Memory corruption?");
}
int arrayLength = (int) size;
using = Optional.ofNullable(using)
.orElseGet( () ... | 227 | 172 | 399 | <no_super_class> |
oracle_opengrok | opengrok/suggester/src/main/java/org/opengrok/suggest/popular/impl/chronicle/ChronicleMapAdapter.java | ChronicleMapAdapter | getPopularityData | class ChronicleMapAdapter implements PopularityMap {
private ChronicleMap<BytesRef, Integer> map;
private final File chronicleMapFile;
public ChronicleMapAdapter(final String name, final double averageKeySize, final int entries, final File file)
throws IOException {
map = ChronicleMap... |
if (page < 0) {
throw new IllegalArgumentException("Cannot retrieve popularity data for negative page: " + page);
}
if (pageSize < 0) {
throw new IllegalArgumentException("Cannot retrieve negative number of results: " + pageSize);
}
List<Entry<BytesRef, ... | 836 | 199 | 1,035 | <no_super_class> |
oracle_opengrok | opengrok/suggester/src/main/java/org/opengrok/suggest/popular/impl/chronicle/ChronicleMapConfiguration.java | ChronicleMapConfiguration | load | class ChronicleMapConfiguration implements Serializable {
private static final long serialVersionUID = -18408710536443827L;
private static final Logger logger = Logger.getLogger(ChronicleMapConfiguration.class.getName());
private static final String FILE_NAME_SUFFIX = "_map.cfg";
private int entries... |
File f = getFile(dir, field);
if (!f.exists()) {
return null;
}
try (ObjectInputStream ois = new ObjectInputStream(new FileInputStream(f))) {
ois.setObjectInputFilter(filterInfo ->
filterInfo.serialClass() == null || filterInfo.serialClass() =... | 517 | 165 | 682 | <no_super_class> |
oracle_opengrok | opengrok/suggester/src/main/java/org/opengrok/suggest/query/SuggesterFuzzyQuery.java | SuggesterFuzzyQuery | getTermsEnumForSuggestions | class SuggesterFuzzyQuery extends FuzzyQuery implements SuggesterQuery {
public SuggesterFuzzyQuery(final Term term, final int maxEdits, final int prefixLength) {
super(term, maxEdits, prefixLength);
}
/** {@inheritDoc} */
@Override
public TermsEnum getTermsEnumForSuggestions(final Terms t... |
if (terms == null) {
return TermsEnum.EMPTY;
}
return getTermsEnum(terms, new AttributeSource());
| 149 | 40 | 189 | <no_super_class> |
oracle_opengrok | opengrok/suggester/src/main/java/org/opengrok/suggest/query/SuggesterPhraseQuery.java | SuggesterPhraseQuery | toString | class SuggesterPhraseQuery extends Query {
private enum SuggestPosition {
START, MIDDLE, END;
private static SuggestPosition from(final int pos, final int size) {
if (pos == 0) {
return SuggestPosition.START;
} else if (pos == size - 1) {
ret... |
return "SuggesterPhraseQuery{" +
"phraseQuery=" + phraseQuery +
", suggesterQuery=" + suggesterQuery +
'}';
| 948 | 45 | 993 | <no_super_class> |
oracle_opengrok | opengrok/suggester/src/main/java/org/opengrok/suggest/query/SuggesterPrefixQuery.java | SuggesterPrefixQuery | getTermsEnumForSuggestions | class SuggesterPrefixQuery extends PrefixQuery implements SuggesterQuery {
/**
* @param prefix term prefix
*/
public SuggesterPrefixQuery(final Term prefix) {
super(prefix);
}
/** {@inheritDoc} */
@Override
public TermsEnum getTermsEnumForSuggestions(final Terms terms) throws... |
if (terms == null) {
return TermsEnum.EMPTY;
}
return super.getTermsEnum(terms, new AttributeSource());
| 140 | 42 | 182 | <no_super_class> |
oracle_opengrok | opengrok/suggester/src/main/java/org/opengrok/suggest/query/SuggesterRangeQuery.java | SuggesterRangeQuery | getTermsEnumForSuggestions | class SuggesterRangeQuery extends TermRangeQuery implements SuggesterQuery {
private static final Logger logger = Logger.getLogger(SuggesterRangeQuery.class.getName());
private final SuggestPosition suggestPosition;
/**
* @param field term field
* @param lowerTerm term on the left side of the r... |
if (terms == null) {
return TermsEnum.EMPTY;
}
BytesRef prefix = getPrefix();
if (prefix != null) {
Automaton prefixAutomaton = PrefixQuery.toAutomaton(prefix);
Automaton finalAutomaton;
if (suggestPosition == SuggestPosition.LOWER) {
... | 618 | 298 | 916 | <no_super_class> |
oracle_opengrok | opengrok/suggester/src/main/java/org/opengrok/suggest/query/SuggesterRegexpQuery.java | SuggesterRegexpQuery | getTermsEnumForSuggestions | class SuggesterRegexpQuery extends RegexpQuery implements SuggesterQuery {
/**
* @param term term with regexp symbols
*/
public SuggesterRegexpQuery(final Term term) {
super(term);
}
/** {@inheritDoc} */
@Override
public TermsEnum getTermsEnumForSuggestions(final Terms terms)... |
if (terms == null) {
return TermsEnum.EMPTY;
}
return super.getTermsEnum(terms);
| 150 | 37 | 187 | <no_super_class> |
oracle_opengrok | opengrok/suggester/src/main/java/org/opengrok/suggest/query/SuggesterWildcardQuery.java | SuggesterWildcardQuery | getTermsEnumForSuggestions | class SuggesterWildcardQuery extends WildcardQuery implements SuggesterQuery {
/**
* @param term term with wildcard symbols
*/
public SuggesterWildcardQuery(final Term term) {
super(term);
}
/** {@inheritDoc} */
@Override
public TermsEnum getTermsEnumForSuggestions(final Term... |
if (terms == null) {
return TermsEnum.EMPTY;
}
return super.getTermsEnum(terms, new AttributeSource());
| 147 | 42 | 189 | <no_super_class> |
oracle_opengrok | opengrok/suggester/src/main/java/org/opengrok/suggest/query/customized/CustomExactPhraseScorer.java | PostingsAndPosition | toString | class PostingsAndPosition {
private final PostingsEnum postings;
private final int offset;
private int freq;
private int upTo;
private int pos;
PostingsAndPosition(PostingsEnum postings, int offset) {
this.postings = postings;
this.offset = offset... |
return "CustomExactPhraseScorer(" + weight + ")"; // custom – renamed class
| 736 | 27 | 763 | <no_super_class> |
oracle_opengrok | opengrok/suggester/src/main/java/org/opengrok/suggest/query/customized/CustomPhraseQuery.java | CustomPhraseWeight | scorer | class CustomPhraseWeight extends Weight {
private final CustomPhraseQuery query;
private final TermStates[] states;
CustomPhraseWeight(IndexSearcher searcher, CustomPhraseQuery query) throws IOException {
super(query);
this.query = query;
this.states = new... |
LeafReader reader = context.reader();
CustomPhraseQuery.PostingsAndFreq[] postingsFreqs = new CustomPhraseQuery.PostingsAndFreq[query.terms.length];
String field = query.terms[0].field();
Terms fieldTerms = reader.terms(field);
if (fieldTerms == null) {
... | 252 | 404 | 656 | <no_super_class> |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.