### Eclipse Workspace Patch 1.0 #P org.eclipse.rse.connectorservice.telnet Index: src/org/eclipse/rse/internal/connectorservice/telnet/TelnetConnectorService.java =================================================================== RCS file: /cvsroot/tools/org.eclipse.tm.rse/plugins/org.eclipse.rse.connectorservice.telnet/src/org/eclipse/rse/internal/connectorservice/telnet/TelnetConnectorService.java,v retrieving revision 1.25 diff -u -r1.25 TelnetConnectorService.java --- src/org/eclipse/rse/internal/connectorservice/telnet/TelnetConnectorService.java 2 Aug 2009 12:01:39 -0000 1.25 +++ src/org/eclipse/rse/internal/connectorservice/telnet/TelnetConnectorService.java 28 May 2012 19:56:49 -0000 @@ -101,17 +101,18 @@ */ protected IPropertySet getTelnetPropertySet() { IPropertySet telnetSet = getPropertySet(PROPERTY_SET_NAME); + if (telnetSet == null) { - telnetSet = createPropertySet(PROPERTY_SET_NAME, - TelnetConnectorResources.PropertySet_Description); + telnetSet = createPropertySet(PROPERTY_SET_NAME/*, + TelnetConnectorResources.PropertySet_Description*/); telnetSet.addProperty(PROPERTY_LOGIN_REQUIRED, - "true", PropertyType.getEnumPropertyType(new String[] { "true", "false" })); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + "false", PropertyType.getEnumPropertyType(new String[] { "true", "false" })); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ telnetSet.addProperty(PROPERTY_LOGIN_PROMPT, "ogin: ", PropertyType.getStringPropertyType()); //$NON-NLS-1$ telnetSet.addProperty(PROPERTY_PASSWORD_PROMPT, "assword: ", PropertyType.getStringPropertyType()); //$NON-NLS-1$ telnetSet.addProperty(PROPERTY_COMMAND_PROMPT, - "$", PropertyType.getStringPropertyType()); //$NON-NLS-1$ + "#", PropertyType.getStringPropertyType()); //$NON-NLS-1$ } return telnetSet; } @@ -258,11 +259,30 @@ } } + int read_withtime(InputStream in) { + long millisToEnd = System.currentTimeMillis() + 1000; + try { + while (System.currentTimeMillis()0) + return in.read(); + else + Thread.sleep(100); + } + } catch (IOException e) { + e.printStackTrace(); + } catch (InterruptedException e) { + e.printStackTrace(); + } + return -1; + } + public int readUntil(String pattern,InputStream in) { + try { char lastChar = pattern.charAt(pattern.length() - 1); StringBuffer sb = new StringBuffer(); - int ch = in.read(); + int ch = read_withtime(in); while (ch >= 0) { char tch = (char) ch; if (Activator.isTracingOn()) @@ -279,7 +299,7 @@ return SUCCESS_CODE; } } - ch = in.read(); + ch = read_withtime(in); } } catch (Exception e) { SystemBasePlugin.logError(e.getMessage() == null ? e.getClass().getName() : e.getMessage(), e); @@ -558,13 +578,24 @@ status = readUntil(password_prompt,this.in); write(password,this.out); } + /* if (status == SUCCESS_CODE && command_prompt != null && command_prompt.length() > 0) { status = readUntil(command_prompt,this.in); } + */ } else { + status = SUCCESS_CODE; + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + /* if (command_prompt != null && command_prompt.length() > 0) { status = readUntil(command_prompt,this.in); } + */ } }