Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Team 14 - IDATT1002
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Eirik Steira
Team 14 - IDATT1002
Commits
f87906fb
Commit
f87906fb
authored
5 years ago
by
Mads Lundegaard
Browse files
Options
Downloads
Patches
Plain Diff
Added logger to methods for better exception handling
parent
f9485c40
No related branches found
No related tags found
2 merge requests
!165
Weekly merge to Master
,
!134
Added logger to methods for better exception handling
Pipeline
#79268
passed
5 years ago
Stage: build
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/NTNU/IDATT1002/utils/MetaDataExtractor.java
+16
-11
16 additions, 11 deletions
src/main/java/NTNU/IDATT1002/utils/MetaDataExtractor.java
with
16 additions
and
11 deletions
src/main/java/NTNU/IDATT1002/utils/MetaDataExtractor.java
+
16
−
11
View file @
f87906fb
package
NTNU.IDATT1002.utils
;
package
NTNU.IDATT1002.utils
;
import
NTNU.IDATT1002.controllers.ExploreAlbums
;
import
NTNU.IDATT1002.models.GeoLocation
;
import
NTNU.IDATT1002.models.GeoLocation
;
import
NTNU.IDATT1002.repository.GeoLocatioRepository
;
import
NTNU.IDATT1002.repository.GeoLocatioRepository
;
import
com.drew.imaging.ImageMetadataReader
;
import
com.drew.imaging.ImageMetadataReader
;
...
@@ -18,6 +19,8 @@ import com.drew.metadata.iptc.IptcDirectory;
...
@@ -18,6 +19,8 @@ import com.drew.metadata.iptc.IptcDirectory;
import
com.drew.metadata.jpeg.JpegDirectory
;
import
com.drew.metadata.jpeg.JpegDirectory
;
import
java.io.File
;
import
java.io.File
;
import
java.io.IOException
;
import
java.io.IOException
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
/**
/**
...
@@ -29,6 +32,8 @@ import java.io.IOException;
...
@@ -29,6 +32,8 @@ import java.io.IOException;
public
class
MetaDataExtractor
{
public
class
MetaDataExtractor
{
private
GeoLocatioRepository
geoLocationRepository
;
private
GeoLocatioRepository
geoLocationRepository
;
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
MetaDataExtractor
.
class
);
public
MetaDataExtractor
()
{
public
MetaDataExtractor
()
{
}
}
...
@@ -56,7 +61,7 @@ public class MetaDataExtractor {
...
@@ -56,7 +61,7 @@ public class MetaDataExtractor {
geoLocation
.
setLongitude
(
longitude
);
geoLocation
.
setLongitude
(
longitude
);
}
}
catch
(
NullPointerException
|
ImageProcessingException
|
IOException
e
)
{
catch
(
NullPointerException
|
ImageProcessingException
|
IOException
e
)
{
e
.
printStackTrace
(
);
logger
.
error
(
"[x] Could not find geolocation on file"
,
e
);
}
}
return
geoLocation
;
return
geoLocation
;
}
}
...
@@ -81,7 +86,7 @@ public class MetaDataExtractor {
...
@@ -81,7 +86,7 @@ public class MetaDataExtractor {
if
(!(
cameraInformation
.
isBlank
()))
if
(!(
cameraInformation
.
isBlank
()))
cameraInformation
=
cleanUpTags
(
cameraInformation
,
directory
);
cameraInformation
=
cleanUpTags
(
cameraInformation
,
directory
);
}
catch
(
IOException
|
ImageProcessingException
|
NullPointerException
e
)
{
}
catch
(
IOException
|
ImageProcessingException
|
NullPointerException
e
)
{
e
.
printStackTrace
(
);
logger
.
error
(
"[x] Could not get camera information from file"
,
e
);
}
}
return
cameraInformation
;
return
cameraInformation
;
}
}
...
@@ -107,7 +112,7 @@ public class MetaDataExtractor {
...
@@ -107,7 +112,7 @@ public class MetaDataExtractor {
lensInformation
=
cleanUpTags
(
lensInformation
,
directory
);
lensInformation
=
cleanUpTags
(
lensInformation
,
directory
);
}
}
catch
(
IOException
|
ImageProcessingException
|
NullPointerException
e
)
{
catch
(
IOException
|
ImageProcessingException
|
NullPointerException
e
)
{
e
.
printStackTrace
(
);
logger
.
error
(
"[x] Could not get lens information from file"
,
e
);
}
}
return
lensInformation
;
return
lensInformation
;
}
}
...
@@ -132,7 +137,7 @@ public class MetaDataExtractor {
...
@@ -132,7 +137,7 @@ public class MetaDataExtractor {
if
(!(
apertureInformation
.
isBlank
()))
if
(!(
apertureInformation
.
isBlank
()))
apertureInformation
=
cleanUpTags
(
apertureInformation
,
directory
);
apertureInformation
=
cleanUpTags
(
apertureInformation
,
directory
);
}
catch
(
IOException
|
ImageProcessingException
|
NullPointerException
e
)
{
}
catch
(
IOException
|
ImageProcessingException
|
NullPointerException
e
)
{
e
.
printStackTrace
(
);
logger
.
error
(
"[x] Could not get aperture information from file"
,
e
);
}
}
return
apertureInformation
;
return
apertureInformation
;
}
}
...
@@ -157,7 +162,7 @@ public class MetaDataExtractor {
...
@@ -157,7 +162,7 @@ public class MetaDataExtractor {
if
(!(
shutterSpeedInformation
.
isBlank
()))
if
(!(
shutterSpeedInformation
.
isBlank
()))
shutterSpeedInformation
=
cleanUpTags
(
shutterSpeedInformation
,
directory
);
shutterSpeedInformation
=
cleanUpTags
(
shutterSpeedInformation
,
directory
);
}
catch
(
IOException
|
ImageProcessingException
|
NullPointerException
e
)
{
}
catch
(
IOException
|
ImageProcessingException
|
NullPointerException
e
)
{
e
.
printStackTrace
(
);
logger
.
error
(
"[x] Could not get shutter speed information from file"
,
e
);
}
}
return
shutterSpeedInformation
;
return
shutterSpeedInformation
;
}
}
...
@@ -182,7 +187,7 @@ public class MetaDataExtractor {
...
@@ -182,7 +187,7 @@ public class MetaDataExtractor {
if
(!(
isoInformation
.
isBlank
()))
if
(!(
isoInformation
.
isBlank
()))
isoInformation
=
cleanUpTags
(
isoInformation
,
directory
);
isoInformation
=
cleanUpTags
(
isoInformation
,
directory
);
}
catch
(
IOException
|
ImageProcessingException
|
NullPointerException
e
)
{
}
catch
(
IOException
|
ImageProcessingException
|
NullPointerException
e
)
{
e
.
printStackTrace
(
);
logger
.
error
(
"[x] Could not get iso information from file"
,
e
);
}
}
return
isoInformation
;
return
isoInformation
;
}
}
...
@@ -208,7 +213,7 @@ public class MetaDataExtractor {
...
@@ -208,7 +213,7 @@ public class MetaDataExtractor {
if
(!(
focalLengthInformation
.
isBlank
()))
if
(!(
focalLengthInformation
.
isBlank
()))
focalLengthInformation
=
cleanUpTags
(
focalLengthInformation
,
directory
);
focalLengthInformation
=
cleanUpTags
(
focalLengthInformation
,
directory
);
}
catch
(
IOException
|
ImageProcessingException
|
NullPointerException
e
)
{
}
catch
(
IOException
|
ImageProcessingException
|
NullPointerException
e
)
{
e
.
printStackTrace
(
);
logger
.
error
(
"[x] Could not get focal length information from file"
,
e
);
}
}
return
focalLengthInformation
;
return
focalLengthInformation
;
}
}
...
@@ -234,7 +239,7 @@ public class MetaDataExtractor {
...
@@ -234,7 +239,7 @@ public class MetaDataExtractor {
if
(!(
fileTypeInformation
.
isBlank
()))
if
(!(
fileTypeInformation
.
isBlank
()))
fileTypeInformation
=
cleanUpTags
(
fileTypeInformation
,
directory
);
fileTypeInformation
=
cleanUpTags
(
fileTypeInformation
,
directory
);
}
catch
(
IOException
|
ImageProcessingException
|
NullPointerException
e
)
{
}
catch
(
IOException
|
ImageProcessingException
|
NullPointerException
e
)
{
e
.
printStackTrace
(
);
logger
.
error
(
"[x] Could not get file type from file"
,
e
);
}
}
return
fileTypeInformation
;
return
fileTypeInformation
;
}
}
...
@@ -266,7 +271,7 @@ public class MetaDataExtractor {
...
@@ -266,7 +271,7 @@ public class MetaDataExtractor {
if
(!(
dateInformation
.
isBlank
()))
if
(!(
dateInformation
.
isBlank
()))
dateInformation
=
cleanUpTags
(
dateInformation
,
directory
);
dateInformation
=
cleanUpTags
(
dateInformation
,
directory
);
}
catch
(
IOException
|
ImageProcessingException
|
NullPointerException
e
)
{
}
catch
(
IOException
|
ImageProcessingException
|
NullPointerException
e
)
{
e
.
printStackTrace
(
);
logger
.
error
(
"[x] Could not get photo date from file"
,
e
);
}
}
return
dateInformation
;
return
dateInformation
;
}
}
...
@@ -291,7 +296,7 @@ public class MetaDataExtractor {
...
@@ -291,7 +296,7 @@ public class MetaDataExtractor {
if
(!(
fileSize
.
isBlank
()))
if
(!(
fileSize
.
isBlank
()))
fileSize
=
cleanUpTags
(
fileSize
,
directory
);
fileSize
=
cleanUpTags
(
fileSize
,
directory
);
}
catch
(
IOException
|
ImageProcessingException
|
NullPointerException
e
)
{
}
catch
(
IOException
|
ImageProcessingException
|
NullPointerException
e
)
{
e
.
printStackTrace
(
);
logger
.
error
(
"[x] Could not get file size from file"
,
e
);
}
}
return
fileSize
;
return
fileSize
;
}
}
...
@@ -317,7 +322,7 @@ public class MetaDataExtractor {
...
@@ -317,7 +322,7 @@ public class MetaDataExtractor {
if
(!(
fileDimension
.
isBlank
()))
if
(!(
fileDimension
.
isBlank
()))
fileDimension
=
cleanUpTags
(
fileDimension
,
directory
);
fileDimension
=
cleanUpTags
(
fileDimension
,
directory
);
}
catch
(
IOException
|
ImageProcessingException
|
NullPointerException
e
)
{
}
catch
(
IOException
|
ImageProcessingException
|
NullPointerException
e
)
{
e
.
printStackTrace
(
);
logger
.
error
(
"[x] Could not get file dimension from file"
,
e
);
}
}
return
fileDimension
;
return
fileDimension
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment