Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug - com.google.common.collect.Iterators.limit(Iterator<FilteringMode>, int) #7316

Closed
2 tasks done
d-ferra opened this issue Jul 17, 2024 · 1 comment
Closed
2 tasks done
Labels
type=defect Bug, not working as expected

Comments

@d-ferra
Copy link

d-ferra commented Jul 17, 2024

Guava Version

33.2.1

Description

A "NullPointerException" can be generated by setting args[0]=null, but not described into the specification

Example

public class Iterators_11_failure_Test{
	public void testLimit_IllegalArgumentException_LimitSizeIsNegative() throws Throwable {
		try {
			 Iterators.limit((Iterator<Locale.FilteringMode>) null, (-14));
                         org.junit.Assert.fail();
		} catch (NullPointerException e) {
        
		}
	}
}

Expected Behavior

The code should throw an IllegalArgumentException.
Description in the JavaDoc: @throws IllegalArgumentException if {@code limitSize} is negative

Actual Behavior

The code generate a NullPointerException.

Packages

com.google.common.collect

Platforms

No response

Checklist

  • I agree to follow the code of conduct.

  • I can reproduce the bug with the latest version of Guava available.

@d-ferra d-ferra added the type=defect Bug, not working as expected label Jul 17, 2024
@cpovirk
Copy link
Member

cpovirk commented Jul 17, 2024

Similar to #7307.

@cpovirk cpovirk closed this as completed Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type=defect Bug, not working as expected
Projects
None yet
Development

No branches or pull requests

2 participants