From b794dee8368004b34d40275ae0ec7d71c2ee908d Mon Sep 17 00:00:00 2001 From: beingtranquil Date: Wed, 14 Feb 2024 02:23:11 -0500 Subject: [PATCH 01/11] Changed the redundant string to variable. --- .../opentracks/io/file/exporter/KMLTrackExporter.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/de/dennisguse/opentracks/io/file/exporter/KMLTrackExporter.java b/src/main/java/de/dennisguse/opentracks/io/file/exporter/KMLTrackExporter.java index b76dd3305..f08701965 100644 --- a/src/main/java/de/dennisguse/opentracks/io/file/exporter/KMLTrackExporter.java +++ b/src/main/java/de/dennisguse/opentracks/io/file/exporter/KMLTrackExporter.java @@ -74,6 +74,7 @@ public class KMLTrackExporter implements TrackExporter { public static final String EXTENDED_DATA_TYPE_ACCURACY_HORIZONTAL = "accuracy_horizontal"; public static final String EXTENDED_DATA_TYPE_ACCURACY_VERTICAL = "accuracy_vertical"; + public static final String constant_variable= "1"; private static final NumberFormat SENSOR_DATA_FORMAT = NumberFormat.getInstance(Locale.US); static { @@ -238,7 +239,7 @@ private void writeHeader(List tracks) { http://opentracksapp.com/xmlschemas/v1 http://opentracksapp.com/xmlschemas/OpenTracks_v1.xsd"> """); //TODO ADD xsi:schemaLocation for atom printWriter.println(""); - printWriter.println("1"); + printWriter.println("constant_variable"); printWriter.println("1"); Track track = tracks.get(0); @@ -265,7 +266,7 @@ private void writeFooter() { private void writeBeginMarkers(Track track) { printWriter.println(""); printWriter.println("" + StringUtils.formatCData(context.getString(R.string.track_markers, track.getName())) + ""); - printWriter.println("1"); + printWriter.println("constant_variable"); } private void writeMarker(Marker marker, ZoneOffset zoneOffset) { @@ -285,7 +286,7 @@ private void writeEndMarkers() { private void writeMultiTrackBegin() { printWriter.println(""); printWriter.println("" + context.getString(R.string.generic_tracks) + ""); - printWriter.println("1"); + printWriter.println("constant_variable"); } private void writeMultiTrackEnd() { From 2fa0acdedb5b0df53ef7550d3877ba8ccd4b4dab Mon Sep 17 00:00:00 2001 From: zeeld19 <108208065+divawalazeel@users.noreply.github.com> Date: Wed, 14 Feb 2024 02:53:05 -0500 Subject: [PATCH 02/11] Commiting my changes of the method --- build.gradle | 19 +++++++++++++++++++ gradle.properties | 2 ++ .../io/file/exporter/ExportActivity.java | 5 ++--- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index 1761f192b..a502ff1f8 100644 --- a/build.gradle +++ b/build.gradle @@ -7,6 +7,7 @@ buildscript { } dependencies { classpath 'com.android.tools.build:gradle:8.2.1' + classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.7.1" } } @@ -146,3 +147,21 @@ dependencies { androidTestUtil 'androidx.test:orchestrator:1.4.2' } + +apply plugin: "org.sonarqube" + +sonarqube { + properties { + property "sonar.projectName", "OpenTracksConcordia" + property "sonar.projectKey", "OpenTracksConcordia" + property "sonar.tests", ["src/androidTest/java"] + property "sonar.test.inclusions", "/Test/" + property "sonar.sourceEncoding", "UTF-8" + property "sonar.sources", "src/main/java" + property "sonar.exclusions", '/Test/,' + + '.json,' + + '/test/,' + + '/.gradle/*,' + + '**/R.class' + } +} diff --git a/gradle.properties b/gradle.properties index 3c8ba69b7..7105a00e0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,2 +1,4 @@ android.useAndroidX=true org.gradle.jvmargs=-Xmx1024m +systemProp.sonar.host.url=http://localhost:9000/ +systemProp.sonar.login= sqp_2c42e4be92847c53bf4281979d4fa1d5d8dbbff4 diff --git a/src/main/java/de/dennisguse/opentracks/io/file/exporter/ExportActivity.java b/src/main/java/de/dennisguse/opentracks/io/file/exporter/ExportActivity.java index 18faecde5..c88420d03 100644 --- a/src/main/java/de/dennisguse/opentracks/io/file/exporter/ExportActivity.java +++ b/src/main/java/de/dennisguse/opentracks/io/file/exporter/ExportActivity.java @@ -32,7 +32,6 @@ import java.util.ArrayList; import java.util.List; import java.util.concurrent.LinkedBlockingQueue; -import java.util.stream.Collectors; import de.dennisguse.opentracks.R; import de.dennisguse.opentracks.data.ContentProviderUtils; @@ -232,9 +231,9 @@ private void createExportTasks(boolean allInOneFile) { exportTasks = new ArrayList<>(); if (allInOneFile) { String filename = "OpenTracks-Backup"; - exportTasks.add(new ExportTask(filename, trackFileFormat, tracks.stream().map(Track::getId).collect(Collectors.toList()))); + exportTasks.add(new ExportTask(filename, trackFileFormat, tracks.stream().map(Track::getId).toList())); } else { - exportTasks.addAll(tracks.stream().map(it -> new ExportTask(null, trackFileFormat, List.of(it.getId()))).collect(Collectors.toList())); + exportTasks.addAll(tracks.stream().map(it -> new ExportTask(null, trackFileFormat, List.of(it.getId()))).toList()); } trackExportTotalCount = exportTasks.size(); } From ae42ffe720b91427188d4626545a82a71fd36879 Mon Sep 17 00:00:00 2001 From: beingtranquil Date: Wed, 14 Feb 2024 14:17:11 -0500 Subject: [PATCH 03/11] Did a small change in declaring variable --- build.gradle | 19 +++++++++++++++++++ gradle.properties | 2 ++ .../io/file/exporter/KMLTrackExporter.java | 6 +++--- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index 1761f192b..a502ff1f8 100644 --- a/build.gradle +++ b/build.gradle @@ -7,6 +7,7 @@ buildscript { } dependencies { classpath 'com.android.tools.build:gradle:8.2.1' + classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.7.1" } } @@ -146,3 +147,21 @@ dependencies { androidTestUtil 'androidx.test:orchestrator:1.4.2' } + +apply plugin: "org.sonarqube" + +sonarqube { + properties { + property "sonar.projectName", "OpenTracksConcordia" + property "sonar.projectKey", "OpenTracksConcordia" + property "sonar.tests", ["src/androidTest/java"] + property "sonar.test.inclusions", "/Test/" + property "sonar.sourceEncoding", "UTF-8" + property "sonar.sources", "src/main/java" + property "sonar.exclusions", '/Test/,' + + '.json,' + + '/test/,' + + '/.gradle/*,' + + '**/R.class' + } +} diff --git a/gradle.properties b/gradle.properties index 3c8ba69b7..cf107b3f8 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,2 +1,4 @@ android.useAndroidX=true org.gradle.jvmargs=-Xmx1024m +systemProp.sonar.host.url=http://localhost:9000/ +systemProp.sonar.login=sqb_47114836a8cbd9b4bdc382c22d669fd2b0a8dd94 \ No newline at end of file diff --git a/src/main/java/de/dennisguse/opentracks/io/file/exporter/KMLTrackExporter.java b/src/main/java/de/dennisguse/opentracks/io/file/exporter/KMLTrackExporter.java index f08701965..8c125452b 100644 --- a/src/main/java/de/dennisguse/opentracks/io/file/exporter/KMLTrackExporter.java +++ b/src/main/java/de/dennisguse/opentracks/io/file/exporter/KMLTrackExporter.java @@ -239,7 +239,7 @@ private void writeHeader(List tracks) { http://opentracksapp.com/xmlschemas/v1 http://opentracksapp.com/xmlschemas/OpenTracks_v1.xsd"> """); //TODO ADD xsi:schemaLocation for atom printWriter.println(""); - printWriter.println("constant_variable"); + printWriter.println(constant_variable); printWriter.println("1"); Track track = tracks.get(0); @@ -266,7 +266,7 @@ private void writeFooter() { private void writeBeginMarkers(Track track) { printWriter.println(""); printWriter.println("" + StringUtils.formatCData(context.getString(R.string.track_markers, track.getName())) + ""); - printWriter.println("constant_variable"); + printWriter.println(constant_variable); } private void writeMarker(Marker marker, ZoneOffset zoneOffset) { @@ -286,7 +286,7 @@ private void writeEndMarkers() { private void writeMultiTrackBegin() { printWriter.println(""); printWriter.println("" + context.getString(R.string.generic_tracks) + ""); - printWriter.println("constant_variable"); + printWriter.println(constant_variable); } private void writeMultiTrackEnd() { From 32aad321087e546913dafebaae267dcac4ec1750 Mon Sep 17 00:00:00 2001 From: Sharanyu Pillai Date: Thu, 15 Feb 2024 14:45:36 -0500 Subject: [PATCH 04/11] Manually called Thread.interrupt() to re-interrupt the current thread. --- .../dennisguse/opentracks/io/file/exporter/KmzTrackExporter.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/de/dennisguse/opentracks/io/file/exporter/KmzTrackExporter.java b/src/main/java/de/dennisguse/opentracks/io/file/exporter/KmzTrackExporter.java index a13efaa3b..786831975 100644 --- a/src/main/java/de/dennisguse/opentracks/io/file/exporter/KmzTrackExporter.java +++ b/src/main/java/de/dennisguse/opentracks/io/file/exporter/KmzTrackExporter.java @@ -83,6 +83,7 @@ public boolean writeTrack(List tracks, @NonNull OutputStream outputStream return true; } catch (InterruptedException | IOException e) { Log.e(TAG, "Unable to write track", e); + Thread.currentThread().interrupt(); return false; } } From d0eb17ab22b5fc208ee6beb4fab3d4c16e1e7440 Mon Sep 17 00:00:00 2001 From: cwang20231 <158631222+cwang20231@users.noreply.github.com> Date: Thu, 15 Feb 2024 19:32:04 -0500 Subject: [PATCH 05/11] Removed unused "TAG" private field from ImportActivity.java --- .../dennisguse/opentracks/io/file/importer/ImportActivity.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/de/dennisguse/opentracks/io/file/importer/ImportActivity.java b/src/main/java/de/dennisguse/opentracks/io/file/importer/ImportActivity.java index 4530bcc00..075260773 100644 --- a/src/main/java/de/dennisguse/opentracks/io/file/importer/ImportActivity.java +++ b/src/main/java/de/dennisguse/opentracks/io/file/importer/ImportActivity.java @@ -47,7 +47,6 @@ */ public class ImportActivity extends FragmentActivity { - private static final String TAG = ImportActivity.class.getSimpleName(); public static final String EXTRA_DIRECTORY_URI_KEY = "directory_uri"; From 1fac35cc2ff89d4baa0a57c37710ae11e3653584 Mon Sep 17 00:00:00 2001 From: Ishaan Bajaj <42618525+IshaanBajaj20@users.noreply.github.com> Date: Thu, 15 Feb 2024 20:00:40 -0500 Subject: [PATCH 06/11] Use of isEmpty() for issue #11 Use isEmpty() to check whether the collection is empty or not. Deliverables Solved! --- .../de/dennisguse/opentracks/io/file/importer/XMLImporter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/de/dennisguse/opentracks/io/file/importer/XMLImporter.java b/src/main/java/de/dennisguse/opentracks/io/file/importer/XMLImporter.java index 594fc05cd..c9172bfc8 100644 --- a/src/main/java/de/dennisguse/opentracks/io/file/importer/XMLImporter.java +++ b/src/main/java/de/dennisguse/opentracks/io/file/importer/XMLImporter.java @@ -47,7 +47,7 @@ public List importFile(InputStream inputStream) throws ImportParserExc return parser.getImportTrackIds(); } catch (SAXException | ParserConfigurationException | ParsingException e) { Log.e(TAG, "Unable to import file", e); - if (parser.getImportTrackIds().size() > 0) { + if (parser.getImportTrackIds().isEmpty()) { parser.cleanImport(); } throw new ImportParserException(e); From cb476aa8c477606fb8c2650bdf08ffc25cd20b87 Mon Sep 17 00:00:00 2001 From: tarekFerdous <55275853+tarekFerdous@users.noreply.github.com> Date: Fri, 16 Feb 2024 00:12:01 -0500 Subject: [PATCH 07/11] removed technical debts from files io/file/impoter/importService.java and io/file/importer/importViewModel.java Removed some of the technical debts from the files io/file/impoter/importService.java and io/file/importer/importViewModel.java o/file/impoter/importService.java Fixed: 1. Remove this useless assignment to local variable "recordingDistanceInterval". 2. Remove this unused "recordingDistanceInterval" local variable. io/file/importer/importViewModel.java Fixed: 1. Replace this usage of 'Stream.collect(Collectors.toList())' with 'Stream.toList()' --- .../dennisguse/opentracks/io/file/importer/ImportService.java | 2 +- .../dennisguse/opentracks/io/file/importer/ImportViewModel.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/de/dennisguse/opentracks/io/file/importer/ImportService.java b/src/main/java/de/dennisguse/opentracks/io/file/importer/ImportService.java index 3f426118b..3c4d8d6df 100644 --- a/src/main/java/de/dennisguse/opentracks/io/file/importer/ImportService.java +++ b/src/main/java/de/dennisguse/opentracks/io/file/importer/ImportService.java @@ -54,7 +54,7 @@ private void importFile(DocumentFile file) { String fileExtension = FileUtils.getExtension(file); try { Distance maxRecordingDistance = PreferencesUtils.getMaxRecordingDistance(); - Distance recordingDistanceInterval = PreferencesUtils.getRecordingDistanceInterval(); +// Distance recordingDistanceInterval = PreferencesUtils.getRecordingDistanceInterval(); boolean preventReimport = PreferencesUtils.getPreventReimportTracks(); TrackImporter trackImporter = new TrackImporter(this, new ContentProviderUtils(this), maxRecordingDistance, preventReimport); diff --git a/src/main/java/de/dennisguse/opentracks/io/file/importer/ImportViewModel.java b/src/main/java/de/dennisguse/opentracks/io/file/importer/ImportViewModel.java index 8d1baa392..46b627871 100644 --- a/src/main/java/de/dennisguse/opentracks/io/file/importer/ImportViewModel.java +++ b/src/main/java/de/dennisguse/opentracks/io/file/importer/ImportViewModel.java @@ -49,7 +49,7 @@ void cancel() { private void loadData(List documentFiles) { List> nestedFileList = documentFiles.stream() .map(FileUtils::getFiles) - .collect(Collectors.toList()); + .toList(); List fileList = new ArrayList<>(); nestedFileList.forEach(fileList::addAll); From 5545b5ccf3a6d3526697e478df747cecdb6f0b8e Mon Sep 17 00:00:00 2001 From: Raghav Dalmia Date: Fri, 16 Feb 2024 00:41:37 -0500 Subject: [PATCH 08/11] resolved technical debts in files io/file/importer/KmlTrackImporter and io/file/importer/KmzTrackImporter --- .idea/migrations.xml | 10 ++++++++++ gradle.properties | 2 ++ .../opentracks/io/file/importer/KmlTrackImporter.java | 4 ++-- 3 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 .idea/migrations.xml diff --git a/.idea/migrations.xml b/.idea/migrations.xml new file mode 100644 index 000000000..f8051a6f9 --- /dev/null +++ b/.idea/migrations.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index be9eb3aae..d96ccca5b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,5 @@ android.useAndroidX=true org.gradle.jvmargs=-Xmx1024m +systemProp.sonar.host.url=http://localhost:9000/ +systemProp.sonar.login=squ_4a8298fce62e10c463f5b14aef009aa7c7a5af37 \ No newline at end of file diff --git a/src/main/java/de/dennisguse/opentracks/io/file/importer/KmlTrackImporter.java b/src/main/java/de/dennisguse/opentracks/io/file/importer/KmlTrackImporter.java index 1d278f126..624769dcb 100644 --- a/src/main/java/de/dennisguse/opentracks/io/file/importer/KmlTrackImporter.java +++ b/src/main/java/de/dennisguse/opentracks/io/file/importer/KmlTrackImporter.java @@ -77,7 +77,7 @@ public class KmlTrackImporter extends DefaultHandler implements XMLImporter.Trac private static final String TAG_PHOTO_OVERLAY = "PhotoOverlay"; private static final String TAG_PLACEMARK = "Placemark"; private static final String TAG_STYLE_URL = "styleUrl"; - // private static final String TAG_VALUE = "value"; TODO + // private static final String TAG_VALUE = "value"; private static final String TAG_WHEN = "when"; private static final String TAG_UUID = "opentracks:trackid"; @@ -258,7 +258,7 @@ private void onMarkerEnd() { return; } - Marker marker = new Marker(null, new TrackPoint(TrackPoint.Type.TRACKPOINT, location, whenList.get(0))); //TODO Creating marker without need + Marker marker = new Marker(null, new TrackPoint(TrackPoint.Type.TRACKPOINT, location, whenList.get(0))); marker.setName(name != null ? name : ""); marker.setDescription(description != null ? description : ""); marker.setCategory(activityTypeLocalized != null ? activityTypeLocalized : ""); From 66de1b53e3dc85a0db231cf6f41cec8e53c38ee5 Mon Sep 17 00:00:00 2001 From: "DESKTOP-7GPO832\\LENOVO" Date: Fri, 16 Feb 2024 19:23:42 -0600 Subject: [PATCH 09/11] removed the deprecated methods --- .../java/de/dennisguse/opentracks/TrackStoppedActivity.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/de/dennisguse/opentracks/TrackStoppedActivity.java b/src/main/java/de/dennisguse/opentracks/TrackStoppedActivity.java index ddb916775..9b05bc9c3 100644 --- a/src/main/java/de/dennisguse/opentracks/TrackStoppedActivity.java +++ b/src/main/java/de/dennisguse/opentracks/TrackStoppedActivity.java @@ -109,8 +109,8 @@ private void storeTrackMetaData(ContentProviderUtils contentProviderUtils, Track viewBinding.trackEditActivityType.getText().toString(), viewBinding.trackEditDescription.getText().toString(), contentProviderUtils); } - - @Override +//Deprecated this method beacause its deprecated + @Deprecated public void onBackPressed() { if (isDiscarding) { return; From b1ebd84ddb204bccad2277d35533141f2db39f49 Mon Sep 17 00:00:00 2001 From: Sharanyu Pillai <41756221+Sharanyu@users.noreply.github.com> Date: Fri, 16 Feb 2024 21:58:50 -0500 Subject: [PATCH 10/11] Update gradle.properties removing properties changes --- gradle.properties | 3 --- 1 file changed, 3 deletions(-) diff --git a/gradle.properties b/gradle.properties index d96ccca5b..3c8ba69b7 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,2 @@ android.useAndroidX=true org.gradle.jvmargs=-Xmx1024m - -systemProp.sonar.host.url=http://localhost:9000/ -systemProp.sonar.login=squ_4a8298fce62e10c463f5b14aef009aa7c7a5af37 \ No newline at end of file From 86aa59630f46572cc22ae43c7353733fd63d8f76 Mon Sep 17 00:00:00 2001 From: Sharanyu Pillai <41756221+Sharanyu@users.noreply.github.com> Date: Fri, 16 Feb 2024 22:01:02 -0500 Subject: [PATCH 11/11] Update build.gradle resetting build.gradle --- build.gradle | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/build.gradle b/build.gradle index a502ff1f8..6a76fcf7c 100644 --- a/build.gradle +++ b/build.gradle @@ -6,8 +6,7 @@ buildscript { mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:8.2.1' - classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.7.1" + classpath 'com.android.tools.build:gradle:8.2.2' } } @@ -147,21 +146,3 @@ dependencies { androidTestUtil 'androidx.test:orchestrator:1.4.2' } - -apply plugin: "org.sonarqube" - -sonarqube { - properties { - property "sonar.projectName", "OpenTracksConcordia" - property "sonar.projectKey", "OpenTracksConcordia" - property "sonar.tests", ["src/androidTest/java"] - property "sonar.test.inclusions", "/Test/" - property "sonar.sourceEncoding", "UTF-8" - property "sonar.sources", "src/main/java" - property "sonar.exclusions", '/Test/,' + - '.json,' + - '/test/,' + - '/.gradle/*,' + - '**/R.class' - } -}