Skip to content

Commit 03818c5

Browse files
* Fixes 2 issues found when using RG4CFML in a new project (#3) * Fixing some small issues * Setting version to 1.7.0-SNAPSHOT * Feature/#56 java memory management (#4) * Documenting the issue from the OP in the ticekt. * Wrapping access to getMemoryXBean into try/catch. * Test scenario and fix. (#5) * Changed supported versions of ACF/Lucee * fix: applyFilter deep search (#6) * Fixes core problem in #62. * Testcase * Prep for 1.7.0 release * Test for GH #58 * Documentation/Changelog updates
1 parent 89ef892 commit 03818c5

File tree

10 files changed

+145
-29
lines changed

10 files changed

+145
-29
lines changed

changelog.md renamed to CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
History
22
=======
33

4+
1.7.0 (November 14 2024)
5+
6+
- Fixes issues around non-existent HTTP request objects when run on ACF and in a thread context
7+
- Fixes access to JVM memory beans depending on JVM settings and JVM type available
8+
- Minimum requirements are now Lucee 5+ anmd ACF 2018+
9+
- Fixes issue with content filter not trailing deep into payload
10+
411
1.6.0 (November 23 2023)
512

613
- Fixed issue in RaygunExceptionMessage on recent version of ACF

README.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@ raygun4cfml
33

44
Raygun Crash Reporting client for CFML.
55

6-
Current Version: 1.6.0 (November 23 2023)
6+
Supported:
7+
8+
Adobe CF 2018+
9+
Lucee 5+
10+
11+
Current Version: 1.7.0 (November 14 2024)
712

813
Dependencies:
914

@@ -80,7 +85,7 @@ Download a zip file containing the current content of the repo or a release/tag
8085
8186
## Version History
8287
83-
See changelog.md for further information.
88+
See CHANGELOG.md for further information.
8489
8590
## General Notes
8691
@@ -90,6 +95,10 @@ See changelog.md for further information.
9095
9196
(3) Version 1.1.0 and newer will not work on Adobe ColdFusion 8 and most likely not on Railo 3 (the latter not tested).
9297
98+
(4) Version 1.7.0 and newer will most likely not work with Adobe ColdFUsion 2016 and Railo/Lucee 4.x.
99+
100+
(5) On newer Java versions (>11), there is no default access to Java Memory Management unless you add the following argument to your JVM configuration: `--add-opens java.management/sun.management=ALL-UNNAMED`
101+
93102
## How to contribute
94103
95104
Note: Please be aware that raygun4cfml is not an official Raygun library and not maintained by Raygun stuff. See [LICENSE](LICENSE) for more details.

box.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name":"raygun4cfml",
3-
"version":"1.6.0",
4-
"location":"MindscapeHQ/raygun4cfml#1.6.0",
3+
"version":"1.7.0",
4+
"location":"MindscapeHQ/raygun4cfml#1.7.0",
55
"author":"Kai Koenig <kai@ventego-creative.co.nz>",
66
"homepage":"https://github.com/MindscapeHQ/raygun4cfml/",
77
"documentation":"https://github.com/MindscapeHQ/raygun4cfml/blob/master/README.md",
@@ -17,9 +17,8 @@
1717
"changelog":"https://github.com/MindscapeHQ/raygun4cfml/blob/master/changelog.md",
1818
"keywords":["error","errortracking","bugs","bugtracking","raygun","raygun.io"],
1919
"engines":[
20-
{"type":"railo","version":">=4.0.0"},
21-
{"type":"lucee","version":">=4.5.0"},
22-
{"type":"adobe","version":">=9.0.0"}
20+
{"type":"lucee","version":">=5.0.0"},
21+
{"type":"adobe","version":">=2018.0.0"}
2322
],
2423
"type":"logging",
2524
"projectURL":"https://github.com/MindscapeHQ/raygun4cfml/",

src/nz/co/ventego-creative/raygun4cfml/RaygunClient.cfc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -249,9 +249,8 @@ limitations under the License.
249249
for (var i=1; i<=ArrayLen(filter); i++)
250250
{
251251
// current filter object (filter,replacement)
252-
matcher = filter[i];
253-
254-
var findKeysByFilter = structFindKey(arguments.messageData,matcher.filter);
252+
var matcher = filter[i];
253+
var findKeysByFilter = structFindKey(arguments.messageData,matcher.filter,"all");
255254

256255
// loop over general finds and replace
257256
for (var j=1; j<=ArrayLen(findKeysByFilter); j++)
@@ -264,7 +263,7 @@ limitations under the License.
264263
if (!isNull(arguments.messageData.details.request.rawData) && isJSON(arguments.messageData.details.request.rawData)) {
265264
var rawDataJSON = deserializeJSON(arguments.messageData.details.request.rawData);
266265

267-
var findRawDataKeysByFilter = structFindKey(rawDataJSON,matcher.filter);
266+
var findRawDataKeysByFilter = structFindKey(rawDataJSON,matcher.filter,"all");
268267

269268
// loop over finds in rawData and replace
270269
for (var k=1; k<=ArrayLen(findRawDataKeysByFilter); k++)

src/nz/co/ventego-creative/raygun4cfml/RaygunClientMessage.cfc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ limitations under the License.
3030
var returnContent = {};
3131

3232
returnContent["name"] = "raygun4cfml";
33-
returnContent["version"] = "1.5.0";
33+
returnContent["version"] = "1.7.0";
3434
returnContent["clientUrl"] = "https://github.com/MindscapeHQ/raygun4cfml";
3535

3636
return returnContent;

src/nz/co/ventego-creative/raygun4cfml/RaygunEnvironmentMessage.cfc

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,24 @@ limitations under the License.
3131
var runtime = createObject("java", "java.lang.System");
3232
var props = runtime.getProperties();
3333
var mf = createObject("java", "java.lang.management.ManagementFactory");
34-
var heapMem = mf.getMemoryMXBean().getHeapMemoryUsage();
34+
var heapMem = "";
3535
var osbean = "";
3636

37-
returnContent["availableVirtualMemory"] = heapMem.getCommitted()-heapMem.getUsed();
38-
returnContent["totalVirtualMemory"] = heapMem.getCommitted();
3937
returnContent["architecture"] = props["os.arch"];
4038
returnContent["osVersion"] = props["os.version"];
4139
returnContent["packageVersion"] = props["java.vm.vendor"] & "|" & props["java.runtime.version"] & "|" & props["java.vm.name"];
4240
returnContent["platform"] = props["os.name"];
4341

42+
try {
43+
heapMem = mf.getMemoryMXBean().getHeapMemoryUsage();
44+
returnContent["availableVirtualMemory"] = heapMem.getCommitted()-heapMem.getUsed();
45+
returnContent["totalVirtualMemory"] = heapMem.getCommitted();
46+
}
47+
catch (any e) {
48+
returnContent["availableVirtualMemory"] = JavaCast("null","");
49+
returnContent["totalVirtualMemory"] = JavaCast("null","");
50+
}
51+
4452
try {
4553
osbean = mf.getOperatingSystemMXBean();
4654
returnContent["availablePhysicalMemory"] = osbean.getFreePhysicalMemorySize();

src/nz/co/ventego-creative/raygun4cfml/RaygunRequestMessage.cfc

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,36 @@ limitations under the License.
3131
<cfscript>
3232
var returnContent = {};
3333
var rawDataMaxLength = 4096;
34-
var httpRequest = getHttpRequestData();
35-
36-
returnContent["hostName"] = CGI.HTTP_HOST;
37-
returnContent["url"] = CGI.SCRIPT_NAME & CGI.PATH_INFO
38-
returnContent["httpMethod"] = CGI.REQUEST_METHOD;
39-
returnContent["iPAddress"] = CGI.REMOTE_ADDR;
40-
returnContent["queryString"] = CGI.QUERY_STRING;
41-
returnContent["headers"] = httpRequest.headers;
42-
returnContent["data"] = CGI;
43-
returnContent["form"] = FORM;
44-
45-
if (CGI.CONTENT_TYPE != "text/html" && CGI.CONTENT_TYPE != "application/x-www-form-urlencoded" && CGI.REQUEST_METHOD != "GET") {
46-
var temp = httpRequest.content;
47-
returnContent["rawData"] = Left(temp, rawDataMaxLength);
34+
35+
try {
36+
var httpRequest = getHttpRequestData();
37+
} catch (any e) {
38+
var httpRequest = {};
39+
}
40+
41+
try {
42+
var localCGI = duplicate(CGI);
43+
} catch (any e) {
44+
var localCGI = {};
45+
}
46+
47+
try {
48+
var localForm = duplicate(FORM);
49+
} catch (any e) {
50+
var localForm = {};
51+
}
52+
53+
returnContent["hostName"] = (localCGI.keyExists("HTTP_HOST") ? localCGI.HTTP_HOST : JavaCast("null", ""));
54+
returnContent["url"] = (localCGI.keyExists("SCRIPT_NAME") ? localCGI.SCRIPT_NAME : JavaCast("null", "")) & (localCGI.keyExists("PATH_INFO") ? localCGI.PATH_INFO : JavaCast("null", ""));
55+
returnContent["httpMethod"] = (localCGI.keyExists("REQUEST_METHOD") ? localCGI.REQUEST_METHOD : JavaCast("null", ""));
56+
returnContent["iPAddress"] = (localCGI.keyExists("REMOTE_ADDR") ? localCGI.REMOTE_ADDR : JavaCast("null", ""));
57+
returnContent["queryString"] = (localCGI.keyExists("QUERY_STRING") ? localCGI.QUERY_STRING : JavaCast("null", ""));
58+
returnContent["headers"] = (httpRequest.keyExists("headers") ? httpRequest.headers : JavaCast("null", ""));
59+
returnContent["data"] = localCGI;
60+
returnContent["form"] = localForm;
61+
62+
if (localCGI.keyExists("CONTENT_TYPE") && localCGI.keyExists("REQUEST_METHOD") && localCGI.CONTENT_TYPE != "text/html" && localCGI.CONTENT_TYPE != "application/x-www-form-urlencoded" && localCGI.REQUEST_METHOD != "GET") {
63+
returnContent["rawData"] = Left((httpRequest.keyExists("content") ? httpRequest.content : JavaCast("null", "")), rawDataMaxLength);
4864
} else {
4965
returnContent["rawData"] = JavaCast("null","");
5066
}

tests/tests_manual/test-gh-57.cfm

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<cfscript>
2+
3+
4+
thread action="run" name="myThread" {
5+
6+
var raygun = createObject("component","nz.co.ventego-creative.raygun4cfml.RaygunClient").init(
7+
apiKey = "<your API key>"
8+
);
9+
10+
try {
11+
(1/0);
12+
} catch(any e) {
13+
result = raygun.send(e);
14+
}
15+
}
16+
17+
</cfscript>

tests/tests_manual/test-gh-58.cfm

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<cfscript>
2+
raygun = createObject("component","nz.co.ventego-creative.raygun4cfml.RaygunClient").init(
3+
apiKey = "<your API key>",
4+
contentFilter = createObject(
5+
"component",
6+
"nz.co.ventego-creative.raygun4cfml.RaygunContentFilter"
7+
).init( [
8+
{
9+
filter : "ghjdfkgdt",
10+
replacement : "__hjkjkpassword__"
11+
},
12+
{
13+
filter : "ghjdyt767fkgdt",
14+
replacement : "__hjkjkpassword__"
15+
},
16+
{
17+
filter : "fgdgf",
18+
replacement : "__hjkjkpassword__"
19+
}
20+
] )
21+
);
22+
23+
try {
24+
(1/0);
25+
} catch(any e) {
26+
result = raygun.send(e);
27+
}
28+
29+
30+
</cfscript>

tests/tests_manual/test-gh-62.cfm

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<cfscript>
2+
3+
customUserDataStruct = {
4+
key1 = {
5+
password = "secret"
6+
},
7+
key2 = {
8+
password = "secret"
9+
}
10+
};
11+
customUserData = createObject("nz.co.ventego-creative.raygun4cfml.RaygunUserCustomData").init(customUserDataStruct);
12+
13+
contentFilterArray = [{
14+
filter = "password",
15+
replacement = "__password__"}
16+
];
17+
contentFilter = createObject("nz.co.ventego-creative.raygun4cfml.RaygunContentFilter").init(contentFilterArray);
18+
19+
raygun = createObject("component","nz.co.ventego-creative.raygun4cfml.RaygunClient").init(
20+
apiKey = "<your API key>",
21+
contentFilter = contentFilter
22+
);
23+
24+
try {
25+
(1/0);
26+
} catch (any e) {
27+
result = raygun.send(issueDataStruct = e, userCustomData = customUserData);
28+
}
29+
30+
31+
</cfscript>

0 commit comments

Comments
 (0)