Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Scheme-less stream URLs throw NullPointerException instead of URISyntaxException

Aperta Adatta ai principianti
#2,218 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 3 giorni

@blihio ci sta già lavorando.

Dal 16/10/2026.

  • #2219 di @blihio — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
82/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
android, java, kotlin
Ambito
networking

Direzione di ricerca

Inizia dalla classe UrlParser nel modulo common, in parse, dove il controllo del supporto al protocollo viene eseguito solo quando uri.scheme non è null. Il costruttore poi assegna scheme = uri.scheme, che genera la NPE. Esegui UrlParser.parse("//localhost/live/test", arrayOf("rtmp")) per riprodurre. Il lavoro è completato quando un input senza schema genera URISyntaxException e i test esistenti del modulo common continuano a passare.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
Kotlin
Stelle
3k
Fork
946
Merge medio
5g 1h
PR unite (30g)
6

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di pedroSG94/RootEncoder

Tutte le issue di pedroSG94/RootEncoder

Issue simili

Altre issue su Kotlin

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.