Merge pull request #13 from bsinno/remove-ununsed-methods

Remove unused methods
This commit is contained in:
Michael Hirsch
2016-01-28 12:12:13 +01:00
12 changed files with 76 additions and 97 deletions

View File

@@ -20,10 +20,11 @@ import feign.RequestLine;
/** /**
* Client binding for the Distribution resource of the management API. * Client binding for the Distribution resource of the management API.
*/ */
@FunctionalInterface
public interface DistributionSetResource { public interface DistributionSetResource {
/** /**
* Creates a list of distrbution sets. * Creates a list of distribution sets.
* *
* @param sets * @param sets
* the request body java bean containing the necessary attributes * the request body java bean containing the necessary attributes

View File

@@ -51,7 +51,7 @@ public class MongoConfiguration extends AbstractMongoConfiguration {
@Autowired(required = false) @Autowired(required = false)
private MongoClientOptions options; private MongoClientOptions options;
private Mongo mongo; private Mongo mongoConnection;
@Override @Override
public String getDatabaseName() { public String getDatabaseName() {
@@ -59,12 +59,12 @@ public class MongoConfiguration extends AbstractMongoConfiguration {
} }
/** /**
* Closes mongo client when destroyd. * Closes mongo client when destroyed.
*/ */
@PreDestroy @PreDestroy
public void close() { public void close() {
if (this.mongo != null) { if (this.mongoConnection != null) {
this.mongo.close(); this.mongoConnection.close();
} }
} }
@@ -76,14 +76,14 @@ public class MongoConfiguration extends AbstractMongoConfiguration {
if (properties.getPort() != null) { if (properties.getPort() != null) {
LOG.debug("Create mongo by properties (host: {}, port: {})", uri.getHosts().get(0), properties.getPort()); LOG.debug("Create mongo by properties (host: {}, port: {})", uri.getHosts().get(0), properties.getPort());
this.mongo = new MongoClient(Arrays.asList(new ServerAddress(uri.getHosts().get(0), properties.getPort())), this.mongoConnection = new MongoClient(
uri.getOptions()); Arrays.asList(new ServerAddress(uri.getHosts().get(0), properties.getPort())), uri.getOptions());
} else { } else {
LOG.debug("Create mongo by URI : {}", uri); LOG.debug("Create mongo by URI : {}", uri);
this.mongo = new MongoClient(uri); this.mongoConnection = new MongoClient(uri);
} }
return this.mongo; return this.mongoConnection;
} }
/* /*

View File

@@ -288,7 +288,7 @@ public class Action extends BaseEntity implements Comparable<Action> {
* @see java.lang.Object#hashCode() * @see java.lang.Object#hashCode()
*/ */
@Override @Override
public int hashCode() { public int hashCode() { // NOSONAR - as this is generated
final int prime = 31; final int prime = 31;
int result = super.hashCode(); int result = super.hashCode();
result = prime * result + ((actionType == null) ? 0 : actionType.hashCode()); result = prime * result + ((actionType == null) ? 0 : actionType.hashCode());
@@ -306,7 +306,7 @@ public class Action extends BaseEntity implements Comparable<Action> {
*/ */
@Override @Override
public boolean equals(final Object obj) { // NOSONAR - as this is generated public boolean equals(final Object obj) { // NOSONAR - as this is generated
// code
if (this == obj) { if (this == obj) {
return true; return true;
} }

View File

@@ -88,7 +88,7 @@ public class DistributionSetTag extends Tag {
* @see java.lang.Object#equals(java.lang.Object) * @see java.lang.Object#equals(java.lang.Object)
*/ */
@Override @Override
public boolean equals(final Object obj) { public boolean equals(final Object obj) { // NOSONAR - as this is generated
if (this == obj) { if (this == obj) {
return true; return true;
} }

View File

@@ -133,7 +133,7 @@ public class ExternalArtifact extends Artifact {
* @see java.lang.Object#hashCode() * @see java.lang.Object#hashCode()
*/ */
@Override @Override
public int hashCode() { public int hashCode() { // NOSONAR - as this is generated
final int prime = 31; final int prime = 31;
int result = super.hashCode(); int result = super.hashCode();
result = prime * result + this.getClass().getName().hashCode(); result = prime * result + this.getClass().getName().hashCode();
@@ -146,7 +146,7 @@ public class ExternalArtifact extends Artifact {
* @see java.lang.Object#equals(java.lang.Object) * @see java.lang.Object#equals(java.lang.Object)
*/ */
@Override @Override
public boolean equals(final Object obj) { public boolean equals(final Object obj) { // NOSONAR - as this is generated
if (this == obj) { if (this == obj) {
return true; return true;
} }

View File

@@ -96,7 +96,7 @@ public class ExternalArtifactProvider extends NamedEntity {
* @see java.lang.Object#hashCode() * @see java.lang.Object#hashCode()
*/ */
@Override @Override
public int hashCode() { public int hashCode() { // NOSONAR - as this is generated
final int prime = 31; final int prime = 31;
int result = super.hashCode(); int result = super.hashCode();
result = prime * result + this.getClass().getName().hashCode(); result = prime * result + this.getClass().getName().hashCode();
@@ -109,7 +109,7 @@ public class ExternalArtifactProvider extends NamedEntity {
* @see java.lang.Object#equals(java.lang.Object) * @see java.lang.Object#equals(java.lang.Object)
*/ */
@Override @Override
public boolean equals(final Object obj) { public boolean equals(final Object obj) { // NOSONAR - as this is generated
if (this == obj) { if (this == obj) {
return true; return true;
} }

View File

@@ -79,7 +79,7 @@ public class LocalArtifact extends Artifact {
* @see java.lang.Object#hashCode() * @see java.lang.Object#hashCode()
*/ */
@Override @Override
public int hashCode() { public int hashCode() { // NOSONAR - as this is generated
final int prime = 31; final int prime = 31;
int result = super.hashCode(); int result = super.hashCode();
result = prime * result + this.getClass().getName().hashCode(); result = prime * result + this.getClass().getName().hashCode();
@@ -92,7 +92,7 @@ public class LocalArtifact extends Artifact {
* @see java.lang.Object#equals(java.lang.Object) * @see java.lang.Object#equals(java.lang.Object)
*/ */
@Override @Override
public boolean equals(final Object obj) { public boolean equals(final Object obj) { // NOSONAR - as this is generated
if (this == obj) { if (this == obj) {
return true; return true;
} }

View File

@@ -257,7 +257,7 @@ public class SoftwareModule extends NamedVersionedEntity {
* @see java.lang.Object#hashCode() * @see java.lang.Object#hashCode()
*/ */
@Override @Override
public int hashCode() { public int hashCode() { // NOSONAR - as this is generated
final int prime = 31; final int prime = 31;
int result = super.hashCode(); int result = super.hashCode();
result = prime * result + this.getClass().getName().hashCode(); result = prime * result + this.getClass().getName().hashCode();
@@ -270,7 +270,7 @@ public class SoftwareModule extends NamedVersionedEntity {
* @see java.lang.Object#equals(java.lang.Object) * @see java.lang.Object#equals(java.lang.Object)
*/ */
@Override @Override
public boolean equals(final Object obj) { public boolean equals(final Object obj) { // NOSONAR - as this is generated
if (this == obj) { if (this == obj) {
return true; return true;
} }

View File

@@ -32,6 +32,7 @@ import com.vaadin.spring.boot.internal.VaadinServletConfigurationProperties;
@Import(VaadinServletConfiguration.class) @Import(VaadinServletConfiguration.class)
public class AsyncVaadinServletConfiguration extends VaadinServletConfiguration { public class AsyncVaadinServletConfiguration extends VaadinServletConfiguration {
@Override
@Bean @Bean
protected ServletRegistrationBean vaadinServletRegistration() { protected ServletRegistrationBean vaadinServletRegistration() {
return createServletRegistrationBean(); return createServletRegistrationBean();

View File

@@ -174,7 +174,7 @@ public class CustomFile implements Serializable {
* @see java.lang.Object#hashCode() * @see java.lang.Object#hashCode()
*/ */
@Override @Override
public int hashCode() { public int hashCode() { // NOSONAR - as this is generated
final int prime = 31; final int prime = 31;
int result = 1; int result = 1;
result = prime * result + (fileName == null ? 0 : fileName.hashCode()); result = prime * result + (fileName == null ? 0 : fileName.hashCode());

View File

@@ -8,9 +8,6 @@
*/ */
package org.eclipse.hawkbit.ui.management.dstable; package org.eclipse.hawkbit.ui.management.dstable;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
@@ -39,8 +36,6 @@ import com.google.common.base.Strings;
* Simple implementation of generics bean query which dynamically loads a batch * Simple implementation of generics bean query which dynamically loads a batch
* of beans. * of beans.
* *
*
*
*/ */
public class DistributionBeanQuery extends AbstractBeanQuery<ProxyDistribution> { public class DistributionBeanQuery extends AbstractBeanQuery<ProxyDistribution> {
@@ -93,7 +88,8 @@ public class DistributionBeanQuery extends AbstractBeanQuery<ProxyDistribution>
/** /**
* Load all the Distribution set. * Load all the Distribution set.
* *
* @parm startIndex as page start * @param startIndex
* as page start
* @param count * @param count
* as total data * as total data
*/ */
@@ -193,15 +189,4 @@ public class DistributionBeanQuery extends AbstractBeanQuery<ProxyDistribution>
return distributionSetManagement; return distributionSetManagement;
} }
private void writeObject(final ObjectOutputStream out) throws IOException {
out.defaultWriteObject();
out.writeObject(firstPageDistributionSets);
}
@SuppressWarnings("unchecked")
private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
firstPageDistributionSets = (Page<DistributionSet>) in.readObject();
}
} }

View File

@@ -14,6 +14,7 @@ import java.io.FileInputStream;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.io.OutputStream; import java.io.OutputStream;
import java.nio.charset.Charset; import java.nio.charset.Charset;
@@ -63,14 +64,12 @@ import com.vaadin.ui.Upload.SucceededListener;
/** /**
* Bulk target upload handler. * Bulk target upload handler.
* *
*
*
*/ */
public class BulkUploadHandler extends CustomComponent public class BulkUploadHandler extends CustomComponent
implements SucceededListener, FailedListener, Receiver, StartedListener { implements SucceededListener, FailedListener, Receiver, StartedListener {
/** /**
* * *
*/ */
private static final long serialVersionUID = -1273494705754674501L; private static final long serialVersionUID = -1273494705754674501L;
private static final Logger LOG = LoggerFactory.getLogger(BulkUploadHandler.class); private static final Logger LOG = LoggerFactory.getLogger(BulkUploadHandler.class);
@@ -208,15 +207,18 @@ public class BulkUploadHandler extends CustomComponent
@Override @Override
public void run() { public void run() {
BufferedReader reader = null;
long innerCounter = 0; long innerCounter = 0;
String line; String line;
if (tempFile != null) { if (tempFile == null) {
try { return;
}
try (InputStream tempStream = new FileInputStream(tempFile)) {
try (BufferedReader reader = new BufferedReader(
new InputStreamReader(tempStream, Charset.defaultCharset()))) {
LOG.info("Bulk file upload started"); LOG.info("Bulk file upload started");
final double totalFileSize = getTotalNumberOfLines(); final double totalFileSize = getTotalNumberOfLines();
reader = new BufferedReader(
new InputStreamReader(new FileInputStream(tempFile), Charset.defaultCharset()));
/** /**
* Once control is in upload succeeded method automatically * Once control is in upload succeeded method automatically
* upload button is re-enabled. To disable the button firing * upload button is re-enabled. To disable the button firing
@@ -232,21 +234,16 @@ public class BulkUploadHandler extends CustomComponent
// Clearing after assignments are done // Clearing after assignments are done
managementUIState.getTargetTableFilters().getBulkUpload().getTargetsCreated().clear(); managementUIState.getTargetTableFilters().getBulkUpload().getTargetsCreated().clear();
} catch (final FileNotFoundException e) {
LOG.error("File not found with name {}", tempFile.getName(), e);
} catch (final IOException e) { } catch (final IOException e) {
LOG.error("Error reading file {}", tempFile.getName(), e); LOG.error("Error reading file {}", tempFile.getName(), e);
} finally { } finally {
try { resetCounts();
if (null != reader) { deleteFile();
reader.close();
resetCounts();
deleteFile();
}
} catch (final IOException e) {
LOG.error("Error while reading file ", e);
}
} }
} catch (final FileNotFoundException e) {
LOG.error("Temporary file not found with name {}", tempFile.getName(), e);
} catch (final IOException e) {
LOG.error("Error while opening temorary file ", e);
} }
} }
@@ -307,24 +304,19 @@ public class BulkUploadHandler extends CustomComponent
} }
private double getTotalNumberOfLines() { private double getTotalNumberOfLines() {
InputStreamReader inputStreamReader;
BufferedReader readerForSize = null;
double totalFileSize = 0; double totalFileSize = 0;
try { try (InputStreamReader inputStreamReader = new InputStreamReader(new FileInputStream(tempFile),
inputStreamReader = new InputStreamReader(new FileInputStream(tempFile), Charset.defaultCharset()); Charset.defaultCharset())) {
readerForSize = new BufferedReader(inputStreamReader); try (BufferedReader readerForSize = new BufferedReader(inputStreamReader)) {
totalFileSize = readerForSize.lines().count(); totalFileSize = readerForSize.lines().count();
}
} catch (final FileNotFoundException e) { } catch (final FileNotFoundException e) {
LOG.error("Error reading file {}", tempFile.getName(), e); LOG.error("Error reading file {}", tempFile.getName(), e);
} finally { } catch (final IOException e) {
if (readerForSize != null) { LOG.error("Error while closing reader of file {}", tempFile.getName(), e);
try {
readerForSize.close();
} catch (final IOException e) {
LOG.error("Error while closing reader of file {}", tempFile.getName(), e);
}
}
} }
return totalFileSize; return totalFileSize;
} }