Subversion Repositories SmartDukaan

Rev

Rev 22124 | Rev 23951 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 22124 Rev 23780
Line 16... Line 16...
16
	      String filetype;
16
	      String filetype;
17
		try {
17
		try {
18
			filetype = tika.detect(file);
18
			filetype = tika.detect(file);
19
		} catch (IOException e) {
19
		} catch (IOException e) {
20
			e.printStackTrace();
20
			e.printStackTrace();
21
			throw new ProfitMandiBusinessException("Content-Type", file.getName(), "");
21
			throw new ProfitMandiBusinessException("Content-Type", file.getName(), "DCMNT_1001");
22
		}
22
		}
23
	      if(filetype.contains("pdf")){
23
	      if(filetype.contains("pdf")){
24
	    	  return ContentType.PDF;
24
	    	  return ContentType.PDF;
25
	      }else if(filetype.contains("jpg") | filetype.contains("jpeg")){
25
	      }else if(filetype.contains("jpg") | filetype.contains("jpeg")){
26
	    	  return ContentType.JPEG;
26
	    	  return ContentType.JPEG;
27
	      }else if(filetype.contains("png")){
27
	      }else if(filetype.contains("png")){
28
	    	  return ContentType.PNG;
28
	    	  return ContentType.PNG;
29
	      }else{
29
	      }else{
30
	    	  throw new ProfitMandiBusinessException("Content-Type", file.getName(), "");
30
	    	  throw new ProfitMandiBusinessException("Content-Type", file.getName(), "DCMNT_1002");
31
	      }
31
	      }
32
	}
32
	}
33
	public static void main(String[] args){
33
	public static void main(String[] args){
34
		//detectFileType(new File("/hsps-docs/1499163441532"));
34
		//detectFileType(new File("/hsps-docs/1499163441532"));
35
		//System.out.println("he");
35
		//System.out.println("he");