Subversion Repositories SmartDukaan

Rev

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

Rev 4490 Rev 9175
Line 7... Line 7...
7
import java.io.File;
7
import java.io.File;
8
import java.io.FileInputStream;
8
import java.io.FileInputStream;
9
import java.io.FileNotFoundException;
9
import java.io.FileNotFoundException;
10
import java.io.IOException;
10
import java.io.IOException;
11
import java.io.InputStream;
11
import java.io.InputStream;
-
 
12
import java.io.UnsupportedEncodingException;
-
 
13
import java.net.URLEncoder;
12
 
14
 
13
import javax.servlet.ServletOutputStream;
15
import javax.servlet.ServletOutputStream;
14
 
16
 
15
import in.shop2020.crm.Activity;
17
import in.shop2020.crm.Activity;
16
import in.shop2020.crm.Agent;
18
import in.shop2020.crm.Agent;
Line 86... Line 88...
86
        byte[] buffer = null;
88
        byte[] buffer = null;
87
        try {
89
        try {
88
            if (attachment == null || attachment.isEmpty()) {
90
            if (attachment == null || attachment.isEmpty()) {
89
                throw new Exception("File name is empty");
91
                throw new Exception("File name is empty");
90
            }
92
            }
-
 
93
            String attachmentString = "";
-
 
94
            try {
-
 
95
            	attachmentString = URLEncoder.encode(attachment, "UTF-8");
-
 
96
    		} catch (UnsupportedEncodingException e) {
-
 
97
    			System.out.println("Unable to encode the attachement file name");
-
 
98
    		}
91
            String fileName = CRMConstants.ATTACHMENTS_ARCHIVE_DIR + attachment;
99
            String fileName = CRMConstants.ATTACHMENTS_ARCHIVE_DIR + attachmentString;
92
            File file = new File(fileName);
100
            File file = new File(fileName);
93
            buffer = new byte[(int)file.length()];
101
            buffer = new byte[(int)file.length()];
94
            InputStream input = null;
102
            InputStream input = null;
95
            try {
103
            try {
96
                int totalBytesRead = 0;
104
                int totalBytesRead = 0;