Giter Club home page Giter Club logo

Comments (2)

athakor avatar athakor commented on July 28, 2024

@runevalle-cognite i dont think so we need to add %s instead of %d, because with the %d format specifier, you can use an argument of all integral types including byte, short, int, long and BigInteger. you can see here argument position is long.

from java-storage.

runevalle-cognite avatar runevalle-cognite commented on July 28, 2024

@athakor
Yes, if it had been the standard formater that had been used, %d would have worked, however that is not the case in guava Preconditions.

Part of stack trace that lead to the discovery of this bug:
com.google.cloud.storage.StorageException: java.lang.IllegalArgumentException: Position should be non-negative, is %d [-1] at com.google.cloud.storage.StorageException.translateAndThrow(StorageException.java:74) at com.google.cloud.storage.BlobReadChannel.read(BlobReadChannel.java:141)

Outline of to reproduce:

  • Establish a channel to a google storage bucket.
  • channel.seek(-1);
  • channel.read(buffer)

Documentation for guava:
https://guava.dev/releases/19.0/api/docs/com/google/common/base/Preconditions.html#checkArgument(boolean,%20java.lang.String,%20java.lang.Object...)

Relevant source code line in the formater that is actually used:
https://github.com/google/guava/blob/master/guava/src/com/google/common/base/Strings.java#L276

from java-storage.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.