You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Shiti Saxena (JIRA)" <ji...@apache.org> on 2014/10/14 12:31:34 UTC

[jira] [Updated] (SPARK-3944) Utils.resolveURI is not consistent on upgrading scalaVersion to 2.11.2

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

Shiti Saxena updated SPARK-3944:
--------------------------------
    Description: 
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}

> 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: Bug
>            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: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org