Coder Social home page Coder Social logo

Comments (16)

fge avatar fge commented on July 22, 2024

Strangely enough, I do use IDEA too (12.0.3) but do not have this problem. Do you use a plugin in particular which makes itself use of Rhino?

Also, I am no expert in Rhino: what do you think is the best way to fix this? You talk about a sealed context and I indeed create one in RhinoHelper's static initializer which is sealed. Does it work if you remove the ctx.seal(null)?

My main problem right now is that I cannot reproduce :/

from json-schema-validator.

fge avatar fge commented on July 22, 2024

OK, I have sent a mail to the mozilla-rhino Google group since I don't have the slightest idea on how to solve that problem... And I still cannot reproduce it.

I'll keep you informed.

from json-schema-validator.

tibidoh avatar tibidoh commented on July 22, 2024

I'm sorry, but it seems that it is a problem of my setup. Rhino from validator has clashed with Rhino v1.6R7 from YUI compressor and IDEA preferred the second one.

Following POM reproduces the issue:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>json-validator-test</groupId>
    <artifactId>json-validator-test</artifactId>
    <version>1.0-SNAPSHOT</version>

    <dependencies>
        <dependency>
            <groupId>com.github.fge</groupId>
            <artifactId>json-schema-validator</artifactId>
            <version>1.6.0</version>

            <exclusions>
                <exclusion>
                    <groupId>org.mozilla</groupId>
                    <artifactId>rhino</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>rhino</groupId>
            <artifactId>js</artifactId>
            <version>1.6R7</version>
        </dependency>
    </dependencies>
</project>

I'm not an expert in Rhino either and I can't advice anything about it but after I removed ctx.seal(null) everything became fine.

from json-schema-validator.

fge avatar fge commented on July 22, 2024

OK but still, the fact that you found a solution seems to tell that there is something that can be done about it...

I'll try and reproduce it with your sample pom.

from json-schema-validator.

fge avatar fge commented on July 22, 2024

OK, reproduced. I obtain the same stack trace.

Hmm... Now I need to analyze. Thanks a lot for the reproducer!

from json-schema-validator.

fge avatar fge commented on July 22, 2024

Good news: I could reproduce the problem and cure it.

Since in 1.99.x the file has moved (it is now in json-schema-core), I have cured the problem there instead. See:

https://github.com/fge/json-schema-core/blob/master/src/main/java/com/github/fge/jsonschema/util/RhinoHelper.java

Can you confirm that it works for you? If it does I'll backport it to 1.6.x and do a 1.6.1.

Original commit:

java-json-tools/json-schema-core@951dd86

from json-schema-validator.

tibidoh avatar tibidoh commented on July 22, 2024

Well, can't say that it completely works on 1.99.10-SNAPSHOT. The validator still crashes with

com.github.fge.jsonschema.exceptions.InvalidSchemaException: invalid schema, cannot continue
    at com.github.fge.jsonschema.processors.validation.ValidationChain$1.process(ValidationChain.java:83)
    at com.github.fge.jsonschema.processors.validation.ValidationChain$1.process(ValidationChain.java:75)
    at com.github.fge.jsonschema.processing.ProcessorSelector$Chooser.process(ProcessorSelector.java:100)
    at com.github.fge.jsonschema.processing.ProcessorChain$ProcessorMerger.process(ProcessorChain.java:135)
    at com.github.fge.jsonschema.processors.validation.ValidationChain.process(ValidationChain.java:69)
    at com.github.fge.jsonschema.processors.validation.ValidationChain.process(ValidationChain.java:37)
    at com.github.fge.jsonschema.processing.ProcessorSelector$Chooser.process(ProcessorSelector.java:100)
    at com.github.fge.jsonschema.processing.ProcessorChain$ProcessorMerger.process(ProcessorChain.java:135)
    at com.github.fge.jsonschema.processors.validation.ValidationProcessor$3.load(ValidationProcessor.java:209)
    at com.github.fge.jsonschema.processors.validation.ValidationProcessor$3.load(ValidationProcessor.java:202)
    at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3579)
    at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2372)
    at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2335)
    at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2250)
    at com.google.common.cache.LocalCache.get(LocalCache.java:3980)
    at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3984)
    at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4868)
    at com.github.fge.jsonschema.processing.ProcessingCache.get(ProcessingCache.java:44)
    at com.github.fge.jsonschema.processors.validation.ValidationProcessor.process(ValidationProcessor.java:78)
    at com.github.fge.jsonschema.main.JsonValidator.doValidate(JsonValidator.java:79)
    at com.github.fge.jsonschema.main.JsonValidator.validate(JsonValidator.java:87)

Which is strange because the same schema is valid for 1.6. But it is completely another problem I hope, so I could say that fix helped :) Please backport it.

from json-schema-validator.

fge avatar fge commented on July 22, 2024

Hmm, care to show the schema?

from json-schema-validator.

fge avatar fge commented on July 22, 2024

OK, 1.6.1 has been put on maven with the fix.

Now, on to the 1.99.x problem, do you reproduce it on the site too (http://json-schema-validator.herokuapp.com)?

from json-schema-validator.

fge avatar fge commented on July 22, 2024

OK, I have a suspiscion: your schema is written for draft v3, right?

1.99.x (and 2.0.x will) default to draft v4.

from json-schema-validator.

tibidoh avatar tibidoh commented on July 22, 2024

Sorry, the schema is pretty complex with lots of references so I can't just copy it into your site. And right, it is written for v3

from json-schema-validator.

tibidoh avatar tibidoh commented on July 22, 2024

BTW thanks for a rapid fix!

from json-schema-validator.

fge avatar fge commented on July 22, 2024

No problem :)

Will you let me know when you have grabbed 1.6.1 so that I can close the issue?

from json-schema-validator.

tibidoh avatar tibidoh commented on July 22, 2024

Yeap, done it already, everything is perfetct

from json-schema-validator.

devorbh avatar devorbh commented on July 22, 2024

Hi, I'm getting below error when trying to validate my schema and json

com.github.fge.jsonschema.exceptions.InvalidSchemaException: invalid schema, cannot continue
at com.github.fge.jsonschema.processors.validation.ValidationChain$1.doException(ValidationChain.java:68)
at com.github.fge.jsonschema.report.ProcessingMessage.asException(ProcessingMessage.java:292)
at com.github.fge.jsonschema.processing.ProcessorChain$1.process(ProcessorChain.java:133)
at com.github.fge.jsonschema.processing.ProcessorChain$ProcessorMerger.process(ProcessorChain.java:187)
at com.github.fge.jsonschema.processing.ProcessingResult.of(ProcessingResult.java:79)
at com.github.fge.jsonschema.processing.CachingProcessor$1.load(CachingProcessor.java:110)
at com.github.fge.jsonschema.processing.CachingProcessor$1.load(CachingProcessor.java:102)
at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3522)
at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2315)
at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2278)
at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2193)
at com.google.common.cache.LocalCache.get(LocalCache.java:3932)
at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3936)
at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4806)

My schema is using enum and patterns, how to deal with it.

from json-schema-validator.

huggsboson avatar huggsboson commented on July 22, 2024

@devorbh it looks like your schema was invalidly specified. Any chance you can paste that here?

from json-schema-validator.

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.