mirror of
https://github.com/haraldk/TwelveMonkeys.git
synced 2025-08-05 04:25:29 -04:00
Minor servlet clean-up.
This commit is contained in:
parent
0327f5fc1a
commit
c28963ae49
@ -30,14 +30,15 @@
|
||||
|
||||
package com.twelvemonkeys.servlet.image;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.imageio.spi.IIORegistry;
|
||||
import javax.imageio.spi.ServiceRegistry;
|
||||
import javax.servlet.ServletContextEvent;
|
||||
import javax.servlet.ServletContextListener;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Takes care of registering and de-registering local ImageIO plugins (service providers) for the servlet context.
|
||||
@ -72,7 +73,7 @@ public final class IIOProviderContextListener implements ServletContextListener
|
||||
Iterator<?> providers = registry.getServiceProviders(category, localFilter, false);
|
||||
|
||||
// Copy the providers, as de-registering while iterating over providers will lead to ConcurrentModificationExceptions.
|
||||
List<Object> providersCopy = new ArrayList<Object>();
|
||||
List<Object> providersCopy = new ArrayList<>();
|
||||
while (providers.hasNext()) {
|
||||
providersCopy.add(providers.next());
|
||||
}
|
||||
|
@ -30,7 +30,12 @@
|
||||
|
||||
package com.twelvemonkeys.servlet.image;
|
||||
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import javax.imageio.ImageReader;
|
||||
import javax.imageio.spi.IIORegistry;
|
||||
@ -38,13 +43,8 @@ import javax.imageio.spi.ImageReaderSpi;
|
||||
import javax.servlet.ServletContext;
|
||||
import javax.servlet.ServletContextEvent;
|
||||
import javax.servlet.ServletContextListener;
|
||||
import java.io.IOException;
|
||||
import java.util.Locale;
|
||||
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* IIOProviderContextListenerTest
|
||||
@ -99,12 +99,12 @@ public class IIOProviderContextListenerTest {
|
||||
|
||||
private static abstract class MockImageReaderSpiBase extends ImageReaderSpi {
|
||||
@Override
|
||||
public boolean canDecodeInput(Object source) throws IOException {
|
||||
public boolean canDecodeInput(Object source) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ImageReader createReaderInstance(Object extension) throws IOException {
|
||||
public ImageReader createReaderInstance(Object extension) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user