[mkgmap] 01/08: Imported Upstream version 0.0.0+svn3694

Bas Couwenberg sebastic at debian.org
Thu Sep 1 08:23:59 UTC 2016


This is an automated email from the git hooks/post-receive script.

sebastic pushed a commit to branch master
in repository mkgmap.

commit 9af5a771af62b67e1a8807267a7bab063cc3d437
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date:   Thu Sep 1 09:59:06 2016 +0200

    Imported Upstream version 0.0.0+svn3694
---
 .classpath                                         |  2 +-
 .settings/org.eclipse.jdt.core.prefs               |  6 +--
 build.xml                                          |  4 --
 resources/mkgmap-version.properties                |  4 +-
 scripts/download/mkdoc                             |  1 +
 src/uk/me/parabola/imgfmt/app/net/RouteNode.java   | 37 +++++++++----
 src/uk/me/parabola/mkgmap/build/MapBuilder.java    | 58 +++++++++++++++++++-
 .../mkgmap/filters/DouglasPeuckerFilter.java       | 25 ++++-----
 .../PreserveHorizontalAndVerticalLinesFilter.java  | 62 ----------------------
 src/uk/me/parabola/mkgmap/general/MapLine.java     |  8 ++-
 .../parabola/mkgmap/osmstyle/RuleFileReader.java   |  2 +-
 test/func/SimpleTest.java                          |  2 +-
 test/func/route/SimpleRouteTest.java               |  6 +--
 .../uk/me/parabola/imgfmt/app/typ/TYPFileTest.java | 12 +++--
 .../mkgmap/osmstyle/RuleFileReaderTest.java        | 16 ++++++
 .../me/parabola/mkgmap/typ/TypTextReaderTest.java  | 14 ++---
 16 files changed, 141 insertions(+), 118 deletions(-)

diff --git a/.classpath b/.classpath
index a9544e7..2061bdc 100644
--- a/.classpath
+++ b/.classpath
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
-	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
 	<classpathentry kind="src" path="resources"/>
 	<classpathentry excluding="uk/me/parabola/mkgmap/reader/dem/optional/" kind="src" path="src"/>
 	<classpathentry kind="src" path="test"/>
diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs
index 7078bf8..5d105e8 100644
--- a/.settings/org.eclipse.jdt.core.prefs
+++ b/.settings/org.eclipse.jdt.core.prefs
@@ -7,9 +7,9 @@ org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nul
 org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
 org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.compliance=1.8
 org.eclipse.jdt.core.compiler.debug.lineNumber=generate
 org.eclipse.jdt.core.compiler.debug.localVariable=generate
 org.eclipse.jdt.core.compiler.debug.sourceFile=generate
@@ -97,4 +97,4 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
 org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
 org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
 org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.7
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/build.xml b/build.xml
index 2b09b34..d2fd028 100644
--- a/build.xml
+++ b/build.xml
@@ -18,10 +18,6 @@
 <project name="mkgmap" default="dist" basedir="."
 		xmlns:ivy="antlib:org.apache.ivy.ant">
 
-	<!-- Set default javac target value -->
-	<property name="ant.build.javac.target" value="1.7"/>
-	<property name="ant.build.javac.source" value="1.7"/>
-
 	<property name="project.name" value="${ant.project.name}"/>
 
 	<!-- Init -->
diff --git a/resources/mkgmap-version.properties b/resources/mkgmap-version.properties
index 9f219a3..ad1defd 100644
--- a/resources/mkgmap-version.properties
+++ b/resources/mkgmap-version.properties
@@ -1,2 +1,2 @@
-svn.version: 3686
-build.timestamp: 2016-07-29T09:57:12+0100
+svn.version: 3694
+build.timestamp: 2016-08-18T22:23:10+0100
diff --git a/scripts/download/mkdoc b/scripts/download/mkdoc
index e3f65d1..997475a 100755
--- a/scripts/download/mkdoc
+++ b/scripts/download/mkdoc
@@ -23,6 +23,7 @@ cp resources/help/en/options ../dist/doc/options.txt
 
 DOC=~/www/web/mkgmap/content/doc
 WEB_DOC_PDF=~/www/mkgmap.org.uk/docroot/doc/pdf
