Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Scheme-less stream URLs throw NullPointerException instead of URISyntaxException

オープン 初心者向け
#2,218 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 3 日以内に返信

@blihio がすでに取り組んでいます。

2026年10月16日 から。

  • #2219 @blihio による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
82/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
android, java, kotlin
領域
networking

調査の方向性

common モジュールの UrlParser クラス、parse から始めてください。parse では、プロトコルサポートのチェックが uri.scheme が null でない場合にのみ実行されます。その後コンストラクタが scheme = uri.scheme を代入し、そこで NPE が発生します。再現には UrlParser.parse("//localhost/live/test", arrayOf("rtmp")) を実行します。スキーマのない入力が URISyntaxException をスローし、既存の common のテストが引き続き通れば完了です。

索引モデルが issue の本文から書いたものです。

説明

Describe the bug

UrlParser.parse allows a scheme-less URI with a host and path to pass validation, then throws NullPointerException when assigning the null scheme to a non-null Kotlin property.

The streaming clients catch URISyntaxException around URL parsing, so this input bypasses their malformed-endpoint handling.

To reproduce

Call either of the following:

UrlParser.parse("//localhost/live/test", arrayOf("rtmp"))
UrlParser.parse("//127.0.0.1:1935/live/test", arrayOf("rtmp"))

Both produce:

java.lang.NullPointerException: getScheme(...) must not be null

The current condition only checks whether the protocol is supported when uri.scheme != null. A missing scheme skips this check, and the constructor later fails at scheme = uri.scheme.

Expected behavior

Reject a missing scheme with URISyntaxException, as with an unsupported scheme, so callers can use the existing malformed-URL handling.

Environment
  • Source version: 2.8.1
  • Commit: 82a9cb4ee4babdc792d2ccee8b893f2b36207d40
  • Module: common
  • Class: UrlParser
  • Reproduced on the JVM and in Android local unit tests using JDK 17 and Gradle 9.7.1.
  • A device or media server is not required to reproduce this parser failure.
Additional context

Two regression tests reproduce the issue: a scheme-less hostname URL and a scheme-less IPv4 URL with an explicit port. Both fail with NPE before the fix and pass afterward.

With only the fix and its tests applied, all 100 common and 25 encoder local unit tests pass.

A full client connection or device-level crash was not tested.

主要言語
Kotlin
スター
3k
フォーク
946
平均マージ
5日 1時間
マージ済み PR(30日)
6

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

pedroSG94/RootEncoder のほかの issue

pedroSG94/RootEncoder の issue をすべて見る

似ている issue

Kotlin の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。