View | Details | Raw Unified | Return to bug 44418
Collapse All | Expand All

(-)/home/franky/jmeterworkspace/jmeter620583/bin/i18nedit.properties (+10 lines)
Line 0 Link Here
1
#I18NEdit settings for project
2
locale.default=en
3
locales=de ja no tw
4
main.name=jakarta-jmeter
5
personal.Administrator.sourcelocale=en
6
personal.Administrator.targetlocale=tw
7
personal.Administrator.workmode=directed
8
personal.jordi.sourcelocale=en
9
personal.jordi.targetlocale=ja
10
personal.jordi.workmode=free
(-)/home/franky/jmeterworkspace/jmeter620583/docs/api/org/apache/jmeter/config/CSVDataSet.html (+47 lines)
Lines 202-207 Link Here
202
</TR>
202
</TR>
203
<TR BGCOLOR="white" CLASS="TableRowColor">
203
<TR BGCOLOR="white" CLASS="TableRowColor">
204
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
204
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
205
<CODE>&nbsp;boolean</CODE></FONT></TD>
206
<TD><CODE><B><A HREF="../../../../org/apache/jmeter/config/CSVDataSet.html#getIndependent()">getIndependent</A></B>()</CODE>
207
208
<BR>
209
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
210
</TR>
211
<TR BGCOLOR="white" CLASS="TableRowColor">
212
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
205
<CODE>&nbsp;<A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A></CODE></FONT></TD>
213
<CODE>&nbsp;<A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A></CODE></FONT></TD>
206
<TD><CODE><B><A HREF="../../../../org/apache/jmeter/config/CSVDataSet.html#getVariableNames()">getVariableNames</A></B>()</CODE>
214
<TD><CODE><B><A HREF="../../../../org/apache/jmeter/config/CSVDataSet.html#getVariableNames()">getVariableNames</A></B>()</CODE>
207
215
Lines 264-269 Link Here
264
<BR>
272
<BR>
265
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
273
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
266
</TR>
274
</TR>
275
276
<TR BGCOLOR="white" CLASS="TableRowColor">
277
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
278
<CODE>&nbsp;void</CODE></FONT></TD>
279
<TD><CODE><B><A HREF="../../../../org/apache/jmeter/config/CSVDataSet.html#setIndependent(boolean)">setIndependent</A></B>(boolean&nbsp;value)</CODE>
280
281
<BR>
282
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
283
</TR>
284
267
</TABLE>
285
</TABLE>
268
&nbsp;<A NAME="methods_inherited_from_class_org.apache.jmeter.config.ConfigTestElement"><!-- --></A>
286
&nbsp;<A NAME="methods_inherited_from_class_org.apache.jmeter.config.ConfigTestElement"><!-- --></A>
269
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
287
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
Lines 517-522 Link Here
517
</DL>
535
</DL>
518
</DD>
536
</DD>
519
</DL>
537
</DL>
538
<HR>
539
540
<A NAME="getIndependent()"><!-- --></A><H3>
541
getIndependent</H3>
542
<PRE>
543
public boolean <B>getIndependent</B>()</PRE>
544
<DL>
545
<DD><DL>
546
</DL>
547
</DD>
548
<DD><DL>
549
</DL>
550
</DD>
551
</DL>
552
<HR>
553
554
<A NAME="setIndependent(boolean)"><!-- --></A><H3>
555
setIndependent</H3>
556
<PRE>
557
public void <B>setIndependent</B>(boolean&nbsp;value)</PRE>
558
<DL>
559
<DD><DL>
560
</DL>
561
</DD>
562
<DD><DL>
563
</DL>
564
</DD>
565
</DL>
566
520
<!-- ========= END OF CLASS DATA ========= -->
567
<!-- ========= END OF CLASS DATA ========= -->
521
<HR>
568
<HR>
522
569
(-)/home/franky/jmeterworkspace/jmeter620583/docs/api/org/apache/jmeter/services/FileServer.html (-5 / +6 lines)
Lines 129-135 Link Here
129
<TR BGCOLOR="white" CLASS="TableRowColor">
129
<TR BGCOLOR="white" CLASS="TableRowColor">
130
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
130
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
131
<CODE>&nbsp;void</CODE></FONT></TD>
131
<CODE>&nbsp;void</CODE></FONT></TD>
132
<TD><CODE><B><A HREF="../../../../org/apache/jmeter/services/FileServer.html#closeFile(java.lang.String)">closeFile</A></B>(<A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A>&nbsp;name)</CODE>
132
<TD><CODE><B><A HREF="../../../../org/apache/jmeter/services/FileServer.html#closeFile(java.lang.Object)">closeFile</A></B>(<A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html" title="class or interface in java.object">Object</A>&nbsp;objectId)</CODE>
133
133
134
<BR>
134
<BR>
135
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
135
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
Lines 191-197 Link Here
191
         boolean&nbsp;recycle)</CODE>
