The following document contains the results of PMD's CPD 4.2.2.
| File | Line |
|---|---|
| com/gisgraphy/domain/geoloc/service/geoloc/GeolocResultsDtoSerializer.java | 219 |
| com/gisgraphy/domain/geoloc/service/geoloc/StreetSearchResultsDtoSerializer.java | 213 |
+ gisFeatureDistance.getGid());
SyndContent description = new SyndContentImpl();
description.setType(OutputFormat.ATOM.getContentType());
description.setValue(gisFeatureDistance.getName());
entry.setDescription(description);
entries.add(entry);
}
synFeed.setEntries(entries);
try {
oWriter = new OutputStreamWriter(outputStream, Constants.CHARSET);
} catch (UnsupportedEncodingException e) {
throw new RuntimeException("unknow encoding "+Constants.CHARSET);
}
// Copy synfeed to output
SyndFeedOutput output = new SyndFeedOutput();
try {
output.output(synFeed, oWriter);
// Flush
oWriter.flush();
} catch (Exception e) {
throw new RuntimeException(e);
}
} finally {
if (oWriter != null)
try {
oWriter.close();
} catch (IOException e) {
throw new RuntimeException(e);
}
if (outputStream != null)
try {
outputStream.close();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
}
| |
| File | Line |
|---|---|
| com/gisgraphy/domain/geoloc/importer/GeonamesAdm3Importer.java | 143 |
| com/gisgraphy/domain/geoloc/importer/GeonamesAdm4Importer.java | 149 |
this.admDao.save(adm4);
}
/* (non-Javadoc)
* @see com.gisgraphy.domain.geoloc.importer.AbstractImporterProcessor#shouldBeSkiped()
*/
@Override
public boolean shouldBeSkipped() {
return !importerConfig.isGeonamesImporterEnabled();
}
/*
* (non-Javadoc)
*
* @see com.gisgraphy.domain.geoloc.importer.AbstractImporterProcessor#shouldIgnoreFirstLine()
*/
@Override
protected boolean shouldIgnoreFirstLine() {
return false;
}
/*
* (non-Javadoc)
*
* @see com.gisgraphy.domain.geoloc.importer.AbstractImporterProcessor#shouldIgnoreComments()
*/
@Override
protected boolean shouldIgnoreComments() {
return true;
}
/*
* (non-Javadoc)
*
* @see com.gisgraphy.domain.geoloc.importer.AbstractImporterProcessor#setCommitFlushMode()
*/
@Override
protected void setCommitFlushMode() {
this.admDao.setFlushMode(FlushMode.COMMIT);
}
/*
* (non-Javadoc)
*
* @see com.gisgraphy.domain.geoloc.importer.AbstractImporterProcessor#flushAndClear()
*/
@Override
protected void flushAndClear() {
this.admDao.flushAndClear();
}
/*
* (non-Javadoc)
*
* @see com.gisgraphy.domain.geoloc.importer.AbstractImporterProcessor#getNumberOfColumns()
*/
@Override
protected int getNumberOfColumns() {
return 2;
}
/**
* @param admDao
* The admDao to set
*/
@Required
public void setAdmDao(IAdmDao admDao) {
this.admDao = admDao;
}
/*
* (non-Javadoc)
*
* @see com.gisgraphy.domain.geoloc.importer.AbstractImporterProcessor#getFiles()
*/
@Override
protected File[] getFiles() {
File[] files = new File[1];
files[0] = new File(importerConfig.getGeonamesDir()
+ importerConfig.getAdm4FileName());
| |
| File | Line |
|---|---|
| com/gisgraphy/domain/geoloc/importer/GeonamesAdm1Importer.java | 104 |
| com/gisgraphy/domain/geoloc/importer/GeonamesAdm4Importer.java | 151 |
}
/* (non-Javadoc)
* @see com.gisgraphy.domain.geoloc.importer.AbstractImporterProcessor#shouldBeSkiped()
*/
@Override
public boolean shouldBeSkipped() {
return !importerConfig.isGeonamesImporterEnabled();
}
/*
* (non-Javadoc)
*
* @see com.gisgraphy.domain.geoloc.importer.AbstractImporterProcessor#shouldIgnoreFirstLine()
*/
@Override
protected boolean shouldIgnoreFirstLine() {
return false;
}
/*
* (non-Javadoc)
*
* @see com.gisgraphy.domain.geoloc.importer.AbstractImporterProcessor#shouldIgnoreComments()
*/
@Override
protected boolean shouldIgnoreComments() {
return true;
}
/*
* (non-Javadoc)
*
* @see com.gisgraphy.domain.geoloc.importer.AbstractImporterProcessor#setCommitFlushMode()
*/
@Override
protected void setCommitFlushMode() {
this.admDao.setFlushMode(FlushMode.COMMIT);
}
/*
* (non-Javadoc)
*
* @see com.gisgraphy.domain.geoloc.importer.AbstractImporterProcessor#flushAndClear()
*/
@Override
protected void flushAndClear() {
this.admDao.flushAndClear();
}
/*
* (non-Javadoc)
*
* @see com.gisgraphy.domain.geoloc.importer.AbstractImporterProcessor#getNumberOfColumns()
*/
@Override
protected int getNumberOfColumns() {
return 2;
}
/**
* @param admDao
* The admDao to set
*/
@Required
public void setAdmDao(IAdmDao admDao) {
this.admDao = admDao;
}
/*
* (non-Javadoc)
*
* @see com.gisgraphy.domain.geoloc.importer.AbstractImporterProcessor#getFiles()
*/
@Override
protected File[] getFiles() {
File[] files = new File[1];
files[0] = new File(importerConfig.getGeonamesDir()
+ importerConfig.getAdm3FileName());
| |
| File | Line |
|---|---|
| com/gisgraphy/domain/geoloc/service/geoloc/GeolocErrorVisitor.java | 50 |
| com/gisgraphy/domain/geoloc/service/geoloc/StreetSearchErrorVisitor.java | 52 |
public StreetSearchErrorVisitor(String errorMessage) {
super();
this.errorMessage = errorMessage;
}
/*
* (non-Javadoc)
*
* @see com.gisgraphy.domain.geoloc.service.errors.IoutputFormatVisitor#visitXML(com.gisgraphy.domain.valueobject.Output.OutputFormat)
*/
public String visitXML(OutputFormat format) {
return String
.format(
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><results xmlns=\"http://gisgraphy.com\"><error>%s</error><numFound>0</numFound></results>",
errorMessage);
}
/*
* (non-Javadoc)
*
* @see com.gisgraphy.domain.geoloc.service.errors.IoutputFormatVisitor#visitJSON(com.gisgraphy.domain.valueobject.Output.OutputFormat)
*/
public String visitJSON(OutputFormat format) {
return String.format("{\"numFound\":0,\"error\":\"%s\",\"result\":[]}",
errorMessage);
}
/*
* (non-Javadoc)
*
* @see com.gisgraphy.domain.geoloc.service.errors.IoutputFormatVisitor#visitPYTHON(com.gisgraphy.domain.valueobject.Output.OutputFormat)
*/
public String visitPYTHON(OutputFormat format) {
return visitXML(format);
}
/*
* (non-Javadoc)
*
* @see com.gisgraphy.domain.geoloc.service.errors.IoutputFormatVisitor#visitRUBY(com.gisgraphy.domain.valueobject.Output.OutputFormat)
*/
public String visitRUBY(OutputFormat format) {
return visitXML(format);
}
/*
* (non-Javadoc)
*
* @see com.gisgraphy.domain.geoloc.service.errors.IoutputFormatVisitor#visitPHP(com.gisgraphy.domain.valueobject.Output.OutputFormat)
*/
public String visitPHP(OutputFormat format) {
return visitXML(format);
}
/*
* (non-Javadoc)
*
* @see com.gisgraphy.domain.geoloc.service.errors.IoutputFormatVisitor#visitATOM(com.gisgraphy.domain.valueobject.Output.OutputFormat)
*/
public String visitATOM(OutputFormat outputFormat) {
return visitXML(outputFormat);
}
/*
* (non-Javadoc)
*
* @see com.gisgraphy.domain.geoloc.service.errors.IoutputFormatVisitor#visitGEORSS(com.gisgraphy.domain.valueobject.Output.OutputFormat)
*/
public String visitGEORSS(OutputFormat outputFormat) {
return visitXML(outputFormat);
}
/* (non-Javadoc)
* @see com.gisgraphy.domain.geoloc.service.errors.IoutputFormatVisitor#getErrorMessage()
*/
public String getErrorMessage() {
return errorMessage;
}
}
| |
| File | Line |
|---|---|
| com/gisgraphy/domain/geoloc/importer/AdmExtracter.java | 435 |
| com/gisgraphy/domain/geoloc/importer/GeonamesAlternateNamesExtracter.java | 296 |
}
/*
* (non-Javadoc)
*
* @see com.gisgraphy.domain.geoloc.importer.AbstractImporterProcessor#shouldIgnoreFirstLine()
*/
@Override
protected boolean shouldIgnoreFirstLine() {
return false;
}
/*
* (non-Javadoc)
*
* @see com.gisgraphy.domain.geoloc.importer.AbstractImporterProcessor#shouldIgnoreComments()
*/
@Override
protected boolean shouldIgnoreComments() {
return true;
}
/*
* (non-Javadoc)
*
* @see com.gisgraphy.domain.geoloc.importer.AbstractImporterProcessor#setCommitFlushMode()
*/
@Override
protected void setCommitFlushMode() {
return;
}
/*
* (non-Javadoc)
*
* @see com.gisgraphy.domain.geoloc.importer.AbstractImporterProcessor#flushAndClear()
*/
@Override
protected void flushAndClear() {
if (adm1fileOutputStreamWriter != null) {
try {
adm1fileOutputStreamWriter.flush();
} catch (IOException e) {
closeOutputStreams();
throw new RuntimeException("can not flush adm1file : "
+ e.getMessage(), e);
}
}
if (adm2fileOutputStreamWriter != null) {
try {
adm2fileOutputStreamWriter.flush();
} catch (IOException e) {
closeOutputStreams();
throw new RuntimeException("can not flush adm2file : "
+ e.getMessage(), e);
}
}
if (countryfileOutputStreamWriter != null) {
| |
| File | Line |
|---|---|
| com/gisgraphy/domain/geoloc/entity/City.java | 70 |
| com/gisgraphy/domain/geoloc/entity/CitySubdivision.java | 55 |
public CitySubdivision() {
super();
}
/*
* (non-Javadoc)
*
* @see com.gisgraphy.domain.geoloc.entity.GisFeature#hashCode()
*/
@Override
public int hashCode() {
final int PRIME = 31;
int result = super.hashCode();
result = PRIME * result
+ ((getFeatureId() == null) ? 0 : getFeatureId().hashCode());
return result;
}
/*
* (non-Javadoc)
*
* @see com.gisgraphy.domain.geoloc.entity.GisFeature#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!super.equals(obj)) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final CitySubdivision other = (CitySubdivision) obj;
| |
| File | Line |
|---|---|
| com/gisgraphy/domain/geoloc/importer/AdmExtracter.java | 551 |
| com/gisgraphy/domain/geoloc/importer/GeonamesAlternateNamesExtracter.java | 420 |
deleteFile(featuresFile, deletedObjectInfo);
resetStatus();
return deletedObjectInfo;
}
private void deleteFile(File file,
List<NameValueDTO<Integer>> deletedObjectInfo) {
if (file.delete()) {
deletedObjectInfo.add(new NameValueDTO<Integer>(file.getName(), 1));
logger.info("File " + file.getName() + " has been deleted");
} else {
deletedObjectInfo.add(new NameValueDTO<Integer>(file.getName(), 0));
logger.info("File " + file.getName() + " has not been deleted");
}
}
| |