View | Details | Raw Unified | Return to bug 194473 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/rse/internal/connectorservice/telnet/TelnetConnectorService.java (-6 / +37 lines)
Lines 101-117 Link Here
101
	 */
101
	 */
102
	protected IPropertySet getTelnetPropertySet() {
102
	protected IPropertySet getTelnetPropertySet() {
103
		IPropertySet telnetSet = getPropertySet(PROPERTY_SET_NAME);
103
		IPropertySet telnetSet = getPropertySet(PROPERTY_SET_NAME);
104
		
104
		if (telnetSet == null) {
105
		if (telnetSet == null) {
105
			telnetSet = createPropertySet(PROPERTY_SET_NAME,
106
			telnetSet = createPropertySet(PROPERTY_SET_NAME/*,
106
					TelnetConnectorResources.PropertySet_Description);
107
					TelnetConnectorResources.PropertySet_Description*/);
107
			telnetSet.addProperty(PROPERTY_LOGIN_REQUIRED,
108
			telnetSet.addProperty(PROPERTY_LOGIN_REQUIRED,
108
							"true", PropertyType.getEnumPropertyType(new String[] { "true", "false" })); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
109
							"false", PropertyType.getEnumPropertyType(new String[] { "true", "false" })); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
109
			telnetSet.addProperty(PROPERTY_LOGIN_PROMPT,
110
			telnetSet.addProperty(PROPERTY_LOGIN_PROMPT,
110
					"ogin: ", PropertyType.getStringPropertyType()); //$NON-NLS-1$
111
					"ogin: ", PropertyType.getStringPropertyType()); //$NON-NLS-1$
111
			telnetSet.addProperty(PROPERTY_PASSWORD_PROMPT,
112
			telnetSet.addProperty(PROPERTY_PASSWORD_PROMPT,
112
					"assword: ", PropertyType.getStringPropertyType()); //$NON-NLS-1$
113
					"assword: ", PropertyType.getStringPropertyType()); //$NON-NLS-1$
113
			telnetSet.addProperty(PROPERTY_COMMAND_PROMPT,
114
			telnetSet.addProperty(PROPERTY_COMMAND_PROMPT,
114
					"$", PropertyType.getStringPropertyType()); //$NON-NLS-1$
115
					"#", PropertyType.getStringPropertyType()); //$NON-NLS-1$
115
		}
116
		}
116
		return telnetSet;
117
		return telnetSet;
117
	}
118
	}
Lines 258-268 Link Here
258
		}
259
		}
259
	}
260
	}
260
261
262
	int read_withtime(InputStream in)  {
263
		long millisToEnd = System.currentTimeMillis() + 1000;
264
		try {
265
			while (System.currentTimeMillis()<millisToEnd)
266
			{
267
				if (in.available()>0)
268
					return in.read();
269
				else
270
					Thread.sleep(100);
271
			}
272
		} catch (IOException e) {
273
			e.printStackTrace();
274
		} catch (InterruptedException e) {
275
			e.printStackTrace();
276
		}	
277
		return -1;
278
	}
279
	
261
	public int readUntil(String pattern,InputStream in) {
280
	public int readUntil(String pattern,InputStream in) {
281
		
262
		try {
282
		try {
263
			char lastChar = pattern.charAt(pattern.length() - 1);
283
			char lastChar = pattern.charAt(pattern.length() - 1);
264
			StringBuffer sb = new StringBuffer();
284
			StringBuffer sb = new StringBuffer();
265
			int ch = in.read();
285
			int ch = read_withtime(in);
266
			while (ch >= 0) {
286
			while (ch >= 0) {
267
				char tch = (char) ch;
287
				char tch = (char) ch;
268
				if (Activator.isTracingOn())
288
				if (Activator.isTracingOn())
Lines 279-285 Link Here
279
						return SUCCESS_CODE;
299
						return SUCCESS_CODE;
280
					}
300
					}
281
				}
301
				}
282
				ch = in.read();
302
				ch = read_withtime(in);
283
			}
303
			}
284
		} catch (Exception e) {
304
		} catch (Exception e) {
285
			SystemBasePlugin.logError(e.getMessage() == null ? 	e.getClass().getName() : e.getMessage(), e);
305
			SystemBasePlugin.logError(e.getMessage() == null ? 	e.getClass().getName() : e.getMessage(), e);
Lines 558-570 Link Here
558
					status = readUntil(password_prompt,this.in);
578
					status = readUntil(password_prompt,this.in);
559
					write(password,this.out);
579
					write(password,this.out);
560
				}
580
				}
581
				/*
561
				if (status == SUCCESS_CODE && command_prompt != null && command_prompt.length() > 0) {
582
				if (status == SUCCESS_CODE && command_prompt != null && command_prompt.length() > 0) {
562
					status = readUntil(command_prompt,this.in);
583
					status = readUntil(command_prompt,this.in);
563
				}
584
				}
585
				*/
564
			} else {
586
			} else {
587
				status = SUCCESS_CODE;
588
				try {
589
					Thread.sleep(1000);
590
				} catch (InterruptedException e) {
591
					// TODO Auto-generated catch block
592
					e.printStackTrace();
593
				}
594
				/*
565
				if (command_prompt != null && command_prompt.length() > 0) {
595
				if (command_prompt != null && command_prompt.length() > 0) {
566
					status = readUntil(command_prompt,this.in);
596
					status = readUntil(command_prompt,this.in);
567
				}
597
				}
598
				*/
568
			}
599
			}
569
		}
600
		}
570
601

Return to bug 194473