Example usage for jdk.nashorn.internal.objects NativeArray size

List of usage examples for jdk.nashorn.internal.objects NativeArray size

Introduction

In this page you can find the example usage for jdk.nashorn.internal.objects NativeArray size.

Prototype

public int size() 

Source Link

Document

Return the size of the ScriptObject - i.e.

Usage

From source file:com.asual.lesscss.compiler.NashornCompiler.java

License:Apache License

private Exception parseLessException(Exception root) {
    logger.debug("Parsing LESS Exception", root);
    if (root instanceof ECMAException) {
        ECMAException e = (ECMAException) root;
        Object thrown = e.getThrown();
        String type = null;//from   w  w  w .jav a2s  . c  o  m
        String message = null;
        String filename = null;
        int line = -1;
        int column = -1;
        List<String> extractList = new ArrayList<String>();
        if (thrown instanceof ScriptObject) {
            ScriptObject so = (ScriptObject) e.getThrown();
            type = so.get("type").toString() + " Error";
            message = so.get("message").toString();
            filename = "";
            if (so.has("filename")) {
                filename = so.get("filename").toString();
            }
            if (so.has("line")) {
                line = ((Long) so.get("line")).intValue();
            }
            if (so.has("column")) {
                column = ((Double) so.get("column")).intValue();
            }
            if (so.has("extract")) {
                NativeArray extract = (NativeArray) so.get("extract");
                for (int i = 0; i < extract.size(); i++) {
                    if (extract.get(i) instanceof String) {
                        extractList.add(((String) extract.get(i)).replace("\t", " "));
                    }
                }
            }
        } else {
            type = thrown.getClass().getSimpleName() + " Error";
            message = e.getMessage().replaceFirst("[^:]+: ", "");
        }
        return new LessException(message, type, filename, line, column, extractList);
    }
    return root;
}

From source file:org.jcruncher.less.LessProcessor.java

License:Apache License

private Exception parseLessException(Exception root) {
    //logger.debug("Parsing LESS Exception", root);
    if (root instanceof ECMAException) {
        ECMAException e = (ECMAException) root;
        Object thrown = e.getThrown();
        String type = null;//from www .j  a  v  a 2s  .  c  om
        String message = null;
        String filename = null;
        int line = -1;
        int column = -1;
        List<String> extractList = new ArrayList<String>();
        if (thrown instanceof ScriptObject) {
            ScriptObject so = (ScriptObject) e.getThrown();
            type = so.get("type").toString() + " Error";
            message = so.get("message").toString();
            filename = "";
            if (so.has("filename")) {
                filename = so.get("filename").toString();
            }
            if (so.has("line")) {
                line = ((Long) so.get("line")).intValue();
            }
            if (so.has("column")) {
                column = ((Double) so.get("column")).intValue();
            }
            if (so.has("extract")) {
                NativeArray extract = (NativeArray) so.get("extract");
                for (int i = 0; i < extract.size(); i++) {
                    if (extract.get(i) instanceof String) {
                        extractList.add(((String) extract.get(i)).replace("\t", " "));
                    }
                }
            }
        } else {
            type = thrown.getClass().getSimpleName() + " Error";
            message = e.getMessage().replaceFirst("[^:]+: ", "");
        }
        return new LessException(message, type, filename, line, column, extractList);
    }
    return root;
}

From source file:org.nuxeo.video.tools.operations.VideoConcatDemuxerOp.java

License:Open Source License

@OperationMethod
public Blob run(NativeArray inDocs) throws ClientException, IOException, CommandNotAvailable {

    DocumentModelListImpl dml = new DocumentModelListImpl();
    for (int i = 0; i < inDocs.size(); ++i) {
        dml.add((DocumentModel) inDocs.get(i));
    }/*w  ww.j a  v  a 2 s . c om*/

    return run(dml);
}