Skip to content

Commit 616768e

Browse files
authored
Merge pull request #58 from delphi-hub/bugfix/windowsencodingerror
Fixed error when accessing resource files on Windows 10 machines
2 parents d7cca67 + 099f3f7 commit 616768e

File tree

5 files changed

+10
-14
lines changed

5 files changed

+10
-14
lines changed

build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name := "delphi-webapi"
22

3-
version := "0.9.5-SNAPSHOT"
3+
version := "0.9.6-SNAPSHOT"
44

55
scalaVersion := "2.13.1"
66

src/main/resources/features.json

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
{
1313
"name" : "maven.artifactId",
1414
"description": "ArtifactId of a Maven Package",
15-
"internalName": "identifier.artifactid"
15+
"internalName": "identifier.artifactId"
1616
},
1717
{
1818
"name" : "maven.version",
@@ -674,11 +674,6 @@
674674
"internalName": "hermes.features.public fields\nonly used by defininig type ",
675675
"name": "metrics.fields.publicvisiblelocal"
676676
},
677-
{
678-
"description": "",
679-
"internalName": "hermes.features.sun",
680-
"name": "sun"
681-
},
682677
{
683678
"description": "Object-based Thread Notification (Object.notify, notifyAll, or wait).",
684679
"internalName": "hermes.features.Object-based Thread Notification",

src/main/scala/de/upb/cs/swt/delphi/webapi/FeatureQuery.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ import org.slf4j.LoggerFactory
2424
import spray.json._
2525
import de.upb.cs.swt.delphi.webapi.FeatureJson._
2626

27-
import scala.io.Source
27+
import scala.io.{Codec, Source}
2828

2929
class FeatureQuery(configuration: Configuration) {
3030
private val log = LoggerFactory.getLogger(this.getClass)
3131

3232
lazy val featureList: Iterable[Feature] =
33-
Source.fromResource("features.json")
33+
Source.fromResource("features.json")(Codec.UTF8)
3434
.getLines()
3535
.mkString("\n")
3636
.parseJson

src/main/scala/de/upb/cs/swt/delphi/webapi/artifacts/ArtifactTransformer.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ import de.upb.cs.swt.delphi.webapi.InternalFeature
2222
import org.joda.time.format.ISODateTimeFormat
2323
import spray.json.JsArray
2424

25-
import scala.io.Source
25+
import scala.io.{Codec, Source}
2626
import spray.json._
2727
import de.upb.cs.swt.delphi.webapi.FeatureJson._
2828
import de.upb.cs.swt.delphi.webapi.search.SearchResults
2929

3030
object ArtifactTransformer {
31-
private lazy val internalFeatures = Source.fromResource("features.json")
31+
private lazy val internalFeatures = Source.fromResource("features.json")(Codec.UTF8)
3232
.getLines()
3333
.mkString("\n")
3434
.parseJson

src/main/scala/de/upb/cs/swt/delphi/webapi/search/SearchQuery.scala

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,15 @@ package de.upb.cs.swt.delphi.webapi.search
1919
import com.sksamuel.elastic4s.http.ElasticDsl._
2020
import com.sksamuel.elastic4s.http.search.SearchHits
2121
import com.sksamuel.elastic4s.http.{ElasticClient, RequestFailure, RequestSuccess}
22+
import com.sksamuel.elastic4s.searches.queries.matches.MatchQuery
2223
import com.sksamuel.elastic4s.searches.queries.{NoopQuery, Query}
2324
import de.upb.cs.swt.delphi.core.model._
2425
import de.upb.cs.swt.delphi.core.ql._
2526
import de.upb.cs.swt.delphi.webapi.artifacts.ArtifactTransformer
2627
import de.upb.cs.swt.delphi.webapi.{Configuration, Feature, FeatureQuery, InternalFeature}
2728
import spray.json.JsArray
2829

29-
import scala.io.Source
30+
import scala.io.{Codec, Source}
3031
import scala.util.{Failure, Success, Try}
3132
import spray.json._
3233
import de.upb.cs.swt.delphi.webapi.FeatureJson._
@@ -35,7 +36,7 @@ import de.upb.cs.swt.delphi.webapi.FeatureJson._
3536
class SearchQuery(configuration: Configuration, featureExtractor: FeatureQuery) {
3637
private val client = ElasticClient(configuration.elasticsearchClientUri)
3738

38-
lazy val internalFeatures = Source.fromResource("features.json")
39+
lazy val internalFeatures = Source.fromResource("features.json")(Codec.UTF8)
3940
.getLines()
4041
.mkString("\n")
4142
.parseJson
@@ -112,7 +113,7 @@ class SearchQuery(configuration: Configuration, featureExtractor: FeatureQuery)
112113
)
113114
)
114115
}
115-
case EqualExpr(field, value) => matchQuery(externalToInternalFeature(field.fieldName), value)
116+
case EqualExpr(field, value) => matchQuery(externalToInternalFeature(field.fieldName), value)
116117
case NotEqualExpr(field, value) => bool(not(matchQuery(externalToInternalFeature(field.fieldName), value)))
117118
case GreaterThanExpr(field, value) => rangeQuery(externalToInternalFeature(field.fieldName)).gt(value.toLong)
118119
case GreaterOrEqualExpr(field, value) => rangeQuery(externalToInternalFeature(field.fieldName)).gte(value.toLong)

0 commit comments

Comments
 (0)