jrjackson 0.2.5 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 53842b80863cf3aa8239c790f2c98fdad8b71031
4
- data.tar.gz: a62f9967a20c1e039e9d791302de4cded88453a1
3
+ metadata.gz: 0f9e650b921f331f6c35671692b6ea5b37e79bd4
4
+ data.tar.gz: c2724492377c6d3edca12a2da84314c5ed250c14
5
5
  SHA512:
6
- metadata.gz: 49f9bab08c76222bd499ff821b937027c7f72d5f5cd1a256597e37cbb1ec3d2fd98f09f61ab0e3fa5b28da3ab19a01239ee07e8a1e24819aa1f1e117fc091289
7
- data.tar.gz: b85776403df1201994debe1982583a774a08d52d2762227c335a1e6303a3f96d2769e9d00ce0c078d02a2ab9db715f91082e4f477aa054184566dc39226cea69
6
+ metadata.gz: 18a45247d04538ddce6d35c9dd9a8462e9569b243132f443d2ab373362e7eaf4685966c48c79a435366f97024e49961acd8722cef2826a9acaf33ad6d1c9ac48
7
+ data.tar.gz: 6d71d6fce9f140dad56018c3025b48dca19d2c243b87845bc4b69f1e5eb44a0843bbacb8414e8758f6f39351b27ee9cd8d12c423ff7a3f29c2012df58eaaca50
data/Rakefile CHANGED
@@ -1,4 +1,5 @@
1
1
  require 'rspec/core/rake_task'
2
+ require 'bundler'
2
3
 
3
4
  Bundler::GemHelper.install_tasks
4
5
 
data/changelog.md ADDED
@@ -0,0 +1,66 @@
1
+ v0.2.6
2
+ fix issue-20
3
+ allow jruby to convert Ruby StringIO into Java
4
+ by not type checking passed arg
5
+ this is because jruby 1.7.9 has changed the type of java object backing Ruby StingIO
6
+ jar compiled for jruby 1.7.8 (jruby 1.7.9 in the maven repo has an error in the pom.xml)
7
+ jruby 1.7.8, jruby 1.7.9 (tested)
8
+ jackson 2.3.0
9
+
10
+ v0.2.5
11
+ fix issue-16
12
+ reduce the gem size by:
13
+ change pom.xml to only include relevant java jars
14
+ exclude benchmaking from the gemspec files
15
+ jruby 1.7.5
16
+ jackson 2.2.3
17
+
18
+ v0.2.4
19
+ fix issue-15
20
+ return Ruby nil instead of Java null
21
+ fix issue-14
22
+ remove all usage of Ruby.getGlobalRuntime
23
+ pass the runtime from the calling Ruby ThreadContext into the deserializers and converters
24
+ jruby 1.7.5
25
+ jackson 2.2.3
26
+
27
+ v0.2.3
28
+ fix issue-12
29
+ improve the serialization support for non Json Datatype Ruby objects
30
+ now has support for serializing via toJava, to_h, to_hash, to_a, to_json
31
+ fix for failing MultiJson unicode test
32
+ jruby 1.7.4
33
+ jackson 2.2.3
34
+
35
+ v0.2.2
36
+ fix issue-13
37
+ compile Java for 1.6 compatibility
38
+ documentation tweaks
39
+ jruby 1.7.4
40
+ jackson 2.2.3
41
+
42
+ v0.2.1
43
+ documentation tweaks
44
+ fix issue-7
45
+ add pluggable String and Symbol Converters for JSON values
46
+ jruby 1.7.4
47
+ jackson 2.2.3
48
+
49
+ v0.2.0
50
+ extract all Java -> Ruby generation to reusable RubyUtils static class
51
+ support BigDecimal
52
+ remove JSON Api
53
+ fixes issues 5, 6, 8,
54
+
55
+ jruby 1.7.3
56
+ jackson 2.2.2
57
+
58
+ v0.1.1
59
+ fix Time regex
60
+ v0.1.0
61
+ MutiJson compatibility
62
+ switch to using almost all Java, i.e. define most of the ruby modules in Java
63
+ jruby 1.7.3
64
+ jackson 2.1.4
65
+ v0.0.7
66
+ first release - minimal jruby wrapper around jackson 1.9.5 jars
@@ -4,7 +4,7 @@
4
4
  <groupId>com.jrjackson.jruby</groupId>
5
5
  <artifactId>jrjackson</artifactId>
6
6
  <name>jrjackson</name>
7
- <version>1.2.7</version>
7
+ <version>1.2.8</version>
8
8
  <url>http://maven.apache.org</url>
9
9
  <build>
10
10
  <plugins>
@@ -67,7 +67,7 @@
67
67
  <dependency>
68
68
  <groupId>org.jruby</groupId>
69
69
  <artifactId>jruby</artifactId>
70
- <version>1.7.5</version>
70
+ <version>1.7.8</version>
71
71
  <scope>compile</scope>
72
72
  </dependency>
73
73
  </dependencies>
@@ -1,7 +1,7 @@
1
1
  module JrJackson
2
2
  module BuildInfo
3
3
  def self.version
4
- '0.2.5'
4
+ '0.2.6'
5
5
  end
6
6
 
7
7
  def self.files
@@ -3,8 +3,8 @@ unless RUBY_PLATFORM =~ /java/
3
3
  exit 255
4
4
  end
5
5
 
6
- require_relative "jars/jrjackson-1.2.7.jar"
7
- # require_relative "linked/jrjackson-1.2.7.jar"
6
+ require_relative "jars/jrjackson-1.2.8.jar"
7
+ # require_relative "linked/jrjackson-1.2.8.jar"
8
8
 
9
9
  require 'com/jrjackson/jr_jackson'
10
10
 
@@ -14,7 +14,7 @@ module JrJackson
14
14
  TIME_REGEX = %r(\A(\d{4}-\d\d-\d\d|(\w{3}\s){2}\d\d)\s\d\d:\d\d:\d\d)
15
15
 
16
16
  def load(json_string, options = nil)
17
- if json_string.is_a?(String) && json_string =~ TIME_REGEX
17
+ if json_string.is_a?(String) && is_time_string?(json_string)
18
18
  return JrJackson::Raw.parse_raw("\"#{json_string}\"")
19
19
  end
20
20
 
@@ -52,6 +52,14 @@ module JrJackson
52
52
 
53
53
  alias :parse :load
54
54
  alias :generate :dump
55
+
56
+ private
57
+
58
+ def is_time_string?(json_string)
59
+ json_string =~ TIME_REGEX
60
+ rescue => e
61
+ raise JrJackson::ParseError, e.message
62
+ end
55
63
  end
56
64
  end
57
65
  end
data/pom.xml CHANGED
@@ -5,7 +5,7 @@
5
5
  <groupId>com.jrjackson.jruby</groupId>
6
6
  <artifactId>jrjackson</artifactId>
7
7
  <packaging>jar</packaging>
8
- <version>1.2.7</version>
8
+ <version>1.2.8</version>
9
9
  <name>jrjackson</name>
10
10
  <url>http://maven.apache.org</url>
11
11
 
@@ -23,27 +23,27 @@
23
23
  <dependency>
24
24
  <groupId>org.jruby</groupId>
25
25
  <artifactId>jruby</artifactId>
26
- <version>1.7.5</version>
26
+ <version>1.7.8</version>
27
27
  </dependency>
28
28
  <dependency>
29
29
  <groupId>com.fasterxml.jackson.core</groupId>
30
30
  <artifactId>jackson-core</artifactId>
31
- <version>2.2.3</version>
31
+ <version>2.3.0</version>
32
32
  </dependency>
33
33
  <dependency>
34
34
  <groupId>com.fasterxml.jackson.core</groupId>
35
35
  <artifactId>jackson-annotations</artifactId>
36
- <version>2.2.3</version>
36
+ <version>2.3.0</version>
37
37
  </dependency>
38
38
  <dependency>
39
39
  <groupId>com.fasterxml.jackson.core</groupId>
40
40
  <artifactId>jackson-databind</artifactId>
41
- <version>2.2.3</version>
41
+ <version>2.3.0</version>
42
42
  </dependency>
43
43
  <dependency>
44
44
  <groupId>com.fasterxml.jackson.module</groupId>
45
45
  <artifactId>jackson-module-afterburner</artifactId>
46
- <version>2.2.3</version>
46
+ <version>2.3.0</version>
47
47
  </dependency>
48
48
  </dependencies>
49
49
  <build>
@@ -1,23 +1,23 @@
1
1
  #!/bin/sh
2
2
 
