Code Monkey home page Code Monkey logo

Comments (6)

spring-projects-issues avatar spring-projects-issues commented on May 7, 2024

Michael Nitschinger commented

This exception originates on the server side, it shows that you have invalid chars in your documents. Can you pinpoint this document and send it along? Has it been stored through spring-data-couchbase? If so we should make sure they can't go through

from spring-data-couchbase.

spring-projects-issues avatar spring-projects-issues commented on May 7, 2024

deepak vohra commented

Why don't the other methods in CrudRepository, including findOne and findAll, on the same document generate an exception if the document has invalid chars? The documents are added with save(Iterable<S> entities) method. The example used is

ArrayList arrayList = new ArrayList();
Catalog catalog1 = new Catalog("Oracle_Magazine", "Oracle_Publishing",
"November-December_2013", "Engineering as a Service",
"David_A._Kelly");

Catalog catalog2 = new Catalog("Oracle_Magazine", "Oracle_Publishing",
          "11/12_2013", "Engineering_as_a_Service", "Kelly, David");
arrayList.add(catalog1);
arrayList.add(catalog2);
repository.save(arrayList);

The generated JSON is
{
"journal": "Oracle_Magazine",
"author": "David_A._Kelly",
"edition": "November-December_2013",
"title": "Engineering as a Service",
"_class": "com.couchbase.model.Catalog",
"publisher": "Oracle_Publishing"
}

and:
{
"journal": "Oracle_Magazine",
"author": "Kelly, David",
"edition": "11/12_2013",
"title": "Engineering_as_a_Service",
"_class": "com.couchbase.model.Catalog",
"publisher": "Oracle_Publishing"
}

from spring-data-couchbase.

spring-projects-issues avatar spring-projects-issues commented on May 7, 2024

deepak vohra commented

Even if the document fields are empty except the Id an exception is generated.

For example,

Catalog catalog1 = new Catalog("", "",
"", "Engineering as a Service",
"");

Catalog catalog2 = new Catalog("", "",
          "", "Engineering_as_a_Service", "");
arrayList.add(catalog1);
arrayList.add(catalog2);
repository.save(arrayList);

The following code snippet generates an exception.

ArrayList arrayList = new ArrayList();
arrayList.add("catalog:engineering-as-a-service");
arrayList.add("catalog:engineering_as_a_service");

Iterable<Catalog> iterable = repository.findAll(arrayList);

from spring-data-couchbase.

spring-projects-issues avatar spring-projects-issues commented on May 7, 2024

deepak vohra commented

Even the following documents, which don't have very many chars,generate an exception.

Save with:
Catalog catalog1 = new Catalog("", "",
"", "a",
"");

Catalog catalog2 = new Catalog("", "",
          "", "b", "");
arrayList.add(catalog1);
arrayList.add(catalog2);
repository.save(arrayList);

Find with:

arrayList.add("a");
arrayList.add("b");

Iterable<Catalog> iterable = repository.findAll(arrayList);
Iterator<Catalog> iter = iterable.iterator();

from spring-data-couchbase.

spring-projects-issues avatar spring-projects-issues commented on May 7, 2024

deepak vohra commented

The exception is generated due an invalid char in the JSON generated for the request and is not related to JSON stored in the datastore

from spring-data-couchbase.

spring-projects-issues avatar spring-projects-issues commented on May 7, 2024

Michael Nitschinger commented

I tried the code and it works without issues.

Also note that the findAll() method doesn't work this way as described here. No argument is supported there, if you want a custom method you need to add one to your interface with a Query param.

Please reopen if you still have issues with the current master, and if possible provide a complete code example with data and server version that I can reproduce.

Thanks!

from spring-data-couchbase.

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.