Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
dmp
OpenAIRE-EUDAT-DMP-service-pilot
Commits
99e4d231
Commit
99e4d231
authored
Sep 27, 2021
by
George Kalampokis
Browse files
Possible patch some leaks
parent
06364873
Changes
3
Show whitespace changes
Inline
Side-by-side
dmp-backend/web/src/main/java/eu/eudat/logic/proxy/fetching/LocalFetcher.java
View file @
99e4d231
...
...
@@ -22,6 +22,7 @@ public class LocalFetcher {
JAXBContext
context
=
JAXBContext
.
newInstance
(
Config
.
class
);
Unmarshaller
unmarshaller
=
context
.
createUnmarshaller
();
Config
config
=
(
Config
)
unmarshaller
.
unmarshal
(
is
);
is
.
close
();
ConfigSingle
currencyConfig
=
config
.
getConfigs
().
stream
().
filter
(
configSingle
->
configSingle
.
getType
().
equals
(
"currency"
)).
findFirst
().
get
();
return
retrieveData
(
currencyConfig
);
...
...
@@ -39,7 +40,7 @@ public class LocalFetcher {
Unmarshaller
unmarshaller
=
context
.
createUnmarshaller
();
Object
object
=
unmarshaller
.
unmarshal
(
is
);
is
.
close
();
Method
reader
=
null
;
if
(
configSingle
.
getParseField
()
!=
null
&&
!
configSingle
.
getParseField
().
isEmpty
())
{
reader
=
new
PropertyDescriptor
(
configSingle
.
getParseField
(),
aClass
).
getReadMethod
();
...
...
dmp-backend/web/src/main/java/eu/eudat/logic/services/utilities/MailServiceImpl.java
View file @
99e4d231
...
...
@@ -86,6 +86,7 @@ public class MailServiceImpl implements MailService {
InputStream
inputStream
=
resource
.
getInputStream
();
StringWriter
writer
=
new
StringWriter
();
IOUtils
.
copy
(
inputStream
,
writer
,
"UTF-8"
);
inputStream
.
close
();
return
writer
.
toString
();
}
catch
(
IOException
e
)
{
logger
.
error
(
e
.
getMessage
(),
e
);
...
...
dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/LanguageRDAMapper.java
View file @
99e4d231
package
eu.eudat.models.rda.mapper
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
eu.eudat.models.rda.Language
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
java.io.BufferedReader
;
import
java.io.IOException
;
import
java.io.InputStreamReader
;
import
java.nio.charset.StandardCharsets
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.stream.Collectors
;
public
class
LanguageRDAMapper
{
private
final
static
Map
<
String
,
Object
>
langMap
=
new
HashMap
<>();
...
...
@@ -20,9 +19,12 @@ public class LanguageRDAMapper {
static
{
String
json
=
null
;
try
{
json
=
new
BufferedReader
(
new
InputStreamReader
(
LanguageRDAMapper
.
class
.
getClassLoader
().
getResource
(
"internal/rda-lang-map.json"
).
openStream
(),
StandardCharsets
.
UTF_8
))
.
lines
().
collect
(
Collectors
.
joining
(
"\n"
));
ObjectMapper
mapper
=
new
ObjectMapper
();
InputStreamReader
isr
=
new
InputStreamReader
(
LanguageRDAMapper
.
class
.
getClassLoader
().
getResource
(
"internal/rda-lang-map.json"
).
openStream
(),
StandardCharsets
.
UTF_8
);
json
=
mapper
.
readValue
(
isr
,
String
.
class
);
isr
.
close
();
langMap
.
putAll
(
new
org
.
json
.
JSONObject
(
json
).
toMap
());
}
catch
(
IOException
e
)
{
logger
.
error
(
e
.
getMessage
(),
e
);
}
...
...
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