Example usage for java.util Arrays deepToString

List of usage examples for java.util Arrays deepToString

Introduction

In this page you can find the example usage for java.util Arrays deepToString.

Prototype

public static String deepToString(Object[] a) 

Source Link

Document

Returns a string representation of the "deep contents" of the specified array.

Usage

From source file:org.n52.ifgicopter.spf.input.GpxInputPlugin.java

/**
 * /*from   ww  w .  j  a  va  2 s. c o m*/
 */
private void innerRun() {
    if (this.wptIter == null)
        return;

    if (this.wptIter.hasNext()) {
        WptType currentWaypoint = this.wptIter.next();

        Map<String, Object> newDataSet = getDataSet(currentWaypoint);

        log.debug("SENDING DATA: " + Arrays.deepToString(newDataSet.entrySet().toArray()));
        this.newData.add(newDataSet);

        this.counter++;
        this.statusString = this.counter + " of " + this.wayPoints.size() + " waypoints processed.";
        makeStatusLabel();
    } else {
        log.info("No more waypoints!");
        this.status = STATUS_NOT_RUNNING;
        stop(); // already sets a status, overwrite again:
        this.statusString = "No more waypoints!";
        makeStatusLabel();
    }
}

From source file:com.celements.menu.MenuService.java

private void addMenuItems(TreeMap<Integer, BaseObject> menuItemsMap, Integer headerId) {
    try {//from ww w  .j  a  v a2  s  .  c o m
        List<Object[]> result = queryManager.createQuery(getSubItemsXWQL(), Query.XWQL)
                .bindValue("headerId", headerId).execute();
        if (LOGGER.isTraceEnabled()) {
            LOGGER.trace("addMenuItems received for " + getContext().getDatabase() + ": "
                    + Arrays.deepToString(result.toArray()));
        }
        for (Object[] resultObj : result) {
            String fullName = resultObj[0].toString();
            int objectNr = Integer.parseInt(resultObj[1].toString());
            DocumentReference menuBarDocRef = webUtilsService.resolveDocumentReference(fullName);
            BaseObject obj = getContext().getWiki().getDocument(menuBarDocRef, getContext()).getXObject(
                    getMenuBarSubItemClassRef(menuBarDocRef.getWikiReference().getName()), objectNr);
            menuItemsMap.put(obj.getIntValue("itempos"), obj);
        }
    } catch (XWikiException e) {
        LOGGER.error(e);
    } catch (QueryException e) {
        LOGGER.error(e);
    }
}

From source file:com.adobe.acs.commons.util.TypeUtil.java

private static String toStringFromArray(final Object obj) {
    if (obj instanceof Object[]) {
        return Arrays.deepToString((Object[]) obj);
    } else if (obj instanceof boolean[]) {
        return Arrays.toString((boolean[]) obj);
    } else if (obj instanceof byte[]) {
        return Arrays.toString((byte[]) obj);
    } else if (obj instanceof short[]) {
        return Arrays.toString((short[]) obj);
    } else if (obj instanceof char[]) {
        return Arrays.toString((char[]) obj);
    } else if (obj instanceof int[]) {
        return Arrays.toString((int[]) obj);
    } else if (obj instanceof long[]) {
        return Arrays.toString((long[]) obj);
    } else if (obj instanceof float[]) {
        return Arrays.toString((float[]) obj);
    } else if (obj instanceof double[]) {
        return Arrays.toString((double[]) obj);
    }/*from   www  . j  ava2  s . c  om*/

    log.warn("Object is not an Array");

    return null;
}

From source file:org.springframework.data.crate.core.CrateTemplate.java

