DiceTechnology / dice-where

IP to Location lookup library
MIT License
3 stars 0 forks source link

ID-1570 - Fix dice-where and update dce-id to use the latest version #113

Closed snackk closed 2 weeks ago

snackk commented 1 month ago

Alternative to -> https://github.com/DiceTechnology/dice-where/pull/112

WHAT

Fix dice-where and update dce-id to use the newest dice-where version.


We call .md5() twice on the same StreamWithMD5Decorator object. This causes the second invocation to return the incorrect hash.

This causes dice-where to download a file successfully, but not return the correct DownloadExecutionResult when it’s finished processing. The error is triggered in the ID test DiceWhereDownloaderScheduleJobTest .

WHY

Recently dice-where was updated to add extra md5 checks prevent faulty downloads. We need to update id to use the newest version.

Sadly the above change also introduced a bug for services using dice-where as a library. This also needs to be fixed so that we can use the updated version in id.

AC

Fix context

  @Override
  public int read(byte[] b, int off, int len) throws IOException {
    return inputStream.read(b, off, len);
  }

Override was necessary to keep the digest updated as the InputStream is being ingested in batches rather than in one sitting.

codecov[bot] commented 3 weeks ago

Codecov Report

Attention: Patch coverage is 77.77778% with 2 lines in your changes missing coverage. Please review.

Project coverage is 58.78%. Comparing base (6703b9d) to head (e8f49a5).

Files Patch % Lines
...ownloader/destination/local/LocalFileAcceptor.java 0.00% 1 Missing :warning:
...here/downloader/stream/StreamWithMD5Decorator.java 87.50% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #113 +/- ## ============================================ + Coverage 58.75% 58.78% +0.03% - Complexity 370 371 +1 ============================================ Files 97 97 Lines 1913 1917 +4 Branches 167 167 ============================================ + Hits 1124 1127 +3 - Misses 730 731 +1 Partials 59 59 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.