Skip to content

Commit c1b6afb

Browse files
Merge pull request #3 from backtrace-labs/dev
Version 1.1.2
2 parents c114b91 + 41ba393 commit c1b6afb

File tree

7 files changed

+44
-15
lines changed

7 files changed

+44
-15
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# Backtrace Android Release Notes
22

33

4+
## Version 1.1.2 - 07.03.2019
5+
- Added class name to function name in exception StackFrame
6+
- Added exception message to annotations
7+
48
## Version 1.1.1 - 26.02.2019
59
- Fixed exception on filter out Backtrace files from StackTraceElements when file name is null
610

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ catch (e: Exception) {
7070
* Gradle
7171
```
7272
dependencies {
73-
implementation 'com.github.backtrace-labs.backtrace-android:backtrace-library:1.1.1'
73+
implementation 'com.github.backtrace-labs.backtrace-android:backtrace-library:1.1.2'
7474
}
7575
```
7676

@@ -79,7 +79,7 @@ dependencies {
7979
<dependency>
8080
<groupId>com.github.backtrace-labs.backtrace-android</groupId>
8181
<artifactId>backtrace-library</artifactId>
82-
<version>1.1.1</version>
82+
<version>1.1.2</version>
8383
<type>aar</type>
8484
</dependency>
8585
```

backtrace-library/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ android {
66
defaultConfig {
77
minSdkVersion 19
88
targetSdkVersion 28
9-
versionCode 111
10-
versionName "1.1.1"
9+
versionCode 112
10+
versionName "1.1.2"
1111
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
1212
}
1313

backtrace-library/src/main/java/backtraceio/library/models/BacktraceData.java

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,24 +117,38 @@ public BacktraceData(Context context, BacktraceReport report, Map<String, Object
117117
}
118118
this.context = context;
119119
this.report = report;
120-
this.annotations = new Annotations();
121120

122121
setReportInformation();
123-
124122
setThreadsInformation();
125123
setAttributes(clientAttributes);
126124
}
127125

128126
/**
129127
* Get absolute paths to report attachments
128+
*
130129
* @return paths to attachments
131130
*/
132131
public List<String> getAttachments() {
133132
return FileHelper.filterOutFiles(this.context, report.attachmentPaths);
134133
}
135134

135+
/***
136+
* Set annotations object
137+
* @param complexAttributes
138+
*/
139+
private void setAnnotations(Map<String, Object> complexAttributes) {
140+
Object exceptionMessage = null;
141+
142+
if (this.attributes != null &&
143+
this.attributes.containsKey("error.message")) {
144+
exceptionMessage = this.attributes.get("error.message");
145+
}
146+
this.annotations = new Annotations(exceptionMessage, complexAttributes);
147+
}
148+
136149
/**
137150
* Set attributes and add complex attributes to annotations
151+
*
138152
* @param clientAttributes
139153
*/
140154
private void setAttributes(Map<String, Object> clientAttributes) {
@@ -145,10 +159,7 @@ private void setAttributes(Map<String, Object> clientAttributes) {
145159
DeviceAttributesHelper deviceAttributesHelper = new DeviceAttributesHelper(this.context);
146160
this.attributes.putAll(deviceAttributesHelper.getDeviceAttributes());
147161

148-
if(this.annotations != null)
149-
{
150-
this.annotations.addComplexAttributes(backtraceAttributes.getComplexAttributes());
151-
}
162+
setAnnotations(backtraceAttributes.getComplexAttributes());
152163
}
153164

154165
/**

backtrace-library/src/main/java/backtraceio/library/models/BacktraceStackFrame.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public BacktraceStackFrame(StackTraceElement frame) {
4545
if (frame == null || frame.getMethodName() == null) {
4646
return;
4747
}
48-
this.functionName = frame.getMethodName();
48+
this.functionName = frame.getClassName() + "." + frame.getMethodName();
4949
this.sourceCodeFileName = frame.getFileName();
5050
this.sourceCode = UUID.randomUUID().toString();
5151
this.line = frame.getLineNumber() > 0 ? frame.getLineNumber() : null;

backtrace-library/src/main/java/backtraceio/library/models/json/Annotations.java

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,29 @@
88
*/
99
public class Annotations extends HashMap<String, Object>{
1010

11-
public Annotations()
11+
public Annotations(Object exceptionMessage, Map<String, Object> complexAttributes)
1212
{
1313
this.put("Environment Variables", System.getenv());
14+
this.addComplexAttributes(complexAttributes);
15+
this.addExceptionDetails(exceptionMessage);
1416
}
1517

16-
public void addComplexAttributes(Map<String, Object> complexAttributes)
18+
private void addComplexAttributes(Map<String, Object> complexAttributes)
1719
{
1820
if(complexAttributes != null) {
1921
this.putAll(complexAttributes);
2022
}
2123
}
24+
25+
private void addExceptionDetails(final Object exceptionMessage){
26+
this.put("Exception", new AnnotationException(exceptionMessage));
27+
}
28+
29+
class AnnotationException{
30+
Object Message;
31+
32+
AnnotationException(Object message){ setMessage(message); }
33+
34+
void setMessage(Object message){ this.Message = message; }
35+
}
2236
}

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ org.gradle.jvmargs=-Xmx1024m
1313
# org.gradle.parallel=true
1414

1515

16-
VERSION_NAME=1.1.1
17-
VERSION_CODE=111
16+
VERSION_NAME=1.1.2
17+
VERSION_CODE=112
1818
GROUP=com.github.backtrace-labs.backtrace-android
1919

2020
POM_DESCRIPTION=Backtrace's integration with Android applications written in Java allows customers to capture and report handled and unhandled java exceptions.

0 commit comments

Comments
 (0)