code stringlengths 31 2.05k | label_name stringclasses 5 values | label int64 0 4 |
|---|---|---|
public void shouldHaveErrorMessageAlongWithCustomMessageInOutputOfTemplate() {
Map<String, Object> data = new HashMap<>();
data.put("errorMessage", "ERROR MESSAGE");
String output = view.render(data);
assertThat(output, containsString("$('trans_content').update(\"Sorry, an unexpected error occurred [ERROR MESSAGE]. :( Please check the server logs for more information.\");"));
} | Base | 1 |
public void shouldHaveTheGenericMessageInOutputOfTemplateWhenCustomErrorMessageIsNotProvided() {
String output = view.render(new HashMap<>());
assertThat(output, containsString("$('trans_content').update(\"Sorry, an unexpected error occurred. :( Please check the server logs for more information.\");"));
} | Base | 1 |
public void setLogid(String logid) {
synchronized (this) {
if ("-".equals(logid)) {
this.logid = "";
} else {
this.logid = SolrTools.escapeSpecialCharacters(logid);
}
}
} | Base | 1 |
public void setImageToShow(String imageToShow) {
synchronized (lock) {
this.imageToShow = imageToShow;
if (viewManager != null) {
viewManager.setDropdownSelected(String.valueOf(imageToShow));
}
// Reset LOGID (the LOGID setter is called later by PrettyFaces, so if a value is passed, it will still be set)
setLogid("");
logger.trace("imageToShow: {}", this.imageToShow);
}
} | Base | 1 |
protected void copyResponse(InputStream is, OutputStream out, byte[] head,
boolean base64) throws IOException
{
if (base64)
{
try (BufferedInputStream in = new BufferedInputStream(is,
BUFFER_SIZE))
{
ByteArrayOutputStream os = new ByteArrayOutputStream();
byte[] buffer = new byte[0xFFFF];
os.write(head, 0, head.length);
for (int len = is.read(buffer); len != -1; len = is.read(buffer))
{
os.write(buffer, 0, len);
}
out.write(mxBase64.encodeToString(os.toByteArray(), false).getBytes());
}
}
else
{
out.write(head);
Utils.copy(is, out);
}
} | Class | 2 |
public static void copy(InputStream in, OutputStream out, int bufferSize)
throws IOException
{
byte[] b = new byte[bufferSize];
int read;
while ((read = in.read(b)) != -1)
{
out.write(b, 0, read);
}
} | Class | 2 |
private String generateTooltipHtml(CmsListInfoBean infoBean) {
StringBuffer result = new StringBuffer();
result.append("<p><b>").append(CmsClientStringUtil.shortenString(infoBean.getTitle(), 70)).append("</b></p>");
if (infoBean.hasAdditionalInfo()) {
for (CmsAdditionalInfoBean additionalInfo : infoBean.getAdditionalInfo()) {
result.append("<p>").append(additionalInfo.getName()).append(": ");
// shorten the value to max 45 characters
result.append(CmsClientStringUtil.shortenString(additionalInfo.getValue(), 45)).append("</p>");
}
}
return result.toString();
} | Base | 1 |
public Handler<ServerWebSocket> webSocketHandler() {
if (!options.isWebsocketBridge()) {
return null;
}
StompServerHandler stomp;
synchronized (this) {
stomp = this.handler;
}
return socket -> {
if (!socket.path().equals(options.getWebsocketPath())) {
LOGGER.error("Receiving a web socket connection on an invalid path (" + socket.path() + "), the path is " +
"configured to " + options.getWebsocketPath() + ". Rejecting connection");
socket.reject();
return;
}
StompServerConnection connection = new StompServerWebSocketConnectionImpl(socket, this, writingFrameHandler);
FrameParser parser = new FrameParser(options);
socket.exceptionHandler((exception) -> {
LOGGER.error("The STOMP server caught a WebSocket error - closing connection", exception);
connection.close();
});
socket.endHandler(v -> connection.close());
parser
.errorHandler((exception) -> {
connection.write(
Frames.createInvalidFrameErrorFrame(exception));
connection.close();
}
)
.handler(frame -> stomp.handle(new ServerFrameImpl(frame, connection)));
socket.handler(parser);
};
} | Class | 2 |
public StompServer listen(int port, String host, Handler<AsyncResult<StompServer>> handler) {
if (port == -1) {
handler.handle(Future.failedFuture("TCP server disabled. The port is set to '-1'."));
return this;
}
StompServerHandler stomp;
synchronized (this) {
stomp = this.handler;
}
Objects.requireNonNull(stomp, "Cannot open STOMP server - no StompServerConnectionHandler attached to the " +
"server.");
server
.connectHandler(socket -> {
StompServerConnection connection = new StompServerTCPConnectionImpl(socket, this, writingFrameHandler);
FrameParser parser = new FrameParser(options);
socket.exceptionHandler((exception) -> {
LOGGER.error("The STOMP server caught a TCP socket error - closing connection", exception);
connection.close();
});
socket.endHandler(v -> connection.close());
parser
.errorHandler((exception) -> {
connection.write(
Frames.createInvalidFrameErrorFrame(exception));
connection.close();
}
)
.handler(frame -> stomp.handle(new ServerFrameImpl(frame, connection)));
socket.handler(parser);
})
.listen(port, host).onComplete(ar -> {
if (ar.failed()) {
if (handler != null) {
vertx.runOnContext(v -> handler.handle(Future.failedFuture(ar.cause())));
} else {
LOGGER.error(ar.cause());
}
} else {
listening = true;
LOGGER.info("STOMP server listening on " + ar.result().actualPort());
if (handler != null) {
vertx.runOnContext(v -> handler.handle(Future.succeededFuture(this)));
}
}
});
return this;
} | Class | 2 |
public void setUp(TestContext context) {
vertx = rule.vertx();
AuthenticationProvider provider = PropertyFileAuthentication.create(vertx, "test-auth.properties");
server = StompServer.create(vertx, new StompServerOptions().setSecured(true))
.handler(StompServerHandler.create(vertx).authProvider(provider));
server.listen().onComplete(context.asyncAssertSuccess());
} | Class | 2 |
void validate(TestContext context, Buffer buffer) {
context.assertTrue(buffer.toString().contains("CONNECTED"));
context.assertTrue(buffer.toString().contains("version:1.2"));
User user = server.stompHandler().getUserBySession(extractSession(buffer.toString()));
context.assertNotNull(user);
} | Class | 2 |
public List<Map<String, Object>> getAllUserGroup(@PathVariable("userId") String userId) {
return groupService.getAllUserGroup(userId);
} | Class | 2 |
public <A extends Output<E>, E extends Exception> void append(A a, char c) throws E {
switch (c) {
case '&' -> {
a.append(AMP);
}
case '<' -> {
a.append(LT);
}
case '>' -> {
a.append(GT);
}
case '"' -> {
a.append(QUOT);
}
default -> {
a.append(c);
}
}
} | Base | 1 |
public <A extends Output<E>, E extends Exception> void append(A a, CharSequence csq, int start, int end) throws E {
csq = csq == null ? "null" : csq;
for (int i = start; i < end; i++) {
char c = csq.charAt(i);
switch (c) {
case '&' -> {
a.append(csq, start, i);
start = i + 1;
a.append(AMP);
}
case '<' -> {
a.append(csq, start, i);
start = i + 1;
a.append(LT);
}
case '>' -> {
a.append(csq, start, i);
start = i + 1;
a.append(GT);
}
case '"' -> {
a.append(csq, start, i);
start = i + 1;
a.append(QUOT);
}
}
}
a.append(csq, start, end);
} | Base | 1 |
public void testParent() throws Exception {
LambdaSectionParent m = new LambdaSectionParent("ignore");
String actual = JStachio.render(m);
String expected = """
bingo
LambdaSectionParent[stuff=ignore]
""";
assertEquals(expected, actual);
} | Base | 1 |
public AFile getAFile(String nameOrPath) throws IOException {
final SFile filecurrent;
// Log.info("AParentFolderRegular::looking for " + nameOrPath);
// Log.info("AParentFolderRegular::dir = " + dir);
if (dir == null) {
filecurrent = new SFile(nameOrPath);
} else {
filecurrent = dir.getAbsoluteFile().file(nameOrPath);
}
// Log.info("AParentFolderRegular::Filecurrent " + filecurrent);
if (filecurrent.exists()) {
return new AFileRegular(filecurrent.getCanonicalFile());
}
return null;
} | Base | 1 |
public void drawU(UGraphic ug) {
for (String s : tmp) {
final Display display = Display.getWithNewlines("<:1f4c4:>" + s);
TextBlock result = display.create(fontConfiguration, HorizontalAlignment.LEFT, skinParam);
result.drawU(ug);
ug = ug.apply(UTranslate.dy(result.calculateDimension(ug.getStringBounder()).getHeight()));
}
} | Base | 1 |
public void add(String line) {
if (line.startsWith("/"))
tmp.add(line.substring(1));
} | Base | 1 |
public UImage toUImage(ColorMapper colorMapper, HColor backcolor, HColor forecolor) {
final BufferedImage im = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
if (backcolor == null) {
backcolor = HColors.WHITE;
}
if (forecolor == null) {
forecolor = HColors.BLACK;
}
final HColorGradient gradient = HColors.gradient(backcolor, forecolor, '\0');
for (int col = 0; col < width; col++) {
for (int line = 0; line < height; line++) {
final int localColor = color[line][col];
if (localColor == -1) {
final double coef = 1.0 * gray[line][col] / (16 - 1);
final Color c = gradient.getColor(colorMapper, coef, 255);
im.setRGB(col, line, c.getRGB());
} else {
im.setRGB(col, line, localColor);
}
}
}
return new UImage(new PixelImage(im, AffineTransformType.TYPE_BILINEAR));
} | Base | 1 |
public void setGray(int x, int y, int level) {
if (x < 0 || x >= width) {
return;
}
if (y < 0 || y >= height) {
return;
}
if (level < 0 || level >= 16) {
throw new IllegalArgumentException();
}
gray[y][x] = level;
color[y][x] = -1;
} | Base | 1 |
public void setColor(int x, int y, int col) {
if (x < 0 || x >= width) {
return;
}
if (y < 0 || y >= height) {
return;
}
gray[y][x] = -1;
color[y][x] = col;
} | Base | 1 |
private TValue executeReturnLegacyDefine(LineLocation location, TContext context, TMemory memory, List<TValue> args)
throws EaterException, EaterExceptionLocated {
if (legacyDefinition == null) {
throw new IllegalStateException();
}
final TMemory copy = getNewMemory(memory, args, Collections.<String, TValue>emptyMap());
final String tmp = context.applyFunctionsAndVariables(copy, location, legacyDefinition);
if (tmp == null) {
return TValue.fromString("");
}
return TValue.fromString(tmp);
// eaterReturn.execute(context, copy);
// // System.err.println("s3=" + eaterReturn.getValue2());
// return eaterReturn.getValue2();
} | Base | 1 |
public void executeProcedureInternal(TContext context, TMemory memory, List<TValue> args, Map<String, TValue> named)
throws EaterException, EaterExceptionLocated {
if (functionType != TFunctionType.PROCEDURE && functionType != TFunctionType.LEGACY_DEFINELONG) {
throw new IllegalStateException();
}
final TMemory copy = getNewMemory(memory, args, named);
context.executeLines(copy, body, TFunctionType.PROCEDURE, false);
} | Base | 1 |
public TFunctionImpl(String functionName, List<TFunctionArgument> args, boolean unquoted,
TFunctionType functionType) {
final Set<String> names = new HashSet<>();
for (TFunctionArgument tmp : args) {
names.add(tmp.getName());
}
this.signature = new TFunctionSignature(functionName, args.size(), names);
this.args = args;
this.unquoted = unquoted;
this.functionType = functionType;
} | Base | 1 |
public boolean canCover(int nbArg, Set<String> namedArguments) {
for (String n : namedArguments) {
if (signature.getNamedArguments().contains(n) == false) {
return false;
}
}
if (nbArg > args.size()) {
return false;
}
assert nbArg <= args.size();
int neededArgument = 0;
for (TFunctionArgument arg : args) {
if (namedArguments.contains(arg.getName())) {
continue;
}
if (arg.getOptionalDefaultValue() == null) {
neededArgument++;
}
}
if (nbArg < neededArgument) {
return false;
}
assert nbArg >= neededArgument;
return true;
} | Base | 1 |
public void addBody(StringLocated s) throws EaterExceptionLocated {
body.add(s);
if (s.getType() == TLineType.RETURN) {
this.containsReturn = true;
if (functionType == TFunctionType.PROCEDURE) {
throw EaterExceptionLocated
.located("A procedure cannot have !return directive. Declare it as a function instead ?", s);
// this.functionType = TFunctionType.RETURN;
}
}
} | Base | 1 |
public void finalizeEnddefinelong() {
if (functionType != TFunctionType.LEGACY_DEFINELONG) {
throw new UnsupportedOperationException();
}
if (body.size() == 1) {
this.functionType = TFunctionType.LEGACY_DEFINE;
this.legacyDefinition = body.get(0).getString();
}
} | Base | 1 |
public TValue executeReturnFunction(TContext context, TMemory memory, LineLocation location, List<TValue> args,
Map<String, TValue> named) throws EaterException, EaterExceptionLocated {
if (functionType == TFunctionType.LEGACY_DEFINE) {
return executeReturnLegacyDefine(location, context, memory, args);
}
if (functionType != TFunctionType.RETURN_FUNCTION) {
throw EaterException.unlocated("Illegal call here. Is there a return directive in your function?");
}
final TMemory copy = getNewMemory(memory, args, named);
final TValue result = context.executeLines(copy, body, TFunctionType.RETURN_FUNCTION, true);
if (result == null) {
throw EaterException.unlocated("No return directive found in your function");
}
return result;
} | Base | 1 |
private TMemory getNewMemory(TMemory memory, List<TValue> values, Map<String, TValue> namedArguments) {
final Map<String, TValue> result = new HashMap<String, TValue>();
int ivalue = 0;
for (TFunctionArgument arg : args) {
final TValue value;
if (namedArguments.containsKey(arg.getName())) {
value = namedArguments.get(arg.getName());
} else if (ivalue < values.size()) {
value = values.get(ivalue);
ivalue++;
} else {
value = arg.getOptionalDefaultValue();
}
if (value == null) {
throw new IllegalStateException();
}
result.put(arg.getName(), value);
}
return memory.forkFromGlobal(result);
} | Base | 1 |
public static Collection<SFile> fileCandidates() {
final Set<SFile> result = new TreeSet<>();
final String classpath = System.getProperty("java.class.path");
String[] classpathEntries = classpath.split(SFile.pathSeparator);
for (String s : classpathEntries) {
if (s == null)
continue;
SFile dir = new SFile(s);
if (dir.isFile()) {
dir = dir.getParentFile();
}
if (dir != null && dir.isDirectory()) {
result.add(dir.file("license.txt"));
}
}
return result;
} | Base | 1 |
public static BufferedImage retrieveDistributorImage(LicenseInfo licenseInfo) {
if (licenseInfo.getLicenseType() != LicenseType.DISTRIBUTOR) {
return null;
}
try {
final byte[] s1 = PLSSignature.retrieveDistributorImageSignature();
if (SignatureUtils.toHexString(s1).equals(SignatureUtils.toHexString(licenseInfo.sha)) == false) {
return null;
}
final InputStream dis = PSystemVersion.class.getResourceAsStream("/distributor.png");
if (dis == null) {
return null;
}
try {
final BufferedImage result = SImageIO.read(dis);
return result;
} finally {
dis.close();
}
} catch (Exception e) {
Logme.error(e);
}
return null;
} | Base | 1 |
public static synchronized LicenseInfo retrieveNamedSlow() {
cache = LicenseInfo.NONE;
if (OptionFlags.ALLOW_INCLUDE == false) {
return cache;
}
final String key = prefs.get("license", "");
if (key.length() > 0) {
cache = setIfValid(retrieveNamed(key), cache);
if (cache.isValid()) {
return cache;
}
}
for (SFile f : fileCandidates()) {
try {
if (f.exists() && f.canRead()) {
final LicenseInfo result = retrieve(f);
if (result == null) {
return null;
}
cache = setIfValid(result, cache);
if (cache.isValid()) {
return cache;
}
}
} catch (IOException e) {
Log.info("Error " + e);
// Logme.error(e);
}
}
return cache;
} | Base | 1 |
private static LicenseInfo retrieve(SFile f) throws IOException {
final BufferedReader br = f.openBufferedReader();
if (br == null) {
return null;
}
try {
final String s = br.readLine();
final LicenseInfo result = retrieveNamed(s);
if (result != null) {
Log.info("Reading license from " + f.getAbsolutePath());
}
return result;
} finally {
br.close();
}
} | Base | 1 |
public static LicenseInfo retrieveDistributor() {
final InputStream dis = PSystemVersion.class.getResourceAsStream("/distributor.txt");
if (dis == null) {
return null;
}
try {
final BufferedReader br = new BufferedReader(new InputStreamReader(dis));
final String licenseString = br.readLine();
br.close();
final LicenseInfo result = PLSSignature.retrieveDistributor(licenseString);
final Throwable creationPoint = new Throwable();
creationPoint.fillInStackTrace();
for (StackTraceElement ste : creationPoint.getStackTrace()) {
if (ste.toString().contains(result.context)) {
return result;
}
}
return null;
} catch (Exception e) {
Logme.error(e);
return null;
}
} | Base | 1 |
private static LicenseInfo setIfValid(LicenseInfo value, LicenseInfo def) {
if (value.isValid() || def.isNone()) {
return value;
}
return def;
} | Base | 1 |
static public void setAllowIncludeFalse() {
ALLOW_INCLUDE = false;
} | Pillar | 3 |
private boolean isAllowed(AFile file) throws IOException {
// ::comment when __CORE__
if (OptionFlags.ALLOW_INCLUDE)
return true;
if (file != null) {
final SFile folder = file.getSystemFolder();
// System.err.println("canonicalPath=" + path + " " + folder + " " +
// INCLUDE_PATH);
if (includePath().contains(folder))
return true;
}
// ::done
return false;
} | Pillar | 3 |
public AFile getAFile(String nameOrPath) throws IOException {
// Log.info("ImportedFiles::getAFile nameOrPath = " + nameOrPath);
// Log.info("ImportedFiles::getAFile currentDir = " + currentDir);
final AParentFolder dir = currentDir;
if (dir == null || isAbsolute(nameOrPath)) {
return new AFileRegular(new SFile(nameOrPath).getCanonicalFile());
}
// final File filecurrent = SecurityUtils.File(dir.getAbsoluteFile(),
// nameOrPath);
final AFile filecurrent = dir.getAFile(nameOrPath);
Log.info("ImportedFiles::getAFile filecurrent = " + filecurrent);
if (filecurrent != null && filecurrent.isOk()) {
return filecurrent;
}
for (SFile d : getPath()) {
if (d.isDirectory()) {
final SFile file = d.file(nameOrPath);
if (file.exists()) {
return new AFileRegular(file.getCanonicalFile());
}
} else if (d.isFile()) {
final AFileZipEntry zipEntry = new AFileZipEntry(d, nameOrPath);
if (zipEntry.isOk()) {
return zipEntry;
}
}
}
return filecurrent;
} | Pillar | 3 |
public ImportedFiles withCurrentDir(AParentFolder newCurrentDir) {
if (newCurrentDir == null) {
return this;
}
return new ImportedFiles(imported, newCurrentDir);
} | Pillar | 3 |
public FileWithSuffix getFile(String filename, String suffix) throws IOException {
final int idx = filename.indexOf('~');
final AFile file;
final String entry;
if (idx == -1) {
file = getAFile(filename);
entry = null;
} else {
file = getAFile(filename.substring(0, idx));
entry = filename.substring(idx + 1);
}
if (isAllowed(file) == false)
return FileWithSuffix.none();
return new FileWithSuffix(filename, suffix, file, entry);
} | Pillar | 3 |
private boolean isFileOk() {
// ::comment when __CORE__
if (SecurityUtils.getSecurityProfile() == SecurityProfile.SANDBOX)
// In SANDBOX, we cannot read any files
return false;
// In any case SFile should not access the security folders
// (the files must be handled internally)
try {
if (isDenied())
return false;
} catch (IOException e) {
return false;
}
// Files in "plantuml.include.path" and "plantuml.allowlist.path" are ok.
if (isInAllowList(SecurityUtils.getPath(SecurityUtils.PATHS_INCLUDES)))
return true;
if (isInAllowList(SecurityUtils.getPath(SecurityUtils.ALLOWLIST_LOCAL_PATHS)))
return true;
if (SecurityUtils.getSecurityProfile() == SecurityProfile.INTERNET)
return false;
if (SecurityUtils.getSecurityProfile() == SecurityProfile.ALLOWLIST)
return false;
if (SecurityUtils.getSecurityProfile() != SecurityProfile.UNSECURE) {
// For UNSECURE, we did not do those checks
final String path = getCleanPathSecure();
if (path.startsWith("/etc/") || path.startsWith("/dev/") || path.startsWith("/boot/")
|| path.startsWith("/proc/") || path.startsWith("/sys/"))
return false;
if (path.startsWith("//"))
return false;
}
// ::done
return true;
} | Pillar | 3 |
public static SFile fromFile(File internal) {
if (internal == null) {
return null;
}
return new SFile(internal);
} | Pillar | 3 |
private boolean isUrlOk() {
// ::comment when __CORE__
if (SecurityUtils.getSecurityProfile() == SecurityProfile.SANDBOX)
// In SANDBOX, we cannot read any URL
return false;
if (SecurityUtils.getSecurityProfile() == SecurityProfile.LEGACY)
return true;
if (SecurityUtils.getSecurityProfile() == SecurityProfile.UNSECURE)
// We are UNSECURE anyway
return true;
if (isInUrlAllowList())
// ::done
return true;
// ::comment when __CORE__
if (SecurityUtils.getSecurityProfile() == SecurityProfile.INTERNET) {
if (forbiddenURL(cleanPath(internal.toString())))
return false;
final int port = internal.getPort();
// Using INTERNET profile, port 80 and 443 are ok
return port == 80 || port == 443 || port == -1;
}
return false;
// ::done
} | Pillar | 3 |
public static boolean isSecurityEnv(String name) {
return name != null && name.toLowerCase().startsWith("plantuml.security.");
} | Pillar | 3 |
private boolean fileExists(String path) {
final SFile f = new SFile(path);
return f.exists();
} | Pillar | 3 |
public TValue executeReturnFunction(TContext context, TMemory memory, LineLocation location, List<TValue> values,
Map<String, TValue> named) throws EaterException, EaterExceptionLocated {
// ::comment when __CORE__
if (OptionFlags.ALLOW_INCLUDE == false)
// ::done
return TValue.fromBoolean(false);
// ::comment when __CORE__
final String path = values.get(0).toString();
return TValue.fromBoolean(fileExists(path));
// ::done
} | Pillar | 3 |
private String getenv(String name) {
// Check, if the script requests secret information.
// A plantuml server should have an own SecurityManager to
// avoid access to properties and environment variables, but we should
// also stop here in other deployments.
if (SecurityUtils.isSecurityEnv(name))
return null;
final String env = System.getProperty(name);
if (env != null)
return env;
return System.getenv(name);
} | Pillar | 3 |
public TValue executeReturnFunction(TContext context, TMemory memory, LineLocation location, List<TValue> values,
Map<String, TValue> named) throws EaterException, EaterExceptionLocated {
// ::comment when __CORE__
if (OptionFlags.ALLOW_INCLUDE == false)
// ::done
return TValue.fromString("");
// ::comment when __CORE__
final String name = values.get(0).toString();
final String value = getenv(name);
if (value == null)
return TValue.fromString("");
return TValue.fromString(value);
// ::done
} | Pillar | 3 |
private String loadStringData(String path, String charset) throws EaterException, UnsupportedEncodingException {
byte[] byteData = null;
if (path.startsWith("http://") || path.startsWith("https://")) {
final SURL url = SURL.create(path);
if (url == null)
throw EaterException.located("load JSON: Invalid URL " + path);
byteData = url.getBytes();
// ::comment when __CORE__
} else {
try {
final SFile file = FileSystem.getInstance().getFile(path);
if (file != null && file.exists() && file.canRead() && !file.isDirectory()) {
final ByteArrayOutputStream out = new ByteArrayOutputStream(1024 * 8);
FileUtils.copyToStream(file, out);
byteData = out.toByteArray();
}
} catch (IOException e) {
Logme.error(e);
throw EaterException.located("load JSON: Cannot read file " + path + ". " + e.getMessage());
}
// ::done
}
if (byteData == null || byteData.length == 0)
return null; // no length, no data (we want the default)
return new String(byteData, charset);
} | Pillar | 3 |
public static synchronized LicenseInfo retrieveNamedSlow() {
cache = LicenseInfo.NONE;
if (OptionFlags.ALLOW_INCLUDE == false)
return cache;
final String key = prefs.get("license", "");
if (key.length() > 0) {
cache = setIfValid(retrieveNamed(key), cache);
if (cache.isValid())
return cache;
}
for (SFile f : fileCandidates()) {
try {
if (f.exists() && f.canRead()) {
final LicenseInfo result = retrieve(f);
if (result == null)
return null;
cache = setIfValid(result, cache);
if (cache.isValid())
return cache;
}
} catch (IOException e) {
Log.info("Error " + e);
// Logme.error(e);
}
}
return cache;
} | Pillar | 3 |
public static PSystemVersion createShowVersion2(UmlSource source) {
final List<String> strings = new ArrayList<>();
strings.add("<b>PlantUML version " + Version.versionString() + "</b> (" + Version.compileTimeString() + ")");
strings.add("(" + License.getCurrent() + " source distribution)");
// :: uncomment when __CORE__
// strings.add(" ");
// strings.add("Compiled with CheerpJ 2.3");
// strings.add("Powered by CheerpJ, a Leaning Technologies Java tool");
// :: done
// :: comment when __CORE__
GraphvizCrash.checkOldVersionWarning(strings);
if (OptionFlags.ALLOW_INCLUDE) {
if (SecurityUtils.getSecurityProfile() == SecurityProfile.UNSECURE)
strings.add("Loaded from " + Version.getJarPath());
if (OptionFlags.getInstance().isWord()) {
strings.add("Word Mode");
strings.add("Command Line: " + Run.getCommandLine());
strings.add("Current Dir: " + new SFile(".").getAbsolutePath());
strings.add("plantuml.include.path: " + PreprocessorUtils.getenv(SecurityUtils.PATHS_INCLUDES));
}
}
strings.add(" ");
GraphvizUtils.addDotStatus(strings, true);
strings.add(" ");
for (String name : OptionPrint.interestingProperties())
strings.add(name);
for (String v : OptionPrint.interestingValues())
strings.add(v);
// ::done
return new PSystemVersion(source, true, strings);
} | Pillar | 3 |
public static byte[] compress(int[] input)
throws IOException
{
return rawCompress(input, input.length * 4); // int uses 4 bytes
} | Base | 1 |
public static byte[] compress(double[] input)
throws IOException
{
return rawCompress(input, input.length * 8); // double uses 8 bytes
} | Base | 1 |
public static byte[] compress(float[] input)
throws IOException
{
return rawCompress(input, input.length * 4); // float uses 4 bytes
} | Base | 1 |
public static byte[] compress(short[] input)
throws IOException
{
return rawCompress(input, input.length * 2); // short uses 2 bytes
} | Base | 1 |
public static byte[] compress(char[] input)
throws IOException
{
return rawCompress(input, input.length * 2); // char uses 2 bytes
} | Base | 1 |
public static byte[] compress(long[] input)
throws IOException
{
return rawCompress(input, input.length * 8); // long uses 8 bytes
} | Base | 1 |
public AbstractSniHandler() {
this(0L);
} | Class | 2 |
public SniHandler(Mapping<? super String, ? extends SslContext> mapping, long handshakeTimeoutMillis) {
this(new AsyncMappingAdapter(mapping), handshakeTimeoutMillis);
} | Class | 2 |
public SniHandler(AsyncMapping<? super String, ? extends SslContext> mapping) {
this(mapping, 0L);
} | Class | 2 |
public SniHandler(AsyncMapping<? super String, ? extends SslContext> mapping, long handshakeTimeoutMillis) {
super(handshakeTimeoutMillis);
this.mapping = (AsyncMapping<String, SslContext>) ObjectUtil.checkNotNull(mapping, "mapping");
} | Class | 2 |
public void testSniHandlerFiresHandshakeTimeout() throws Exception {
SniHandler handler = new SniHandler(new Mapping<String, SslContext>() {
@Override
public SslContext map(String input) {
throw new UnsupportedOperationException("Should not be called");
}
}, 10);
final AtomicReference<SniCompletionEvent> completionEventRef =
new AtomicReference<SniCompletionEvent>();
EmbeddedChannel ch = new EmbeddedChannel(handler, new ChannelInboundHandlerAdapter() {
@Override
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) {
if (evt instanceof SniCompletionEvent) {
completionEventRef.set((SniCompletionEvent) evt);
}
}
});
try {
while (completionEventRef.get() == null) {
Thread.sleep(100);
// We need to run all pending tasks as the handshake timeout is scheduled on the EventLoop.
ch.runPendingTasks();
}
SniCompletionEvent completionEvent = completionEventRef.get();
assertNotNull(completionEvent);
assertNotNull(completionEvent.cause());
assertEquals(SslHandshakeTimeoutException.class, completionEvent.cause().getClass());
} finally {
ch.finishAndReleaseAll();
}
} | Class | 2 |
public void testDecorationWithNull() {
Http2ConnectionDecoder delegate = mock(Http2ConnectionDecoder.class);
Http2EmptyDataFrameConnectionDecoder decoder = new Http2EmptyDataFrameConnectionDecoder(delegate, 2);
decoder.frameListener(null);
assertNull(decoder.frameListener());
} | Class | 2 |
public void testDecoration() {
Http2ConnectionDecoder delegate = mock(Http2ConnectionDecoder.class);
final ArgumentCaptor<Http2FrameListener> listenerArgumentCaptor =
ArgumentCaptor.forClass(Http2FrameListener.class);
when(delegate.frameListener()).then(new Answer<Http2FrameListener>() {
@Override
public Http2FrameListener answer(InvocationOnMock invocationOnMock) {
return listenerArgumentCaptor.getValue();
}
});
Http2FrameListener listener = mock(Http2FrameListener.class);
Http2EmptyDataFrameConnectionDecoder decoder = new Http2EmptyDataFrameConnectionDecoder(delegate, 2);
decoder.frameListener(listener);
verify(delegate).frameListener(listenerArgumentCaptor.capture());
assertThat(decoder.frameListener(),
CoreMatchers.not(CoreMatchers.instanceOf(Http2EmptyDataFrameListener.class)));
assertThat(decoder.frameListener0(), CoreMatchers.instanceOf(Http2EmptyDataFrameListener.class));
} | Class | 2 |
public Bin(String name, Object value) {
this.name = name;
this.value = Value.get(value);
} | Base | 1 |
public static Bin asBlob(String name, Object value) {
return new Bin(name, Value.getAsBlob(value));
} | Base | 1 |
public int write(byte[] buffer, int offset) {
System.arraycopy(bytes, 0, buffer, offset, bytes.length);
return bytes.length;
} | Base | 1 |
public static Value getAsBlob(Object value) {
return (value == null)? NullValue.INSTANCE : new BlobValue(value);
} | Base | 1 |
public int getType() {
return ParticleType.JBLOB;
} | Base | 1 |
public void pack(Packer packer) {
packer.packBlob(object);
} | Base | 1 |
public static byte[] serialize(Object val) {
if (DisableSerializer) {
throw new AerospikeException("Object serializer has been disabled");
}
try (ByteArrayOutputStream bstream = new ByteArrayOutputStream()) {
try (ObjectOutputStream ostream = new ObjectOutputStream(bstream)) {
ostream.writeObject(val);
}
return bstream.toByteArray();
}
catch (Throwable e) {
throw new AerospikeException.Serialize(e);
}
} | Base | 1 |
public void validateKeyType() {
throw new AerospikeException(ResultCode.PARAMETER_ERROR, "Invalid key type: jblob");
} | Base | 1 |
public String toString() {
return Buffer.bytesToHexString(bytes);
} | Base | 1 |
public Object getObject() {
return object;
} | Base | 1 |
public int hashCode() {
return object.hashCode();
} | Base | 1 |
public boolean equals(Object other) {
return (other != null &&
this.getClass().equals(other.getClass()) &&
this.object.equals(((BlobValue)other).object));
} | Base | 1 |
public BlobValue(Object object) {
this.object = object;
} | Base | 1 |
public int estimateSize() throws AerospikeException.Serialize {
bytes = serialize(object);
return bytes.length;
} | Base | 1 |
public static Value get(Object value) {
if (value == null) {
return NullValue.INSTANCE;
}
if (value instanceof Value) {
return (Value)value;
}
if (value instanceof byte[]) {
return new BytesValue((byte[])value);
}
if (value instanceof String) {
return new StringValue((String)value);
}
if (value instanceof Integer) {
return new IntegerValue((Integer)value);
}
if (value instanceof Long) {
return new LongValue((Long)value);
}
if (value instanceof List<?>) {
return new ListValue((List<?>)value);
}
if (value instanceof Map<?,?>) {
return new MapValue((Map<?,?>)value);
}
if (value instanceof Double) {
return new DoubleValue((Double)value);
}
if (value instanceof Float) {
return new FloatValue((Float)value);
}
if (value instanceof Short) {
return new ShortValue((Short)value);
}
if (value instanceof Boolean) {
if (UseBoolBin) {
return new BooleanValue((Boolean)value);
}
else {
return new BoolIntValue((Boolean)value);
}
}
if (value instanceof Byte) {
return new ByteValue((byte)value);
}
if (value instanceof Character) {
return Value.get(((Character)value).charValue());
}
if (value instanceof Enum) {
return new StringValue(value.toString());
}
if (value instanceof UUID) {
return new StringValue(value.toString());
}
if (value instanceof ByteBuffer) {
ByteBuffer bb = (ByteBuffer)value;
return new BytesValue(bb.array());
}
return new BlobValue(value);
} | Base | 1 |
public LuaValue getLuaValue(LuaInstance instance) {
return LuaString.valueOf(bytes);
} | Base | 1 |
public static Object bytesToObject(byte[] buf, int offset, int length) {
if (length <= 0) {
return null;
}
if (Value.DisableDeserializer) {
throw new AerospikeException.Serialize("Object deserializer has been disabled");
}
try (ByteArrayInputStream bastream = new ByteArrayInputStream(buf, offset, length)) {
try (ObjectInputStream oistream = new ObjectInputStream(bastream)) {
return oistream.readObject();
}
}
catch (Throwable e) {
throw new AerospikeException.Serialize(e);
}
} | Base | 1 |
public static Object bytesToParticle(int type, byte[] buf, int offset, int len)
throws AerospikeException {
switch (type) {
case ParticleType.STRING:
return Buffer.utf8ToString(buf, offset, len);
case ParticleType.INTEGER:
return Buffer.bytesToNumber(buf, offset, len);
case ParticleType.BOOL:
return Buffer.bytesToBool(buf, offset, len);
case ParticleType.DOUBLE:
return Buffer.bytesToDouble(buf, offset);
case ParticleType.BLOB:
return Arrays.copyOfRange(buf, offset, offset+len);
case ParticleType.JBLOB:
return Buffer.bytesToObject(buf, offset, len);
case ParticleType.GEOJSON:
return Buffer.bytesToGeoJSON(buf, offset, len);
case ParticleType.HLL:
return Buffer.bytesToHLL(buf, offset, len);
case ParticleType.LIST:
return Unpacker.unpackObjectList(buf, offset, len);
case ParticleType.MAP:
return Unpacker.unpackObjectMap(buf, offset, len);
default:
return null;
}
} | Base | 1 |
public LuaValue getLuaValue(int type, byte[] buf, int offset, int len) throws AerospikeException {
if (len <= 0) {
return LuaValue.NIL;
}
switch (type) {
case ParticleType.STRING:
byte[] copy = new byte[len];
System.arraycopy(buf, offset, copy, 0, len);
return LuaString.valueOf(copy, 0, len);
case ParticleType.INTEGER:
if (len <= 4) {
return LuaInteger.valueOf(Buffer.bytesToInt(buf, offset));
}
if (len <= 8) {
return LuaInteger.valueOf(Buffer.bytesToLong(buf, offset));
}
throw new AerospikeException("Lua BigInteger not implemented.");
case ParticleType.BOOL:
return LuaBoolean.valueOf(Buffer.bytesToBool(buf, offset, len));
case ParticleType.DOUBLE:
return LuaDouble.valueOf(Buffer.bytesToDouble(buf, offset));
case ParticleType.BLOB:
byte[] blob = new byte[len];
System.arraycopy(buf, offset, blob, 0, len);
return new LuaBytes(this, blob);
case ParticleType.JBLOB:
Object object = Buffer.bytesToObject(buf, offset, len);
return new LuaJavaBlob(object);
case ParticleType.LIST: {
LuaUnpacker unpacker = new LuaUnpacker(this, buf, offset, len);
return unpacker.unpackList();
}
case ParticleType.MAP: {
LuaUnpacker unpacker = new LuaUnpacker(this, buf, offset, len);
return unpacker.unpackMap();
}
case ParticleType.GEOJSON:
// skip the flags
int ncells = Buffer.bytesToShort(buf, offset + 1);
int hdrsz = 1 + 2 + (ncells * 8);
return new LuaGeoJSON(new String(buf, offset + hdrsz, len - hdrsz));
default:
return LuaValue.NIL;
}
} | Base | 1 |
protected LuaValue getJavaBlob(Object value) {
return new LuaJavaBlob(value);
} | Base | 1 |
public void packBlob(Object val) {
byte[] bytes = BlobValue.serialize(val);
packByteArrayBegin(bytes.length + 1);
packByte(ParticleType.JBLOB);
packByteArray(bytes, 0, bytes.length);
} | Base | 1 |
public void packObject(Object obj) {
if (obj == null) {
packNil();
return;
}
if (obj instanceof Value) {
Value value = (Value)obj;
value.pack(this);
return;
}
if (obj instanceof byte[]) {
packParticleBytes((byte[])obj);
return;
}
if (obj instanceof String) {
packParticleString((String)obj);
return;
}
if (obj instanceof Integer) {
packInt((Integer)obj);
return;
}
if (obj instanceof Long) {
packLong((Long)obj);
return;
}
if (obj instanceof List<?>) {
packList((List<?>)obj);
return;
}
if (obj instanceof Map<?,?>) {
packMap((Map<?,?>)obj);
return;
}
if (obj instanceof Double) {
packDouble((Double)obj);
return;
}
if (obj instanceof Float) {
packFloat((Float)obj);
return;
}
if (obj instanceof Short) {
packInt((Short)obj);
return;
}
if (obj instanceof Boolean) {
packBoolean((Boolean)obj);
return;
}
if (obj instanceof Byte) {
packInt(((Byte)obj) & 0xff);
return;
}
if (obj instanceof Character) {
packInt(((Character)obj).charValue());
return;
}
if (obj instanceof Enum) {
packString(obj.toString());
return;
}
if (obj instanceof UUID) {
packString(obj.toString());
return;
}
if (obj instanceof ByteBuffer) {
packByteBuffer((ByteBuffer) obj);
return;
}
packBlob(obj);
} | Base | 1 |
private T unpackBlob(int count) throws IOException, ClassNotFoundException {
int type = buffer[offset++] & 0xff;
count--;
T val;
switch (type) {
case ParticleType.STRING:
val = getString(Buffer.utf8ToString(buffer, offset, count));
break;
case ParticleType.JBLOB:
if (Value.DisableDeserializer) {
throw new AerospikeException.Serialize("Object deserializer has been disabled");
}
try (ByteArrayInputStream bastream = new ByteArrayInputStream(buffer, offset, count)) {
try (ObjectInputStream oistream = new ObjectInputStream(bastream)) {
val = getJavaBlob(oistream.readObject());
}
}
catch (Throwable e) {
throw new AerospikeException.Serialize(e);
}
break;
case ParticleType.GEOJSON:
val = getGeoJSON(Buffer.utf8ToString(buffer, offset, count));
break;
default:
val = getBlob(Arrays.copyOfRange(buffer, offset, offset + count));
break;
}
offset += count;
return val;
} | Base | 1 |
protected Object getJavaBlob(Object value) {
return value;
} | Base | 1 |
public void runListRangeExample(AerospikeClient client, Parameters params) {
Key key = new Key(params.namespace, params.set, "mapkey");
String binName = "mapbin";
// Delete record if it already exists.
client.delete(params.writePolicy, key);
List<Value> l1 = new ArrayList<Value>();
l1.add(Value.get(new GregorianCalendar(2018, 1, 1).getTime()));
l1.add(Value.get(1));
List<Value> l2 = new ArrayList<Value>();
l2.add(Value.get(new GregorianCalendar(2018, 1, 2).getTime()));
l2.add(Value.get(2));
List<Value> l3 = new ArrayList<Value>();
l3.add(Value.get(new GregorianCalendar(2018, 2, 1).getTime()));
l3.add(Value.get(3));
List<Value> l4 = new ArrayList<Value>();
l4.add(Value.get(new GregorianCalendar(2018, 2, 2).getTime()));
l4.add(Value.get(4));
List<Value> l5 = new ArrayList<Value>();
l5.add(Value.get(new GregorianCalendar(2018, 2, 5).getTime()));
l5.add(Value.get(5));
Map<Value,Value> inputMap = new HashMap<Value,Value>();
inputMap.put(Value.get("Charlie"), Value.get(l1));
inputMap.put(Value.get("Jim"), Value.get(l2));
inputMap.put(Value.get("John"), Value.get(l3));
inputMap.put(Value.get("Harry"), Value.get(l4));
inputMap.put(Value.get("Bill"), Value.get(l5));
// Write values to empty map.
Record record = client.operate(params.writePolicy, key,
MapOperation.putItems(MapPolicy.Default, binName, inputMap)
);
console.info("Record: " + record);
List<Value> end = new ArrayList<Value>();
end.add(Value.get(new GregorianCalendar(2018, 2, 2).getTime()));
end.add(Value.getAsNull());
// Delete values < end.
record = client.operate(params.writePolicy, key,
MapOperation.removeByValueRange(binName, null, Value.get(end), MapReturnType.COUNT)
);
console.info("Record: " + record);
} | Base | 1 |
public void addNullValue() {
Version version = Version.getServerVersion(client, null);
// Do not run on servers < 3.6.1
if (version.isLess(3, 6, 1)) {
return;
}
Key key = new Key(args.namespace, args.set, "addkey");
String binName = "addbin";
// Delete record if it already exists.
client.delete(null, key);
Bin bin = new Bin(binName, (Long)null);
AerospikeException ae = assertThrows(AerospikeException.class, new ThrowingRunnable() {
public void run() {
client.add(null, key, bin);
}
});
assertEquals(ae.getResultCode(), ResultCode.PARAMETER_ERROR);
} | Base | 1 |
public void setKeyParams() throws Exception {
assertPlotParam("key", "out");
assertPlotParam("key", "left");
assertPlotParam("key", "top");
assertPlotParam("key", "center");
assertPlotParam("key", "right");
assertPlotParam("key", "horiz");
assertPlotParam("key", "box");
assertPlotParam("key", "bottom");
assertInvalidPlotParam("yrange", "out%20right%20top%0aset%20yrange%20[33:system(%20");
} | Class | 2 |
public void setLabelParams() throws Exception {
assertPlotParam("ylabel", "This is good");
assertPlotParam("ylabel", " and so Is this - _ yay");
assertInvalidPlotParam("ylabel", "[33:system(%20");
assertInvalidPlotParam("title", "[33:system(%20");
assertInvalidPlotParam("y2label", "[33:system(%20");
} | Class | 2 |
public void setSmoothParams() throws Exception {
assertPlotParam("smooth", "unique");
assertPlotParam("smooth", "frequency");
assertPlotParam("smooth", "fnormal");
assertPlotParam("smooth", "cumulative");
assertPlotParam("smooth", "cnormal");
assertPlotParam("smooth", "bins");
assertPlotParam("smooth", "csplines");
assertPlotParam("smooth", "acsplines");
assertPlotParam("smooth", "mcsplines");
assertPlotParam("smooth", "bezier");
assertPlotParam("smooth", "sbezier");
assertPlotParam("smooth", "unwrap");
assertPlotParam("smooth", "zsort");
assertInvalidPlotParam("smooth", "[33:system(%20");
} | Class | 2 |
public void setFormatParams() throws Exception {
assertPlotParam("yformat", "%25.2f");
assertPlotParam("y2format", "%25.2f");
assertPlotParam("xformat", "%25.2f");
assertPlotParam("yformat", "%253.0em");
assertPlotParam("yformat", "%253.0em%25%25");
assertPlotParam("yformat", "%25.2f seconds");
assertPlotParam("yformat", "%25.0f ms");
assertInvalidPlotParam("yformat", "%252.[33:system");
} | Class | 2 |
public void setStyleParams() throws Exception {
assertPlotParam("style", "linespoint");
assertPlotParam("style", "points");
assertPlotParam("style", "circles");
assertPlotParam("style", "dots");
assertInvalidPlotParam("style", "dots%20[33:system(%20");
} | Class | 2 |
public void badRequest(final BadRequestException exception) {
logWarn("Bad Request on " + request().getUri() + ": " + exception.getMessage());
if (this.api_version > 0) {
// always default to the latest version of the error formatter since we
// need to return something
switch (this.api_version) {
case 1:
default:
sendReply(exception.getStatus(), serializer.formatErrorV1(exception));
}
return;
}
if (hasQueryStringParam("json")) {
final StringBuilder buf = new StringBuilder(10 +
exception.getDetails().length());
buf.append("{\"err\":\"");
HttpQuery.escapeJson(exception.getMessage(), buf);
buf.append("\"}");
sendReply(HttpResponseStatus.BAD_REQUEST, buf);
} else {
sendReply(HttpResponseStatus.BAD_REQUEST,
makePage("Bad Request", "Looks like it's your fault this time",
"<blockquote>"
+ "<h1>Bad Request</h1>"
+ "Sorry but your request was rejected as being"
+ " invalid.<br/><br/>"
+ "The reason provided was:<blockquote>"
+ exception.getMessage()
+ "</blockquote></blockquote>"));
}
} | Class | 2 |
public void internalError(final Exception cause) {
logError("Internal Server Error on " + request().getUri(), cause);
if (this.api_version > 0) {
// always default to the latest version of the error formatter since we
// need to return something
switch (this.api_version) {
case 1:
default:
sendReply(HttpResponseStatus.INTERNAL_SERVER_ERROR,
serializer.formatErrorV1(cause));
}
return;
}
ThrowableProxy tp = new ThrowableProxy(cause);
tp.calculatePackagingData();
final String pretty_exc = ThrowableProxyUtil.asString(tp);
tp = null;
if (hasQueryStringParam("json")) {
// 32 = 10 + some extra space as exceptions always have \t's to escape.
final StringBuilder buf = new StringBuilder(32 + pretty_exc.length());
buf.append("{\"err\":\"");
HttpQuery.escapeJson(pretty_exc, buf);
buf.append("\"}");
sendReply(HttpResponseStatus.INTERNAL_SERVER_ERROR, buf);
} else {
sendReply(HttpResponseStatus.INTERNAL_SERVER_ERROR,
makePage("Internal Server Error", "Houston, we have a problem",
"<blockquote>"
+ "<h1>Internal Server Error</h1>"
+ "Oops, sorry but your request failed due to a"
+ " server error.<br/><br/>"
+ "Please try again in 30 seconds.<pre>"
+ pretty_exc
+ "</pre></blockquote>"));
}
} | Class | 2 |
public void executeNSU() throws Exception {
final DeferredGroupException dge = mock(DeferredGroupException.class);
when(dge.getCause()).thenReturn(new NoSuchUniqueName("foo", "metrics"));
when(query_result.configureFromQuery((TSQuery)any(), anyInt()))
.thenReturn(Deferred.fromError(dge));
final HttpQuery query = NettyMocks.getQuery(tsdb,
"/api/query?start=1h-ago&m=sum:sys.cpu.user");
rpc.execute(tsdb, query);
assertEquals(HttpResponseStatus.BAD_REQUEST, query.response().getStatus());
final String json =
query.response().getContent().toString(Charset.forName("UTF-8"));
assertTrue(json.contains("No such name for 'foo': 'metrics'"));
} | Class | 2 |
public void postQueryNoMetricBadRequest() throws Exception {
final DeferredGroupException dge = mock(DeferredGroupException.class);
when(dge.getCause()).thenReturn(new NoSuchUniqueName("foo", "metrics"));
when(query_result.configureFromQuery((TSQuery)any(), anyInt()))
.thenReturn(Deferred.fromError(dge));
HttpQuery query = NettyMocks.postQuery(tsdb, "/api/query",
"{\"start\":1425440315306,\"queries\":" +
"[{\"metric\":\"nonexistent\",\"aggregator\":\"sum\",\"rate\":true," +
"\"rateOptions\":{\"counter\":false}}]}");
rpc.execute(tsdb, query);
assertEquals(HttpResponseStatus.BAD_REQUEST, query.response().getStatus());
final String json =
query.response().getContent().toString(Charset.forName("UTF-8"));
assertTrue(json.contains("No such name for 'foo': 'metrics'"));
} | Class | 2 |
protected boolean validateIssuerAudienceAndAzp(@NonNull JwtClaims claims,
@NonNull String iss,
@NonNull List<String> audiences,
@NonNull String clientId,
@NonNull OpenIdClientConfiguration openIdClientConfiguration) {
if (openIdClientConfiguration.getIssuer().isPresent()) {
Optional<URL> issuerOptional = openIdClientConfiguration.getIssuer();
if (issuerOptional.isPresent()) {
String issuer = issuerOptional.get().toString();
return issuer.equalsIgnoreCase(iss) ||
audiences.contains(clientId) &&
validateAzp(claims, clientId, audiences);
}
}
return false;
} | Pillar | 3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.