3
- # ruby benchmarking/individual/json-mri-sourced.rb
4
- # ruby benchmarking/individual/oj-mri-sourced.rb
3
+ ruby benchmarking/individual/json-mri-sourced.rb
4
+ ruby benchmarking/individual/oj-mri-sourced.rb
5
5
 
6
- # jruby -J-Xmn512m -J-Xms2048m -J-Xmx2048m benchmarking/individual/gson-jr-sourced.rb
7
- # jruby -J-Xmn512m -J-Xms2048m -J-Xmx2048m benchmarking/individual/json-jr-sourced.rb
6
+ chruby-exec jruby -- jruby -J-Xmn512m -J-Xms2048m -J-Xmx2048m benchmarking/individual/gson-jr-sourced.rb
7
+ chruby-exec jruby -- jruby -J-Xmn512m -J-Xms2048m -J-Xmx2048m benchmarking/individual/json-jr-sourced.rb
8
8
 
9
- jruby -J-Xmn512m -J-Xms2048m -J-Xmx2048m benchmarking/individual/string-jr-sourced.rb
10
- jruby -J-Xmn512m -J-Xms2048m -J-Xmx2048m benchmarking/individual/str-bd-jr-sourced.rb
9
+ chruby-exec jruby -- jruby -J-Xmn512m -J-Xms2048m -J-Xmx2048m benchmarking/individual/string-jr-sourced.rb
10
+ chruby-exec jruby -- jruby -J-Xmn512m -J-Xms2048m -J-Xmx2048m benchmarking/individual/str-bd-jr-sourced.rb
11
11
 
12
- jruby -J-Xmn512m -J-Xms2048m -J-Xmx2048m benchmarking/individual/symbol-jr-sourced.rb
13
- jruby -J-Xmn512m -J-Xms2048m -J-Xmx2048m benchmarking/individual/sym-bd-jr-sourced.rb
12
+ chruby-exec jruby -- jruby -J-Xmn512m -J-Xms2048m -J-Xmx2048m benchmarking/individual/symbol-jr-sourced.rb
13
+ chruby-exec jruby -- jruby -J-Xmn512m -J-Xms2048m -J-Xmx2048m benchmarking/individual/sym-bd-jr-sourced.rb
14
14
 
15
- jruby -J-Xmn512m -J-Xms2048m -J-Xmx2048m benchmarking/individual/raw-jr-sourced.rb
16
- jruby -J-Xmn512m -J-Xms2048m -J-Xmx2048m benchmarking/individual/raw-bd-jr-sourced.rb
15
+ chruby-exec jruby -- jruby -J-Xmn512m -J-Xms2048m -J-Xmx2048m benchmarking/individual/raw-jr-sourced.rb
16
+ chruby-exec jruby -- jruby -J-Xmn512m -J-Xms2048m -J-Xmx2048m benchmarking/individual/raw-bd-jr-sourced.rb
17
17
 
18
- # ruby benchmarking/individual/json-gen-mri-sourced.rb
19
- # ruby benchmarking/individual/oj-gen-mri-sourced.rb
18
+ ruby benchmarking/individual/json-gen-mri-sourced.rb
19
+ ruby benchmarking/individual/oj-gen-mri-sourced.rb
20
20
 
21
- # jruby -J-Xmn512m -J-Xms2048m -J-Xmx2048m benchmarking/individual/json-gen-jr-sourced.rb
22
- # jruby -J-Xmn512m -J-Xms2048m -J-Xmx2048m benchmarking/individual/gson-gen-jr-sourced.rb
23
- jruby -J-Xmn512m -J-Xms2048m -J-Xmx2048m benchmarking/individual/raw-gen-jr-sourced.rb
21
+ chruby-exec jruby -- jruby -J-Xmn512m -J-Xms2048m -J-Xmx2048m benchmarking/individual/json-gen-jr-sourced.rb
22
+ chruby-exec jruby -- jruby -J-Xmn512m -J-Xms2048m -J-Xmx2048m benchmarking/individual/gson-gen-jr-sourced.rb
23
+ chruby-exec jruby -- jruby -J-Xmn512m -J-Xms2048m -J-Xmx2048m benchmarking/individual/raw-gen-jr-sourced.rb
@@ -6,11 +6,8 @@ import org.jruby.RubyObject;
6
6
  import org.jruby.RubyString;
7
7
  import org.jruby.RubySymbol;
