Giter Site home page Giter Site logo

Comments (3)

hansenmc avatar hansenmc commented on June 18, 2024

We used to throw an exception if the number of URIs exceeded the URIs count, but rather than IllegalStateException it was an ArrayIndexOutOfBounds:

https://github.com/marklogic/corb2/blob/a161d974ef32ec132cb0b1293e8ad11a958e78f8/src/main/java/com/marklogic/developer/corb/Manager.java#L728

if (count >= urisArray.length) {
    throw new ArrayIndexOutOfBoundsException("received more than " + total + " results: " + uri);
}

We could override the ArrayQueue.add() and change the behavior. If the capacity is exceeded, should we catch the IllegalStateException and then:

  • log a WARNING or ERROR
  • keep processing (without throwing) ignore that URI and subsequent URIs? Only processing up to the count that was specified?

Or, log the warning and instantiate a new larger Array? That could get expensive/slow depending on whether we grow incrementally, or by some percentage, and if we were to go down that route, we should consider just using an ArrayList instead of Array, or maybe create an ArrayListQueue?

from corb2.

hansenmc avatar hansenmc commented on June 18, 2024

Actually, it looks as if we expected to be able to catch when the number of URIs exceeded the count in the QueryUrisLoader, but are using queue.add()
https://github.com/marklogic/corb2/blob/master/src/main/java/com/marklogic/developer/corb/QueryUrisLoader.java#L169
and should instead be using queue.offer()

I'll take a look and do some testing.

from corb2.

bbandlamudi avatar bbandlamudi commented on June 18, 2024

Thanks Mads! Regarding your first question, I am a little unsure about whether to increase (expensive) the array size with a warning or fail with a proper error (and a non-zero exit code). Though it offers flexibility, we may not want to cover up the mistake from the developers. However, if we do allow it, should we opt for having little bit of internal buffer (few extra spaces for few additional elements) rather than unlimited array size adjustments?

We still want to adjust to lesser value as we can get less number of uris when there are empty strings in between.

from corb2.

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.