mirror of
https://github.com/M66B/FairEmail.git
synced 2026-01-03 11:28:41 +01:00
Fixed warnings
This commit is contained in:
@@ -1223,7 +1223,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||
|
||||
new SimpleTask<EntityFolder>() {
|
||||
@Override
|
||||
protected EntityFolder onLoad(Context context, Bundle args) throws Throwable {
|
||||
protected EntityFolder onLoad(Context context, Bundle args) {
|
||||
EntityMessage message = (EntityMessage) args.getSerializable("message");
|
||||
return DB.getInstance(context).folder().getFolder(message.folder);
|
||||
}
|
||||
@@ -1265,7 +1265,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||
|
||||
new SimpleTask<Void>() {
|
||||
@Override
|
||||
protected Void onLoad(Context context, Bundle args) throws Throwable {
|
||||
protected Void onLoad(Context context, Bundle args) {
|
||||
EntityMessage message = (EntityMessage) args.getSerializable("message");
|
||||
String[] keywords = args.getStringArray("keywords");
|
||||
boolean[] selected = args.getBooleanArray("selected");
|
||||
@@ -1312,7 +1312,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||
|
||||
new SimpleTask<Void>() {
|
||||
@Override
|
||||
protected Void onLoad(Context context, Bundle args) throws Throwable {
|
||||
protected Void onLoad(Context context, Bundle args) {
|
||||
EntityMessage message = (EntityMessage) args.getSerializable("message");
|
||||
String keyword = args.getString("keyword");
|
||||
|
||||
|
||||
@@ -153,7 +153,7 @@ public class AdapterOperation extends RecyclerView.Adapter<AdapterOperation.View
|
||||
|
||||
new SimpleTask<Void>() {
|
||||
@Override
|
||||
protected Void onLoad(Context context, Bundle args) throws Throwable {
|
||||
protected Void onLoad(Context context, Bundle args) {
|
||||
DB.getInstance(context).operation().deleteOperation(args.getLong("id"));
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ public abstract class DB extends RoomDatabase {
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
static String exec(DB db, String command) {
|
||||
private static String exec(DB db, String command) {
|
||||
Cursor cursor = null;
|
||||
try {
|
||||
cursor = db.query(command, new Object[0]);
|
||||
@@ -309,26 +309,25 @@ public abstract class DB extends RoomDatabase {
|
||||
if (addresses == null)
|
||||
return null;
|
||||
JSONArray jaddresses = new JSONArray();
|
||||
if (addresses != null)
|
||||
for (Address address : addresses)
|
||||
try {
|
||||
if (address instanceof InternetAddress) {
|
||||
String a = ((InternetAddress) address).getAddress();
|
||||
String p = ((InternetAddress) address).getPersonal();
|
||||
JSONObject jaddress = new JSONObject();
|
||||
if (a != null)
|
||||
jaddress.put("address", a);
|
||||
if (p != null)
|
||||
jaddress.put("personal", p);
|
||||
jaddresses.put(jaddress);
|
||||
} else {
|
||||
JSONObject jaddress = new JSONObject();
|
||||
jaddress.put("address", address.toString());
|
||||
jaddresses.put(jaddress);
|
||||
}
|
||||
} catch (JSONException ex) {
|
||||
Log.e(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
|
||||
for (Address address : addresses)
|
||||
try {
|
||||
if (address instanceof InternetAddress) {
|
||||
String a = ((InternetAddress) address).getAddress();
|
||||
String p = ((InternetAddress) address).getPersonal();
|
||||
JSONObject jaddress = new JSONObject();
|
||||
if (a != null)
|
||||
jaddress.put("address", a);
|
||||
if (p != null)
|
||||
jaddress.put("personal", p);
|
||||
jaddresses.put(jaddress);
|
||||
} else {
|
||||
JSONObject jaddress = new JSONObject();
|
||||
jaddress.put("address", address.toString());
|
||||
jaddresses.put(jaddress);
|
||||
}
|
||||
} catch (JSONException ex) {
|
||||
Log.e(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
|
||||
}
|
||||
return jaddresses.toString();
|
||||
}
|
||||
|
||||
|
||||
@@ -59,10 +59,6 @@ public interface DaoAttachment {
|
||||
" AND cid = :cid")
|
||||
EntityAttachment getAttachment(long message, String cid);
|
||||
|
||||
@Query("SELECT * FROM attachment" +
|
||||
" WHERE id = :id")
|
||||
EntityAttachment getAttachment(long id);
|
||||
|
||||
@Query("UPDATE attachment" +
|
||||
" SET progress = :progress" +
|
||||
" WHERE id = :id")
|
||||
|
||||
@@ -180,7 +180,4 @@ public interface DaoFolder {
|
||||
|
||||
@Query("DELETE FROM folder WHERE id = :id")
|
||||
void deleteFolder(long id);
|
||||
|
||||
@Query("DELETE FROM folder WHERE account= :account AND name = :name")
|
||||
void deleteFolder(long account, String name);
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ public class EntityMessage implements Serializable {
|
||||
public Long last_attempt; // send
|
||||
|
||||
static String generateMessageId() {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append('<')
|
||||
.append(Math.abs(new Random().nextInt())).append('.')
|
||||
.append(System.currentTimeMillis()).append('.')
|
||||
|
||||
@@ -60,18 +60,18 @@ public class EntityOperation {
|
||||
public Long created;
|
||||
public String error;
|
||||
|
||||
public static final String ADD = "add";
|
||||
public static final String MOVE = "move";
|
||||
public static final String DELETE = "delete";
|
||||
public static final String SEND = "send";
|
||||
public static final String SEEN = "seen";
|
||||
public static final String ANSWERED = "answered";
|
||||
public static final String FLAG = "flag";
|
||||
public static final String KEYWORD = "keyword";
|
||||
public static final String HEADERS = "headers";
|
||||
public static final String BODY = "body";
|
||||
public static final String ATTACHMENT = "attachment";
|
||||
public static final String SYNC = "sync";
|
||||
static final String ADD = "add";
|
||||
static final String MOVE = "move";
|
||||
static final String DELETE = "delete";
|
||||
static final String SEND = "send";
|
||||
static final String SEEN = "seen";
|
||||
static final String ANSWERED = "answered";
|
||||
static final String FLAG = "flag";
|
||||
static final String KEYWORD = "keyword";
|
||||
static final String HEADERS = "headers";
|
||||
static final String BODY = "body";
|
||||
static final String ATTACHMENT = "attachment";
|
||||
static final String SYNC = "sync";
|
||||
|
||||
static void queue(DB db, EntityMessage message, String name) {
|
||||
JSONArray jargs = new JSONArray();
|
||||
|
||||
@@ -1452,7 +1452,7 @@ public class FragmentCompose extends FragmentEx {
|
||||
|
||||
// Select account
|
||||
for (int pos = 0; pos < accounts.size(); pos++)
|
||||
if (accounts.get(pos).id == result.draft.account) {
|
||||
if (accounts.get(pos).id.equals(result.draft.account)) {
|
||||
spAccount.setSelection(pos);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -33,8 +33,6 @@ public class FragmentLegend extends FragmentEx {
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
setSubtitle(R.string.menu_legend);
|
||||
|
||||
View view = inflater.inflate(R.layout.fragment_legend, container, false);
|
||||
|
||||
return view;
|
||||
return inflater.inflate(R.layout.fragment_legend, container, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,6 +58,7 @@ import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
@@ -673,8 +674,10 @@ public class FragmentSetup extends FragmentEx {
|
||||
|
||||
byte[] salt = new byte[16];
|
||||
byte[] prefix = new byte[16];
|
||||
raw.read(salt);
|
||||
raw.read(prefix);
|
||||
if (raw.read(salt) != salt.length)
|
||||
throw new IOException("length");
|
||||
if (raw.read(prefix) != prefix.length)
|
||||
throw new IOException("length");
|
||||
|
||||
SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1");
|
||||
KeySpec keySpec = new PBEKeySpec(password.toCharArray(), salt, KEY_ITERATIONS, KEY_LENGTH);
|
||||
|
||||
@@ -48,6 +48,7 @@ import org.jsoup.nodes.Element;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
@@ -148,7 +149,8 @@ public class FragmentWebView extends FragmentEx {
|
||||
|
||||
fis = new FileInputStream(file);
|
||||
byte[] bytes = new byte[(int) file.length()];
|
||||
fis.read(bytes);
|
||||
if (fis.read(bytes) != bytes.length)
|
||||
throw new IOException("length");
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("data:");
|
||||
|
||||
@@ -272,7 +272,7 @@ public class Helper {
|
||||
}
|
||||
|
||||
static String canonicalAddress(String address) {
|
||||
String[] a = address.split("\\@");
|
||||
String[] a = address.split("@");
|
||||
if (a.length > 0)
|
||||
a[0] = a[0].split("\\+")[0];
|
||||
return TextUtils.join("@", a);
|
||||
|
||||
@@ -34,7 +34,7 @@ import java.util.regex.Pattern;
|
||||
public class HtmlHelper {
|
||||
private static Pattern pattern = Pattern.compile("([http|https]+://[\\w\\S(\\.|:|/)]+)");
|
||||
|
||||
public static String sanitize(String html) {
|
||||
static String sanitize(String html) {
|
||||
Document document = Jsoup.parse(Jsoup.clean(html, Whitelist.relaxed().addProtocols("img", "src", "cid")));
|
||||
|
||||
for (Element tr : document.select("tr"))
|
||||
|
||||
@@ -28,7 +28,7 @@ import javax.mail.internet.MimeMessage;
|
||||
public class MimeMessageEx extends MimeMessage {
|
||||
private String msgid;
|
||||
|
||||
public MimeMessageEx(Session session, String msgid) {
|
||||
MimeMessageEx(Session session, String msgid) {
|
||||
super(session);
|
||||
this.msgid = msgid;
|
||||
}
|
||||
|
||||
@@ -118,8 +118,6 @@ public abstract class SimpleTask<T> implements LifecycleObserver {
|
||||
this.stored = null;
|
||||
owner.getLifecycle().addObserver(this);
|
||||
|
||||
onInit(args);
|
||||
|
||||
// Run in background thread
|
||||
executor.submit(new Runnable() {
|
||||
@Override
|
||||
@@ -164,9 +162,6 @@ public abstract class SimpleTask<T> implements LifecycleObserver {
|
||||
}
|
||||
}
|
||||
|
||||
protected void onInit(Bundle args) {
|
||||
}
|
||||
|
||||
protected T onLoad(Context context, Bundle args) throws Throwable {
|
||||
// Be careful not to access members in outer scopes
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user