Example usage for android.util Log w

List of usage examples for android.util Log w

Introduction

In this page you can find the example usage for android.util Log w.

Prototype

public static int w(String tag, Throwable tr) 

Source Link

Usage

From source file:be.uclouvain.multipathcontrol.stats.JSONSenderTask.java

@Override
protected Collection<String> doInBackground(JSONSender... jsonSenders) {
    // list of name of prefs that have to be removed
    if (httpClient == null)
        return null;

    Collection<String> collection = new ArrayList<String>(jsonSenders.length);
    for (JSONSender jsonSender : jsonSenders) {
        Log.d(Manager.TAG, "Try sending: " + jsonSender.getName() + " - " + jsonSender.getCategory());

        // remove it also is we had problem when creating JSONSender object
        if (jsonSender.getJSONObject() == null || jsonSender.send(httpClient)) {
            Log.d(Manager.TAG, "To be cleared: " + jsonSender.getName());
            collection.add(jsonSender.getName());
            jsonSender.clear();/*w w  w.j  a  va  2s  . co m*/
        } else {
            Log.w(Manager.TAG, "Not able to send: " + jsonSender.getName());
        }
    }
    return collection;
}

From source file:com.hemou.android.util.StrUtils.java

public static String obj2Str(Object obj) {
    String str;//from www. j av a2s  .  c om
    try {
        str = new ObjectMapper().writeValueAsString(obj);
    } catch (Exception e) {
        Log.w("Obj2Str", "Can not convert for?" + e.getMessage() + "");
        str = obj == null ? "null" : obj.toString();
    }
    return str;
}

From source file:es.udc.fic.android.robot_control.robot.ConectorPlaca.java

public boolean escribir(EstadoRobot c) {
    boolean salida = false;
    if (c != null) {
        Log.i(C.ROBOT_TAG, "Enviando Comando [ " + c.toString() + " ]");
        try {/*from  ww w.jav a 2 s  .  c o m*/
            byte[] m = c.mensaje();
            StringBuffer sb = new StringBuffer();
            for (int x = 0; x < m.length; x++) {
                sb.append(String.valueOf(m[x]));
                sb.append(" ");
            }
            Log.i(C.ROBOT_TAG, "En el cable [ " + sb.toString() + " ]");
            int result = connection.bulkTransfer(endpointOUT, m, m.length, 1000);
            Log.i(C.ROBOT_TAG, "Resultado de escritura [ " + result + " ]");
            salida = (result >= 0);
        } catch (Exception ex) {
            Log.w("Error enviando datos al robot ", ex);
            salida = false;
        }
    } else {
        Log.w(C.ROBOT_TAG, "Nada que enviar. Se ha intentado enviar un estado nulo");
    }
    return salida;
}

From source file:com.android.vending.licensing.i.java

private void a(String paramString) {
    try {// w  w w  .j  a  v  a  2s. c o  m
        Long localLong2 = Long.valueOf(Long.parseLong(paramString));
        localLong1 = localLong2;
        this.m = localLong1.longValue();
        this.s.a("validityTimestamp", paramString);
        return;
    } catch (NumberFormatException localNumberFormatException) {
        while (true) {
            Log.w("ServerManagedPolicy", "License validity timestamp (VT) missing, caching for a minute");
            Long localLong1 = Long.valueOf(60000L + System.currentTimeMillis());
            paramString = Long.toString(localLong1.longValue());
        }
    }
}

From source file:eu.alefzero.owncloud.files.services.InstantUploadService.java

@Override
public int onStartCommand(Intent intent, int flags, int startId) {
    if (intent == null || !intent.hasExtra(KEY_ACCOUNT) || !intent.hasExtra(KEY_DISPLAY_NAME)
            || !intent.hasExtra(KEY_FILE_PATH) || !intent.hasExtra(KEY_FILE_SIZE)
            || !intent.hasExtra(KEY_MIME_TYPE)) {
        Log.w(TAG, "Not all required information was provided, abording");
        return Service.START_NOT_STICKY;
    }/*from   w ww.j av  a  2 s . c o  m*/

    if (mUploaderRunnable == null) {
        mUploaderRunnable = new UploaderRunnable();
    }

    String filename = intent.getStringExtra(KEY_DISPLAY_NAME);
    String filepath = intent.getStringExtra(KEY_FILE_PATH);
    String mimetype = intent.getStringExtra(KEY_MIME_TYPE);
    Account account = intent.getParcelableExtra(KEY_ACCOUNT);
    long filesize = intent.getLongExtra(KEY_FILE_SIZE, -1);

    mUploaderRunnable.addElementToQueue(filename, filepath, mimetype, filesize, account);

    // starting new thread for new download doesnt seems like a good idea
    // maybe some thread pool or single background thread would be better
    Log.d(TAG, "Starting instant upload thread");
    new Thread(mUploaderRunnable).start();

    return Service.START_STICKY;
}

From source file:com.amazon.android.model.translators.ContentTranslator.java

/**
 * Explicitly sets a member variable named field to the given value. If the field does not
 * match one of {@link Content}'s predefined field names, the field and value will be stored in
 * the {@link Content#mExtras} map./*from ww w .j a v a 2s. c om*/
 *
 * @param model The {@link Content} to set the field on.
 * @param field The {@link String} describing what member variable to set.
 * @param value The {@link Object} value to set the member variable.
 * @return True if the value was set, false if there was an error.
 */
