Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix dump memory problem #213

Merged
merged 2 commits into from
Apr 8, 2013
Merged
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
2 changes: 1 addition & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Features

Bug Fixes
---------

* [PR#213](https://github.com/twall/jna/pull/213): Fix `Structure.toString()` not to dump memory when `jna.dump_memory` is false. - [@tomohiron](https://github.com/tomohiron).

Release 3.5.2
=============
Expand Down
2 changes: 1 addition & 1 deletion src/com/sun/jna/Structure.java
Original file line number Diff line number Diff line change
Expand Up @@ -1287,7 +1287,7 @@ public String toString() {
}

public String toString(boolean debug) {
return toString(0, true, true);
return toString(0, true, debug);
}

private String format(Class type) {
Expand Down
4 changes: 4 additions & 0 deletions test/com/sun/jna/StructureTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -1144,6 +1144,10 @@ protected List getFieldOrder() {
assertTrue("Improperly formatted toString(): expected "
+ EXPECTED + "\n" + actual,
actual.matches(EXPECTED));

System.setProperty("jna.dump_memory", "false");
assertFalse("Doesn't dump memory when jna.dump_memory is false",
s.toString().contains("memory dump"));
}

public void testNativeMappedWrite() {
Expand Down