mirror of https://github.com/apache/cloudstack.git
=Further fix to ETag
This commit is contained in:
parent
d4e81ab525
commit
b5d43dcbf9
|
|
@ -24,8 +24,13 @@ import org.hibernate.Session;
|
|||
import com.cloud.bridge.util.QueryHelper;
|
||||
|
||||
/**
|
||||
* @author Kelven Yang
|
||||
* @author Kelven Yang, John Zucker
|
||||
* Provide methods for getting, saving, deleting or updating state per session or, in a given session, returnin a List in
|
||||
* response to queryEntities for a particular instantation of the EntityDao generic class, as defined here.
|
||||
* Any instantation of EntityDao passes in the class for which it is instantiating. For example a new instance of SBucketDao
|
||||
* passes in com.cloud.bridge.model.SBucket as its clazz.
|
||||
*/
|
||||
|
||||
public class EntityDao<T> {
|
||||
private Class<?> clazz;
|
||||
|
||||
|
|
|
|||
|
|
@ -428,7 +428,7 @@ public class MultipartLoadDao {
|
|||
|
||||
parts[i] = new S3MultipartPart();
|
||||
parts[i].setPartNumber( rs.getInt( "partNumber" ));
|
||||
parts[i].setEtag( rs.getString( "MD5" ));
|
||||
parts[i].setEtag( rs.getString( "MD5" ).toLowerCase());
|
||||
parts[i].setLastModified( tod );
|
||||
parts[i].setSize( rs.getInt( "StoredSize" ));
|
||||
parts[i].setPath( rs.getString( "StoredPath" ));
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ import com.cloud.bridge.util.StringHelper;
|
|||
import com.cloud.bridge.util.Tuple;
|
||||
|
||||
/**
|
||||
* @author Kelven Yang
|
||||
* @author Kelven Yang, John Zucker
|
||||
*/
|
||||
public class S3FileSystemBucketAdapter implements S3BucketAdapter {
|
||||
protected final static Logger logger = Logger.getLogger(S3FileSystemBucketAdapter.class);
|
||||
|
|
@ -105,7 +105,7 @@ public class S3FileSystemBucketAdapter implements S3BucketAdapter {
|
|||
fos.write(buffer, 0, len);
|
||||
md5.update(buffer, 0, len);
|
||||
}
|
||||
return StringHelper.toHexString(md5.digest());
|
||||
return StringHelper.toHexStringLowerCase(md5.digest());
|
||||
|
||||
}
|
||||
catch(IOException e) {
|
||||
|
|
|
|||
|
|
@ -19,13 +19,17 @@ import java.io.IOException;
|
|||
import java.io.InputStream;
|
||||
|
||||
/**
|
||||
* @author Kelven
|
||||
* @author Kelven, John Zucker
|
||||
* Provide converters for regexp (case independent tokens)
|
||||
* Also provide upper case (default) or lower case converters for hex
|
||||
*/
|
||||
public class StringHelper {
|
||||
public static final String EMPTY_STRING = "";
|
||||
|
||||
private static final char[] hexChars = { '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F' };
|
||||
|
||||
private static final char[] hexCharsLowerCase = { '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F' };
|
||||
|
||||
public static String toHexString(byte[] b) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
for (int i = 0; i < b.length; i++) {
|
||||
|
|
@ -35,6 +39,15 @@ public class StringHelper {
|
|||
return sb.toString();
|
||||
}
|
||||
|
||||
public static String toHexStringLowerCase(byte[] b) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
for (int i = 0; i < b.length; i++) {
|
||||
sb.append(hexCharsLowerCase[ (int)(((int)b[i] >> 4) & 0x0f)]);
|
||||
sb.append(hexCharsLowerCase[ (int)(((int)b[i]) & 0x0f)]);
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static String substringInBetween(String name,
|
||||
String prefix, String delimiter) {
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue