Skip to content

Commit

Permalink
Remove unused code and exception declarations (apache#5461)
Browse files Browse the repository at this point in the history
* Remove unused code and exception declarations

* Address comments

* Remove redundant Exception declarations

* Make FirehoseFactoryV2.connect() to throw IOException again
  • Loading branch information
leventov authored Mar 16, 2018
1 parent afa2520 commit 693e357
Show file tree
Hide file tree
Showing 758 changed files with 2,116 additions and 6,291 deletions.
1 change: 1 addition & 0 deletions .idea/inspectionProfiles/Druid.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 16 additions & 8 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/scopes/UnusedInspectionsScope.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions api/src/main/java/io/druid/data/input/FirehoseFactoryV2.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import io.druid.java.util.common.parsers.ParseException;

import java.io.IOException;

/**
* Initialization method that connects up the FirehoseV2. If this method returns successfully it should be safe to
* call start() on the returned FirehoseV2 (which might subsequently block).
Expand All @@ -41,5 +42,10 @@
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type")
public interface FirehoseFactoryV2<T extends InputRowParser>
{
/**
* This method is declared to throw {@link IOException}, although it's not thrown in the implementations in Druid
* code, for compatibility with third-party extensions.
*/
@SuppressWarnings("RedundantThrows")
FirehoseV2 connect(T parser, Object lastCommit) throws IOException, ParseException;
}
2 changes: 1 addition & 1 deletion api/src/main/java/io/druid/data/input/FirehoseV2.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public interface FirehoseV2 extends Closeable
/**
* For initial start
*/
void start() throws Exception;
void start();

