1
0
mirror of https://github.com/arduino/Arduino.git synced 2024-12-01 12:24:14 +01:00

Libraries: fixed incorrect handling of null types

This commit is contained in:
Federico Fissore 2015-05-19 16:26:03 +02:00
parent f13fe9a4f7
commit 9191442aea
3 changed files with 14 additions and 62 deletions

View File

@ -16,6 +16,12 @@ public class LibraryByTypeComparator implements Comparator<ContributedLibrary> {
@Override
public int compare(ContributedLibrary o1, ContributedLibrary o2) {
if (o1.getTypes() == null) {
return 1;
}
if (o2.getTypes() == null) {
return -1;
}
return libraryTypeComparator.compare(o1.getTypes().get(0), o2.getTypes().get(0));
}

View File

@ -6,6 +6,12 @@ public class LibraryOfSameTypeComparator implements Comparator<ContributedLibrar
@Override
public int compare(ContributedLibrary o1, ContributedLibrary o2) {
if (o1.getTypes() == null) {
return 1;
}
if (o2.getTypes() == null) {
return -1;
}
if (!o1.getTypes().get(0).equals(o2.getTypes().get(0))) {
return 0;
}

View File

@ -32,8 +32,6 @@ import java.io.File;
import java.util.Arrays;
import java.util.List;
import cc.arduino.contributions.libraries.ContributedLibraryReference;
public class LegacyUserLibrary extends UserLibrary {
private String name;
@ -45,6 +43,8 @@ public class LegacyUserLibrary extends UserLibrary {
res.setInstalled(true);
res.layout = LibraryLayout.FLAT;
res.name = libFolder.getName();
res.setTypes(Arrays.asList("Contributed"));
res.setCategory("Uncategorized");
return res;
}
@ -58,66 +58,6 @@ public class LegacyUserLibrary extends UserLibrary {
return Arrays.asList("*");
}
@Override
public String getAuthor() {
return null;
}
@Override
public String getParagraph() {
return null;
}
@Override
public String getSentence() {
return null;
}
@Override
public String getWebsite() {
return null;
}
@Override
public String getCategory() {
return "Uncategorized";
}
@Override
public String getLicense() {
return null;
}
@Override
public String getVersion() {
return null;
}
@Override
public String getMaintainer() {
return null;
}
@Override
public String getChecksum() {
return null;
}
@Override
public long getSize() {
return 0;
}
@Override
public String getUrl() {
return null;
}
@Override
public List<ContributedLibraryReference> getRequires() {
return null;
}
@Override
public String toString() {
return "LegacyLibrary:" + name + "\n";