Unnamed: 0
int64
0
637
label
int64
0
1
code
stringlengths
24
8.83k
200
0
InstanceManager getInstanceManager() { return instanceManager; }
201
0
public void testSingletonPatternInSerialization() { final Object[] singletones = new Object[] { ExceptionTransformer.INSTANCE, NOPTransformer.INSTANCE, StringValueTransformer.stringValueTransformer(), }; for (final Object original : singletones) { TestUtils.assertSameAfterSerialization("Singleton pattern broken for " + original.getClass(), original); } }
202
0
public String getCipherSuite() throws IOException { // Look up the current SSLSession SSLSession session = ssl.getSession(); if (session == null) return null; return session.getCipherSuite(); }
203
0
public void processAction(ActionRequest actionRequest, ActionResponse actionResponse) throws PortletException, IOException { String action = actionRequest.getParameter("action"); actionResponse.setRenderParameter("action", action); if (action.equals("showView")) { String view_id = actionRequest.getParameter("view_id"); actionResponse.setRenderParameter("view_id", view_id); } else if (action.equals("showAllViews")) { // no parameters needed to be redirected to doView() } else if (action.equals("showAllServers")) { // no parameters needed to be redirected to doView() } else if (action.equals("showAllGraphs")) { // no parameters needed to be redirected to doView() } else if (action.equals("showEditView")) { String view_id = actionRequest.getParameter("view_id"); actionResponse.setRenderParameter("view_id", view_id); } else if (action.equals("saveEditView")) { updateView(actionRequest, actionResponse); } else if (action.equals("showAddView")) { // no parameters needed to be redirected to doView() } else if (action.equals("saveAddView")) { addView(actionRequest, actionResponse); } else if (action.equals("showAddGraph")) { String server_id = actionRequest.getParameter("server_id"); if (server_id != null) actionResponse.setRenderParameter("server_id", server_id); String mbean = actionRequest.getParameter("mbean"); if (mbean != null) actionResponse.setRenderParameter("mbean", mbean); String dataname = actionRequest.getParameter("dataname"); if (dataname != null) actionResponse.setRenderParameter("dataname", dataname); } else if (action.equals("saveAddGraph")) { addGraph(actionRequest, actionResponse); } else if (action.equals("showEditGraph")) { String graph_id = actionRequest.getParameter("graph_id"); actionResponse.setRenderParameter("graph_id", graph_id); } else if (action.equals("saveEditGraph")) { updateGraph(actionRequest, actionResponse); } else if (action.equals("deleteGraph")) { deleteGraph(actionRequest, actionResponse); } else if (action.equals("deleteView")) { deleteView(actionRequest, actionResponse); } else if (action.equals("showServer")) { String server_id = actionRequest.getParameter("server_id"); actionResponse.setRenderParameter("server_id", server_id); } else if (action.equals("showEditServer")) { String server_id = actionRequest.getParameter("server_id"); actionResponse.setRenderParameter("server_id", server_id); } else if (action.equals("saveEditServer")) { updateServer(actionRequest, actionResponse); } else if (action.equals("showAddServer")) { // no parameters needed to be redirected to doView() } else if (action.equals("deleteServer")) { deleteServer(actionRequest, actionResponse); } else if (action.equals("saveAddServer")) { addServer(actionRequest, actionResponse); } else if (action.equals("startTrackingMbean")) { String server_id = actionRequest.getParameter("server_id"); actionResponse.setRenderParameter("server_id", server_id); String mbean = actionRequest.getParameter("mbean"); actionResponse.setRenderParameter("mbean", mbean); } else if (action.equals("stopTrackingMbean")) { String server_id = actionRequest.getParameter("server_id"); actionResponse.setRenderParameter("server_id", server_id); String mbean = actionRequest.getParameter("mbean"); actionResponse.setRenderParameter("mbean", mbean); } else if (action.equals("stopThread") || action.equals("disableServerViewQuery")) { String server_id = actionRequest.getParameter("server_id"); stopThread(server_id, actionRequest); actionResponse.setRenderParameter("server_id", server_id); } else if (action.equals("startThread") || action.equals("enableServerViewQuery")) { String server_id = actionRequest.getParameter("server_id"); String snapshotDuration = actionRequest.getParameter("snapshotDuration"); startThread(server_id, new Long(snapshotDuration), actionRequest); actionResponse.setRenderParameter("server_id", server_id); actionResponse.setRenderParameter("snapshotDuration", snapshotDuration); } else if (action.equals("disableServer") || action.equals("disableEditServer")) { String server_id = actionRequest.getParameter("server_id"); actionResponse.setRenderParameter("server_id", server_id); alterServerState(server_id, false, actionRequest); } else if (action.equals("enableServer") || action.equals("enableEditServer")) { String server_id = actionRequest.getParameter("server_id"); alterServerState(server_id, true, actionRequest); actionResponse.setRenderParameter("server_id", server_id); } else if (action.equals("testAddServerConnection")) { String name = actionRequest.getParameter("name"); String ip = actionRequest.getParameter("ip"); String username = actionRequest.getParameter("username"); String password = actionRequest.getParameter("password"); String password2 = actionRequest.getParameter("password2"); Integer port = Integer.parseInt(actionRequest.getParameter("port")); String protocol = actionRequest.getParameter("protocol"); testConnection(ip, username, password, port, protocol, actionRequest); actionResponse.setRenderParameter("name", name); actionResponse.setRenderParameter("username", username); actionResponse.setRenderParameter("ip", ip); // Don't return the password in the output // actionResponse.setRenderParameter("password", password); // actionResponse.setRenderParameter("password2", password2); actionResponse.setRenderParameter("port", "" + port); actionResponse.setRenderParameter("protocol", protocol); } else if (action.equals("testEditServerConnection")) { String name = actionRequest.getParameter("name"); String ip = actionRequest.getParameter("ip"); String username = actionRequest.getParameter("username"); String password = actionRequest.getParameter("password"); String password2 = actionRequest.getParameter("password2"); String server_id = actionRequest.getParameter("server_id"); String snapshot = actionRequest.getParameter("snapshot"); String retention = actionRequest.getParameter("retention"); Integer port = Integer.parseInt(actionRequest.getParameter("port")); String protocol = actionRequest.getParameter("protocol"); if (snapshot == null) { snapshot = ""; } if (retention == null) { retention = ""; } testConnection(ip, username, password, port, protocol, actionRequest); actionResponse.setRenderParameter("name", name); actionResponse.setRenderParameter("username", username); actionResponse.setRenderParameter("ip", ip); // Don't return the password in the output // actionResponse.setRenderParameter("password", password); // actionResponse.setRenderParameter("password2", password2); actionResponse.setRenderParameter("snapshot", snapshot); actionResponse.setRenderParameter("server_id", server_id); actionResponse.setRenderParameter("retention", retention); actionResponse.setRenderParameter("port", "" + port); actionResponse.setRenderParameter("protocol", "" + protocol); } }
204
0
public void resetPassword_InvalidCodeData() { ExpiringCode expiringCode = new ExpiringCode("good_code", new Timestamp(System.currentTimeMillis() + UaaResetPasswordService.PASSWORD_RESET_LIFETIME), "user-id", null); when(codeStore.retrieveCode("good_code")).thenReturn(expiringCode); SecurityContext securityContext = mock(SecurityContext.class); when(securityContext.getAuthentication()).thenReturn(new MockAuthentication()); SecurityContextHolder.setContext(securityContext); try { emailResetPasswordService.resetPassword("good_code", "password"); fail(); } catch (InvalidCodeException e) { assertEquals("Sorry, your reset password link is no longer valid. Please request a new one", e.getMessage()); } } @Test
205
0
private void wipeRepositoryDirectories() { if (repoPath.exists()) { assertThat(repoPath.getAbsolutePath(), containsString(clusterName)); if (FileSystemUtils.deleteRecursively(repoPath)) { logger.info("Successfully wiped repository directory for node location: {}", repoPath); } else { logger.info("Failed to wipe data directory for node location: {}", repoPath); } } }
206
0
public void init(FilterConfig conf) throws ServletException { if (conf != null && "zookeeper".equals(conf.getInitParameter("signer.secret.provider"))) { SolrZkClient zkClient = (SolrZkClient)conf.getServletContext().getAttribute(DELEGATION_TOKEN_ZK_CLIENT); try { conf.getServletContext().setAttribute("signer.secret.provider.zookeeper.curator.client", getCuratorClient(zkClient)); } catch (KeeperException | InterruptedException e) { throw new ServletException(e); } } super.init(conf); } @Override
207
0
public boolean getMapperDirectoryRedirectEnabled() { return false; }
208
0
public static boolean isNewAuthenticationPathNeeded(long globalIndex, int xmssHeight, int layer) { if (globalIndex == 0) { return false; } return ((globalIndex + 1) % (long)Math.pow((1 << xmssHeight), layer) == 0) ? true : false; }
209
0
public final Set<Class<?>> getGroupList() { return constraintDescriptor.getGroups(); }
210
0
public void destroy() { }
211
0
protected Log getLog() { return log; } /** * SSL information. */
212
0
protected Processor<Long> createUpgradeProcessor( SocketWrapper<Long> socket, HttpUpgradeHandler httpUpgradeProcessor) throws IOException { return new AprProcessor(socket, httpUpgradeProcessor, (AprEndpoint) proto.endpoint); } } }
213
0
private Object readResolve() { Jenkins.getInstance().checkPermission(Jenkins.RUN_SCRIPTS); return this; }
214
0
public String getDisplayName() { return "Requestor"; } } }
215
0
public OutputStream createOutput(String blobName) throws IOException { maybeIOExceptionOrBlock(blobName); return super.createOutput(blobName); } } } }
216
0
public void run() { } }; /** * Creates a new instance * @param objectPostProcessor the {@link ObjectPostProcessor} to use * @see WebSecurityConfiguration */
217
0
void toHtml() throws IOException { writeBackAndRefreshLinks(); writeln("<br/>"); assert sessionsInformations != null; if (sessionsInformations.isEmpty()) { writeln("#Aucune_session#"); return; } writeTitle("system-users.png", getString("Sessions")); writeSessions(sessionsInformations); long totalSerializedSize = 0; int nbSerializableSessions = 0; for (final SessionInformations sessionInformations : sessionsInformations) { final int size = sessionInformations.getSerializedSize(); if (size >= 0) { totalSerializedSize += size; nbSerializableSessions++; } } final long meanSerializedSize; if (nbSerializableSessions > 0) { meanSerializedSize = totalSerializedSize / nbSerializableSessions; } else { meanSerializedSize = -1; } writeln("<div align='right'>" + getFormattedString("nb_sessions", sessionsInformations.size()) + "<br/><br/>" + getFormattedString("taille_moyenne_sessions", meanSerializedSize) + "</div>"); }
218
0
public boolean allowsSignup() { return !disableSignup; } /** * Checks if captcha is enabled on user signup. * * @return true if captcha is enabled on signup. */
219
0
public static String stripExpressionIfAltSyntax(ValueStack stack, String expr) { if (altSyntax(stack)) { // does the expression start with %{ and end with }? if so, just cut it off! if (isExpression(expr)) { return expr.substring(2, expr.length() - 1); } } return expr; } /** * Is the altSyntax enabled? [TRUE] * * @param stack the ValueStack where the context value is searched for. * @return true if altSyntax is activated. False otherwise. * See <code>struts.properties</code> where the altSyntax flag is defined. */
220
0
private void processServletSecurityAnnotation(Servlet servlet) { // Calling this twice isn't harmful so no syncs servletSecurityAnnotationScanRequired = false; ServletSecurity secAnnotation = servlet.getClass().getAnnotation(ServletSecurity.class); Context ctxt = (Context) getParent(); if (secAnnotation != null) { ctxt.addServletSecurity( new ApplicationServletRegistration(this, ctxt), new ServletSecurityElement(secAnnotation)); } }
221
0
public long getBytesWritten() { return bytesWritten; } } }
222
0
private void doRedirectTest(String path, int expected) throws IOException { ByteChunk bc = new ByteChunk(); int rc = getUrl("http://localhost:" + getPort() + path, bc, null); Assert.assertEquals(expected, rc); } /** * Prepare a string to search in messages that contain a timestamp, when it * is known that the timestamp was printed between {@code timeA} and * {@code timeB}. */
223
0
public void testEntityExpansionWReq2() throws Exception { String url = "https://localhost:" + getIdpHttpsPort() + "/fediz-idp/federation?"; url += "wa=wsignin1.0"; url += "&whr=urn:org:apache:cxf:fediz:idp:realm-A"; url += "&wtrealm=urn:org:apache:cxf:fediz:fedizhelloworld"; String wreply = "https://localhost:" + getRpHttpsPort() + "/" + getServletContextName() + "/secure/fedservlet"; url += "&wreply=" + wreply; InputStream is = this.getClass().getClassLoader().getResource("entity_wreq2.xml").openStream(); String entity = IOUtils.toString(is, "UTF-8"); is.close(); String validWreq = "<RequestSecurityToken xmlns=\"http://docs.oasis-open.org/ws-sx/ws-trust/200512\">" + "<TokenType>&m;http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV2.0</TokenType>" + "</RequestSecurityToken>"; url += "&wreq=" + URLEncoder.encode(entity + validWreq, "UTF-8"); String user = "alice"; String password = "ecila"; final WebClient webClient = new WebClient(); webClient.getOptions().setUseInsecureSSL(true); webClient.getCredentialsProvider().setCredentials( new AuthScope("localhost", Integer.parseInt(getIdpHttpsPort())), new UsernamePasswordCredentials(user, password)); webClient.getOptions().setJavaScriptEnabled(false); try { webClient.getPage(url); Assert.fail("Failure expected on a bad wreq value"); } catch (FailingHttpStatusCodeException ex) { Assert.assertEquals(ex.getStatusCode(), 400); } webClient.close(); } // Send an malformed wreq value @org.junit.Test
224
0
Class<?> convertGroup(Class<?> originalGroup); /** * Returns a set with {@link GroupConversionDescriptor}s representing the * group conversions of this cascadable. * * @return A set with group conversion descriptors. May be empty, but never * {@code null}. */
225
0
public static File checkSlip(File parentFile, File file) throws IllegalArgumentException { String parentCanonicalPath; String canonicalPath; try { parentCanonicalPath = parentFile.getCanonicalPath(); canonicalPath = file.getCanonicalPath(); } catch (IOException e) { throw new IORuntimeException(e); } if (false == canonicalPath.startsWith(parentCanonicalPath)) { throw new IllegalArgumentException("New file is outside of the parent dir: " + file.getName()); } return file; }
226
0
public ExitCode runWithoutHelp(CommandRunnerParams params) throws IOException, InterruptedException { if (saveFilename != null && loadFilename != null) { params.getConsole().printErrorText("Can't use both --load and --save"); return ExitCode.COMMANDLINE_ERROR; } if (saveFilename != null) { invalidateChanges(params); RemoteDaemonicParserState state = params.getParser().storeParserState(params.getCell()); try (FileOutputStream fos = new FileOutputStream(saveFilename); ZipOutputStream zipos = new ZipOutputStream(fos)) { zipos.putNextEntry(new ZipEntry("parser_data")); try (ObjectOutputStream oos = new ObjectOutputStream(zipos)) { oos.writeObject(state); } } } else if (loadFilename != null) { try (FileInputStream fis = new FileInputStream(loadFilename); ZipInputStream zipis = new ZipInputStream(fis)) { ZipEntry entry = zipis.getNextEntry(); Preconditions.checkState(entry.getName().equals("parser_data")); try (ObjectInputStream ois = new ParserStateObjectInputStream(zipis)) { RemoteDaemonicParserState state; try { state = (RemoteDaemonicParserState) ois.readObject(); } catch (ClassNotFoundException e) { params.getConsole().printErrorText("Invalid file format"); return ExitCode.COMMANDLINE_ERROR; } params.getParser().restoreParserState(state, params.getCell()); } } invalidateChanges(params); ParserConfig configView = params.getBuckConfig().getView(ParserConfig.class); if (configView.isParserCacheMutationWarningEnabled()) { params .getConsole() .printErrorText( params .getConsole() .getAnsi() .asWarningText( "WARNING: Buck injected a parser state that may not match the local state.")); } } return ExitCode.SUCCESS; }
227
0
private boolean isPropertyConfigured(TrustedIdp trustedIdp, String property, boolean defaultValue) { Map<String, String> parameters = trustedIdp.getParameters(); if (parameters != null && parameters.containsKey(property)) { return Boolean.parseBoolean(parameters.get(property)); } return defaultValue; }
228
0
public void testHandleNeverSendAResponse() throws Exception { final AuthenticationResult firstResult = _negotiator.handleResponse(new byte[0]); assertEquals("Unexpected authentication status", AuthenticationResult.AuthenticationStatus.CONTINUE, firstResult.getStatus()); assertArrayEquals("Unexpected authentication challenge", new byte[0], firstResult.getChallenge()); final AuthenticationResult secondResult = _negotiator.handleResponse(new byte[0]); assertEquals("Unexpected first authentication result", AuthenticationResult.AuthenticationStatus.ERROR, secondResult.getStatus()); }
229
0
public Collection<FileAnnotation> parse(final InputStream file, final String moduleName) throws InvocationTargetException { try { SecureDigester digester = new SecureDigester(LintParser.class); List<LintIssue> issues = new ArrayList<LintIssue>(); digester.push(issues); String issueXPath = "issues/issue"; digester.addObjectCreate(issueXPath, LintIssue.class); digester.addSetProperties(issueXPath); digester.addSetNext(issueXPath, "add"); String locationXPath = issueXPath + "/location"; digester.addObjectCreate(locationXPath, Location.class); digester.addSetProperties(locationXPath); digester.addSetNext(locationXPath, "addLocation", Location.class.getName()); digester.parse(file); return convert(issues, moduleName); } catch (IOException | SAXException exception) { throw new InvocationTargetException(exception); } } /** * Converts the Lint object structure to that of the analysis-core API. * * @param issues The parsed Lint issues. * @param moduleName Name of the maven module, if any. * @return A collection of the discovered issues. */
230
0
private static void zip(File file, String srcRootDir, ZipOutputStream out) throws UtilException { if (file == null) { return; } final String subPath = FileUtil.subPath(srcRootDir, file); // 获取文件相对于压缩文件夹根目录的子路径 if (file.isDirectory()) {// 如果是目录,则压缩压缩目录中的文件或子目录 final File[] files = file.listFiles(); if (ArrayUtil.isEmpty(files) && StrUtil.isNotEmpty(subPath)) { // 加入目录,只有空目录时才加入目录,非空时会在创建文件时自动添加父级目录 addDir(subPath, out); } // 压缩目录下的子文件或目录 for (File childFile : files) { zip(childFile, srcRootDir, out); } } else {// 如果是文件或其它符号,则直接压缩该文件 addFile(file, subPath, out); } } /** * 添加文件到压缩包 * * @param file 需要压缩的文件 * @param path 在压缩文件中的路径 * @param out 压缩文件存储对象 * @throws UtilException IO异常 * @since 4.0.5 */
231
0
public void initResetPasswordTest() throws Exception { codeStore = getWebApplicationContext().getBean(ExpiringCodeStore.class); } @Test
232
0
public final <T> Set<ConstraintViolation<T>> validate(T object, Class<?>... groups) { Contracts.assertNotNull( object, MESSAGES.validatedObjectMustNotBeNull() ); if ( !beanMetaDataManager.isConstrained( object.getClass() ) ) { return Collections.emptySet(); } ValidationOrder validationOrder = determineGroupValidationOrder( groups ); ValidationContext<T> validationContext = getValidationContext().forValidate( object ); ValueContext<?, Object> valueContext = ValueContext.getLocalExecutionContext( object, beanMetaDataManager.getBeanMetaData( object.getClass() ), PathImpl.createRootPath() ); return validateInContext( valueContext, validationContext, validationOrder ); } @Override
233
0
public String getAlgorithm() { return "XMSS"; }
234
0
public ProcessGroup getParent() { return parent.get(); }
235
0
private void checkAdmin() { final Jenkins jenkins = Jenkins.getInstance(); //Hoping this method doesn't change meaning again if (jenkins != null) { //If Jenkins is not alive then we are not started, so no unauthorised user might do anything jenkins.checkPermission(Jenkins.ADMINISTER); } } /** * Check whether the list of servers contains a GerritServer object of a specific name. * * @param serverName to check. * @return whether the list contains a server with the given name. */
236
0
public int available() throws IOException { if (max >= 0 && pos >= max) { return 0; } return in.available(); } } }
237
0
public static void addNamespacePrefix(Element element, String namespaceUri, String prefix) { element.setAttributeNS(XMLConstants.XMLNS_ATTRIBUTE_NS_URI, "xmlns:" + prefix, namespaceUri); }
238
0
public boolean contains(Artifact artifact) { // Note: getLocation(artifact) does an artifact.isResolved() check - no need to do it here. File location = getLocation(artifact); return location.canRead() && (location.isFile() || new File(location, "META-INF").isDirectory()); }
239
0
public String getTestString() { return testString; } @Override
240
0
public void removeUser(String username) { UserDatabase database = (UserDatabase) this.resource; User user = database.findUser(username); if (user == null) { return; } try { MBeanUtils.destroyMBean(user); database.removeUser(user); } catch (Exception e) { IllegalArgumentException iae = new IllegalArgumentException ("Exception destroying user [" + username + "] MBean"); iae.initCause(e); throw iae; } }
241
0
public T transform(final T input) { if (input == null) { return null; } return PrototypeFactory.prototypeFactory(input).create(); }
242
0
public void execute(FunctionContext context) { Object[] arguments = (Object[]) context.getArguments(); String regionName = (String) arguments[0]; Set<String> keys = (Set<String>) arguments[1]; if (this.cache.getLogger().fineEnabled()) { StringBuilder builder = new StringBuilder(); builder.append("Function ").append(ID).append(" received request to touch ") .append(regionName).append("->").append(keys); this.cache.getLogger().fine(builder.toString()); } // Retrieve the appropriate Region and value to update the lastAccessedTime Region region = this.cache.getRegion(regionName); if (region != null) { region.getAll(keys); } // Return result to get around NPE in LocalResultCollectorImpl context.getResultSender().lastResult(true); } @Override
243
0
protected void engineInitVerify( PublicKey publicKey) throws InvalidKeyException { CipherParameters param = DSAUtil.generatePublicKeyParameter(publicKey); digest.reset(); signer.init(false, param); }
244
0
public void testSave() throws IOException, InterruptedException, ReactorException { FreeStyleProject p = j.createFreeStyleProject("project"); p.disabled = true; p.nextBuildNumber = 5; p.description = "description"; p.save(); j.jenkins.reload(); assertEquals("All persistent data should be saved.", "description", p.description); assertEquals("All persistent data should be saved.", 5, p.nextBuildNumber); assertEquals("All persistent data should be saved", true, p.disabled); } @Test
245
0
private static void deflater(InputStream in, OutputStream out, int level) { final DeflaterOutputStream ios = (out instanceof DeflaterOutputStream) ? (DeflaterOutputStream) out : new DeflaterOutputStream(out, new Deflater(level, true)); IoUtil.copy(in, ios); } // ---------------------------------------------------------------------------------------------- Private method end
246
0
protected CoderResult decodeLoop(ByteBuffer in, CharBuffer out) { if (in.hasArray() && out.hasArray()) { return decodeHasArray(in, out); } return decodeNotHasArray(in, out); }
247
0
public static <I, O> Transformer<I, O> invokerTransformer(final String methodName, final Class<?>[] paramTypes, final Object[] args) { if (methodName == null) { throw new NullPointerException("The method to invoke must not be null"); } if (((paramTypes == null) && (args != null)) || ((paramTypes != null) && (args == null)) || ((paramTypes != null) && (args != null) && (paramTypes.length != args.length))) { throw new IllegalArgumentException("The parameter types must match the arguments"); } if (paramTypes == null || paramTypes.length == 0) { return new InvokerTransformer<I, O>(methodName); } return new InvokerTransformer<I, O>(methodName, paramTypes, args); } /** * Constructor for no arg instance. * * @param methodName the method to call */
248
0
private void checkError() throws IOException { if (error) { throw new IOException(sm.getString("chunkedInputFilter.error")); } }
249
0
public final BootstrapConfiguration parseValidationXml() { InputStream inputStream = getInputStream(); if ( inputStream == null ) { return BootstrapConfigurationImpl.getDefaultBootstrapConfiguration(); } try { String schemaVersion = xmlParserHelper.getSchemaVersion( VALIDATION_XML_FILE, inputStream ); Schema schema = getSchema( schemaVersion ); ValidationConfigType validationConfig = unmarshal( inputStream, schema ); return createBootstrapConfiguration( validationConfig ); } finally { closeStream( inputStream ); } }
250
0
public ExpressionInterceptUrlRegistry getRegistry() { return REGISTRY; }
251
0
public Settings settings() { return this.settings; } /** * The home of the installation. */
252
0
public void testPrivateKeyParsingSHA256() throws Exception { XMSSMTParameters params = new XMSSMTParameters(20, 10, new SHA256Digest()); XMSSMT mt = new XMSSMT(params, new SecureRandom()); mt.generateKeys(); byte[] privateKey = mt.exportPrivateKey(); byte[] publicKey = mt.exportPublicKey(); mt.importState(privateKey, publicKey); assertTrue(Arrays.areEqual(privateKey, mt.exportPrivateKey())); }
253
0
public void destroy() { if (log.isDebugEnabled()) { log.debug(internal.getMessage("finalizing")); } destroyModules(); destroyInternal(); getServletContext().removeAttribute(Globals.ACTION_SERVLET_KEY); // Release our LogFactory and Log instances (if any) ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); if (classLoader == null) { classLoader = ActionServlet.class.getClassLoader(); } try { LogFactory.release(classLoader); } catch (Throwable t) { ; // Servlet container doesn't have the latest version ; // of commons-logging-api.jar installed // :FIXME: Why is this dependent on the container's version of commons-logging? // Shouldn't this depend on the version packaged with Struts? /* Reason: LogFactory.release(classLoader); was added as an attempt to investigate the OutOfMemory error reported on Bugzilla #14042. It was committed for version 1.136 by craigmcc */ } PropertyUtils.clearDescriptors(); } /** * <p>Initialize this servlet. Most of the processing has been factored into * support methods so that you can override particular functionality at a * fairly granular level.</p> * * @exception ServletException if we cannot configure ourselves correctly */
254
0
private void loadOtherTesseractConfig(Properties properties) { for (String k : properties.stringPropertyNames()) { if (k.contains("_")) { addOtherTesseractConfig(k, properties.getProperty(k)); } } }
255
0
public static <T> Transformer<Class<? extends T>, T> instantiateTransformer(final Class<?>[] paramTypes, final Object[] args) { if (((paramTypes == null) && (args != null)) || ((paramTypes != null) && (args == null)) || ((paramTypes != null) && (args != null) && (paramTypes.length != args.length))) { throw new IllegalArgumentException("Parameter types must match the arguments"); } if (paramTypes == null || paramTypes.length == 0) { return new InstantiateTransformer<T>(); } return new InstantiateTransformer<T>(paramTypes, args); } /** * Constructor for no arg instance. */
256
0
String hash(String plaintext, String salt, int iterations) throws EncryptionException; /** * Encrypts the provided plaintext bytes using the cipher transformation * specified by the property <code>Encryptor.CipherTransformation</code> * and the <i>master encryption key</i> as specified by the property * {@code Encryptor.MasterKey} as defined in the <code>ESAPI.properties</code> file. * </p> * * @param plaintext The {@code PlainText} to be encrypted. * @return the {@code CipherText} object from which the raw ciphertext, the * IV, the cipher transformation, and many other aspects about * the encryption detail may be extracted. * @throws EncryptionException Thrown if something should go wrong such as * the JCE provider cannot be found, the cipher algorithm, * cipher mode, or padding scheme not being supported, specifying * an unsupported key size, specifying an IV of incorrect length, * etc. * @see #encrypt(SecretKey, PlainText) * @since 2.0 */
257
0
public HandshakeResponse getHandshakeResponse() { return handshakeResponse; } } }
258
0
public void handleDialog(ActionRequest req, ActionResponse resp) throws IOException, PortletException { List<String> lines = new ArrayList<String>(); req.getPortletSession().setAttribute("lines", lines); lines.add("handling dialog"); StringBuilder txt = new StringBuilder(128); String clr = req.getActionParameters().getValue("color"); txt.append("Color: ").append(clr); lines.add(txt.toString()); LOGGER.fine(txt.toString()); resp.getRenderParameters().setValue("color", clr); txt.setLength(0); Part part = null; try { part = req.getPart("file"); } catch (Throwable t) {} if ((part != null) && (part.getSubmittedFileName() != null) && (part.getSubmittedFileName().length() > 0)) { txt.append("Uploaded file name: ").append(part.getSubmittedFileName()); txt.append(", part name: ").append(part.getName()); txt.append(", size: ").append(part.getSize()); txt.append(", content type: ").append(part.getContentType()); lines.add(txt.toString()); LOGGER.fine(txt.toString()); txt.setLength(0); txt.append("Headers: "); String sep = ""; for (String hdrname : part.getHeaderNames()) { txt.append(sep).append(hdrname).append("=").append(part.getHeaders(hdrname)); sep = ", "; } lines.add(txt.toString()); LOGGER.fine(txt.toString()); // Store the file in a temporary location in the webapp where it can be served. // Note that this is, in general, not what you want to do in production, as // there can be problems serving the resource. Did it this way for a // quick solution that doesn't require additional Tomcat configuration. try { String fn = part.getSubmittedFileName(); File img = getFile(fn); if (img.exists()) { lines.add("deleting existing temp file: " + img.getCanonicalPath()); img.delete(); } InputStream is = part.getInputStream(); Files.copy(is, img.toPath(), StandardCopyOption.REPLACE_EXISTING); resp.getRenderParameters().setValue("fn", fn); resp.getRenderParameters().setValue("ct", part.getContentType()); } catch (Exception e) { lines.add("Exception doing I/O: " + e.toString()); txt.setLength(0); txt.append("Problem getting temp file: " + e.getMessage() + "\n"); StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); e.printStackTrace(pw); pw.flush(); txt.append(sw.toString()); LOGGER.warning(txt.toString()); } } else { lines.add("file part was null"); } } @RenderMethod(portletNames = "MultipartPortlet")
259
0
public void configure() throws Exception { from("direct:start1") .to("xslt:org/apache/camel/component/xslt/transform_dtd.xsl") .to("mock:result"); from("direct:start2") .to("xslt:org/apache/camel/component/xslt/transform_dtd.xsl?allowStAX=false") .to("mock:result"); } }; } }
260
0
XSLTElementDef getElemDef() { return m_elemDef; } /** * Set the element definition that belongs to this element. * * @param def The element definition object that produced and constrains this element. */
261
0
public String getMethod() { return this.method; } } }
262
0
public Result isAllowed(String principalId) { LockoutPolicy lockoutPolicy = lockoutPolicyRetriever.getLockoutPolicy(); long eventsAfter = timeService.getCurrentTimeMillis() - lockoutPolicy.getCountFailuresWithin() * 1000; List<AuditEvent> events = auditService.find(principalId, eventsAfter); final int failureCount = sequentialFailureCount(events); if (failureCount >= lockoutPolicy.getLockoutAfterFailures()) { // Check whether time of most recent failure is within the lockout period AuditEvent lastFailure = mostRecentFailure(events); if (lastFailure != null && lastFailure.getTime() > timeService.getCurrentTimeMillis() - lockoutPolicy.getLockoutPeriodSeconds() * 1000) { return new Result(false, failureCount); } } return new Result(true, failureCount); } /** * Counts the number of failures that occurred without an intervening * successful login. */
263
0
public OpenIDLoginConfigurer<HttpSecurity> openidLogin() throws Exception { return getOrApply(new OpenIDLoginConfigurer<HttpSecurity>()); } /** * Adds the Security headers to the response. This is activated by default when using * {@link WebSecurityConfigurerAdapter}'s default constructor. Accepting the * default provided by {@link WebSecurityConfigurerAdapter} or only invoking * {@link #headers()} without invoking additional methods on it, is the equivalent of: * * <pre> * &#064;Configuration * &#064;EnableWebSecurity * public class CsrfSecurityConfig extends WebSecurityConfigurerAdapter { * * &#064;Override * protected void configure(HttpSecurity http) throws Exception { * http * .headers() * .contentTypeOptions() * .and() * .xssProtection() * .and() * .cacheControl() * .and() * .httpStrictTransportSecurity() * .and() * .frameOptions() * .and() * ...; * } * } * </pre> * * You can disable the headers using the following: * * <pre> * &#064;Configuration * &#064;EnableWebSecurity * public class CsrfSecurityConfig extends WebSecurityConfigurerAdapter { * * &#064;Override * protected void configure(HttpSecurity http) throws Exception { * http * .headers().disable() * ...; * } * } * </pre> * * You can enable only a few of the headers by first invoking * {@link HeadersConfigurer#defaultsDisabled()} * and then invoking the appropriate methods on the {@link #headers()} result. * For example, the following will enable {@link HeadersConfigurer#cacheControl()} and * {@link HeadersConfigurer#frameOptions()} only. * * <pre> * &#064;Configuration * &#064;EnableWebSecurity * public class CsrfSecurityConfig extends WebSecurityConfigurerAdapter { * * &#064;Override * protected void configure(HttpSecurity http) throws Exception { * http * .headers() * .defaultsDisabled() * .cacheControl() * .and() * .frameOptions() * .and() * ...; * } * } * </pre> * * You can also choose to keep the defaults but explicitly disable a subset of headers. * For example, the following will enable all the default headers except * {@link HeadersConfigurer#frameOptions()}. * * <pre> * &#064;Configuration * &#064;EnableWebSecurity * public class CsrfSecurityConfig extends WebSecurityConfigurerAdapter { * * &#064;Override * protected void configure(HttpSecurity http) throws Exception { * http * .headers() * .frameOptions() * .disable() * .and() * ...; * } * } * </pre> * * @return * @throws Exception * @see HeadersConfigurer */
264
0
public String toString() { return name; } } }
265
0
protected void validateOrderBy(String orderBy) throws IllegalArgumentException { super.validateOrderBy(orderBy, EXTERNAL_GROUP_MAPPING_FIELDS); }
266
0
public Object createObject(Attributes attributes) { String username = attributes.getValue("username"); if (username == null) { username = attributes.getValue("name"); } String password = attributes.getValue("password"); String fullName = attributes.getValue("fullName"); if (fullName == null) { fullName = attributes.getValue("fullname"); } String groups = attributes.getValue("groups"); String roles = attributes.getValue("roles"); User user = database.createUser(username, password, fullName); if (groups != null) { while (groups.length() > 0) { String groupname = null; int comma = groups.indexOf(','); if (comma >= 0) { groupname = groups.substring(0, comma).trim(); groups = groups.substring(comma + 1); } else { groupname = groups.trim(); groups = ""; } if (groupname.length() > 0) { Group group = database.findGroup(groupname); if (group == null) { group = database.createGroup(groupname, null); } user.addGroup(group); } } } if (roles != null) { while (roles.length() > 0) { String rolename = null; int comma = roles.indexOf(','); if (comma >= 0) { rolename = roles.substring(0, comma).trim(); roles = roles.substring(comma + 1); } else { rolename = roles.trim(); roles = ""; } if (rolename.length() > 0) { Role role = database.findRole(rolename); if (role == null) { role = database.createRole(rolename, null); } user.addRole(role); } } } return (user); }
267
0
public void testSendingStringMessage() throws Exception { sendEntityMessage(MESSAGE); }
268
0
public InputSource resolveEntity(String name, String publicId, String baseURI, String systemId) throws SAXException, IOException { throw new SAXException(sm.getString("defaultServlet.blockExternalEntity2", name, publicId, baseURI, systemId)); } } }
269
0
public static void init(TikaConfig config, DigestingParser.Digester digestr, InputStreamFactory iSF) { tikaConfig = config; digester = digestr; inputStreamFactory = iSF; } static {
270
0
public void process(Exchange exchange) throws Exception {
271
0
public boolean createDB(String dbName, PortletRequest request) { // ensure there are no illegal chars in DB name InputUtils.validateSafeInput(dbName); Connection conn = null; try { conn = DerbyConnectionUtil.getDerbyConnection(dbName, DerbyConnectionUtil.CREATE_DB_PROP); portlet.addInfoMessage(request, portlet.getLocalizedString(request, "sysdb.infoMsg01", dbName)); return true; } catch (Throwable e) { portlet.addErrorMessage(request, portlet.getLocalizedString(request, "sysdb.errorMsg01"), e.getMessage()); return false; } finally { // close DB connection try { if (conn != null) { conn.close(); } } catch (SQLException e) { portlet.addErrorMessage(request, portlet.getLocalizedString(request, "sysdb.errorMsg02"), e.getMessage()); } } }
272
0
public Member getCascadingMember() { return cascadingMember; } @Override
273
0
protected void finalize() throws Throwable { super.finalize(); dispose(); }
274
0
protected void handleClob(String tableName, String fieldName, int rowNum, ResultSet resultSet, int columnIndex, ContentHandler handler, ParseContext context) throws SQLException, IOException, SAXException { //no-op for now. } @Override
275
0
public void testNoConfig() throws Exception { TesseractOCRConfig config = new TesseractOCRConfig(); assertEquals("Invalid default tesseractPath value", "", config.getTesseractPath()); assertEquals("Invalid default tessdataPath value", "", config.getTessdataPath()); assertEquals("Invalid default language value", "eng", config.getLanguage()); assertEquals("Invalid default pageSegMode value", "1", config.getPageSegMode()); assertEquals("Invalid default minFileSizeToOcr value", 0, config.getMinFileSizeToOcr()); assertEquals("Invalid default maxFileSizeToOcr value", Integer.MAX_VALUE, config.getMaxFileSizeToOcr()); assertEquals("Invalid default timeout value", 120, config.getTimeout()); assertEquals("Invalid default ImageMagickPath value", "", config.getImageMagickPath()); assertEquals("Invalid default density value", 300 , config.getDensity()); assertEquals("Invalid default depth value", 4 , config.getDepth()); assertEquals("Invalid default colorpsace value", "gray" , config.getColorspace()); assertEquals("Invalid default filter value", "triangle" , config.getFilter()); assertEquals("Invalid default resize value", 900 , config.getResize()); assertEquals("Invalid default applyRotation value", false, config.getApplyRotation()); } @Test
276
0
public void onCreateSSLEngine(SSLEngine engine) { if (proto.npnHandler != null) { proto.npnHandler.onCreateEngine(engine); } } } }
277
0
public C mvcMatchers(HttpMethod method, String... mvcPatterns) { HandlerMappingIntrospector introspector = new HandlerMappingIntrospector( this.context); List<RequestMatcher> matchers = new ArrayList<RequestMatcher>(mvcPatterns.length); for (String mvcPattern : mvcPatterns) { MvcRequestMatcher matcher = new MvcRequestMatcher(introspector, mvcPattern); if (method != null) { matcher.setMethod(method); } matchers.add(matcher); } return chainRequestMatchers(matchers); } /** * Maps a {@link List} of * {@link org.springframework.security.web.util.matcher.RegexRequestMatcher} * instances. * * @param method the {@link HttpMethod} to use or {@code null} for any * {@link HttpMethod}. * @param regexPatterns the regular expressions to create * {@link org.springframework.security.web.util.matcher.RegexRequestMatcher} from * * @return the object that is chained after creating the {@link RequestMatcher} */
278
0
public DateTime getSessionNotOnOrAfter() { return sessionNotOnOrAfter; }
279
0
public String getAlgorithm() { return "XMSSMT"; }
280
0
public void setDynamicAttribute(String uri, String localName, Object value) throws JspException { if (ComponentUtils.altSyntax(getStack()) && ComponentUtils.isExpression(value.toString())) { dynamicAttributes.put(localName, String.valueOf(ObjectUtils.defaultIfNull(findValue(value.toString()), value))); } else { dynamicAttributes.put(localName, value); } }
281
0
public String getDisplayName() { return "Suspects Causing Unit Tests to Begin Failing"; } } }
282
0
public MessageBytes newInstance() { return new MessageBytes(); } } }
283
0
public static void main(String[] args) { new RunSQLHelper().runSQL("derbyDB4", "create table derbyTbl1(num int, addr varchar(40));" + "create table derbyTbl2(num int, addr varchar(40));" + "create table derbyTbl3(num int, addr varchar(40));" + "insert into derb", false); }
284
0
public static VersionNumber getVersion() { try { return new VersionNumber(VERSION); } catch (NumberFormatException e) { try { // for non-released version of Hudson, this looks like "1.345 (private-foobar), so try to approximate. int idx = VERSION.indexOf(' '); if (idx>0) return new VersionNumber(VERSION.substring(0,idx)); } catch (NumberFormatException _) { // fall through } // totally unparseable return null; } catch (IllegalArgumentException e) { // totally unparseable return null; } } /** * Hash of {@link #VERSION}. */
285
0
public void testUnsafeRedirectActionPrefix() throws Exception { Map parameterMap = new HashMap(); parameterMap.put("redirectAction:" + "%{3*4}", ""); StrutsMockHttpServletRequest request = new StrutsMockHttpServletRequest(); request.setupGetServletPath("/someServletPath.action"); request.setParameterMap(parameterMap); DefaultActionMapper defaultActionMapper = new DefaultActionMapper(); defaultActionMapper.setContainer(container); ActionMapping actionMapping = defaultActionMapper.getMapping(request, configManager); StrutsResultSupport result = (StrutsResultSupport) actionMapping.getResult(); assertNull(result); }
286
0
public void testBeforeTest() throws IOException { long clusterSeed = randomLong(); int minNumDataNodes = randomIntBetween(0, 3); int maxNumDataNodes = randomIntBetween(minNumDataNodes, 4); final String clusterName = clusterName("shared", Integer.toString(CHILD_JVM_ID), clusterSeed); String clusterName1 = clusterName("shared", Integer.toString(CHILD_JVM_ID), clusterSeed); while (clusterName.equals(clusterName1)) { clusterName1 = clusterName("shared", Integer.toString(CHILD_JVM_ID), clusterSeed); // spin until the time changes } SettingsSource settingsSource = SettingsSource.EMPTY; int numClientNodes = randomIntBetween(0, 2); boolean enableRandomBenchNodes = randomBoolean(); boolean enableHttpPipelining = randomBoolean(); int jvmOrdinal = randomIntBetween(0, 10); String nodePrefix = "foobar"; InternalTestCluster cluster0 = new InternalTestCluster(clusterSeed, minNumDataNodes, maxNumDataNodes, clusterName, settingsSource, numClientNodes, enableHttpPipelining, jvmOrdinal, nodePrefix); InternalTestCluster cluster1 = new InternalTestCluster(clusterSeed, minNumDataNodes, maxNumDataNodes, clusterName1, settingsSource, numClientNodes, enableHttpPipelining, jvmOrdinal, nodePrefix); assertClusters(cluster0, cluster1, false); long seed = randomLong(); try { { Random random = new Random(seed); cluster0.beforeTest(random, random.nextDouble()); } { Random random = new Random(seed); cluster1.beforeTest(random, random.nextDouble()); } assertArrayEquals(cluster0.getNodeNames(), cluster1.getNodeNames()); Iterator<Client> iterator1 = cluster1.iterator(); for (Client client : cluster0) { assertTrue(iterator1.hasNext()); Client other = iterator1.next(); assertSettings(client.settings(), other.settings(), false); } assertArrayEquals(cluster0.getNodeNames(), cluster1.getNodeNames()); cluster0.afterTest(); cluster1.afterTest(); } finally { IOUtils.close(cluster0, cluster1); } }
287
0
private String extractFullContextPath(HttpServletRequest request) throws MalformedURLException { String result = null; String contextPath = request.getContextPath(); String requestUrl = request.getRequestURL().toString(); String requestPath = new URL(requestUrl).getPath(); // Cut request path of request url and add context path if not ROOT if (requestPath != null && requestPath.length() > 0) { int lastIndex = requestUrl.lastIndexOf(requestPath); result = requestUrl.substring(0, lastIndex); } else { result = requestUrl; } if (contextPath != null && contextPath.length() > 0) { // contextPath contains starting slash result = result + contextPath + "/"; } else { result = result + "/"; } return result; }
288
0
public String filenameOf(@Nonnull String id) { return super.filenameOf(keyFor(id)); } /** * {@inheritDoc} */ @Override
289
0
ElementKind getKind();
290
0
protected void service(final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException { log.trace("Service: {}", request); // is there a consumer registered for the request. HttpConsumer consumer = getServletResolveConsumerStrategy().resolve(request, getConsumers()); if (consumer == null) { response.sendError(HttpServletResponse.SC_NOT_FOUND); return; } if (consumer.getEndpoint().getHttpMethodRestrict() != null) { Iterator it = ObjectHelper.createIterable(consumer.getEndpoint().getHttpMethodRestrict()).iterator(); boolean match = false; while (it.hasNext()) { String method = it.next().toString(); if (method.equalsIgnoreCase(request.getMethod())) { match = true; break; } } if (!match) { response.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED); return; } } if ("TRACE".equals(request.getMethod()) && !consumer.isTraceEnabled()) { response.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED); return; } // we do not support java serialized objects unless explicit enabled String contentType = request.getContentType(); if (HttpConstants.CONTENT_TYPE_JAVA_SERIALIZED_OBJECT.equals(contentType) && !consumer.getEndpoint().getComponent().isAllowJavaSerializedObject()) { System.out.println("415 miser !!!"); response.sendError(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE); return; } final Exchange result = (Exchange) request.getAttribute(EXCHANGE_ATTRIBUTE_NAME); if (result == null) { // no asynchronous result so leverage continuation final Continuation continuation = ContinuationSupport.getContinuation(request); if (continuation.isInitial() && continuationTimeout != null) { // set timeout on initial continuation.setTimeout(continuationTimeout); } // are we suspended and a request is dispatched initially? if (consumer.isSuspended() && continuation.isInitial()) { response.sendError(HttpServletResponse.SC_SERVICE_UNAVAILABLE); return; } if (continuation.isExpired()) { String id = (String) continuation.getAttribute(EXCHANGE_ATTRIBUTE_ID); // remember this id as expired expiredExchanges.put(id, id); log.warn("Continuation expired of exchangeId: {}", id); response.sendError(HttpServletResponse.SC_SERVICE_UNAVAILABLE); return; } // a new request so create an exchange final Exchange exchange = new DefaultExchange(consumer.getEndpoint(), ExchangePattern.InOut); if (consumer.getEndpoint().isBridgeEndpoint()) { exchange.setProperty(Exchange.SKIP_GZIP_ENCODING, Boolean.TRUE); exchange.setProperty(Exchange.SKIP_WWW_FORM_URLENCODED, Boolean.TRUE); } if (consumer.getEndpoint().isDisableStreamCache()) { exchange.setProperty(Exchange.DISABLE_HTTP_STREAM_CACHE, Boolean.TRUE); } HttpHelper.setCharsetFromContentType(request.getContentType(), exchange); exchange.setIn(new HttpMessage(exchange, request, response)); // set context path as header String contextPath = consumer.getEndpoint().getPath(); exchange.getIn().setHeader("CamelServletContextPath", contextPath); String httpPath = (String)exchange.getIn().getHeader(Exchange.HTTP_PATH); // here we just remove the CamelServletContextPath part from the HTTP_PATH if (contextPath != null && httpPath.startsWith(contextPath)) { exchange.getIn().setHeader(Exchange.HTTP_PATH, httpPath.substring(contextPath.length())); } if (log.isTraceEnabled()) { log.trace("Suspending continuation of exchangeId: {}", exchange.getExchangeId()); } continuation.setAttribute(EXCHANGE_ATTRIBUTE_ID, exchange.getExchangeId()); // we want to handle the UoW try { consumer.createUoW(exchange); } catch (Exception e) { log.error("Error processing request", e); throw new ServletException(e); } // must suspend before we process the exchange continuation.suspend(); ClassLoader oldTccl = overrideTccl(exchange); if (log.isTraceEnabled()) { log.trace("Processing request for exchangeId: {}", exchange.getExchangeId()); } // use the asynchronous API to process the exchange consumer.getAsyncProcessor().process(exchange, new AsyncCallback() { public void done(boolean doneSync) { // check if the exchange id is already expired boolean expired = expiredExchanges.remove(exchange.getExchangeId()) != null; if (!expired) { if (log.isTraceEnabled()) { log.trace("Resuming continuation of exchangeId: {}", exchange.getExchangeId()); } // resume processing after both, sync and async callbacks continuation.setAttribute(EXCHANGE_ATTRIBUTE_NAME, exchange); continuation.resume(); } else { log.warn("Cannot resume expired continuation of exchangeId: {}", exchange.getExchangeId()); } } }); if (oldTccl != null) { restoreTccl(exchange, oldTccl); } // return to let Jetty continuation to work as it will resubmit and invoke the service // method again when its resumed return; } try { // now lets output to the response if (log.isTraceEnabled()) { log.trace("Resumed continuation and writing response for exchangeId: {}", result.getExchangeId()); } Integer bs = consumer.getEndpoint().getResponseBufferSize(); if (bs != null) { log.trace("Using response buffer size: {}", bs); response.setBufferSize(bs); } consumer.getBinding().writeResponse(result, response); } catch (IOException e) { log.error("Error processing request", e); throw e; } catch (Exception e) { log.error("Error processing request", e); throw new ServletException(e); } finally { consumer.doneUoW(result); } }
291
0
public String getTreeDigest() { return DigestUtil.getXMSSDigestName(treeDigest); }
292
0
public void setCustomWorkspace(String customWorkspace) throws IOException { this.customWorkspace= Util.fixEmptyAndTrim(customWorkspace); save(); }
293
0
public String nextElement() { underlying.nextElement(); return "application/json"; } } }
294
0
public Set<MediaType> getSupportedTypes(ParseContext context) { return getWrappedParser().getSupportedTypes(context); } /** * Acts like a regular parser except it ignores the ContentHandler * and it automatically sets/overwrites the embedded Parser in the * ParseContext object. * <p> * To retrieve the results of the parse, use {@link #getMetadata()}. * <p> * Make sure to call {@link #reset()} after each parse. */ @Override
295
0
private void init(InputStream is) { if (is == null) { return; } Properties props = new Properties(); try { props.load(is); } catch (IOException e) { } finally { if (is != null) { try { is.close(); } catch (IOException e) { //swallow } } } // set parameters for Tesseract setTesseractPath( getProp(props, "tesseractPath", getTesseractPath())); setTessdataPath( getProp(props, "tessdataPath", getTessdataPath())); setLanguage( getProp(props, "language", getLanguage())); setPageSegMode( getProp(props, "pageSegMode", getPageSegMode())); setMinFileSizeToOcr( getProp(props, "minFileSizeToOcr", getMinFileSizeToOcr())); setMaxFileSizeToOcr( getProp(props, "maxFileSizeToOcr", getMaxFileSizeToOcr())); setTimeout( getProp(props, "timeout", getTimeout())); setOutputType(getProp(props, "outputType", getOutputType().toString())); setPreserveInterwordSpacing(getProp(props, "preserveInterwordSpacing", false)); // set parameters for ImageMagick setEnableImageProcessing( getProp(props, "enableImageProcessing", isEnableImageProcessing())); setImageMagickPath( getProp(props, "ImageMagickPath", getImageMagickPath())); setDensity( getProp(props, "density", getDensity())); setDepth( getProp(props, "depth", getDepth())); setColorspace( getProp(props, "colorspace", getColorspace())); setFilter( getProp(props, "filter", getFilter())); setResize( getProp(props, "resize", getResize())); setApplyRotation( getProp(props, "applyRotation", getApplyRotation())); loadOtherTesseractConfig(props); } /** * @see #setTesseractPath(String tesseractPath) */
296
0
public String getInfo() { return (info); }
297
0
public int callback(int num_msg, Pointer msg, Pointer resp, Pointer _) { LOGGER.fine("pam_conv num_msg="+num_msg); if(password==null) return PAM_CONV_ERR; // allocates pam_response[num_msg]. the caller will free this Pointer m = libc.calloc(pam_response.SIZE,num_msg); resp.setPointer(0,m); for( int i=0; i<num_msg; i++ ) { pam_message pm = new pam_message(msg.getPointer(POINTER_SIZE*i)); LOGGER.fine(pm.msg_style+":"+pm.msg); if(pm.msg_style==PAM_PROMPT_ECHO_OFF) { pam_response r = new pam_response(m.share(pam_response.SIZE*i)); r.setResp(password); r.write(); // write to (*resp)[i] } } return PAM_SUCCESS; } });
298
0
public boolean isClosed() { return closed; } } }
299
0
private void decodeTest() { EllipticCurve curve = new EllipticCurve( new ECFieldFp(new BigInteger("6277101735386680763835789423207666416083908700390324961279")), // q new BigInteger("fffffffffffffffffffffffffffffffefffffffffffffffc", 16), // a new BigInteger("64210519e59c80e70fa7e9ab72243049feb8deecc146b9b1", 16)); // b ECPoint p = ECPointUtil.decodePoint(curve, Hex.decode("03188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012")); if (!p.getAffineX().equals(new BigInteger("188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012", 16))) { fail("x uncompressed incorrectly"); } if (!p.getAffineY().equals(new BigInteger("7192b95ffc8da78631011ed6b24cdd573f977a11e794811", 16))) { fail("y uncompressed incorrectly"); } } /** * X9.62 - 1998,<br> * J.3.2, Page 155, ECDSA over the field Fp<br> * an example with 239 bit prime */