exportToJson fails when CREATE TABLE statement contains nested parentheses
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 68/100
調査の方向性
exportToJson('full') で使用されるヘルパー modEmbeddedParentheses() の周辺にある ExportToJson.java から始め、ネストした括弧と同じ階層の括弧を含む、提供された budgets の CREATE TABLE 文で失敗を再現します。収集された開き括弧と閉じ括弧の位置を追跡します; 完了の条件は、報告された StringIndexOutOfBoundsException が発生せず、これらのスキーマで Android のエクスポートが正常に完了することです。
索引モデルが issue の本文から書いたものです。
説明
Plugin version:
capacitor-community/[email protected]
Platform(s):
Android
Current behavior:
exportToJson('full', false); fails when CREATE TABLE statement contains nested parentheses
e.g if this statements are used, export fails
CHECK (isDisabled IN (0, 1))
CHECK (endDate IS NULL OR date(endDate) >= date(startDate))
CHECK ( (isRecurring = 1 AND recurrenceIntervalType IS NOT NULL AND recurrenceIntervalValue IS NOT NULL) OR
(isRecurring = 0 AND recurrenceIntervalType IS NULL AND recurrenceIntervalValue IS NULL) ),
Changing those to those below works as workaround, export finishes:
CHECK (isDisabled = 0 OR isDisabled = 1)
CHECK (endDate IS NULL OR endDate >= startDate)
CHECK (isRecurring = 1 AND recurrenceIntervalType IS NOT NULL AND recurrenceIntervalValue IS NOT NULL
OR isRecurring = 0 AND recurrenceIntervalType IS NULL AND recurrenceIntervalValue IS NULL),
Exact error messages from android:
Error: exportToJson CreateExportObject: GetTablesFull: begin 919, end 831, length 1121
2026-04-28 23:41:51.380 8687-8752 com.getcap...RetHandler com.myapp.app V *** ERROR ExportToJson: ExportToJson CreateExportObject: GetTablesFull: begin 919, end 831, length 1121
2026-04-28 23:41:51.380 8687-8752 Capacitor com.myapp.app D Sending plugin error: {"save":false,"callbackId":"14032160","pluginId":"CapacitorSQLite","methodName":"exportToJson","success":false,"error":{"message":"ExportToJson: ExportToJson CreateExportObject: GetTablesFull: begin 919, end 831, length 1121"}}
2026-04-28 23:41:51.380 8687-8687 Capacitor/Console com.myapp.app E File: - Line 330 - Msg: [object Object]
2026-04-28 23:41:51.382 8687-8687 Capacitor/Console com.myapp.app E File: https://localhost/settings - Line 961 - Msg: Uncaught (in promise) Error: ExportToJson: ExportToJson CreateExportObject: GetTablesFull: begin 919, end 831, length 1121
Expected behavior:
Export completed without problems.
Steps to reproduce:
Run statement containing nested parentheses and run exportToJson('full')
`CREATE TABLE budgets
(
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT NOT NULL,
amount REAL NOT NULL,
startDate TEXT NOT NULL,
endDate TEXT NULL,
isRecurring BOOLEAN NOT NULL DEFAULT 0,
recurrenceIntervalType TEXT NULL,
recurrenceIntervalValue INTEGER NULL,
warnNotifThresholdPercent INTEGER NOT NULL DEFAULT 80,
CHECK (isRecurring IN (0, 1)),
CHECK ( (isRecurring = 1 AND recurrenceIntervalType IS NOT NULL AND recurrenceIntervalValue IS NOT NULL) OR
(isRecurring = 0 AND recurrenceIntervalType IS NULL AND recurrenceIntervalValue IS NULL) ),
CHECK (recurrenceIntervalType IN ('days', 'weeks', 'months', 'years') OR recurrenceIntervalType IS NULL),
CHECK (endDate IS NULL OR date(endDate) >= date(startDate))
);`
Other information:
Claude sonnet analysis of the problem:
The Android plugin's modEmbeddedParentheses() helper in ExportToJson.java iterates through the ( and ) positions it collected from the CREATE TABLE body. When it detects a nested pair (oPars[i+1] < cPars[i]), it advances i inside the loop and the loop advances it again, putting it out of sync. It then tries to fill the "gap" between the two inner groups with substring(cPars[i], oPars[i+1]-1).
For CHECK ( (expr_A) OR (expr_B) ) the inner i points to the close of expr_B (later in string) while i+1 points to the open of expr_B (earlier in string) → begin > end → StringIndexOutOfBoundsException: begin 919, end 831, length 1121.
Or from other prompt
The crash comes from ExportToJson.java (line ~290) inside the modEmbeddedParentheses() helper, which is called for every CREATE TABLE schema during exportToJson('full').
The helper collects all ( positions into oPars and all ) positions into cPars and then tries to pair them up in a single loop. The pairing logic has a flaw: when a table has sibling nested parentheses — i.e., two (or more) inner groups at the same depth — it advances i inside the loop body and outside it, so the "gap between groups" substring is computed as substring(cPars[i], oPars[i+1] - 1) where cPars[i] ends up greater than oPars[i+1] - 1. That triggers Java's StringIndexOutOfBoundsException: begin N, end M, length L.
Capacitor doctor:
💊 Capacitor Doctor 💊
Latest Dependencies:
@capacitor/cli: 8.3.1
@capacitor/core: 8.3.1
@capacitor/android: 8.3.1
@capacitor/ios: 8.3.1
Installed Dependencies:
@capacitor/ios: not installed
@capacitor/cli: 8.3.1
@capacitor/core: 8.3.1
@capacitor/android: 8.3.1
[success] Android looking great! 👌
- 主要言語
- Swift
- スター
- 663
- フォーク
- 159
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
capacitor-community/sqlite のほかの issue
-
難易度 3/5 1〜2日 初心者へのやさしさ 72/100
capacitor-community/sqlite#700 · コメント 1 件 · リアクション 1 件 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
capacitor-community/sqlite#693 · リアクション 7 件 ·
-
feature needs: triage
難易度 3/5 1〜2日 初心者へのやさしさ 55/100
capacitor-community/sqlite#689 ·
-
bug/fix needs: triage
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
capacitor-community/sqlite#685 ·
-
bug/fix needs: triage
難易度 3/5 1〜2日 初心者へのやさしさ 48/100
capacitor-community/sqlite#671 ·
capacitor-community/sqlite の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
permissionlesstech/bitchat#1743 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 70/100
521xueweihan/HelloGitHub#3816 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 65/100
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
jamesmontemagno/tiny-clips#378 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
图标看起来比其他应用小一圈オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100