8
8
  import org.jruby.RubyHash;
9
- import org.jruby.RubyIO;
10
9
  import org.jruby.anno.JRubyMethod;
11
10
  import org.jruby.anno.JRubyModule;
12
- import org.jruby.exceptions.RaiseException;
13
- import org.jruby.ext.stringio.RubyStringIO;
14
11
  import org.jruby.java.addons.IOJavaAddons;
15
12
  import org.jruby.runtime.ThreadContext;
16
13
  import org.jruby.runtime.builtin.IRubyObject;
@@ -105,11 +102,10 @@ public class JrJacksonRaw extends RubyObject {
105
102
  o = mapper.readValue(
106
103
  ((RubyString)arg).getBytes(), Object.class
107
104
  );
108
- } else if ((arg instanceof RubyIO) || (arg instanceof RubyStringIO)) {
105
+ } else {
106
+ // must be an IO object then
109
107
  IRubyObject stream = IOJavaAddons.AnyIO.any_to_inputstream(context, arg);
110
108
  o = mapper.readValue((InputStream)stream.toJava(InputStream.class), Object.class);
111
- } else {
112
- throw ruby.newArgumentError("Unsupported source. This method accepts String or IO");
113
109
  }
114
110
  return RubyUtils.rubyObject(ruby, o);
115
111
  }
@@ -8,6 +8,7 @@ require 'test/unit'
8
8
  require 'thread'
9
9
  require 'bigdecimal'
10
10
  require 'jrjackson'
11
+ require 'stringio'
11
12
 
12
13
  class JrJacksonTest < Test::Unit::TestCase
13
14
 
@@ -98,6 +99,19 @@ class JrJacksonTest < Test::Unit::TestCase
98
99
  assert_equal expected, actual
99
100
  end
100
101
 
102
+ def test_stringio
103
+ expected = {"foo" => 5}
104
+ json = ::StringIO.new('{"foo":5}')
105
+ actual = JrJackson::Json.load(json)
106
+ assert_equal expected, actual
107
+ end
108
+
109
+ def test_bad_utf
110
+ assert_raise JrJackson::ParseError do
111
+ JrJackson::Json.load("\x82\xAC\xEF")
112
+ end
113
+ end
114
+
101
115
  def test_can_parse_big_decimals
102
116
  expected = BigDecimal.new '0.12345678901234567890123456789'
103
117
  json = '{"foo":0.12345678901234567890123456789}'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jrjackson
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Guy Boertje
@@ -14,14 +14,14 @@ dependencies:
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.0'
27
27
  description: A mostly native JRuby wrapper for the java jackson json processor jar
@@ -31,16 +31,17 @@ executables: []
31
31
  extensions: []
32
32
  extra_rdoc_files: []
33
33
  files:
34
- - .gitignore
35
- - .jrubyrc
34
+ - ".gitignore"
35
+ - ".jrubyrc"
36
36
  - Gemfile
37
37
  - README.md
38
38
  - Rakefile
39
+ - changelog.md
39
40
  - dependency-reduced-pom.xml
40
41
  - jrjackson.gemspec
41
42
  - lib/jrjackson.rb
42
43
  - lib/jrjackson/build_info.rb
43
- - lib/jrjackson/jars/jrjackson-1.2.7.jar
44
+ - lib/jrjackson/jars/jrjackson-1.2.8.jar
44
45
  - lib/jrjackson/jrjackson.rb
45
46
  - lib/require_relative_patch.rb
46
47
  - pom.xml
@@ -68,19 +69,18 @@ require_paths:
68
69
  - lib
69
70
  required_ruby_version: !ruby/object:Gem::Requirement
70
71
  requirements:
71
- - - '>='
72
+ - - ">="
72
73
  - !ruby/object:Gem::Version
73
74
  version: '0'
74
75
  required_rubygems_version: !ruby/object:Gem::Requirement
75
76
  requirements:
76
- - - '>='
77
+ - - ">="
77
78
  - !ruby/object:Gem::Version
78
79
  version: '0'
79
80
  requirements: []
80
81
  rubyforge_project:
81
- rubygems_version: 2.0.3
82
+ rubygems_version: 2.2.0
82
83
  signing_key:
83
84
  specification_version: 4
84
85
  summary: A JRuby wrapper for the java jackson json processor jar
85
86
  test_files: []
86
- has_rdoc:
Binary file