+mkdir -p $WEB_DOC_PDF
 cp *.txt $DOC
 cp styles/style-manual.pdf $WEB_DOC_PDF
 )
diff --git a/src/uk/me/parabola/imgfmt/app/net/RouteNode.java b/src/uk/me/parabola/imgfmt/app/net/RouteNode.java
index b4bbb43..c04ad78 100644
--- a/src/uk/me/parabola/imgfmt/app/net/RouteNode.java
+++ b/src/uk/me/parabola/imgfmt/app/net/RouteNode.java
@@ -347,24 +347,39 @@ public class RouteNode implements Comparable<RouteNode> {
 	}
 
 	public void checkRoundabouts() {
-
 		List<RouteArc> roundaboutArcs = new ArrayList<RouteArc>();
-
+		int countNonRoundaboutRoads = 0;
+		int countNonRoundaboutOtherHighways = 0;
+		RouteArc roundaboutArc = null;
 		for(RouteArc a : arcs) {
 			// ignore ways that have been synthesised by mkgmap
-			if(!a.getRoadDef().isSynthesised() && a.isDirect() && 
-			   a.getRoadDef().isRoundabout()) {
-				roundaboutArcs.add(a);
+			RoadDef r = a.getRoadDef();
+			if (!r.isSynthesised() && a.isDirect()){
+				if(r.isRoundabout())
+				{
+					roundaboutArcs.add(a);
+					if (roundaboutArc == null)
+						roundaboutArc = a;
+				}
+				else {
+					// ignore footpaths and ways with no access
+					byte access = r.getAccess();
+					if ((access & AccessTagsAndBits.CAR) != 0)
+						countNonRoundaboutRoads++;
+					else if ((access & (AccessTagsAndBits.BIKE | AccessTagsAndBits.BUS | AccessTagsAndBits.TAXI | AccessTagsAndBits.TRUCK)) != 0)
+						countNonRoundaboutOtherHighways++;
+				}
 			}
 		}
 			
-		if(arcs.size() > 1 && roundaboutArcs.size() == 1) {
-			if(roundaboutArcs.get(0).isForward())
-				log.warn("Roundabout " + roundaboutArcs.get(0).getRoadDef() + " starts at " + coord.toOSMURL());
-			else
-				log.warn("Roundabout " + roundaboutArcs.get(0).getRoadDef() + " ends at " + coord.toOSMURL());
+		if(arcs.size() > 1 && roundaboutArcs.size() == 1)
+			log.warn("Roundabout",roundaboutArc.getRoadDef(),roundaboutArc.isForward() ? "starts at" : "ends at", coord.toOSMURL());
+		if (roundaboutArcs.size() > 0) {
+			if (countNonRoundaboutRoads > 1)
+				log.warn("Roundabout",roundaboutArc.getRoadDef(),"is connected to more than one road at",coord.toOSMURL());
+			else if ((countNonRoundaboutRoads == 1) && (countNonRoundaboutOtherHighways > 0))
+				log.warn("Roundabout",roundaboutArc.getRoadDef(),"is connected to a road and",countNonRoundaboutOtherHighways,"other highways at",coord.toOSMURL());
 		}
-
 		if(roundaboutArcs.size() > 2) {
 			for(RouteArc fa : arcs) {
 				if(fa.isForward() && fa.isDirect()) {
diff --git a/src/uk/me/parabola/mkgmap/build/MapBuilder.java b/src/uk/me/parabola/mkgmap/build/MapBuilder.java
index e002acd..27e169d 100644
--- a/src/uk/me/parabola/mkgmap/build/MapBuilder.java
+++ b/src/uk/me/parabola/mkgmap/build/MapBuilder.java
@@ -22,6 +22,7 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashMap;
+import java.util.IdentityHashMap;
 import java.util.List;
 import java.util.Set;
 
@@ -69,7 +70,6 @@ import uk.me.parabola.mkgmap.filters.LineSplitterFilter;
 import uk.me.parabola.mkgmap.filters.MapFilter;
 import uk.me.parabola.mkgmap.filters.MapFilterChain;
 import uk.me.parabola.mkgmap.filters.PolygonSplitterFilter;
-import uk.me.parabola.mkgmap.filters.PreserveHorizontalAndVerticalLinesFilter;
 import uk.me.parabola.mkgmap.filters.RemoveEmpty;
 import uk.me.parabola.mkgmap.filters.RemoveObsoletePointsFilter;
 import uk.me.parabola.mkgmap.filters.RoundCoordsFilter;
@@ -1120,9 +1120,10 @@ public class MapBuilder implements Configurable {
 			shapes = mergedShapes;
 		}
 		
+		preserveHorizontalAndVerticalLines(res, shapes);
+		
 		LayerFilterChain filters = new LayerFilterChain(config);
 		if (enableLineCleanFilters && (res < 24)) {
-			filters.addFilter(new PreserveHorizontalAndVerticalLinesFilter());
 			filters.addFilter(new RoundCoordsFilter());
 			int sizefilterVal =  getMinSizePolygonForResolution(res);
 			if (sizefilterVal > 0)
@@ -1146,6 +1147,59 @@ public class MapBuilder implements Configurable {
 		}
 	}
 
+	/**
+	 * Preserve shape points which a) lie on the shape boundary or
+	 * b) which appear multiple times in the shape (excluding the start
+	 * point which should always be identical to the end point).
+	 * The preserved points are kept treated specially in the 
+	 * Line-Simplification-Filters, this should avoid artifacts like
+	 * white triangles in the sea for lower resolutions.     
+	 * @param res the current resolution
+	 * @param shapes list of shapes
+	 */
+	private void preserveHorizontalAndVerticalLines(int res, List<MapShape> shapes) {
+		if (res == 24)
+			return;
+		for (MapShape shape : shapes) {
+			if (shape.getMinResolution() > res || shape.getMaxResolution() < res)
+				continue;
+			int minLat = shape.getBounds().getMinLat();
+			int maxLat = shape.getBounds().getMaxLat();
+			int minLon = shape.getBounds().getMinLong();
+			int maxLon = shape.getBounds().getMaxLong();
+			
+			List<Coord> points = shape.getPoints();
+			int n = shape.getPoints().size();
+			IdentityHashMap<Coord, Coord> coords = new IdentityHashMap<>(n);
+			Coord first = points.get(0);
+			Coord prev = first;
+			Coord last = first;
+			for(int i = 1; i < points.size(); ++i) {
+				last = points.get(i);
+				// preserve coord instances which are used more than once,
+				// these are typically produced by the ShapeMergerFilter 
+				// to connect holes
+				if (coords.get(last) == null){
+					coords.put(last, last);
+				}
+				else {
+					if (!last.preserved()){
+						last.preserved(true);
+					}
+				}
+
+				// preserve the end points of horizontal and vertical lines that lie
+				// on the bbox of the shape. 
+				if(last.getLatitude() == prev.getLatitude() && (last.getLatitude() == minLat || last.getLatitude() == maxLat) ||
+				   last.getLongitude() == prev.getLongitude()&& (last.getLongitude() == minLon || last.getLongitude() == maxLon)){
+					last.preserved(true);
+					prev.preserved(true);
+				}
+				prev = last;
+			}
+		}
+	}
+
 	Highway makeHighway(Map map, String ref) {
 		if(getDefaultRegion(null) == null) {
 			log.warn("Highway " + ref + " has no region (define a default region to zap this warning)");
diff --git a/src/uk/me/parabola/mkgmap/filters/DouglasPeuckerFilter.java b/src/uk/me/parabola/mkgmap/filters/DouglasPeuckerFilter.java
index 55cf626..0970700 100644
--- a/src/uk/me/parabola/mkgmap/filters/DouglasPeuckerFilter.java
+++ b/src/uk/me/parabola/mkgmap/filters/DouglasPeuckerFilter.java
@@ -19,7 +19,6 @@ import java.util.List;
 import uk.me.parabola.imgfmt.app.Coord;
 import uk.me.parabola.mkgmap.general.MapElement;
 import uk.me.parabola.mkgmap.general.MapLine;
-import uk.me.parabola.mkgmap.general.MapShape;
 
 /**
  * This is a filter that smooths out lines at low resolutions. If the element
@@ -33,7 +32,6 @@ public class DouglasPeuckerFilter implements MapFilter {
 	private final double filterDistance;
 	private double maxErrorDistance;
 	private int resolution;
-	private int level;
 
 	public DouglasPeuckerFilter(double filterDistance) {
 		this.filterDistance = filterDistance;
@@ -41,7 +39,6 @@ public class DouglasPeuckerFilter implements MapFilter {
 
 	public void init(FilterConfig config) {
 		this.resolution = config.getResolution();
-		this.level = config.getLevel();
 		this.maxErrorDistance = filterDistance * (1<< config.getShift());
 	}
 
@@ -69,18 +66,16 @@ public class DouglasPeuckerFilter implements MapFilter {
 		coords.addAll(points);
 		// Loop runs downwards, as the list length gets modified while running
 		int endIndex = coords.size()-1;
-		if (level == 0 || line instanceof MapShape){
-			for(int i = endIndex-1; i > 0; i--) {
-				Coord p = coords.get(i);
-				//int highwayCount = p.getHighwayCount();
-
-				// If a node in the line use the douglas peucker algorithm for upper segment
-				// TODO: Should consider only nodes connected to roads visible at current resolution.
-				if (p.preserved()) {
-					// point is "preserved", don't remove it
-					douglasPeucker(coords, i, endIndex, maxErrorDistance);
-					endIndex = i;
-				}
+		for(int i = endIndex-1; i > 0; i--) {
+			Coord p = coords.get(i);
+			//int highwayCount = p.getHighwayCount();
+
+			// If a node in the line use the douglas peucker algorithm for upper segment
+			// TODO: Should consider only nodes connected to roads visible at current resolution.
+			if (p.preserved()) {
+				// point is "preserved", don't remove it
+				douglasPeucker(coords, i, endIndex, maxErrorDistance);
+				endIndex = i;
 			}
 		}
 		// Simplify the rest
diff --git a/src/uk/me/parabola/mkgmap/filters/PreserveHorizontalAndVerticalLinesFilter.java b/src/uk/me/parabola/mkgmap/filters/PreserveHorizontalAndVerticalLinesFilter.java
deleted file mode 100644
index e778aa7..0000000
--- a/src/uk/me/parabola/mkgmap/filters/PreserveHorizontalAndVerticalLinesFilter.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (C) 2007 Steve Ratcliffe
- * 
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License version 2 as
- *  published by the Free Software Foundation.
- * 
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- * 
- */
-package uk.me.parabola.mkgmap.filters;
-
-import java.util.List;
-
-import uk.me.parabola.imgfmt.app.Coord;
-import uk.me.parabola.mkgmap.general.MapElement;
-import uk.me.parabola.mkgmap.general.MapLine;
-
-public class PreserveHorizontalAndVerticalLinesFilter implements MapFilter {
-
-	private int shift;
-
-	public void init(FilterConfig config) {
-		shift = config.getShift();
-	}
-
-	/**
-	 * @param element A map element that will be a line or a polygon.
-	 * @param next This is used to pass the possibly transformed element onward.
-	 */
-	public void doFilter(MapElement element, MapFilterChain next) {
-		MapLine line = (MapLine) element;
-
-		if(shift != 0) {
-			// preserve the end points of horizontal and vertical lines that lie
-			// on the bbox of the shape. 
-			int minLat = line.getBounds().getMinLat();
-			int maxLat = line.getBounds().getMaxLat();
-			int minLon = line.getBounds().getMinLong();
-			int maxLon = line.getBounds().getMaxLong();
-			
-			List<Coord> points = line.getPoints();
-			Coord first = points.get(0);
-			Coord prev = first;
-			Coord last = first;
-			for(int i = 1; i < points.size(); ++i) {
-				last = points.get(i);
-				if(last.getLatitude() == prev.getLatitude() && (last.getLatitude() == minLat || last.getLatitude() == maxLat) ||
-				   last.getLongitude() == prev.getLongitude()&& (last.getLongitude() == minLon || last.getLongitude() == maxLon)){
-					last.preserved(true);
-					prev.preserved(true);
-				}
-				prev = last;
-			}
-		}
-
-		next.doFilter(line);
-	}
-}
diff --git a/src/uk/me/parabola/mkgmap/general/MapLine.java b/src/uk/me/parabola/mkgmap/general/MapLine.java
index 2dd2485..04531ab 100644
--- a/src/uk/me/parabola/mkgmap/general/MapLine.java
+++ b/src/uk/me/parabola/mkgmap/general/MapLine.java
@@ -66,6 +66,12 @@ public class MapLine extends MapElement {
 		assert !points.isEmpty() : "trying to set points with zero length";
 
 		this.points = points;
+		// preserve first and last point, so that points which are shared by
+		// different ways are kept
+		if (points.size() > 0 && this instanceof MapShape == false){
+			points.get(0).preserved(true);
+			points.get(points.size()-1).preserved(true);
+		}
 		testForConsecutivePoints(points);
 	}
 	
@@ -84,13 +90,11 @@ public class MapLine extends MapElement {
 	public void insertPointsAtStart(List<Coord> additionalPoints) {
 		assert points.get(0).equals(additionalPoints.get(additionalPoints.size()-1));
 		testForConsecutivePoints(additionalPoints);
-		points.get(0).preserved(true);
 		points.addAll(0, additionalPoints.subList(0, additionalPoints.size()-1));
 	}
 
 	public void insertPointsAtEnd(List<Coord> additionalPoints) {
 		testForConsecutivePoints(additionalPoints);
-		additionalPoints.get(0).preserved(true);
 		points.remove(points.size()-1); 
 		points.addAll(additionalPoints);
 	}
diff --git a/src/uk/me/parabola/mkgmap/osmstyle/RuleFileReader.java b/src/uk/me/parabola/mkgmap/osmstyle/RuleFileReader.java
index 94f4bc4..19ac7e1 100644
--- a/src/uk/me/parabola/mkgmap/osmstyle/RuleFileReader.java
+++ b/src/uk/me/parabola/mkgmap/osmstyle/RuleFileReader.java
@@ -447,7 +447,7 @@ public class RuleFileReader {
 			return 10;
 
 		case AND:
-			return Math.min(selectivity(op.getFirst()), selectivity(op.getSecond()));
+			return Math.max(selectivity(op.getFirst()), selectivity(op.getSecond()));
 
 		case OR:
 			return Math.max(selectivity(op.getFirst()), selectivity(op.getSecond()));
diff --git a/test/func/SimpleTest.java b/test/func/SimpleTest.java
index 824b77e..5b378d2 100644
--- a/test/func/SimpleTest.java
+++ b/test/func/SimpleTest.java
@@ -103,7 +103,7 @@ public class SimpleTest extends Base {
 			case "RGN":
 				count++;
 				System.out.println("RGN size " + size);
-				assertThat("RGN size", size, new RangeMatcher(2702));
+				assertThat("RGN size", size, new RangeMatcher(2704));
 				break;
 			case "TRE":
 				count++;
diff --git a/test/func/route/SimpleRouteTest.java b/test/func/route/SimpleRouteTest.java
index 63a9c67..73d0da2 100644
--- a/test/func/route/SimpleRouteTest.java
+++ b/test/func/route/SimpleRouteTest.java
@@ -57,7 +57,7 @@ public class SimpleRouteTest extends Base {
 			case "RGN":
 				count++;
 				System.out.println("RGN size " + size);
-				assertThat("RGN size", size, new RangeMatcher(128717));
+				assertThat("RGN size", size, new RangeMatcher(127586));
 				break;
 			case "TRE":
 				count++;
@@ -71,7 +71,7 @@ public class SimpleRouteTest extends Base {
 				break;
 			case "NET":
 				count++;
-				assertEquals("NET size", 66851, size);
+				assertEquals("NET size", 66859, size);
 				break;
 			case "NOD":
 				count++;
@@ -94,7 +94,7 @@ public class SimpleRouteTest extends Base {
 			case "RGN":
 				count++;
 				System.out.println("RGN size " + size);
-				assertThat("RGN size", size, new RangeMatcher(2726));
+				assertThat("RGN size", size, new RangeMatcher(2727));
 				break;
 			case "TRE":
 				count++;
diff --git a/test/uk/me/parabola/imgfmt/app/typ/TYPFileTest.java b/test/uk/me/parabola/imgfmt/app/typ/TYPFileTest.java
index 930ab46..d47daab 100644
--- a/test/uk/me/parabola/imgfmt/app/typ/TYPFileTest.java
+++ b/test/uk/me/parabola/imgfmt/app/typ/TYPFileTest.java
@@ -23,16 +23,20 @@ import uk.me.parabola.imgfmt.sys.ImgFS;
 
 import org.junit.Test;
 
+import func.lib.TestUtils;
+
 import static org.junit.Assert.*;
 
 public class TYPFileTest {
 	
 	@Test
 	public void testWrite() throws Exception {
+		TestUtils.registerFile("test.typ");
 		FileSystemParam params = new FileSystemParam();
-		FileSystem fs = ImgFS.createFs("test.typ", params);
-		ImgChannel channel = fs.create("XXX.TYP");
-		TYPFile typFile = new TYPFile(channel);
-		assertNotNull("typ file is created", typFile);
+		try (FileSystem fs = ImgFS.createFs("test.typ", params)) {
+			ImgChannel channel = fs.create("XXX.TYP");
+			TYPFile typFile = new TYPFile(channel);
+			assertNotNull("typ file is created", typFile);
+		}
 	}
 }
diff --git a/test/uk/me/parabola/mkgmap/osmstyle/RuleFileReaderTest.java b/test/uk/me/parabola/mkgmap/osmstyle/RuleFileReaderTest.java
index c6f16e7..47f9c9e 100644
--- a/test/uk/me/parabola/mkgmap/osmstyle/RuleFileReaderTest.java
+++ b/test/uk/me/parabola/mkgmap/osmstyle/RuleFileReaderTest.java
@@ -1154,6 +1154,22 @@ public class RuleFileReaderTest {
 		assertEquals(type.getType(), 2);
 	}
 
+	@Test
+	public void testBugOr() {
+		String s = "maxspeed=*\n" +
+				"  & ( maxspeedkmh()>120 | maxspeed = none )\n" +
+				"  & ( highway = motorway | highway = trunk )\n" +
+				"[0x4]\n";
+		RuleSet rs = makeRuleSet(s);
+
+		Way w = new Way(1);
+		w.addTag("highway", "trunk");
+		w.addTag("maxspeed", "122");
+
+		GType type = getFirstType(rs, w);
+		assertNotNull(type);
+	}
+
 	/**
 	 * Get a way with a few points for testing length.
 	 *
diff --git a/test/uk/me/parabola/mkgmap/typ/TypTextReaderTest.java b/test/uk/me/parabola/mkgmap/typ/TypTextReaderTest.java
index ad800bb..c98dbc2 100644
--- a/test/uk/me/parabola/mkgmap/typ/TypTextReaderTest.java
+++ b/test/uk/me/parabola/mkgmap/typ/TypTextReaderTest.java
@@ -269,9 +269,8 @@ public class TypTextReaderTest {
 	 */
 	@Test
 	public void testFromFile() throws IOException {
-		TestUtils.registerFile("test.typ");
 		Reader r = new BufferedReader(new FileReader("test/resources/typ/test.txt"));
-		TypTextReader tr = new TypTextReader();
+		tr = new TypTextReader();
 		tr.read("test.typ", r);
 
 		TestUtils.registerFile("ts__test.typ");
@@ -279,11 +278,12 @@ public class TypTextReaderTest {
 		FileChannel channel = raf.getChannel();
 		channel.truncate(0);
 		FileImgChannel w = new FileImgChannel(channel);
-		TYPFile typ = new TYPFile(w);
-
-		typ.setData(tr.getData());
-		typ.write();
-		typ.close();
+		try (TYPFile typ = new TYPFile(w)) {
+			typ.setData(tr.getData());
+			typ.write();
+		}
+		
+		
 	}
 
 	/**

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/mkgmap.git



More information about the Pkg-grass-devel mailing list