Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ permissions:
checks: write
id-token: write

jobs:
# Code quality checks
trunk-check:
name: Trunk code check
Expand All @@ -22,9 +23,7 @@ permissions:
- name: Trunk Check
uses: trunk-io/trunk-action@75699af9e26881e564e9d832ef7dc3af25ec031b # v1.2.4
with:
check-mode: all

jobs:
check-mode: pull_request
pr-check-hadcoded-secrets:
name: "Check PR for hardcoded secrets"
uses: mParticle/mparticle-workflows/.github/workflows/security-hardcoded-secrets.yml@main
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ public void setUserAttribute(String json) {
called.value = true;
latch.countDown();
} catch (JSONException jse) {
jse.printStackTrace();
Logger.error(jse);
}

}
Expand All @@ -259,7 +259,7 @@ public void removeUserAttribute(String json) {
called.value = true;
latch.countDown();
} catch (JSONException jse) {
jse.printStackTrace();
Logger.error(jse);
}
}
});
Expand All @@ -285,7 +285,7 @@ public void setUserTag(String json) {
called.value = true;
latch.countDown();
} catch (JSONException jse) {
jse.printStackTrace();
Logger.error(jse);
}
}

Expand All @@ -300,7 +300,7 @@ public void setUserAttribute(String json) {
called.value = true;
latch.countDown();
} catch (JSONException jse) {
jse.printStackTrace();
Logger.error(jse);
}
}
});
Expand Down Expand Up @@ -357,7 +357,7 @@ public void logEvent(String json) {
}
Logger.error(new JSONObject(json).toString(4));
} catch (JSONException e) {
e.printStackTrace();
Logger.error(e);
}
}
});
Expand Down Expand Up @@ -466,7 +466,7 @@ public void logout(String json) {
called.value = true;
latch.countDown();
} catch (JSONException e) {
e.printStackTrace();
Logger.error(e);
}
}
});
Expand Down Expand Up @@ -518,7 +518,7 @@ public void login(String json) {
called.value = true;
latch.countDown();
} catch (JSONException e) {
e.printStackTrace();
Logger.error(e);
}
}
});
Expand Down Expand Up @@ -570,7 +570,7 @@ public void modify(String json) {
called.value = true;
latch.countDown();
} catch (JSONException e) {
e.printStackTrace();
Logger.error(e);
}
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.mparticle

