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:IntVector.java

/**
 * Performs deep copy.//from   w ww.  j  a va 2s .c  o  m
 */
public Object clone() {
    try {
        final IntVector _clone = (IntVector) super.clone();

        // deep clone:
        if (m_size < COPY_THRESHOLD) {
            _clone.m_values = new int[m_values.length];
            final int[] _clone_values = _clone.m_values;
            for (int i = 0; i < m_size; ++i)
                _clone_values[i] = m_values[i];
        } else {
            _clone.m_values = (int[]) m_values.clone();
        }

        return _clone;
    } catch (CloneNotSupportedException e) {
        throw new InternalError(e.toString());
    }
}

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

@Override
public void selectionChanged(SelectionChangedEvent event) {
    String managerName = null;//  www .j  a  v a 2s . c  o m
    String calenadarId = null;

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

    //ID?
    if (selection.getFirstElement() != null) {
        ArrayList<?> info = (ArrayList<?>) selection.getFirstElement();
        managerName = (String) info.get(GetCalendarListTableDefine.MANAGER_NAME);
        calenadarId = (String) info.get(GetCalendarListTableDefine.CALENDAR_ID);
        //ID
        m_composite.setCalendarId(calenadarId);
    }

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

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

    //?
    viewPart = page.findView(CalendarMonthView.ID);
    if (viewPart != null) {
        CalendarMonthView view = (CalendarMonthView) viewPart.getAdapter(CalendarMonthView.class);
        if (view == null) {
            m_log.info("selection changed: calendar month view is null");
            return;
        }
        view.update(managerName, calenadarId);
    }
}

From source file:edu.ku.brc.af.ui.weblink.WebLinkMgr.java

/**
 * Returns the instance to the singleton
 * @return  the instance to the singleton
 *///from ww  w.  j  a va  2s.  c  om
public static WebLinkMgr 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 = (WebLinkMgr) Class.forName(factoryNameStr).newInstance();

        } catch (Exception e) {
            edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount();
            edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(WebLinkMgr.class, e);
            InternalError error = new InternalError("Can't instantiate WebLink factory " + factoryNameStr); //$NON-NLS-1$
            error.initCause(e);
            throw error;
        }
    }
    // if not factory than pass an instance of this in
    // and this does nothing to the SQL.
    return instance = new WebLinkMgr();
}

From source file:com.wickettasks.business.services.task.TestTaskService.java

@Before
public void addUserAndTaskList() {
    try {//from  ww  w .j av a2  s.co m
        this.user = this.userService.add("test@email.com", "password");
    } catch (ExistingUserException e) {
        throw new InternalError(e.toString());
    }
    this.taskList = this.taskListService.add("testTaskList", this.user.getId());
}

From source file:com.clustercontrol.jobmanagement.util.TimeToANYhourConverter.java

