From 17609bc347e11117de0e0644209eeae3bf18a1ff Mon Sep 17 00:00:00 2001 From: Nils Schwabe Date: Fri, 11 Jul 2014 16:29:22 +0200 Subject: Fix some todos (new errors, ...) --- .../openslx/imagemaster/crcchecker/CRCChecker.java | 98 +++++++++--------- .../openslx/imagemaster/crcchecker/CRCFile.java | 38 +++++-- .../openslx/imagemaster/crcchecker/ImageFile.java | 58 ++++++----- .../thrift/iface/AuthenticationException.java | 2 +- .../thrift/iface/AuthorizationException.java | 2 +- .../imagemaster/thrift/iface/DownloadInfos.java | 2 +- .../imagemaster/thrift/iface/FtpCredentials.java | 2 +- .../imagemaster/thrift/iface/ImageData.java | 2 +- .../thrift/iface/ImageDataException.java | 2 +- .../imagemaster/thrift/iface/ImageServer.java | 2 +- .../thrift/iface/InvalidTokenException.java | 2 +- .../thrift/iface/ServerAuthenticationError.java | 5 +- .../iface/ServerAuthenticationException.java | 2 +- .../thrift/iface/ServerSessionData.java | 2 +- .../imagemaster/thrift/iface/SessionData.java | 2 +- .../imagemaster/thrift/iface/UploadException.java | 112 ++++++++++----------- .../imagemaster/thrift/iface/UploadInfos.java | 2 +- .../openslx/imagemaster/thrift/iface/UserInfo.java | 2 +- 18 files changed, 186 insertions(+), 151 deletions(-) (limited to 'src/main/java/org/openslx/imagemaster') diff --git a/src/main/java/org/openslx/imagemaster/crcchecker/CRCChecker.java b/src/main/java/org/openslx/imagemaster/crcchecker/CRCChecker.java index 753809d..b7f288e 100644 --- a/src/main/java/org/openslx/imagemaster/crcchecker/CRCChecker.java +++ b/src/main/java/org/openslx/imagemaster/crcchecker/CRCChecker.java @@ -1,75 +1,79 @@ package org.openslx.imagemaster.crcchecker; import java.io.IOException; -import java.util.LinkedList; -import java.util.List; import java.util.zip.CRC32; -import org.apache.log4j.Logger; - public class CRCChecker { - - private static Logger log = Logger.getLogger( CRCChecker.class ); private static final int blockSize = 16 * 1024 * 1024; + private ImageFile imageFile; + private CRCFile crcFile; + + private byte[] block = new byte[ blockSize ]; // array that is used to read the blocks + /** - * Checks the CRC sum of given blocks of a given imageFile against a given crcFile. - * The caller needs to make sure that block that are going to be checked are complete! + * Initialize a crc checker with an image file and a crc file. * - * @param imageFile The imageFile to check - * @param crcFile The crcFile to check against - * @param blocks The blocks to check - * @return List of blocks where the crc matches, or null if the crc file is corrupted - * @throws IOException When crc file could not be read + * @param imageFile The image file to check + * @param crcFile The crc file to check against */ - public static List checkCRC( String imageFile, String crcFile, List blocks ) throws IOException + public CRCChecker( String imageFilename, String crcFilename ) { - List result = new LinkedList<>(); + this.imageFile = new ImageFile( imageFilename, blockSize ); + } - ImageFile image = new ImageFile( imageFile, blockSize ); - CRCFile crc = new CRCFile( crcFile ); + public void done() + { + imageFile.close(); + } - log.debug( "Checking image file: '" + imageFile + "' with crc file: '" + crcFile + "'" ); + public boolean hasValidCrcFile() + { try { - if ( !crc.isValid() ) - return null; - // TODO: also return null if the crc file contains the wrong number of checksums (only makes sense if the upload is complete) + return crcFile.isValid(); } catch ( IOException e ) { - throw new IOException( "Could not read CRC file", e ); + return false; } + } - // check all blocks - byte[] block = new byte[blockSize]; - for ( Integer blockN : blocks ) { - try { - image.getBlock( blockN, block ); - } catch ( IOException e ) { - throw new IOException( "Could not read image file", e ); - } + /** + * Checks a chosen block against the crc file. + * + * @param block The block to check + * @return Whether the block was valid or not + * @throws IOException When image or crc file could not be read. + */ + public boolean checkBlock( int blockNumber ) throws IOException + { + if ( !this.hasValidCrcFile() ) + return false; - if ( block == null ) - continue; // some error occured (for example: someone tried to check a block that is not in the file) + int length; + try { + length = imageFile.getBlock( blockNumber, block ); + } catch ( IOException e ) { + throw new IOException( "Could not read image file", e ); + } - // check this block with CRC32 - // add this block to result, if check was ok with CRC file + if ( length <= 0 ) + return false; - CRC32 crcCalc = new CRC32(); + CRC32 crcCalc = new CRC32(); + if ( length == blockSize ) { crcCalc.update( block ); - int crcSum = Integer.reverseBytes( (int)crcCalc.getValue() ); - int crcSumFromFile; - try { - crcSumFromFile = crc.getCRCSum( blockN ); - } catch ( IOException e ) { - throw new IOException( "Could not read CRC file", e ); - } + } else { + crcCalc.update( block, 0, length ); + } - if ( crcSum == crcSumFromFile ) - result.add( blockN ); - else - log.debug( blockN + " was invalid" ); + int crcSum = Integer.reverseBytes( (int)crcCalc.getValue() ); + int crcSumFromFile; + try { + crcSumFromFile = crcFile.getCRCSum( blockNumber ); + } catch ( IOException e ) { + throw new IOException( "Could not read CRC file", e ); } - return result; + return ( crcSum == crcSumFromFile ); } } diff --git a/src/main/java/org/openslx/imagemaster/crcchecker/CRCFile.java b/src/main/java/org/openslx/imagemaster/crcchecker/CRCFile.java index 49c909d..7d059fc 100644 --- a/src/main/java/org/openslx/imagemaster/crcchecker/CRCFile.java +++ b/src/main/java/org/openslx/imagemaster/crcchecker/CRCFile.java @@ -11,10 +11,7 @@ import java.util.List; import java.util.zip.CRC32; /** - * Represents a crcfile - * - * @author nils - * + * Represents a crc file */ public class CRCFile { @@ -46,13 +43,30 @@ public class CRCFile DataOutputStream dos = new DataOutputStream( fos ); for ( Integer sum : listOfCrcSums ) { - dos.writeInt( Integer.reverseBytes( sum.intValue() ) ); // save byte-reversed integers to match right order in crc file + dos.writeInt( sum.intValue() ); // save byte-reversed integers to match right order in crc file TODO: is that right? } dos.close(); return new CRCFile( filename ); } + /** + * Checks if given sums are valid. + * @param listOfCrcSums + * @return + */ + public static boolean sumsAreValid( List listOfCrcSums ) + { + byte[] bytes = new byte[ ( listOfCrcSums.size() - 1 ) * Integer.SIZE / 8 ]; + int masterSum = listOfCrcSums.remove( 0 ); + for ( int i = 0; i < bytes.length; i++ ) { + bytes[i] = listOfCrcSums.remove( 0 ).byteValue(); + } + CRC32 crcCalc = new CRC32(); + crcCalc.update( bytes ); + return ( masterSum == Integer.reverseBytes( (int)crcCalc.getValue() ) ); + } + /** * Checks if this crc file is valid. * (If the crc over the file is equal to the first crc sum.) @@ -90,7 +104,8 @@ public class CRCFile */ public int getCRCSum( int blockNumber ) throws IOException { - if (crcSums == null) loadSums(); + if ( crcSums == null ) + loadSums(); if ( blockNumber < 0 ) return 0; @@ -99,17 +114,20 @@ public class CRCFile return crcSums.get( blockNumber ); } - + /** * Returns the loaded crcSums. + * * @return The loaded crcSums * @throws IOException If the crcSums could not be loaded from file */ - public List getCrcSums() throws IOException { - if (crcSums == null) loadSums(); + public List getCrcSums() throws IOException + { + if ( crcSums == null ) + loadSums(); return this.crcSums; } - + private void loadSums() throws IOException { // the crcSums were not read yet diff --git a/src/main/java/org/openslx/imagemaster/crcchecker/ImageFile.java b/src/main/java/org/openslx/imagemaster/crcchecker/ImageFile.java index cb8c700..13bb0fd 100644 --- a/src/main/java/org/openslx/imagemaster/crcchecker/ImageFile.java +++ b/src/main/java/org/openslx/imagemaster/crcchecker/ImageFile.java @@ -7,51 +7,61 @@ import java.io.RandomAccessFile; /** * Representing an image file. * Is able to return certain blocks of this file. + * * @author nils - * + * */ public class ImageFile { private File f; private RandomAccessFile file = null; private int blockSize; - - public ImageFile(String filename, int blockSize) { + + public ImageFile( String filename, int blockSize ) + { this.f = new File( filename ); this.blockSize = blockSize; } - + /** * Get a certain block (uses RandomAccessFile) * If the last block is not full an array with a smaller size is set * and the actual number of bytes is returned. + * * @param block The number of the block you want to get - * @return The actual size of the array or 0 if the block number is < 0 or the block is not in the file + * @return The actual number of read bytes or -1 if nothing was read. * @throws IOException When file was not found or could not be read */ - public int getBlock(int block, byte[] array) throws IOException { - if (block < 0) return 0; - if (block > f.length()/blockSize) return 0; - - if (file == null) { + public int getBlock( int block, byte[] array ) throws IOException + { + if ( block < 0 ) + return 0; + if ( block > f.length() / blockSize ) + return 0; + + if ( file == null ) { file = new RandomAccessFile( f, "r" ); } - + file.seek( (long)block * blockSize ); - long remaining = length() - (block * blockSize); - if (blockSize > remaining) { - array = new byte[(int)remaining]; // only read available bytes - file.read( array ); - return (int)remaining; // return actual size of array - } else { - // size of array is ok, read the full array and return block size - file.read( array ); - return this.blockSize; - } + return file.read( array ); } - - public long length() { + + public long length() + { return f.length(); } -} \ No newline at end of file + + /** + * Closes the file. + * It's not a problem to use getBlock() again. The file will then be re-opened. + */ + public void close() + { + try { + file.close(); + file = null; + } catch ( IOException e ) {/* Can't do anything about it.*/} + } +} diff --git a/src/main/java/org/openslx/imagemaster/thrift/iface/AuthenticationException.java b/src/main/java/org/openslx/imagemaster/thrift/iface/AuthenticationException.java index 44ca1fe..692b58a 100644 --- a/src/main/java/org/openslx/imagemaster/thrift/iface/AuthenticationException.java +++ b/src/main/java/org/openslx/imagemaster/thrift/iface/AuthenticationException.java @@ -34,7 +34,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) -@Generated(value = "Autogenerated by Thrift Compiler (1.0.0-dev)", date = "2014-7-10") +@Generated(value = "Autogenerated by Thrift Compiler (1.0.0-dev)", date = "2014-7-11") public class AuthenticationException extends TException implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("AuthenticationException"); diff --git a/src/main/java/org/openslx/imagemaster/thrift/iface/AuthorizationException.java b/src/main/java/org/openslx/imagemaster/thrift/iface/AuthorizationException.java index d0b6b29..43f5ec7 100644 --- a/src/main/java/org/openslx/imagemaster/thrift/iface/AuthorizationException.java +++ b/src/main/java/org/openslx/imagemaster/thrift/iface/AuthorizationException.java @@ -34,7 +34,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) -@Generated(value = "Autogenerated by Thrift Compiler (1.0.0-dev)", date = "2014-7-10") +@Generated(value = "Autogenerated by Thrift Compiler (1.0.0-dev)", date = "2014-7-11") public class AuthorizationException extends TException implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("AuthorizationException"); diff --git a/src/main/java/org/openslx/imagemaster/thrift/iface/DownloadInfos.java b/src/main/java/org/openslx/imagemaster/thrift/iface/DownloadInfos.java index 40a2c1d..d3022c8 100644 --- a/src/main/java/org/openslx/imagemaster/thrift/iface/DownloadInfos.java +++ b/src/main/java/org/openslx/imagemaster/thrift/iface/DownloadInfos.java @@ -34,7 +34,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) -@Generated(value = "Autogenerated by Thrift Compiler (1.0.0-dev)", date = "2014-7-10") +@Generated(value = "Autogenerated by Thrift Compiler (1.0.0-dev)", date = "2014-7-11") public class DownloadInfos implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("DownloadInfos"); diff --git a/src/main/java/org/openslx/imagemaster/thrift/iface/FtpCredentials.java b/src/main/java/org/openslx/imagemaster/thrift/iface/FtpCredentials.java index a9619ff..07dbd41 100644 --- a/src/main/java/org/openslx/imagemaster/thrift/iface/FtpCredentials.java +++ b/src/main/java/org/openslx/imagemaster/thrift/iface/FtpCredentials.java @@ -34,7 +34,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) -@Generated(value = "Autogenerated by Thrift Compiler (1.0.0-dev)", date = "2014-7-10") +@Generated(value = "Autogenerated by Thrift Compiler (1.0.0-dev)", date = "2014-7-11") public class FtpCredentials implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("FtpCredentials"); diff --git a/src/main/java/org/openslx/imagemaster/thrift/iface/ImageData.java b/src/main/java/org/openslx/imagemaster/thrift/iface/ImageData.java index 1159bc7..883f2c4 100644 --- a/src/main/java/org/openslx/imagemaster/thrift/iface/ImageData.java +++ b/src/main/java/org/openslx/imagemaster/thrift/iface/ImageData.java @@ -34,7 +34,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) -@Generated(value = "Autogenerated by Thrift Compiler (1.0.0-dev)", date = "2014-7-10") +@Generated(value = "Autogenerated by Thrift Compiler (1.0.0-dev)", date = "2014-7-11") public class ImageData implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ImageData"); diff --git a/src/main/java/org/openslx/imagemaster/thrift/iface/ImageDataException.java b/src/main/java/org/openslx/imagemaster/thrift/iface/ImageDataException.java index acd09d7..a440485 100644 --- a/src/main/java/org/openslx/imagemaster/thrift/iface/ImageDataException.java +++ b/src/main/java/org/openslx/imagemaster/thrift/iface/ImageDataException.java @@ -34,7 +34,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) -@Generated(value = "Autogenerated by Thrift Compiler (1.0.0-dev)", date = "2014-7-10") +@Generated(value = "Autogenerated by Thrift Compiler (1.0.0-dev)", date = "2014-7-11") public class ImageDataException extends TException implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ImageDataException"); diff --git a/src/main/java/org/openslx/imagemaster/thrift/iface/ImageServer.java b/src/main/java/org/openslx/imagemaster/thrift/iface/ImageServer.java index 7b7b56a..b79ce99 100644 --- a/src/main/java/org/openslx/imagemaster/thrift/iface/ImageServer.java +++ b/src/main/java/org/openslx/imagemaster/thrift/iface/ImageServer.java @@ -34,7 +34,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) -@Generated(value = "Autogenerated by Thrift Compiler (1.0.0-dev)", date = "2014-7-10") +@Generated(value = "Autogenerated by Thrift Compiler (1.0.0-dev)", date = "2014-7-11") public class ImageServer { public interface Iface { diff --git a/src/main/java/org/openslx/imagemaster/thrift/iface/InvalidTokenException.java b/src/main/java/org/openslx/imagemaster/thrift/iface/InvalidTokenException.java index d5dfd61..234d30a 100644 --- a/src/main/java/org/openslx/imagemaster/thrift/iface/InvalidTokenException.java +++ b/src/main/java/org/openslx/imagemaster/thrift/iface/InvalidTokenException.java @@ -34,7 +34,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) -@Generated(value = "Autogenerated by Thrift Compiler (1.0.0-dev)", date = "2014-7-10") +@Generated(value = "Autogenerated by Thrift Compiler (1.0.0-dev)", date = "2014-7-11") public class InvalidTokenException extends TException implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("InvalidTokenException"); diff --git a/src/main/java/org/openslx/imagemaster/thrift/iface/ServerAuthenticationError.java b/src/main/java/org/openslx/imagemaster/thrift/iface/ServerAuthenticationError.java index 83ba841..cd1132f 100644 --- a/src/main/java/org/openslx/imagemaster/thrift/iface/ServerAuthenticationError.java +++ b/src/main/java/org/openslx/imagemaster/thrift/iface/ServerAuthenticationError.java @@ -14,7 +14,8 @@ import org.apache.thrift.TEnum; public enum ServerAuthenticationError implements org.apache.thrift.TEnum { GENERIC_ERROR(0), INVALID_ORGANIZATION(1), - BANNED_NETWORK(2); + INVALID_KEY(2), + BANNED_NETWORK(3); private final int value; @@ -40,6 +41,8 @@ public enum ServerAuthenticationError implements org.apache.thrift.TEnum { case 1: return INVALID_ORGANIZATION; case 2: + return INVALID_KEY; + case 3: return BANNED_NETWORK; default: return null; diff --git a/src/main/java/org/openslx/imagemaster/thrift/iface/ServerAuthenticationException.java b/src/main/java/org/openslx/imagemaster/thrift/iface/ServerAuthenticationException.java index c2b9821..ca22b2d 100644 --- a/src/main/java/org/openslx/imagemaster/thrift/iface/ServerAuthenticationException.java +++ b/src/main/java/org/openslx/imagemaster/thrift/iface/ServerAuthenticationException.java @@ -34,7 +34,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) -@Generated(value = "Autogenerated by Thrift Compiler (1.0.0-dev)", date = "2014-7-10") +@Generated(value = "Autogenerated by Thrift Compiler (1.0.0-dev)", date = "2014-7-11") public class ServerAuthenticationException extends TException implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ServerAuthenticationException"); diff --git a/src/main/java/org/openslx/imagemaster/thrift/iface/ServerSessionData.java b/src/main/java/org/openslx/imagemaster/thrift/iface/ServerSessionData.java index 295dfa5..9bd5666 100644 --- a/src/main/java/org/openslx/imagemaster/thrift/iface/ServerSessionData.java +++ b/src/main/java/org/openslx/imagemaster/thrift/iface/ServerSessionData.java @@ -34,7 +34,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) -@Generated(value = "Autogenerated by Thrift Compiler (1.0.0-dev)", date = "2014-7-10") +@Generated(value = "Autogenerated by Thrift Compiler (1.0.0-dev)", date = "2014-7-11") public class ServerSessionData implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ServerSessionData"); diff --git a/src/main/java/org/openslx/imagemaster/thrift/iface/SessionData.java b/src/main/java/org/openslx/imagemaster/thrift/iface/SessionData.java index 640db68..3383787 100644 --- a/src/main/java/org/openslx/imagemaster/thrift/iface/SessionData.java +++ b/src/main/java/org/openslx/imagemaster/thrift/iface/SessionData.java @@ -34,7 +34,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) -@Generated(value = "Autogenerated by Thrift Compiler (1.0.0-dev)", date = "2014-7-10") +@Generated(value = "Autogenerated by Thrift Compiler (1.0.0-dev)", date = "2014-7-11") public class SessionData implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("SessionData"); diff --git a/src/main/java/org/openslx/imagemaster/thrift/iface/UploadException.java b/src/main/java/org/openslx/imagemaster/thrift/iface/UploadException.java index faa382a..de7a963 100644 --- a/src/main/java/org/openslx/imagemaster/thrift/iface/UploadException.java +++ b/src/main/java/org/openslx/imagemaster/thrift/iface/UploadException.java @@ -34,11 +34,11 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) -@Generated(value = "Autogenerated by Thrift Compiler (1.0.0-dev)", date = "2014-7-10") +@Generated(value = "Autogenerated by Thrift Compiler (1.0.0-dev)", date = "2014-7-11") public class UploadException extends TException implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("UploadException"); - private static final org.apache.thrift.protocol.TField NUMBERM_FIELD_DESC = new org.apache.thrift.protocol.TField("numberm", org.apache.thrift.protocol.TType.I32, (short)1); + private static final org.apache.thrift.protocol.TField NUMBER_FIELD_DESC = new org.apache.thrift.protocol.TField("number", org.apache.thrift.protocol.TType.I32, (short)1); private static final org.apache.thrift.protocol.TField MESSAGE_FIELD_DESC = new org.apache.thrift.protocol.TField("message", org.apache.thrift.protocol.TType.STRING, (short)2); private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); @@ -51,7 +51,7 @@ public class UploadException extends TException implements org.apache.thrift.TBa * * @see UploadError */ - public UploadError numberm; // required + public UploadError number; // required public String message; // required /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ @@ -60,7 +60,7 @@ public class UploadException extends TException implements org.apache.thrift.TBa * * @see UploadError */ - NUMBERM((short)1, "numberm"), + NUMBER((short)1, "number"), MESSAGE((short)2, "message"); private static final Map byName = new HashMap(); @@ -76,8 +76,8 @@ public class UploadException extends TException implements org.apache.thrift.TBa */ public static _Fields findByThriftId(int fieldId) { switch(fieldId) { - case 1: // NUMBERM - return NUMBERM; + case 1: // NUMBER + return NUMBER; case 2: // MESSAGE return MESSAGE; default: @@ -123,7 +123,7 @@ public class UploadException extends TException implements org.apache.thrift.TBa public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; static { Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put(_Fields.NUMBERM, new org.apache.thrift.meta_data.FieldMetaData("numberm", org.apache.thrift.TFieldRequirementType.DEFAULT, + tmpMap.put(_Fields.NUMBER, new org.apache.thrift.meta_data.FieldMetaData("number", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, UploadError.class))); tmpMap.put(_Fields.MESSAGE, new org.apache.thrift.meta_data.FieldMetaData("message", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); @@ -135,11 +135,11 @@ public class UploadException extends TException implements org.apache.thrift.TBa } public UploadException( - UploadError numberm, + UploadError number, String message) { this(); - this.numberm = numberm; + this.number = number; this.message = message; } @@ -147,8 +147,8 @@ public class UploadException extends TException implements org.apache.thrift.TBa * Performs a deep copy on other. */ public UploadException(UploadException other) { - if (other.isSetNumberm()) { - this.numberm = other.numberm; + if (other.isSetNumber()) { + this.number = other.number; } if (other.isSetMessage()) { this.message = other.message; @@ -161,7 +161,7 @@ public class UploadException extends TException implements org.apache.thrift.TBa @Override public void clear() { - this.numberm = null; + this.number = null; this.message = null; } @@ -169,31 +169,31 @@ public class UploadException extends TException implements org.apache.thrift.TBa * * @see UploadError */ - public UploadError getNumberm() { - return this.numberm; + public UploadError getNumber() { + return this.number; } /** * * @see UploadError */ - public UploadException setNumberm(UploadError numberm) { - this.numberm = numberm; + public UploadException setNumber(UploadError number) { + this.number = number; return this; } - public void unsetNumberm() { - this.numberm = null; + public void unsetNumber() { + this.number = null; } - /** Returns true if field numberm is set (has been assigned a value) and false otherwise */ - public boolean isSetNumberm() { - return this.numberm != null; + /** Returns true if field number is set (has been assigned a value) and false otherwise */ + public boolean isSetNumber() { + return this.number != null; } - public void setNumbermIsSet(boolean value) { + public void setNumberIsSet(boolean value) { if (!value) { - this.numberm = null; + this.number = null; } } @@ -223,11 +223,11 @@ public class UploadException extends TException implements org.apache.thrift.TBa public void setFieldValue(_Fields field, Object value) { switch (field) { - case NUMBERM: + case NUMBER: if (value == null) { - unsetNumberm(); + unsetNumber(); } else { - setNumberm((UploadError)value); + setNumber((UploadError)value); } break; @@ -244,8 +244,8 @@ public class UploadException extends TException implements org.apache.thrift.TBa public Object getFieldValue(_Fields field) { switch (field) { - case NUMBERM: - return getNumberm(); + case NUMBER: + return getNumber(); case MESSAGE: return getMessage(); @@ -261,8 +261,8 @@ public class UploadException extends TException implements org.apache.thrift.TBa } switch (field) { - case NUMBERM: - return isSetNumberm(); + case NUMBER: + return isSetNumber(); case MESSAGE: return isSetMessage(); } @@ -282,12 +282,12 @@ public class UploadException extends TException implements org.apache.thrift.TBa if (that == null) return false; - boolean this_present_numberm = true && this.isSetNumberm(); - boolean that_present_numberm = true && that.isSetNumberm(); - if (this_present_numberm || that_present_numberm) { - if (!(this_present_numberm && that_present_numberm)) + boolean this_present_number = true && this.isSetNumber(); + boolean that_present_number = true && that.isSetNumber(); + if (this_present_number || that_present_number) { + if (!(this_present_number && that_present_number)) return false; - if (!this.numberm.equals(that.numberm)) + if (!this.number.equals(that.number)) return false; } @@ -307,10 +307,10 @@ public class UploadException extends TException implements org.apache.thrift.TBa public int hashCode() { List list = new ArrayList(); - boolean present_numberm = true && (isSetNumberm()); - list.add(present_numberm); - if (present_numberm) - list.add(numberm.getValue()); + boolean present_number = true && (isSetNumber()); + list.add(present_number); + if (present_number) + list.add(number.getValue()); boolean present_message = true && (isSetMessage()); list.add(present_message); @@ -328,12 +328,12 @@ public class UploadException extends TException implements org.apache.thrift.TBa int lastComparison = 0; - lastComparison = Boolean.valueOf(isSetNumberm()).compareTo(other.isSetNumberm()); + lastComparison = Boolean.valueOf(isSetNumber()).compareTo(other.isSetNumber()); if (lastComparison != 0) { return lastComparison; } - if (isSetNumberm()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.numberm, other.numberm); + if (isSetNumber()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.number, other.number); if (lastComparison != 0) { return lastComparison; } @@ -368,11 +368,11 @@ public class UploadException extends TException implements org.apache.thrift.TBa StringBuilder sb = new StringBuilder("UploadException("); boolean first = true; - sb.append("numberm:"); - if (this.numberm == null) { + sb.append("number:"); + if (this.number == null) { sb.append("null"); } else { - sb.append(this.numberm); + sb.append(this.number); } first = false; if (!first) sb.append(", "); @@ -426,10 +426,10 @@ public class UploadException extends TException implements org.apache.thrift.TBa break; } switch (schemeField.id) { - case 1: // NUMBERM + case 1: // NUMBER if (schemeField.type == org.apache.thrift.protocol.TType.I32) { - struct.numberm = org.openslx.imagemaster.thrift.iface.UploadError.findByValue(iprot.readI32()); - struct.setNumbermIsSet(true); + struct.number = org.openslx.imagemaster.thrift.iface.UploadError.findByValue(iprot.readI32()); + struct.setNumberIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } @@ -457,9 +457,9 @@ public class UploadException extends TException implements org.apache.thrift.TBa struct.validate(); oprot.writeStructBegin(STRUCT_DESC); - if (struct.numberm != null) { - oprot.writeFieldBegin(NUMBERM_FIELD_DESC); - oprot.writeI32(struct.numberm.getValue()); + if (struct.number != null) { + oprot.writeFieldBegin(NUMBER_FIELD_DESC); + oprot.writeI32(struct.number.getValue()); oprot.writeFieldEnd(); } if (struct.message != null) { @@ -485,15 +485,15 @@ public class UploadException extends TException implements org.apache.thrift.TBa public void write(org.apache.thrift.protocol.TProtocol prot, UploadException struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; BitSet optionals = new BitSet(); - if (struct.isSetNumberm()) { + if (struct.isSetNumber()) { optionals.set(0); } if (struct.isSetMessage()) { optionals.set(1); } oprot.writeBitSet(optionals, 2); - if (struct.isSetNumberm()) { - oprot.writeI32(struct.numberm.getValue()); + if (struct.isSetNumber()) { + oprot.writeI32(struct.number.getValue()); } if (struct.isSetMessage()) { oprot.writeString(struct.message); @@ -505,8 +505,8 @@ public class UploadException extends TException implements org.apache.thrift.TBa TTupleProtocol iprot = (TTupleProtocol) prot; BitSet incoming = iprot.readBitSet(2); if (incoming.get(0)) { - struct.numberm = org.openslx.imagemaster.thrift.iface.UploadError.findByValue(iprot.readI32()); - struct.setNumbermIsSet(true); + struct.number = org.openslx.imagemaster.thrift.iface.UploadError.findByValue(iprot.readI32()); + struct.setNumberIsSet(true); } if (incoming.get(1)) { struct.message = iprot.readString(); diff --git a/src/main/java/org/openslx/imagemaster/thrift/iface/UploadInfos.java b/src/main/java/org/openslx/imagemaster/thrift/iface/UploadInfos.java index e19abe5..d52fe8e 100644 --- a/src/main/java/org/openslx/imagemaster/thrift/iface/UploadInfos.java +++ b/src/main/java/org/openslx/imagemaster/thrift/iface/UploadInfos.java @@ -34,7 +34,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) -@Generated(value = "Autogenerated by Thrift Compiler (1.0.0-dev)", date = "2014-7-10") +@Generated(value = "Autogenerated by Thrift Compiler (1.0.0-dev)", date = "2014-7-11") public class UploadInfos implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("UploadInfos"); diff --git a/src/main/java/org/openslx/imagemaster/thrift/iface/UserInfo.java b/src/main/java/org/openslx/imagemaster/thrift/iface/UserInfo.java index 9eebe41..efe59f7 100644 --- a/src/main/java/org/openslx/imagemaster/thrift/iface/UserInfo.java +++ b/src/main/java/org/openslx/imagemaster/thrift/iface/UserInfo.java @@ -34,7 +34,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) -@Generated(value = "Autogenerated by Thrift Compiler (1.0.0-dev)", date = "2014-7-10") +@Generated(value = "Autogenerated by Thrift Compiler (1.0.0-dev)", date = "2014-7-11") public class UserInfo implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("UserInfo"); -- cgit v1.2.3-55-g7522