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
e3bfd797
Commit
e3bfd797
authored
Jan 04, 2018
by
Stephane Nicoll
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '1.5.x'
parents
bee5fa7f
d49b022c
Changes
12
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
2612 additions
and
20 deletions
+2612
-20
checkstyle-suppressions.xml
...ng-boot-parent/src/checkstyle/checkstyle-suppressions.xml
+1
-0
pom.xml
...ng-boot-tools/spring-boot-configuration-processor/pom.xml
+1
-6
JSONOrderedObject.java
...ot/configurationprocessor/metadata/JSONOrderedObject.java
+3
-3
JsonConverter.java
...k/boot/configurationprocessor/metadata/JsonConverter.java
+3
-4
JsonMarshaller.java
.../boot/configurationprocessor/metadata/JsonMarshaller.java
+3
-4
ConfigurationMetadataAnnotationProcessorTests.java
...cessor/ConfigurationMetadataAnnotationProcessorTests.java
+3
-3
JSON.java
...pringframework/boot/configurationprocessor/json/JSON.java
+116
-0
JSONArray.java
...framework/boot/configurationprocessor/json/JSONArray.java
+615
-0
JSONException.java
...ework/boot/configurationprocessor/json/JSONException.java
+49
-0
JSONObject.java
...ramework/boot/configurationprocessor/json/JSONObject.java
+775
-0
JSONStringer.java
...mework/boot/configurationprocessor/json/JSONStringer.java
+432
-0
JSONTokener.java
...amework/boot/configurationprocessor/json/JSONTokener.java
+611
-0
No files found.
spring-boot-project/spring-boot-parent/src/checkstyle/checkstyle-suppressions.xml
View file @
e3bfd797
...
...
@@ -22,4 +22,5 @@
<suppress
files=
"Ansi.*\.java"
checks=
"JavadocStyle"
/>
<suppress
files=
"LogLevel\.java"
checks=
"JavadocVariable"
/>
<suppress
files=
"HelpMojo\.java"
checks=
".*"
/>
<suppress
files=
"[\\/]org.springframework.boot.configurationprocessor.json[\\/].*\.java$"
checks=
".*"
/>
</suppressions>
spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/pom.xml
View file @
e3bfd797
...
...
@@ -14,11 +14,6 @@
<main.basedir>
${basedir}/../../..
</main.basedir>
</properties>
<dependencies>
<!-- Compile (should stick to the bare minimum) -->
<dependency>
<groupId>
com.vaadin.external.google
</groupId>
<artifactId>
android-json
</artifactId>
</dependency>
<!-- Test -->
<dependency>
<groupId>
org.projectlombok
</groupId>
...
...
spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/JSONOrderedObject.java
View file @
e3bfd797
/*
* Copyright 2012-201
7
the original author or authors.
* Copyright 2012-201
8
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -20,8 +20,8 @@ import java.util.Iterator;
import
java.util.LinkedHashSet
;
import
java.util.Set
;
import
org.json.JSONException
;
import
org.json.JSONObject
;
import
org.
springframework.boot.configurationprocessor.
json.JSONException
;
import
org.
springframework.boot.configurationprocessor.
json.JSONObject
;
/**
* Extension to {@link JSONObject} that remembers the order of inserts.
...
...
spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/JsonConverter.java
View file @
e3bfd797
/*
* Copyright 2012-201
7
the original author or authors.
* Copyright 2012-201
8
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -20,9 +20,8 @@ import java.lang.reflect.Array;
import
java.util.Collection
;
import
java.util.Map
;
import
org.json.JSONArray
;
import
org.json.JSONObject
;
import
org.springframework.boot.configurationprocessor.json.JSONArray
;
import
org.springframework.boot.configurationprocessor.json.JSONObject
;
import
org.springframework.boot.configurationprocessor.metadata.ItemMetadata.ItemType
;
/**
...
...
spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/JsonMarshaller.java
View file @
e3bfd797
/*
* Copyright 2012-201
7
the original author or authors.
* Copyright 2012-201
8
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -27,9 +27,8 @@ import java.util.Iterator;
import
java.util.List
;
import
java.util.Map
;
import
org.json.JSONArray
;
import
org.json.JSONObject
;
import
org.springframework.boot.configurationprocessor.json.JSONArray
;
import
org.springframework.boot.configurationprocessor.json.JSONObject
;
import
org.springframework.boot.configurationprocessor.metadata.ItemMetadata.ItemType
;
/**
...
...
spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/ConfigurationMetadataAnnotationProcessorTests.java
View file @
e3bfd797
/*
* Copyright 2012-201
7
the original author or authors.
* Copyright 2012-201
8
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -23,14 +23,14 @@ import java.time.Duration;
import
java.util.Arrays
;
import
java.util.Collections
;
import
org.json.JSONArray
;
import
org.json.JSONObject
;
import
org.junit.Before
;
import
org.junit.Rule
;
import
org.junit.Test
;
import
org.junit.rules.ExpectedException
;
import
org.junit.rules.TemporaryFolder
;
import
org.springframework.boot.configurationprocessor.json.JSONArray
;
import
org.springframework.boot.configurationprocessor.json.JSONObject
;
import
org.springframework.boot.configurationprocessor.metadata.ConfigurationMetadata
;
import
org.springframework.boot.configurationprocessor.metadata.ItemDeprecation
;
import
org.springframework.boot.configurationprocessor.metadata.ItemHint
;
...
...
spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/json/JSON.java
0 → 100644
View file @
e3bfd797
/*
* Copyright (C) 2010 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
springframework
.
boot
.
configurationprocessor
.
json
;
class
JSON
{
/**
* Returns the input if it is a JSON-permissible value; throws otherwise.
*/
static
double
checkDouble
(
double
d
)
throws
JSONException
{
if
(
Double
.
isInfinite
(
d
)
||
Double
.
isNaN
(
d
))
{
throw
new
JSONException
(
"Forbidden numeric value: "
+
d
);
}
return
d
;
}
static
Boolean
toBoolean
(
Object
value
)
{
if
(
value
instanceof
Boolean
)
{
return
(
Boolean
)
value
;
}
else
if
(
value
instanceof
String
)
{
String
stringValue
=
(
String
)
value
;
if
(
"true"
.
equalsIgnoreCase
(
stringValue
))
{
return
true
;
}
else
if
(
"false"
.
equalsIgnoreCase
(
stringValue
))
{
return
false
;
}
}
return
null
;
}
static
Double
toDouble
(
Object
value
)
{
if
(
value
instanceof
Double
)
{
return
(
Double
)
value
;
}
else
if
(
value
instanceof
Number
)
{
return
((
Number
)
value
).
doubleValue
();
}
else
if
(
value
instanceof
String
)
{
try
{
return
Double
.
valueOf
((
String
)
value
);
}
catch
(
NumberFormatException
ignored
)
{
}
}
return
null
;
}
static
Integer
toInteger
(
Object
value
)
{
if
(
value
instanceof
Integer
)
{
return
(
Integer
)
value
;
}
else
if
(
value
instanceof
Number
)
{
return
((
Number
)
value
).
intValue
();
}
else
if
(
value
instanceof
String
)
{
try
{
return
(
int
)
Double
.
parseDouble
((
String
)
value
);
}
catch
(
NumberFormatException
ignored
)
{
}
}
return
null
;
}
static
Long
toLong
(
Object
value
)
{
if
(
value
instanceof
Long
)
{
return
(
Long
)
value
;
}
else
if
(
value
instanceof
Number
)
{
return
((
Number
)
value
).
longValue
();
}
else
if
(
value
instanceof
String
)
{
try
{
return
(
long
)
Double
.
parseDouble
((
String
)
value
);
}
catch
(
NumberFormatException
ignored
)
{
}
}
return
null
;
}
static
String
toString
(
Object
value
)
{
if
(
value
instanceof
String
)
{
return
(
String
)
value
;
}
else
if
(
value
!=
null
)
{
return
String
.
valueOf
(
value
);
}
return
null
;
}
public
static
JSONException
typeMismatch
(
Object
indexOrName
,
Object
actual
,
String
requiredType
)
throws
JSONException
{
if
(
actual
==
null
)
{
throw
new
JSONException
(
"Value at "
+
indexOrName
+
" is null."
);
}
else
{
throw
new
JSONException
(
"Value "
+
actual
+
" at "
+
indexOrName
+
" of type "
+
actual
.
getClass
().
getName
()
+
" cannot be converted to "
+
requiredType
);
}
}
public
static
JSONException
typeMismatch
(
Object
actual
,
String
requiredType
)
throws
JSONException
{
if
(
actual
==
null
)
{
throw
new
JSONException
(
"Value is null."
);
}
else
{
throw
new
JSONException
(
"Value "
+
actual
+
" of type "
+
actual
.
getClass
().
getName
()
+
" cannot be converted to "
+
requiredType
);
}
}
}
spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/json/JSONArray.java
0 → 100644
View file @
e3bfd797
This diff is collapsed.
Click to expand it.
spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/json/JSONException.java
0 → 100644
View file @
e3bfd797
/*
* Copyright (C) 2010 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
springframework
.
boot
.
configurationprocessor
.
json
;
// 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:
* <ul>
* <li>Attempts to parse or construct malformed documents
* <li>Use of null as a name
* <li>Use of numeric types not available to JSON, such as {@link
* Double#isNaN() NaNs} or {@link Double#isInfinite() infinities}.
* <li>Lookups using an out of range index or nonexistent name
* <li>Type mismatches on lookups
* </ul>
*
* <p>Although this is a checked exception, it is rarely recoverable. Most
* callers should simply wrap this exception in an unchecked exception and
* rethrow:
* <pre> public JSONArray toJSONObject() {
* try {
* JSONObject result = new JSONObject();
* ...
* } catch (JSONException e) {
* throw new RuntimeException(e);
* }
* }</pre>
*/
public
class
JSONException
extends
Exception
{
public
JSONException
(
String
s
)
{
super
(
s
);
}
}
spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/json/JSONObject.java
0 → 100644
View file @
e3bfd797
This diff is collapsed.
Click to expand it.
spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/json/JSONStringer.java
0 → 100644
View file @
e3bfd797
This diff is collapsed.
Click to expand it.
spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/json/JSONTokener.java
0 → 100644
View file @
e3bfd797
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