{"action":"created","issue":{"url":"https://api.github.com/repos/orientechnologies/orientdb/issues/6484","repository_url":"https://api.github.com/repos/orientechnologies/orientdb","labels_url":"https://api.github.com/repos/orientechnologies/orientdb/issues/6484/labels{/name}","comments_url":"https://api.github.com/repos/orientechnologies/orientdb/issues/6484/comments","events_url":"https://api.github.com/repos/orientechnologies/orientdb/issues/6484/events","html_url":"https://github.com/orientechnologies/orientdb/issues/6484","id":168539020,"number":6484,"title":"Creating a sequence using the API and the example in the docs throws NPE","user":{"login":"odysseaspenta","id":794419,"avatar_url":"https://avatars.githubusercontent.com/u/794419?v=3","gravatar_id":"","url":"https://api.github.com/users/odysseaspenta","html_url":"https://github.com/odysseaspenta","followers_url":"https://api.github.com/users/odysseaspenta/followers","following_url":"https://api.github.com/users/odysseaspenta/following{/other_user}","gists_url":"https://api.github.com/users/odysseaspenta/gists{/gist_id}","starred_url":"https://api.github.com/users/odysseaspenta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/odysseaspenta/subscriptions","organizations_url":"https://api.github.com/users/odysseaspenta/orgs","repos_url":"https://api.github.com/users/odysseaspenta/repos","events_url":"https://api.github.com/users/odysseaspenta/events{/privacy}","received_events_url":"https://api.github.com/users/odysseaspenta/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/orientechnologies/orientdb/labels/bug","name":"bug","color":"ededed"}],"state":"closed","locked":false,"assignee":{"login":"luigidellaquila","id":459289,"avatar_url":"https://avatars.githubusercontent.com/u/459289?v=3","gravatar_id":"","url":"https://api.github.com/users/luigidellaquila","html_url":"https://github.com/luigidellaquila","followers_url":"https://api.github.com/users/luigidellaquila/followers","following_url":"https://api.github.com/users/luigidellaquila/following{/other_user}","gists_url":"https://api.github.com/users/luigidellaquila/gists{/gist_id}","starred_url":"https://api.github.com/users/luigidellaquila/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/luigidellaquila/subscriptions","organizations_url":"https://api.github.com/users/luigidellaquila/orgs","repos_url":"https://api.github.com/users/luigidellaquila/repos","events_url":"https://api.github.com/users/luigidellaquila/events{/privacy}","received_events_url":"https://api.github.com/users/luigidellaquila/received_events","type":"User","site_admin":false},"assignees":[{"login":"luigidellaquila","id":459289,"avatar_url":"https://avatars.githubusercontent.com/u/459289?v=3","gravatar_id":"","url":"https://api.github.com/users/luigidellaquila","html_url":"https://github.com/luigidellaquila","followers_url":"https://api.github.com/users/luigidellaquila/followers","following_url":"https://api.github.com/users/luigidellaquila/following{/other_user}","gists_url":"https://api.github.com/users/luigidellaquila/gists{/gist_id}","starred_url":"https://api.github.com/users/luigidellaquila/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/luigidellaquila/subscriptions","organizations_url":"https://api.github.com/users/luigidellaquila/orgs","repos_url":"https://api.github.com/users/luigidellaquila/repos","events_url":"https://api.github.com/users/luigidellaquila/events{/privacy}","received_events_url":"https://api.github.com/users/luigidellaquila/received_events","type":"User","site_admin":false}],"milestone":null,"comments":3,"created_at":"2016-07-31T21:22:39Z","updated_at":"2016-08-04T06:23:39Z","closed_at":"2016-08-03T08:27:58Z","body":"## OrientDB Version, operating system, or hardware.\n- v2.2.5\n\n## Operating System\n- [X] Linux\n\n## Expected behavior and actual behavior\nWhen using the example from the documentation that describes how to create a sequence using the API, a NullPointerException is generated. The example looks like:\n```\nOSequenceLibrary sequenceLibrary = database.getMetadata().getSequenceLibrary();\nOSequence seq = sequenceLibrary.createSequence(\"idseq\", SEQUENCE_TYPE.ORDERED, new OSequence.CreateParams().setStart(0));\n```\nThe issue is on line 98 of OSequence class. The code expects the increment parameter to be set but the example doesn't set a value which causes an NPE. Setting a default value of 1 for the increment should take care of the issue.\n```\n  protected void initSequence(OSequence.CreateParams params) {\n    setStart(params.start);\n    setIncrement(params.increment);\n    setValue(params.start);\n\n    setSequenceType();\n  }\n```\nand the stack trace is:\n```\njava.lang.NullPointerException\n\tat com.orientechnologies.orient.core.metadata.sequence.OSequence.initSequence(OSequence.java:98)\n\tat com.orientechnologies.orient.core.metadata.sequence.OSequence.<init>(OSequence.java:92)\n\tat com.orientechnologies.orient.core.metadata.sequence.OSequenceOrdered.<init>(OSequenceOrdered.java:25)\n\tat com.orientechnologies.orient.core.metadata.sequence.OSequenceHelper.createSequence(OSequenceHelper.java:16)\n\tat com.orientechnologies.orient.core.metadata.sequence.OSequenceLibraryImpl.createSequence(OSequenceLibraryImpl.java:77)\n\tat com.orientechnologies.orient.core.metadata.sequence.OSequenceLibraryProxy.createSequence(OSequenceLibraryProxy.java:36)\n\tat \n```\nIt was fixed in our code by initializing the increment parameter in addition to the starting value first.\n"},"comment":{"url":"https://api.github.com/repos/orientechnologies/orientdb/issues/comments/237463352","html_url":"https://github.com/orientechnologies/orientdb/issues/6484#issuecomment-237463352","issue_url":"https://api.github.com/repos/orientechnologies/orientdb/issues/6484","id":237463352,"user":{"login":"smolinari","id":3314957,"avatar_url":"https://avatars.githubusercontent.com/u/3314957?v=3","gravatar_id":"","url":"https://api.github.com/users/smolinari","html_url":"https://github.com/smolinari","followers_url":"https://api.github.com/users/smolinari/followers","following_url":"https://api.github.com/users/smolinari/following{/other_user}","gists_url":"https://api.github.com/users/smolinari/gists{/gist_id}","starred_url":"https://api.github.com/users/smolinari/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smolinari/subscriptions","organizations_url":"https://api.github.com/users/smolinari/orgs","repos_url":"https://api.github.com/users/smolinari/repos","events_url":"https://api.github.com/users/smolinari/events{/privacy}","received_events_url":"https://api.github.com/users/smolinari/received_events","type":"User","site_admin":false},"created_at":"2016-08-04T06:23:39Z","updated_at":"2016-08-04T06:23:39Z","body":"Could it be feasible to allow the client to select the starting point of the increment? \r\n\r\nScott"}}
{"actor":{"display_login":"smolinari"}}