You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2025/01/15 09:56:40 UTC
(jena) 03/06: GH-2800: Rename jena-iri IRIException as IRIException0
This is an automated email from the ASF dual-hosted git repository.
andy pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/jena.git
commit 315b865b353f9b935b8edf46cff8a9a74aad4b3b
Author: Andy Seaborne <an...@apache.org>
AuthorDate: Sat Jan 11 09:03:11 2025 +0000
GH-2800: Rename jena-iri IRIException as IRIException0
---
.../java/org/apache/jena/riot/system/Checker.java | 2 +-
.../apache/jena/riot/system/CheckerJenaIRI.java | 2 +-
.../iri/{IRIException.java => IRIException0.java} | 4 ++--
.../main/java/org/apache/jena/iri/IRIFactory.java | 8 ++++----
.../main/java/org/apache/jena/iri/IRIFactoryI.java | 12 ++++++------
.../main/java/org/apache/jena/iri/Violation.java | 20 ++++++++------------
.../apache/jena/iri/impl/AbsIRIFactoryImpl.java | 22 +++++++++++-----------
.../org/apache/jena/iri/impl/IRIImplException.java | 6 +++---
.../java/org/apache/jena/iri/TestIRIFactory.java | 19 ++++++++++---------
9 files changed, 46 insertions(+), 49 deletions(-)
diff --git a/jena-arq/src/main/java/org/apache/jena/riot/system/Checker.java b/jena-arq/src/main/java/org/apache/jena/riot/system/Checker.java
index 01d7098385..caed482e23 100644
--- a/jena-arq/src/main/java/org/apache/jena/riot/system/Checker.java
+++ b/jena-arq/src/main/java/org/apache/jena/riot/system/Checker.java
@@ -127,7 +127,7 @@ public class Checker {
errorHandler(errorHandler).warning("Bad IRI: " + msg, line, col);
} else
errorHandler(errorHandler).warning("Unwise IRI: " + msg, line, col);
- } catch (org.apache.jena.iri.IRIException | org.apache.jena.irix.IRIException ex) {}
+ } catch (org.apache.jena.iri.IRIException0 | org.apache.jena.irix.IRIException ex) {}
}
// /**
diff --git a/jena-arq/src/main/java/org/apache/jena/riot/system/CheckerJenaIRI.java b/jena-arq/src/main/java/org/apache/jena/riot/system/CheckerJenaIRI.java
index f417b62d0d..b725f6003b 100644
--- a/jena-arq/src/main/java/org/apache/jena/riot/system/CheckerJenaIRI.java
+++ b/jena-arq/src/main/java/org/apache/jena/riot/system/CheckerJenaIRI.java
@@ -105,7 +105,7 @@ class CheckerJenaIRI {
errorHandler(errorHandler).warning("Bad IRI: " + msg, line, col);
} else
errorHandler(errorHandler).warning("Not advised IRI: " + msg, line, col);
- } catch (org.apache.jena.iri.IRIException | org.apache.jena.irix.IRIException ex) {}
+ } catch (org.apache.jena.iri.IRIException0 | org.apache.jena.irix.IRIException ex) {}
}
private static ErrorHandler errorHandler(ErrorHandler handler) {
diff --git a/jena-iri/src/main/java/org/apache/jena/iri/IRIException.java b/jena-iri/src/main/java/org/apache/jena/iri/IRIException0.java
similarity index 93%
rename from jena-iri/src/main/java/org/apache/jena/iri/IRIException.java
rename to jena-iri/src/main/java/org/apache/jena/iri/IRIException0.java
index 35f2e6526b..2d52d69e33 100644
--- a/jena-iri/src/main/java/org/apache/jena/iri/IRIException.java
+++ b/jena-iri/src/main/java/org/apache/jena/iri/IRIException0.java
@@ -28,10 +28,10 @@ package org.apache.jena.iri;
* but merely remember the error to be accessed by the user
* using {@link IRI#violations(boolean)}.
*/
-abstract public class IRIException extends RuntimeException {
+abstract public class IRIException0 extends RuntimeException {
- protected IRIException() {
+ protected IRIException0() {
super();
}
diff --git a/jena-iri/src/main/java/org/apache/jena/iri/IRIFactory.java b/jena-iri/src/main/java/org/apache/jena/iri/IRIFactory.java
index e7477f3b1b..2ba7fd5993 100644
--- a/jena-iri/src/main/java/org/apache/jena/iri/IRIFactory.java
+++ b/jena-iri/src/main/java/org/apache/jena/iri/IRIFactory.java
@@ -488,7 +488,7 @@ characters ("[", "]") are not part of the above list
* @param query Query string
* @param fragment Fragment
* @return An IRI with the given components.
- * * @throws IRIException If the resulting IRI
+ * * @throws IRIException0 If the resulting IRI
* has unfixable errors, e.g. non-ascii chars in the scheme name
@see #setEncoding(String)
@@ -501,7 +501,7 @@ characters ("[", "]") are not part of the above list
String path,
String query,
String fragment
- ) throws IRIException {
+ ) throws IRIException0 {
return throwAnyErrors(create( scheme,
userInfo,
host,
@@ -531,7 +531,7 @@ characters ("[", "]") are not part of the above list
* @param fragment Fragment
* @return An IRI with the given components.
- * @throws IRIException If the resulting IRI
+ * @throws IRIException0 If the resulting IRI
* has unfixable errors, e.g. non-ascii chars in the scheme name
@see #setEncoding(String)
@@ -542,7 +542,7 @@ characters ("[", "]") are not part of the above list
String path,
String query,
String fragment
- ) throws IRIException {
+ ) throws IRIException0 {
return throwAnyErrors(create( scheme,
authority,
path,
diff --git a/jena-iri/src/main/java/org/apache/jena/iri/IRIFactoryI.java b/jena-iri/src/main/java/org/apache/jena/iri/IRIFactoryI.java
index c16983b2b6..d7c8a3d6ba 100644
--- a/jena-iri/src/main/java/org/apache/jena/iri/IRIFactoryI.java
+++ b/jena-iri/src/main/java/org/apache/jena/iri/IRIFactoryI.java
@@ -44,12 +44,12 @@ public interface IRIFactoryI {
* @param i
* The IRI to use.
* @return A new IRI object.
- * @throws IRIException
+ * @throws IRIException0
* If a violation of the standards being enforced by the factory
* has been detected, and this violation is classified by the
* factory as an error.
*/
- IRI construct(IRI i) throws IRIException ;
+ IRI construct(IRI i) throws IRIException0 ;
/**
* Make a new IRI object (possibly including IRI resolution), and check it
@@ -58,12 +58,12 @@ public interface IRIFactoryI {
* @param s
* The IRI to use.
* @return A new IRI object.
- * @throws IRIException
+ * @throws IRIException0
* If a violation of the standards being enforced by the factory
* has been detected, and this violation is classified by the
* factory as an error.
*/
- IRI construct(String s) throws IRIException ;
+ IRI construct(String s) throws IRIException0 ;
/**
* Make a new IRI object (possibly including IRI resolution), and check it
@@ -72,12 +72,12 @@ public interface IRIFactoryI {
* @param uri
* The IRI string to use.
* @return A new IRI object.
- * @throws IRIException
+ * @throws IRIException0
* If a violation of the standards being enforced by the factory
* has been detected, and this violation is classified by the
* factory as an error.
*/
- IRI construct(URI uri) throws IRIException ;
+ IRI construct(URI uri) throws IRIException0 ;
/**
* Make a new IRI object (possibly including IRI resolution), and check it
diff --git a/jena-iri/src/main/java/org/apache/jena/iri/Violation.java b/jena-iri/src/main/java/org/apache/jena/iri/Violation.java
index 2a146979e9..2e22881551 100644
--- a/jena-iri/src/main/java/org/apache/jena/iri/Violation.java
+++ b/jena-iri/src/main/java/org/apache/jena/iri/Violation.java
@@ -21,8 +21,8 @@ package org.apache.jena.iri;
/**
* Information concerning a
* violation of some specification concerning IRIs.
- * This may be wrapped in
- * an {@link IRIException} and thrown,
+ * This may be wrapped in
+ * an {@link IRIException0} and thrown,
* or may be returned by
* {@link IRI#violations(boolean)}. Which conditions
* result in errors and warnings
@@ -31,10 +31,6 @@ package org.apache.jena.iri;
*/
public abstract class Violation implements ViolationCodes, IRIComponents {
-
- // TODO e-mail about dot-segments
-
- // TODO single script in a component
/**
* The value from {@link ViolationCodes}
* corresponding to this condition.
@@ -73,22 +69,22 @@ public abstract class Violation implements ViolationCodes, IRIComponents {
* @return The error message.
*/
abstract public String getShortMessage();
-
+
/**
* A long description of the error condition,
- * typically including the
+ * typically including the
* @return The error message.
*/
abstract public String getLongMessage();
-
-
+
+
/**
- * The URL of the
+ * The URL of the
* section of the specification which has been violated.
* @return The error message.
*/
abstract public String getSpecificationURL();
-
+
/**
* Using the settings of the factory associated
* with the IRI associated with this violation,
diff --git a/jena-iri/src/main/java/org/apache/jena/iri/impl/AbsIRIFactoryImpl.java b/jena-iri/src/main/java/org/apache/jena/iri/impl/AbsIRIFactoryImpl.java
index fe6fd1c3a7..c768d3b902 100644
--- a/jena-iri/src/main/java/org/apache/jena/iri/impl/AbsIRIFactoryImpl.java
+++ b/jena-iri/src/main/java/org/apache/jena/iri/impl/AbsIRIFactoryImpl.java
@@ -22,7 +22,7 @@ package org.apache.jena.iri.impl;
import java.net.URI;
import org.apache.jena.iri.IRI ;
-import org.apache.jena.iri.IRIException ;
+import org.apache.jena.iri.IRIException0;
import org.apache.jena.iri.IRIFactoryI ;
abstract public class AbsIRIFactoryImpl implements IRIFactoryI {
@@ -43,30 +43,30 @@ abstract public class AbsIRIFactoryImpl implements IRIFactoryI {
// AbsIRIImpl.NO_EXCEPTIONS)
);
}
-
+
@Override
public IRI create(URI uri) {
return create(uri.toASCIIString());
}
-
-
+
+
@Override
- public IRI construct(String s) throws IRIException {
+ public IRI construct(String s) throws IRIException0 {
return throwAnyErrors(create(s));
}
//@Override
@Override
- public IRI construct(IRI i) throws IRIException {
- return throwAnyErrors(create(i));
+ public IRI construct(IRI i) throws IRIException0 {
+ return throwAnyErrors(create(i));
}
-
+
@Override
- public IRI construct(URI uri) throws IRIException {
+ public IRI construct(URI uri) throws IRIException0 {
return throwAnyErrors(create(uri));
}
- protected IRI throwAnyErrors(IRI rslt) throws IRIException {
+ protected IRI throwAnyErrors(IRI rslt) throws IRIException0 {
if (rslt.hasViolation(false)) {
throw new IRIImplException(rslt.violations(false).next());
// Iterator it = rslt.exceptions();
@@ -74,7 +74,7 @@ abstract public class AbsIRIFactoryImpl implements IRIFactoryI {
// Violation v = (Violation)it.next();
// if (v.isError())
// throw new IRIImplException(v);
-// }
+// }
}
return rslt;
}
diff --git a/jena-iri/src/main/java/org/apache/jena/iri/impl/IRIImplException.java b/jena-iri/src/main/java/org/apache/jena/iri/impl/IRIImplException.java
index a0b9c40340..79f12ff4e1 100644
--- a/jena-iri/src/main/java/org/apache/jena/iri/impl/IRIImplException.java
+++ b/jena-iri/src/main/java/org/apache/jena/iri/impl/IRIImplException.java
@@ -18,10 +18,10 @@
package org.apache.jena.iri.impl;
-import org.apache.jena.iri.IRIException ;
+import org.apache.jena.iri.IRIException0;
import org.apache.jena.iri.Violation ;
-public class IRIImplException extends IRIException {
+public class IRIImplException extends IRIException0 {
private static final long serialVersionUID = 1072420548744246731L;
private final Violation violation;
@@ -39,6 +39,6 @@ public class IRIImplException extends IRIException {
public String getMessage() {
return getViolation().getShortMessage();
}
-
+
}
diff --git a/jena-iri/src/test/java/org/apache/jena/iri/TestIRIFactory.java b/jena-iri/src/test/java/org/apache/jena/iri/TestIRIFactory.java
index ebdcb16ce1..9e05eb302b 100644
--- a/jena-iri/src/test/java/org/apache/jena/iri/TestIRIFactory.java
+++ b/jena-iri/src/test/java/org/apache/jena/iri/TestIRIFactory.java
@@ -21,21 +21,22 @@ import static org.junit.Assert.assertEquals;
import java.net.URI;
-import junit.framework.JUnit4TestAdapter;
import org.junit.Test;
+import junit.framework.JUnit4TestAdapter;
+
public class TestIRIFactory {
static public junit.framework.Test suite() {
return new JUnit4TestAdapter(TestIRIFactory.class);
}
-
+
@SuppressWarnings("deprecation")
private static IRIFactory iriFactory = IRIFactory.jenaImplementation();
-
+
@Test
public void createFromURI() {
URI uri = URI.create("http://johndoe:secret@example.com:81/page?2#hash");
- IRI iri = iriFactory.create(uri);
+ IRI iri = iriFactory.create(uri);
assertEquals("http", iri.getScheme());
assertEquals("johndoe:secret", iri.getRawUserinfo());
assertEquals("example.com", iri.getRawHost());
@@ -50,17 +51,17 @@ public class TestIRIFactory {
URI relative = URI.create("page/deeper.txt?q");
IRI relativeIri = iriFactory.create(relative);
assertEquals("page/deeper.txt", relativeIri.getRawPath());
-
+
IRI base = iriFactory.create("http://example.com/relative/path?q=somethingelse");
IRI absolute = base.create(relative);
assertEquals("http://example.com/relative/page/deeper.txt?q", absolute.toString());
-
+
URI other = URI.create("http://other.example.net/");
IRI otherIri = base.create(other);
assertEquals("http://other.example.net/", otherIri.toASCIIString());
}
-
- @Test(expected=IRIException.class)
+
+ @Test(expected=IRIException0.class)
public void constructFromDubiousURI() throws Exception {
// Legal URI by Java
URI relative = URI.create("unknown:abc");
@@ -70,5 +71,5 @@ public class TestIRIFactory {
// Expect exception
IRI relativeIri = IRIFactory.iriImplementation().construct(relative);
}
-
+
}