code stringlengths 12 2.05k | label_name stringclasses 5
values | label int64 0 4 |
|---|---|---|
public EntityResolver getEntityResolver() {
return entityResolver;
} | Base | 1 |
protected void deactivateConversationContext(HttpServletRequest request) {
ConversationContext conversationContext = httpConversationContext();
if (conversationContext.isActive()) {
// Only deactivate the context if one is already active, otherwise we get Exceptions
if (conve... | Class | 2 |
public void shouldNotIncludeCommitFromAnotherBranchInGetLatestModifications() throws Exception {
Modification lastCommit = hgCommand.latestOneModificationAsModifications().get(0);
makeACommitToSecondBranch();
hg(workingDirectory, "pull").runOrBomb(null);
Modification actual = hgComm... | Class | 2 |
void encodedUnicode() {
final String encodedPath = "/%ec%95%88";
final String encodedQuery = "%eb%85%95";
final PathAndQuery res = PathAndQuery.parse(encodedPath + '?' + encodedQuery);
assertThat(res).isNotNull();
assertThat(res.path()).isEqualTo(Ascii.toUpperCase(encodedPath... | Base | 1 |
private boolean isFileWithinDirectory(
final File dir,
final File file
) throws IOException {
final File dir_ = dir.getAbsoluteFile();
if (dir_.isDirectory()) {
final File fl = new File(dir_, file.getPath());
if (fl.isFile()) {
if (... | Base | 1 |
public String getShortDescription() {
if(note != null) {
return Messages.Cause_RemoteCause_ShortDescriptionWithNote(addr, note);
} else {
return Messages.Cause_RemoteCause_ShortDescription(addr);
}
} | Base | 1 |
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(), ... | Base | 1 |
public SAXReader(String xmlReaderClassName) throws SAXException {
if (xmlReaderClassName != null) {
this.xmlReader = XMLReaderFactory
.createXMLReader(xmlReaderClassName);
}
} | Base | 1 |
protected String getCorsDomain(String referer, String userAgent)
{
String dom = null;
if (referer != null && referer.toLowerCase()
.matches("https?://([a-z0-9,-]+[.])*draw[.]io/.*"))
{
dom = referer.toLowerCase().substring(0,
referer.indexOf(".draw.io/") + 8);
}
else if (referer != null && refe... | 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 |
public static boolean isTransparent(HColor back) {
if (back == TRANSPARENT) {
return true;
}
if (back instanceof HColorBackground && ((HColorBackground) back).getBack() == TRANSPARENT) {
return true;
}
if (back instanceof HColorSimple && ((HColorSimple) back).isTransparent()) {
return true;
}
re... | Base | 1 |
private static void verifyPeerName(PGStream stream, Properties info, SSLSocket newConnection)
throws PSQLException {
HostnameVerifier hvn;
String sslhostnameverifier = PGProperty.SSL_HOSTNAME_VERIFIER.get(info);
if (sslhostnameverifier == null) {
hvn = PGjdbcHostnameVerifier.INSTANCE;
ss... | Class | 2 |
public void testSetRequestMethod() {
HttpURLConnection conn = createHttpUrlConnection(convertToUrl(TEST_URL), "", 0, "", "");
Utils.setRequestMethod(conn, Utils.RequestMethod.POST);
Assert.assertEquals(conn.getRequestMethod(), "POST");
} | Base | 1 |
public User updateUser(JpaUser user) throws NotFoundException, UnauthorizedException {
if (!UserDirectoryUtils.isCurrentUserAuthorizedHandleRoles(securityService, user.getRoles()))
throw new UnauthorizedException("The user is not allowed to set the admin role on other users");
JpaUser updateUser = User... | Class | 2 |
protected static RootSearcher searchRootDirectory(Path fPath)
throws IOException {
RootSearcher rootSearcher = new RootSearcher();
Files.walkFileTree(fPath, rootSearcher);
return rootSearcher;
} | Base | 1 |
private void verifyRewrite(File dir) throws Exception {
File xml = new File(dir, "foo.xml");
assertEquals("<foo>" + encryptNew(TEST_KEY) + "</foo>".trim(),
FileUtils.readFileToString(xml).trim());
} | Class | 2 |
public void testClearResetsPseudoHeaderDivision() {
final HttpHeadersBase http2Headers = newHttp2Headers();
http2Headers.method(HttpMethod.POST);
http2Headers.set("some", "value");
http2Headers.clear();
http2Headers.method(HttpMethod.GET);
assertThat(http2Headers.name... | Class | 2 |
private void checkCorsGetOrigin(final String in, final String out) throws ServletException, IOException {
prepareStandardInitialisation();
StringWriter sw = initRequestResponseMocks(
new Runnable() {
public void run() {
expect(request.getH... | Compound | 4 |
public TList readListBegin() throws TException {
return new TList(readByte(), readI32());
} | Base | 1 |
public void create_withThreadPool() throws Exception {
final QueuedThreadPool threadPool = new QueuedThreadPool(100);
final JettyServerFactory jettyServerFactory = mock(JettyServerFactory.class);
final StaticFilesConfiguration staticFilesConfiguration = mock(StaticFilesConfiguration.class);
... | Base | 1 |
public void testReadBytesAndWriteBytesWithFileChannel() throws IOException {
File file = File.createTempFile("file-channel", ".tmp");
RandomAccessFile randomAccessFile = null;
try {
randomAccessFile = new RandomAccessFile(file, "rw");
FileChannel channel = randomAcces... | Base | 1 |
public static byte[] decryptWithConcatKDF(final JWEHeader header,
final SecretKey secretKey,
final Base64URL encryptedKey,
final Base64URL iv,
final Base64URL cipherText,
final Base64URL authTag,
final Provider ceProvider,
final Provider macProvider)
throws JOS... | Base | 1 |
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 |
private void returnPrincipals(Subject subject, PrintWriter out) {
Map<String, Object> answer = new HashMap<String, Object>();
List<Object> principals = new ArrayList<Object>();
for (Principal principal : subject.getPrincipals()) {
Map<String, String> data = new HashMap<String,... | Compound | 4 |
public AuthorizationCodeRequestUrl newAuthorizationUrl() {
return new AuthorizationCodeRequestUrl(authorizationServerEncodedUrl, clientId).setScopes(
scopes);
} | Class | 2 |
private void visitorPermission(Invocation ai) {
ai.invoke();
String templateName = ai.getReturnValue();
if (templateName == null) {
return;
}
GlobalResourceHandler.printUserTime("Template before");
String templatePath = TemplateHelper.fullTemplateInfo(ai.g... | Base | 1 |
public Argument<Session> argumentType() {
return Argument.of(Session.class);
} | Class | 2 |
public void testPseudoHeadersMustComeFirstWhenIterating() {
final HttpHeadersBase headers = newHttp2Headers();
verifyPseudoHeadersFirst(headers);
verifyAllPseudoHeadersPresent(headers);
} | Class | 2 |
private void handle(ServletRequestHandler pReqHandler,HttpServletRequest pReq, HttpServletResponse pResp) throws IOException {
JSONAware json = null;
try {
// Check access policy
requestHandler.checkClientIPAccess(pReq.getRemoteHost(),pReq.getRemoteAddr());
// Re... | Compound | 4 |
public OHttpSession[] getSessions() {
acquireSharedLock();
try {
return (OHttpSession[]) sessions.values().toArray(new OHttpSession[sessions.size()]);
} finally {
releaseSharedLock();
}
}
| Class | 2 |
void shouldNotDecodeSlash() {
final PathAndQuery res = PathAndQuery.parse("%2F?%2F");
// Do not accept a relative path.
assertThat(res).isNull();
final PathAndQuery res1 = PathAndQuery.parse("/%2F?%2F");
assertThat(res1).isNotNull();
assertThat(res1.path()).isEqualTo(... | Base | 1 |
public void setFeature(String name, boolean value) throws SAXException {
getXMLReader().setFeature(name, value);
} | Base | 1 |
void sharp() {
final PathAndQuery res = PathAndQuery.parse("/#?a=b#1");
assertThat(res).isNotNull();
assertThat(res.path()).isEqualTo("/#");
assertThat(res.query()).isEqualTo("a=b#1");
// '%23' in a query string should never be decoded into '#'.
final PathAndQuery re... | Base | 1 |
private boolean handleJid(Invite invite) {
List<Contact> contacts = xmppConnectionService.findContacts(invite.getJid(), invite.account);
if (invite.isAction(XmppUri.ACTION_JOIN)) {
Conversation muc = xmppConnectionService.findFirstMuc(invite.getJid());
if (muc != null) {
switchToConversation(muc, invite.... | Class | 2 |
void resetPasswordUnexistingUser() throws Exception
{
when(this.userReference.toString()).thenReturn("user:Foobar");
when(this.userManager.exists(this.userReference)).thenReturn(false);
String exceptionMessage = "User [user:Foobar] doesn't exist";
when(this.localizationManager.ge... | Base | 1 |
public static SecretKey deriveSharedKey(final JWEHeader header,
final SecretKey Z,
final ConcatKDF concatKDF)
throws JOSEException {
final int sharedKeyLength = sharedKeyLength(header.getAlgorithm(), header.getEncryptionMethod());
// Set the alg ID for the concat KDF
AlgorithmMode algMode = resol... | Base | 1 |
public CsrfTokenHandler(final Form< ? > form)
{
form.add(csrfTokenField = new HiddenField<String>("csrfToken", Model.of(getCsrfSessionToken())));
} | Compound | 4 |
public void translate(ServerOpenHorseWindowPacket packet, GeyserSession session) {
Entity entity = session.getEntityCache().getEntityByJavaId(packet.getEntityId());
if (entity == null) {
return;
}
UpdateEquipPacket updateEquipPacket = new UpdateEquipPacket();
upd... | Class | 2 |
ReservedChar(int rawChar, String percentEncodedChar, byte marker) {
this.rawChar = rawChar;
this.percentEncodedChar = percentEncodedChar;
this.marker = marker;
} | Base | 1 |
public void testGetOperations() {
final HttpHeadersBase headers = newEmptyHeaders();
headers.add("Foo", "1");
headers.add("Foo", "2");
assertThat(headers.get("Foo")).isEqualTo("1");
final List<String> values = headers.getAll("Foo");
assertThat(values).containsExactl... | Class | 2 |
public CorsChecker(Document pDoc) {
NodeList corsNodes = pDoc.getElementsByTagName("cors");
if (corsNodes.getLength() > 0) {
patterns = new ArrayList<Pattern>();
for (int i = 0; i < corsNodes.getLength(); i++) {
Node corsNode = corsNodes.item(i);
... | Compound | 4 |
void checkVerificationCode() throws Exception
{
when(this.userManager.exists(this.userReference)).thenReturn(true);
InternetAddress email = new InternetAddress("foobar@xwiki.org");
when(this.userProperties.getEmail()).thenReturn(email);
String verificationCode = "abcd1245";
... | Base | 1 |
public void translate(ServerStopSoundPacket packet, GeyserSession session) {
// Runs if all sounds are stopped
if (packet.getSound() == null) {
StopSoundPacket stopPacket = new StopSoundPacket();
stopPacket.setStoppingAllSound(true);
stopPacket.setSoundName("");
... | Class | 2 |
public boolean isValid(String value, ConstraintValidatorContext context) {
if (StringUtils.isEmpty(value)) {
return true;
}
try {
Pattern.compile(value);
return true;
} catch (Exception ex) {
String errorMessage = String.format("URL parameter '%s' is not a va... | Class | 2 |
public JiffleRuntime getRuntimeInstance(Jiffle.RuntimeModel model) throws
it.geosolutions.jaiext.jiffle.JiffleException {
return createRuntimeInstance(model, getRuntimeBaseClass(model), false);
} | Base | 1 |
public boolean checkObjectExecutePermission(Class clazz, String methodName)
{
if (Class.class.isAssignableFrom(clazz) && methodName != null && this.secureClassMethods.contains(methodName)) {
return true;
} else {
return super.checkObjectExecutePermission(clazz, methodName... | Class | 2 |
public void violationMessagesAreEscaped() {
assertThat(ConstraintViolations.format(validator.validate(new InjectionExample()))).containsExactly(
" ${'value'}",
"${'property'} ${'value'}",
"${'property'}[${'key'}] ${'value'}",
"${'property'}[1] ... | Class | 2 |
final void set(CharSequence name, Iterable<String> values) {
final AsciiString normalizedName = normalizeName(name);
requireNonNull(values, "values");
final int h = normalizedName.hashCode();
final int i = index(h);
remove0(h, i, normalizedName);
for (String v : val... | Class | 2 |
public void submoduleAdd(String repoUrl, String submoduleNameToPutInGitSubmodules, String folder) {
String[] addSubmoduleWithSameNameArgs = new String[]{"submodule", "add", repoUrl, folder};
String[] changeSubmoduleNameInGitModules = new String[]{"config", "--file", ".gitmodules", "--rename-section"... | Class | 2 |
public Player(String title, ISkinParam skinParam, TimingRuler ruler, boolean compact) {
this.skinParam = skinParam;
this.compact = compact;
this.ruler = ruler;
this.title = Display.getWithNewlines(title);
} | Base | 1 |
public void headersWithDifferentNamesAndValuesShouldNotBeEquivalent() {
final HttpHeadersBase h1 = newEmptyHeaders();
h1.set("name1", "value1");
final HttpHeadersBase h2 = newEmptyHeaders();
h2.set("name2", "value2");
assertThat(h1).isNotEqualTo(h2);
assertThat(h2).is... | Class | 2 |
public void nullHeaderNameNotAllowed() {
newEmptyHeaders().add(null, "foo");
} | Class | 2 |
private static PathAndQuery splitPathAndQuery(@Nullable final String pathAndQuery) {
final Bytes path;
final Bytes query;
if (pathAndQuery == null) {
return ROOT_PATH_QUERY;
}
// Split by the first '?'.
final int queryPos = pathAndQuery.indexOf('?');
... | Base | 1 |
public static int sharedKeyLength(final JWEAlgorithm alg, final EncryptionMethod enc)
throws JOSEException {
if (alg.equals(JWEAlgorithm.ECDH_ES)) {
int length = enc.cekBitLength();
if (length == 0) {
throw new JOSEException("Unsupported JWE encryption method " + enc);
}
return length;
} els... | Base | 1 |
private XMLGregorianCalendar toXMLGregorianCalendar(ZonedDateTime instant) {
if (instant == null) {
return null;
}
return new XMLGregorianCalendarImpl(GregorianCalendar.from(instant));
} | Base | 1 |
public void translate(ServerSpawnExpOrbPacket packet, GeyserSession session) {
Vector3f position = Vector3f.from(packet.getX(), packet.getY(), packet.getZ());
Entity entity = new ExpOrbEntity(
packet.getExp(), packet.getEntityId(), session.getEntityCache().getNextEntityId().incremen... | Class | 2 |
public void translate(ServerPlayerChangeHeldItemPacket packet, GeyserSession session) {
PlayerHotbarPacket hotbarPacket = new PlayerHotbarPacket();
hotbarPacket.setContainerId(0);
hotbarPacket.setSelectedHotbarSlot(packet.getSlot());
hotbarPacket.setSelectHotbarSlot(true);
se... | Class | 2 |
private static boolean doesNotContainFileColon(String path) {
return !path.contains("file:");
} | Base | 1 |
public void existingDocumentFromUICheckEscaping() throws Exception
{
// current document = xwiki:Main.WebHome
DocumentReference documentReference = new DocumentReference("xwiki", Arrays.asList("Main"), "WebHome");
XWikiDocument document = mock(XWikiDocument.class);
when(document.... | Class | 2 |
public void translate(ServerRemoveEntitiesPacket packet, GeyserSession session) {
for (int entityId : packet.getEntityIds()) {
Entity entity = session.getEntityCache().getEntityByJavaId(entityId);
if (entity != null) {
session.getEntityCache().removeEntity(entity, fal... | Class | 2 |
final void add(CharSequence name, String value) {
final AsciiString normalizedName = normalizeName(name);
requireNonNull(value, "value");
final int h = normalizedName.hashCode();
final int i = index(h);
add0(h, i, normalizedName, value);
} | Class | 2 |
public boolean isCorsAccessAllowed(String pOrigin) {
return restrictor.isCorsAccessAllowed(pOrigin);
} | Compound | 4 |
public void multipleTestingOfSameClass() throws Exception {
assertThat(ConstraintViolations.format(validator.validate(new CorrectExample())))
.isEmpty();
assertThat(ConstraintViolations.format(validator.validate(new CorrectExample())))
.isEmpty();
assertThat(TestLogge... | Class | 2 |
public void create_withNullThreadPool() throws Exception {
final JettyServerFactory jettyServerFactory = mock(JettyServerFactory.class);
final StaticFilesConfiguration staticFilesConfiguration = mock(StaticFilesConfiguration.class);
final Routes routes = mock(Routes.class);
when(jet... | Base | 1 |
public List<String> getShellCommandLine( String[] arguments )
{
List<String> commandLine = new ArrayList<String>();
if ( getShellCommand() != null )
{
commandLine.add( getShellCommand() );
}
if ( getShellArgs() != null )
{
commandLine.ad... | Base | 1 |
public void translate(ServerSetTitleTextPacket packet, GeyserSession session) {
String text;
if (packet.getText() == null) { //TODO 1.17 can this happen?
text = " ";
} else {
text = MessageTranslator.convertMessage(packet.getText(), session.getLocale());
}
... | Class | 2 |
public TMap readMapBegin() throws TException {
int size = readVarint32();
byte keyAndValueType = size == 0 ? 0 : readByte();
return new TMap(
getTType((byte) (keyAndValueType >> 4)), getTType((byte) (keyAndValueType & 0xf)), size);
} | Base | 1 |
List<String> cleanForKeySlow(String key) {
key = StringUtils.trin(StringUtils.goLowerCase(key));
key = key.replaceAll("_|\\.|\\s", "");
// key = replaceSmart(key, "partition", "package");
key = replaceSmart(key, "sequenceparticipant", "participant");
key = replaceSmart(key, "sequenceactor", "actor");
key =... | Base | 1 |
public void newDocumentFromURLTemplateProviderSpecifiedNonTerminal() throws Exception
{
// new document = xwiki:X.Y
DocumentReference documentReference = new DocumentReference("xwiki", "X", "Y");
XWikiDocument document = mock(XWikiDocument.class);
when(document.getDocumentReferen... | Class | 2 |
public String compact() {
return id.replaceAll("/", "-").replaceAll("\\\\", "-");
} | Class | 2 |
public void translate(ServerKeepAlivePacket packet, GeyserSession session) {
if (!session.getConnector().getConfig().isForwardPlayerPing()) {
return;
}
NetworkStackLatencyPacket latencyPacket = new NetworkStackLatencyPacket();
latencyPacket.setFromServer(true);
la... | Class | 2 |
public void translate(ServerUpdateTimePacket packet, GeyserSession session) {
// Bedrock sends a GameRulesChangedPacket if there is no daylight cycle
// Java just sends a negative long if there is no daylight cycle
long time = packet.getTime();
// https://minecraft.gamepedia.com/Day... | Class | 2 |
private JsonNode yamlPathToJson(Path path) throws IOException {
Yaml reader = new Yaml();
ObjectMapper mapper = new ObjectMapper();
Path p;
try (InputStream in = Files.newInputStream(path)) {
return mapper.valueToTree(reader.load(in));
}
} | Base | 1 |
public Claims validateToken(String token) throws AuthenticationException {
try {
RsaKeyUtil rsaKeyUtil = new RsaKeyUtil();
PublicKey publicKey = rsaKeyUtil.fromPemEncoded(keycloakPublicKey);
return (Claims) Jwts.parser().setSigningKey(publicKey).parse(token.replace("Bear... | Base | 1 |
public HomePageConfig loadConfigFor(Identity identity) {
String userName = identity.getName();
HomePageConfig retVal = null;
File configFile = getConfigFile(userName);
if (!configFile.exists()) {
// config file does not exist! create one, init the defaults, save it.
retVal = loadAndSaveDefaults(identity)... | Base | 1 |
public void testSelectByType() {
JWKSelector selector = new JWKSelector(new JWKMatcher.Builder().keyType(KeyType.RSA).build());
List<JWK> keyList = new ArrayList<>();
keyList.add(new RSAKey.Builder(new Base64URL("n"), new Base64URL("e")).keyID("1").build());
keyList.add(new ECKey.Builder(ECKey.Curve.P_256, n... | Base | 1 |
public String getOrderBy() {
return orderBy;
} | Base | 1 |
public void testSetContentFromFile() throws Exception {
TestHttpData test = new TestHttpData("test", UTF_8, 0);
try {
File tmpFile = File.createTempFile(UUID.randomUUID().toString(), ".tmp");
tmpFile.deleteOnExit();
FileOutputStream fos = new FileOutputStream(tmpF... | Base | 1 |
public Optional<URL> getResource(String path) {
boolean isDirectory = isDirectory(path);
if (!isDirectory) {
URL url = classLoader.getResource(prefixPath(path));
return Optional.ofNullable(url);
}
return Optional.empty();
} | Base | 1 |
void testDecodePath() throws Exception {
// Fast path
final String pathThatDoesNotNeedDecode = "/foo_bar_baz";
assertThat(decodePath(pathThatDoesNotNeedDecode)).isSameAs(pathThatDoesNotNeedDecode);
// Slow path
assertThat(decodePath("/foo%20bar\u007fbaz")).isEqualTo("/foo ba... | Base | 1 |
public EfficiencyStatement getUserEfficiencyStatementByKey(Long key) {
String query = "select statement from effstatement as statement where statement.key=:key";
List<UserEfficiencyStatementImpl> statement = dbInstance.getCurrentEntityManager()
.createQuery(query, UserEfficiencyStatementImpl.class)
.setPa... | Base | 1 |
public void initWithAgentDiscoveryAndUrlCreationAfterGet() throws ServletException, IOException {
checkMulticastAvailable();
prepareStandardInitialisation(ConfigKey.DISCOVERY_ENABLED.getKeyValue(), "true");
try {
StringWriter sw = initRequestResponseMocks();
expect(re... | Compound | 4 |
public void checkAccess(ThreadGroup g) {
if (RobocodeProperties.isSecurityOff()) {
return;
}
Thread c = Thread.currentThread();
if (isSafeThread(c)) {
return;
}
super.checkAccess(g);
final ThreadGroup cg = c.getThreadGroup();
if (cg == null) {
// What the heck is going on here? JDK 1.3 is ... | Class | 2 |
private static AsciiString normalizeName(CharSequence name) {
checkArgument(requireNonNull(name, "name").length() > 0, "name is empty.");
return HttpHeaderNames.of(name);
} | Class | 2 |
public void testPreserveSingleQuotesOnArgument()
{
Shell sh = newShell();
sh.setWorkingDirectory( "/usr/bin" );
sh.setExecutable( "chmod" );
String[] args = { "\'some arg with spaces\'" };
List shellCommandLine = sh.getShellCommandLine( args );
String cli = St... | Base | 1 |
public void testWhitespaceBeforeTransferEncoding02() {
String requestStr = "POST / HTTP/1.1" +
" Transfer-Encoding : chunked\r\n" +
"Host: target.com" +
"Content-Length: 65\r\n\r\n" +
"0\r\n\r\n" +
"GET /maliciousRequest HTTP/1.... | Base | 1 |
void requestResetPassword() throws Exception
{
when(this.authorizationManager.hasAccess(Right.PROGRAM)).thenReturn(true);
UserReference userReference = mock(UserReference.class);
ResetPasswordRequestResponse requestResponse = mock(ResetPasswordRequestResponse.class);
when(this.re... | Base | 1 |
private String loginUser(URI hostUri) throws Throwable {
URI usersLink = UriUtils.buildUri(hostUri, UserService.FACTORY_LINK);
// wait for factory availability
this.host.waitForReplicatedFactoryServiceAvailable(usersLink);
String basicAuth = BasicAuthenticationUtils.constructBasicAu... | Class | 2 |
public void translate(TextPacket packet, GeyserSession session) {
String message = packet.getMessage();
if (MessageTranslator.isTooLong(message, session)) {
return;
}
ClientChatPacket chatPacket = new ClientChatPacket(message);
session.sendDownstreamPacket(chatP... | Class | 2 |
public void write(byte[] b, int offset, int length) throws IOException {
if (b == null) {
throw new NullPointerException();
}
if (offset < 0 || offset + length > b.length) {
throw new ArrayIndexOutOfBoundsException();
}
write(fd, b, offset, length);
} | Base | 1 |
private String templatePath() {
if (templatePath == null) {
String file = HgCommand.class.getResource("/hg.template").getFile();
try {
templatePath = URLDecoder.decode(new File(file).getAbsolutePath(), "UTF-8");
} catch (UnsupportedEncodingException e) {
... | Class | 2 |
static void setProperty(SchemaFactory schemaFactory, String propertyName) throws SAXException {
try {
schemaFactory.setProperty(propertyName, "");
} catch (SAXException e) {
if (Boolean.getBoolean(SYSTEM_PROPERTY_IGNORE_XXE_PROTECTION_FAILURES)) {
LOGGER.warni... | Base | 1 |
public void update(DatabaseTypeUpdateRequest request) {
databaseTypeDao.selectOptionalById(request.getId()).ifPresent(data -> {
if (DatabaseTypes.has(data.getDatabaseType())) {
throw DomainErrors.MUST_NOT_MODIFY_SYSTEM_DEFAULT_DATABASE_TYPE.exception();
}
... | Class | 2 |
public static <T> T withEncodedPassword(AuthenticationRequestType type, Properties info,
PasswordAction<byte[], T> action) throws PSQLException, IOException {
byte[] encodedPassword = withPassword(type, info, password -> {
if (password == null) {
throw new PSQLException(
GT.tr("The... | Class | 2 |
error_t nicSendPacket(NetInterface *interface, const NetBuffer *buffer,
size_t offset, NetTxAncillary *ancillary)
{
error_t error;
bool_t status;
//Gather entropy
netContext.entropy += netGetSystemTickCount();
#if (TRACE_LEVEL >= TRACE_LEVEL_DEBUG)
//Retrieve the length of the packet
size_t lengt... | Class | 2 |
public boolean isAvailable() {
try {
GeoTools.getInitialContext();
return true;
} catch (NamingException e) {
return false;
}
} | Class | 2 |
public boolean add(MediaPackage sourceMediaPackage, AccessControlList acl, Date now) throws SolrServerException,
UnauthorizedException {
try {
SolrInputDocument episodeDocument = createEpisodeInputDocument(sourceMediaPackage, acl);
Schema.setOcModified(episodeDocument, now);
SolrInput... | Class | 2 |
public boolean isResetPasswordSent()
{
// If there is no form and we see an info box, then the request was sent.
return !getDriver().hasElementWithoutWaiting(By.cssSelector("#resetPasswordForm"))
&& messageBox.getText().contains("An e-mail was sent to");
} | Base | 1 |
public Process execute()
throws CommandLineException
{
// TODO: Provided only for backward compat. with <= 1.4
verifyShellState();
Process process;
//addEnvironment( "MAVEN_TEST_ENVAR", "MAVEN_TEST_ENVAR_VALUE" );
String[] environment = getEnvironmentVariables(... | Base | 1 |
public synchronized <T extends Source> T getSource(Class<T> sourceClass) throws SQLException {
checkFreed();
ensureInitialized();
if (data == null) {
return null;
}
try {
if (sourceClass == null || DOMSource.class.equals(sourceClass)) {
DocumentBuilderFactory factory = Docume... | Base | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.