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:com.clustercontrol.infra.etc.action.InfraFileManagerAction.java

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    //?/*  w w  w  . j a va2  s. c  o m*/
    IWorkbenchPage page = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage();

    //?
    try {
        page.showView(InfraFileManagerView.ID);
        IViewPart viewPart = page.findView(InfraFileManagerView.ID);
        if (viewPart == null)
            throw new InternalError("viewPart is null.");
        InfraFileManagerView view = (InfraFileManagerView) viewPart.getAdapter(InfraFileManagerView.class);
        if (view == null) {
            m_log.info("execute: view is null");
            return null;
        }
        view.setFocus();
    } catch (PartInitException e) {
        e.printStackTrace();
    }
    return null;
}

From source file:com.clustercontrol.accesscontrol.etc.action.SystemPrivilegePropertyAction.java

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    //?//from   w ww  .  j a va2  s .co m
    IWorkbenchPage page = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage();

    //?
    try {
        page.showView(SystemPrivilegeListView.ID);
        IViewPart viewPart = page.findView(SystemPrivilegeListView.ID);
        if (viewPart == null)
            throw new InternalError("viewPart is null.");
        SystemPrivilegeListView view = (SystemPrivilegeListView) viewPart
                .getAdapter(SystemPrivilegeListView.class);
        if (view == null) {
            m_log.info("execute: view is null");
            return null;
        }
        view.setFocus();
    } catch (PartInitException e) {
    }
    return null;
}

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

/**
 * twitter// w ww  . j av  a 2 s  . c o m
 */
@SocialBookmark(icon = "twitter.png")
@Priority(10)
public String twitterSocialBookmark(@PageLink(shortened = true) String pageLink, @PageTitle String pageTitle) {
    String tweet = pageLink + " - " + pageTitle;

    if (tweet.length() > MAX_TWEET_LENGTH) {
        tweet = tweet.substring(0, MAX_TWEET_LENGTH);
    }

    try {
        return "http://twitter.com/home?status=" + URLEncoder.encode(tweet, "utf-8");
    } catch (UnsupportedEncodingException ex) {
        throw new InternalError("no utf-8");
    }
}

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

/**
 * identi.ca//from  ww  w  . ja v  a 2  s . c o  m
 */
@SocialBookmark(icon = "identica.png")
@Priority(11)
public String identicaSocialBookmark(@PageLink(shortened = true) String pageLink, @PageTitle String pageTitle) {
    String post = pageLink + " - " + pageTitle;

    if (post.length() > MAX_POST_LENGTH) {
        post = post.substring(0, MAX_POST_LENGTH);
    }

    try {
        return "http://identi.ca/notice/new?status_textarea=" + URLEncoder.encode(post, "utf-8");
    } catch (UnsupportedEncodingException ex) {
        throw new InternalError("no utf-8");
    }
}

From source file:gov.nih.nci.calims2.taglib.EnumTag.java

/**
 * Gets the value of the optional property in the specified locale.
 * @param locale The locale/*from w  w  w. ja va 2 s.c  o m*/
 * @return The optional property in the specified locale
 */
private String getPropertyValue(Locale locale) throws Exception {
    try {
        String methodName = "get" + propertyName.substring(0, 1).toUpperCase() + propertyName.substring(1);
        Method m = value.getClass().getMethod(methodName, Locale.class);
        return (String) m.invoke(value, locale);
    } catch (IllegalArgumentException e) {
        throw new InternalError("Could not happen. Method take a locale argument");
    }
}

From source file:gov.nih.nci.calims2.business.inventory.container.CoordinateHelper.java

/**
 * Converts a given String into the integer coordinate according to the label type.
 * // www.  j  a v  a2s  .  c  o m
 * @param labelType The label type
 * @param value The string to convert
 * @return The coordinate corresponding to the given label.
 */
public static int getCoordinateValue(LayoutLabelType labelType, String value) {
    if (StringUtils.isBlank(value)) {
        return 0;
    }
    switch (labelType) {
    case DIGITS: {
        return Integer.parseInt(value) - 1;
    }
    case ALL_LOWER_CASE: {
        return convertString('a', value);
    }
    case ALL_UPPER_CASE: {
        return convertString('A', value);
    }
    default: {
        throw new InternalError("Can not happen");
    }
    }
}

From source file:se.cambio.cds.gdl.model.GuideDefinition.java

/**
 * @param archetypeBindings the archetypeBindings to set
 *//*from   w ww  .j a v a2  s .c  o  m*/
public void setArchetypeBindings(Object archetypeBindings) {
    if (archetypeBindings instanceof Map) {
        changeArchetypeBindings((Map) archetypeBindings);
    } else if (archetypeBindings instanceof List) {
        changeArchetypeBindings((List) archetypeBindings);
    } else {
        throw new InternalError("Archetype bindings could not be set (unknown type '"
                + archetypeBindings.getClass().getName() + "').");
    }
}

From source file:com.clustercontrol.calendar.composite.action.CalendarPatternSelectionChangedListener.java

@Override
public void selectionChanged(SelectionChangedEvent event) {
    String id = null;/*w ww . java2s . c om*/

    StructuredSelection selection = (StructuredSelection) event.getSelection();
    if (selection == null)
        throw new InternalError("selection is null.");

    //ID?
    if (selection.getFirstElement() != null) {
        ArrayList<?> info = (ArrayList<?>) selection.getFirstElement();
        id = (String) info.get(GetCalendarPatternTableDefine.CAL_PATTERN_ID);
        //ID
        m_composite.setCalendarPatternId(id);
    }

    //?
    IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();

    //[]???/???
    IViewPart viewPart = page.findView(CalendarPatternView.ID);
    if (viewPart != null) {
        CalendarPatternView view = (CalendarPatternView) viewPart.getAdapter(CalendarPatternView.class);
        if (view == null) {
            m_log.info("selection changed: view is null");
            return;
        }
        //??/???
        view.setEnabledAction(selection.size(), selection);
    }
}

From source file:com.wickettasks.business.services.tasklist.TestTaskListService.java

@Before
public void addUser() {
    try {/* w w w.  j av a 2s  . c  om*/
        this.user = this.userService.add("test@email.com", "password");
    } catch (ExistingUserException e) {
        throw new InternalError(e.toString());
    }
}

From source file:edu.ku.brc.af.core.db.BackupServiceFactory.java

/**
 * Returns the instance to the singleton
 * @return  the instance to the singleton
 */// ww  w.  j  av  a  2  s  .  co m
public static BackupServiceFactory getInstance() {
    if (instance != null) {
        return instance;
    }

    // else
    String factoryNameStr = AccessController.doPrivileged(new java.security.PrivilegedAction<String>() {
        public String run() {
            return System.getProperty(factoryName);
        }
    });

    if (isNotEmpty(factoryNameStr)) {
        try {
            return instance = (BackupServiceFactory) Class.forName(factoryNameStr).newInstance();

        } catch (Exception e) {
            edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount();
            edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(BackupServiceFactory.class, e);
            InternalError error = new InternalError("Can't instantiate RecordSet factory " + factoryNameStr); //$NON-NLS-1$
            error.initCause(e);
            throw error;
        }
    }
    return null;
}