@Override
public boolean setMemberVariable(Content model, String field, Object value) {

    if (model == null || field == null || field.isEmpty()) {
        Log.e(TAG, "Input parameters should not be null and field cannot be empty.");
        return false;
    }
    // This allows for some content to have extra values that others might not have.
    if (value == null) {
        Log.w(TAG, "Value for " + field + " was null so not set for Content, this may be " + "intentional.");
        return true;
    }
    try {
        switch (field) {
        case Content.TITLE_FIELD_NAME:
            model.setTitle(value.toString());
            break;
        case Content.DESCRIPTION_FIELD_NAME:
            model.setDescription(value.toString());
            break;
        case Content.ID_FIELD_NAME:
            model.setId(value.toString());
            break;
        case Content.SUBTITLE_FIELD_NAME:
            model.setSubtitle(value.toString());
            break;
        case Content.URL_FIELD_NAME:
            model.setUrl(value.toString());
            break;
        case Content.CARD_IMAGE_URL_FIELD_NAME:
            model.setCardImageUrl(value.toString());
            break;
        case Content.BACKGROUND_IMAGE_URL_FIELD_NAME:
            model.setBackgroundImageUrl(value.toString());
            break;
        case Content.TAGS_FIELD_NAME:
            // Expecting value to be a list.
            model.setTags(value.toString());
            break;
        case Content.CLOSED_CAPTION_FIELD_NAME:
            model.setCloseCaptionUrls((List) value);
            break;
        case Content.RECOMMENDATIONS_FIELD_NAME:
            // Expecting value to be a list.
            model.setRecommendations(value.toString());
            break;
        case Content.AVAILABLE_DATE_FIELD_NAME:
            model.setAvailableDate(value.toString());
            break;
        case Content.SUBSCRIPTION_REQUIRED_FIELD_NAME:
            model.setSubscriptionRequired((boolean) value);
            break;
        case Content.CHANNEL_ID_FIELD_NAME:
            model.setChannelId(value.toString());
            break;
        case Content.DURATION_FIELD_NAME:
            model.setDuration(Long.valueOf((String) value));
            break;
        case Content.AD_CUE_POINTS_FIELD_NAME:
            model.setAdCuePoints((List) value);
            break;
        case Content.STUDIO_FIELD_NAME:
            model.setStudio(value.toString());
            break;
        case Content.FORMAT_FIELD_NAME:
            model.setFormat(value.toString());
            break;
        default:
            model.setExtraValue(field, value);
            break;
        }
    } catch (ClassCastException e) {
        Log.e(TAG, "Error casting value to the required type for field " + field, e);
        return false;
    } catch (ListUtils.ExpectingJsonArrayException e) {
        Log.e(TAG, "Error creating JSONArray from provided tags string " + value, e);
        return false;
    }
    return true;
}

From source file:com.grinnellplans.plandroid.LoginTask.java

private String constructResponse(Exception e) {
    Log.w("LoginTask::constructResponse", "enter");
    String resp = null;/*  w w  w  . j  a  v a 2 s. c o  m*/
    try {
        JSONObject respObject = new JSONObject();
        respObject.put("success", false);
        respObject.put("message", new StringBuilder().append(e.getClass().getName()).append(": ")
                .append(e.getMessage()).toString());

        resp = respObject.toString();
    } catch (Exception localException) {
        Log.w("LoginTask::constructResponse", "caught exception");
        resp = "{\"success\":false,\"message\":\"unknown local exception occured\"}";
    }
    Log.w("LoginTask::constructResponse", "exit");
    return resp;
}

From source file:com.kevinquan.google.activityrecoginition.model.MotionSnapshot.java

public boolean addMotion(Motion aMotion) {
    if (aMotion == null) {
        return false;
    }/* w w  w.j av  a 2 s. com*/
    if (aMotion.getTimestamp() == mTimestamp) {
        mMotions.add(aMotion);
        return true;
    } else {
        Log.w(TAG, "Motion could not be added as the timestamp was incorrect.  Expected " + mTimestamp
                + " but found " + aMotion.getTimestamp());
    }
    return false;
}

From source file:sg.macbuntu.android.pushcontacts.DeviceRegistrar.java

public static void unregisterWithServer(final Context context, final String deviceRegistrationID) {
    try {//from w w w . jav  a 2s.c  o  m
        HttpResponse res = makeRequest(context, deviceRegistrationID, UNREGISTER_URL);
        if (res.getStatusLine().getStatusCode() == 200) {
            SharedPreferences settings = Prefs.get(context);
            SharedPreferences.Editor editor = settings.edit();
            editor.remove("deviceRegistrationID");
            editor.commit();
        } else {
            Log.w(TAG, "Unregistration error " + String.valueOf(res.getStatusLine().getStatusCode()));
        }
    } catch (Exception e) {
        Log.w(TAG, "Unegistration error " + e.getMessage());
    }

    // Update dialog activity
    context.sendBroadcast(new Intent("sg.macbuntu.android.pushcontacts.UPDATE_UI"));
}

From source file:com.google.android.apps.santatracker.doodles.tilt.SwimmingLevelManager.java

@Override
Actor loadActorFromJSON(JSONObject json) throws JSONException {
    String type = json.getString(Actor.TYPE_KEY);
    Actor actor = null;/*  w w  w. jav a2 s. c o  m*/
    if (BoundingBoxSpriteActor.TYPE_TO_RESOURCE_MAP.containsKey(type)) {
        actor = BoundingBoxSpriteActor.fromJSON(json, context);
    } else {
        Log.w(TAG, "Unable to create object of type: " + type);
    }
    return actor;
}