Résultats CPD
Le document suivant contient les résultats de l'inspection CPD CPD 6.13.0.
Duplicatas
Fichier |
Ligne |
fr/paris/lutece/plugins/stock/utils/MultiPartFormOutputStream.java |
296 |
fr/paris/lutece/plugins/stock/utils/MultiPartFormOutputStream.java |
363 |
throw new IllegalArgumentException( "Input stream cannot be null." );
}
if ( fileName == null || fileName.length( ) == 0 )
{
throw new IllegalArgumentException( "File name cannot be null or empty." );
}
Calendar cal = Calendar.getInstance( );
String uUID = String.valueOf( cal.get( Calendar.YEAR ) ) + String.valueOf( cal.get( Calendar.MONTH ) )
+ String.valueOf( cal.get( Calendar.DAY_OF_MONTH ) ) + String.valueOf( cal.get( Calendar.HOUR_OF_DAY ) )
+ String.valueOf( cal.get( Calendar.MINUTE ) ) + String.valueOf( cal.get( Calendar.SECOND ) );
/*
* --boundary\r\n Content-Disposition: form-data; name="<fieldName>"; filename="<filename>"\r\n Content-Type: <mime-type>\r\n \r\n <file-data>\r\n
*/
// write boundary
_out.writeBytes( PREFIX );
_out.writeBytes( _boundary );
_out.writeBytes( NEWLINE );
// write content header
_out.writeBytes( "Content-Disposition: form-data; name=\"" + name + "\"; filename=\"" + uUID + "_" + fileName + "\"" );
_out.writeBytes( NEWLINE );
if ( mimeType != null )
{
_out.writeBytes( "Content-Type: " + mimeType );
_out.writeBytes( NEWLINE );
}
_out.writeBytes( NEWLINE ); |
Fichier |
Ligne |
fr/paris/lutece/plugins/stock/utils/MapConverter.java |
47 |
fr/paris/lutece/plugins/stock/utils/TimestampConverter.java |
47 |
public class MapConverter implements Converter
{
/**
* Méthode permettant de convertir une date d'un type à l'autre
*
* @param type
* Type de la date passée en paramètre Les types suivants peuvent être précisés : - {@link String} - {@link Timestamp} - {@link Date} -
* {@link Calendar}
* @param value
* date à convertir en {@link Timestamp}
* @return une date de type {@link Timestamp} ou null en cas d'erreur
*/
public Object convert( Class type, Object value ) throws ConversionException
{
if ( value != null )
{
// Support Calendar and Timestamp conversion
if ( value instanceof String )
{
if ( !( (String) value ).trim( ).equals( "" ) )
{
Timestamp date = DateUtils.getDate( (String) value, true );
if ( date == null )
{
TimestampValidation timestampValidation = new TimestampValidation( (String) value );
timestampValidation.setIdTypeError( TimestampValidation.ERROR_DATE_FORMAT );
return timestampValidation;
}
return date;
}
}
if ( value instanceof Timestamp )
{
return value;
}
else
if ( value instanceof Date )
{
return new Timestamp( ( (Date) value ).getTime( ) );
}
else
if ( value instanceof Calendar )
{
return new Timestamp( ( (Calendar) value ).getTime( ).getTime( ) );
}
}
return null;
}
} |
Fichier |
Ligne |
fr/paris/lutece/plugins/stock/utils/DateUtils.java |
101 |
fr/paris/lutece/plugins/stock/utils/DateUtils.java |
226 |
Calendar caldate = new GregorianCalendar( );
caldate.setTime( date );
caldate.set( Calendar.MILLISECOND, 0 );
caldate.set( Calendar.SECOND, 0 );
if ( isStartOfDayHour )
{
caldate.set( Calendar.HOUR_OF_DAY, caldate.getActualMinimum( Calendar.HOUR_OF_DAY ) );
caldate.set( Calendar.MINUTE, caldate.getActualMinimum( Calendar.MINUTE ) );
}
else
{
caldate.set( Calendar.HOUR_OF_DAY, caldate.getActualMaximum( Calendar.HOUR_OF_DAY ) );
caldate.set( Calendar.MINUTE, caldate.getActualMaximum( Calendar.MINUTE ) );
caldate.set( Calendar.SECOND, caldate.getActualMaximum( Calendar.SECOND ) );
}
Timestamp timeStamp = new Timestamp( caldate.getTimeInMillis( ) );
return timeStamp;
}
/**
* Renvoie la date sous le format défini par strPattern
*
* @param date
* la date
* @param strPattern
* le format souhaite de la date
* @return la date sous forme EEEE dd MMMM yyyy
*/
public static String getDate( Timestamp date, String strPattern ) |