Skip to content

Adding error check of unsupported types #482

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 9, 2018

Conversation

zhenlineo
Copy link
Contributor

@zhenlineo zhenlineo requested a review from lutovich April 3, 2018 14:37
Copy link
Contributor

@lutovich lutovich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zhenlineo review completed. Made two comments. It would also be nice to add ITs which use nodes, relationships and paths as query parameters.

@@ -91,6 +94,10 @@ public static Value value( Object value )
{
if ( value == null ) { return NullValue.NULL; }

if ( value instanceof NodeValue || value instanceof RelationshipValue || value instanceof PathValue )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it will be better to prohibit node, relationship and path in PackStreamMessageFormatV1. It is clear that struct packing code is the single point that writes structs to the channel. While Values#value() is just one of many factory methods.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason to do it outside/earlier is because when we got an error there, we will kill the connection, which seems too aggressive. So if we could found the error in advance, then we will simply pop an error to the surface.

@@ -70,12 +70,12 @@ public void shouldTypeAsNode()
assertThat( value.typeConstructor(), equalTo( TypeConstructor.NODE ) );
}

private NodeValue emptyNodeValue()
public static NodeValue emptyNodeValue()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please extract NodeValueTest#emptyNodeValue(), PathValueTest#pathValue() and RelationshipValueTest#emptyRelationshipValue() into a test utility class. Alternatively ValuesTest could just create it's own node, relationship and path values.

@zhenlineo zhenlineo force-pushed the 1.6-param-types branch 2 times, most recently from 5150775 to 6984fa0 Compare April 4, 2018 16:17
The input parameters could be of type:
* Map<String, Object>
* Record
* MapValue generated via Values#parameters
* MapValue

If the input parameters are provided by a Map<String, Object> or Record, or Values#parameters, then any unsupported types will be captured via Values#value.

If the input parameters are provided by a MapValue directly, then any unsupported types will be captured at PackStream#pack.
…est util

Some tests needs this server side packer to serialize such types.
@lutovich lutovich merged commit eddabdb into neo4j:1.6 Apr 9, 2018
@lutovich lutovich deleted the 1.6-param-types branch April 9, 2018 12:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants