Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(63)

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/WebappAuthenticator.java

Issue 1054203002: Enable NeedsBraces check and fix some checkstyle issues. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.chrome.browser; 5 package org.chromium.chrome.browser;
6 6
7 import android.annotation.SuppressLint; 7 import android.annotation.SuppressLint;
8 import android.content.Context; 8 import android.content.Context;
9 import android.os.AsyncTask; 9 import android.os.AsyncTask;
10 import android.util.Log; 10 import android.util.Log;
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 Log.e(TAG, "Could not close key input stream '" + file + "': " + e); 122 Log.e(TAG, "Could not close key input stream '" + file + "': " + e);
123 } 123 }
124 } 124 }
125 } 125 }
126 126
127 private static boolean writeKeyToFile(Context context, String basename, Secr etKey key) { 127 private static boolean writeKeyToFile(Context context, String basename, Secr etKey key) {
128 File file = context.getFileStreamPath(basename); 128 File file = context.getFileStreamPath(basename);
129 byte[] keyBytes = key.getEncoded(); 129 byte[] keyBytes = key.getEncoded();
130 FileOutputStream output = null; 130 FileOutputStream output = null;
131 if (MAC_KEY_BYTE_COUNT != keyBytes.length) { 131 if (MAC_KEY_BYTE_COUNT != keyBytes.length) {
132 Log.e(TAG, "writeKeyToFile got key encoded bytes length " + keyBytes .length + 132 Log.e(TAG, "writeKeyToFile got key encoded bytes length " + keyBytes .length
133 "; expected " + MAC_KEY_BYTE_COUNT); 133 + "; expected " + MAC_KEY_BYTE_COUNT);
134 return false; 134 return false;
135 } 135 }
136 136
137 try { 137 try {
138 output = new FileOutputStream(file); 138 output = new FileOutputStream(file);
139 output.write(keyBytes); 139 output.write(keyBytes);
140 return true; 140 return true;
141 } catch (Exception e) { 141 } catch (Exception e) {
142 Log.e(TAG, "Could not write key to '" + file + "': " + e); 142 Log.e(TAG, "Could not write key to '" + file + "': " + e);
143 return false; 143 return false;
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 } 220 }
221 Mac mac = Mac.getInstance(MAC_ALGORITHM_NAME); 221 Mac mac = Mac.getInstance(MAC_ALGORITHM_NAME);
222 mac.init(key); 222 mac.init(key);
223 return mac; 223 return mac;
224 } catch (GeneralSecurityException e) { 224 } catch (GeneralSecurityException e) {
225 Log.w(TAG, "Error in creating MAC instance", e); 225 Log.w(TAG, "Error in creating MAC instance", e);
226 return null; 226 return null;
227 } 227 }
228 } 228 }
229 } 229 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698