Skip to content
This repository was archived by the owner on May 16, 2025. It is now read-only.

Commit d786634

Browse files
committed
Fix memory leak (metafacture-core#666)
Let maps implement Closeable. Bump metafacture-core version. Follow .github/workflows/build.yml to build the proper metafacture-core dependency.
1 parent eebbe88 commit d786634

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

.github/workflows/build.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@ jobs:
1313
java-version: 1.8
1414
- name: Grant execute permission for gradlew
1515
run: chmod +x gradlew
16+
- name: Install metafacture-core 5.7.1
17+
run: |
18+
cd ..
19+
git clone https://github.com/metafacture/metafacture-core.git
20+
cd metafacture-core
21+
git checkout metafacture-core-5.7.1
22+
./gradlew publishToMavenLocal
23+
cd -
1624
- name: Build with Gradle
1725
run: ./gradlew build
1826
env:

build.gradle

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ subprojects {
4444
'jquery': '3.3.1-1',
4545
'junit_jupiter': '5.8.2',
4646
'junit_platform': '1.4.2',
47-
'metafacture': '5.7.0',
47+
'metafacture': '5.7.1',
4848
'mockito': '2.27.0',
4949
'requirejs': '2.3.6',
5050
'slf4j': '1.7.21',
@@ -54,7 +54,7 @@ subprojects {
5454
}
5555

5656
group = 'org.metafacture'
57-
version = '0.8.0-SNAPSHOT'
57+
version = '0.7.1'
5858

5959
apply plugin: 'checkstyle'
6060
apply plugin: 'eclipse'
@@ -72,6 +72,7 @@ subprojects {
7272
repositories {
7373
mavenCentral()
7474
maven githubPackage.invoke("metafacture")
75+
mavenLocal()
7576
}
7677

7778
dependencies {

metafix/src/main/java/org/metafacture/metafix/maps/RdfMap.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import org.apache.jena.riot.RDFDataMgr;
3232
import org.apache.jena.shared.PropertyNotFoundException;
3333

34+
import java.io.Closeable;
3435
import java.io.IOException;
3536
import java.net.HttpURLConnection;
3637
import java.net.URL;
@@ -56,7 +57,7 @@
5657
*
5758
* @see org.metafacture.metamorph.maps.FileMap
5859
*/
59-
public final class RdfMap extends AbstractReadOnlyMap<String, String> {
60+
public final class RdfMap extends AbstractReadOnlyMap<String, String> implements Closeable {
6061

6162
public static final String SELECT = "select";
6263
public static final String TARGET = "target";
@@ -394,6 +395,14 @@ private String read(final String url) throws IOException {
394395
return conn.getURL().toString();
395396
}
396397

398+
@Override
399+
public void close() {
400+
map.clear();
401+
if (model != null) {
402+
model.close();
403+
}
404+
}
405+
397406
private enum Select {
398407
SUBJECT, OBJECT, DEFAULT
399408
}

0 commit comments

Comments
 (0)