Example usage for java.lang InternalError InternalError

List of usage examples for java.lang InternalError InternalError

Introduction

In this page you can find the example usage for java.lang InternalError InternalError.

Prototype

public InternalError(Throwable cause) 

Source Link

Document

Constructs an InternalError with the specified cause and a detail message of (cause==null ?

Usage

From source file:org.shredzone.cilla.plugin.social.GoogleSocialHandler.java

/**
 * Google reader/*from   w w w .ja  v  a2  s .  c  o  m*/
 */
@SocialBookmark(icon = "googlereader.png")
public String googleReaderSocialBookmark(@PageLink(encoded = true) String pageLink,
        @PageTitle(encoded = true) String pageTitle) {
    String siteUrl = viewService.getViewContext().getRequestServerUrl();

    try {
        return "http://www.google.com/reader/link?url=" + pageLink + "&title=" + pageTitle + "&srcURL="
                + URLEncoder.encode(siteUrl, "utf-8") + "&srcTitle=" + URLEncoder.encode(siteName, "utf-8");
    } catch (UnsupportedEncodingException ex) {
        throw new InternalError("no utf-8");
    }
}

From source file:ProxyFactory.java

/**
 * Returns an instance of a proxy class for this factory's interfaces that
 * dispatches method invocations to the specified invocation handler. 
 * <tt>ProxyFactory.newInstance</tt> throws <tt>IllegalArgumentException</tt>
 * for the same reasons that <tt>Proxy.getProxyClass</tt> does.
 *
 * @param handler//from w  w w . j  a va2s.  co  m
 *      the invocation handler to dispatch method invocations to 
 * @return
 *      a proxy instance with the specified invocation handler of a proxy
 *      class that implements this factory's specified interfaces 
 *
 * @throws IllegalArgumentException
 *      if any of the restrictions on the parameters that may be passed to
 *      <tt>getProxyClass</tt> are violated 
 * @throws NullPointerException
 *      if the invocation handler is null
 */
public Object newInstance(InvocationHandler handler) {
    if (handler == null)
        throw new NullPointerException();

    try {
        return getConstructor().newInstance(new Object[] { handler });
    } catch (InstantiationException e) {
        throw new InternalError(e.toString());
    } catch (IllegalAccessException e) {
        throw new InternalError(e.toString());
    } catch (InvocationTargetException e) {
        throw new InternalError(e.toString());
    }
}

From source file:gov.nih.nci.calims2.business.email.EmailMessage.java

/**
 * {@inheritDoc}// ww w.j  av  a 2 s.c  om
 */
public EmailMessage clone() {
    try {
        EmailMessage clone = (EmailMessage) super.clone();
        if (recipients != null) {
            Map<Message.RecipientType, Set<String>> newRecipients = new HashMap<Message.RecipientType, Set<String>>();
            for (Map.Entry<Message.RecipientType, Set<String>> entry : recipients.entrySet()) {
                recipients.put(entry.getKey(), new HashSet<String>(entry.getValue()));
            }
            clone.recipients = newRecipients;
        }
        return clone;
    } catch (CloneNotSupportedException e) {
        throw new InternalError("Can not happen - we support clone");
    }
}

From source file:technology.tikal.customers.dao.objectify.paginator.StringPaginator.java

private List<T> consultarTodosSinFiltro(PaginationContext<K> context, int duplicated, int retry) {
    List<T> result;//w  w w .  j a v  a2s  .c o m
    Query<T> query = buildQuery(context);
    if (context.getPagination().hasSince()) {
        String since = StringNormalizer.normalize(context.getPagination().getSince());
        query = query.filter(context.getIndexOfy() + " >=", since);
        result = resolvePaginationSince(query, context, duplicated);
        if (result == null) {
            if (retry > this.maxRetry) {
                throw new InternalError("No se logro paginar");
            }
            //se incrementa el numero de duplicados y se busca de nuevo
            result = this.consultarTodosSinFiltro(context, duplicated + stepDuplicated, retry + 1);
        }
    } else {
        result = resolvePagination(query, context);
    }
    return result;
}

From source file:net.sf.firemox.token.Register.java

/**
 * Returns the integer value of this expression
 * //ww w.  j a v  a  2  s  .  c  om
 * @param ability
 *          is the ability owning this test. The card component of this
 *          ability should correspond to the card owning this test too.
 * @param tested
 *          the tested card
 * @param context
 *          is the context attached to this test.
 * @param index
 *          the index value access.
 * @return the integer value of this expression
 */
public int getValue(Ability ability, Target tested, ContextEventListener context, int index) {
    if (on != null)
        return on.getTargetable(ability, tested).getValue(index);
    switch (ordinal) {
    case IdTokens.STACK:
        return StackManager.registers[index];
    case IdTokens.STATIC_REGISTER:
        return MCommonVars.registers[index];
    case IdTokens.REQUIRED_MANA:
        if (index == IdTokens.MANA_POOL) {
            return MToolKit.manaPool(StackManager.actionManager.getRequiredMana());
        }
        return StackManager.actionManager.getRequiredMana()[index];
    default:
        throw new InternalError("unknown idToken : " + index);
    }
}

From source file:com.nextbook.config.ConfigurableStringHttpMessageConverter.java

@Override
protected Long getContentLength(String s, MediaType contentType) {
    Charset charset = getContentTypeCharset(contentType);
    try {/*from  ww w  .j  a  v a  2 s . c  o  m*/
        return (long) s.getBytes(charset.name()).length;
    } catch (UnsupportedEncodingException ex) {
        // should not occur
        throw new InternalError(ex.getMessage());
    }
}

From source file:com.manydesigns.elements.Mode.java

Mode(int value, String name) {
    int baseMode = value & BASE_MODE_MASK;
    switch (baseMode) {
    case 0:/*from w  w w.jav a 2s . co m*/
        edit = true;
        preview = false;
        view = false;
        hidden = false;
        break;
    case 1:
        edit = false;
        preview = true;
        view = false;
        hidden = false;
        break;
    case 2:
        edit = false;
        preview = false;
        view = true;
        hidden = false;
        break;
    case 3:
        edit = false;
        preview = false;
        view = false;
        hidden = true;
        break;
    default:
        throw new InternalError("Unrecognized mode: " + value);
    }
    create = (value & CREATE_MASK) != 0;
    bulk = (value & BULK_MASK) != 0;
    this.name = name;
}

From source file:net.jodah.failsafe.internal.actions.DoThrowAction.java

@Override
public R execute(ActionContext<R> context) throws Exception {
    return super.execute(context, "", () -> {
        final Throwable t;

        synchronized (current) {
            if (current.isEmpty()) {
                throw FailsafeContinueException.INSTANCE; // move on to the next one
            }//from w ww .j  av a 2  s  . co  m
            t = current.remove(0);
        }
        ThrowableSupport.sneakyThrow(t.fillInStackTrace());
        throw new InternalError("should not have been reached");
    });
}

From source file:ml.shifu.shifu.container.meta.MetaItem.java

@Override
public MetaItem clone() {
    MetaItem copy = null;//  w  w  w . j  av  a 2 s. com
    try {
        copy = (MetaItem) super.clone();
    } catch (CloneNotSupportedException e) {
        // This should never happen
        throw new InternalError(e.toString());
    }

    copy.setName(name);
    copy.setType(type);
    copy.setDefval(defval);
    copy.setMaxLength(maxLength);
    copy.setMinLength(minLength);
    copy.setOptions(options);
    copy.setElementType(elementType);

    if (CollectionUtils.isNotEmpty(element)) {
        List<MetaItem> elementList = new ArrayList<MetaItem>();
        for (MetaItem meta : element) {
            elementList.add(meta.clone());
        }

        copy.setElement(elementList);
    }

    return copy;
}

From source file:org.shredzone.commons.gravatar.impl.GravatarServiceImpl.java

@Override
public String computeHash(String mail) {
    try {/*from w  ww. j a v a2 s.c o  m*/
        MessageDigest md5 = MessageDigest.getInstance("MD5");
        md5.reset();
        md5.update(mail.trim().toLowerCase().getBytes("UTF-8"));

        byte[] digest = md5.digest();

        return IntStream.range(0, digest.length).mapToObj(ix -> String.format("%02x", digest[ix] & 0xFF))
                .collect(joining());
    } catch (NoSuchAlgorithmException | UnsupportedEncodingException ex) {
        // should never happen since we use standard stuff
        throw new InternalError(ex.getMessage());
    }
}