Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Scheme-less stream URLs throw NullPointerException instead of URISyntaxException

Đang mở Phù hợp với người mới
#2,218 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 3 ngày

@blihio đang làm issue này rồi.

Từ ngày 16/10/2026.

  • #2219 của @blihio — đang mở

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
82/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
android, java, kotlin
Lĩnh vực
networking

Hướng nghiên cứu

Bắt đầu từ lớp UrlParser trong module common, tại parse, nơi kiểm tra hỗ trợ giao thức chỉ chạy khi uri.scheme khác null. Constructor sau đó gán scheme = uri.scheme, gây ra NPE. Chạy UrlParser.parse("//localhost/live/test", arrayOf("rtmp")) để tái hiện. Hoàn thành khi đầu vào không có scheme ném URISyntaxException và các test hiện có của module common vẫn chạy đạt.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
Kotlin
Star
3k
Fork
946
Merge trung bình
5 ngày 1 giờ
Pull request đã merge (30 ngày)
6

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của pedroSG94/RootEncoder

Tất cả issue của pedroSG94/RootEncoder

Issue tương tự

Thêm issue về Kotlin

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.