Example usage for org.apache.commons.lang NullArgumentException NullArgumentException

List of usage examples for org.apache.commons.lang NullArgumentException NullArgumentException

Introduction

In this page you can find the example usage for org.apache.commons.lang NullArgumentException NullArgumentException.

Prototype

public NullArgumentException(String argName) 

Source Link

Document

Instantiates with the given argument name.

Usage

From source file:com.eyeq.pivot4j.impl.PivotModelImpl.java

/**
 * @see com.eyeq.pivot4j.state.Configurable#restoreSettings(org.apache.commons.configuration.HierarchicalConfiguration)
 *///from   w ww. ja v a  2 s  .  co  m
@Override
public synchronized void restoreSettings(HierarchicalConfiguration configuration) {
    if (configuration == null) {
        throw new NullArgumentException("configuration");
    }

    String mdx = configuration.getString("mdx");

    setMdx(mdx);

    if (mdx == null) {
        if (logger.isWarnEnabled()) {
            logger.warn("The configuration does not contain valid MDX query.");
        }

        return;
    }

    if (!isInitialized()) {
        initialize();
    }

    this.sorting = configuration.getBoolean("sort[@enabled]", false);

    this.sortPosMembers = null;
    this.sortCriteria = SortCriteria.ASC;
    this.topBottomCount = 10;

    Quax quaxToSort = null;

    if (sorting) {
        List<Object> sortPosUniqueNames = configuration.getList("sort.member");
        if (sortPosUniqueNames != null && !sortPosUniqueNames.isEmpty()) {
            try {
                Cube cube = getCube();

                this.sortPosMembers = new ArrayList<Member>(sortPosUniqueNames.size());

                for (Object uniqueName : sortPosUniqueNames) {
                    Member member = cube.lookupMember(
                            IdentifierNode.parseIdentifier(uniqueName.toString()).getSegmentList());
                    if (member == null) {
                        if (logger.isWarnEnabled()) {
                            logger.warn("Sort position member not found " + uniqueName);
                        }

                        break;
                    }

                    sortPosMembers.add(member);
                }
            } catch (OlapException e) {
                throw new PivotException(e);
            }
        }

        this.topBottomCount = configuration.getInt("sort[@topBottomCount]", 10);

        String sortName = configuration.getString("sort[@criteria]");
        if (sortName != null) {
            this.sortCriteria = SortCriteria.valueOf(sortName);
        }

        int ordinal = configuration.getInt("sort[@ordinal]", -1);

        if (ordinal > 0) {
            for (Axis axis : queryAdapter.getAxes()) {
                Quax quax = queryAdapter.getQuax(axis);
                if (quax.getOrdinal() == ordinal) {
                    quaxToSort = quax;
                    break;
                }
            }
        }
    }

    queryAdapter.setQuaxToSort(quaxToSort);

    this.cellSet = null;
}

From source file:net.ymate.framework.commons.HttpClientHelper.java

public static SSLConnectionSocketFactory createConnectionSocketFactory(String certType, URL certFilePath,
        char[] passwordChars) throws KeyStoreException, IOException, CertificateException,
        NoSuchAlgorithmException, UnrecoverableKeyException, KeyManagementException {
    if (StringUtils.isBlank(certType)) {
        throw new NullArgumentException("certType");
    }//from  w  w w.  j a  v  a 2 s. c  o  m
    if (certFilePath == null) {
        throw new NullArgumentException("certFilePath");
    }
    if (ArrayUtils.isEmpty(passwordChars)) {
        throw new NullArgumentException("passwordChars");
    }
    KeyStore _keyStore = KeyStore.getInstance(certType);
    InputStream _certFileStream = null;
    try {
        _certFileStream = certFilePath.openStream();
        _keyStore.load(_certFileStream, passwordChars);
    } finally {
        IOUtils.closeQuietly(_certFileStream);
    }
    SSLContext _sslContext = SSLContexts.custom().loadKeyMaterial(_keyStore, passwordChars).build();
    return new SSLConnectionSocketFactory(_sslContext, new String[] { "TLSv1" }, null,
            new DefaultHostnameVerifier());
}

From source file:net.ymate.framework.core.support.ExceptionProcessHelper.java

public ExceptionProcessHelper registerProcessor(Class<? extends Throwable> target,
        IExceptionProcessor processor) {
    if (target == null) {
        throw new NullArgumentException("target");
    }/*from   w w w .j a  v a  2 s  .  c  o m*/
    if (processor == null) {
        throw new NullArgumentException("processor");
    }
    __processors.put(target.getName(), processor);
    //
    return this;
}

From source file:net.ymate.framework.core.support.I18NResourceHelper.java

private I18NResourceHelper(final String resourceName) {
    if (StringUtils.isBlank(resourceName)) {
        throw new NullArgumentException("resourceName");
    }// www.ja va 2 s  . c  o m
    __resourceAdapter = new IResourceAdapter() {

        public String getResourceName() {
            return resourceName;
        }

        public String getDefaultValue(String resourceKey) {
            return null;
        }
    };
}

From source file:net.ymate.framework.core.support.I18NResourceHelper.java

private I18NResourceHelper(IResourceAdapter resourceAdapter) {
    if (resourceAdapter == null) {
        throw new NullArgumentException("resourceAdapter");
    }/*from   ww  w .  ja v a 2s  .  c  om*/
    if (StringUtils.isBlank(resourceAdapter.getResourceName())) {
        throw new NullArgumentException("resourceName");
    }
    __resourceAdapter = resourceAdapter;
}

From source file:net.ymate.framework.core.support.TokenProcessHelper.java

public synchronized void resetToken(HttpServletRequest request, String name) {
    if (StringUtils.trimToNull(name) == null) {
        throw new NullArgumentException(name);
    }/*ww w  . j  ava 2  s .c  o  m*/
    HttpSession session = request.getSession(false);
    if (session != null) {
        session.removeAttribute(TRANSACTION_TOKEN_KEY + "|" + name);
    }
}

From source file:net.ymate.framework.core.support.TokenProcessHelper.java

public synchronized String saveToken(HttpServletRequest request, String name) {
    if (StringUtils.trimToNull(name) == null) {
        throw new NullArgumentException(name);
    }/*from   w w w .j  av a  2s. c om*/
    String token = generateToken(request);
    if (token != null) {
        HttpSession session = request.getSession();
        session.setAttribute(TRANSACTION_TOKEN_KEY + "|" + name, token);
    }
    return token;
}

From source file:net.ymate.framework.core.taglib.AbstractTagSupport.java

@Override
public int doStartTag() throws JspException {
    // Init//from   w ww.java 2s  .  c om
    __iterator = null;
    __sequence = 0;
    //
    Object _resultObj = doProcessTagData();
    // ?
    if (__iterator != null) {
        if (StringUtils.isBlank(getVar())) {
            throw new NullArgumentException("var");
        }
        if (__iterator.hasNext()) {
            __doProcessIteratorTagDataStatus(__iterator.next(), ++__sequence);
            return EVAL_BODY_AGAIN;
        } else {
            return SKIP_BODY;
        }
    } else {
        // ??
        if (_resultObj != null) {
            if (StringUtils.isNotBlank(getVar())) {
                switch (Scope
                        .valueOf(StringUtils.defaultIfEmpty(getScope(), Scope.PAGE.name()).toUpperCase())) {
                case APPLICATION:
                    pageContext.getServletContext().setAttribute(getVar(), _resultObj);
                    break;
                case REQUEST:
                    pageContext.getRequest().setAttribute(getVar(), _resultObj);
                    break;
                case SESSION:
                    pageContext.getSession().setAttribute(getVar(), _resultObj);
                    break;
                default:
                    pageContext.setAttribute(getVar(), _resultObj);
                }
            } else if (_resultObj instanceof String) {
                try {
                    pageContext.getOut().write(_resultObj.toString());
                } catch (IOException e) {
                    throw new JspException(e.getMessage(), RuntimeUtils.unwrapThrow(e));
                }
            }
            return EVAL_BODY_INCLUDE;
        } else {
            if (isAlways()) {
                return EVAL_BODY_INCLUDE;
            }
            return SKIP_BODY;
        }
    }
}

From source file:net.ymate.framework.core.taglib.AbstractTagSupport.java

protected boolean __doInitIterator(Iterator<?> iterator, int pageCount, long recordCount) throws JspException {
    if (innerLoop) {
        // ??var?
        if (StringUtils.isBlank(var)) {
            throw new NullArgumentException("var");
        }//from  www  .  j  a v  a  2s .  co  m
        //
        this.setIterator(iterator);
        // ?????
        pageContext.setAttribute(var + "_records", recordCount);
        pageContext.setAttribute(var + "_pages", pageCount);
        //
        return true;
    }
    return false;
}

From source file:net.ymate.framework.webmvc.support.UserSessionBean.java

private UserSessionBean(String id) {
    this.id = StringUtils.isNotBlank(id) ? id : getSessionStorageAdapter().createSessionId();
    if (StringUtils.isBlank(this.id)) {
        throw new NullArgumentException("id");
    }/*from w ww  . j  a v a 2s  .co m*/
    this.createTime = System.currentTimeMillis();
    this.lastActivateTime = this.createTime;
    this.__attributes = new HashMap<String, Serializable>();
}