[GitHub] [commons-io] jglick opened a new pull request, #478: `FileUtils.deleteDirectory` could throw `UncheckedIOException`
jglick opened a new pull request, #478: URL: https://github.com/apache/commons-io/pull/478 At some point between 2.11.0 and 2.13.0, I think as of 323d376b4a934a5a6ebdc552dc923db9e267e569, there seems to have been an incompatible change due to use of `UncheckedIOException`. I found the following from a piece of code calling `FileUtils.deleteDirectory` and catching and logging `IOException`, which failed to catch the runtime exception: ``` java.nio.file.NoSuchFileException: /path/to/file at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92) at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111) at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116) at java.base/sun.nio.fs.UnixFileAttributeViews$Posix.readAttributes(UnixFileAttributeViews.java:234) at java.base/sun.nio.fs.UnixFileAttributeViews$Posix.readAttributes(UnixFileAttributeViews.java:147) at java.base/sun.nio.fs.UnixFileSystemProvider.readAttributes(UnixFileSystemProvider.java:149) at java.base/sun.nio.fs.LinuxFileSystemProvider.readAttributes(LinuxFileSystemProvider.java:99) at java.base/java.nio.file.Files.readAttributes(Files.java:1764) at org.apache.commons.io.function.Uncheck.apply(Uncheck.java:162) Caused: java.io.UncheckedIOException at org.apache.commons.io.function.Uncheck.wrap(Uncheck.java:242) at org.apache.commons.io.function.Uncheck.apply(Uncheck.java:164) at org.apache.commons.io.file.PathUtils.readAttributes(PathUtils.java:1259) at org.apache.commons.io.file.PathUtils.readPosixFileAttributes(PathUtils.java:1349) at org.apache.commons.io.file.PathUtils.deleteFile(PathUtils.java:582) at org.apache.commons.io.file.PathUtils.delete(PathUtils.java:476) at org.apache.commons.io.FileUtils.forceDelete(FileUtils.java:1337) at org.apache.commons.io.function.IOStream.lambda$forAll$11(IOStream.java:340) at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948) at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:658) at org.apache.commons.io.function.IOStream.forAll(IOStream.java:338) at org.apache.commons.io.function.IOStreams.forAll(IOStreams.java:42) at org.apache.commons.io.function.IOStreams.forAll(IOStreams.java:36) at org.apache.commons.io.function.IOConsumer.forAll(IOConsumer.java:80) at org.apache.commons.io.FileUtils.cleanDirectory(FileUtils.java:333) at org.apache.commons.io.FileUtils.deleteDirectory(FileUtils.java:1192) ``` Never mind the exact reason for the failure of `Files.readAttributes`; something to do with NFS I think. The point is that `deleteDirectory` should either succeed, or throw some subtype of `IOException`. Reproduced similar behavior in the unit test prior to `src/main/` fix: ``` org.opentest4j.AssertionFailedError: Unexpected exception type thrown, expected: but was: at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151) at org.junit.jupiter.api.AssertThrows.assertThrows(AssertThrows.java:67) at org.junit.jupiter.api.AssertThrows.assertThrows(AssertThrows.java:35) at org.junit.jupiter.api.Assertions.assertThrows(Assertions.java:3111) at org.apache.commons.io.file.PathUtilsDeleteFileTest.testForceDeleteFileDoesNotExist(PathUtilsDeleteFileTest.java:115) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at java.base/java.util.ArrayList.forEach(ArrayList.java:1541) at java.base/java.util.ArrayList.forEach(ArrayList.java:1541) Caused by: java.io.UncheckedIOException: java.nio.file.NoSuchFileException: /tmp/org.apache.commons.io.file.PathUtilsDeleteFileTest15920347910072703873/nonexistent at org.apache.commons.io.function.Uncheck.wrap(Uncheck.java:339) at org.apache.commons.io.function.Uncheck.apply(Uncheck.java:165) at org.apache.commons.io.file.PathUtils.readAttributes(PathUtils.java:1259) at org.apache.commons.io.file.PathUtils.readPosixFileAttributes(PathUtils.java:1349) at org.apache.commons.io.file.PathUtils.deleteFile(PathUtils.java:582) at org.apache.commons.io.file.PathUtils.deleteFile(PathUtils.java:544) at org.apache.commons.io.file.PathUtilsDeleteFileTest.lambda$testForceDeleteFileDoesNotExist$0(PathUtilsDeleteFileTest.java:115) at org.junit.jupiter.api.AssertThrows.assertThrows(AssertThrows.java:53) ... 6 more Caused by: java.nio.file.NoSuchFileException: /tmp/org.apache.commons.io.file.PathUtilsDeleteFileTest15920347910072703873/nonexistent at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92) at
[jira] [Commented] (VALIDATOR-490) [DomainValidator] Add local to LOCAL_TLDs
[ https://issues.apache.org/jira/browse/VALIDATOR-490?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17762502#comment-17762502 ] Jon Krehling commented on VALIDATOR-490: Well that's a can of worms Yeah lets close this out if this isn't supposed to even be used and you are supposed to specify your own TLD anyways. Thanks for the sanity check. > [DomainValidator] Add local to LOCAL_TLDs > -- > > Key: VALIDATOR-490 > URL: https://issues.apache.org/jira/browse/VALIDATOR-490 > Project: Commons Validator > Issue Type: Improvement >Affects Versions: 1.7 >Reporter: Jon Krehling >Priority: Minor > > I am looking to have .local added to the list of LOCAL_TLDs > [https://www.iana.org/assignments/special-use-domain-names/special-use-domain-names.xhtml] > It seems odd to have .localhost and not .local and by default every service > in kubernetes will end with .local > https://github.com/apache/commons-validator/blob/master/src/main/java/org/apache/commons/validator/routines/DomainValidator.java#L2002 > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Closed] (VALIDATOR-490) [DomainValidator] Add local to LOCAL_TLDs
[ https://issues.apache.org/jira/browse/VALIDATOR-490?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Jon Krehling closed VALIDATOR-490. -- Resolution: Information Provided > [DomainValidator] Add local to LOCAL_TLDs > -- > > Key: VALIDATOR-490 > URL: https://issues.apache.org/jira/browse/VALIDATOR-490 > Project: Commons Validator > Issue Type: Improvement >Affects Versions: 1.7 >Reporter: Jon Krehling >Priority: Minor > > I am looking to have .local added to the list of LOCAL_TLDs > [https://www.iana.org/assignments/special-use-domain-names/special-use-domain-names.xhtml] > It seems odd to have .localhost and not .local and by default every service > in kubernetes will end with .local > https://github.com/apache/commons-validator/blob/master/src/main/java/org/apache/commons/validator/routines/DomainValidator.java#L2002 > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[GitHub] [commons-statistics] aherbert commented on a diff in pull request #52: STATISTICS-80: Variance Implementation
aherbert commented on code in PR #52: URL: https://github.com/apache/commons-statistics/pull/52#discussion_r1317695196 ## commons-statistics-descriptive/src/main/java/org/apache/commons/statistics/descriptive/SumOfSquaredDeviations.java: ## @@ -86,17 +85,8 @@ public void accept(double value) { * * @return {@code SumOfSquaredDeviations} of all values seen so far. */ -@Override -public double getAsDouble() { -return Double.isFinite(super.getAsDouble()) ? squaredDevSum : Double.NaN; -} - -/** - * Gets a new FirstMoment instance with all of its parameters copied from the current instance. - * @return The FirstMoment instance. - */ -FirstMoment getFirstMoment() { -return new FirstMoment(m1, n, super.getNonFiniteValue(), dev, nDev); +public double getSumOfSquaredDeviations() { +return Double.isFinite(super.getFirstMoment()) ? squaredDevSum : Double.NaN; Review Comment: No need for super here ## commons-statistics-descriptive/src/test/java/org/apache/commons/statistics/descriptive/TestData.java: ## @@ -19,11 +19,18 @@ import java.util.stream.Stream; import org.junit.jupiter.params.provider.Arguments; +/** + * Utility class which provides the data for tests in {o.a.c.s.descriptive} module. + */ final class TestData { /** Class contains only static methods. */ private TestData() {} +/** + * Function which supplies data to test the accept() and of() methods. Review Comment: supplies a test data for a statistic in a single array. ## commons-statistics-descriptive/src/main/java/org/apache/commons/statistics/descriptive/SumOfSquaredDeviations.java: ## @@ -111,11 +101,11 @@ public SumOfSquaredDeviations combine(SumOfSquaredDeviations other) { if (oldN == 0) { squaredDevSum = other.squaredDevSum; } else if (otherN != 0) { -final double diffOfMean = other.getFirstMoment().getAsDouble() - m1; +final double diffOfMean = other.getFirstMoment() - m1; final double sqDiffOfMean = diffOfMean * diffOfMean; squaredDevSum += other.squaredDevSum + sqDiffOfMean * ((double) (oldN * otherN) / (oldN + otherN)); Review Comment: This is a product of two longs so it could have integer overflow. The sum could also overflow but the sizes involved make that unlikely. I think this should be made safe by using: ```java (((double) oldN * otherN) / ((double) oldN + otherN)) ``` ## commons-statistics-descriptive/src/main/java/org/apache/commons/statistics/descriptive/Variance.java: ## @@ -109,6 +109,9 @@ public static Variance create() { */ public static Variance of(double... values) { final double mean = Mean.of(values).getAsDouble(); +if (!Double.isFinite(mean)) { +return StorelessSampleVariance.create(Math.abs(mean), mean, values.length, Math.abs(mean)); Review Comment: Correction ```java return StorelessSampleVariance.create(Math.abs(mean), mean, values.length, mean); ``` The second value is a proxy for the non-finite sum of the values, so we should not use abs. ## commons-statistics-descriptive/src/main/java/org/apache/commons/statistics/descriptive/Variance.java: ## @@ -124,10 +127,10 @@ public static Variance of(double... values) { // To prevent squaredDevSum from spuriously attaining a NaN value // when accum2Squared (which implies accum is also infinite) is infinite, assign it Review Comment: This comment is now out-of-date. You should also update the method javadoc with the case: if the sum of the squared deviations from the mean is infinite, the variance is NaN. ## commons-statistics-descriptive/src/test/java/org/apache/commons/statistics/descriptive/TestData.java: ## @@ -100,15 +122,26 @@ static Stream testCombine() { ); } -static Stream testCombineNonFinite() { +/** + * Function which supplies data with non-finite values to test the combine() method. Review Comment: supplies a test data for a statistic in as a pair of double[] arrays. Each case will contain at least 1 non-finite value. ## commons-statistics-descriptive/src/test/java/org/apache/commons/statistics/descriptive/TestData.java: ## @@ -60,18 +67,33 @@ static Stream testValues() { ); } -static Stream testValuesNonFinite() { +/** + * Function which supplies data with non-finite values to test the accept() and of() methods. Review Comment: supplies a test data for a statistic in a single array. Each case will contain at least 1 non-finite value. ## commons-statistics-descriptive/src/test/java/org/apache/commons/statistics/descriptive/TestData.java: ## @@ -60,18 +67,33 @@ static Stream testValues() { ); } -static Stream
[GitHub] [commons-jcs] garydgregory merged pull request #169: Bump actions/checkout from 3.5.3 to 4.0.0
garydgregory merged PR #169: URL: https://github.com/apache/commons-jcs/pull/169 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@commons.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [commons-configuration] garydgregory merged pull request #316: Bump slf4j.version from 2.0.7 to 2.0.9
garydgregory merged PR #316: URL: https://github.com/apache/commons-configuration/pull/316 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@commons.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[jira] [Resolved] (DBUTILS-151) Module org.apache.commons.dbutils does not declare `uses`
[ https://issues.apache.org/jira/browse/DBUTILS-151?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Gary D. Gregory resolved DBUTILS-151. - Fix Version/s: 1.8.1 Resolution: Fixed [~mprins] Please test git master or a snapshot build from [https://repository.apache.org/content/repositories/snapshots/commons-dbutils/commons-dbutils/1.8.1-SNAPSHOT/] > Module org.apache.commons.dbutils does not declare `uses` > - > > Key: DBUTILS-151 > URL: https://issues.apache.org/jira/browse/DBUTILS-151 > Project: Commons DbUtils > Issue Type: Bug >Affects Versions: 1.8.0 > Environment: openjdk version "11.0.20" 2023-07-18 / Maven 3.9.4 >Reporter: mark >Priority: Major > Fix For: 1.8.1 > > > On upgrading an existing project from 1.7 (using "auto-module") to 1.8.0 I'm > seeing ServiceConfigurationError errors in some testcases that point to the > newly added module configuration/module-info.class (which btw does not appear > to be in the change list and not in the source code) > > {{{}[ERROR] Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: > 0.076 s <<< FAILURE! -- in > nl.b3p.jdbc.util.converter.LimitSqlOracleIntegrationTest{}}}{{{}[ERROR] > nl.b3p.jdbc.util.converter.LimitSqlOracleIntegrationTest.checkLimitQuery -- > Time elapsed: 0.043 s <<< ERROR!{}}}{{{}java.util.ServiceConfigurationError: > org.apache.commons.dbutils.ColumnHandler: module org.apache.commons.dbutils > does not declare `uses`{}}}{{ at > java.base/java.util.ServiceLoader.fail(ServiceLoader.java:589)}}{{ at > java.base/java.util.ServiceLoader.checkCaller(ServiceLoader.java:575)}}{{ > at java.base/java.util.ServiceLoader.(ServiceLoader.java:504)}}{{ > at java.base/java.util.ServiceLoader.load(ServiceLoader.java:1692)}}{{ > at > org.apache.commons.dbutils@1.8.0/org.apache.commons.dbutils.BeanProcessor.(BeanProcessor.java:83)}}{{ > at > org.apache.commons.dbutils@1.8.0/org.apache.commons.dbutils.BasicRowProcessor.(BasicRowProcessor.java:135)}}{{ > at > org.apache.commons.dbutils@1.8.0/org.apache.commons.dbutils.handlers.ArrayHandler.(ArrayHandler.java:40)}}{{ > at > org.apache.commons.dbutils@1.8.0/org.apache.commons.dbutils.handlers.MapListHandler.(MapListHandler.java:45)}}{{ > at > nl.b3p.jdbc.util@15.3-SNAPSHOT/nl.b3p.jdbc.util.converter.LimitSqlOracleIntegrationTest.checkLimitQuery(LimitSqlOracleIntegrationTest.java:68)}}{{ > at java.base/java.lang.reflect.Method.invoke(Method.java:566)}}{{ > at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)}}{{ > at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)}} > {{{}[ERROR] > nl.b3p.jdbc.util.converter.LimitSqlOracleIntegrationTest.checkLimitQueryOracle11 > -- Time elapsed: 0.029 s <<< ERROR!{}}}{{{}java.lang.NoClassDefFoundError: > Could not initialize class > org.apache.commons.dbutils.handlers.ArrayHandler{}}}{{ at > org.apache.commons.dbutils@1.8.0/org.apache.commons.dbutils.handlers.MapListHandler.(MapListHandler.java:45)}}{{ > at > nl.b3p.jdbc.util@15.3-SNAPSHOT/nl.b3p.jdbc.util.converter.LimitSqlOracleIntegrationTest.checkLimitQueryOracle11(LimitSqlOracleIntegrationTest.java:99)}}{{ > at java.base/java.lang.reflect.Method.invoke(Method.java:566)}}{{ > at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)}}{{ > at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)}} > > > eg > [https://github.com/B3Partners/jdbc-util/actions/runs/5808228462/job/15774473973#step:8:247] > on PR: https://github.com/B3Partners/jdbc-util/pull/478 -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (CSV-310) Misleading error message when QuoteMode set to None
[ https://issues.apache.org/jira/browse/CSV-310?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17762381#comment-17762381 ] Buddhi De Silva commented on CSV-310: - Please see the related PR: [https://github.com/apache/commons-csv/pull/352] > Misleading error message when QuoteMode set to None > --- > > Key: CSV-310 > URL: https://issues.apache.org/jira/browse/CSV-310 > Project: Commons CSV > Issue Type: Improvement > Components: Parser >Affects Versions: 1.10.0 >Reporter: Buddhi De Silva >Priority: Minor > Labels: easy-fix, formatter, > > When we try to print CSV content using the _CSVFormat_ and {_}CSVPrinter{_}, > we can ger it done with following sample code. > {code:java} > public void testHappyPath() throws IOException { > CSVFormat csvFormat = CSVFormat.DEFAULT.builder() > .setHeader("Col1", "Col2", "Col3", "Col4") > .setQuoteMode(QuoteMode.NONE) > .setEscape('#') > .build(); CSVPrinter printer = new CSVPrinter(System.out, > csvFormat); List temp = new ArrayList<>(); temp.add(new > String[] { "rec1", "rec2\"", "", "rec4" }); > temp.add(new String[] { "", "rec6", "rec7", "rec8" }); for (String[] > temp1 : temp) { > printer.printRecord(temp1); > } > printer.close(); > } {code} > In above sample I have used 'setQuoteMode(QuoteMode.NONE)'. However, if we do > not set the escape character using 'setEscape('#')' then it would result in > following exception. > {code:java} > java.lang.IllegalArgumentException: No quotes mode set but no escape > character is set. {code} > At first, I was wondering why I was getting this error. Then I looked into > the source and figured out that _CSVFormat.printWithEscapes()_ method > internaly using _getEscapeCharacter().charValue()_ method to print records. > > However, the error message which we are getting is sort of misleading. It > implies that the code has not set any quote mode even though we set it. > Simple and more meaningful exception message could be: "Quote mode set to > NONE but no escape character is set". -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Updated] (DBUTILS-151) Module org.apache.commons.dbutils does not declare `uses`
[ https://issues.apache.org/jira/browse/DBUTILS-151?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Gary D. Gregory updated DBUTILS-151: Summary: Module org.apache.commons.dbutils does not declare `uses` (was: module org.apache.commons.dbutils does not declare `uses`) > Module org.apache.commons.dbutils does not declare `uses` > - > > Key: DBUTILS-151 > URL: https://issues.apache.org/jira/browse/DBUTILS-151 > Project: Commons DbUtils > Issue Type: Bug >Affects Versions: 1.8.0 > Environment: openjdk version "11.0.20" 2023-07-18 / Maven 3.9.4 >Reporter: mark >Priority: Major > > On upgrading an existing project from 1.7 (using "auto-module") to 1.8.0 I'm > seeing ServiceConfigurationError errors in some testcases that point to the > newly added module configuration/module-info.class (which btw does not appear > to be in the change list and not in the source code) > > {{{}[ERROR] Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: > 0.076 s <<< FAILURE! -- in > nl.b3p.jdbc.util.converter.LimitSqlOracleIntegrationTest{}}}{{{}[ERROR] > nl.b3p.jdbc.util.converter.LimitSqlOracleIntegrationTest.checkLimitQuery -- > Time elapsed: 0.043 s <<< ERROR!{}}}{{{}java.util.ServiceConfigurationError: > org.apache.commons.dbutils.ColumnHandler: module org.apache.commons.dbutils > does not declare `uses`{}}}{{ at > java.base/java.util.ServiceLoader.fail(ServiceLoader.java:589)}}{{ at > java.base/java.util.ServiceLoader.checkCaller(ServiceLoader.java:575)}}{{ > at java.base/java.util.ServiceLoader.(ServiceLoader.java:504)}}{{ > at java.base/java.util.ServiceLoader.load(ServiceLoader.java:1692)}}{{ > at > org.apache.commons.dbutils@1.8.0/org.apache.commons.dbutils.BeanProcessor.(BeanProcessor.java:83)}}{{ > at > org.apache.commons.dbutils@1.8.0/org.apache.commons.dbutils.BasicRowProcessor.(BasicRowProcessor.java:135)}}{{ > at > org.apache.commons.dbutils@1.8.0/org.apache.commons.dbutils.handlers.ArrayHandler.(ArrayHandler.java:40)}}{{ > at > org.apache.commons.dbutils@1.8.0/org.apache.commons.dbutils.handlers.MapListHandler.(MapListHandler.java:45)}}{{ > at > nl.b3p.jdbc.util@15.3-SNAPSHOT/nl.b3p.jdbc.util.converter.LimitSqlOracleIntegrationTest.checkLimitQuery(LimitSqlOracleIntegrationTest.java:68)}}{{ > at java.base/java.lang.reflect.Method.invoke(Method.java:566)}}{{ > at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)}}{{ > at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)}} > {{{}[ERROR] > nl.b3p.jdbc.util.converter.LimitSqlOracleIntegrationTest.checkLimitQueryOracle11 > -- Time elapsed: 0.029 s <<< ERROR!{}}}{{{}java.lang.NoClassDefFoundError: > Could not initialize class > org.apache.commons.dbutils.handlers.ArrayHandler{}}}{{ at > org.apache.commons.dbutils@1.8.0/org.apache.commons.dbutils.handlers.MapListHandler.(MapListHandler.java:45)}}{{ > at > nl.b3p.jdbc.util@15.3-SNAPSHOT/nl.b3p.jdbc.util.converter.LimitSqlOracleIntegrationTest.checkLimitQueryOracle11(LimitSqlOracleIntegrationTest.java:99)}}{{ > at java.base/java.lang.reflect.Method.invoke(Method.java:566)}}{{ > at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)}}{{ > at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)}} > > > eg > [https://github.com/B3Partners/jdbc-util/actions/runs/5808228462/job/15774473973#step:8:247] > on PR: https://github.com/B3Partners/jdbc-util/pull/478 -- This message was sent by Atlassian Jira (v8.20.10#820010)
[GitHub] [commons-csv] gbidsilva opened a new pull request, #352: [CSV-310] Changing the exception message to be more meaningful
gbidsilva opened a new pull request, #352: URL: https://github.com/apache/commons-csv/pull/352 See related Jira issue: https://issues.apache.org/jira/browse/CSV-310 When we try to print CSV content using the `CSVFormat` and `CSVPrinter`, we can ger it done with following sample code. ``` public void testHappyPath() throws IOException { CSVFormat csvFormat = CSVFormat.DEFAULT.builder() .setHeader("Col1", "Col2", "Col3", "Col4") .setQuoteMode(QuoteMode.NONE) .setEscape('#') .build(); CSVPrinter printer = new CSVPrinter(System.out, csvFormat); List temp = new ArrayList<>(); temp.add(new String[] { "rec1", "rec2\"", "", "rec4" }); temp.add(new String[] { "", "rec6", "rec7", "rec8" }); for (String[] temp1 : temp) { printer.printRecord(temp1); } printer.close(); } ``` In above sample I have used `setQuoteMode(QuoteMode.NONE)`. However, if we do not set the escape character using `setEscape('#')` then it would result in following exception. `java.lang.IllegalArgumentException: No quotes mode set but no escape character is set.` At first, I was wondering why I was getting this error. Then I looked into the source and figured out that `CSVFormat.printWithEscapes()` method internally using `getEscapeCharacter().charValue()` method to print records. However, the error message which we are getting is sort of misleading. It implies that the code has not set any quote mode even though we set it. Simple and more meaningful exception message could be: `Quote mode set to NONE but no escape character is set`. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@commons.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[jira] [Updated] (CSV-310) Misleading error message when QuoteMode set to None
[ https://issues.apache.org/jira/browse/CSV-310?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Buddhi De Silva updated CSV-310: Description: When we try to print CSV content using the _CSVFormat_ and {_}CSVPrinter{_}, we can ger it done with following sample code. {code:java} public void testHappyPath() throws IOException { CSVFormat csvFormat = CSVFormat.DEFAULT.builder() .setHeader("Col1", "Col2", "Col3", "Col4") .setQuoteMode(QuoteMode.NONE) .setEscape('#') .build(); CSVPrinter printer = new CSVPrinter(System.out, csvFormat); List temp = new ArrayList<>(); temp.add(new String[] { "rec1", "rec2\"", "", "rec4" }); temp.add(new String[] { "", "rec6", "rec7", "rec8" }); for (String[] temp1 : temp) { printer.printRecord(temp1); } printer.close(); } {code} In above sample I have used 'setQuoteMode(QuoteMode.NONE)'. However, if we do not set the escape character using 'setEscape('#')' then it would result in following exception. {code:java} java.lang.IllegalArgumentException: No quotes mode set but no escape character is set. {code} At first, I was wondering why I was getting this error. Then I looked into the source and figured out that _CSVFormat.printWithEscapes()_ method internaly using _getEscapeCharacter().charValue()_ method to print records. However, the error message which we are getting is sort of misleading. It implies that the code has not set any quote mode even though we set it. Simple and more meaningful exception message could be: "Quote mode set to NONE but no escape character is set". was: When we try to print CSV content using the _CSVFormat_ and {_}CSVPrinter{_}, we can ger it done with following sample code. {code:java} public void testHappyPath() throws IOException { CSVFormat csvFormat = CSVFormat.DEFAULT.builder() .setHeader("Col1", "Col2", "Col3", "Col4") .setQuoteMode(QuoteMode.NONE) .setEscape('#') .build(); CSVPrinter printer = new CSVPrinter(System.out, csvFormat); List temp = new ArrayList<>(); temp.add(new String[] { "rec1", "rec2\"", "", "rec4" }); temp.add(new String[] { "", "rec6", "rec7", "rec8" }); for (String[] temp1 : temp) { printer.printRecord(temp1); } printer.close(); } {code} In above sample I have used 'setQuoteMode(QuoteMode.NONE)'. However, if we do not set the escape character using 'setEscape('#')' then it would result in following exception. {code:java} java.lang.IllegalArgumentException: No quotes mode set but no escape character is set. {code} At first, I was wondering why I was getting this error. Then I looked into the source and figured out that _CSVFormat.printWithEscapes()_ method internaly using _getEscapeCharacter().charValue()_ method to print records. However, the error message which we are getting is sort of misleading. It implies that the code has not set any quote mode even though we set it. Simple and more meaningful exception message could be: "Quote mode set to NONE but no escape character is set". > Misleading error message when QuoteMode set to None > --- > > Key: CSV-310 > URL: https://issues.apache.org/jira/browse/CSV-310 > Project: Commons CSV > Issue Type: Improvement > Components: Parser >Affects Versions: 1.10.0 >Reporter: Buddhi De Silva >Priority: Minor > Labels: easy-fix, formatter, > > When we try to print CSV content using the _CSVFormat_ and {_}CSVPrinter{_}, > we can ger it done with following sample code. > {code:java} > public void testHappyPath() throws IOException { > CSVFormat csvFormat = CSVFormat.DEFAULT.builder() > .setHeader("Col1", "Col2", "Col3", "Col4") > .setQuoteMode(QuoteMode.NONE) > .setEscape('#') > .build(); CSVPrinter printer = new CSVPrinter(System.out, > csvFormat); List temp = new ArrayList<>(); temp.add(new > String[] { "rec1", "rec2\"", "", "rec4" }); > temp.add(new String[] { "", "rec6", "rec7", "rec8" }); for (String[] > temp1 : temp) { > printer.printRecord(temp1); > } > printer.close(); > } {code} > In above sample I have used 'setQuoteMode(QuoteMode.NONE)'. However, if we do > not set the escape character using 'setEscape('#')' then it would result in > following exception. > {code:java} > java.lang.IllegalArgumentException: No quotes mode set but no escape > character is set. {code} > At first, I was wondering why I was getting this error. Then I looked into > the source and figured out that _CSVFormat.printWithEscapes()_ method > internaly using _getEscapeCharacter().charValue()_ method to print records. > > However, the error message which we are getting is sort of misleading. It >
[jira] [Created] (CSV-310) Misleading error message when QuoteMode set to None
Buddhi De Silva created CSV-310: --- Summary: Misleading error message when QuoteMode set to None Key: CSV-310 URL: https://issues.apache.org/jira/browse/CSV-310 Project: Commons CSV Issue Type: Improvement Components: Parser Affects Versions: 1.10.0 Reporter: Buddhi De Silva When we try to print CSV content using the _CSVFormat_ and {_}CSVPrinter{_}, we can ger it done with following sample code. {code:java} public void testHappyPath() throws IOException { CSVFormat csvFormat = CSVFormat.DEFAULT.builder() .setHeader("Col1", "Col2", "Col3", "Col4") .setQuoteMode(QuoteMode.NONE) .setEscape('#') .build(); CSVPrinter printer = new CSVPrinter(System.out, csvFormat); List temp = new ArrayList<>(); temp.add(new String[] { "rec1", "rec2\"", "", "rec4" }); temp.add(new String[] { "", "rec6", "rec7", "rec8" }); for (String[] temp1 : temp) { printer.printRecord(temp1); } printer.close(); } {code} In above sample I have used 'setQuoteMode(QuoteMode.NONE)'. However, if we do not set the escape character using 'setEscape('#')' then it would result in following exception. {code:java} java.lang.IllegalArgumentException: No quotes mode set but no escape character is set. {code} At first, I was wondering why I was getting this error. Then I looked into the source and figured out that _CSVFormat.printWithEscapes()_ method internaly using _getEscapeCharacter().charValue()_ method to print records. However, the error message which we are getting is sort of misleading. It implies that the code has not set any quote mode even though we set it. Simple and more meaningful exception message could be: "Quote mode set to NONE but no escape character is set". -- This message was sent by Atlassian Jira (v8.20.10#820010)
[GitHub] [commons-bcel] garydgregory commented on a diff in pull request #221: Fix for type.getType(...) use on non-signature type names
garydgregory commented on code in PR #221: URL: https://github.com/apache/commons-bcel/pull/221#discussion_r1317176598 ## src/main/java/org/apache/bcel/generic/Type.java: ## @@ -365,6 +366,24 @@ public int hashCode() { return type ^ signature.hashCode(); } +static String internalTypeNameToSignature(final String internalTypeName) { +if (StringUtils.isEmpty(internalTypeName) || StringUtils.equalsAny(internalTypeName, "B", "C", "D", "F", "I", "J", "S", "Z")) { +return internalTypeName; Review Comment: Sometime this week... -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@commons.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [commons-bcel] Jeeppler commented on a diff in pull request #221: Fix for type.getType(...) use on non-signature type names
Jeeppler commented on code in PR #221: URL: https://github.com/apache/commons-bcel/pull/221#discussion_r1317173715 ## src/main/java/org/apache/bcel/generic/Type.java: ## @@ -365,6 +366,24 @@ public int hashCode() { return type ^ signature.hashCode(); } +static String internalTypeNameToSignature(final String internalTypeName) { +if (StringUtils.isEmpty(internalTypeName) || StringUtils.equalsAny(internalTypeName, "B", "C", "D", "F", "I", "J", "S", "Z")) { +return internalTypeName; Review Comment: @garydgregory any chance you can have a look at it? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@commons.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[jira] [Commented] (IMAGING-316) Support the BigTIFF file format
[ https://issues.apache.org/jira/browse/IMAGING-316?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17762356#comment-17762356 ] Gary Lucas commented on IMAGING-316: I requested and received permission from Joris Van Damme (of AWare Systems) to include the sample BigTIFF files I mentioned in the Commons Imaging distribution under the test resources files. These samples are a set of 8 BigTIFF files and one conventional TIFF file provided for reference purposes. The files are relatively small, making the whole collection come in at 158 KB (the "big" refers to the 64-bit address space, not the actual size of the files). This collection exercises all of the core functions that are affected by the 64-bit address space and will provide a solid basis for JUnit tests. I will, of course, include a proper citation and grateful acknowledgement of the data source in a README.TXT file. To learn more about BigTIFF, visit Mr. Van Damme's page at [https://www.awaresystems.be/imaging/tiff/bigtiff.html] > Support the BigTIFF file format > --- > > Key: IMAGING-316 > URL: https://issues.apache.org/jira/browse/IMAGING-316 > Project: Commons Imaging > Issue Type: New Feature >Affects Versions: 1.x >Reporter: Gary Lucas >Priority: Major > > Traditional TIFF files address file position in bytes using 32-bit integers. > This approach automatically limits the maximum size of a TIFF file to 4 GB. > The BigTIFF specification (formalized in 2011) uses 64-bit integers to > address file positions, and thus supports much larger files. I propose that > a future release of Commons Imaging would benefit from supporting BigTIFF. > The level of effort for this implementation may be large. > In terms of creating JUnit tests to support this effort, note that just > because a file uses the BigTIFF specification doesn't mean that the file has > to be super large. It should be possible to create BigTIFF test files that > are only a few kilobytes. Thus supporting BigTIFF does not necessarily mean > that massive files will need to be included in the Commons Imaging > distribution. > Finally, it is reasonable to ask if anyone would actually need images that > were so large that they couldn't fit within 4 GB. The short answer is that > some folks in the Geographic Information Systems (GIS) community do work with > images (or data sets) that large and, also, that some systems produce images > in BigTIFF format even when ordinary TIFF would suffice. > > P.S. It might be work investigating whether the existing Imaging library > actually supports the full 32-bit address space of a conventional TIFF. > Regrettably, Java doesn't support unsigned integer types. And it is > possible that a file address with the high bit set might be incorrectly > interpreted as a negative number. So I will be taking a look at the code to > make sure all file addresses are properly masked when they are handed over to > Java. > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (VALIDATOR-490) [DomainValidator] Add local to LOCAL_TLDs
[ https://issues.apache.org/jira/browse/VALIDATOR-490?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17762350#comment-17762350 ] Michael Osipov commented on VALIDATOR-490: -- Looking at k8s documentation and these two issues (https://github.com/kubernetes/kubernetes/issues/82381, https://github.com/kubernetes/kubernetes/issues/115300) I consider their DNS setup and ill-designed and a total abuse of mDNS names which exists for 10 years now. I am inclined, just like [~ggregory], to close this one out. > [DomainValidator] Add local to LOCAL_TLDs > -- > > Key: VALIDATOR-490 > URL: https://issues.apache.org/jira/browse/VALIDATOR-490 > Project: Commons Validator > Issue Type: Improvement >Affects Versions: 1.7 >Reporter: Jon Krehling >Priority: Minor > > I am looking to have .local added to the list of LOCAL_TLDs > [https://www.iana.org/assignments/special-use-domain-names/special-use-domain-names.xhtml] > It seems odd to have .localhost and not .local and by default every service > in kubernetes will end with .local > https://github.com/apache/commons-validator/blob/master/src/main/java/org/apache/commons/validator/routines/DomainValidator.java#L2002 > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Comment Edited] (VALIDATOR-490) [DomainValidator] Add local to LOCAL_TLDs
[ https://issues.apache.org/jira/browse/VALIDATOR-490?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17762191#comment-17762191 ] Michael Osipov edited comment on VALIDATOR-490 at 9/6/23 7:26 AM: -- The kube dns pod should provide it so from the containers/application perspective it does not resolve with mDNS. Since its containerized and the container is agnostic to the actual server its running on I suppose it doesn't have to mean local in the same way localhost does. {noformat} nslookup testapp Server: 172.20.0.10 Address:172.20.0.10#53 Name: testapp.default.svc.cluster.local Address: 172.20.152.235 {noformat} was (Author: JIRAUSER302131): The kube dns pod should provide it so from the containers/application perspective it does not resolve with mDNS. Since its containerized and the container is agnostic to the actual server its running on I suppose it doesn't have to mean local in the same way localhost does. {code:java} nslookup testapp Server: 172.20.0.10 Address:172.20.0.10#53 Name: testapp.default.svc.cluster.local Address: 172.20.152.235 {code} > [DomainValidator] Add local to LOCAL_TLDs > -- > > Key: VALIDATOR-490 > URL: https://issues.apache.org/jira/browse/VALIDATOR-490 > Project: Commons Validator > Issue Type: Improvement >Affects Versions: 1.7 >Reporter: Jon Krehling >Priority: Minor > > I am looking to have .local added to the list of LOCAL_TLDs > [https://www.iana.org/assignments/special-use-domain-names/special-use-domain-names.xhtml] > It seems odd to have .localhost and not .local and by default every service > in kubernetes will end with .local > https://github.com/apache/commons-validator/blob/master/src/main/java/org/apache/commons/validator/routines/DomainValidator.java#L2002 > -- This message was sent by Atlassian Jira (v8.20.10#820010)