vandershraaf / Crunchbase4J

Simple Java library for Crunchbase API
2 stars 1 forks source link

Unrecognized field "name," error #4

Open vandershraaf opened 10 years ago

vandershraaf commented 10 years ago

When running TestEntityList test, it caught error with stacktrace below:

com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "name," (class com.ashrafishak.crunchbase4j.entitylist.Entity), not marked as ignorable (2 known properties: , "name", "permalink"])
 at [Source: sun.net.www.protocol.http.HttpURLConnection$HttpInputStream@43c332b8; line: 2, column: 46] (through reference chain: com.ashrafishak.crunchbase4j.entitylist.Entity["name,"])
    at com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException.from(UnrecognizedPropertyException.java:79)
    at com.fasterxml.jackson.databind.DeserializationContext.reportUnknownProperty(DeserializationContext.java:568)
    at com.fasterxml.jackson.databind.deser.std.StdDeserializer.handleUnknownProperty(StdDeserializer.java:649)
    at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownProperty(BeanDeserializerBase.java:830)
    at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:310)
    at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:112)
    at com.fasterxml.jackson.databind.deser.std.ObjectArrayDeserializer.deserialize(ObjectArrayDeserializer.java:147)
    at com.fasterxml.jackson.databind.deser.std.ObjectArrayDeserializer.deserialize(ObjectArrayDeserializer.java:18)
    at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:2563)
    at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:1851)
    at com.ashrafishak.crunchbase4j.Crunchbase4J.pullCrunchbaseApi(Crunchbase4J.java:267)
    at com.ashrafishak.crunchbase4j.Crunchbase4J.getEntityList(Crunchbase4J.java:217)
    at com.ashrafishak.crunchbase4j.TestEntityList.testEntityList(TestEntityList.java:15)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

At first I thought the error came from Crunchbase4J, but turns out it actually came from the API itself. The property is not named properly; it should be "name", and not "name," (notice the comma next to 'name'). Here is the sample output from API:

[{
    "permalink": "sirius-angel-fund",
    "name,": null
}, {
    "permalink": "east-west-bank",
    "name,": null
}, {
    "permalink": "national-insurance-solutions-nis",
    "name,": null
}, {
    "permalink": "corporate-counsellors",
    "name,": null
}, {
    "permalink": "metacrew-ventures",
    "name,": null
}, {
    "permalink": "venture-partners-mexico",
    "name,": null
}, {
    "permalink": "auria-capital",
    "name,": null
}, {
    "permalink": "danske-bank",
    "name,": null
}, {

To overcome this error, there are 2 ways: 1) Report this bug to Crunchbase developer. 2) Handle the error ourselves; simply rename the property in Jackson mapping.

vandershraaf commented 10 years ago

Labelled it as 'bug'