Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
caosdb-server
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
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
Code review analytics
Issue 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
caosdb
Software
caosdb-server
Commits
52084366
Verified
Commit
52084366
authored
3 years ago
by
Timm Fitschen
Browse files
Options
Downloads
Patches
Plain Diff
fix parsing of the unit
parent
32c737f9
No related branches found
No related tags found
1 merge request
!13
fix #131 and #134 (white spaces in query)
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/org/caosdb/server/query/POV.java
+10
-8
10 additions, 8 deletions
src/main/java/org/caosdb/server/query/POV.java
with
10 additions
and
8 deletions
src/main/java/org/caosdb/server/query/POV.java
+
10
−
8
View file @
52084366
...
...
@@ -70,8 +70,8 @@ public class POV implements EntityFilterInterface {
private
String
propertiesTable
=
null
;
private
String
refIdsTable
=
null
;
private
final
HashMap
<
String
,
String
>
statistics
=
new
HashMap
<>();
private
Logger
logger
=
LoggerFactory
.
getLogger
(
getClass
());
private
Stack
<
String
>
prefix
=
new
Stack
<>();
private
final
Logger
logger
=
LoggerFactory
.
getLogger
(
getClass
());
private
final
Stack
<
String
>
prefix
=
new
Stack
<>();
private
Unit
getUnit
(
final
String
s
)
throws
ParserException
{
return
CaosDBSystemOfUnits
.
getUnit
(
s
);
...
...
@@ -116,7 +116,7 @@ public class POV implements EntityFilterInterface {
// try and parse as integer
try
{
final
Pattern
dp
=
Pattern
.
compile
(
"^(-?[0-9]++)([^(\\.[0-9])-][^-]*)?$"
);
final
Pattern
dp
=
Pattern
.
compile
(
"^(-?[0-9]++)
\\s*
([^(\\.[0-9])-][^-]*)?$"
);
final
Matcher
m
=
dp
.
matcher
(
value
);
if
(!
m
.
matches
())
{
throw
new
NumberFormatException
();
...
...
@@ -133,7 +133,7 @@ public class POV implements EntityFilterInterface {
this
.
vDouble
=
(
double
)
this
.
vInt
;
}
else
{
try
{
final
Pattern
dp
=
Pattern
.
compile
(
"^(-?[0-9]+(?:\\.[0-9]+))([^-]*)$"
);
final
Pattern
dp
=
Pattern
.
compile
(
"^(-?[0-9]+(?:\\.[0-9]+))
\\s*
([^-]*)$"
);
final
Matcher
m
=
dp
.
matcher
(
value
);
if
(!
m
.
matches
())
{
throw
new
NumberFormatException
();
...
...
@@ -142,7 +142,7 @@ public class POV implements EntityFilterInterface {
unitStr
=
m
.
group
(
2
);
this
.
vDouble
=
Double
.
parseDouble
(
vDoubleStr
);
if
(
(
this
.
vDouble
%
1
)
==
0
)
{
if
(
this
.
vDouble
%
1
==
0
)
{
this
.
vInt
=
(
int
)
Math
.
floor
(
this
.
vDouble
);
}
}
catch
(
final
NumberFormatException
e
)
{
...
...
@@ -509,14 +509,16 @@ public class POV implements EntityFilterInterface {
return
this
.
aggregate
;
}
private
String
measurement
(
String
m
)
{
private
String
measurement
(
final
String
m
)
{
return
String
.
join
(
""
,
prefix
)
+
m
;
}
@Override
public
String
getCacheKey
()
{
StringBuilder
sb
=
new
StringBuilder
();
if
(
this
.
getAggregate
()
!=
null
)
sb
.
append
(
this
.
aggregate
);
final
StringBuilder
sb
=
new
StringBuilder
();
if
(
this
.
getAggregate
()
!=
null
)
{
sb
.
append
(
this
.
aggregate
);
}
sb
.
append
(
toString
());
if
(
this
.
hasSubProperty
())
{
sb
.
append
(
getSubProperty
().
getCacheKey
());
...
...
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