From 2a6ec15be82172865090a26180e03d1f0c08e39a Mon Sep 17 00:00:00 2001 From: Florian Frank Date: Tue, 18 Aug 2015 11:21:09 +0200 Subject: Remove remnants of GPL licenses --- java/src/json/ext/ByteListTranscoder.java | 3 +-- java/src/json/ext/Generator.java | 3 +-- java/src/json/ext/GeneratorMethods.java | 3 +-- java/src/json/ext/GeneratorService.java | 3 +-- java/src/json/ext/GeneratorState.java | 3 +-- java/src/json/ext/OptionsReader.java | 3 +-- java/src/json/ext/Parser.java | 3 +-- java/src/json/ext/Parser.rl | 3 +-- java/src/json/ext/ParserService.java | 3 +-- java/src/json/ext/RuntimeInfo.java | 3 +-- java/src/json/ext/StringDecoder.java | 3 +-- java/src/json/ext/StringEncoder.java | 5 +++++ java/src/json/ext/Utils.java | 3 +-- 13 files changed, 17 insertions(+), 24 deletions(-) (limited to 'java') diff --git a/java/src/json/ext/ByteListTranscoder.java b/java/src/json/ext/ByteListTranscoder.java index ed9e54b..6f6ab66 100644 --- a/java/src/json/ext/ByteListTranscoder.java +++ b/java/src/json/ext/ByteListTranscoder.java @@ -1,8 +1,7 @@ /* * This code is copyrighted work by Daniel Luz . * - * Distributed under the Ruby and GPLv2 licenses; see COPYING and GPL files - * for details. + * Distributed under the Ruby license: https://www.ruby-lang.org/en/about/license.txt */ package json.ext; diff --git a/java/src/json/ext/Generator.java b/java/src/json/ext/Generator.java index ecceb27..d9be209 100644 --- a/java/src/json/ext/Generator.java +++ b/java/src/json/ext/Generator.java @@ -1,8 +1,7 @@ /* * This code is copyrighted work by Daniel Luz . * - * Distributed under the Ruby and GPLv2 licenses; see COPYING and GPL files - * for details. + * Distributed under the Ruby license: https://www.ruby-lang.org/en/about/license.txt */ package json.ext; diff --git a/java/src/json/ext/GeneratorMethods.java b/java/src/json/ext/GeneratorMethods.java index 637b579..bde7a18 100644 --- a/java/src/json/ext/GeneratorMethods.java +++ b/java/src/json/ext/GeneratorMethods.java @@ -1,8 +1,7 @@ /* * This code is copyrighted work by Daniel Luz . * - * Distributed under the Ruby and GPLv2 licenses; see COPYING and GPL files - * for details. + * Distributed under the Ruby license: https://www.ruby-lang.org/en/about/license.txt */ package json.ext; diff --git a/java/src/json/ext/GeneratorService.java b/java/src/json/ext/GeneratorService.java index ed33639..e665ad1 100644 --- a/java/src/json/ext/GeneratorService.java +++ b/java/src/json/ext/GeneratorService.java @@ -1,8 +1,7 @@ /* * This code is copyrighted work by Daniel Luz . * - * Distributed under the Ruby and GPLv2 licenses; see COPYING and GPL files - * for details. + * Distributed under the Ruby license: https://www.ruby-lang.org/en/about/license.txt */ package json.ext; diff --git a/java/src/json/ext/GeneratorState.java b/java/src/json/ext/GeneratorState.java index 3065307..afc7640 100644 --- a/java/src/json/ext/GeneratorState.java +++ b/java/src/json/ext/GeneratorState.java @@ -1,8 +1,7 @@ /* * This code is copyrighted work by Daniel Luz . * - * Distributed under the Ruby and GPLv2 licenses; see COPYING and GPL files - * for details. + * Distributed under the Ruby license: https://www.ruby-lang.org/en/about/license.txt */ package json.ext; diff --git a/java/src/json/ext/OptionsReader.java b/java/src/json/ext/OptionsReader.java index 8212503..9bb6e64 100644 --- a/java/src/json/ext/OptionsReader.java +++ b/java/src/json/ext/OptionsReader.java @@ -1,8 +1,7 @@ /* * This code is copyrighted work by Daniel Luz . * - * Distributed under the Ruby and GPLv2 licenses; see COPYING and GPL files - * for details. + * Distributed under the Ruby license: https://www.ruby-lang.org/en/about/license.txt */ package json.ext; diff --git a/java/src/json/ext/Parser.java b/java/src/json/ext/Parser.java index 37423f5..5458fb1 100644 --- a/java/src/json/ext/Parser.java +++ b/java/src/json/ext/Parser.java @@ -3,8 +3,7 @@ /* * This code is copyrighted work by Daniel Luz . * - * Distributed under the Ruby and GPLv2 licenses; see COPYING and GPL files - * for details. + * Distributed under the Ruby license: https://www.ruby-lang.org/en/about/license.txt */ package json.ext; diff --git a/java/src/json/ext/Parser.rl b/java/src/json/ext/Parser.rl index 6d65963..d43c74f 100644 --- a/java/src/json/ext/Parser.rl +++ b/java/src/json/ext/Parser.rl @@ -1,8 +1,7 @@ /* * This code is copyrighted work by Daniel Luz . * - * Distributed under the Ruby and GPLv2 licenses; see COPYING and GPL files - * for details. + * Distributed under the Ruby license: https://www.ruby-lang.org/en/about/license.txt */ package json.ext; diff --git a/java/src/json/ext/ParserService.java b/java/src/json/ext/ParserService.java index dde8834..b6015f9 100644 --- a/java/src/json/ext/ParserService.java +++ b/java/src/json/ext/ParserService.java @@ -1,8 +1,7 @@ /* * This code is copyrighted work by Daniel Luz . * - * Distributed under the Ruby and GPLv2 licenses; see COPYING and GPL files - * for details. + * Distributed under the Ruby license: https://www.ruby-lang.org/en/about/license.txt */ package json.ext; diff --git a/java/src/json/ext/RuntimeInfo.java b/java/src/json/ext/RuntimeInfo.java index 5de5740..ceaca5b 100644 --- a/java/src/json/ext/RuntimeInfo.java +++ b/java/src/json/ext/RuntimeInfo.java @@ -1,8 +1,7 @@ /* * This code is copyrighted work by Daniel Luz . * - * Distributed under the Ruby and GPLv2 licenses; see COPYING and GPL files - * for details. + * Distributed under the Ruby license: https://www.ruby-lang.org/en/about/license.txt */ package json.ext; diff --git a/java/src/json/ext/StringDecoder.java b/java/src/json/ext/StringDecoder.java index 6023113..76cf183 100644 --- a/java/src/json/ext/StringDecoder.java +++ b/java/src/json/ext/StringDecoder.java @@ -1,8 +1,7 @@ /* * This code is copyrighted work by Daniel Luz . * - * Distributed under the Ruby and GPLv2 licenses; see COPYING and GPL files - * for details. + * Distributed under the Ruby license: https://www.ruby-lang.org/en/about/license.txt */ package json.ext; diff --git a/java/src/json/ext/StringEncoder.java b/java/src/json/ext/StringEncoder.java index 57bd19b..9d40dd3 100644 --- a/java/src/json/ext/StringEncoder.java +++ b/java/src/json/ext/StringEncoder.java @@ -1,3 +1,8 @@ +/* + * This code is copyrighted work by Daniel Luz . + * + * Distributed under the Ruby license: https://www.ruby-lang.org/en/about/license.txt + */ package json.ext; import org.jruby.exceptions.RaiseException; diff --git a/java/src/json/ext/Utils.java b/java/src/json/ext/Utils.java index 44d6a55..ed6f832 100644 --- a/java/src/json/ext/Utils.java +++ b/java/src/json/ext/Utils.java @@ -1,8 +1,7 @@ /* * This code is copyrighted work by Daniel Luz . * - * Distributed under the Ruby and GPLv2 licenses; see COPYING and GPL files - * for details. + * Distributed under the Ruby license: https://www.ruby-lang.org/en/about/license.txt */ package json.ext; -- cgit v1.2.1 From 5fd6c4e168005c68995a97ef436725a01c42dfd9 Mon Sep 17 00:00:00 2001 From: Florian Frank Date: Thu, 25 Feb 2016 00:10:42 +0100 Subject: Call OBJECT_HANDLER for objects without #to_json as a last-ditch effort. --- java/src/json/ext/Generator.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'java') diff --git a/java/src/json/ext/Generator.java b/java/src/json/ext/Generator.java index d9be209..bb3a394 100644 --- a/java/src/json/ext/Generator.java +++ b/java/src/json/ext/Generator.java @@ -427,11 +427,14 @@ public final class Generator { new Handler() { @Override RubyString generateNew(Session session, IRubyObject object) { - IRubyObject result = - object.callMethod(session.getContext(), "to_json", - new IRubyObject[] {session.getState()}); - if (result instanceof RubyString) return (RubyString)result; - throw session.getRuntime().newTypeError("to_json must return a String"); + if (object.respondsTo("to_json")) { + IRubyObject result = object.callMethod(session.getContext(), "to_json", + new IRubyObject[] {session.getState()}); + if (result instanceof RubyString) return (RubyString)result; + throw session.getRuntime().newTypeError("to_json must return a String"); + } else { + return OBJECT_HANDLER.generateNew(session, object); + } } @Override -- cgit v1.2.1