This is an automated email from the ASF dual-hosted git repository. neilcsmith pushed a commit to branch delivery in repository https://gitbox.apache.org/repos/asf/netbeans.git
The following commit(s) were added to refs/heads/delivery by this push: new 51e3aa8 Ensure BufferedInputStream is not initialized with a buffer size of 0 new a42b661 Merge pull request #3491 from matthiasblaesing/error_multiline_search 51e3aa8 is described below commit 51e3aa851ff1e0b9351529f64c4307dbd1aca2e4 Author: Matthias Bläsing <mblaes...@doppel-helix.eu> AuthorDate: Sat Jan 22 22:00:09 2022 +0100 Ensure BufferedInputStream is not initialized with a buffer size of 0 With an empty file the BufferedCharSequence fails to be initialized: java.lang.IllegalArgumentException: Buffer size <= 0 at java.base/java.io.BufferedInputStream.<init>(BufferedInputStream.java:207) at org.netbeans.modules.search.matcher.BufferedCharSequence$Source.initStreams(BufferedCharSequence.java:562) Caused: java.io.IOException Caused: org.netbeans.modules.search.matcher.BufferedCharSequence$SourceIOException at org.netbeans.modules.search.matcher.BufferedCharSequence$Source.initStreams(BufferedCharSequence.java:570) at org.netbeans.modules.search.matcher.BufferedCharSequence$Source.<init>(BufferedCharSequence.java:494) at org.netbeans.modules.search.matcher.BufferedCharSequence.<init>(BufferedCharSequence.java:145) [catch] at org.netbeans.modules.search.matcher.MultiLineStreamMatcher.checkMeasuredInternal(MultiLineStreamMatcher.java:84) at org.netbeans.modules.search.matcher.AbstractMatcher.check(AbstractMatcher.java:53) at org.netbeans.modules.search.matcher.DefaultMatcher.checkMeasuredInternal(DefaultMatcher.java:93) at org.netbeans.modules.search.matcher.AbstractMatcher.check(AbstractMatcher.java:53) at org.netbeans.modules.search.BasicComposition.start(BasicComposition.java:78) at org.netbeans.modules.search.SearchTask.run(SearchTask.java:93) at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1418) at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:45) at org.openide.util.lookup.Lookups.executeWith(Lookups.java:278) at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2033) So ensure, that at least a 1 byte buffer is used. --- .../src/org/netbeans/modules/search/matcher/BufferedCharSequence.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/api.search/src/org/netbeans/modules/search/matcher/BufferedCharSequence.java b/platform/api.search/src/org/netbeans/modules/search/matcher/BufferedCharSequence.java index af4417d..b819579 100644 --- a/platform/api.search/src/org/netbeans/modules/search/matcher/BufferedCharSequence.java +++ b/platform/api.search/src/org/netbeans/modules/search/matcher/BufferedCharSequence.java @@ -559,7 +559,7 @@ public class BufferedCharSequence implements CharSequence { try { istream = fo.getInputStream(); try { - bstream = new BufferedInputStream(istream, bufferSize); + bstream = new BufferedInputStream(istream, Math.max(1, bufferSize)); } catch (Throwable t) { if (istream != null) { istream.close(); --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@netbeans.apache.org For additional commands, e-mail: commits-h...@netbeans.apache.org For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists