Unnamed: 0
int64
0
637
label
int64
0
1
code
stringlengths
24
8.83k
0
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...
1
0
public String getCharacterEncoding() { return characterEncoding; } /** * Set the character encoding to be used to read the user name and password. * * @param encoding The name of the encoding to use */
2
0
public Log getLogger() { return logger; }
3
0
public void getAbsolutePathTest() { String absolutePath = FileUtil.getAbsolutePath("LICENSE-junit.txt"); Assert.assertNotNull(absolutePath); String absolutePath2 = FileUtil.getAbsolutePath(absolutePath); Assert.assertNotNull(absolutePath2); Assert.assertEquals(absolutePath, absolutePath2); } @Test
4
0
private Collection getPcClassLoaders() { if (_pcClassLoaders == null) _pcClassLoaders = new ConcurrentReferenceHashSet( ConcurrentReferenceHashSet.WEAK); return _pcClassLoaders; }
5
0
public static void main(String argv[]) throws Exception { doMain(SimpleSocketServer.class, argv); }
6
0
public JettyHttpComponent getComponent() { return (JettyHttpComponent) super.getComponent(); } @Override
7
0
public boolean isConfigured() { return order >= CONFIGURING.order; } } }
8
0
protected static final boolean isAlpha(String value) { for (int i = 0; i < value.length(); i++) { char c = value.charAt(i); if (!((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'))) { return false; } } return true; }
9
0
public void fail_if_unzipping_stream_outside_target_directory() throws Exception { File zip = new File(getClass().getResource("ZipUtilsTest/zip-slip.zip").toURI()); File toDir = temp.newFolder(); expectedException.expect(IllegalStateException.class); expectedException.expectMessage("Unzipping an entr...
10
0
public TransformerFactory createTransformerFactory() { TransformerFactory factory = TransformerFactory.newInstance(); // Enable the Security feature by default try { factory.setFeature(javax.xml.XMLConstants.FEATURE_SECURE_PROCESSING, true); } catch (TransformerConfigurat...
11
0
public long getAuthenticatedTime() { return authenticatedTime; } @Override @JsonIgnore
12
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, ...
13
0
public FormValidation doCheckCommand(@QueryParameter String value) { if (!Jenkins.getInstance().hasPermission(Jenkins.RUN_SCRIPTS)) { return FormValidation.warning(Messages.CommandLauncher_cannot_be_configured_by_non_administrato()); } if (Util.fixEmptyAndTrim...
14
0
public void filterWithParameter() throws IOException, ServletException { filterWithParameterForMethod("delete", "DELETE"); filterWithParameterForMethod("put", "PUT"); filterWithParameterForMethod("patch", "PATCH"); } @Test
15
0
public void setReplayCache(TokenReplayCache<String> replayCache) { this.replayCache = replayCache; }
16
0
public void setUp() throws Exception { scimUserProvisioning = mock(ScimUserProvisioning.class); expiringCodeStore = mock(ExpiringCodeStore.class); passwordValidator = mock(PasswordValidator.class); clientDetailsService = mock(ClientDetailsService.class); resetPasswordService ...
17
0
public AhcComponent getComponent() { return (AhcComponent) super.getComponent(); } @Override
18
0
public StandardInterceptUrlRegistry access(String... attributes) { addMapping(requestMatchers, SecurityConfig.createList(attributes)); return UrlAuthorizationConfigurer.this.REGISTRY; } } }
19
0
protected static Object toPoolKey(Map map) { Object key = Configurations.getProperty("Id", map); return ( key != null) ? key : map; } /** * Register <code>factory</code> in the pool under <code>key</code>. * * @since 1.1.0 */
20
0
protected Log getLog() { return log; } // ----------------------------------------------------------- Constructors
21
0
public void commence(ServletRequest request, ServletResponse response, AuthenticationException authException) throws IOException, ServletException { HttpServletRequest hrequest = (HttpServletRequest)request; HttpServletResponse hresponse = (HttpServletResponse)respo...
22
0
public void testSetParameterAndAttributeNames() throws Exception { interceptor.setAttributeName("hello"); interceptor.setParameterName("world"); params.put("world", Locale.CHINA); interceptor.intercept(mai); assertNull(params.get("world")); // should have been removed ...
23
0
String postProcessVariableName(String variableName) { return variableName; } } }
24
0
public Iterable<Cascadable> getCascadables() { return cascadables; } @Override
25
0
public String getDataSourceName() { return dataSourceName; } /** * Set the name of the JNDI JDBC DataSource. * * @param dataSourceName the name of the JNDI JDBC DataSource */
26
0
public boolean equals(Object obj) { if ( this == obj ) { return true; } if ( !super.equals( obj ) ) { return false; } if ( getClass() != obj.getClass() ) { return false; } ConstrainedField other = (ConstrainedField) obj; if ( getLocation().getMember() == null ) { if ( other.getLocation().ge...
27
0
public boolean isSingleton() { return _singleton; } /** * The plugin class name. */
28
0
public String toXml() { StringBuilder sb = new StringBuilder("<user username=\""); sb.append(RequestUtil.filter(username)); sb.append("\" password=\""); sb.append(RequestUtil.filter(password)); sb.append("\""); if (fullName != null) { sb.append(" fullName...
29
0
public static Document signMetaInfo(Crypto crypto, String keyAlias, String keyPassword, Document doc, String referenceID) throws Exception { if (keyAlias == null || "".equals(keyAlias)) { keyAlias = crypto.getDefaultX509Identifier(); } ...
30
0
private Charset getCharset(String encoding) { if (encoding == null) { return DEFAULT_CHARSET; } try { return B2CConverter.getCharset(encoding); } catch (UnsupportedEncodingException e) { return DEFAULT_CHARSET; } } /** * Debug...
31
0
public ConstrainedParameter getParameterMetaData(int parameterIndex) { if ( parameterIndex < 0 || parameterIndex > parameterMetaData.size() - 1 ) { throw log.getInvalidExecutableParameterIndexException( executable.getAsString(), parameterIndex ); } return parameterMetaData.get( parameterIndex );...
32
0
private SendfileState processSendfile(SocketWrapperBase<?> socketWrapper) { openSocket = keepAlive; // Done is equivalent to sendfile not being used SendfileState result = SendfileState.DONE; // Do sendfile as needed: add socket to sendfile and end if (sendfileData != null &&...
33
0
protected String determineTargetUrl(HttpServletRequest request) { String targetUrl = request.getParameter("from"); request.getSession().setAttribute("from", targetUrl); if (targetUrl == null) return getDefaultTargetUrl(); if (Util.isAbsoluteUri(targetUrl)) r...
34
0
public final void recycle() { try { // Must clear super's buffer. while (ready()) { // InputStreamReader#skip(long) will allocate buffer to skip. read(); } } catch(IOException ioe){ } } } /** Special output stream whe...
35
0
public void execute(FunctionContext context) { RegionFunctionContext rfc = (RegionFunctionContext) context; Set<String> keys = (Set<String>) rfc.getFilter(); // Get local (primary) data for the context Region primaryDataSet = PartitionRegionHelper.getLocalDataForContext(rfc); if (this.cache.getL...
36
0
private static boolean isFile(Path src) { return Files.exists(src) && Files.isRegularFile(src); }
37
0
public BeanDefinition parse(Element element, ParserContext pc) { CompositeComponentDefinition compositeDef = new CompositeComponentDefinition( element.getTagName(), pc.extractSource(element)); pc.pushContainingComponent(compositeDef); registerFilterChainProxyIfNecessary(pc, pc.extractSource(element)); //...
38
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; ...
39
0
public BeanDefinition parse(Element elt, ParserContext pc) { MatcherType matcherType = MatcherType.fromElement(elt); String path = elt.getAttribute(HttpSecurityBeanDefinitionParser.ATT_PATH_PATTERN); String requestMatcher = elt.getAttribute(ATT_REQUEST_MATCHER_REF); String filters = elt.getAttribute(HttpSecuri...
40
0
public long end() throws IOException { return 0; }
41
0
public static <E> Closure<E> whileClosure(final Predicate<? super E> predicate, final Closure<? super E> closure, final boolean doLoop) { if (predicate == null) { throw new NullPointerException("Predicate must not be null"); } if (clo...
42
0
public void setDefaultHostName(String defaultHostName) { this.defaultHostName = defaultHostName; } /** * Add a new host to the mapper. * * @param name Virtual host name * @param aliases Alias names for the virtual host * @param host Host object */
43
0
protected void startInternal() throws LifecycleException { // Create the roles PreparedStatement string StringBuilder temp = new StringBuilder("SELECT "); temp.append(roleNameCol); temp.append(" FROM "); temp.append(userRoleTable); temp.append(" WHERE "); tem...
44
0
public XMLLoader init(SolrParams args) { // Init StAX parser: inputFactory = XMLInputFactory.newInstance(); EmptyEntityResolver.configureXMLInputFactory(inputFactory); inputFactory.setXMLReporter(xmllog); try { // The java 1.6 bundled stax parser (sjsxp) does not currently have a thread-safe...
45
0
public void setParameterName(String parameterName) { this.parameterName = parameterName; }
46
0
public byte[] asSerializedByteArray() { int kdfInfo = cipherText_.getKDFInfo(); debug("asSerializedByteArray: kdfInfo = " + kdfInfo); long timestamp = cipherText_.getEncryptionTimestamp(); String cipherXform = cipherText_.getCipherTransformation(); assert cipherText_.getKeySi...
47
0
public void testContextRoot_Bug53339() throws Exception { Tomcat tomcat = getTomcatInstance(); tomcat.enableNaming(); // No file system docBase required Context ctx = tomcat.addContext("", null); Tomcat.addServlet(ctx, "Bug53356", new Bug53356Servlet()); ctx.addServ...
48
0
protected void execute() { if (controllersListStrings == null && !removeCont && !removeAll) { print("No controller are given, skipping."); return; } if (controllersListStrings != null) { Arrays.asList(controllersListStrings).forEach( c...
49
0
protected void saveLocale(ActionInvocation invocation, Locale locale) { invocation.getInvocationContext().setLocale(locale); }
50
0
public boolean isFinished() { return endChunk; }
51
0
public void test1() throws ANTLRException { new CronTab("@yearly"); new CronTab("@weekly"); new CronTab("@midnight"); new CronTab("@monthly"); new CronTab("0 0 * 1-10/3 *"); } @Test
52
0
public void multiByteReadThrowsAtEofForCorruptedStoredEntry() throws Exception { byte[] content; try (FileInputStream fs = new FileInputStream(getFile("COMPRESS-264.zip"))) { content = IOUtils.toByteArray(fs); } // make size much bigger than entry's real size for ...
53
0
public void testRead7ZipMultiVolumeArchiveForStream() throws IOException { final FileInputStream archive = new FileInputStream(getFile("apache-maven-2.2.1.zip.001")); ZipArchiveInputStream zi = null; try { zi = new ZipArchiveInputStream(archive,null,false); ...
54
0
public static Charset getCharset(String enc) throws UnsupportedEncodingException { // Encoding names should all be ASCII String lowerCaseEnc = enc.toLowerCase(Locale.US); Charset charset = (Charset) encodingToCharsetCache.get(lowerCaseEnc); if (charset == null)...
55
0
public final String convert(String str, boolean query) { if (str == null) return null; if( (!query || str.indexOf( '+' ) < 0) && str.indexOf( '%' ) < 0 ) return str; StringBuffer dec = new StringBuffer(); // decoded string output int strPos = 0;...
56
0
public String[] getGroups() { UserDatabase database = (UserDatabase) this.resource; ArrayList<String> results = new ArrayList<String>(); Iterator<Group> groups = database.getGroups(); while (groups.hasNext()) { Group group = groups.next(); results.add(findGro...
57
0
public void testEntities() throws Exception { // use a binary file, so when it's loaded fail with XML eror: String file = getFile("mailing_lists.pdf").toURI().toASCIIString(); String xml = "<?xml version=\"1.0\"?>" + "<!DOCTYPE foo [" + // check that external entities are not resolve...
58
0
public void init(Map<String,Object> pluginConfig) { try { String delegationTokenEnabled = (String)pluginConfig.getOrDefault(DELEGATION_TOKEN_ENABLED_PROPERTY, "false"); authFilter = (Boolean.parseBoolean(delegationTokenEnabled)) ? new HadoopAuthFilter() : new AuthenticationFilter(); // Initiali...
59
0
public void testExceptionTransformer() { assertNotNull(TransformerUtils.exceptionTransformer()); assertSame(TransformerUtils.exceptionTransformer(), TransformerUtils.exceptionTransformer()); try { TransformerUtils.exceptionTransformer().transform(null); } catch (final Fun...
60
0
protected void process(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { ModuleUtils.getInstance().selectModule(request, getServletContext()); ModuleConfig config = getModuleConfig(request); RequestProcessor processor = getProcessorFor...
61
0
public void addRecipients(final ExtendedEmailPublisherContext context, EnvVars env, Set<InternetAddress> to, Set<InternetAddress> cc, Set<InternetAddress> bcc) { final class Debug implements RecipientProviderUtilities.IDebug { private final ExtendedEmailPublisherDescriptor descriptor ...
62
0
private static synchronized PyObject get_dis() { if (dis == null) { dis = __builtin__.__import__("dis"); } return dis; }
63
0
public void processAction(ActionRequest actionRequest, ActionResponse actionResponse) throws PortletException, IOException { String action = actionRequest.getParameter("action"); actionResponse.setRenderParameter("action", action); if (action.equals("showView")) { Str...
64
0
List<OrderDecorator> getFilters() { List<OrderDecorator> filters = new ArrayList<OrderDecorator>(); if (cpf != null) { filters.add(new OrderDecorator(cpf, CHANNEL_FILTER)); } if (concurrentSessionFilter != null) { filters.add(new OrderDecorator(concurrentSessionFilter, CONCURRENT_SESSION_FILTER));...
65
0
public void injectChaos(Random random) throws Exception { // sometimes we restart one of the jetty nodes if (random.nextBoolean()) { JettySolrRunner jetty = jettys.get(random.nextInt(jettys.size())); ChaosMonkey.stop(jetty); log.info("============ Restarting jetty"); ChaosMonkey.start...
66
0
public Permission getRequiredPermission() { return Jenkins.ADMINISTER; }
67
0
public Document getMetaData( HttpServletRequest request, FedizContext config ) throws ProcessingException { try { ByteArrayOutputStream bout = new ByteArrayOutputStream(4096); Writer streamWriter = new OutputStreamWriter(bout, "UTF-8"); XMLStreamWriter writer...
68
0
protected void configure(HttpSecurity http) throws Exception { // This config is also on UrlAuthorizationConfigurer javadoc http .apply(new UrlAuthorizationConfigurer<HttpSecurity>(getApplicationContext())).getRegistry() .antMatchers("/users**","/sessions/**").hasRole("USER") .antMatchers("/signup").has...
69
0
public void testInitializiationIsConsistent() { long clusterSeed = randomLong(); int minNumDataNodes = randomIntBetween(0, 9); int maxNumDataNodes = randomIntBetween(minNumDataNodes, 10); String clusterName = randomRealisticUnicodeOfCodepointLengthBetween(1, 10); SettingsSour...
70
0
public void testConfigureDownstreamProjectSecurity() throws Exception { jenkins.setSecurityRealm(new LegacySecurityRealm()); ProjectMatrixAuthorizationStrategy auth = new ProjectMatrixAuthorizationStrategy(); auth.add(Jenkins.READ, "alice"); jenkins.setAuthorizationStrategy(auth); ...
71
0
boolean isAllowJavaSerializedObject(); /** * The status codes which is considered a success response. The values are inclusive. The range must be defined as from-to with the dash included. * <p/> * The default range is <tt>200-299</tt> */
72
0
public void register(ContainerBuilder builder, LocatableProperties props) throws ConfigurationException { builder.factory(com.opensymphony.xwork2.ObjectFactory.class) .factory(ActionProxyFactory.class, DefaultActionProxyFactory.class, Scope.SINGLETON) .factory(Ob...
73
0
private String getIncompatiblePluginMessage(Object obj, Class<?> type) { return _loc.get("incompatible-plugin", new Object[]{ _name, obj == null ? null : obj.getClass().getName(), type == null ? null : type.getName() }).to...
74
0
public Properties defaultOutputProperties() { Properties properties = new Properties(); properties.put(OutputKeys.ENCODING, defaultCharset); properties.put(OutputKeys.OMIT_XML_DECLARATION, "yes"); return properties; } /** * Converts the given input Source into the requi...
75
0
public void run() { request.getCoyoteRequest().action(ActionCode.ASYNC_DISPATCHED, null); try { applicationDispatcher.dispatch(servletRequest, servletResponse); }catch (Exception x) { //log.error("Async.dispatch",x); throw new R...
76
0
private String getState(ServletRequest request) { if (request.getParameter(FederationConstants.PARAM_CONTEXT) != null) { return request.getParameter(FederationConstants.PARAM_CONTEXT); } else if (request.getParameter(SAMLSSOConstants.RELAY_STATE) != null) { return request.get...
77
0
private Settings nodeSettings() { return ImmutableSettings.builder() .put("node.add_id_to_custom_path", false) .put("node.enable_custom_paths", true) .put("gateway.type", "local") // don't delete things! .put(ThrottlingAllocationDecider.CLUSTER...
78
0
public void testExceptionFactory() { assertNotNull(FactoryUtils.exceptionFactory()); assertSame(FactoryUtils.exceptionFactory(), FactoryUtils.exceptionFactory()); try { FactoryUtils.exceptionFactory().create(); } catch (final FunctorException ex) { try { ...
79
0
public void setQuery( MessageBytes queryMB ) { this.queryMB=queryMB; }
80
0
private void signIn(String userName, String password) { webDriver.get(baseUrl + "/logout.do"); webDriver.get(baseUrl + "/login"); webDriver.findElement(By.name("username")).sendKeys(userName); webDriver.findElement(By.name("password")).sendKeys(password); webDriver.findElemen...
81
0
protected void embalmTarget() { if (!gotMethods && target.allowedMethods.isEmpty()) { target.allowedMethods.add(WILDCARD); } target.params = Collections.unmodifiableMap(target.params); target.results = Collections.unmodifiableMap(target.results); ...
82
0
public String getCommand() { return agentCommand; } /** * Gets the formatted current time stamp. */
83
0
protected final ApplicationContext getApplicationContext() { return this.context; } @Autowired
84
0
private Object readResolve() { this.remote = normalize(this.remote); return this; }
85
0
public void setMethodParam(String methodParam) { Assert.hasText(methodParam, "'methodParam' must not be empty"); this.methodParam = methodParam; } @Override
86
0
public void toCode(final List<String> lineList, final String requestID, final int indentSpaces, final boolean includeProcessing) { // Create the request variable. final ArrayList<ToCodeArgHelper> constructorArgs = new ArrayList<ToCodeArgHelper>(3); constructorArgs.add(ToCod...
87
0
public void process(Exchange exchange) throws Exception { // if we bridge endpoint then we need to skip matching headers with the HTTP_QUERY to avoid sending // duplicated headers to the receiver, so use this skipRequestHeaders as the list of headers to skip Map<String, Object> skipRequestHe...
88
0
public String getDisplayName() { return "Culprits"; } } }
89
0
private void verifyNoDescendantsWithLocalModifications(final String action) { for (final ProcessGroup descendant : findAllProcessGroups()) { final VersionControlInformation descendantVci = descendant.getVersionControlInformation(); if (descendantVci != null) { final V...
90
0
public String changePasswordPage() { return "change_password"; } @RequestMapping(value="/change_password.do", method = POST)
91
0
private void assertJoe(ScimUser joe) { assertNotNull(joe); assertEquals(JOE_ID, joe.getId()); assertEquals("Joe", joe.getGivenName()); assertEquals("User", joe.getFamilyName()); assertEquals("joe@joe.com", joe.getPrimaryEmail()); assertEquals("joe", joe.getUserName())...
92
0
public boolean getMapperDirectoryRedirectEnabled() { return mapperDirectoryRedirectEnabled; } @Override
93
0
void populateResponse(Exchange exchange, JettyContentExchange httpExchange) throws Exception; /** * Gets the header filter strategy * * @return the strategy */
94
0
public void testUtf8MalformedHarmony() { for (byte[] input : MALFORMED) { doHarmonyDecoder(input, true, -1); } }
95
0
public void zip_directory() throws IOException { File foo = FileUtils.toFile(getClass().getResource("/org/sonar/api/utils/ZipUtilsTest/shouldZipDirectory/foo.txt")); File dir = foo.getParentFile(); File zip = temp.newFile(); ZipUtils.zipDir(dir, zip); assertThat(zip).exists().isFile(); asser...
96
0
public void setShouldReset(boolean shouldReset) { m_shouldReset = shouldReset; } /** * A stack of current template modes. */
97
0
public static void initializeSamlUtils() { try { samlTestUtils.initializeSimple(); } catch (ConfigurationException e) { e.printStackTrace(); } } @Override
98
0
public void setAllowUnverifiedUsers(boolean allowUnverifiedUsers) { this.allowUnverifiedUsers = allowUnverifiedUsers; }
99
0
private static void verifyInsideTargetDirectory(ZipEntry entry, Path entryPath, Path targetDirPath) { if (!entryPath.normalize().startsWith(targetDirPath.normalize())) { // vulnerability - trying to create a file outside the target directory throw new IllegalStateException("Unzipping an entry outside ...