Clojure

NPE when creating an empty array of ints, longs, floats or doubles

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: Release 1.1
  • Component/s: None
  • Labels:
    None
  • Approval:
    Ok

Description

(int-array []) should return an empty array - the same as (int-array 0). Also true for long-array, float-array and double-array.

user=> (doc int-array)
-------------------------
clojure.core/int-array
([size-or-seq] [size init-val-or-seq])
Creates an array of ints

OK:
user=> (int-array [1 2])
#<int[] [I@1342ba4>
user=> (vec (int-array [1 2]))
[1 2]

NPE:
user=> (int-array [])
java.lang.NullPointerException (NO_SOURCE_FILE:0)

OK:
user=> (int-array 2)
#<int[] [I@18d9850>
user=> (vec (int-array 2))
[0 0]
user=> (int-array 0)
#<int[] [I@1e97f9f>
user=> (vec (int-array 0))
[]

NPE:
user=> (long-array [])
java.lang.NullPointerException (NO_SOURCE_FILE:0)
user=> (float-array [])
java.lang.NullPointerException (NO_SOURCE_FILE:0)
user=> (double-array [])
java.lang.NullPointerException (NO_SOURCE_FILE:0)

user=> (int-array ())
java.lang.NullPointerException (NO_SOURCE_FILE:0)
user=> (int-array {})
java.lang.NullPointerException (NO_SOURCE_FILE:0)
user=> (int-array #{})
java.lang.NullPointerException (NO_SOURCE_FILE:0)

Activity

Hide
Assembla Importer added a comment -

fsodomka said: [file:b0V98YAUWr3Qj6eJe5afGb]: fix errors and add tests

Show
Assembla Importer added a comment - fsodomka said: [file:b0V98YAUWr3Qj6eJe5afGb]: fix errors and add tests
Hide
Assembla Importer added a comment -

fsodomka said: See patch fix_and_test_146.diff. Fixes Java code and adds tests. It is my first patch for the Java code of Clojure, so be careful

Show
Assembla Importer added a comment - fsodomka said: See patch fix_and_test_146.diff. Fixes Java code and adds tests. It is my first patch for the Java code of Clojure, so be careful
Hide
Assembla Importer added a comment -

fsodomka said: [file:aa7RF6AVOr3PFkeJe5afGb]: fix errors and add tests

Show
Assembla Importer added a comment - fsodomka said: [file:aa7RF6AVOr3PFkeJe5afGb]: fix errors and add tests
Hide
Assembla Importer added a comment -

richhickey said: A better fix is to use RT.count(s) rather than s.count(). Then there is no special handling.

Show
Assembla Importer added a comment - richhickey said: A better fix is to use RT.count(s) rather than s.count(). Then there is no special handling.
Hide
Assembla Importer added a comment -

fsodomka said: [file:bNDk58GSGr3OJWeJe5aVNr]: fix errors and add tests

Show
Assembla Importer added a comment - fsodomka said: [file:bNDk58GSGr3OJWeJe5aVNr]: fix errors and add tests
Hide
Assembla Importer added a comment -

fsodomka said: New version of patch uploaded. See if this works.

Show
Assembla Importer added a comment - fsodomka said: New version of patch uploaded. See if this works.
Hide
Assembla Importer added a comment -

richhickey said: Patch v3 is ok, thanks

Show
Assembla Importer added a comment - richhickey said: Patch v3 is ok, thanks
Hide
Assembla Importer added a comment -

chouser@n01se.net said: Child association with ticket #188 was added

Show
Assembla Importer added a comment - chouser@n01se.net said: Child association with ticket #188 was added
Hide
Assembla Importer added a comment -

fsodomka said: (In [[r:270185aba54cef1d8ce59ec347b5623f2e502afe]]) fixed NPE when creating an empty array of ints, longs, floats or doubles, fixes #146

Signed-off-by: Chouser <chouser@n01se.net>

Branch: master

Show
Assembla Importer added a comment - fsodomka said: (In [[r:270185aba54cef1d8ce59ec347b5623f2e502afe]]) fixed NPE when creating an empty array of ints, longs, floats or doubles, fixes #146 Signed-off-by: Chouser <chouser@n01se.net> Branch: master

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: