code stringlengths 12 2.05k | label_name stringclasses 5
values | label int64 0 4 |
|---|---|---|
public static IRubyObject from_document(ThreadContext context, IRubyObject klazz, IRubyObject document) {
XmlDocument doc = ((XmlDocument) ((XmlNode) document).document(context));
RubyArray errors = (RubyArray) doc.getInstanceVariable("@errors");
if (!errors.isEmpty()) {
throw (... | Base | 1 |
public PersistentTask createTask(String name, Serializable task,
Identity creator, OLATResource resource, String resSubPath, Date scheduledDate) {
PersistentTask ptask = new PersistentTask();
Date currentDate = new Date();
ptask.setCreationDate(currentDate);
ptask.setLastModified(currentDate);
ptask.setSc... | Base | 1 |
public void render(HtmlRenderer renderer) {
if (isArtifactsDeleted || isEmpty()) {
HtmlElement element = p().content("Artifacts for this job instance are unavailable as they may have been <a href='" +
CurrentGoCDVersion.docsUrl("configuration/delete_artifacts.html") +
... | Base | 1 |
public static void main(
String[] args)
{
Security.addProvider(new BouncyCastleProvider());
runTest(new ECDSA5Test());
} | Base | 1 |
public void translate(ShowCreditsPacket packet, GeyserSession session) {
if (packet.getStatus() == ShowCreditsPacket.Status.END_CREDITS) {
ClientRequestPacket javaRespawnPacket = new ClientRequestPacket(ClientRequest.RESPAWN);
session.sendDownstreamPacket(javaRespawnPacket);
... | Class | 2 |
public void testWrapMemoryMapped() throws Exception {
File file = File.createTempFile("netty-test", "tmp");
FileChannel output = null;
FileChannel input = null;
ByteBuf b1 = null;
ByteBuf b2 = null;
try {
output = new RandomAccessFile(file, "rw").getChann... | Base | 1 |
private Path getFilePath(String path) {
return baseDirPath.map(dir -> dir.resolve(path)).orElseGet(() -> Paths.get(path));
} | Base | 1 |
List<Modification> findRecentModifications(int count) {
// Currently impossible to check modifications on a remote repository.
InMemoryStreamConsumer consumer = inMemoryConsumer();
bombUnless(pull(consumer), "Failed to run hg pull command: " + consumer.getAllOutput());
CommandLine hg... | Class | 2 |
public void translate(MobEquipmentPacket packet, GeyserSession session) {
if (!session.isSpawned() || packet.getHotbarSlot() > 8 ||
packet.getContainerId() != ContainerId.INVENTORY || session.getPlayerInventory().getHeldItemSlot() == packet.getHotbarSlot()) {
// For the last cond... | Class | 2 |
public void testUpdateMapper_serializade() {
//create a mapper
String mapperId = UUID.randomUUID().toString();
String sessionId = UUID.randomUUID().toString().substring(0, 32);
PersistentMapper sMapper = new PersistentMapper("mapper-to-persist-bis");
PersistedMapper pMapper = mapperDao.persistMapper(sessionI... | Base | 1 |
void ampersand() {
final PathAndQuery res = PathAndQuery.parse("/&?a=1&a=2&b=3");
assertThat(res).isNotNull();
assertThat(res.path()).isEqualTo("/&");
assertThat(res.query()).isEqualTo("a=1&a=2&b=3");
// '%26' in a query string should never be decoded into '&'.
final... | Base | 1 |
protected Details authenticate(String username, String password) throws AuthenticationException {
Details u = loadUserByUsername(username);
if (!u.isPasswordCorrect(password))
throw new BadCredentialsException("Failed to login as "+username);
return u;
} | Class | 2 |
protected void handleResponse(HttpRequest<?> request, MutableHttpResponse<?> response) {
HttpHeaders headers = request.getHeaders();
Optional<String> originHeader = headers.getOrigin();
originHeader.ifPresent(requestOrigin -> {
Optional<CorsOriginConfiguration> optionalConfig = ... | Class | 2 |
public static AsciiString of(AsciiString name) {
final AsciiString lowerCased = name.toLowerCase();
final AsciiString cached = map.get(lowerCased);
return cached != null ? cached : lowerCased;
} | Class | 2 |
public void testContains() {
final HttpHeadersBase headers = newEmptyHeaders();
headers.addLong("long", Long.MAX_VALUE);
assertThat(headers.containsLong("long", Long.MAX_VALUE)).isTrue();
assertThat(headers.containsLong("long", Long.MIN_VALUE)).isFalse();
headers.addInt("in... | Class | 2 |
public static boolean saveLinkList(HashMap<String, PortletInstitution> portletMap){
XStream xstream = XStreamHelper.createXStreamInstance();
xstream.alias("LinksPortlet", Map.class);
xstream.alias(ELEM_LINK, PortletLink.class);
xstream.alias(ELEM_INSTITUTION, PortletInstitution.class);
xstream.aliasAttribute... | Base | 1 |
public static XStream createXStreamInstanceForDBObjects() {
return new EnhancedXStream(true);
} | Base | 1 |
final protected CommandExecutionResult executeArg(TimingDiagram diagram, LineLocation location, RegexResult arg) {
final String compact = arg.get("COMPACT", 0);
final String code = arg.get("CODE", 0);
String full = arg.get("FULL", 0);
if (full == null) {
full = code;
}
final TimingStyle type = TimingSty... | Base | 1 |
public void testCopy() throws Exception {
HttpHeadersBase headers = newEmptyHeaders();
headers.addLong("long", Long.MAX_VALUE);
headers.addInt("int", Integer.MIN_VALUE);
headers.addDouble("double", Double.MAX_VALUE);
headers.addFloat("float", Float.MAX_VALUE);
final l... | Class | 2 |
public void addViolation(String propertyName, String key, String message) {
violationOccurred = true;
String messageTemplate = escapeEl(message);
context.buildConstraintViolationWithTemplate(messageTemplate)
.addPropertyNode(propertyName)
.addBeanNode().inIter... | Class | 2 |
private void initConfigMocks(String[] pInitParams, String[] pContextParams,String pLogRegexp, Class<? extends Exception> pExceptionClass) {
config = createMock(ServletConfig.class);
context = createMock(ServletContext.class);
String[] params = pInitParams != null ? Arrays.copyOf(pInitParam... | Compound | 4 |
public void testGetShellCommandLineBash()
throws Exception
{
Commandline cmd = new Commandline( new BourneShell() );
cmd.setExecutable( "/bin/echo" );
cmd.addArguments( new String[] {
"hello world"
} );
String[] shellCommandline = cmd.getShellCommandl... | Base | 1 |
public void setCharacterStream() throws Exception {
String exmplar = "<x>value</x>";
SQLXML pgSQLXML = con.createSQLXML();
Writer writer = pgSQLXML.setCharacterStream();
writer.write(exmplar);
PreparedStatement preparedStatement = con.prepareStatement("insert into xmltab values (?)");
prepare... | Base | 1 |
protected ObjectStreamClass readClassDescriptor()
throws IOException, ClassNotFoundException {
int type = read();
if (type < 0) {
throw new EOFException();
}
switch (type) {
case ThrowableObjectOutputStream.TYPE_EXCEPTION:
return Ob... | Class | 2 |
protected void configureReader(XMLReader reader, DefaultHandler handler)
throws DocumentException {
// configure lexical handling
SAXHelper.setParserProperty(reader, SAX_LEXICALHANDLER, handler);
// try alternate property just in case
SAXHelper.setParserProperty(reader, ... | Base | 1 |
private void sendAllJSON(HttpExchange pExchange, ParsedUri pParsedUri, JSONAware pJson) throws IOException {
OutputStream out = null;
try {
Headers headers = pExchange.getResponseHeaders();
if (pJson != null) {
headers.set("Content-Type", getMimeType(pParsedUr... | Base | 1 |
public Optional<URL> getResource(String path) {
Path filePath = getFilePath(normalize(path));
if (Files.exists(filePath) && Files.isReadable(filePath) && !Files.isDirectory(filePath)) {
try {
URL url = filePath.toUri().toURL();
return Optional.of(url);
... | Base | 1 |
public void translate(CommandRequestPacket packet, GeyserSession session) {
String command = packet.getCommand().replace("/", "");
CommandManager commandManager = GeyserConnector.getInstance().getCommandManager();
if (session.getConnector().getPlatformType() == PlatformType.STANDALONE && com... | Class | 2 |
public void testEqualsInsertionOrderSameHeaderName() {
final HttpHeadersBase h1 = newEmptyHeaders();
h1.add("a", "b");
h1.add("a", "c");
final HttpHeadersBase h2 = newEmptyHeaders();
h2.add("a", "c");
h2.add("a", "b");
assertThat(h1).isNotEqualTo(h2);
} | Class | 2 |
public void complexExample() throws Exception {
assertThat(ConstraintViolations.format(validator.validate(new ComplexExample())))
.containsExactlyInAnyOrder(
FAILED_RESULT + "1",
FAILED_RESULT + "2",
FAILED_RESULT + "3"
);
asser... | Class | 2 |
public String resolveDriverClassName(DriverClassNameResolveRequest request) {
return driverResources.resolveSqlDriverNameFromJar(request.getJdbcDriverFileUrl());
} | Class | 2 |
default OptionalLong contentLength() {
Optional<Long> optional = getFirst(HttpHeaders.CONTENT_LENGTH, Long.class);
return optional.map(OptionalLong::of).orElseGet(OptionalLong::empty);
} | Class | 2 |
protected final boolean loadMore() throws IOException
{
if (_inputStream != null) {
_currInputProcessed += _inputEnd;
int count = _inputStream.read(_inputBuffer, 0, _inputBuffer.length);
if (count > 0) {
_inputPtr = 0;
_inputEnd = coun... | Base | 1 |
public void handle(HttpExchange pExchange) throws IOException {
if (requestHandler == null) {
throw new IllegalStateException("Handler not yet started");
}
JSONAware json = null;
URI uri = pExchange.getRequestURI();
ParsedUri parsedUri = new ParsedUri(uri,context... | Compound | 4 |
public void appendText(String text) {
if (text == null) {
return;
}
String previous = this.binding.textinput.getText().toString();
if (UIHelper.isLastLineQuote(previous)) {
text = '\n' + text;
} else if (previous.length() != 0 && !Character.isWhitespac... | Class | 2 |
void setPaths(final String s) {
try {
final ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(s.getBytes("8859_1")));
this.paths = (WorkBundle) ois.readObject();
} catch (Exception e) {
logger.error("Cannot deserialize ... | Base | 1 |
public String invokeServletAndReturnAsString(String url, XWikiContext xwikiContext)
{
HttpServletRequest servletRequest = xwikiContext.getRequest();
HttpServletResponse servletResponse = xwikiContext.getResponse();
try {
return IncludeServletAsString.invokeServletAndReturnA... | Class | 2 |
public boolean loginValidate(String userName, String password, String email) {
String sql = "select * from voter_table where voter_name=? and password=? and email=?";
try {
ps = DbUtil.getConnection().prepareStatement(sql);
ps.setString(1, userName);
ps.setString(2, password);
ps.setString(3, email);
... | Variant | 0 |
public boolean isMetadataFileValid(OLATResource videoResource) {
VFSContainer baseContainer = FileResourceManager.getInstance().getFileResourceRootImpl(videoResource);
VFSLeaf metaDataFile = (VFSLeaf) baseContainer.resolve(FILENAME_VIDEO_METADATA_XML);
try {
VideoMetadata meta = (VideoMetadata) XStreamHelper.... | Base | 1 |
void getGadgets() throws Exception
{
assertEquals(new ArrayList<>(), this.defaultGadgetSource.getGadgets(testSource, macroTransformationContext));
BaseObject gadgetObject1 = mock(BaseObject.class);
when(xWikiDocument.getXObjects(gadgetClassReference)).thenReturn(Collections.singletonLis... | Base | 1 |
public String resolveSqlDriverNameFromJar(String driverFileUrl) {
String tempFilePath = "temp/" + UUID.randomUUID() + ".jar";
File driverFile = doDownload(driverFileUrl, tempFilePath);
String className = doResolveSqlDriverNameFromJar(driverFile);
try {
Files.deleteIfExist... | Class | 2 |
public void translate(RespawnPacket packet, GeyserSession session) {
if (packet.getState() == RespawnPacket.State.CLIENT_READY) {
// Previously we only sent the respawn packet before the server finished loading
// The message included was 'Otherwise when immediate respawn is on the c... | Class | 2 |
public void testMatchOperations() {
JWKMatcher matcher = new JWKMatcher.Builder().keyOperations(new LinkedHashSet<>(Arrays.asList(KeyOperation.SIGN, KeyOperation.VERIFY))).build();
assertTrue(matcher.matches(new RSAKey.Builder(new Base64URL("n"), new Base64URL("e")).keyID("1")
.keyOperations(new HashSet<>(Arr... | Base | 1 |
public void existingDocumentFromUITemplateProviderSpecifiedTerminalOverridenFromUIToNonTerminal() throws Exception
{
// current document = xwiki:Main.WebHome
DocumentReference documentReference = new DocumentReference("xwiki", Arrays.asList("Main"), "WebHome");
XWikiDocument document = m... | Class | 2 |
public static File createTempFile(String prefix, String suffix, File directory) throws IOException {
if (javaVersion() >= 7) {
if (directory == null) {
return Files.createTempFile(prefix, suffix).toFile();
}
return Files.createTempFile(directory.toPath(), ... | Class | 2 |
static XmlSchema createSchemaInstance(ThreadContext context, RubyClass klazz, Source source) {
Ruby runtime = context.getRuntime();
XmlRelaxng xmlRelaxng = (XmlRelaxng) NokogiriService.XML_RELAXNG_ALLOCATOR.allocate(runtime, klazz);
xmlRelaxng.setInstanceVariable("@errors", runtime.newEmptyA... | Base | 1 |
private void initializeVelocity() {
if (velocityEngine == null) {
velocityEngine = new VelocityEngine();
Properties props = new Properties();
props.setProperty(RuntimeConstants.RUNTIME_LOG, "startup_wizard_vel.log");
// Linux requires setting logging properties to initialize Velocity Context.
prop... | Base | 1 |
public final HColor getBackColor(ISkinParam skinParam, Style style) {
if (colors == null || colors.getColor(ColorType.BACK) == null) {
if (UseStyle.useBetaStyle() == false)
return HColorUtils.COL_D7E0F2;
return style.value(PName.BackGroundColor).asColor(skinParam.getThemeStyle(), skinParam.getIHtmlColorSe... | Base | 1 |
private void updateStatus() {
if (config.getHIDMode() == 0) {
config.setNetworkStatus(false);
EditorActivity.stopNetworkSocketService(this);
ipButton.setVisibility(View.GONE);
ipStatusDivider.setVisibility(View.GONE);
if (config.getUSBStatus()) {
... | Class | 2 |
public AccessControlList getAccessControlList(String mediaPackageId) throws NotFoundException,
SearchServiceDatabaseException {
EntityManager em = null;
try {
em = emf.createEntityManager();
SearchEntity entity = getSearchEntity(mediaPackageId, em);
if (entity == null) {
throw new ... | Class | 2 |
protected DataSource createDataSource(Map<String, ?> params, SQLDialect dialect)
throws IOException {
String jndiName = (String) JNDI_REFNAME.lookUp(params);
if (jndiName == null) throw new IOException("Missing " + JNDI_REFNAME.description);
Context ctx = null;
DataSourc... | Class | 2 |
private String clean(String svg) {
svg = svg.toLowerCase().replaceAll("\\s", "");
if (svg.contains("<script>"))
return EMPTY_SVG;
if (svg.contains("</script>"))
return EMPTY_SVG;
if (svg.contains("<foreignobject"))
return EMPTY_SVG;
if (svg.contains("</foreignobject>"))
return EMPTY_SVG;
return... | Base | 1 |
public void renderHead(IHeaderResponse response) {
super.renderHead(response);
response.render(JavaScriptHeaderItem.forReference(new MarkdownResourceReference()));
String encodedAttachmentSupport;
if (getAttachmentSupport() != null) {
encodedAttachmentSupport = Base64.encodeBase64String(SerializationUtil... | Base | 1 |
public Mapper retrieveMapperById(String mapperId) {
List<PersistedMapper> mappers = dbInstance.getCurrentEntityManager()
.createNamedQuery("loadMapperByKey", PersistedMapper.class)
.setParameter("mapperId", mapperId)
.getResultList();
PersistedMapper pm = mappers.isEmpty() ? null : mappers.get(0);
... | Base | 1 |
private Secret(String value) {
this.value = value;
} | Class | 2 |
protected static String unifyQuotes( String path )
{
if ( path == null )
{
return null;
}
if ( path.indexOf( " " ) == -1 && path.indexOf( "'" ) != -1 && path.indexOf( "\"" ) == -1 )
{
return StringUtils.escape( path );
}
return St... | Base | 1 |
protected void afterFeaturesReceived() throws SecurityRequiredException, NotConnectedException, InterruptedException {
StartTls startTlsFeature = getFeature(StartTls.ELEMENT, StartTls.NAMESPACE);
if (startTlsFeature != null) {
if (startTlsFeature.required() && config.getSecurityMode() ==... | Class | 2 |
public <T extends JiffleRuntime> T getRuntimeInstance(Class<T> baseClass) throws
it.geosolutions.jaiext.jiffle.JiffleException {
RuntimeModel model = RuntimeModel.get(baseClass);
if (model == null) {
throw new it.geosolutions.jaiext.jiffle.JiffleException(baseClass.getName() ... | Base | 1 |
public static Secret decrypt(String data) {
if(data==null) return null;
try {
byte[] in = Base64.decode(data.toCharArray());
Secret s = tryDecrypt(KEY.decrypt(), in);
if (s!=null) return s;
// try our historical key for backward compatibility
... | Class | 2 |
protected Response attachToPost(Message mess, String filename, InputStream file, HttpServletRequest request) {
Identity identity = getIdentity(request);
if(identity == null) {
return Response.serverError().status(Status.UNAUTHORIZED).build();
} else if (!identity.equalsByPersistableKey(mess.getCreator())) {
... | Base | 1 |
public void testToString() {
HttpHeadersBase headers = newEmptyHeaders();
headers.add("name1", "value1");
headers.add("name1", "value2");
headers.add("name2", "value3");
assertThat(headers.toString()).isEqualTo("[name1=value1, name1=value2, name2=value3]");
headers =... | Class | 2 |
public void setHeadersShouldClearAndOverwrite() {
final HttpHeadersBase headers1 = newEmptyHeaders();
headers1.add("name", "value");
final HttpHeadersBase headers2 = newEmptyHeaders();
headers2.add("name", "newvalue");
headers2.add("name1", "value1");
headers1.set(h... | Class | 2 |
public int decryptWithAd(byte[] ad, byte[] ciphertext,
int ciphertextOffset, byte[] plaintext, int plaintextOffset,
int length) throws ShortBufferException, BadPaddingException {
int space;
if (ciphertextOffset > ciphertext.length)
space = 0;
else
space = ciphertext.length - ciphertextOffset;
if (l... | Base | 1 |
public int decryptWithAd(byte[] ad, byte[] ciphertext,
int ciphertextOffset, byte[] plaintext, int plaintextOffset,
int length) throws ShortBufferException, BadPaddingException {
int space;
if (ciphertextOffset > ciphertext.length)
space = 0;
else
space = ciphertext.length - ciphertextOffset;
if (l... | Base | 1 |
public boolean isValid(String value, ConstraintValidatorContext context) {
long longValue = 0;
boolean failed = false;
String errorMessage = "";
try {
longValue = Long.parseLong(value);
} catch (NumberFormatException ex) {
failed = true;
errorMessage = String.fo... | Class | 2 |
public int size() {
return ByteUtils.bitLength(k.decode());
} | Class | 2 |
public void preflightCheckNegative() {
String origin = "http://bla.com";
String headers ="X-Data: Test";
expect(backend.isCorsAccessAllowed(origin)).andReturn(false);
replay(backend);
Map<String,String> ret = handler.handleCorsPreflightRequest(origin, headers);
asse... | Compound | 4 |
private void decodeTest()
{
EllipticCurve curve = new EllipticCurve(
new ECFieldFp(new BigInteger("6277101735386680763835789423207666416083908700390324961279")), // q
new BigInteger("fffffffffffffffffffffffffffffffefffffffffffffffc", 16), // a
new BigInteg... | Base | 1 |
public List<Entry> search(final String filter, final Object[] filterArgs, final int maxResultCount) {
return search(filter, filterArgs, resultWrapper -> (Entry) resultWrapper.getResult(), maxResultCount);
} | Class | 2 |
public static String getRealIp(HttpServletRequest request) {
//bae env
if (ZrLogUtil.isBae() && request.getHeader("clientip") != null) {
return request.getHeader("clientip");
}
String ip = request.getHeader("X-forwarded-for");
if (ip == null || ip.length() == 0 ||... | Base | 1 |
public void testPseudoHeadersWithClearDoesNotLeak() {
final HttpHeadersBase headers = newHttp2Headers();
assertThat(headers.isEmpty()).isFalse();
headers.clear();
assertThat(headers.isEmpty()).isTrue();
// Combine 2 headers together, make sure pseudo headers stay up front.
... | Class | 2 |
private void switchToConversation(Conversation conversation, String text, boolean asQuote, String nick, boolean pm) {
Intent intent = new Intent(this, ConversationsActivity.class);
intent.setAction(ConversationsActivity.ACTION_VIEW_CONVERSATION);
intent.putExtra(ConversationsActivity.EXTRA_CONVERSATION, conversa... | Class | 2 |
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException
{
// GAE can't serve dot prefixed folders
String uri = request.getRequestURI().replace("/.", "/");
if (uri.toLowerCase().contains(".json"))
{
response.setCon... | Base | 1 |
public static void ensurePointOnCurve(final ECPublicKey ephemeralPublicKey, final ECPrivateKey privateKey)
throws JOSEException {
// Ensure the following is met:
// (y^2) mod p = (x^3 + ax + b) mod p
ECParameterSpec ecParameterSpec = privateKey.getParams();
EllipticCurve curve = ecParameterSpec.getCurve()... | Base | 1 |
protected HtmlRenderable htmlBody() {
return sequence(
HtmlElement.div(cssClass("dir-container")).content(
HtmlElement.span(cssClass("directory")).content(
HtmlElement.a(onclick("BuildDetail.tree_navigator(this)"))
.... | Base | 1 |
public String extractCorsOrigin(String pOrigin) {
if (pOrigin != null) {
// Prevent HTTP response splitting attacks
String origin = pOrigin.replaceAll("[\\n\\r]*","");
if (backendManager.isCorsAccessAllowed(origin)) {
return "null".equals(origin) ? "*" : ... | Compound | 4 |
private int _readAndWriteBytes(OutputStream out, int total) throws IOException
{
int left = total;
while (left > 0) {
int avail = _inputEnd - _inputPtr;
if (_inputPtr >= _inputEnd) {
loadMoreGuaranteed();
avail = _inputEnd - _inputPtr;
... | Base | 1 |
public void newDocumentFromURLWhenNoType() throws Exception
{
// No type has been set by the user
when(mockRequest.get("type")).thenReturn(null);
// new document = xwiki:X.Y
DocumentReference documentReference = new DocumentReference("xwiki", Arrays.asList("X"), "Y");
XW... | Class | 2 |
protected BigInteger[] derDecode(
byte[] encoding)
throws IOException
{
ByteArrayInputStream bIn = new ByteArrayInputStream(encoding);
ASN1InputStream aIn = new ASN1InputStream(bIn);
ASN1Sequence s = (ASN1Sequence)aIn.readObject();
BigInteg... | Base | 1 |
protected void initUpgradesHistories() {
File upgradesDir = new File(WebappHelper.getUserDataRoot(), SYSTEM_DIR);
File upgradesHistoriesFile = new File(upgradesDir, INSTALLED_UPGRADES_XML);
if (upgradesHistoriesFile.exists()) {
upgradesHistories = (Map<String, UpgradeHistoryData>)upgradesXStream.fromXML(upgra... | Base | 1 |
public FromSkinparamToStyle(String key) {
if (key.contains("<<")) {
final StringTokenizer st = new StringTokenizer(key, "<>");
this.key = st.nextToken();
this.stereo = st.hasMoreTokens() ? st.nextToken() : null;
} else {
this.key = key;
this.stereo = null;
}
} | Base | 1 |
Randoms() {
random = new Random();
Date date = new Date();
random.setSeed(date.getTime());
} | Class | 2 |
public void testUpdateUser() throws Exception {
Set<JpaRole> authorities = new HashSet<JpaRole>();
authorities.add(new JpaRole("ROLE_ASTRO_101_SPRING_2011_STUDENT", org1));
JpaUser user = new JpaUser("user1", "pass1", org1, provider.getName(), true, authorities);
provider.addUser(user);
User loa... | Class | 2 |
public void doIconSize( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException {
String qs = req.getQueryString();
if(qs==null || !ICON_SIZE.matcher(qs).matches())
throw new ServletException();
Cookie cookie = new Cookie("iconSize", qs);
cookie.set... | Base | 1 |
protected boolean isProbablePrime(BigInteger x)
{
/*
* Primes class for FIPS 186-4 C.3 primality checking
*/
return !Primes.hasAnySmallFactors(x) && Primes.isMRProbablePrime(x, param.getRandom(), iterations);
} | Class | 2 |
public DefaultFileSystemResourceLoader(File baseDirPath) {
this.baseDirPath = Optional.of(baseDirPath.toPath());
} | Base | 1 |
private void parseAttributesForKnownElements(Map<String, List<Entry>> subdirs, Node desc) {
// NOTE: NamedNodeMap does not have any particular order...
NamedNodeMap attributes = desc.getAttributes();
for (Node attr : asIterable(attributes)) {
if (!XMP.ELEMENTS.contains(attr.getN... | Base | 1 |
public void testMatchOperationsNotSpecifiedOrSign() {
JWKMatcher matcher = new JWKMatcher.Builder().keyOperations(KeyOperation.SIGN, null).build();
assertTrue(matcher.matches(new RSAKey.Builder(new Base64URL("n"), new Base64URL("e")).keyID("1")
.keyOperations(new HashSet<>(Collections.singletonList(KeyOperati... | Base | 1 |
public Optional<InputStream> getResourceAsStream(String path) {
Path filePath = getFilePath(normalize(path));
try {
return Optional.of(Files.newInputStream(filePath));
} catch (IOException e) {
return Optional.empty();
}
} | Base | 1 |
public void newDocumentFromURL() throws Exception
{
// new document = xwiki:X.Y
DocumentReference documentReference = new DocumentReference("xwiki", Arrays.asList("X"), "Y");
XWikiDocument document = mock(XWikiDocument.class);
when(document.getDocumentReference()).thenReturn(docu... | Class | 2 |
public static String compileMustache(Map<String, Object> context, String template) {
if (context == null || StringUtils.isBlank(template)) {
return "";
}
Writer writer = new StringWriter();
try {
Mustache.compiler().escapeHTML(false).emptyStringIsFalse(true).compile(template).execute(context, writer);
... | Base | 1 |
public void testPrivateKeyParsingSHA256()
throws IOException, ClassNotFoundException
{
XMSSMTParameters params = new XMSSMTParameters(20, 10, new SHA256Digest());
XMSSMT mt = new XMSSMT(params, new SecureRandom());
mt.generateKeys();
byte[] privateKey = mt.exportPrivateKe... | Base | 1 |
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// to get values from the login page
// HttpSession session=request.getSession();
PrintWriter out = response.getWriter();
int min = 100000;
int max = 999999;
otp = 5432;
Random r = n... | Variant | 0 |
public void translate(SetLocalPlayerAsInitializedPacket packet, GeyserSession session) {
if (session.getPlayerEntity().getGeyserId() == packet.getRuntimeEntityId()) {
if (!session.getUpstream().isInitialized()) {
session.getUpstream().setInitialized(true);
session... | Class | 2 |
public void multipleValuesPerNameIteratorWithOtherNames() {
final HttpHeadersBase headers = newEmptyHeaders();
headers.add("name1", "value1");
headers.add("name1", "value2");
headers.add("name2", "value4");
headers.add("name1", "value3");
assertThat(headers.size()).is... | Class | 2 |
public int encryptWithAd(byte[] ad, byte[] plaintext, int plaintextOffset,
byte[] ciphertext, int ciphertextOffset, int length) throws ShortBufferException {
int space;
if (ciphertextOffset > ciphertext.length)
space = 0;
else
space = ciphertext.length - ciphertextOffset;
if (!haskey) {
// The key ... | Base | 1 |
public void translate(ServerUpdateViewPositionPacket packet, GeyserSession session) {
if (!session.isSpawned() && session.getLastChunkPosition() == null) {
ChunkUtils.updateChunkPosition(session, Vector3i.from(packet.getChunkX() << 4, 64, packet.getChunkZ() << 4));
}
} | Class | 2 |
public AuthorizationCodeTokenRequest newTokenRequest(String authorizationCode) {
return new AuthorizationCodeTokenRequest(transport, jsonFactory,
new GenericUrl(tokenServerEncodedUrl), authorizationCode).setClientAuthentication(
clientAuthentication).setRequestInitializer(requestInitializer).setSc... | Class | 2 |
public ResponseEntity<Resource> fetch(@PathVariable String key) {
LitemallStorage litemallStorage = litemallStorageService.findByKey(key);
if (key == null) {
ResponseEntity.notFound();
}
String type = litemallStorage.getType();
MediaType mediaType = MediaType.pars... | Base | 1 |
private File tempFile() throws IOException {
String newpostfix;
String diskFilename = getDiskFilename();
if (diskFilename != null) {
newpostfix = '_' + diskFilename;
} else {
newpostfix = getPostfix();
}
File tmpFile;
if (getBaseDirecto... | Base | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.