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

(-)src/org/eclipse/ui/internal/views/log/LogReader.java (-14 / +25 lines)
Lines 61-69 Link Here
61
				if (line == null)
61
				if (line == null)
62
					break;
62
					break;
63
				line = line.trim();
63
				line = line.trim();
64
				if (line.length() == 0)
64
				
65
					continue;
66
67
				if (line.startsWith("!SESSION")) { //$NON-NLS-1$
65
				if (line.startsWith("!SESSION")) { //$NON-NLS-1$
68
					state = SESSION_STATE;
66
					state = SESSION_STATE;
69
				} else if (line.startsWith("!ENTRY")) { //$NON-NLS-1$
67
				} else if (line.startsWith("!ENTRY")) { //$NON-NLS-1$
Lines 84-98 Link Here
84
				}
82
				}
85
			
83
			
86
				if (writer != null) {
84
				if (writer != null) {
87
					if (writerState == STACK_STATE && current != null) {
85
					setData(current, session, writerState, swriter);
88
						current.setStack(swriter.toString());
89
					} else if (writerState == SESSION_STATE && session != null) {
90
						session.setSessionData(swriter.toString());
91
					} else if (writerState == MESSAGE_STATE && current != null){
92
						StringBuffer sb = new StringBuffer(current.getMessage());
93
						sb.append(swriter.toString());
94
						current.setMessage(sb.toString().trim());
95
					}
96
					writerState = UNKNOWN_STATE;
86
					writerState = UNKNOWN_STATE;
97
					swriter = null;
87
					swriter = null;
98
					writer.close();
88
					writer.close();
Lines 148-155 Link Here
148
				}
138
				}
149
			} 
139
			} 
150
			
140
			
151
			if (swriter != null && current != null && writerState == STACK_STATE)
141
			if (swriter != null && current != null && writerState == STACK_STATE) {
142
				writerState = UNKNOWN_STATE;
152
				current.setStack(swriter.toString());
143
				current.setStack(swriter.toString());
144
			}
153
		} catch (FileNotFoundException e) {
145
		} catch (FileNotFoundException e) {
154
		} catch (IOException e) {
146
		} catch (IOException e) {
155
		} finally {
147
		} finally {
Lines 158-165 Link Here
158
					reader.close();
150
					reader.close();
159
			} catch (IOException e1) {
151
			} catch (IOException e1) {
160
			}
152
			}
161
			if (writer != null)
153
			if (writer != null) {
154
				setData(current, session, writerState, swriter);
162
				writer.close();
155
				writer.close();
156
			}
157
		}
158
	}
159
160
	/**
161
	 * Assigns data from writer to appropriate field of current Log Entry or Session,
162
	 * depending on writer state.
163
	 */
164
	private static void setData(LogEntry current, LogSession session,
165
			int writerState, StringWriter swriter) {
166
		if (writerState == STACK_STATE && current != null) {
167
			current.setStack(swriter.toString());
168
		} else if (writerState == SESSION_STATE && session != null) {
169
			session.setSessionData(swriter.toString());
170
		} else if (writerState == MESSAGE_STATE && current != null){
171
			StringBuffer sb = new StringBuffer(current.getMessage());
172
			sb.append(swriter.toString());
173
			current.setMessage(sb.toString().trim());
163
		}
174
		}
164
	}
175
	}
165
		
176
		

Return to bug 100715