[ 
https://issues.apache.org/jira/browse/SPARK-3944?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Prashant Sharma updated SPARK-3944:
-----------------------------------
    Issue Type: Sub-task  (was: Bug)
        Parent: SPARK-1812

> Utils.resolveURI is not consistent on upgrading scalaVersion to 2.11.2
> ----------------------------------------------------------------------
>
>                 Key: SPARK-3944
>                 URL: https://issues.apache.org/jira/browse/SPARK-3944
>             Project: Spark
>          Issue Type: Sub-task
>            Reporter: Shiti Saxena
>
> The method tries to match a String (`uri.getScheme`) to obtain the result. 
> The value from `uri.getScheme` can be null. 
> Pattern matching using Regex when String value is null throws NPE in Scala 
> 2.11.2. whereas it works in 2.10.4
> Running the same code snippet gives different results
> {noformat}
> Welcome to Scala version 2.10.4 (Java HotSpot(TM) 64-Bit Server VM, Java 
> 1.7.0_60).
> Type in expressions to have them evaluated.
> Type :help for more information.
> scala> val pattern = "(.*)".r
> pattern: scala.util.matching.Regex = (.*)
> scala> val x:String = null
> x: String = null
> scala> x match {   case pattern(x) => println("Success")
>      |       case null => println("Fail")
>      | }
> Fail
> scala> 
> {noformat}
> {noformat}
> Welcome to Scala version 2.11.2 (Java HotSpot(TM) 64-Bit Server VM, Java 
> 1.7.0_60).
> Type in expressions to have them evaluated.
> Type :help for more information.
> scala> val pattern = "(.*)".r
> pattern: scala.util.matching.Regex = (.*)
> scala> val x:String = null
> x: String = null
> scala> x match {   case pattern(x) => println("Success")
>      |       case null => println("Fail")
>      |      }
> java.lang.NullPointerException
>   at java.util.regex.Matcher.getTextLength(Matcher.java:1234)
>   at java.util.regex.Matcher.reset(Matcher.java:308)
>   at java.util.regex.Matcher.<init>(Matcher.java:228)
>   at java.util.regex.Pattern.matcher(Pattern.java:1088)
>   at scala.util.matching.Regex.unapplySeq(Regex.scala:206)
>   ... 47 elided
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to