Skip to content

Commit c0fbcb1

Browse files
committed
improve codestyle
1 parent dc349f0 commit c0fbcb1

File tree

3 files changed

+20
-22
lines changed

3 files changed

+20
-22
lines changed

src/main/java/analytics/AnalyticsLogger.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
public class AnalyticsLogger {
1616

17+
public static String url = "https://www.iliasdownloadertool.de/api/v1/analytics";
18+
1719
public static AnalyticsLogger logger;
1820

1921
private final String sessionID;
@@ -24,7 +26,7 @@ public class AnalyticsLogger {
2426

2527
private final String iliasPortal;
2628

27-
public AnalyticsLogger() {
29+
private AnalyticsLogger() {
2830
this.sessionID = generateSessionID();
2931
this.iliasVersion = new VersionValidator().getVersion();
3032
this.userID = generateUserID();
@@ -40,9 +42,9 @@ public static AnalyticsLogger getInstance() {
4042

4143
private String generateUserID() {
4244
String name = Settings.getInstance().getUser().getName();
43-
String shortName = IliasManager.getInstance().getShortName();
45+
String pluginShortName = IliasManager.getInstance().getShortName();
4446

45-
return hash(hash(name) + hash(shortName) + hash("G(xpt+OgoLltz5b#e(Bu-YcYF$cokfmp9349fdjd!-4sdvf2"));
47+
return hash(hash(name) + hash(pluginShortName) + hash("G(xpt+OgoLltz5b#e(Bu-YcYF$cokfmp9349fdjd!-4sdvf2"));
4648
}
4749

4850
private String generateSessionID() {
@@ -52,14 +54,13 @@ private String generateSessionID() {
5254
public void log(Enum actionType) {
5355
new Thread(() -> {
5456
CloseableHttpClient client = HttpClients.createDefault();
55-
String uri = "http://localhost:5000/api/v1/analytics";
56-
String uri2 = "https://www.iliasdownloadertool.de/api/v1/analytics";
57-
HttpPost httpPost = new HttpPost(uri2);
57+
58+
HttpPost httpPost = new HttpPost(url);
5859

5960
SessionLog sessionLog = new SessionLog(this.userID, this.sessionID, actionType,
6061
this.iliasVersion, this.iliasPortal);
6162

62-
StringEntity entity = null;
63+
StringEntity entity;
6364
try {
6465
entity = new StringEntity(sessionLog.toJson());
6566
httpPost.setEntity(entity);

src/main/java/download/IliasFileDownloader.java

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -68,18 +68,15 @@ private void askForStoragePosition(String name, final String targetPath, final I
6868
fileChooser.setInitialDirectory(new File(targetPath));
6969
fileChooser.setInitialFileName(name + "." + file.getExtension());
7070

71-
Platform.runLater(new Runnable() {
72-
@Override
73-
public void run() {
74-
final File selectedFile = fileChooser.showSaveDialog(new Stage());
75-
String path = targetPath;
76-
if (selectedFile != null) {
77-
path = selectedFile.getAbsolutePath();
78-
if (!path.endsWith("." + file.getExtension())) {
79-
path = path + "." + file.getExtension();
80-
}
81-
new Thread(new IliasFileDownloaderTask(file, path)).start();
71+
Platform.runLater(() -> {
72+
final File selectedFile = fileChooser.showSaveDialog(new Stage());
73+
String path = targetPath;
74+
if (selectedFile != null) {
75+
path = selectedFile.getAbsolutePath();
76+
if (!path.endsWith("." + file.getExtension())) {
77+
path = path + "." + file.getExtension();
8278
}
79+
new Thread(new IliasFileDownloaderTask(file, path)).start();
8380
}
8481
});
8582
}

src/main/java/utils/FileAppearanceManager.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ public class FileAppearanceManager {
2626
private Map<String, String> ignoredPictures;
2727

2828
private FileAppearanceManager() {
29-
fileExtensions = new ArrayList<String>();
30-
normalPictures = new HashMap<String, String>();
31-
notSynchronizedPictures = new HashMap<String, String>();
32-
ignoredPictures = new HashMap<String, String>();
29+
fileExtensions = new ArrayList<>();
30+
normalPictures = new HashMap<>();
31+
notSynchronizedPictures = new HashMap<>();
32+
ignoredPictures = new HashMap<>();
3333

3434
try {
3535
readPropertyFile();

0 commit comments

Comments
 (0)