Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Fastjson
Commits
3339419d
Commit
3339419d
authored
9 years ago
by
高铁
Browse files
Options
Download
Email Patches
Plain Diff
bug fixed for issue 555
parent
6af506c1
master
dependabot/maven/com.fasterxml.jackson.core-jackson-databind-2.12.6.1
dependabot/maven/com.google.code.gson-gson-2.8.9
dependabot/maven/com.google.protobuf-protobuf-java-3.16.1
dependabot/maven/org.codehaus.groovy-groovy-2.4.21
dependabot/maven/org.eclipse.jetty-jetty-server-9.4.41.v20210516
dependabot/maven/org.eclipse.jetty-jetty-webapp-9.4.34.v20201102
dependabot/maven/org.hibernate-hibernate-core-5.4.24.Final
dependabot/maven/org.jetbrains.kotlin-kotlin-stdlib-1.6.0
dependabot/maven/org.springframework-spring-webmvc-5.3.18
issue/#3138
summer_of_code_json_check
1.2.83
1.2.80
1.2.79
1.2.78
1.2.76
1.2.75
1.2.74
1.2.73
1.2.72
1.2.71
1.2.70
1.2.69
1.2.68
1.2.67
1.2.66
1.2.63
1.2.62
1.2.61
1.2.60
1.2.59
1.2.58
1.2.57
1.2.56
1.2.55
1.2.54
1.2.52
1.2.51
1.2.50
1.2.49
1.2.48
1.2.47
1.2.46
1.2.45
1.2.44
1.2.43
1.2.42
1.2.41
1.2.40
1.2.39
1.2.38
1.2.37
1.2.36
1.2.35
1.2.34
1.2.33
1.2.32
1.2.31
1.2.30
1.2.29
1.2.28
1.2.27
1.2.26
1.2.25
1.2.24
1.2.23
1.2.22
1.2.21
1.2.20
1.2.19
1.2.18
1.2.17
1.2.16
1.2.15
1.2.14
1.2.14.sec01
1.2.13
1.2.13.sec01
1.2.12
1.1.37
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/main/java/com/alibaba/fastjson/util/JavaBeanInfo.java
+13
-1
src/main/java/com/alibaba/fastjson/util/JavaBeanInfo.java
src/test/java/com/alibaba/json/bvt/bug/Bug_for_issue_555.java
+34
-0
...test/java/com/alibaba/json/bvt/bug/Bug_for_issue_555.java
src/test/java/com/alibaba/json/bvt/bug/Bug_for_issue_555_setter.java
+44
-0
...va/com/alibaba/json/bvt/bug/Bug_for_issue_555_setter.java
src/test/java/com/alibaba/json/bvt/bug/Bug_for_issue_555_setter2.java
+45
-0
...a/com/alibaba/json/bvt/bug/Bug_for_issue_555_setter2.java
with
136 additions
and
1 deletion
+136
-1
src/main/java/com/alibaba/fastjson/util/JavaBeanInfo.java
+
13
-
1
View file @
3339419d
...
...
@@ -403,6 +403,10 @@ public class JavaBeanInfo {
fieldAnnotation
=
field
.
getAnnotation
(
JSONField
.
class
);
if
(
fieldAnnotation
!=
null
)
{
if
(!
fieldAnnotation
.
deserialize
())
{
continue
;
}
ordinal
=
fieldAnnotation
.
ordinal
();
serialzeFeatures
=
SerializerFeature
.
of
(
fieldAnnotation
.
serialzeFeatures
());
parserFeatures
=
Feature
.
of
(
fieldAnnotation
.
parseFeatures
());
...
...
@@ -444,6 +448,10 @@ public class JavaBeanInfo {
JSONField
fieldAnnotation
=
field
.
getAnnotation
(
JSONField
.
class
);
if
(
fieldAnnotation
!=
null
)
{
if
(!
fieldAnnotation
.
deserialize
())
{
continue
;
}
ordinal
=
fieldAnnotation
.
ordinal
();
serialzeFeatures
=
SerializerFeature
.
of
(
fieldAnnotation
.
serialzeFeatures
());
parserFeatures
=
Feature
.
of
(
fieldAnnotation
.
parseFeatures
());
...
...
@@ -480,12 +488,16 @@ public class JavaBeanInfo {
String
propertyName
;
JSONField
annotation
=
method
.
getAnnotation
(
JSONField
.
class
);
if
(
annotation
!=
null
&&
annotation
.
deserialize
())
{
continue
;
}
if
(
annotation
!=
null
&&
annotation
.
name
().
length
()
>
0
)
{
propertyName
=
annotation
.
name
();
}
else
{
propertyName
=
Character
.
toLowerCase
(
methodName
.
charAt
(
3
))
+
methodName
.
substring
(
4
);
}
FieldInfo
fieldInfo
=
getField
(
fieldList
,
propertyName
);
if
(
fieldInfo
!=
null
)
{
continue
;
...
...
This diff is collapsed.
Click to expand it.
src/test/java/com/alibaba/json/bvt/bug/Bug_for_issue_555.java
0 → 100644
+
34
-
0
View file @
3339419d
package
com.alibaba.json.bvt.bug
;
import
java.util.List
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
junit.framework.TestCase
;
public
class
Bug_for_issue_555
extends
TestCase
{
public
void
test_for_issue
()
throws
Exception
{
JSON
.
parseObject
(
"{\"list\":[{\"spec\":{}}]}"
,
A
.
class
);
}
public
static
class
A
{
public
List
<
B
>
list
;
}
public
static
class
B
{
@JSONField
(
serialize
=
true
,
deserialize
=
false
)
public
Spec
spec
;
}
public
static
class
Spec
{
private
int
id
;
public
Spec
(
int
id
)
{
this
.
id
=
id
;
}
}
}
This diff is collapsed.
Click to expand it.
src/test/java/com/alibaba/json/bvt/bug/Bug_for_issue_555_setter.java
0 → 100644
+
44
-
0
View file @
3339419d
package
com.alibaba.json.bvt.bug
;
import
java.util.List
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
junit.framework.TestCase
;
public
class
Bug_for_issue_555_setter
extends
TestCase
{
public
void
test_for_issue
()
throws
Exception
{
JSON
.
parseObject
(
"{\"list\":[{\"spec\":{}}]}"
,
A
.
class
);
}
public
static
class
A
{
public
List
<
B
>
list
;
}
public
static
class
B
{
@JSONField
(
serialize
=
true
,
deserialize
=
false
)
private
Spec
spec
;
public
Spec
getSpec
()
{
return
spec
;
}
public
void
setSpec
(
Spec
spec
)
{
this
.
spec
=
spec
;
}
}
public
static
class
Spec
{
private
int
id
;
public
Spec
(
int
id
){
this
.
id
=
id
;
}
}
}
This diff is collapsed.
Click to expand it.
src/test/java/com/alibaba/json/bvt/bug/Bug_for_issue_555_setter2.java
0 → 100644
+
45
-
0
View file @
3339419d
package
com.alibaba.json.bvt.bug
;
import
java.util.List
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
junit.framework.TestCase
;
public
class
Bug_for_issue_555_setter2
extends
TestCase
{
public
void
test_for_issue
()
throws
Exception
{
JSON
.
parseObject
(
"{\"list\":[{\"spec\":{}}]}"
,
A
.
class
);
}
public
static
class
A
{
public
List
<
B
>
list
;
}
public
static
class
B
{
private
Spec
spec
;
@JSONField
(
serialize
=
true
,
deserialize
=
false
)
public
Spec
getSpec
()
{
return
spec
;
}
@JSONField
(
serialize
=
true
,
deserialize
=
false
)
public
void
setSpec
(
Spec
spec
)
{
this
.
spec
=
spec
;
}
}
public
static
class
Spec
{
private
int
id
;
public
Spec
(
int
id
){
this
.
id
=
id
;
}
}
}
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
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
Menu
Projects
Groups
Snippets
Help