Unnamed: 0
int64
0
637
label
int64
0
1
code
stringlengths
24
8.83k
300
0
private void debug(String msg) { if ( logger.isDebugEnabled() ) { logger.debug(Logger.EVENT_SUCCESS, msg); } }
301
0
private static DocumentBuilderFactory createDocumentBuilderFactory() throws ParserConfigurationException { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING , true); dbf.setValidating(false); dbf.setIgnoringComme...
302
0
public void changePassword_Resets_All_Sessions() throws Exception { ScimUser user = createUser(); MockHttpSession session = new MockHttpSession(); MockHttpSession afterLoginSessionA = (MockHttpSession) getMockMvc().perform(post("/login.do") .session(session) .accept(...
303
0
public void setValueStackFactory(ValueStackFactory valueStackFactory) { this.valueStackFactory = valueStackFactory; } @Inject("devMode")
304
0
private List<AuthInfo> createAuthInfo(SolrZkClient zkClient) { List<AuthInfo> ret = new LinkedList<AuthInfo>(); // In theory the credentials to add could change here if zookeeper hasn't been initialized ZkCredentialsProvider credentialsProvider = zkClient.getZkClientConnectionStrategy().g...
305
0
public String changePassword( Model model, @RequestParam("current_password") String currentPassword, @RequestParam("new_password") String newPassword, @RequestParam("confirm_password") String confirmPassword, HttpServletResponse response, HttpS...
306
0
public void testSnapshotMoreThanOnce() throws ExecutionException, InterruptedException, IOException { Client client = client(); final File tempDir = randomRepoPath().getAbsoluteFile(); logger.info("--> creating repository"); assertAcked(client.admin().cluster().preparePutRepository(...
307
0
protected static void setupFeatures(DocumentBuilderFactory factory) { Properties properties = System.getProperties(); List<String> features = new ArrayList<String>(); for (Map.Entry<Object, Object> prop : properties.entrySet()) { String key = (String) prop.getKey(); i...
308
0
public void testSaveAndLoad() throws IOException { assumeTrue(AppleNativeIntegrationTestUtils.isApplePlatformAvailable(ApplePlatform.MACOSX)); ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "parser_with_cell", tmp); workspace.setUp(); // Warm the parser c...
309
0
public void setEnforceAssertionsSigned(boolean enforceAssertionsSigned) { this.enforceAssertionsSigned = enforceAssertionsSigned; } /** * Enforce that the Issuer of the received Response/Assertion is known. The default is true. */
310
0
public void setUp() throws Exception { SecurityContextHolder.clearContext(); scimUserProvisioning = mock(ScimUserProvisioning.class); codeStore = mock(ExpiringCodeStore.class); passwordValidator = mock(PasswordValidator.class); clientDetailsService = mock(ClientDetailsService...
311
0
public static final void main(String args[]) { System.out.println("Supported pseudo-random functions for KDF (version: " + kdfVersion + ")"); System.out.println("Enum Name\tAlgorithm\t# bits"); for (PRF_ALGORITHMS prf : PRF_ALGORITHMS.values()) { System.out.println(prf + "\t" + prf.getAlgName() + "\t" + pr...
312
0
private void doTestExtensionSizeLimit(int len, boolean ok) throws Exception { // Setup Tomcat instance Tomcat tomcat = getTomcatInstance(); tomcat.getConnector().setProperty( "maxExtensionSize", Integer.toString(EXT_SIZE_LIMIT)); // Must have a real docBase - just u...
313
0
void sendPluginResult(PluginResult pluginResult) { synchronized (this) { if (!aborted) { callbackContext.sendPluginResult(pluginResult); } } } } /** * Adds an interface method to an InputStream to return the number...
314
0
public void setHttpClient(HttpClient httpClient) { this.httpClient = httpClient; }
315
0
protected Log getLog() { return log; } // ------------------------------------------------------------ Constructor
316
0
public void doStart() throws Exception { URI rootURI; if (serverInfo != null) { rootURI = serverInfo.resolveServer(configuredDir); } else { rootURI = configuredDir; } if (!rootURI.getScheme().equals("file")) { throw new IllegalStateExceptio...
317
0
public void setMaxSize(String maxSize) { this.maxSize = Long.parseLong(maxSize); } /** * Sets the buffer size to be used. * * @param bufferSize */ @Inject(value = StrutsConstants.STRUTS_MULTIPART_BUFFERSIZE, required = false)
318
0
public void execute(FunctionContext context) { // Verify that the cache exists before continuing. // When this function is executed by a remote membership listener, it is // being invoked before the cache is started. Cache cache = verifyCacheExists(); // Register as membership listener regist...
319
0
public void setSocketBuffer(int socketBuffer) { super.setSocketBuffer(socketBuffer); outputBuffer.setSocketBuffer(socketBuffer); }
320
0
public void waitForAllNodes(int timeout) throws IOException, InterruptedException { waitForAllNodes(jettys.size(), timeout); }
321
0
static MatcherType fromElement(Element elt) { if (StringUtils.hasText(elt.getAttribute(ATT_MATCHER_TYPE))) { return valueOf(elt.getAttribute(ATT_MATCHER_TYPE)); } return ant; }
322
0
public int realReadBytes(byte cbuf[], int off, int len) throws IOException; } /** Same as java.nio.channel.WrittableByteChannel. */
323
0
public void complete() { if (log.isDebugEnabled()) { logDebug("complete "); } check(); request.getCoyoteRequest().action(ActionCode.ASYNC_COMPLETE, null); } @Override
324
0
public void testContainsExpressionIsFalse() throws Exception { // given String anExpression = "foo"; // when boolean actual = ComponentUtils.containsExpression(anExpression); // then assertFalse(actual); } } class MockConfigurationProvider implements Configurat...
325
0
@Test(timeout = 1000L) public void testCeilLongMonths() throws Exception { Calendar cal = Calendar.getInstance(); cal.set(Calendar.MONTH, Calendar.NOVEMBER); new CronTab("0 0 31 * *").ceil(cal); // would infinite loop }
326
0
public static File unzip(File zip, File toDir, Predicate<ZipEntry> filter) throws IOException { if (!toDir.exists()) { FileUtils.forceMkdir(toDir); } Path targetDirNormalizedPath = toDir.toPath().normalize(); ZipFile zipFile = new ZipFile(zip); try { Enumeration<? extends ZipEntry> en...
327
0
public Authentication authenticate(Authentication req) throws AuthenticationException { logger.debug("Processing authentication request for " + req.getName()); if (req.getCredentials() == null) { BadCredentialsException e = new BadCredentialsException("No password supplied"); ...
328
0
public void test_SignedWithoutSignature() throws Exception { JWT inputJwt = new JWT() .setSubject("123456789") .setIssuedAt(ZonedDateTime.now(ZoneOffset.UTC)) .setExpiration(ZonedDateTime.now(ZoneOffset.UTC).plusHours(2)); String encodedJWT = JWT.getEncoder().encode(inputJwt, HMACSign...
329
0
public void initJdbcScimUserProvisioningTests() throws Exception { db = new JdbcScimUserProvisioning(jdbcTemplate, new JdbcPagingListFactory(jdbcTemplate, limitSqlAdapter)); zoneDb = new JdbcIdentityZoneProvisioning(jdbcTemplate); providerDb = new JdbcIdentityProviderProvisioning(jdbcTemplat...
330
0
public void setUp() throws Exception { lc = new LoggerContext(); lc.setName("testContext"); logger = lc.getLogger(LoggerSerializationTest.class); // create the byte output stream bos = new ByteArrayOutputStream(); oos = new ObjectOutputStream(bos); whitelist =...
331
0
public void withFieldsAndXpath() throws Exception { File tmpdir = File.createTempFile("test", "tmp", TEMP_DIR); tmpdir.delete(); tmpdir.mkdir(); tmpdir.deleteOnExit(); createFile(tmpdir, "x.xsl", xsl.getBytes("UTF-8"), false); Map entityAttrs = createMap("name", "e", "url", "cd.xml", ...
332
0
public void handle(Map<String, Object> record, String xpath); }
333
0
public int hashCode() { final int prime = 31; int result = super.hashCode(); result = prime * result + ( ( getLocation().getMember() == null ) ? 0 : getLocation().getMember().hashCode() ); return result; } @Override
334
0
public int getTransportGuaranteeRedirectStatus() { return transportGuaranteeRedirectStatus; } /** * Set the HTTP status code used when the container needs to issue an HTTP * redirect to meet the requirements of a configured transport guarantee. * * @param transportGuaranteeRedi...
335
0
public void setFireRequestListenersOnForwards(boolean enable) { fireRequestListenersOnForwards = enable; } @Override
336
0
public void cleanUp() { if (multi != null) { multi.cleanUp(); } }
337
0
public final int getDegree() { return mDegree; } /** * Returns the fieldpolynomial as a new Bitstring. * * @return a copy of the fieldpolynomial as a new Bitstring */
338
0
public void setXWorkConverter(XWorkConverter conv) { this.defaultConverter = new OgnlTypeConverterWrapper(conv); } @Inject(XWorkConstants.DEV_MODE)
339
0
public void testJvmDecoder1() { // This should trigger an error but currently passes. Once the JVM is // fixed, s/false/true/ and s/20/13/ doJvmDecoder(SRC_BYTES_1, false, 20); } @Test
340
0
protected void doStop() throws Exception { super.doStop(); // ensure client is closed when stopping if (client != null && !client.isClosed()) { client.close(); } client = null; }
341
0
public O transform(final Object input) { if (input == null) { return null; } try { final Class<?> cls = input.getClass(); final Method method = cls.getMethod(iMethodName, iParamTypes); return (O) method.invoke(input, iArgs); } catch (fi...
342
0
public String getCompression() { switch (compressionLevel) { case 0: return "off"; case 1: return "on"; case 2: return "force"; } return "off"; } /** * Set compression level. */
343
0
public Reader getData(String query) { return new StringReader(xml); } }; }
344
0
public String getInfo() { return (info); }
345
0
public void setMethods(Set<String> methods) { this.methods = new HashSet<>(); for (String method : methods) { this.methods.add(method.toUpperCase()); } } /** * @param authenticationEntryPoint the authenticationEntryPoint to set */
346
0
public void run() { synchronized (context) { File file = context.targetFile; if (file != null) { file.delete(); } // Trigger the abort callback immediately to m...
347
0
public Iterator<Group> getGroups() { synchronized (groups) { return (groups.iterator()); } } /** * Return the set of {@link Role}s assigned specifically to this user. */ @Override
348
0
public static Encryptor getInstance() throws EncryptionException { if ( singletonInstance == null ) { synchronized ( JavaEncryptor.class ) { if ( singletonInstance == null ) { singletonInstance = new JavaEncryptor(); } } } ...
349
0
private ApplicationContext getContext() { return getSharedObject(ApplicationContext.class); } /** * Allows configuring OpenID based authentication. * * <h2>Example Configurations</h2> * * A basic example accepting the defaults and not using attribute exchange: * * <pre> * &#064;Configuration * &...
350
0
public URL getConfigFile() { return configFile; } @Override
351
0
void version(String version); @LogMessage(level = INFO) @Message(id = 2, value = "Ignoring XML configuration.")
352
0
public void copyToRepository(InputStream source, int size, Artifact destination, FileWriteMonitor monitor) throws IOException { if(!destination.isResolved()) { throw new IllegalArgumentException("Artifact "+destination+" is not fully resolved"); } // is this a writable repository...
353
0
public void testRead7ZipMultiVolumeArchiveForFile() throws IOException { final File file = getFile("apache-maven-2.2.1.zip.001"); ZipFile zf = new ZipFile(file); zf.close(); }
354
0
public boolean getMapperDirectoryRedirectEnabled();
355
0
public void testFloatInHeader() { Response response = WebClient.create(endPoint + TIKA_PATH) .type("application/pdf") .accept("text/plain") .header(TikaResource.X_TIKA_PDF_HEADER_PREFIX + "averageCharTolerance", ...
356
0
private void testKeyGenerationAll() throws Exception { testKeyGeneration(1024); testKeyGeneration(2048); testKeyGeneration(3072); }
357
0
public static String normalizeChildProjectValue(String actualValue){ actualValue = actualValue.replaceAll("(,[ ]*,)", ", "); actualValue = actualValue.replaceAll("(^,|,$)", ""); return actualValue.trim(); }
358
0
public void sendRequest(DiscoveryNode node, long requestId, String action, TransportRequest request, TransportRequestOptions options) throws IOException, TransportException { if (recoveryActionToBlock.equals(action) || requestBlocked.getCount() == 0) { logger.info("--> preventing {} ...
359
0
protected void stopInternal() throws LifecycleException { super.stopInternal(); // Close any open DB connection close(this.dbConnection); }
360
0
public static String getPathWithinApplication(HttpServletRequest request) { String contextPath = getContextPath(request); String requestUri = getRequestUri(request); if (StringUtils.startsWithIgnoreCase(requestUri, contextPath)) { // Normal case: URI contains context path. ...
361
0
public boolean getAllowCasualMultipartParsing(); /** * Set to <code>true</code> to allow requests mapped to servlets that * do not explicitly declare @MultipartConfig or have * &lt;multipart-config&gt; specified in web.xml to parse * multipart/form-data requests. * * @param allowC...
362
0
public void setCharset(Charset charset) { if( !byteC.isNull() ) { // if the encoding changes we need to reset the conversion results charC.recycle(); hasStrValue=false; } byteC.setCharset(charset); } /** * Sets the content to be a char[] ...
363
0
public final GF2nElement convert(GF2nElement elem, GF2nField basis) throws RuntimeException { if (basis == this) { return (GF2nElement)elem.clone(); } if (fieldPolynomial.equals(basis.fieldPolynomial)) { return (GF2nElement)elem.clone(); ...
364
0
public CsrfConfigurer<H> csrfTokenRepository( CsrfTokenRepository csrfTokenRepository) { Assert.notNull(csrfTokenRepository, "csrfTokenRepository cannot be null"); this.csrfTokenRepository = csrfTokenRepository; return this; } /** * Specify the {@link RequestMatcher} to use for determining when CSRF shou...
365
0
private BigInteger[] derDecode( byte[] encoding) throws IOException { ASN1Sequence s = (ASN1Sequence)ASN1Primitive.fromByteArray(encoding); if (s.size() != 2) { throw new IOException("malformed signature"); } if (!Arrays.areEqual(encoding, s.g...
366
0
protected UserDetailsContextMapper getUserDetailsContextMapper() { return userDetailsContextMapper; }
367
0
public abstract void perform() throws IOException;
368
0
public long getFailureCount() { return failureCounter.get(); }
369
0
public long getTimestamp() { return timestamp; } } }
370
0
public int getTransportGuaranteeRedirectStatus() { return transportGuaranteeRedirectStatus; } /** * Set the HTTP status code used when the container needs to issue an HTTP * redirect to meet the requirements of a configured transport guarantee. * * @param transportGuaranteeRedi...
371
0
public void setRedirectUri(String redirectUri) { this.redirectUri = redirectUri; }
372
0
public boolean isDoLoop() { return iDoLoop; }
373
0
public void testCompatibilityWith_v1_0_12() throws IOException, ClassNotFoundException { FileInputStream fis = new FileInputStream(SERIALIZATION_PREFIX + "logger_v1.0.12.ser"); ObjectInputStream ois = new ObjectInputStream(fis); Logger a = (Logger) ois.readObject(); ois.close(); ...
374
0
public Tomcat getTomcatInstance() { return tomcat; } /** * Make the Tomcat instance preconfigured with test/webapp available to * sub-classes. * @param addJstl Should JSTL support be added to the test webapp * @param start Should the Tomcat instance be started * * @r...
375
0
@CheckForNull public TimeZone getTimeZone() { if (this.specTimezone == null) { return null; } return TimeZone.getTimeZone(this.specTimezone); }
376
0
public int getCacheSize() { return cacheSize; } /** * @param cacheSize The cacheSize to set. */
377
0
protected Log getLog() { return log; } @Override
378
0
public X509Certificate generateCert(PublicKey publicKey, PrivateKey privateKey, String sigalg, int validity, String cn, String ou, String o, String l, String st, String c) throws java.security.SignatureException, ...
379
0
public String getRmiBindAddress() { return rmiBindAddress; } /** * Set the inet address on which the Platform RMI server is exported. * @param theRmiBindAddress The textual representation of inet address */
380
0
public ClientLockoutPolicyRetriever setEnabled(boolean enabled) { isEnabled = enabled; return this; }
381
0
private Page createPage() { if (pageCreator == null) { return null; } else { return pageCreator.createPage(); } } /** * @see org.apache.wicket.Component#onBeforeRender() */ @Override
382
0
public Object getTarget() { Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER); return this; } @Override
383
0
public void testSpecifiedIndexUnavailable_multipleIndices() throws Exception { createIndex("test1"); ensureYellow(); // Verify defaults verify(search("test1", "test2"), true); verify(msearch(null, "test1", "test2"), true); verify(count("test1", "test2"), true); ...
384
0
public boolean isEraseCredentialsAfterAuthentication() { return false; }
385
0
public void copyToRepository(InputStream source, int size, Artifact destination, FileWriteMonitor monitor) throws IOException { if(!destination.isResolved()) { throw new IllegalArgumentException("Artifact "+destination+" is not fully resolved"); } // is this a writable repository...
386
0
public void setAllowJavaSerializedObject(boolean allowJavaSerializedObject) { // need to override and call super for component docs super.setAllowJavaSerializedObject(allowJavaSerializedObject); }
387
0
public void testChunkHeaderCRLF() throws Exception { doTestChunkingCRLF(true, true, true, true, true, true); } @Test
388
0
protected Log getLog() { return log; } // ----------------------------------------------------------- Constructors
389
0
void readRequest(HttpServletRequest request, HttpMessage message); /** * Parses the body from a {@link org.apache.camel.http.common.HttpMessage} * * @param httpMessage the http message * @return the parsed body returned as either a {@link java.io.InputStream} or a {@link java.io.Reader} ...
390
0
public void setUp() throws Exception { provider = new ActiveDirectoryLdapAuthenticationProvider("mydomain.eu", "ldap://192.168.1.200/"); } @Test
391
0
public Collection<ResourcePermission> getRequiredPermissions(String regionName) { return Collections.singletonList(new ResourcePermission(ResourcePermission.Resource.DATA, ResourcePermission.Operation.READ, regionName)); }
392
0
public void testConstructor1() throws Exception { SimpleBindRequest bindRequest = new SimpleBindRequest(); bindRequest = bindRequest.duplicate(); assertNotNull(bindRequest.getBindDN()); assertEquals(bindRequest.getBindDN(), ""); assertNotNull(bindRequest.getPassword()); assertEqua...
393
0
public PackageConfig getPackageConfig(String name) { return packageContexts.get(name); }
394
0
public String[] getRoles(Principal principal) { if (principal instanceof GenericPrincipal) { return ((GenericPrincipal) principal).getRoles(); } String className = principal.getClass().getSimpleName(); throw new IllegalStateException(sm.getString("realmBase.cannotGetRole...
395
0
public void destroy() { normalView = null; viewViews = null; viewServers = null; viewGraphs = null; pageView = null; editView = null; addView = null; addGraph = null; editGraph = null; viewServer = null; editServer = null; ...
396
0
public ParameterMetaData build() { return new ParameterMetaData( parameterIndex, name, parameterType, adaptOriginsAndImplicitGroups( getConstraints() ), isCascading(), getGroupConversions(), requiresUnwrapping() ); } } }
397
0
public String createDB(String dbName) { // ensure there are no illegal chars in DB name InputUtils.validateSafeInput(dbName); String result = DB_CREATED_MSG + ": " + dbName; Connection conn = null; try { conn = DerbyConnectionUtil.getDerbyConnection(dbName, ...
398
0
protected void onUnsuccessfulAuthentication(HttpServletRequest request, HttpServletResponse response, AuthenticationException failed) throws IOException { super.onUnsuccessfulAuthentication(request, response, failed); LOGGER.log(Level.INFO, "Login attempt failed", failed); }
399
0
public static File resolve(File[] roots, String path) { for (File root : roots) { File file = new File(path); final File normalizedPath; try { if (file.isAbsolute()) { normalizedPath = file.getCanonicalFile(); } else { ...