Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade depenencies 2 #45

Merged
merged 4 commits into from
May 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 6 additions & 14 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,33 +20,25 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 2

- uses: actions/setup-java@v2
- uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: 11
cache: 'gradle'

- uses: gradle/wrapper-validation-action@v1

- name: Cache Gradle packages and wrapper
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: ${{ runner.os }}-gradle-

- name: Initialize CodeQL
uses: github/codeql-action/init@v1
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}

- name: Autobuild
uses: github/codeql-action/autobuild@v1
uses: github/codeql-action/autobuild@v2

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
uses: github/codeql-action/analyze@v2
23 changes: 9 additions & 14 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,25 @@ jobs:
DEFAULT_JAVA: 17

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3

- uses: actions/cache@v1
- name: Setup Java ${{ matrix.java }}
uses: actions/setup-java@v3
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-java-${{ matrix.java }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: |
${{ runner.os }}-java-${{ matrix.java }}-gradle-
distribution: 'temurin'
java-version: ${{ matrix.java }}
cache: 'gradle'


- name: Cache SonarQube packages
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-java-${{ matrix.java }}-sonar
restore-keys: ${{ runner.os }}-java-${{ matrix.java }}-sonar

- uses: gradle/wrapper-validation-action@v1

- name: Setup Java ${{ matrix.java }}
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: ${{ matrix.java }}

- name: Build with Gradle
run: ./gradlew clean build --info --warning-mode all

Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [1.6.0] - unreleased

### Updated

* [#45](https://github.com/kaklakariada/fritzbox-java-api/pull/45) Upgrade dependencies

## [1.5.0] - 2021-12-04

### Added
Expand Down
10 changes: 5 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {
id "com.github.hierynomus.license" version "0.16.1"
id "org.sonarqube" version "3.3"
id "io.codearte.nexus-staging" version "0.30.0"
id "com.github.ben-manes.versions" version "0.39.0"
id "com.github.ben-manes.versions" version "0.42.0"
}

repositories {
Expand Down Expand Up @@ -44,13 +44,13 @@ test {
dependencies {
implementation 'com.squareup.okhttp3:okhttp:4.9.3'
implementation 'com.subshell.simpleframework:simple-xml:2.9.0'
implementation 'org.slf4j:slf4j-api:1.7.32'
implementation 'org.slf4j:slf4j-api:1.7.36'

runtimeOnly 'ch.qos.logback:logback-classic:1.2.9'
runtimeOnly 'ch.qos.logback:logback-classic:1.2.11'

testImplementation 'junit:junit:4.13.2'
testImplementation 'org.mockito:mockito-core:4.2.0'
testImplementation 'org.assertj:assertj-core:3.21.0'
testImplementation 'org.mockito:mockito-core:4.5.1'
testImplementation 'org.assertj:assertj-core:3.22.0'
}

license {
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@
package com.github.kaklakariada.fritzbox.helper;

public class StringHelper {
private StringHelper(){

private StringHelper() {
// Not instantiable
}

/**
* <p>Note that the method does not allow for a leading sign, either positive or negative.</p>
* <p>
* Note that the method does not allow for a leading sign, either positive or negative.
* </p>
*
* <pre>
* StringUtils.isIntegerNumber(null) = false
Expand All @@ -38,7 +40,8 @@ private StringHelper(){
* </pre>
*
*
* @param cs the String to check, may be null
* @param cs
* the String to check, may be null
* @return {@code true} if only contains digits or is enclosed by blanks, and is non-null
*/
public static boolean isIntegerNumber(final String cs) {
Expand All @@ -52,20 +55,24 @@ public static boolean isIntegerNumber(final String cs) {
}
return true;
}

/**
* <h4>Code copied 'as is' from apache-commons-lang3, class StringUtils.isNumeric()</h4>
* <b>Code copied 'as is' from apache-commons-lang3, class StringUtils.isNumeric()</b>
*
* <p>Checks if the CharSequence contains only Unicode digits.
* A decimal point is not a Unicode digit and returns false.</p>
* <p>
* Checks if the CharSequence contains only Unicode digits. A decimal point is not a Unicode digit and returns
* false.
* </p>
*
* <p>{@code null} will return {@code false}.
* An empty CharSequence (length()=0) will return {@code false}.</p>
* <p>
* {@code null} will return {@code false}. An empty CharSequence (length()=0) will return {@code false}.
* </p>
*
* <p>Note that the method does not allow for a leading sign, either positive or negative.
* Also, if a String passes the numeric test, it may still generate a NumberFormatException
* when parsed by Integer.parseInt or Long.parseLong, e.g. if the value is outside the range
* for int or long respectively.</p>
* <p>
* Note that the method does not allow for a leading sign, either positive or negative. Also, if a String passes the
* numeric test, it may still generate a NumberFormatException when parsed by Integer.parseInt or Long.parseLong,
* e.g. if the value is outside the range for int or long respectively.
* </p>
*
* <pre>
* StringUtils.isNumeric(null) = false
Expand All @@ -81,7 +88,8 @@ public static boolean isIntegerNumber(final String cs) {
* StringUtils.isNumeric("+123") = false
* </pre>
*
* @param cs the CharSequence to check, may be null
* @param cs
* the CharSequence to check, may be null
* @return {@code true} if only contains digits, and is non-null
*/
public static boolean isNumeric(final CharSequence cs) {
Expand All @@ -96,12 +104,13 @@ public static boolean isNumeric(final CharSequence cs) {
}
return true;
}



/**
* <h4>Code copied 'as is' from apache-commons-lang3, class StringUtils.isEmpty()</h4>
* <b>Code copied 'as is' from apache-commons-lang3, class StringUtils.isEmpty()</b>
*
* <p>Checks if a CharSequence is empty ("") or null.</p>
* <p>
* Checks if a CharSequence is empty ("") or null.
* </p>
*
* <pre>
* StringUtils.isEmpty(null) = true
Expand All @@ -112,7 +121,8 @@ public static boolean isNumeric(final CharSequence cs) {
* </pre>
*
*
* @param cs the CharSequence to check, may be null
* @param cs
* the CharSequence to check, may be null
* @return {@code true} if the CharSequence is empty or null
*/
public static boolean isEmpty(final CharSequence cs) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
import java.util.Optional;
import java.util.stream.Collectors;

import com.github.kaklakariada.fritzbox.helper.StringHelper;

import org.simpleframework.xml.Attribute;
import org.simpleframework.xml.Root;
import org.simpleframework.xml.Text;

import com.github.kaklakariada.fritzbox.helper.StringHelper;

@Root(name = "stats")
public class Statistics {

Expand All @@ -54,23 +54,23 @@ public int getGrid() {
/**
* Provide the gathered data as provided by Fritz!Box
*
* @return
* @return data provided by the Fritz!Box
*/
public String getCsvValues() {
return csvValues;
}

/**
* Just for unit test provided. Therefore it is set to protected
* Just for unit test provided. Therefore it is set to package private.
*/
protected void setCsvValues(String csvValues) {
void setCsvValues(final String csvValues) {
this.csvValues = csvValues;
}

/**
* Provide the gathered data as computed as meant to be used by AVM
*
* @return
* @return the gathered data
*/
public List<Optional<Number>> getValues() {
if (getCsvValues() == null) {
Expand All @@ -93,7 +93,7 @@ public List<Optional<Number>> getValues() {
* Sample: The Voltage is measured in 'V' (Volt) and has a precision of '0.001'. The number 237123 provided by the
* statistics must be multiplied by the precision which gives us 237.123 V.
*
* @return
* @return the measurement unit
*/
public MeasurementUnit getMeasurementUnit() {
return measurementUnit;
Expand All @@ -103,10 +103,10 @@ public void setMeasurementUnit(final MeasurementUnit measurementUnit) {
this.measurementUnit = measurementUnit;
}

protected Number computeValue(String aValue) {
protected Number computeValue(final String aValue) {
Number numberValue = null;
if (StringHelper.isIntegerNumber(aValue)) {
Integer intValue = Integer.valueOf(aValue.trim());
final Integer intValue = Integer.valueOf(aValue.trim());
if (measurementUnit.getPrescision() instanceof Double) {
numberValue = Double.valueOf(intValue * (Double) measurementUnit.getPrescision());
} else {
Expand Down