Skip to content

Upgrades. #22

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,20 @@ script:
scala:
- 2.10.7
- 2.11.12
- 2.12.4
- 2.13.0-M2
- 2.12.6
- 2.13.0-M3
- 2.13.0-M4
jdk:
- oraclejdk8
env:
- SCALAJS_VERSION=0.6.21
- SCALAJS_VERSION=1.0.0-M1
- SCALAJS_VERSION=1.0.0-M2
- SCALAJS_VERSION=0.6.23
- SCALAJS_VERSION=1.0.0-M3
matrix:
exclude:
- scala: 2.10.7
env: SCALAJS_VERSION=1.0.0-M3
- scala: 2.13.0-M4
env: SCALAJS_VERSION=1.0.0-M3

cache:
directories:
Expand Down
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import sbtcrossproject.crossProject

crossScalaVersions in ThisBuild := Seq("2.12.4", "2.11.12", "2.10.7", "2.13.0-M2")
crossScalaVersions in ThisBuild := Seq("2.12.6", "2.11.12", "2.10.7", "2.13.0-M3", "2.13.0-M4")
scalaVersion in ThisBuild := (crossScalaVersions in ThisBuild).value.head

val commonSettings: Seq[Setting[_]] = Seq(
Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=0.13.16
sbt.version=0.13.17
10 changes: 2 additions & 8 deletions project/build.sbt
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
val scalaJSVersion =
Option(System.getenv("SCALAJS_VERSION")).getOrElse("0.6.21")
Option(System.getenv("SCALAJS_VERSION")).getOrElse("0.6.23")

addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion)

{
if (scalaJSVersion != "1.0.0-M1")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.3.0")
else
Nil
}
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.3.0")

addSbtPlugin("org.scalastyle" % "scalastyle-sbt-plugin" % "0.8.0")
18 changes: 11 additions & 7 deletions src/main/scala/java/util/logging/Formatter.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package java.util.logging

import java.lang.StringBuilder

abstract class Formatter protected () {

def format(record: LogRecord): String
Expand All @@ -17,7 +19,7 @@ abstract class Formatter protected () {
// Instead we'll do simple text replacement, very imperative
var msgAccumulator = new StringBuilder()
var inParam = false
var paramInFlight:StringBuilder = null
var paramInFlight: StringBuilder = null
var substitutionFailure = false // track failure to break the loop
var i = 0

Expand All @@ -31,13 +33,13 @@ abstract class Formatter protected () {
paramInFlight = new StringBuilder()
} else if (inParam && currentChar != '}') {
// accumulate the param
paramInFlight += currentChar
paramInFlight.append(currentChar)
} else if (currentChar == '}') {
// end of param, replace placeholder by value if possible
inParam = false
val (failed, replacement) = {
try {
val index = paramInFlight.toInt
val index = paramInFlight.toString().toInt
if (index >= 0 && index < params.length) {
(false, params(index).toString)
} else if (index > 0) {
Expand All @@ -55,15 +57,17 @@ abstract class Formatter protected () {

// The JVM will fail if e.g. there are bogus params and would not replace
// any parameter
if (failed) substitutionFailure = failed
else msgAccumulator ++= replacement
if (failed)
substitutionFailure = failed
else
msgAccumulator.append(replacement)
} else {
msgAccumulator += currentChar
msgAccumulator.append(currentChar)
}
}

if (substitutionFailure || inParam) msg
else msgAccumulator.result()
else msgAccumulator.toString()
} else {
msg
}
Expand Down