public static boolean main() {
    String a = "2009/04/19 12:23:01";
    String b = "2009/04/22 12:23:00";
    String c = "2009/05/20 12:23:00";
    String d = "2010/04/20 12:23:00";
    String e = "2009/04/19 12:24:00";
    String f = "2009/04/19 13:23:00";
    String g = "2009/04/19 12:24:01";
    String h = "2009/04/19 13:23:01";
    String i = "2009/04/19 12:23:00";
    SimpleDateFormat DFYS = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
    DFYS.setTimeZone(TimezoneUtil.getTimeZone());
    Date ta = null;/* ww  w .j  a v  a 2 s.  c om*/
    Date tb = null;
    Date tc = null;
    Date td = null;
    Date te = null;
    Date tf = null;
    Date tg = null;
    Date th = null;
    Date ti = null;
    try {
        ta = DFYS.parse(a);
        tb = DFYS.parse(b);
        tc = DFYS.parse(c);
        td = DFYS.parse(d);
        te = DFYS.parse(e);
        tf = DFYS.parse(f);
        tg = DFYS.parse(g);
        th = DFYS.parse(h);
        ti = DFYS.parse(i);
    } catch (java.text.ParseException z) {
        m_log.debug(z.getMessage(), z);
        throw new InternalError(z.getMessage());
    }
    long s = ta.getTime();
    long e1 = tb.getTime();
    long e2 = tc.getTime();
    long e3 = td.getTime();
    long e4 = te.getTime();
    long e5 = tf.getTime();
    long e6 = tg.getTime();
    long e7 = th.getTime();
    long e8 = ti.getTime();
    m_log.info("from date = : " + a);
    m_log.info("test case 1 :>>>>>>>>>>>>");
    m_log.info("to   date = : " + b);
    m_log.info("diffTime   = : " + toDiffTime(s, e1));
    m_log.info("test case 2 :>>>>>>>>>>>>");
    m_log.info("to   date = : " + c);
    m_log.info("diffTime   = : " + toDiffTime(s, e2));
    m_log.info("test case 3 :>>>>>>>>>>>>");
    m_log.info("to   date = : " + d);
    m_log.info("diffTime   = : " + toDiffTime(s, e3));
    m_log.info("test case 4 :>>>>>>>>>>>>");
    m_log.info("to   date = : " + e);
    m_log.info("diffTime   = : " + toDiffTime(s, e4));
    m_log.info("test case 5 :>>>>>>>>>>>>");
    m_log.info("to   date = : " + f);
    m_log.info("diffTime   = : " + toDiffTime(s, e5));
    m_log.info("test case 6 :>>>>>>>>>>>>");
    m_log.info("to   date = : " + g);
    m_log.info("diffTime   = : " + toDiffTime(s, e6));
    m_log.info("test case 7 :>>>>>>>>>>>>");
    m_log.info("to   date = : " + h);
    m_log.info("diffTime   = : " + toDiffTime(s, e7));
    m_log.info("test case 8 :>>>>>>>>>>>>");
    m_log.info("to   date = : " + a);
    m_log.info("diffTime   = : " + toDiffTime(s, s));
    m_log.info("test case 9 :>>>>>>>>>>>>");
    m_log.info("to   date = : " + i);
    m_log.info("diffTime   = : " + toDiffTime(s, e8));
    return true;
}

From source file:com.commsen.apropos.core.PropertiesManager.java

/**
 * Loads properties form {@value #dataFile} and fills {@link #rootPackages} and
 * {@value #allPackages}. This method is called only once - during class initialization (from a
 * static block)/*from w  ww. jav  a 2s.  c o m*/
 */
private static void load() {
    if (dataFile.exists() && dataFile.isFile()) {
        FileInputStream dataStream = null;
        try {
            dataStream = new FileInputStream(dataFile);
            instance = (PropertiesManager) xStream.fromXML(dataStream);
        } catch (FileNotFoundException e) {
            throw new InternalError(e.getMessage());
        } finally {
            if (dataStream != null)
                try {
                    dataStream.close();
                } catch (IOException e) {
                    // oops failed to close stream
                }
        }
        for (PropertyPackage rootPackage : instance.rootPackages) {
            addToAllPackages(rootPackage);
        }
    }
}

From source file:edu.ku.brc.af.core.SchemaI18NService.java

/**
 * Returns the instance of the AppContextMgr.
 * @return the instance of the AppContextMgr.
 *//*from  w  w w  .  j a v  a  2  s.com*/
