Subversion Repositories linid-dm

Compare Revisions

Rev 345 → Rev 380

/2.0/src/main/java/org/linid/dm/wui/t5lib/components/PhotoEditor.java
14,6 → 14,7
import org.apache.tapestry5.ioc.annotations.Value;
import org.apache.tapestry5.services.Request;
import org.apache.tapestry5.upload.services.UploadedFile;
import org.linid.dm.wui.model.exception.InvalidPhotoFormatException;
import org.linid.dm.wui.t5lib.services.JpegFileFormatChecker;
 
public class PhotoEditor {
43,12 → 44,13
 
/**
* upload file
* @throws InvalidPhotoFormatException
*/
public void onSuccess()
public void onSuccess() throws InvalidPhotoFormatException
{
if(userUid!=null){
if (!checkFileFormat()) {
throw new RuntimeException("Invalid format, JPEG expected");
throw new InvalidPhotoFormatException("Invalid format, JPEG expected");
} else {
File copied = new File(photoDirectory,userUid+PHOTO_EXT);
file.write(copied);
/2.0/src/main/java/org/linid/dm/wui/model/exception/InvalidPhotoFormatException.java New file
0,0 → 1,22
package org.linid.dm.wui.model.exception;
 
public class InvalidPhotoFormatException extends Exception {
 
private static final long serialVersionUID = -4858649318595970856L;
 
public InvalidPhotoFormatException() {
super();
}
 
public InvalidPhotoFormatException(String message, Throwable cause) {
super(message, cause);
}
 
public InvalidPhotoFormatException(String message) {
super(message);
}
 
public InvalidPhotoFormatException(Throwable cause) {
super(cause);
}
}