Example usage for java.lang UnknownError UnknownError

List of usage examples for java.lang UnknownError UnknownError

Introduction

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

Prototype

public UnknownError() 

Source Link

Document

Constructs an UnknownError with no detail message.

Usage

From source file:org.apache.webdav.ui.WebdavSystemView.java

public void disconnect() throws java.lang.UnknownError {
    try {//from w  w w.  j a va2 s.  c  o m
        this.webdavResource.close();
    } catch (Exception e) {
        System.err.println(e.toString());
        throw new UnknownError();
    }
}

From source file:de.topicmapslab.majortom.server.topicmaps.TopicMapsHandler.java

/**
 * {@inheritDoc}/* w  w  w  .  ja va 2  s.c om*/
 */
@Override
public String createTopicMap(String baseLocator, boolean inMemory, int initialCapacity)
        throws ServletException {

    TopicMapSystem tms = null;

    if (inMemory) {
        tms = getMemoryTopicMapSystem(initialCapacity);
    } else {
        tms = getDBTopicMapSystem();
    }

    // try if topic map already exists
    TopicMap tm = tms.getTopicMap(baseLocator);

    if (tm == null) {
        try {
            tm = tms.createTopicMap(baseLocator);
        } catch (TopicMapExistsException e) {
            // should never happen
            logger.error("Topic Map with Base Locator: " + baseLocator + " exists");
            throw new UnknownError();
        }

        // create id with md5 of baselocator
        String id = null;
        id = MD5Util.calculateMD5(baseLocator);

        // put the id to the map
        topicMapMap.put(id, tm);

        return id;
    }
    return (String) topicMapMap.getKey(tm);
}

From source file:im.r_c.android.dbox.SQLBuilder.java

static ContentValues buildContentValues(TableInfo tableInfo, Object obj) {
    ContentValues values = new ContentValues();
    for (ColumnInfo ci : tableInfo.mColumnMap.values()) {
        if (TableInfo.COLUMN_ID.equals(ci.mName)) {
            continue;
        }/*from  www. j a  v  a 2s.  c  o m*/

        try {
            switch (ci.mType) {
            case ColumnInfo.TYPE_BOOLEAN:
                values.put(ci.mName, ci.mField.getBoolean(obj) ? 1 : 0);
                break;
            case ColumnInfo.TYPE_BYTE:
                values.put(ci.mName, ci.mField.getByte(obj));
                break;
            case ColumnInfo.TYPE_SHORT:
                values.put(ci.mName, ci.mField.getShort(obj));
                break;
            case ColumnInfo.TYPE_INT:
                values.put(ci.mName, ci.mField.getInt(obj));
                break;
            case ColumnInfo.TYPE_LONG:
                values.put(ci.mName, ci.mField.getLong(obj));
                break;
            case ColumnInfo.TYPE_FLOAT:
                values.put(ci.mName, ci.mField.getFloat(obj));
                break;
            case ColumnInfo.TYPE_DOUBLE:
                values.put(ci.mName, ci.mField.getDouble(obj));
                break;
            case ColumnInfo.TYPE_STRING:
                values.put(ci.mName, (String) ci.mField.get(obj));
                break;
            case ColumnInfo.TYPE_DATE:
                Date date = (Date) ci.mField.get(obj);
                values.put(ci.mName, date.getTime());
                break;
            case ColumnInfo.TYPE_BYTE_ARRAY:
                values.put(ci.mName, (byte[]) ci.mField.get(obj));
                break;
            }
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        }
    }

    if (values.size() != tableInfo.mColumnMap.size() - 1) {
        // "values" contains all column values of the table except "id",
        // so normally this block will NEVER be executed.
        throw new UnknownError();
    }

    return values;
}