manticore 0.6.2-java → 0.6.3-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 52e7c6c63c54c59317eb836e5caa6cc1dbb08fc1
4
- data.tar.gz: 362d618ee0a1e92762bd5acbb9639c0ea18af0e9
3
+ metadata.gz: 8b96d1eb1f7f1e5b6885a5f08e24ba394ac9fac0
4
+ data.tar.gz: 1ff15070f745905119d536ae7df328ce845990a6
5
5
  SHA512:
6
- metadata.gz: ab0c5c529908001ac420bc3c82234ff9016139024211dc2e1e9111dc71e43b37b6ce92c674a5b67c270329de752e3d33fc9e8cb726246a792bdc060e02bb3881
7
- data.tar.gz: 1aa799e26509c9e0ce51be46b5cf3f156bd0bfc33f9ecc8a41c136a039f2547ef8e8d0ad479afcfd69a34b6d0fbdb7525e670d65c8c594e51d50a4c53a04a62f
6
+ metadata.gz: 1f08d3632cbe683ce2456e4cde41d05545bdf5926992067f06f25af1477d9a31bac90d797a88a4f4d4a7a56477afd9f725981958ac3082e501c18199da4875b3
7
+ data.tar.gz: d2231b58a53b86bd77af5c2f27f79d9a4ece0d72cffbace8c1a830fefcd33a84f5c710f93d1e55e76637ab48d5966c79f466ee40c911418a59e4ce440576a8c7
@@ -39,14 +39,19 @@ public class Manticore implements Library {
39
39
  @JRubyMethod(name = "read_entity")
40
40
  public IRubyObject readEntity(ThreadContext context, IRubyObject rEntity, Block block) throws IOException {
41
41
  HttpEntity entity = (HttpEntity)rEntity.toJava(HttpEntity.class);
42
+
42
43
  String charset = EntityUtils.getContentCharSet(entity);
43
- if(charset == null) { charset = HTTP.DEFAULT_CONTENT_CHARSET; }
44
- Encoding encoding;
45
- try {
44
+ if (charset == null) {
46
45
  String mimeType = EntityUtils.getContentMimeType(entity);
47
- if (mimeType.startsWith("application/json")) {
46
+ if ( mimeType != null && mimeType.startsWith("application/json") ) {
48
47
  charset = "UTF-8";
48
+ } else {
49
+ charset = HTTP.DEFAULT_CONTENT_CHARSET;
49
50
  }
51
+ }
52
+
53
+ Encoding encoding;
54
+ try {
50
55
  encoding = context.getRuntime().getEncodingService().getEncodingFromString(charset);
51
56
  } catch(Throwable e) {
52
57
  encoding = context.getRuntime().getEncodingService().getEncodingFromString(HTTP.DEFAULT_CONTENT_CHARSET);
@@ -1,3 +1,3 @@
1
1
  module Manticore
2
- VERSION = "0.6.2"
2
+ VERSION = "0.6.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: manticore
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 0.6.3
5
5
  platform: java
6
6
  authors:
7
7
  - Chris Heald