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:net.sf.firemox.xml.XmlTbs.java

/**
 * Writes the card identified by the given card XML description file name in
 * the given directory to the given OutputStream.
 * /* w  w w. j ava  2s .  c om*/
 * @param currentDir
 *          the directory path to find the card XML description file name
 * @param out
 *          the OutputStream to write the identified card to
 * @param cardFile
 *          the card XML description file name
 */
private static void writeCard(String currentDir, OutputStream out, String cardFile) {
    try {
        XmlConfiguration.parseCard(cardFile, currentDir, out);
    } catch (Throwable e) {
        if (e instanceof StackOverflowError) {
            throw new InternalError(
                    "StackOverflowError writting card, may be you use some recursive actions reference");
        }
        throw new InternalError(e.getMessage());
    }
}

From source file:org.isatools.tablib.mapping.pipeline.GenericProtocolApplicationTabMapper.java

@SuppressWarnings("unchecked")
public ProtocolApplication map(int recordIndex) {
    BIIObjectStore store = getStore();/*from  www . j a  va  2s . co  m*/
    SectionInstance sectionInstance = getSectionInstance();
    int fieldIndex = getFieldIndex();
    Study study = mappingUtils.getStudyFromSection(sectionInstance);
    if (study == null) {
        throw new InternalError("No study found associated to the format/file: "
                + sectionInstance.getParent().getFormat().getId() + "/"
                + sectionInstance.getParent().getFileId());
    }
    String studyAcc = study.getAcc();

    // link the protocol
    //
    ProtocolApplication protocolApp = null;
    Field protoRefField = sectionInstance.getField(fieldIndex);
    String protoRefValue = null;
    Protocol protocol = null;
    if (protoRefField != null) {
        protoRefValue = StringUtils.trimToNull(sectionInstance.getString(recordIndex, fieldIndex));

        // It might happen that there is the protocol ref column but it has empty values.
        if (protoRefValue != null) {
            protocol = (Protocol) store.get(Protocol.class, studyAcc + "\\" + protoRefValue);
            if (protocol == null) {
                throw new TabMissingValueException(
                        i18n.msg("ref_protocol_missing", protoRefValue, study.getAcc()));
            }

            // Now add the Protocol Application
            protocolApp = new ProtocolApplication(protocol);
            protocolApp.setOrder(fieldIndex);
        } else {
            return null;
        }
    } else {
        if (recordIndex == 0) {
            log.warn("No protocol reference in the sample/assay file");
        }
        return null;
    }

    // Additional mappings provided by the property helpers
    for (PropertyMappingHelper pmap : getPropertyHelpers().values()) {
        pmap.map(protocolApp, recordIndex);
    }

    if (protoRefValue != null) {
        TabMappingContext context = store.valueOfType(TabMappingContext.class);
        String usedPref = "used.protocol." + studyAcc + "\\" + protoRefValue;
        context.put(usedPref, protocol);
        for (ParameterValue pval : protocolApp.getParameterValues()) {
            Parameter param = pval.getType();
            context.put(usedPref + "\\" + param.getValue(), param);
        }
    }

    // Add the file it comes from and its type (sample/assay)
    addSourceFileAnnotation(protocolApp);

    log.trace("New mapped Protocol Application: " + protocolApp.hashCode() + "/" + protocolApp);
    return protocolApp;
}

From source file:edu.utah.further.dts.api.domain.namespace.DtsAttributeSet.java

/**
 * Return a deep copy of this object.//w w w.  ja  v  a 2s. c  o  m
 *
 * @return a deep copy of this object
 * @see edu.utah.further.core.api.lang.PubliclyCloneable#copy()
 */
@Override
public DtsAttributeSet copy() {
    try {
        // Could alternatively call CoreUtil.clone(), but reflection is slower
        // than direct invocation
        return (DtsAttributeSet) super.clone();
    } catch (final CloneNotSupportedException e) {
        throw new InternalError("We are cloneable so we shouldn't be here!");
    }
}

From source file:iot.agile.http.resource.DeviceManager.java

@POST
@Path("/find")
public String Find() {
    throw new InternalError("Not implemented");
}

From source file:com.clustercontrol.monitor.view.action.EventModifyMonitorSettingAction.java

/**
 * []????????/* w ww .j a v a 2s  . c o m*/
 * <p>
 * <ol>
 * <li>[]??????????</li>
 * <li>????????? </li>
 * </ol>
 *
 * @see org.eclipse.core.commands.IHandler#execute
 * @see com.clustercontrol.monitor.view.EventView
 * @see com.clustercontrol.monitor.view.EventView#update()
 */
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    this.window = HandlerUtil.getActiveWorkbenchWindow(event);
    // In case this action has been disposed
    if (null == this.window || !isEnabled()) {
        return null;
    }

    // ???
    this.viewPart = HandlerUtil.getActivePart(event);
    ScopeListBaseView view = null;
    try {
        view = (EventView) this.viewPart.getAdapter(EventView.class);
    } catch (Exception e) {
        m_log.info("execute " + e.getMessage());
        return null;
    }

    if (view == null) {
        m_log.info("execute: view is null");
        return null;
    }

    EventListComposite composite = (EventListComposite) view.getListComposite();
    WidgetTestUtil.setTestId(this, null, composite);
    StructuredSelection selection = (StructuredSelection) composite.getTableViewer().getSelection();

    List<?> list = (ArrayList<?>) selection.getFirstElement();

    String managerName = "";
    String pluginId = "";
    String monitorId = "";

    if (list != null) {
        managerName = (String) list.get(POS_MANAER_NAME);
        pluginId = (String) list.get(POS_PLUGIN_ID);
        if (pluginId == null)
            throw new InternalError("pluginId is null.");

        monitorId = (String) list.get(POS_MONITOR_ID);

        if (monitorId != null) {
            // ???
            MonitorModifyAction mmAction = new MonitorModifyAction();
            // ???????????
            if (mmAction.dialogOpen(composite.getShell(), managerName, pluginId,
                    monitorId) == IDialogConstants.OK_ID) {
                composite.update();
            }
        }
    }
    return null;
}

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

/**
 * Saves data into {@link #dataFile}. This method is called by other static methods of this
 * class after modifying any data.//from  w  w  w  .  j  ava 2s  .com
 */
private static void save() {
    FileOutputStream fileStream = null;
    try {
        fileStream = new FileOutputStream(dataFile);
        xStream.toXML(instance, fileStream);
    } catch (FileNotFoundException e) {
        throw new InternalError(e.getMessage());
    } finally {
        if (fileStream != null)
            try {
                fileStream.close();
            } catch (IOException e) {
                // oops failed to close stream
            }
    }
}

From source file:com.clustercontrol.repository.view.action.ScopeAddAction.java

@Override
public void updateElement(UIElement element, @SuppressWarnings("rawtypes") Map parameters) {
    IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    // page may not start at state restoring
    if (null != window) {
        IWorkbenchPage page = window.getActivePage();
        if (null != page) {
            //IWorkbenchPart part = page.findView(ScopeListView.ID); // TODO Check why this caused error on RAP. RAP bug?
            IViewReference viewRef = page.findViewReference(ScopeListView.ID);

            if (viewRef == null)
                throw new InternalError("viewRef is null.");

            IViewPart part = viewRef.getView(false);

            boolean editEnable = false;
            if (part instanceof ScopeListView) {
                // Enable button when 1 item is selected
                ScopeListView view = (ScopeListView) part;

                if (view.getBuiltin() == false && (view.getScopeTreeComposite().getTree().isFocusControl()
                        || view.getComposite().getTable().isFocusControl())) {

                    switch (view.getType()) {
                    case FacilityConstant.TYPE_COMPOSITE:
                        break;
                    case FacilityConstant.TYPE_MANAGER:
                        editEnable = true;
                        break;
                    case FacilityConstant.TYPE_SCOPE:
                        editEnable = !view.getNotReferFlg();
                        break;
                    case FacilityConstant.TYPE_NODE:
                        break;
                    default: // ??
                        break;
                    }//from ww  w . ja v  a2  s. c  om
                }
            }
            this.setBaseEnabled(editEnable);
        }
    }
}

From source file:org.wso2.carbon.identity.sso.saml.builders.ArtifactMessageBuilder.java

/**
 * Build the SAML V2.0 Artifact type of Type Code 0x0004
 * Artifact length : 44 bytes//from  ww  w . ja  v  a2  s.c  om
 *
 * SAML V2.0 defines an artifact type of type code 0x0004
 * Identification:urn:oasis:names:tc:SAML:2.0:artifact-04
 *
 * SAML_artifact := B64(TypeCode EndpointIndex RemainingArtifact)
 * TypeCode := Byte1Byte2
 * EndpointIndex := Byte1Byte2
 *
 * TypeCode := 0x0004
 * RemainingArtifact := SourceID MessageHandle
 * SourceID := 20-byte_sequence
 * MessageHandle := 20-byte_sequence
 *
 * @return SAML V2.0 Artifact type of Type Code 0x0004
 */
// TODO use Interface type as the return type

public SAML2ArtifactType0004 buildArtifact() throws IdentityException {

    try {
        String issuerID = SAMLSSOUtil.getIssuer().getValue();
        int assertionConsumerServiceIndex = 0x0000;

        byte[] endpointIndex = DatatypeHelper.intToByteArray(assertionConsumerServiceIndex);
        byte[] trimmedIndex = new byte[2];
        trimmedIndex[0] = endpointIndex[2];
        trimmedIndex[1] = endpointIndex[3];

        MessageDigest sha1Digester = MessageDigest.getInstance("SHA-1");
        byte[] sourceID = sha1Digester.digest(issuerID.getBytes());
        // TODO trim/pad as necessary to make sourceID 20 bytes

        SecureRandom handleGenerator = SecureRandom.getInstance("SHA1PRNG");
        byte[] messageHandle;
        messageHandle = new byte[20];
        handleGenerator.nextBytes(messageHandle);

        return new SAML2ArtifactType0004(trimmedIndex, sourceID, messageHandle);
    } catch (NoSuchAlgorithmException e) {
        log.error("JVM does not support required cryptography algorithms: SHA-1/SHA1PRNG.", e);
        throw new InternalError("JVM does not support required cryptography algorithms: SHA-1/SHA1PRNG.");
    }
}