@Override
public <T> BulkOperartionResult<T> execute(CrateBulkAction action, CrateBulkActionResponseHandler<T> handler)
        throws DataAccessException {

    notNull(action, "An implementation of CrateBulkAction is required");
    notNull(action.getActionType(), "Action Type is required");
    notNull(handler, "An implementation of CrateBulkActionResponseHandler<T> is required");

    if (!ALLOWED_BULK_OPERATIONS.contains(action.getActionType())) {
        throw new CrateSQLActionException(format(BULK_ACTION, action.getActionType(), ALLOWED_BULK_OPERATIONS));
    }//w  w w .  j  a va2s.c o  m

    try {
        SQLBulkRequest request = action.getSQLRequest();
        if (logger.isDebugEnabled()) {
            logger.debug(SQL_STATEMENT, request.stmt(), Arrays.deepToString(request.bulkArgs()));
        }
        return handler.handle(client.bulkSql(request).get());
    } catch (SQLActionException e) {
        throw tryConvertingRuntimeException(e);
    } catch (InterruptedException e) {
        throw new CrateSQLActionException(e.getMessage(), e);
    } catch (ExecutionException e) {
        throw new CrateSQLActionException(e.getMessage(), e);
    }
}

From source file:com.github.drochetti.javassist.maven.ClassTransformer.java

private void debugClassLoader(final ClassPool classPool) {
    if (!logger.isDebugEnabled()) {
        return;/*  w w  w .  ja v a  2 s.c o  m*/
    }
    logger.debug(" - classPool: " + classPool.toString());
    ClassLoader classLoader = classPool.getClassLoader();
    while (classLoader != null) {
        logger.debug(" -- " + classLoader.getClass().getName() + ": " + classLoader.toString());
        if (classLoader instanceof URLClassLoader) {
            logger.debug(" --- urls: " + Arrays.deepToString(((URLClassLoader) classLoader).getURLs()));
        }
        classLoader = classLoader.getParent();
    }
}

From source file:org.n52.ifgicopter.spf.input.FakeInputPlugin.java

/**
 * // ww  w .ja va2 s. co  m
 */
private void innerRun() {
    Map<String, Object> newDataSet = new HashMap<String, Object>();

    Point p = getNextPosition();
    Date now = new Date();

    newDataSet.put("time", Long.valueOf(now.getTime()));
    newDataSet.put("latitude", Double.valueOf(p.getCoordinate().y));
    newDataSet.put("longitude", Double.valueOf(p.getCoordinate().x));
    newDataSet.put("altitude", Double.valueOf(p.getCoordinate().z));

    /*
     * http://en.wikipedia.org/wiki/Altitude#Relation_between_temperature_and_altitude_in_Earth.27s_atmosphere
     * 
     * temperature lapse rate: 6.49 K(C)/1,000m --> 0.00649 K / 1m
     */
    double t = this.initialTemperature + 0.00649 * p.getCoordinate().z;

    // a little bit randomization
    double value2 = getPollutantValue(p.getCoordinate().y, p.getCoordinate().x, p.getCoordinate().z);

    newDataSet.put("temperature", Double.valueOf(t));
    newDataSet.put("pollutant", Double.valueOf(value2));

    log.debug("SENDING DATA: " + Arrays.deepToString(newDataSet.entrySet().toArray()));
    this.newData.add(newDataSet);

    makeStatusLabel();
    this.counter++;
}

From source file:edu.cornell.mannlib.vitro.webapp.controller.VitroHttpServlet.java

/**
 * A child class may call this if logging is set to debug level.
 *//*w  ww  .ja  v a 2s  .  c o  m*/
protected void dumpRequestParameters(HttpServletRequest req) {
    Log subclassLog = LogFactory.getLog(this.getClass());

    @SuppressWarnings("unchecked")
    Map<String, String[]> map = req.getParameterMap();

    for (String key : map.keySet()) {
        String[] values = map.get(key);
        subclassLog.debug("Parameter '" + key + "' = " + Arrays.deepToString(values));
    }
}

From source file:org.apache.rya.mongodb.document.util.DisjunctiveNormalFormConverter.java

/**
 * Creates the inputs needed to populate a truth table based on the provided
 * number of terms that the expression uses. So, entering 3 for the number
 * of terms will create a 3 x 8 size table:
 * <pre>//from www  .  j  ava  2 s. co m
 * 0 0 0
 * 0 0 1
 * 0 1 0
 * 0 1 1
 * 1 0 0
 * 1 0 1
 * 1 1 0
 * 1 1 1
 * </pre>
 * @param termNumber the number of terms.
 * @return a two-dimensional array of bytes representing the truth table
 * inputs.  The table will be of size: [termNumber] x [2 ^ termNumber]
 */
