List of usage examples for android.util Log w
public static int w(String tag, Throwable tr)
From source file:cn.kang.base.crash.handler.SimpleMultipartEntity.java
public void writeFirstBoundaryIfNeeds() { if (!isSetFirst) { try {//from ww w . j a v a 2 s. c o m out.write(("--" + boundary + "\r\n").getBytes()); } catch (final IOException e) { Log.w(e.getMessage(), e); } } isSetFirst = true; }
From source file:com.infosupport.service.LPRServiceCaller.java
public static JSONObject doGet(String urlString) { String json = null;//from w w w .j a v a 2 s. co m try { URL url = new URL(urlString); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("GET"); conn.setRequestProperty("Accept", "application/json"); if (conn.getResponseCode() != 200) { throw new RuntimeException("Failed : HTTP error code : " + conn.getResponseCode()); } BufferedReader br = new BufferedReader(new InputStreamReader((conn.getInputStream()))); String output; while ((output = br.readLine()) != null) { json = output; System.out.println(json + "from doGet"); } conn.disconnect(); } catch (IOException e) { Log.w(TAG, "IOException, waarschijnlijk geen internet connectie aanwezig..."); } JSONObject jsonObject = null; try { jsonObject = new JSONObject(json); } catch (JSONException e) { Log.e(TAG, "Kon geen JsonObject maken van het response"); } return jsonObject; }
From source file:com.microsoft.aad.adal.CordovaAdalPlugin.java
public CordovaAdalPlugin() { // Android API < 18 does not support AndroidKeyStore so ADAL requires // some extra work to crete and pass secret key to ADAL. if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR2) { try {//w w w. j a v a 2 s. c om SecretKey secretKey = this.createSecretKey(SECRET_KEY); AuthenticationSettings.INSTANCE.setSecretKey(secretKey.getEncoded()); } catch (Exception e) { Log.w("CordovaAdalPlugin", "Unable to create secret key: " + e.getMessage()); } } }
From source file:org.mythtv.service.myth.v25.SettingHelperV25.java
public String process(final Context context, final LocationProfile locationProfile, final String settingName, final String settingDefault) { Log.v(TAG, "process : enter"); if (!NetworkHelper.getInstance().isMasterBackendConnected(context, locationProfile)) { Log.w(TAG, "process : Master Backend '" + locationProfile.getHostname() + "' is unreachable"); return null; }//from w w w.j av a 2 s . com mMythServicesTemplate = (MythServicesTemplate) MythAccessFactory.getServiceTemplateApiByVersion(mApiVersion, locationProfile.getUrl()); if (null == mMythServicesTemplate) { Log.w(TAG, "process : Master Backend '" + locationProfile.getHostname() + "' is unreachable"); return null; } String setting = null; try { setting = downloadSetting(locationProfile, settingName, settingDefault); } catch (Exception e) { Log.e(TAG, "process : error", e); setting = null; } Log.v(TAG, "process : exit"); return setting; }
From source file:org.ounl.lifelonglearninghub.learntracker.gis.ou.db.ws.SubjectWSGetAsyncTask.java
public List<SubjectDO> listSubjects(String sCourseId) { // e.g. query https://lifelong-learning-hub.appspot.com/_ah/api/subjectendpoint/v1/subject/course/S23222 InputStream is = null;//from w ww .ja v a 2 s .c o m String url = Session.getSingleInstance().getWSPath() + "/_ah/api/subjectendpoint/v1/subject/course/"; url += sCourseId; try { Log.d(CLASSNAME, " Querying to backend " + url); HttpClient httpclient = new DefaultHttpClient(); HttpGet httpget = new HttpGet(url); HttpResponse response = httpclient.execute(httpget); final int statusCode = response.getStatusLine().getStatusCode(); if (statusCode != HttpStatus.SC_OK) { Log.w(getClass().getSimpleName(), "Error " + statusCode + " for URL " + url); return null; } HttpEntity entity = response.getEntity(); is = entity.getContent(); } catch (Exception e) { Log.e(CLASSNAME, "Error in http connection " + e.toString()); } Reader reader = new InputStreamReader(is); Gson gson = new Gson(); SubjectDOList r = gson.fromJson(reader, SubjectDOList.class); List<SubjectDO> subjects = r.subjects; return subjects; }
From source file:com.asksven.betterbatterystats.services.KbReaderService.java
private static InputStream retrieveStream(String url) { DefaultHttpClient client = new DefaultHttpClient(); HttpGet getRequest = new HttpGet(url); try {/* w w w . j a v a 2s . com*/ HttpResponse getResponse = client.execute(getRequest); final int statusCode = getResponse.getStatusLine().getStatusCode(); if (statusCode != HttpStatus.SC_OK) { Log.w(TAG, "Error " + statusCode + " for URL " + url); return null; } HttpEntity getResponseEntity = getResponse.getEntity(); return getResponseEntity.getContent(); } catch (IOException e) { getRequest.abort(); Log.w(TAG, "Error for URL " + url, e); } return null; }
From source file:com.hemou.android.util.StrUtils.java
public static <K> K str2Obj(String str, TypeReference<K> type) { try {/*from ww w .j ava 2 s . c o m*/ return new ObjectMapper().readValue(str, type); } catch (Exception e) { Log.w("Str2Obj", "Can not convert " + str + " to class ?" + type.getType() + ""); e.printStackTrace(); } return null; }
From source file:com.heyzap.cordova.ads.CDVHeyzapAds.java
public void start(final JSONArray args, final CallbackContext callbackContext) { String publisherID = args.optString(0); int options = getStartOptionsFromJSON(args.optJSONObject(1)); if (!publisherID.isEmpty()) { HeyzapAds.framework = FRAMEWORK; HeyzapAds.start(publisherID, cordova.getActivity(), options); } else {// ww w . ja va2s . c o m String msg = "publisher ID is missing."; Log.w(TAG, msg); callbackContext.error(msg); } callbackContext.success(); }
From source file:eu.masconsult.bgbanking.utils.CookieQuotesFixerResponseInterceptor.java
@Override public void process(HttpResponse response, HttpContext context) throws HttpException, IOException { CookieStore cookieStore = (CookieStore) context.getAttribute(ClientContext.COOKIE_STORE); for (Header header : response.getAllHeaders()) { if (!header.getName().equalsIgnoreCase("Set-Cookie")) { continue; }/*w w w . j a va 2 s . c om*/ Matcher matcher = pattern.matcher(header.getValue()); if (!matcher.find()) { continue; } for (Cookie cookie : cookieStore.getCookies()) { if (cookie.getName().equalsIgnoreCase(matcher.group(1))) { if (cookie instanceof BasicClientCookie) { ((BasicClientCookie) cookie).setValue('"' + cookie.getValue() + '"'); } else if (cookie instanceof BasicClientCookie2) { ((BasicClientCookie2) cookie).setValue('"' + cookie.getValue() + '"'); } else { Log.w(TAG, "unhandled cookie implementation " + cookie.getClass().getName()); } break; } } } }
From source file:com.tih.tihir.ConsumerIrManagerBase.java
@Override public void stop() { Log.w(TAG, "stop() is not available on this device"); }