Skip to content
Open
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
4 changes: 1 addition & 3 deletions src/test/java/org/xerial/snappy/SnappyOutputStreamTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,7 @@ public void batchingOfWritesShouldNotAffectCompressedDataSize()
byte[] expectedCompressedData = compressAsChunks(orig, Integer.MAX_VALUE);
// Hardcoding an expected compressed size here will catch regressions that lower the
// compression quality:
if (ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN)
assertEquals(90992, expectedCompressedData.length);
else if(OSInfo.getArchName() == "aarch64")
if(OSInfo.getArchName() == "aarch64")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

In Java, you should use the .equals() method for string comparison instead of ==. The == operator checks for reference equality (whether they are the same object), not value equality (whether they have the same character sequence). While this might work in some cases due to string interning, it's not a reliable practice and can lead to unexpected behavior. Using .equals() is safer and more explicit.

Suggested change
if(OSInfo.getArchName() == "aarch64")
if("aarch64".equals(OSInfo.getArchName()))

// Arm has a better compression ratio
assertEquals(91051, expectedCompressedData.length);
else
Expand Down
Loading