Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
Openfire
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
Administrator
Openfire
Commits
d913a858
Commit
d913a858
authored
Dec 20, 2016
by
Dave Cridland
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OF-1156 Make storing null in caches non-fatal by default
parent
ebc579ea
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
2 deletions
+12
-2
DefaultCache.java
src/java/org/jivesoftware/util/cache/DefaultCache.java
+12
-2
No files found.
src/java/org/jivesoftware/util/cache/DefaultCache.java
View file @
d913a858
...
...
@@ -28,6 +28,7 @@ import java.util.Map;
import
java.util.NoSuchElementException
;
import
java.util.Set
;
import
org.jivesoftware.util.JiveGlobals
;
import
org.jivesoftware.util.LinkedListNode
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -61,6 +62,7 @@ public class DefaultCache<K, V> implements Cache<K, V> {
private
static
final
String
NULL_KEY_IS_NOT_ALLOWED
=
"Null key is not allowed!"
;
private
static
final
String
NULL_VALUE_IS_NOT_ALLOWED
=
"Null value is not allowed!"
;
private
static
final
boolean
allowNull
=
JiveGlobals
.
getBooleanProperty
(
"cache.allow.null"
,
true
);
private
static
final
Logger
Log
=
LoggerFactory
.
getLogger
(
DefaultCache
.
class
);
...
...
@@ -701,8 +703,16 @@ public class DefaultCache<K, V> implements Cache<K, V> {
}
private
void
checkNotNull
(
final
Object
argument
,
final
String
message
)
{
if
(
argument
==
null
)
{
throw
new
NullPointerException
(
message
);
try
{
if
(
argument
==
null
)
{
throw
new
NullPointerException
(
message
);
}
}
catch
(
NullPointerException
e
)
{
if
(
allowNull
)
{
Log
.
error
(
"Ignoring null store in Cache: "
,
e
);
// Gives us a trace for debugging.
}
else
{
throw
e
;
}
}
}
}
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