Skip to content

Conversation

bchapuis
Copy link
Member

@bchapuis bchapuis commented Apr 4, 2025

  • Extract serialization logic
  • Introduce builder patter
  • Reduce visibility of internal classes
  • Improve resource management
  • Split unit tests
  • Improve the javadoc

*/
@Override
public void serialize(List<Entry> entries, OutputStream output) throws IOException {
var buffer = ByteBuffer.allocate(entries.size() * 48);

Check notice

Code scanning / CodeQL

Unread local variable Note

Variable 'ByteBuffer buffer' is never read.

Copilot Autofix

AI 7 months ago

To fix the problem, we need to remove the declaration and assignment of the buffer variable, as it is not used anywhere in the method. This change will not affect the existing functionality of the code, as the variable is currently redundant.

Suggested changeset 1
baremaps-pmtiles/src/main/java/org/apache/baremaps/pmtiles/EntrySerializer.java

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/baremaps-pmtiles/src/main/java/org/apache/baremaps/pmtiles/EntrySerializer.java b/baremaps-pmtiles/src/main/java/org/apache/baremaps/pmtiles/EntrySerializer.java
--- a/baremaps-pmtiles/src/main/java/org/apache/baremaps/pmtiles/EntrySerializer.java
+++ b/baremaps-pmtiles/src/main/java/org/apache/baremaps/pmtiles/EntrySerializer.java
@@ -49,3 +49,2 @@
   public void serialize(List<Entry> entries, OutputStream output) throws IOException {
-    var buffer = ByteBuffer.allocate(entries.size() * 48);
     varIntSerializer.writeVarInt(output, entries.size());
EOF
@@ -49,3 +49,2 @@
public void serialize(List<Entry> entries, OutputStream output) throws IOException {
var buffer = ByteBuffer.allocate(entries.size() * 48);
varIntSerializer.writeVarInt(output, entries.size());
Copilot is powered by AI and may make mistakes. Always verify output.
- Extract serialization logic
- Introduce builder patter
- Reduce visibility of internal classes
- Improve resource management
- Split unit tests
- Improve the javadoc
@bchapuis bchapuis force-pushed the pmtiles-refactoring branch from f45b3a5 to bf8a892 Compare April 4, 2025 22:22
@bchapuis bchapuis merged commit e646718 into main Apr 4, 2025
7 checks passed
@bchapuis bchapuis deleted the pmtiles-refactoring branch April 4, 2025 22:23
Copy link

sonarqubecloud bot commented Apr 4, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant