Skip to content

Commit 10e8df8

Browse files
committed
Issue MobileChromeApps#64: Plugin uses Android Log class and not Cordova LOG class
1 parent 977b57d commit 10e8df8

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/android/Zip.java

+5-7
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,15 @@
99
import java.util.zip.ZipEntry;
1010
import java.util.zip.ZipInputStream;
1111

12-
1312
import android.net.Uri;
1413
import org.apache.cordova.CallbackContext;
1514
import org.apache.cordova.CordovaPlugin;
1615
import org.apache.cordova.CordovaResourceApi.OpenForReadResult;
16+
import org.apache.cordova.LOG;
1717
import org.apache.cordova.PluginResult;
1818
import org.json.JSONException;
1919
import org.json.JSONObject;
2020

21-
import android.util.Log;
22-
2321
public class Zip extends CordovaPlugin {
2422

2523
private static final String LOG_TAG = "Zip";
@@ -67,7 +65,7 @@ private void unzipSync(CordovaArgs args, CallbackContext callbackContext) {
6765
if (tempFile == null || !tempFile.exists()) {
6866
String errorMessage = "Zip file does not exist";
6967
callbackContext.error(errorMessage);
70-
Log.e(LOG_TAG, errorMessage);
68+
LOG.e(LOG_TAG, errorMessage);
7169
return;
7270
}
7371

@@ -77,7 +75,7 @@ private void unzipSync(CordovaArgs args, CallbackContext callbackContext) {
7775
if (outputDir == null || (!outputDir.exists() && !outputDir.mkdirs())){
7876
String errorMessage = "Could not create output directory";
7977
callbackContext.error(errorMessage);
80-
Log.e(LOG_TAG, errorMessage);
78+
LOG.e(LOG_TAG, errorMessage);
8179
return;
8280
}
8381

@@ -128,7 +126,7 @@ private void unzipSync(CordovaArgs args, CallbackContext callbackContext) {
128126
File file = new File(outputDirectory + compressedName);
129127
file.getParentFile().mkdirs();
130128
if(file.exists() || file.createNewFile()){
131-
Log.w("Zip", "extracting: " + file.getPath());
129+
LOG.w(LOG_TAG, "extracting: " + file.getPath());
132130
FileOutputStream fout = new FileOutputStream(file);
133131
int count;
134132
while ((count = zis.read(buffer)) != -1)
@@ -155,7 +153,7 @@ private void unzipSync(CordovaArgs args, CallbackContext callbackContext) {
155153
} catch (Exception e) {
156154
String errorMessage = "An error occurred while unzipping.";
157155
callbackContext.error(errorMessage);
158-
Log.e(LOG_TAG, errorMessage, e);
156+
LOG.e(LOG_TAG, errorMessage, e);
159157
} finally {
160158
if (inputStream != null) {
161159
try {

0 commit comments

Comments
 (0)