/**
* Advance the firehose to the next offset. Implementations of this interface should make sure that
Expand Down
5 changes: 0 additions & 5 deletions api/src/main/java/io/druid/guice/Binders.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import io.druid.segment.loading.DataSegmentFinder;
import io.druid.segment.loading.DataSegmentKiller;
import io.druid.segment.loading.DataSegmentMover;
import io.druid.segment.loading.DataSegmentPuller;
import io.druid.segment.loading.DataSegmentPusher;
import io.druid.tasklogs.TaskLogs;

Expand All @@ -36,10 +35,6 @@
@PublicApi
public class Binders
{
public static MapBinder<String, DataSegmentPuller> dataSegmentPullerBinder(Binder binder)
{
return MapBinder.newMapBinder(binder, String.class, DataSegmentPuller.class);
}

public static MapBinder<String, DataSegmentKiller> dataSegmentKillerBinder(Binder binder)
{
Expand Down
42 changes: 0 additions & 42 deletions api/src/main/java/io/druid/segment/loading/DataSegmentPuller.java

This file was deleted.

9 changes: 4 additions & 5 deletions api/src/main/java/io/druid/tasklogs/NoopTaskLogs.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,32 +24,31 @@
import io.druid.java.util.common.logger.Logger;

import java.io.File;
import java.io.IOException;

public class NoopTaskLogs implements TaskLogs
{
private final Logger log = new Logger(TaskLogs.class);

@Override
public Optional<ByteSource> streamTaskLog(String taskid, long offset) throws IOException
public Optional<ByteSource> streamTaskLog(String taskid, long offset)
{
return Optional.absent();
}

@Override
public void pushTaskLog(String taskid, File logFile) throws IOException
public void pushTaskLog(String taskid, File logFile)
{
log.info("Not pushing logs for task: %s", taskid);
}

@Override
public void killAll() throws IOException
public void killAll()
{
log.info("Noop: No task logs are deleted.");
}

@Override
public void killOlderThan(long timestamp) throws IOException
public void killOlderThan(long timestamp)
{
log.info("Noop: No task logs are deleted.");
}
Expand Down
2 changes: 1 addition & 1 deletion api/src/main/java/io/druid/utils/CompressionUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public static void unzip(InputStream in, File outDir) throws IOException
* @throws IOException on propogated IO exception, IAE if it cannot determine the proper new name for `pulledFile`
*/
@Deprecated // See description for alternative
public static void gunzip(File pulledFile, File outDir) throws IOException
public static void gunzip(File pulledFile, File outDir)
{
final File outFile = new File(outDir, io.druid.java.util.common.CompressionUtils.getGzBaseName(pulledFile.getName()));
io.druid.java.util.common.CompressionUtils.gunzip(pulledFile, outFile);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
public class CSVParseSpecTest
{
@Test(expected = IllegalArgumentException.class)
public void testColumnMissing() throws Exception
public void testColumnMissing()
{
@SuppressWarnings("unused") // expected exception
final ParseSpec spec = new CSVParseSpec(
Expand All @@ -50,7 +50,7 @@ public void testColumnMissing() throws Exception
}

@Test(expected = IllegalArgumentException.class)
public void testComma() throws Exception
public void testComma()
{
@SuppressWarnings("unused") // expected exception
final ParseSpec spec = new CSVParseSpec(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public void testSerde() throws IOException
}

@Test(expected = IllegalArgumentException.class)
public void testColumnMissing() throws Exception
public void testColumnMissing()
{
@SuppressWarnings("unused") // expected exception
final ParseSpec spec = new DelimitedParseSpec(
Expand All @@ -82,7 +82,7 @@ public void testColumnMissing() throws Exception
}

@Test(expected = IllegalArgumentException.class)
public void testComma() throws Exception
public void testComma()
{
@SuppressWarnings("unused") // expected exception
final ParseSpec spec = new DelimitedParseSpec(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
public class FileIteratingFirehoseTest
{
@Parameters(name = "{0}, {1}")
public static Collection<Object[]> constructorFeeder() throws IOException
public static Collection<Object[]> constructorFeeder()
{
final List<List<String>> inputTexts = ImmutableList.of(
ImmutableList.of("2000,foo"),
Expand Down Expand Up @@ -133,14 +133,14 @@ public void testClose() throws IOException
final LineIterator lineIterator = new LineIterator(new Reader()
{
@Override
public int read(char[] cbuf, int off, int len) throws IOException
public int read(char[] cbuf, int off, int len)
{
System.arraycopy(LINE_CHARS, 0, cbuf, 0, LINE_CHARS.length);
return LINE_CHARS.length;
}

@Override
public void close() throws IOException
public void close()
{
throw new RuntimeException("close test for FileIteratingFirehose");
}
Expand All @@ -162,7 +162,7 @@ private static final class TestCloseable implements Closeable
private boolean closed;

@Override
public void close() throws IOException
public void close()
{
closed = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
public class JSONLowercaseParseSpecTest
{
@Test
public void testLowercasing() throws Exception
public void testLowercasing()
{
JSONLowercaseParseSpec spec = new JSONLowercaseParseSpec(
new TimestampSpec(
Expand Down
10 changes: 5 additions & 5 deletions api/src/test/java/io/druid/data/input/impl/ParseSpecTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class ParseSpecTest
public ExpectedException expectedException = ExpectedException.none();

@Test(expected = ParseException.class)
public void testDuplicateNames() throws Exception
public void testDuplicateNames()
{
@SuppressWarnings("unused") // expected exception
final ParseSpec spec = new DelimitedParseSpec(
Expand All @@ -57,7 +57,7 @@ public void testDuplicateNames() throws Exception
}

@Test(expected = IllegalArgumentException.class)
public void testDimAndDimExcluOverlap() throws Exception
public void testDimAndDimExcluOverlap()
{
@SuppressWarnings("unused") // expected exception
final ParseSpec spec = new DelimitedParseSpec(
Expand All @@ -80,7 +80,7 @@ public void testDimAndDimExcluOverlap() throws Exception
}

@Test
public void testDimExclusionDuplicate() throws Exception
public void testDimExclusionDuplicate()
{
@SuppressWarnings("unused") // expected exception
final ParseSpec spec = new DelimitedParseSpec(
Expand All @@ -103,7 +103,7 @@ public void testDimExclusionDuplicate() throws Exception
}

@Test
public void testDefaultTimestampSpec() throws Exception
public void testDefaultTimestampSpec()
{
expectedException.expect(NullPointerException.class);
expectedException.expectMessage("parseSpec requires timestampSpec");
Expand All @@ -124,7 +124,7 @@ public void testDefaultTimestampSpec() throws Exception
}

@Test
public void testDimensionSpecRequired() throws Exception
public void testDimensionSpecRequired()
{
expectedException.expect(NullPointerException.class);
expectedException.expectMessage("parseSpec requires dimensionSpec");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
public class TimestampSpecTest
{
@Test
public void testExtractTimestamp() throws Exception
public void testExtractTimestamp()
{
TimestampSpec spec = new TimestampSpec("TIMEstamp", "yyyy-MM-dd", null);
Assert.assertEquals(
Expand All @@ -39,7 +39,7 @@ public void testExtractTimestamp() throws Exception
}

@Test
public void testExtractTimestampWithMissingTimestampColumn() throws Exception
public void testExtractTimestampWithMissingTimestampColumn()
{
TimestampSpec spec = new TimestampSpec(null, null, DateTimes.EPOCH);
Assert.assertEquals(
Expand All @@ -49,7 +49,7 @@ public void testExtractTimestampWithMissingTimestampColumn() throws Exception
}

@Test
public void testContextualTimestampList() throws Exception
public void testContextualTimestampList()
{
String DATE_FORMAT = "yyyy-MM-dd'T'HH:mm:ss";
String[] dates = new String[]{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ protected InputStream openObjectStream(File object) throws IOException
}

@Override
protected InputStream wrapObjectStream(File object, InputStream stream) throws IOException
protected InputStream wrapObjectStream(File object, InputStream stream)
{
return stream;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public class ConditionalMultibindTest
private Properties props;

@Before
public void setUp() throws Exception
public void setUp()
{
props = new Properties();
}
Expand Down
2 changes: 1 addition & 1 deletion api/src/test/java/io/druid/guice/JsonConfiguratorTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public void testTest()
}

@Test
public void testsimpleConfigurate() throws Exception
public void testsimpleConfigurate()
{
final JsonConfigurator configurator = new JsonConfigurator(mapper, validator);
properties.setProperty(PROP_PREFIX + "prop1", "prop1");
Expand Down
4 changes: 2 additions & 2 deletions api/src/test/java/io/druid/guice/PolyBindTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class PolyBindTest
private Properties props;
private Injector injector;

public void setUp(Module... modules) throws Exception
public void setUp(Module... modules)
{
props = new Properties();
injector = Guice.createInjector(
Expand All @@ -66,7 +66,7 @@ public void configure(Binder binder)
}

@Test
public void testSanity() throws Exception
public void testSanity()
{
setUp(
new Module()
Expand Down
Loading

0 comments on commit 693e357

Please sign in to comment.