public static byte[][] createTruthTableInputs(final int termNumber) {
    final int numColumns = termNumber;
    final int numRows = (int) Math.pow(2, numColumns);
    final byte[][] truthTable = new byte[numRows][numColumns];

    for (int row = 0; row < numRows; row++) {
        for (int col = 0; col < numColumns; col++) {
            // We're starting from the top-left and going right then down to
            // the next row. The left-side is of a higher order than the
            // right-side so adjust accordingly.
            final int digitOrderPosition = numColumns - 1 - col;
            final int power = (int) Math.pow(2, digitOrderPosition);
            final int toggle = (row / power) % 2;
            truthTable[row][col] = (byte) toggle;
        }
    }

    log.trace("Truth table inputs: " + Arrays.deepToString(truthTable));

    return truthTable;
}

From source file:org.apache.zeppelin.submarine.hadoop.YarnClient.java

public Map<String, Object> getClusterApps(String appId) {
    Map<String, Object> appAttempts = new HashMap<>();
    String appUrl = this.yarnWebHttpAddr + "/ws/v1/cluster/apps/" + appId + "?_=" + System.currentTimeMillis();

    InputStream inputStream = null;
    try {/*ww  w . j  a  v  a  2s .  c  o m*/
        HttpResponse response = callRestUrl(appUrl, principal, HTTP.GET);
        inputStream = response.getEntity().getContent();
        String result = new BufferedReader(new InputStreamReader(inputStream)).lines()
                .collect(Collectors.joining(System.lineSeparator()));
        if (response.getStatusLine().getStatusCode() != 200 /*success*/) {
            LOGGER.warn("Status code " + response.getStatusLine().getStatusCode());
            LOGGER.warn("message is :" + Arrays.deepToString(response.getAllHeaders()));
            LOGGER.warn("result\n" + result);
        }
        // parse app status json
        appAttempts = parseClusterApps(result);

        return appAttempts;
    } catch (Exception exp) {
        exp.printStackTrace();
    } finally {
        try {
            if (null != inputStream) {
                inputStream.close();
            }
        } catch (Exception e) {
            LOGGER.error(e.getMessage(), e);
        }
    }

    return appAttempts;
}

From source file:org.freedesktop.dbus.Message.java

/**
 * Create a message from wire-format data.
 * /* w ww  . j  a va 2  s.co m*/
 * @param msg
 *            D-Bus serialized data of type yyyuu
 * @param hdrs
 *            D-Bus serialized data of type a(yv)
 * @param bdy
 *            D-Bus serialized data of the signature defined in headers.
 */
@SuppressWarnings("unchecked")
void populate(byte[] msg, byte[] hdrs, byte[] bdy) throws DBusException {
    this.big = (msg[0] == Endian.BIG);
    this.type = msg[1];
    this.flags = msg[2];
    this.protover = msg[3];
    this.wiredata[0] = msg;
    this.wiredata[1] = hdrs;
    this.wiredata[2] = bdy;
    this.body = bdy;
    this.bufferuse = 3;
    this.bodylen = ((Number) extract(Message.ArgumentType.UINT32_STRING, msg, 4)[0]).longValue();
    this.serial = ((Number) extract(Message.ArgumentType.UINT32_STRING, msg, 8)[0]).longValue();
    this.bytecounter = msg.length + hdrs.length + bdy.length;

    if (log.isTraceEnabled()) {
        log.trace(hdrs);
    }
    Object[] hs = extract("a(yv)", hdrs, 0);

    if (log.isTraceEnabled()) {
        log.trace(Arrays.deepToString(hs));
    }
    for (Object o : (Vector<Object>) hs[0]) {
        this.headers.put((Byte) ((Object[]) o)[0], ((Variant<Object>) ((Object[]) o)[1]).getValue());
    }
}