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
66755105
Commit
66755105
authored
Jan 13, 2020
by
Stephane Nicoll
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '2.1.x' into 2.2.x
Closes gh-19682
parents
0c7dae0d
e87ed08e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
8 deletions
+35
-8
PoolingDataSourceBean.java
...ingframework/boot/jta/bitronix/PoolingDataSourceBean.java
+10
-7
PoolingDataSourceBeanTests.java
...amework/boot/jta/bitronix/PoolingDataSourceBeanTests.java
+25
-1
No files found.
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jta/bitronix/PoolingDataSourceBean.java
View file @
66755105
/*
* Copyright 2012-20
19
the original author or authors.
* Copyright 2012-20
20
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.
...
...
@@ -107,13 +107,16 @@ public class PoolingDataSourceBean extends PoolingDataSource implements BeanName
@Override
public
Logger
getParentLogger
()
throws
SQLFeatureNotSupportedException
{
try
{
return
this
.
getParentLogger
();
}
catch
(
Exception
ex
)
{
// Work around https://jira.codehaus.org/browse/BTM-134
return
Logger
.
getLogger
(
Logger
.
GLOBAL_LOGGER_NAME
);
XADataSource
dataSource
=
this
.
dataSource
;
if
(
dataSource
!=
null
)
{
try
{
return
dataSource
.
getParentLogger
();
}
catch
(
Exception
ex
)
{
// Swallow and continue
}
}
return
Logger
.
getLogger
(
Logger
.
GLOBAL_LOGGER_NAME
);
}
/**
...
...
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jta/bitronix/PoolingDataSourceBeanTests.java
View file @
66755105
/*
* Copyright 2012-20
19
the original author or authors.
* Copyright 2012-20
20
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.
...
...
@@ -17,6 +17,8 @@
package
org
.
springframework
.
boot
.
jta
.
bitronix
;
import
java.sql.Connection
;
import
java.sql.SQLFeatureNotSupportedException
;
import
java.util.logging.Logger
;
import
javax.sql.XAConnection
;
import
javax.sql.XADataSource
;
...
...
@@ -60,6 +62,28 @@ class PoolingDataSourceBeanTests {
assertThat
(
this
.
bean
.
getUniqueName
()).
isEqualTo
(
"un"
);
}
@Test
void
shouldReturnGlobalLoggerWhenDataSourceIsAbsent
()
throws
SQLFeatureNotSupportedException
{
assertThat
(
this
.
bean
.
getParentLogger
()).
isSameAs
(
Logger
.
getLogger
(
Logger
.
GLOBAL_LOGGER_NAME
));
}
@Test
void
shouldReturnGlobalLoggerWhenDataSourceThrowsException
()
throws
SQLFeatureNotSupportedException
{
XADataSource
dataSource
=
mock
(
XADataSource
.
class
);
given
(
dataSource
.
getParentLogger
()).
willThrow
(
new
SQLFeatureNotSupportedException
());
this
.
bean
.
setDataSource
(
dataSource
);
assertThat
(
this
.
bean
.
getParentLogger
()).
isSameAs
(
Logger
.
getLogger
(
Logger
.
GLOBAL_LOGGER_NAME
));
}
@Test
void
shouldReturnParentLoggerFromDataSource
()
throws
SQLFeatureNotSupportedException
{
Logger
logger
=
Logger
.
getLogger
(
"test"
);
XADataSource
dataSource
=
mock
(
XADataSource
.
class
);
given
(
dataSource
.
getParentLogger
()).
willReturn
(
logger
);
this
.
bean
.
setDataSource
(
dataSource
);
assertThat
(
this
.
bean
.
getParentLogger
()).
isSameAs
(
logger
);
}
@Test
void
setDataSource
()
throws
Exception
{
XADataSource
dataSource
=
mock
(
XADataSource
.
class
);
...
...
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