Skip to content

Commit

Permalink
eclipse-leshanGH-1427 : Fix Float Attribute Parsing.
Browse files Browse the repository at this point in the history
  • Loading branch information
sbernard31 committed Mar 29, 2023
1 parent 37bfbe0 commit 989f4e7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public <E extends Throwable> LwM2mAttribute<Double> consumeAttributeValue(String
parser.consumeNextChar();
}
if (parser.nextCharIs('.')) {
parser.consumeNextChar();
parser.consumeDIGIT();
while (parser.nextCharIsDIGIT()) {
parser.consumeNextChar();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@ public void should_provide_query_params() throws InvalidAttributeException {
LwM2mAttributes.create(LwM2mAttributes.MINIMUM_PERIOD, 5L),
LwM2mAttributes.create(LwM2mAttributes.MAXIMUM_PERIOD, 60L),
LwM2mAttributes.create(LwM2mAttributes.EVALUATE_MINIMUM_PERIOD, 30L),
LwM2mAttributes.create(LwM2mAttributes.EVALUATE_MAXIMUM_PERIOD, 45L));
assertEquals("ver=1.1&pmin=5&pmax=60&epmin=30&epmax=45", sut.toString());
LwM2mAttributes.create(LwM2mAttributes.EVALUATE_MAXIMUM_PERIOD, 45L),
LwM2mAttributes.create(LwM2mAttributes.LESSER_THAN, 10D),
LwM2mAttributes.create(LwM2mAttributes.GREATER_THAN, 20.10D));
assertEquals("ver=1.1&pmin=5&pmax=60&epmin=30&epmax=45&lt=10.0&gt=20.1", sut.toString());

LwM2mAttributeSet res = new LwM2mAttributeSet(parser.parseUriQuery(sut.toString()));
assertEquals(sut, res);
Expand Down

0 comments on commit 989f4e7

Please sign in to comment.