Search in sources :

Example 26 with AtlasException

use of org.apache.jena.atlas.AtlasException in project jena by apache.

the class NumberUtils method formatUnsignedInt$.

// No checking.  char[] filled backwards
private static int formatUnsignedInt$(char[] b, int x, int width) {
    // x >= 0 
    // Inserts chars backwards
    int idx = 0;
    while (width > 0) {
        int i = x % 10;
        char ch = Chars.digits10[i];
        b[idx] = ch;
        width--;
        idx++;
        x = x / 10;
        if (x == 0)
            break;
    }
    if (x != 0)
        throw new AtlasException("formatInt: overflow[x=" + x + ", width=" + width + "]");
    while (width > 0) {
        b[idx] = '0';
        idx++;
        width--;
    }
    return width;
}
Also used : AtlasException(org.apache.jena.atlas.AtlasException)

Example 27 with AtlasException

use of org.apache.jena.atlas.AtlasException in project jena by apache.

the class JSONInputIterator method nextToken.

protected final Token nextToken() {
    if (eof())
        return tokenEOF;
    // Tokenizer errors appear here!
    try {
        Token t = peekIter.next();
        currLine = t.getLine();
        currCol = t.getColumn();
        return t;
    } catch (RiotParseException ex) {
        // Intercept to log it.
        raiseException(ex);
        throw ex;
    } catch (AtlasException ex) {
        // Bad I/O
        RiotParseException ex2 = new RiotParseException(ex.getMessage(), -1, -1);
        raiseException(ex2);
        throw ex2;
    }
}
Also used : RiotParseException(org.apache.jena.riot.RiotParseException) Token(org.apache.jena.riot.tokens.Token) AtlasException(org.apache.jena.atlas.AtlasException)

Aggregations

AtlasException (org.apache.jena.atlas.AtlasException)27 IOException (java.io.IOException)5 FileNotFoundException (java.io.FileNotFoundException)4 File (java.io.File)3 InputStream (java.io.InputStream)3 RiotParseException (org.apache.jena.riot.RiotParseException)3 OutputStream (java.io.OutputStream)2 ArrayList (java.util.ArrayList)2 Token (org.apache.jena.riot.tokens.Token)2 BufferedInputStream (java.io.BufferedInputStream)1 FileInputStream (java.io.FileInputStream)1 FileOutputStream (java.io.FileOutputStream)1 Iterator (java.util.Iterator)1 InStreamUTF8 (org.apache.jena.atlas.io.InStreamUTF8)1 InputStreamBuffered (org.apache.jena.atlas.io.InputStreamBuffered)1 IteratorResourceClosing (org.apache.jena.atlas.iterator.IteratorResourceClosing)1 ProgressMonitor (org.apache.jena.atlas.lib.ProgressMonitor)1 BlockMgr (org.apache.jena.tdb.base.block.BlockMgr)1 FileSet (org.apache.jena.tdb.base.file.FileSet)1 Location (org.apache.jena.tdb.base.file.Location)1