From source file:edu.cornell.med.icb.geo.tools.GEOPlatform.java

/**
 * Read the platform information from a GEO platform file.
 *
 * @param filename// w  w  w  .  j a v  a 2s  .  c  o m
 * @throws SyntaxErrorException
 * @throws IOException
 */
public void read(final String filename) throws SyntaxErrorException, IOException {
    if (filename == null) {
        return;
    }
    final GeoPlatformFileReader reader = new GeoPlatformFileReader();
    final Reader lowLevelReader;
    if (filename.endsWith(".gz")) {
        lowLevelReader = new InputStreamReader(new GZIPInputStream(new FileInputStream(filename)));
    } else {
        lowLevelReader = new FileReader(filename);
    }

    final Table platformFileContent = reader.read(lowLevelReader);
    final Table.RowIterator ri = platformFileContent.firstRow();

    int probeSetIdColumnIndex = -1;
    int genbankAcColumnIndex = -1;
    int genbankListColumnIndex = -1;
    int genbankColumnIndex = -1;
    final String probeIdColumnName = "ID";
    final String genbankAcColumnName = "GB_ACC";
    final String genbankListColumnName = "GB_LIST";

    try {
        probeSetIdColumnIndex = platformFileContent.getColumnIndex(probeIdColumnName);
    } catch (InvalidColumnException e) {
        assert false;
    }
    try {
        genbankAcColumnIndex = platformFileContent.getColumnIndex(genbankAcColumnName);
    } catch (InvalidColumnException e) { // NOPMD
        // OK, see below.
    }
    try {
        genbankListColumnIndex = platformFileContent.getColumnIndex(genbankListColumnName);
    } catch (InvalidColumnException e) { // NOPMD
        // OK, see below.
    }

    genbankColumnIndex = (genbankListColumnIndex != -1 ? genbankListColumnIndex : genbankAcColumnIndex);
    if (probeSetIdColumnIndex == -1 || genbankColumnIndex == -1) {
        throw new SyntaxErrorException(0,
                "One of the following column names could not be found in the platformFileContent description file: "
                        + probeIdColumnName + ", (at least one of : " + genbankAcColumnName + ", "
                        + genbankListColumnName + " ).");
    }

    int count = 0;

    while (!ri.end()) {
        try {
            final String probesetId = (String) platformFileContent.getValue(probeSetIdColumnIndex, ri);
            final String genbankAccession = (String) platformFileContent.getValue(genbankColumnIndex, ri);
            probesetId2GenbankList.put(probesetId, genbankAccession);
            count++;
        } catch (TypeMismatchException e) {
            throw new InternalError("Column type does not match" + e.getMessage());
        } catch (InvalidColumnException e) {
            throw new InternalError("Should never happen");

        }
        ri.next();
    }
    this.count = count;
}

From source file:org.metaabm.commands.SetLabelCommand.java

public List<TargetTranslator> translatorsFor(IID source, EStructuralFeature feature) {
    if (feature == MetaABMPackage.Literals.IID__LABEL) {
        if (source instanceof SAgent && (((SAgent) source).getOwner() == null || ((SAgent) source).getOwner()
                .getImplementation().getMode() != SImplementationMode.GENERATE_LITERAL)) {
            return TargetTranslator.NAMED_IMPLEMENTED_TRANSLATORS;
        } else if (source instanceof SAgent) {
            return TargetTranslator.AGENT_TRANSLATORS;
        } else if (source instanceof SProjection) {
            return TargetTranslator.SAPCE_TRANSLATORS;
        } else if (source instanceof SImplemented && source instanceof SNamed) {
            return TargetTranslator.NAMED_IMPLEMENTED_TRANSLATORS;
        } else if (source instanceof SImplemented) {
            return TargetTranslator.IMPLEMENTED_TRANSLATORS;
        } else if (source instanceof SNamed) {
            return TargetTranslator.NAMED_TRANSLATORS;
        } else if (source instanceof IID) {
            return TargetTranslator.ID_TRANSLATORS;
        }/*w w  w.j a va  2  s  .  co  m*/
    } else if (feature == MetaABMPackage.Literals.SNAMED__PLURAL_LABEL) {
        if (source instanceof SContext && ((SAgent) source).getOwner() != null && ((SAgent) source).getOwner()
                .getImplementation().getMode() == SImplementationMode.GENERATE_LITERAL) {
            return TargetTranslator.PLURAL_TRANSLATORS;
        } else {
            return new ArrayList<TargetTranslator>();
        }
    }
    throw new InternalError("Should not be possible to reach this line.");
}