191
         boolean&nbsp;recycle)</CODE>
192
192
193
<BR>
193
<BR>
194
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Get the next line of the named file.</TD>
194
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Get the next line of a file that is associated with 
195
a given object. If independent is true, the file will be read independent if it is associated with more than one object.</TD>
195
</TR>
196
</TR>
196
<TR BGCOLOR="white" CLASS="TableRowColor">
197
<TR BGCOLOR="white" CLASS="TableRowColor">
197
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
198
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
Lines 199-205 Link Here
199
<TD><CODE><B><A HREF="../../../../org/apache/jmeter/services/FileServer.html#reserveFile(java.lang.String)">reserveFile</A></B>(<A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A>&nbsp;filename)</CODE>
200
<TD><CODE><B><A HREF="../../../../org/apache/jmeter/services/FileServer.html#reserveFile(java.lang.String)">reserveFile</A></B>(<A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A>&nbsp;filename)</CODE>
200
201
201
<BR>
202
<BR>
202
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates an association between a filename and a File inputOutputObject,
203
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates an association between a ObjectId and a File inputOutputObject,
203
 and stores it for later use - unless it is already stored.</TD>
204
 and stores it for later use - unless it is already stored.</TD>
204
</TR>
205
</TR>
205
<TR BGCOLOR="white" CLASS="TableRowColor">
206
<TR BGCOLOR="white" CLASS="TableRowColor">
Lines 209-216 Link Here
209
            <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A>&nbsp;charsetName)</CODE>
210
            <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A>&nbsp;charsetName)</CODE>
210
211
211
<BR>
212
<BR>
212
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates an association between a filename and a File inputOutputObject,
213
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates an association between a ObjectId and a File inputOutputObject,
213
 and stores it for later use - unless it is already stored.</TD>
214
 and stores it for later use. If independent is true, a file is also stored even if it is already exists in the HasMap.</TD>
214
</TR>
215
</TR>
215
<TR BGCOLOR="white" CLASS="TableRowColor">
216
<TR BGCOLOR="white" CLASS="TableRowColor">
216
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
217
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
(-)/home/franky/jmeterworkspace/jmeter620583/src/components/org/apache/jmeter/config/CSVDataSet.java (-2 / +13 lines)
Lines 55-60 Link Here
55
    private transient boolean recycle = true;
55
    private transient boolean recycle = true;
56
    
56
    
57
    private transient boolean stopThread = false;
57
    private transient boolean stopThread = false;
58
    
59
    private transient boolean independent = false;
58
60
59
    transient private String[] vars;
61
    transient private String[] vars;
60
62
Lines 71-77 Link Here
71
		FileServer server = FileServer.getFileServer();
73
		FileServer server = FileServer.getFileServer();
72
		String _fileName = getFilename();
74
		String _fileName = getFilename();
73
		if (vars == null) {
75
		if (vars == null) {
74
			server.reserveFile(_fileName, getFileEncoding());
76
			server.reserveFile(this, _fileName, getFileEncoding(), getIndependent());
75
			vars = JOrphanUtils.split(getVariableNames(), ","); // $NON-NLS-1$
77
			vars = JOrphanUtils.split(getVariableNames(), ","); // $NON-NLS-1$
76
		}
78
		}