import android.content.Context
import com.mparticle.internal.ConfigManager
import com.mparticle.internal.Logger
import com.mparticle.internal.PushRegistrationHelper
import com.mparticle.internal.PushRegistrationHelper.PushRegistration
import com.mparticle.networking.Matcher
Expand Down Expand Up @@ -209,7 +210,7 @@ class PushRegistrationTest : BaseCleanStartedEachTest() {
try {
Thread.sleep(10)
} catch (e: InterruptedException) {
e.printStackTrace()
Logger.error(e)
}
}
TestingUtils.setFirebasePresent(false, null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import android.os.Looper
import com.mparticle.internal.AccessUtils
import com.mparticle.internal.AppStateManager
import com.mparticle.internal.Constants
import com.mparticle.internal.Logger
import com.mparticle.networking.Matcher
import com.mparticle.networking.MockServer.JSONMatch
import com.mparticle.testutils.AndroidUtils
Expand Down Expand Up @@ -61,7 +62,7 @@ sent sessionId = ${eventObject.getString("id")}""",
}
}
} catch (e: Exception) {
e.printStackTrace()
Logger.error(e)
Assert.fail(e.message)
}
false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import android.os.Looper
import com.mparticle.internal.AccessUtils
import com.mparticle.internal.AccessUtils.EmptyMParticleApiClient
import com.mparticle.internal.Constants
import com.mparticle.internal.Logger
import com.mparticle.internal.MPUtility
import com.mparticle.internal.MParticleApiClientImpl.MPRampException
import com.mparticle.internal.MParticleApiClientImpl.MPThrottleException
Expand Down Expand Up @@ -86,7 +87,7 @@ class UploadMessageTest : BaseCleanStartedEachTest() {
}
}
} catch (e: Exception) {
e.printStackTrace()
Logger.error(e)
Assert.fail(e.toString())
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import android.os.Looper
import com.mparticle.MParticle
import com.mparticle.MParticle.IdentityType
import com.mparticle.internal.ConfigManager
import com.mparticle.internal.Logger
import com.mparticle.networking.Matcher
import com.mparticle.testutils.AndroidUtils
import com.mparticle.testutils.BaseCleanStartedEachTest
Expand Down Expand Up @@ -64,7 +65,7 @@ class IdentityApiTest : BaseCleanStartedEachTest() {
com.mparticle.internal.AccessUtils
.awaitMessageHandler()
} catch (e: InterruptedException) {
e.printStackTrace()
Logger.error(e)
}
assertMParticleUserEquals(user, mpid1, identities, null, isLoggedIn)
latch.countDown()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import android.os.Handler
import android.util.MutableBoolean
import com.mparticle.MParticle
import com.mparticle.internal.ConfigManager
import com.mparticle.internal.Logger
import com.mparticle.internal.MPUtility
import com.mparticle.networking.MPConnection
import com.mparticle.networking.MPConnectionTestImpl
Expand Down Expand Up @@ -323,7 +324,7 @@ class MParticleIdentityClientImplTest : BaseCleanStartedEachTest() {
try {
identityClient?.makeUrlRequest(connection, payload, identity)
} catch (e: JSONException) {
e.printStackTrace()
Logger.error(e)
Assert.fail(e.message)
}
(connection as MPConnectionTestImpl).responseCode = 202
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class AppStateManagerInstrumentedTest : BaseCleanStartedEachTest() {
}
checked[0] = true
} catch (e: JSONException) {
e.printStackTrace()
Logger.error(e)
}
}
},
Expand Down Expand Up @@ -97,7 +97,7 @@ class AppStateManagerInstrumentedTest : BaseCleanStartedEachTest() {
latch.countDown()
}
} catch (e: JSONException) {
e.printStackTrace()
Logger.error(e)
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.mparticle.internal.database.services

import com.mparticle.internal.Constants
import com.mparticle.internal.JsonReportingMessage
import com.mparticle.internal.Logger
import com.mparticle.testutils.TestingUtils
import org.json.JSONException
import org.junit.Assert
Expand Down Expand Up @@ -213,7 +214,7 @@ class ReportingServiceTest : BaseMPServiceTest() {
.getInt("a random Number")
.compareTo(o2.msgObject.getInt("a random Number"))
} catch (e: JSONException) {
e.printStackTrace()
Logger.error(e)
}
-1
},
Expand All @@ -227,7 +228,7 @@ class ReportingServiceTest : BaseMPServiceTest() {
.getInt("a random Number")
.compareTo(o2.toJson().getInt("a random Number"))
} catch (e: JSONException) {
e.printStackTrace()
Logger.error(e)
}
-1
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import com.mparticle.MParticle
import com.mparticle.identity.MParticleIdentityClient
import com.mparticle.internal.AccessUtils
import com.mparticle.internal.Constants
import com.mparticle.internal.Logger
import com.mparticle.internal.MParticleApiClient
import com.mparticle.internal.MParticleApiClientImpl
import com.mparticle.internal.MParticleApiClientImpl.MPNoConfigException
Expand Down Expand Up @@ -43,9 +44,9 @@ class PinningTestHelper internal constructor(
),
)
} catch (e: MalformedURLException) {
e.printStackTrace()
Logger.error(e)
} catch (e: MPNoConfigException) {
e.printStackTrace()
Logger.error(e)
}
val apiClient: MParticleApiClient = AccessUtils.getApiClient()
setRequestClient(apiClient, path)
Expand Down
3 changes: 2 additions & 1 deletion android-core/src/main/java/com/mparticle/MPReceiver.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import androidx.annotation.NonNull;

import com.mparticle.internal.Logger;
import com.mparticle.messaging.MPMessagingAPI;
import com.mparticle.messaging.ProviderCloudMessage;

Expand Down Expand Up @@ -62,7 +63,7 @@ public void run() {
try {
Class.forName("android.os.AsyncTask");
} catch (ClassNotFoundException e) {
e.printStackTrace();
Logger.error(e);
}
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public void run() {
try {
Class.forName("android.os.AsyncTask");
} catch (ClassNotFoundException e) {
e.printStackTrace();
Logger.error(e);
}
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ public synchronized void configUpToDate() throws JSONException {
onConfigLoaded(ConfigType.KIT, kitConfig != combined);
}
} catch (JSONException e) {
e.printStackTrace();
Logger.error(e);
throw new RuntimeException(e);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -811,13 +811,13 @@ public static String getProp(String key) {
Method get = SystemProperties.getMethod("get", new Class[]{String.class});
return get.invoke(SystemProperties, new Object[]{key}).toString();
} catch (ClassNotFoundException e) {
e.printStackTrace();
Logger.error(e);
} catch (NoSuchMethodException e) {
e.printStackTrace();
Logger.error(e);
} catch (IllegalAccessException e) {
e.printStackTrace();
Logger.error(e);
} catch (InvocationTargetException e) {
e.printStackTrace();
Logger.error(e);
}
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ private void removeGcmTable(SQLiteDatabase db) {
try {
db.execSQL("DROP TABLE IF EXISTS gcm_messages");
} catch (Exception e) {
e.printStackTrace();
Logger.error(e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import com.mparticle.internal.Constants;
import com.mparticle.internal.InternalSession;
import com.mparticle.internal.Logger;

import org.json.JSONArray;
import org.json.JSONException;
Expand All @@ -24,15 +25,15 @@ public BaseMPMessageBuilder(String messageType) {
try {
put(Constants.MessageKey.TYPE, messageType);
} catch (JSONException e) {
e.printStackTrace();
Logger.error(e);
}
}

public BaseMPMessageBuilder timestamp(long timestamp) {
try {
put(Constants.MessageKey.TIMESTAMP, timestamp);
} catch (JSONException e) {
e.printStackTrace();
Logger.error(e);
}
return this;
}
Expand All @@ -50,7 +51,7 @@ public BaseMPMessageBuilder name(String name) {
try {
put(Constants.MessageKey.NAME, name);
} catch (JSONException e) {
e.printStackTrace();
Logger.error(e);
}
return this;
}
Expand All @@ -63,7 +64,7 @@ public BaseMPMessageBuilder attributes(JSONObject attributes) {
addEventLengthAttributes(mLength);
}
} catch (JSONException e) {
e.printStackTrace();
Logger.error(e);
}
}
return this;
Expand All @@ -82,7 +83,7 @@ public BaseMPMessageBuilder dataConnection(String dataConnection) {
try {
put(Constants.MessageKey.STATE_INFO_DATA_CONNECTION, dataConnection);
} catch (JSONException e) {
e.printStackTrace();
Logger.error(e);
}
}
return this;
Expand All @@ -95,7 +96,7 @@ public BaseMPMessageBuilder length(Double length) {
put(Constants.MessageKey.EVENT_DURATION, length);
addEventLengthAttributes(length);
} catch (JSONException e) {
e.printStackTrace();
Logger.error(e);
}
}
return this;
Expand All @@ -111,7 +112,7 @@ private void addEventLengthAttributes(Double length) {
getJSONObject(Constants.MessageKey.ATTRIBUTES).put("EventLength", Integer.toString(length.intValue()));
}
} catch (JSONException e) {
e.printStackTrace();
Logger.error(e);
}
}

Expand All @@ -127,7 +128,7 @@ public BaseMPMessageBuilder flags(Map<String, List<String>> customFlags) {
}
put(Constants.MessageKey.EVENT_FLAGS, flagsObject);
} catch (JSONException e) {
e.printStackTrace();
Logger.error(e);
}
}
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.mparticle.MParticle;
import com.mparticle.internal.Constants;
import com.mparticle.internal.InternalSession;
import com.mparticle.internal.Logger;

import org.json.JSONException;

Expand All @@ -26,7 +27,7 @@ public BaseMPMessageBuilder customEventType(MParticle.EventType eventType) {
try {
put(Constants.MessageKey.EVENT_TYPE, eventType);
} catch (JSONException e) {
e.printStackTrace();
Logger.error(e);
}
return this;
}
Expand Down
Loading
Loading