Skip to content

Commit f1b1db0

Browse files
author
Philip (flip) Kromer
committed
Minor fixes: error messages on import; gitignore artifacts; make NumberUtils available to UDFs
1 parent 4f92c50 commit f1b1db0

4 files changed

Lines changed: 15 additions & 12 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,4 @@ libs/
3232
Icon?
3333
ehthumbs.db
3434
Thumbs.db
35+
target/*

src/main/java/com/esri/core/geometry/NumberUtils.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@
2424

2525
package com.esri.core.geometry;
2626

27-
class NumberUtils {
27+
public class NumberUtils {
2828

29-
static int snap(int v, int minv, int maxv) {
29+
public static int snap(int v, int minv, int maxv) {
3030
return v < minv ? minv : v > maxv ? maxv : v;
3131
}
3232

33-
static long snap(long v, long minv, long maxv) {
33+
public static long snap(long v, long minv, long maxv) {
3434
return v < minv ? minv : v > maxv ? maxv : v;
3535
}
3636

src/main/java/com/esri/core/geometry/OperatorExportToWktLocal.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ static void exportToWkt(int export_flags, Geometry geometry,
4242
|| (export_flags & WktExportFlags.wktExportMultiLineString) != 0
4343
|| (export_flags & WktExportFlags.wktExportPoint) != 0
4444
|| (export_flags & WktExportFlags.wktExportMultiPoint) != 0)
45-
throw new IllegalArgumentException();
45+
throw new IllegalArgumentException("Cannot export a Polygon as Line/Point : "+export_flags);
4646

4747
exportPolygonToWkt(export_flags, (Polygon) geometry, string);
4848
return;
@@ -52,7 +52,7 @@ static void exportToWkt(int export_flags, Geometry geometry,
5252
|| (export_flags & WktExportFlags.wktExportMultiPolygon) != 0
5353
|| (export_flags & WktExportFlags.wktExportPoint) != 0
5454
|| (export_flags & WktExportFlags.wktExportMultiPoint) != 0)
55-
throw new IllegalArgumentException();
55+
throw new IllegalArgumentException("Cannot export a Polyline as (Multi)Polygon/(Multi)Point : "+export_flags);
5656

5757
exportPolylineToWkt(export_flags, (Polyline) geometry, string);
5858
return;
@@ -62,7 +62,7 @@ static void exportToWkt(int export_flags, Geometry geometry,
6262
|| (export_flags & WktExportFlags.wktExportMultiLineString) != 0
6363
|| (export_flags & WktExportFlags.wktExportPolygon) != 0
6464
|| (export_flags & WktExportFlags.wktExportMultiPolygon) != 0)
65-
throw new IllegalArgumentException();
65+
throw new IllegalArgumentException("Cannot export a MultiPoint as (Multi)LineString/(Multi)Polygon: "+export_flags);
6666

6767
exportMultiPointToWkt(export_flags, (MultiPoint) geometry, string);
6868
return;
@@ -72,7 +72,7 @@ static void exportToWkt(int export_flags, Geometry geometry,
7272
|| (export_flags & WktExportFlags.wktExportMultiLineString) != 0
7373
|| (export_flags & WktExportFlags.wktExportPolygon) != 0
7474
|| (export_flags & WktExportFlags.wktExportMultiPolygon) != 0)
75-
throw new IllegalArgumentException();
75+
throw new IllegalArgumentException("Cannot export a Point as (Multi)LineString/(Multi)Polygon: "+export_flags);
7676

7777
exportPointToWkt(export_flags, (Point) geometry, string);
7878
return;
@@ -82,7 +82,7 @@ static void exportToWkt(int export_flags, Geometry geometry,
8282
|| (export_flags & WktExportFlags.wktExportMultiLineString) != 0
8383
|| (export_flags & WktExportFlags.wktExportPoint) != 0
8484
|| (export_flags & WktExportFlags.wktExportMultiPoint) != 0)
85-
throw new IllegalArgumentException();
85+
throw new IllegalArgumentException("Cannot export an Envelop as (Multi)LineString/(Multi)Point: "+export_flags);
8686

8787
exportEnvelopeToWkt(export_flags, (Envelope) geometry, string);
8888
return;
@@ -149,7 +149,7 @@ static void exportPolygonToWkt(int export_flags, Polygon polygon,
149149

150150
if ((export_flags & WktExportFlags.wktExportPolygon) != 0) {
151151
if (polygon_count > 1)
152-
throw new IllegalArgumentException();
152+
throw new IllegalArgumentException("Cannot export a Polygon with specified export flags: "+export_flags);
153153

154154
polygonTaggedText_(precision, b_export_zs, b_export_ms, zs, ms,
155155
position, path_flags, paths, path_count, string);
@@ -207,7 +207,7 @@ static void exportPolylineToWkt(int export_flags, Polyline polyline,
207207

208208
if ((export_flags & WktExportFlags.wktExportLineString) != 0) {
209209
if (path_count > 1)
210-
throw new IllegalArgumentException();
210+
throw new IllegalArgumentException("Cannot export a LineString with specified export flags: "+export_flags);
211211

212212
lineStringTaggedText_(precision, b_export_zs, b_export_ms, zs, ms,
213213
position, path_flags, paths, string);
@@ -256,7 +256,7 @@ static void exportMultiPointToWkt(int export_flags, MultiPoint multipoint,
256256

257257
if ((export_flags & WktExportFlags.wktExportPoint) != 0) {
258258
if (point_count > 1)
259-
throw new IllegalArgumentException();
259+
throw new IllegalArgumentException("Cannot export a Point with specified export flags: "+export_flags);
260260

261261
pointTaggedTextFromMultiPoint_(precision, b_export_zs, b_export_ms,
262262
zs, ms, position, string);

src/main/java/com/esri/core/geometry/WktParser.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,9 @@ private void geometry_() {
264264
m_current_token_type = WktToken.geometrycollection;
265265
m_function_stack.add(State.geometryCollectionStart);
266266
} else {
267-
throw new IllegalArgumentException();
267+
String snippet = (m_wkt_string.length() > 200 ?
268+
m_wkt_string.substring(0,200)+"..." : m_wkt_string);
269+
throw new IllegalArgumentException("Could not parse Well-Known Text: "+snippet);
268270
}
269271

270272
m_function_stack.add(State.attributes);

0 commit comments

Comments
 (0)