Skip to content

Commit

Permalink
In Android 14, the "PRAGMA table_info" can/will return all uppercase …
Browse files Browse the repository at this point in the history
…type names. Explicitly toLowerCase them.
  • Loading branch information
tomf committed Oct 16, 2023
1 parent 89a09ce commit 1201393
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

import androidx.annotation.NonNull;

import java.util.Locale;
import java.util.Map;

/**
Expand Down Expand Up @@ -114,18 +115,17 @@ public SqLiteDataType[] newArray(final int size) {
* We only lookup the more common types.
*
* @param typeName one of the {@link #MAP} keys
* Must be lower-case
*
* @throws IllegalArgumentException if the type name is unknown
*/
@NonNull
static SqLiteDataType getInstance(@NonNull final String typeName) {
final SqLiteDataType type = MAP.get(typeName);
final SqLiteDataType type = MAP.get(typeName.toLowerCase(Locale.ENGLISH));
if (type != null) {
return type;
}

throw new IllegalArgumentException(typeName);
throw new IllegalArgumentException("No matching SqLiteDataType found for :" + typeName);
}

@NonNull
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* @Copyright 2018-2022 HardBackNutter
* @Copyright 2018-2023 HardBackNutter
* @License GNU General Public License
*
* This file is part of NeverTooManyBooks.
Expand Down Expand Up @@ -87,6 +87,8 @@ public ColumnInfo getColumn(@NonNull final String name) {
* @param tableName Name of the database table to lookup
*
* @return A collection of ColumnInfo objects.
*
* @throws SQLiteException if we failed to get the column details
*/
@NonNull
private Map<String, ColumnInfo> describeTable(@NonNull final SQLiteDatabase db,
Expand Down

0 comments on commit 1201393

Please sign in to comment.