mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-09 23:15:49 +01:00
avoid NumberFormatException
This commit is contained in:
@@ -41,6 +41,12 @@ object Implicits {
|
||||
}
|
||||
sb.toString
|
||||
}
|
||||
|
||||
def toIntOpt: Option[Int] = try {
|
||||
Option(Integer.parseInt(value))
|
||||
} catch {
|
||||
case e: NumberFormatException => None
|
||||
}
|
||||
}
|
||||
|
||||
implicit class RichRequest(request: HttpServletRequest){
|
||||
@@ -69,4 +75,4 @@ object Implicits {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user