public static SchemaI18NService getInstance() {
    if (instance != null) {
        return instance;

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

    if (factoryNameStr != null) {
        try {
            instance = (SchemaI18NService) Class.forName(factoryNameStr).newInstance();
            return instance;

        } catch (Exception e) {
            edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount();
            edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(SchemaI18NService.class, e);
            InternalError error = new InternalError(
                    "Can't instantiate SchemaI18NService factory " + factoryNameStr); //$NON-NLS-1$
            error.initCause(e);
            throw error;
        }
    }
    throw new RuntimeException("The System porpoerty [" + factoryName + "] has not been set up!"); //$NON-NLS-1$ //$NON-NLS-2$
}

From source file:resources.XmlToAnime.java

public static void ReadXml() {
    animes.clear();//from  w  w  w . jav a  2  s  .  co  m
    if (sUrl.isEmpty() || sUrl == null) {
        throw new InternalError("Url should not be empty!");
    }

    try {
        DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
        DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
        //Document doc = (Document) dBuilder.parse(new URL(sUrl).openStream());
        //Document doc = (Document) dBuilder.parse

        InputStream input = getInput();
        if (input.available() > 0) {
            Document doc = (Document) dBuilder.parse(input);
            doc.getDocumentElement().normalize();
            NodeList nList = doc.getElementsByTagName("entry");

            for (int i = 0; i < nList.getLength(); i++) {
                Node nNode = nList.item(i);
                if (nNode.getNodeType() == Node.ELEMENT_NODE) {
                    Anime anime = new Anime();
                    Element eElement = (Element) nNode;
                    anime.setId(Integer.parseInt(eElement.getElementsByTagName("id").item(0).getTextContent()));
                    anime.setTitle(eElement.getElementsByTagName("title").item(0).getTextContent());
                    anime.setDescription(eElement.getElementsByTagName("synopsis").item(0).getTextContent());
                    anime.setEpisodes(Integer
                            .parseInt(eElement.getElementsByTagName("episodes").item(0).getTextContent()));
                    anime.setImageUrl(eElement.getElementsByTagName("image").item(0).getTextContent());
                    anime.setStartDate(eElement.getElementsByTagName("start_date").item(0).getTextContent());
                    anime.setEndDate(eElement.getElementsByTagName("end_date").item(0).getTextContent());

                    String temp = eElement.getElementsByTagName("status").item(0).getTextContent();
                    if (temp.toLowerCase().contains("finished")) {
                        anime.setStatus(AnimeStatus.FINISHED);
                    } else if (temp.toLowerCase().contains("currently")) {
                        anime.setStatus(AnimeStatus.CURRENTLY_AIRING);
                    }

                    anime.setAirDay(CalculateNextRelease.getAirDay(anime));
                    anime.setType(
                            Anime.TYPE.valueOf(eElement.getElementsByTagName("type").item(0).getTextContent()));
                    animes.add(anime);
                }
            }
        }

    } catch (SAXException | IOException | ParserConfigurationException e) {
        status = STATUS.ERROR;
        e.printStackTrace();
    }
}

From source file:de.qaware.chronix.timeseries.MultivariateTimeSeries.java

public void add(long time, double[] values) {
    if (labels.size() != values.length + 1) // labels include a label for time
        throw new InternalError("ERROR:  The TSValues: " + values + " contains the wrong number of values. "
                + "expected:  " + labels.size() + ", " + "found: " + values.length);

    if ((this.size() > 0) && (time <= times.get(times.size() - 1)))
        throw new InternalError("ERROR:  The point being inserted at the "
                + "end of the time series does not have " + "the correct time sequence. ");

    times.add(time);/*from   ww  w  .  java  2  s  .c  o m*/
    this.values.add(values);
}

From source file:kr.ac.kaist.wala.hybridroid.analysis.resource.AndroidDecompiler.java

private static void permission(String path) {
    String[] cmd = { "chmod", "755", path };
    ProcessBuilder pb = new ProcessBuilder();
    pb.command(cmd);/*from  w w w  .java  2  s . c o m*/

    Process p = null;
    try {
        p = pb.start();
        BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
        BufferedReader bre = new BufferedReader(new InputStreamReader(p.getErrorStream()));
        String r = null;

        while ((r = br.readLine()) != null) {
            System.out.println(r);
        }

        while ((r = bre.readLine()) != null) {
            System.err.println(r);
        }

        int res = p.waitFor();
        if (res != 0) {
            throw new InternalError("failed to decompile: " + path);
        }
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (InterruptedException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}