Bug 1316013 - Fixed by removing variables and building them as part of the Log statement (which never gets called because DEBUG is set to FALSE). r?sebastian draft
authorSwaroop Rao <swaroop.rao@gmail.com>
Wed, 16 Nov 2016 09:12:36 -0500
changeset 439721 e1f0abe7d67222afa172c7e2fe3c1ba1b1ef78d7
parent 439625 2a68f9e36564c01910d118261b436c17816ae677
child 440478 cd39577fe74c35146e1801282f76da4951f90964
push id36070
push userbmo:swaroop.rao@gmail.com
push dateWed, 16 Nov 2016 14:13:56 +0000
reviewerssebastian
bugs1316013
milestone52.0a1
Bug 1316013 - Fixed by removing variables and building them as part of the Log statement (which never gets called because DEBUG is set to FALSE). r?sebastian MozReview-Commit-ID: 7nWeXG50KLQ
mobile/android/base/java/org/mozilla/gecko/media/GeckoMediaDrmBridgeV21.java
--- a/mobile/android/base/java/org/mozilla/gecko/media/GeckoMediaDrmBridgeV21.java
+++ b/mobile/android/base/java/org/mozilla/gecko/media/GeckoMediaDrmBridgeV21.java
@@ -137,17 +137,16 @@ public class GeckoMediaDrmBridgeV21 impl
         if (mProvisioningPromiseId > 0 && mCrypto == null) {
             if (DEBUG) Log.d(LOGTAG, "Pending createSession because it's provisioning !");
             savePendingCreateSessionData(createSessionToken, promiseId,
                                          initData, initDataType);
             return;
         }
 
         ByteBuffer sessionId = null;
-        String strSessionId = null;
         try {
             boolean hasMediaCrypto = ensureMediaCryptoCreated();
             if (!hasMediaCrypto) {
                 onRejectPromise(promiseId, "MediaCrypto intance is not created !");
                 return;
             }
 
             sessionId = openSession();
@@ -165,19 +164,18 @@ public class GeckoMediaDrmBridgeV21 impl
             onSessionCreated(createSessionToken,
                              promiseId,
                              sessionId.array(),
                              request.getData());
             onSessionMessage(sessionId.array(),
                              LICENSE_REQUEST_INITIAL,
                              request.getData());
             mSessionMIMETypes.put(sessionId, initDataType);
-            strSessionId = new String(sessionId.array());
             mSessionIds.add(sessionId);
-            if (DEBUG) Log.d(LOGTAG, " StringID : " + strSessionId + " is put into mSessionIds ");
+            if (DEBUG) Log.d(LOGTAG, " StringID : " + new String(sessionId.array()) + " is put into mSessionIds ");
         } catch (android.media.NotProvisionedException e) {
             if (DEBUG) Log.d(LOGTAG, "Device not provisioned:" + e.getMessage());
             if (sessionId != null) {
                 // The promise of this createSession will be either resolved
                 // or rejected after provisioning.
                 mDrm.closeSession(sessionId.array());
             }
             savePendingCreateSessionData(createSessionToken, promiseId,
@@ -366,30 +364,29 @@ public class GeckoMediaDrmBridgeV21 impl
             }
             ByteBuffer session = ByteBuffer.wrap(sessionArray);
             if (!sessionExists(session)) {
                 if (DEBUG) Log.d(LOGTAG, "MediaDrmListener: Invalid session.");
                 return;
             }
             // On L, these events are treated as exceptions and handled correspondingly.
             // Leaving this code block for logging message.
-            String sessionId = new String(session.array());
             switch (event) {
                 case MediaDrm.EVENT_PROVISION_REQUIRED:
                     if (DEBUG) Log.d(LOGTAG, "MediaDrm.EVENT_PROVISION_REQUIRED");
                     break;
                 case MediaDrm.EVENT_KEY_REQUIRED:
                     if (DEBUG) Log.d(LOGTAG, "MediaDrm.EVENT_KEY_REQUIRED");
                     // No need to handle here if we're not in privacy mode.
                     break;
                 case MediaDrm.EVENT_KEY_EXPIRED:
-                    if (DEBUG) Log.d(LOGTAG, "MediaDrm.EVENT_KEY_EXPIRED, sessionId=" + sessionId);
+                    if (DEBUG) Log.d(LOGTAG, "MediaDrm.EVENT_KEY_EXPIRED, sessionId=" + new String(session.array()));
                     break;
                 case MediaDrm.EVENT_VENDOR_DEFINED:
-                    if (DEBUG) Log.d(LOGTAG, "MediaDrm.EVENT_VENDOR_DEFINED, sessionId=" + sessionId);
+                    if (DEBUG) Log.d(LOGTAG, "MediaDrm.EVENT_VENDOR_DEFINED, sessionId=" + new String(session.array()));
                     break;
                 default:
                     if (DEBUG) Log.d(LOGTAG, "Invalid DRM event " + event);
                     return;
             }
         }
     }
 
@@ -587,19 +584,18 @@ public class GeckoMediaDrmBridgeV21 impl
             if (mCryptoSessionId == null) {
                 if (DEBUG) Log.d(LOGTAG, "Cannot open session for MediaCrypto");
                 return false;
             }
 
             if (MediaCrypto.isCryptoSchemeSupported(mSchemeUUID)) {
                 final byte [] cryptoSessionId = mCryptoSessionId.array();
                 mCrypto = new MediaCrypto(mSchemeUUID, cryptoSessionId);
-                String strCryptoSessionId = new String(cryptoSessionId);
                 mSessionIds.add(mCryptoSessionId);
-                if (DEBUG) Log.d(LOGTAG, "MediaCrypto successfully created! - SId " + INVALID_SESSION_ID + ", " + strCryptoSessionId);
+                if (DEBUG) Log.d(LOGTAG, "MediaCrypto successfully created! - SId " + INVALID_SESSION_ID + ", " + new String(cryptoSessionId));
                 return true;
             } else {
                 if (DEBUG) Log.d(LOGTAG, "Cannot create MediaCrypto for unsupported scheme.");
                 return false;
             }
         } catch (android.media.MediaCryptoException e) {
             if (DEBUG) Log.d(LOGTAG, "Cannot create MediaCrypto:" + e.getMessage());
             release();