Bug 1081606: Don't call toArray with zero-size arrays. r=rnewman

* * *
Bug 1081606: Don't call toArray with zero-size arrays. r=rnewman
This commit is contained in:
Chris Kitching 2014-10-12 02:52:38 +01:00
Родитель 53b5941b4f
Коммит 056a0996e8
4 изменённых файлов: 5 добавлений и 5 удалений

Просмотреть файл

@ -199,7 +199,7 @@ public class FilePicker implements GeckoEventListener {
title = getFilePickerTitle(mimeType); title = getFilePickerTitle(mimeType);
} }
Intent chooser = Intent.createChooser(base, title); Intent chooser = Intent.createChooser(base, title);
chooser.putExtra(Intent.EXTRA_INITIAL_INTENTS, intents.toArray(new Parcelable[]{})); chooser.putExtra(Intent.EXTRA_INITIAL_INTENTS, intents.toArray(new Parcelable[intents.size()]));
handler.gotIntent(chooser); handler.gotIntent(chooser);
} }

Просмотреть файл

@ -379,7 +379,7 @@ abstract public class FxAccountAbstractSetupActivity extends FxAccountAbstractAc
} }
// And then sorted in alphabetical order. // And then sorted in alphabetical order.
final String[] sortedEmails = emails.toArray(new String[0]); final String[] sortedEmails = emails.toArray(new String[emails.size()]);
Arrays.sort(sortedEmails); Arrays.sort(sortedEmails);
final ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_dropdown_item_1line, sortedEmails); final ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_dropdown_item_1line, sortedEmails);

Просмотреть файл

@ -176,7 +176,7 @@ public class FxAccountCreateAccountActivity extends FxAccountAbstractSetupActivi
for (int i = 1991; i <= year - 5; i++) { for (int i = 1991; i <= year - 5; i++) {
years.add(Integer.toString(i)); years.add(Integer.toString(i));
} }
return years.toArray(new String[0]); return years.toArray(new String[years.size()]);
} }
protected void createYearEdit() { protected void createYearEdit() {

Просмотреть файл

@ -173,7 +173,7 @@ public class FormHistoryRepositorySession extends
} }
} }
String guidsArray[] = guids.toArray(new String[0]); String guidsArray[] = guids.toArray(new String[guids.size()]);
delegate.onGuidsSinceSucceeded(guidsArray); delegate.onGuidsSinceSucceeded(guidsArray);
} }
}; };
@ -466,7 +466,7 @@ public class FormHistoryRepositorySession extends
protected void flushInsertQueue() throws RemoteException { protected void flushInsertQueue() throws RemoteException {
synchronized (recordsBufferMonitor) { synchronized (recordsBufferMonitor) {
if (recordsBuffer.size() > 0) { if (recordsBuffer.size() > 0) {
final ContentValues[] outgoing = recordsBuffer.toArray(new ContentValues[0]); final ContentValues[] outgoing = recordsBuffer.toArray(new ContentValues[recordsBuffer.size()]);
recordsBuffer = new ArrayList<ContentValues>(); recordsBuffer = new ArrayList<ContentValues>();
if (outgoing == null || outgoing.length == 0) { if (outgoing == null || outgoing.length == 0) {