Package org.apache.jorphan.util

Examples of org.apache.jorphan.util.JMeterException


    public static Object construct(String className) throws JMeterException {
        Object instance = null;
        try {
            instance = ClassUtils.getClass(className).newInstance();
        } catch (ClassNotFoundException e) {
            throw new JMeterException(e);
        } catch (InstantiationException e) {
            throw new JMeterException(e);
        } catch (IllegalAccessException e) {
            throw new JMeterException(e);
        }
        return instance;
    }
View Full Code Here


        try {
            Class<?> clazz = ClassUtils.getClass(className);
            clazz.getConstructor(new Class [] {Integer.TYPE});
            instance = ClassUtils.getClass(className).newInstance();
        } catch (ClassNotFoundException e) {
            throw new JMeterException(e);
        } catch (InstantiationException e) {
            throw new JMeterException(e);
        } catch (IllegalAccessException e) {
            throw new JMeterException(e);
        } catch (SecurityException e) {
            throw new JMeterException(e);
        } catch (NoSuchMethodException e) {
            throw new JMeterException(e);
        }
        return instance;
    }
View Full Code Here

        Method m;
        try {
            m = ClassUtils.getPublicMethod(instance.getClass(), methodName, new Class [] {});
            m.invoke(instance, (Object [])null);
        } catch (NoSuchMethodException e) {
            throw new JMeterException(e);
        } catch (IllegalAccessException e) {
            throw new JMeterException(e);
        } catch (InvocationTargetException e) {
            throw new JMeterException(e);
        }
    }
View Full Code Here

        instantiateParser();
        SampleResult res = null;
        try {

            if (PARSER == null) {
                throw new JMeterException("No Parser available");
            }
            /*
             * samp.setDomain(this.getDomain()); samp.setPort(this.getPort());
             */
            // we call parse with 1 to get only one.
View Full Code Here

            }

            if (shouldLog) {
                log.error(message);
            }
            throw new JMeterException(message, e);
        }
        return r;
    }
View Full Code Here

            byte[] ba = request.parse(new BufferedInputStream(clientSocket.getInputStream()));
            if (ba.length == 0) {
                if (isDebug) {
                    log.debug(port + "Empty request, ignored");
                }
                throw new JMeterException(); // hack to skip processing
            }
            if (isDebug) {
                log.debug(port + "Initial request: " + new String(ba));
            }
            outStreamClient = clientSocket.getOutputStream();

            if ((request.getMethod().startsWith(HTTPConstants.CONNECT)) && (outStreamClient != null)) {
                if (isDebug) {
                    log.debug(port + "Method CONNECT => SSL");
                }
                // write a OK reponse to browser, to engage SSL exchange
                outStreamClient.write(("HTTP/1.0 200 OK\r\n\r\n").getBytes(SampleResult.DEFAULT_HTTP_ENCODING)); // $NON-NLS-1$
                outStreamClient.flush();
               // With ssl request, url is host:port (without https:// or path)
                String[] param = request.getUrl().split(":")// $NON-NLS-1$
                if (param.length == 2) {
                    if (isDebug) {
                        log.debug(port + "Start to negotiate SSL connection, host: " + param[0]);
                    }
                    clientSocket = startSSL(clientSocket, param[0]);
                } else {
                    // Should not happen, but if it does we don't want to continue
                    log.error("In SSL request, unable to find host and port in CONNECT request: " + request.getUrl());
                    throw new JMeterException(); // hack to skip processing
                }
                // Re-parse (now it's the http request over SSL)
                try {
                    ba = request.parse(new BufferedInputStream(clientSocket.getInputStream()));
                } catch (IOException ioe) { // most likely this is because of a certificate error
                    final String url = param.length>0 " for '"+ param[0] +"'" : "";
                    log.warn(port + "Problem with SSL certificate"+url+"? Ensure browser is set to accept the JMeter proxy cert: " + ioe.getMessage());
                    // won't work: writeErrorToClient(HttpReplyHdr.formInternalError());
                    result = generateErrorResult(result, request, ioe, "\n**ensure browser is set to accept the JMeter proxy certificate**"); // Generate result (if nec.) and populate it
                    throw new JMeterException(); // hack to skip processing
                }
                if (isDebug) {
                    log.debug(port + "Reparse: " + new String(ba));
                }
                if (ba.length == 0) {
                    log.warn(port + "Empty response to http over SSL. Probably waiting for user to authorize the certificate for " + request.getUrl());
                    throw new JMeterException(); // hack to skip processing
                }
            }

            SamplerCreator samplerCreator = SAMPLERFACTORY.getSamplerCreator(request, pageEncodings, formEncodings);
            sampler = samplerCreator.createAndPopulateSampler(request, pageEncodings, formEncodings);
View Full Code Here

    public static Object construct(String className) throws JMeterException {
        Object instance = null;
        try {
            instance = ClassUtils.getClass(className).newInstance();
        } catch (ClassNotFoundException e) {
            throw new JMeterException(e);
        } catch (InstantiationException e) {
            throw new JMeterException(e);
        } catch (IllegalAccessException e) {
            throw new JMeterException(e);
        }
        return instance;
    }
View Full Code Here

        try {
            Class<?> clazz = ClassUtils.getClass(className);
            clazz.getConstructor(new Class [] {Integer.TYPE});
            instance = ClassUtils.getClass(className).newInstance();
        } catch (ClassNotFoundException e) {
            throw new JMeterException(e);
        } catch (InstantiationException e) {
            throw new JMeterException(e);
        } catch (IllegalAccessException e) {
            throw new JMeterException(e);
        } catch (SecurityException e) {
            throw new JMeterException(e);
        } catch (NoSuchMethodException e) {
            throw new JMeterException(e);
        }
        return instance;
    }
View Full Code Here

        try {
            Class<?> clazz = Class.forName(className);
            Constructor<?> constructor = clazz.getConstructor(String.class);
            instance = constructor.newInstance(parameter);
        } catch (ClassNotFoundException e) {
            throw new JMeterException(e);
        } catch (InstantiationException e) {
            throw new JMeterException(e);
        } catch (IllegalAccessException e) {
            throw new JMeterException(e);
        } catch (NoSuchMethodException e) {
            throw new JMeterException(e);
        } catch (IllegalArgumentException e) {
            throw new JMeterException(e);
        } catch (InvocationTargetException e) {
            throw new JMeterException(e);
        }
        return instance;
    }
View Full Code Here

        Method m;
        try {
            m = ClassUtils.getPublicMethod(instance.getClass(), methodName, new Class [] {});
            m.invoke(instance, (Object [])null);
        } catch (NoSuchMethodException e) {
            throw new JMeterException(e);
        } catch (IllegalAccessException e) {
            throw new JMeterException(e);
        } catch (InvocationTargetException e) {
            throw new JMeterException(e);
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.jorphan.util.JMeterException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.