77
		try {
79
		try {
Lines 79-85 Link Here
79
			if (delim.equals("\\t")) // $NON-NLS-1$
81
			if (delim.equals("\\t")) // $NON-NLS-1$
80
				delim = "\t";// Make it easier to enter a Tab // $NON-NLS-1$
82
				delim = "\t";// Make it easier to enter a Tab // $NON-NLS-1$
81
            JMeterVariables threadVars = this.getThreadContext().getVariables();
83
            JMeterVariables threadVars = this.getThreadContext().getVariables();
82
			String line = server.readLine(_fileName,getRecycle());
84
			String line = server.readLine(this, _fileName, getRecycle(), getIndependent());
83
            if (line!=null) {// i.e. not EOF
85
            if (line!=null) {// i.e. not EOF
84
                String[] lineValues = JOrphanUtils.split(line, delim,false);
86
                String[] lineValues = JOrphanUtils.split(line, delim,false);
85
    			for (int a = 0; a < vars.length && a < lineValues.length; a++) {
87
    			for (int a = 0; a < vars.length && a < lineValues.length; a++) {
Lines 167-171 Link Here
167
    public void setStopThread(boolean value) {
169
    public void setStopThread(boolean value) {
168
        this.stopThread = value;
170
        this.stopThread = value;
169
    }
171
    }
172
    
173
    public boolean getIndependent() {
174
        return independent;
175
    }
176
177
    public void setIndependent(boolean value) {
178
        this.independent = value;
179
    }
170
180
181
171
}
182
}
(-)/home/franky/jmeterworkspace/jmeter620583/src/components/org/apache/jmeter/config/CSVDataSetBeanInfo.java (-2 / +8 lines)
Lines 35-40 Link Here
35
    private static final String DELIMITER = "delimiter";             //$NON-NLS-1$
35
    private static final String DELIMITER = "delimiter";             //$NON-NLS-1$
36
    private static final String RECYCLE = "recycle";                 //$NON-NLS-1$
36
    private static final String RECYCLE = "recycle";                 //$NON-NLS-1$
37
    private static final String STOPTHREAD = "stopThread";           //$NON-NLS-1$
37
    private static final String STOPTHREAD = "stopThread";           //$NON-NLS-1$
38
   private static final String INDEPENDENT = "independent";         //$NON-NLS-1$
38
39
39
	public CSVDataSetBeanInfo() {
40
	public CSVDataSetBeanInfo() {
40
		super(CSVDataSet.class);
41
		super(CSVDataSet.class);
Lines 39-46 Link Here
39
	public CSVDataSetBeanInfo() {
40
	public CSVDataSetBeanInfo() {
40
		super(CSVDataSet.class);
41
		super(CSVDataSet.class);
41
		createPropertyGroup("csv_data",             //$NON-NLS-1$
42
		createPropertyGroup("csv_data",             //$NON-NLS-1$
42
                new String[] { FILENAME, FILE_ENCODING, VARIABLE_NAMES, DELIMITER, RECYCLE, STOPTHREAD });
43
               new String[] { FILENAME, FILE_ENCODING, VARIABLE_NAMES, DELIMITER, RECYCLE, STOPTHREAD,INDEPENDENT });
43
        
44
		
44
		PropertyDescriptor p = property(FILENAME);
45
		PropertyDescriptor p = property(FILENAME);
45
		p.setValue(NOT_UNDEFINED, Boolean.TRUE);
46
		p.setValue(NOT_UNDEFINED, Boolean.TRUE);
46
		p.setValue(DEFAULT, "");        //$NON-NLS-1$
47
		p.setValue(DEFAULT, "");        //$NON-NLS-1$
Lines 70-74 Link Here
70
        p.setValue(NOT_UNDEFINED, Boolean.TRUE);
71
        p.setValue(NOT_UNDEFINED, Boolean.TRUE);
71
        p.setValue(DEFAULT, Boolean.FALSE);
72
        p.setValue(DEFAULT, Boolean.FALSE);
72
        p.setValue(NOT_EXPRESSION, Boolean.TRUE);
73
        p.setValue(NOT_EXPRESSION, Boolean.TRUE);
74
        
75
        p = property(INDEPENDENT);
76
        p.setValue(NOT_UNDEFINED, Boolean.TRUE);
77
        p.setValue(DEFAULT, Boolean.FALSE);
78
        p.setValue(NOT_EXPRESSION, Boolean.TRUE);
73
	}
79
	}
74
}
80
}
(-)/home/franky/jmeterworkspace/jmeter620583/src/core/org/apache/jmeter/services/FileServer.java (-34 / +78 lines)
Lines 73-78 Link Here
73
		base = new File(DEFAULT_BASE);
73
		base = new File(DEFAULT_BASE);
74
		log.info("Default base="+DEFAULT_BASE);
74
		log.info("Default base="+DEFAULT_BASE);
75
	}
75
	}
76
	
77
	private FileEntry getFileEntrybyFilename(Map map, String filename){
78
		FileEntry fileEntry = null;
79
		Iterator it;
80
		boolean found = false;
81
		if (map != null){
82
			it = map.values().iterator();
83
		    while (it.hasNext() && !found) {
84
		    	fileEntry = (FileEntry) it.next();	
85
		        if (fileEntry.file.getName().equals(filename)){	
86
		    		 found = true;
87
		    	}
88
		    }
89
	    }
90
		return fileEntry;
91
	}
76
92
77
	public static FileServer getFileServer() {
93
	public static FileServer getFileServer() {
78
		return server;
94
		return server;
Lines 101-130 Link Here
101
	}
117
	}
102
118
103
    /**
119
    /**
104
     * Creates an association between a filename and a File inputOutputObject,
120
     * Creates an association between a ObjectId and a File inputOutputObject,
105
     * and stores it for later use - unless it is already stored.
121
     * and stores it for later use - unless it is already stored.
106
     * 
122
     * @param objectId - use a given object as the key for the HashMap
107
     * @param filename - relative (to base) or absolute file name
123
     * @param filename - relative (to base) or absolute file name
108
     */
124
     */
109
	public synchronized void reserveFile(String filename) {
125
	public synchronized void reserveFile(Object objectId, String filename) {
110
		reserveFile(filename,null);
126
		reserveFile(objectId, filename, null, false);
111
	}
127
	}
112
128
113
    /**
129
    /**
114
     * Creates an association between a filename and a File inputOutputObject,
130
     * Creates an association between a ObjectId and a File inputOutputObject,
115
     * and stores it for later use - unless it is already stored.
131
     * and stores it for later use. If independent is true, a file is also
132
     * stored even if it is already exists in the HasMap.
116
     * 
133
     * 
134
     * @param objectId - use a given object as the key for the HashMap 
117
     * @param filename - relative (to base) or absolute file name
135
     * @param filename - relative (to base) or absolute file name
118
     * @param charsetName - the character set encoding to use for the file
136
     * @param charsetName - the character set encoding to use for the file
137
     * @param independent - if true the given filename is stored even the same filename is already stored
119
     */
138
     */
120
	public synchronized void reserveFile(String filename, String charsetName) {
139
	public synchronized void reserveFile(Object objectId, String filename, String charsetName, boolean independent) {	
121
		if (!files.containsKey(filename)) {
140
	   Iterator it;
122
            File f = new File(filename); 
141
	   FileEntry existFileentry;
123
            FileEntry file = 
142
	   boolean b = false;
124
                new FileEntry(f.isAbsolute() ? f : new File(base, filename),null,charsetName);
143
       it = files.values().iterator();
125
            log.info("Stored: "+filename);
144
       while (it.hasNext() && !b) {
126
			files.put(filename, file);
145
    	 existFileentry = (FileEntry) it.next();
127
		}
146
    	 if (existFileentry.file.getName().equals(filename)){
147
    		 b = true;
148
    	 }
149
       }
150
      
151
       if (!b || independent){
152
           File f = new File(filename); 
153
           FileEntry file = 
154
               new FileEntry(f.isAbsolute() ? f : new File(base, filename), null, charsetName);
155
           
156
       log.info("Stored: "+ filename);
157
		files.put(objectId, file);
158
       }
159
	
128
	}
160
	}
129
161
130
   /**
162
   /**
Lines 130-136 Link Here
130
   /**
162
   /**
131
	 * Get the next line of the named file, recycle by default.
163
	 * Get the next line of the named file, recycle by default.
132
	 *
164
	 *
133
     * @param filename
165
	 *@param filename - name of the file
134
	 * @return String containing the next line in the file
166
	 * @return String containing the next line in the file
135
	 * @throws IOException
167
	 * @throws IOException
136
	 */
168
	 */
Lines 135-158 Link Here
135
	 * @throws IOException
167
	 * @throws IOException
136
	 */
168
	 */
137
    public String readLine(String filename) throws IOException {
169
    public String readLine(String filename) throws IOException {
138
      return readLine(filename, true);
170
      return readLine(null, filename, true, false);
139
    }
171
    }
140
172
141
   /**
173
   /**
142
	 * Get the next line of the named file.
174
	 * Get the next line of a file that is associated with a given object. If independent
175
	 * is true, the file will be read independent if it is associated with more than one object. 
143
	 * 
176
	 * 
144
     * @param filename
177
     * @param objectId - use a given object as the key for the HashMap
178
     * @param filename - name of the file
145
     * @param recycle - should file be restarted at EOF?
179
     * @param recycle - should file be restarted at EOF?
180
     * @param independent - read lines from the same file independent from the calling objects
146
	 * @return String containing the next line in the file (null if EOF reached and not recycle)
181
	 * @return String containing the next line in the file (null if EOF reached and not recycle)
147
	 * @throws IOException
182
	 * @throws IOException
148
	 */
183
	 */
149
	public synchronized String readLine(String filename, boolean recycle) throws IOException {
184
	public synchronized String readLine(Object objectId, String filename, boolean recycle, boolean independent) throws IOException {
150
		FileEntry fileEntry = (FileEntry) files.get(filename);
185
		FileEntry fileEntry = null;
186
		
187
		if (independent){
188
			// get FileEntry by key if the same file is more than once in the HashMap (independent = true)
189
			fileEntry = (FileEntry) files.get(objectId);
190
		} else {
191
			// get FileEntry by filename if a file is only once in the HashMap (independent = false)
192
			fileEntry = (FileEntry) getFileEntrybyFilename(files, filename);
193
		}
194
		
151
		if (fileEntry != null) {
195
		if (fileEntry != null) {
152
			if (fileEntry.inputOutputObject == null) {
196
			if (fileEntry.inputOutputObject == null) {
153
				fileEntry.inputOutputObject = createBufferedReader(fileEntry, filename);
197
				fileEntry.inputOutputObject = createBufferedReader(fileEntry);
154
            } else if (!(fileEntry.inputOutputObject instanceof Reader)) {
198
            } else if (!(fileEntry.inputOutputObject instanceof Reader)) {
155
                throw new IOException("File " + filename + " already in use");
199
                throw new IOException("File " + fileEntry.file.getName() + " already in use");
156
            }
200
            }
157
			BufferedReader reader = (BufferedReader) fileEntry.inputOutputObject;
201
			BufferedReader reader = (BufferedReader) fileEntry.inputOutputObject;
158
			String line = reader.readLine();
202
			String line = reader.readLine();
Lines 158-164 Link Here
158
			String line = reader.readLine();
202
			String line = reader.readLine();
159
			if (line == null && recycle) {
203
			if (line == null && recycle) {
160
				reader.close();
204
				reader.close();
161
				reader = createBufferedReader(fileEntry, filename);
205
				reader = createBufferedReader(fileEntry);
162
				fileEntry.inputOutputObject = reader;
206
				fileEntry.inputOutputObject = reader;
163
				line = reader.readLine();
207
				line = reader.readLine();
164
			}
208
			}
Lines 165-174 Link Here
165
            if (log.isDebugEnabled()) log.debug("Read:"+line);
209
            if (log.isDebugEnabled()) log.debug("Read:"+line);
166
			return line;
210
			return line;
167
		}
211
		}
168
		throw new IOException("File never reserved: "+filename);
212
		throw new IOException("File never reserved: "+ filename);
169
	}
213
	}
170
	
214
	
171
	private BufferedReader createBufferedReader(FileEntry fileEntry, String filename) throws IOException { 
215
	private BufferedReader createBufferedReader(FileEntry fileEntry) throws IOException { 
172
		FileInputStream fis = new FileInputStream(fileEntry.file);				
216
		FileInputStream fis = new FileInputStream(fileEntry.file);				
173
		InputStreamReader isr = null;
217
		InputStreamReader isr = null;
174
        // If file encoding is specified, read using that encoding, otherwise use default platform encoding
218
        // If file encoding is specified, read using that encoding, otherwise use default platform encoding
Lines 182-191 Link Here
182
	}
226
	}
183
227
184
	public synchronized void write(String filename, String value) throws IOException {
228
	public synchronized void write(String filename, String value) throws IOException {
185
		FileEntry fileEntry = (FileEntry) files.get(filename);
229
		FileEntry fileEntry = (FileEntry) getFileEntrybyFilename(files, filename);
186
		if (fileEntry != null) {
230
		if (fileEntry != null) {
187
			if (fileEntry.inputOutputObject == null) {
231
			if (fileEntry.inputOutputObject == null) {
188
				fileEntry.inputOutputObject = createBufferedWriter(fileEntry, filename);
232
				fileEntry.inputOutputObject = createBufferedWriter(fileEntry);
189
			} else if (!(fileEntry.inputOutputObject instanceof Writer)) {
233
			} else if (!(fileEntry.inputOutputObject instanceof Writer)) {
190
				throw new IOException("File " + filename + " already in use");
234
				throw new IOException("File " + filename + " already in use");
191
			}
235
			}
Lines 197-203 Link Here
197
        }
241
        }
198
	}
242
	}
199
243
200
	private BufferedWriter createBufferedWriter(FileEntry fileEntry, String filename) throws IOException { 
244
	private BufferedWriter createBufferedWriter(FileEntry fileEntry) throws IOException { 
201
		FileOutputStream fos = new FileOutputStream(fileEntry.file);				
245
		FileOutputStream fos = new FileOutputStream(fileEntry.file);				
202
		OutputStreamWriter osw = null;
246
		OutputStreamWriter osw = null;
203
        // If file encoding is specified, write using that encoding, otherwise use default platform encoding
247
        // If file encoding is specified, write using that encoding, otherwise use default platform encoding
Lines 214-220 Link Here
214
		Iterator iter = files.entrySet().iterator();
258
		Iterator iter = files.entrySet().iterator();
215
		while (iter.hasNext()) {
259
		while (iter.hasNext()) {
216
            Map.Entry me = (Map.Entry) iter.next();
260
            Map.Entry me = (Map.Entry) iter.next();
217
			closeFile((String)me.getKey(),(FileEntry)me.getValue() );
261
			closeFile((FileEntry)me.getValue() );
218
		}
262
		}
219
		files.clear();
263
		files.clear();
220
	}
264
	}
Lines 223-236 Link Here
223
	 * @param name
267
	 * @param name
224
	 * @throws IOException
268
	 * @throws IOException
225
	 */
269
	 */
226
	public synchronized void closeFile(String name) throws IOException {
270
	public synchronized void closeFile(Object objectId) throws IOException {
227
		FileEntry fileEntry = (FileEntry) files.get(name);
271
		FileEntry fileEntry = (FileEntry) files.get(objectId);
228
		closeFile(name, fileEntry);
272
		closeFile(fileEntry);
229
	}
273
	}
230
274
231
    private void closeFile(String name, FileEntry fileEntry) throws IOException {
275
    private void closeFile(FileEntry fileEntry) throws IOException {
232
        if (fileEntry != null && fileEntry.inputOutputObject != null) {
276
        if (fileEntry != null && fileEntry.inputOutputObject != null) {
233
            log.info("Close: "+name);
277
            log.info("Close: "+fileEntry.file.getName());
234
            if (fileEntry.inputOutputObject instanceof Reader) {
278
            if (fileEntry.inputOutputObject instanceof Reader) {
235
                ((Reader) fileEntry.inputOutputObject).close();
279
                ((Reader) fileEntry.inputOutputObject).close();
236
            } else if (fileEntry.inputOutputObject instanceof Writer) {
280
            } else if (fileEntry.inputOutputObject instanceof Writer) {
(-)/home/franky/jmeterworkspace/jmeter620583/src/core/org/apache/jmeter/util/JMeterVersion.java (-1 / +1 lines)
Lines 44-50 Link Here
44
	 * This ensures that JMeterUtils always gets the correct
44
	 * This ensures that JMeterUtils always gets the correct
45
	 * version, even if JMeterUtils is not re-compiled during the build.
45
	 * version, even if JMeterUtils is not re-compiled during the build.
46
	 */
46
	 */
47
	private static final String VERSION = "2.3.2";
47
	private static final String VERSION = "2.3.20080222";
48
48
49
	static final String COPYRIGHT = "Copyright (c) 1998-2008 The Apache Software Foundation";
49
	static final String COPYRIGHT = "Copyright (c) 1998-2008 The Apache Software Foundation";
50
50
(-)/home/franky/jmeterworkspace/jmeter620583/src/protocol/http/org/apache/jmeter/protocol/http/util/accesslog/SharedTCLogParser.java (-1 / +1 lines)
Lines 49-55 Link Here
49
	 */
49
	 */
50
	public int parse(TestElement el, int parseCount) {
50
	public int parse(TestElement el, int parseCount) {
51
		FileServer fileServer = FileServer.getFileServer();
51
		FileServer fileServer = FileServer.getFileServer();
52
		fileServer.reserveFile(FILENAME);
52
		fileServer.reserveFile(this, FILENAME);
53
		try {
53
		try {
54
			return parse(fileServer, el, parseCount);
54
			return parse(fileServer, el, parseCount);
55
		} catch (Exception exception) {
55
		} catch (Exception exception) {
(-)/home/franky/jmeterworkspace/jmeter620583/test/src/org/apache/jmeter/services/TestFileServer.java (-2 / +2 lines)
Lines 59-65 Link Here
59
        FS.closeFile("xxx"); // Unrecognised files are ignored
59
        FS.closeFile("xxx"); // Unrecognised files are ignored
60
        assertFalse("Should not have any files open",FS.filesOpen());
60
        assertFalse("Should not have any files open",FS.filesOpen());
61
        String infile="testfiles/test.csv";
61
        String infile="testfiles/test.csv";
62
        FS.reserveFile(infile); // Does not open file
62
        FS.reserveFile(this, infile); // Does not open file
63
        assertFalse("Should not have any files open",FS.filesOpen());
63
        assertFalse("Should not have any files open",FS.filesOpen());
64
        assertEquals("a1,b1,c1,d1",FS.readLine(infile));
64
        assertEquals("a1,b1,c1,d1",FS.readLine(infile));
65
        assertTrue("Should have some files open",FS.filesOpen());
65
        assertTrue("Should have some files open",FS.filesOpen());
Lines 86-92 Link Here
86
        }
86
        }
87
        String base=FS.getBaseDir();
87
        String base=FS.getBaseDir();
88
        infile=base+"/testfiles/test.csv";
88
        infile=base+"/testfiles/test.csv";
89
        FS.reserveFile(infile); // Does not open file
89
        FS.reserveFile(this, infile); // Does not open file
90
        assertFalse("Should not have any files open",FS.filesOpen());
90
        assertFalse("Should not have any files open",FS.filesOpen());
91
        assertEquals("a1,b1,c1,d1",FS.readLine(infile));
91
        assertEquals("a1,b1,c1,d1",FS.readLine(infile));
92
        try {
92
        try {

Return to bug 44418