Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
87bccb96
Commit
87bccb96
authored
Jan 08, 2018
by
Phillip Webb
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '1.5.x'
parents
41c02b30
700d3c39
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
620 additions
and
668 deletions
+620
-668
pom.xml
...ng-boot-tools/spring-boot-configuration-processor/pom.xml
+18
-0
README.adoc
...g-boot-configuration-processor/src/json-shade/README.adoc
+5
-0
JSON.java
...pringframework/boot/configurationprocessor/json/JSON.java
+17
-22
JSONArray.java
...framework/boot/configurationprocessor/json/JSONArray.java
+108
-123
JSONException.java
...ework/boot/configurationprocessor/json/JSONException.java
+13
-13
JSONObject.java
...ramework/boot/configurationprocessor/json/JSONObject.java
+178
-207
JSONStringer.java
...mework/boot/configurationprocessor/json/JSONStringer.java
+108
-121
JSONTokener.java
...amework/boot/configurationprocessor/json/JSONTokener.java
+173
-182
No files found.
spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/pom.xml
View file @
87bccb96
...
@@ -36,6 +36,24 @@
...
@@ -36,6 +36,24 @@
<proc>
none
</proc>
<proc>
none
</proc>
</configuration>
</configuration>
</plugin>
</plugin>
<plugin>
<groupId>
org.codehaus.mojo
</groupId>
<artifactId>
build-helper-maven-plugin
</artifactId>
<executions>
<execution>
<id>
add-json-shade-source
</id>
<phase>
generate-sources
</phase>
<goals>
<goal>
add-source
</goal>
</goals>
<configuration>
<sources>
<source>
${basedir}/src/json-shade/java
</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</plugins>
</build>
</build>
</project>
</project>
spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/json-shade/README.adoc
0 → 100644
View file @
87bccb96
## Shaded JSON
This source was originally taken from `com.vaadin.external.google:android-json` which
provides a clean room re-implementation of the `org.json` APIs and does not include the
"Do not use for evil" clause.
spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/
main
/java/org/springframework/boot/configurationprocessor/json/JSON.java
→
spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/
json-shade
/java/org/springframework/boot/configurationprocessor/json/JSON.java
View file @
87bccb96
...
@@ -17,9 +17,7 @@
...
@@ -17,9 +17,7 @@
package
org
.
springframework
.
boot
.
configurationprocessor
.
json
;
package
org
.
springframework
.
boot
.
configurationprocessor
.
json
;
class
JSON
{
class
JSON
{
/**
* Returns the input if it is a JSON-permissible value; throws otherwise.
*/
static
double
checkDouble
(
double
d
)
throws
JSONException
{
static
double
checkDouble
(
double
d
)
throws
JSONException
{
if
(
Double
.
isInfinite
(
d
)
||
Double
.
isNaN
(
d
))
{
if
(
Double
.
isInfinite
(
d
)
||
Double
.
isNaN
(
d
))
{
throw
new
JSONException
(
"Forbidden numeric value: "
+
d
);
throw
new
JSONException
(
"Forbidden numeric value: "
+
d
);
...
@@ -31,12 +29,12 @@ class JSON {
...
@@ -31,12 +29,12 @@ class JSON {
if
(
value
instanceof
Boolean
)
{
if
(
value
instanceof
Boolean
)
{
return
(
Boolean
)
value
;
return
(
Boolean
)
value
;
}
}
else
if
(
value
instanceof
String
)
{
if
(
value
instanceof
String
)
{
String
stringValue
=
(
String
)
value
;
String
stringValue
=
(
String
)
value
;
if
(
"true"
.
equalsIgnoreCase
(
stringValue
))
{
if
(
"true"
.
equalsIgnoreCase
(
stringValue
))
{
return
true
;
return
true
;
}
}
else
if
(
"false"
.
equalsIgnoreCase
(
stringValue
))
{
if
(
"false"
.
equalsIgnoreCase
(
stringValue
))
{
return
false
;
return
false
;
}
}
}
}
...
@@ -47,10 +45,10 @@ class JSON {
...
@@ -47,10 +45,10 @@ class JSON {
if
(
value
instanceof
Double
)
{
if
(
value
instanceof
Double
)
{
return
(
Double
)
value
;
return
(
Double
)
value
;
}
}
else
if
(
value
instanceof
Number
)
{
if
(
value
instanceof
Number
)
{
return
((
Number
)
value
).
doubleValue
();
return
((
Number
)
value
).
doubleValue
();
}
}
else
if
(
value
instanceof
String
)
{
if
(
value
instanceof
String
)
{
try
{
try
{
return
Double
.
valueOf
((
String
)
value
);
return
Double
.
valueOf
((
String
)
value
);
}
}
...
@@ -64,10 +62,10 @@ class JSON {
...
@@ -64,10 +62,10 @@ class JSON {
if
(
value
instanceof
Integer
)
{
if
(
value
instanceof
Integer
)
{
return
(
Integer
)
value
;
return
(
Integer
)
value
;
}
}
else
if
(
value
instanceof
Number
)
{
if
(
value
instanceof
Number
)
{
return
((
Number
)
value
).
intValue
();
return
((
Number
)
value
).
intValue
();
}
}
else
if
(
value
instanceof
String
)
{
if
(
value
instanceof
String
)
{
try
{
try
{
return
(
int
)
Double
.
parseDouble
((
String
)
value
);
return
(
int
)
Double
.
parseDouble
((
String
)
value
);
}
}
...
@@ -81,10 +79,10 @@ class JSON {
...
@@ -81,10 +79,10 @@ class JSON {
if
(
value
instanceof
Long
)
{
if
(
value
instanceof
Long
)
{
return
(
Long
)
value
;
return
(
Long
)
value
;
}
}
else
if
(
value
instanceof
Number
)
{
if
(
value
instanceof
Number
)
{
return
((
Number
)
value
).
longValue
();
return
((
Number
)
value
).
longValue
();
}
}
else
if
(
value
instanceof
String
)
{
if
(
value
instanceof
String
)
{
try
{
try
{
return
(
long
)
Double
.
parseDouble
((
String
)
value
);
return
(
long
)
Double
.
parseDouble
((
String
)
value
);
}
}
...
@@ -98,7 +96,7 @@ class JSON {
...
@@ -98,7 +96,7 @@ class JSON {
if
(
value
instanceof
String
)
{
if
(
value
instanceof
String
)
{
return
(
String
)
value
;
return
(
String
)
value
;
}
}
else
if
(
value
!=
null
)
{
if
(
value
!=
null
)
{
return
String
.
valueOf
(
value
);
return
String
.
valueOf
(
value
);
}
}
return
null
;
return
null
;
...
@@ -109,11 +107,9 @@ class JSON {
...
@@ -109,11 +107,9 @@ class JSON {
if
(
actual
==
null
)
{
if
(
actual
==
null
)
{
throw
new
JSONException
(
"Value at "
+
indexOrName
+
" is null."
);
throw
new
JSONException
(
"Value at "
+
indexOrName
+
" is null."
);
}
}
else
{
throw
new
JSONException
(
"Value "
+
actual
+
" at "
+
indexOrName
+
" of type "
throw
new
JSONException
(
"Value "
+
actual
+
" at "
+
indexOrName
+
actual
.
getClass
().
getName
()
+
" cannot be converted to "
+
" of type "
+
actual
.
getClass
().
getName
()
+
requiredType
);
+
" cannot be converted to "
+
requiredType
);
}
}
}
public
static
JSONException
typeMismatch
(
Object
actual
,
String
requiredType
)
public
static
JSONException
typeMismatch
(
Object
actual
,
String
requiredType
)
...
@@ -121,10 +117,9 @@ class JSON {
...
@@ -121,10 +117,9 @@ class JSON {
if
(
actual
==
null
)
{
if
(
actual
==
null
)
{
throw
new
JSONException
(
"Value is null."
);
throw
new
JSONException
(
"Value is null."
);
}
}
else
{
throw
new
JSONException
(
throw
new
JSONException
(
"Value "
+
actual
"Value "
+
actual
+
" of type "
+
actual
.
getClass
().
getName
()
+
" of type "
+
actual
.
getClass
().
getName
()
+
" cannot be converted to "
+
requiredType
);
+
" cannot be converted to "
+
requiredType
);
}
}
}
}
}
spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/
main
/java/org/springframework/boot/configurationprocessor/json/JSONArray.java
→
spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/
json-shade
/java/org/springframework/boot/configurationprocessor/json/JSONArray.java
View file @
87bccb96
This diff is collapsed.
Click to expand it.
spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/
main
/java/org/springframework/boot/configurationprocessor/json/JSONException.java
→
spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/
json-shade
/java/org/springframework/boot/configurationprocessor/json/JSONException.java
View file @
87bccb96
/*
/*
* Copyright
2012-2018 the original author or authors.
* Copyright
(C) 2010 The Android Open Source Project
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -16,23 +16,22 @@
...
@@ -16,23 +16,22 @@
package
org
.
springframework
.
boot
.
configurationprocessor
.
json
;
package
org
.
springframework
.
boot
.
configurationprocessor
.
json
;
// Note: this class was written without inspecting the non-free org.json source
code.
// Note: this class was written without inspecting the non-free org.json sourcecode.
/**
/**
* Thrown to indicate a problem with the JSON API. Such problems include:
* Thrown to indicate a problem with the JSON API. Such problems include:
* <ul>
* <ul>
*
<li>Attempts to parse or construct malformed documents
* <li>Attempts to parse or construct malformed documents
*
<li>Use of null as a name
* <li>Use of null as a name
*
<li>Use of numeric types not available to JSON, such as {@link
*
<li>Use of numeric types not available to JSON, such as {@link Double#isNaN() NaNs} or
*
Double#isNaN() NaNs} or
{@link Double#isInfinite() infinities}.
* {@link Double#isInfinite() infinities}.
*
<li>Lookups using an out of range index or nonexistent name
* <li>Lookups using an out of range index or nonexistent name
*
<li>Type mismatches on lookups
* <li>Type mismatches on lookups
* </ul>
* </ul>
*
* <p>
* <p>Although this is a checked exception, it is rarely recoverable. Most
* Although this is a checked exception, it is rarely recoverable. Most callers should
* callers should simply wrap this exception in an unchecked exception and
* simply wrap this exception in an unchecked exception and rethrow: <pre class="code">
* rethrow:
* public JSONArray toJSONObject() {
* <pre> public JSONArray toJSONObject() {
* try {
* try {
* JSONObject result = new JSONObject();
* JSONObject result = new JSONObject();
* ...
* ...
...
@@ -46,4 +45,5 @@ public class JSONException extends Exception {
...
@@ -46,4 +45,5 @@ public class JSONException extends Exception {
public
JSONException
(
String
s
)
{
public
JSONException
(
String
s
)
{
super
(
s
);
super
(
s
);
}
}
}
}
spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/
main
/java/org/springframework/boot/configurationprocessor/json/JSONObject.java
→
spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/
json-shade
/java/org/springframework/boot/configurationprocessor/json/JSONObject.java
View file @
87bccb96
This diff is collapsed.
Click to expand it.
spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/
main
/java/org/springframework/boot/configurationprocessor/json/JSONStringer.java
→
spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/
json-shade
/java/org/springframework/boot/configurationprocessor/json/JSONStringer.java
View file @
87bccb96
This diff is collapsed.
Click to expand it.
spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/
main
/java/org/springframework/boot/configurationprocessor/json/JSONTokener.java
→
spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/
json-shade
/java/org/springframework/boot/configurationprocessor/json/JSONTokener.java
View file @
87bccb96
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment