agave-systems/systems-core/src/main/java/org/iplantc/service/transfer/ftp/FTP2.java
/**
	 * Uses legacy list command with file filter to get the file info
	 * 
	 * @param resolvedPath absolute path to file or folder on the system
	 * @return
	 * @throws RemoteDataException
	 * @throws IOException
	 */
Uses legacy list command with file filter to get the file info

@param resolvedPath absolute path to file or folder on the system
@return
@throws RemoteDataException
@throws IOException
Uses legacy list command with file filter to get the file info @param resolvedPath absolute path to file or folder on the system @return @throws RemoteDataException @throws IOException
private RemoteFileInfo doGetLegacyFileInfo(String resolvedPath) 
	throws RemoteDataException, IOException
	{
		RemoteFileInfo fileInfo = null;
		BufferedReader reader = null;
		try
		{
			if (fileInfoCache.containsKey(resolvedPath)) {
				return fileInfoCache.get(resolvedPath);
			}
			setType(Session.TYPE_ASCII);
			setDTP(true);
			changeDir(resolvedPath);
			ByteArrayDataSink sink = new ByteArrayDataSink();
			if (isWindowsSystem()) {
				list("*", "-a", sink);
			} else {
				list("*", "-d", sink);
			}
	        ByteArrayOutputStream received = sink.getData();
	        reader = new BufferedReader(new StringReader(received.toString()));
	        String line = null;
	        while ((line = reader.readLine()) != null) {
	            line = line.trim();
	            if(line.equals(""))
	            {
	                continue;
	            }
	            if (line.startsWith("total"))
	                continue;
	            RemoteFileInfo childInfo = new RemoteFileInfo(line);
				if (!StringUtils.equals(childInfo.getName(), ".") && 
						!StringUtils.equals(childInfo.getName(), FilenameUtils.getName(StringUtils.removeEnd(resolvedPath, "/")))) 
				{
		            fileInfoCache.put(resolvedPath + "/" + childInfo.getName(), childInfo);
		            return childInfo;
				}
	        }
	        List<RemoteFileInfo> listing = doLegacyLs(resolvedPath);
	        ByteArrayOutputStream received = sink.getData();
	        reader = new BufferedReader(new StringReader(received.toString()));
	        String line = null;
	        while ((line = reader.readLine()) != null) {
	            line = line.trim();
	            if(line.equals(""))
	            {
	                continue;
	            }
	            if (line.startsWith("total"))
	                continue;
	            RemoteFileInfo childInfo = new RemoteFileInfo(line);
				if (StringUtils.equals(childInfo.getName(), ".") || 
						StringUtils.equals(childInfo.getName(), FilenameUtils.getName(StringUtils.removeEnd(resolvedPath, "/")))) 
				{
					fileInfo = childInfo;
				}
	        }
	        changeDir(resolvePath(""));
			return fileInfo;
		}
		catch (ServerException e) 
		{
			if (e.toString().contains("check for file existence") ||
					e.toString().contains("No such file or directory")) 
			{
				throw new FileNotFoundException("No such file or directory");
			} else if (e.toString().contains("Permission denied")) {
				throw new RemoteDataException("Permission denied", e);
			} else {
				throw new RemoteDataException("Failed to retrieve file info for " + fileInfoCache.containsKey(resolvedPath), e);
			}
		}
		catch (Exception e) {
			throw new RemoteDataException("Failed to retrieve file info for " + fileInfoCache.containsKey(resolvedPath), e);
		}
		finally {
			try { reader.close(); } catch (Exception e) {}
		}
	}
private RemoteFileInfo doGetLegacyFileInfo ( String resolvedPath ) throws RemoteDataException , IOException { RemoteFileInfo fileInfo = null ; BufferedReader reader = null ; try { if ( fileInfoCache . containsKey ( resolvedPath ) ) { return fileInfoCache . get ( resolvedPath ) ; } setType ( Session . TYPE_ASCII ) ; setDTP ( true ) ; changeDir ( resolvedPath ) ; ByteArrayDataSink sink = new ByteArrayDataSink ( ) ; if ( isWindowsSystem ( ) ) { list ( "*" , "-a" , sink ) ; } else { list ( "*" , "-d" , sink ) ; } ByteArrayOutputStream received = sink . getData ( ) ; reader = new BufferedReader ( new StringReader ( received . toString ( ) ) ) ; String line = null ; while ( ( line = reader . readLine ( ) ) != null ) { line = line . trim ( ) ; if ( line . equals ( "" ) ) { continue ; } if ( line . startsWith ( "total" ) ) continue ; RemoteFileInfo childInfo = new RemoteFileInfo ( line ) ; if ( ! StringUtils . equals ( childInfo . getName ( ) , "." ) && ! StringUtils . equals ( childInfo . getName ( ) , FilenameUtils . getName ( StringUtils . removeEnd ( resolvedPath , "/" ) ) ) ) { fileInfoCache . put ( resolvedPath + "/" + childInfo . getName ( ) , childInfo ) ; return childInfo ; } } changeDir ( resolvePath ( "" ) ) ; return fileInfo ; } catch ( ServerException e ) { if ( e . toString ( ) . contains ( "check for file existence" ) || e . toString ( ) . contains ( "No such file or directory" ) ) { throw new FileNotFoundException ( "No such file or directory" ) ; } else if ( e . toString ( ) . contains ( "Permission denied" ) ) { throw new RemoteDataException ( "Permission denied" , e ) ; } else { throw new RemoteDataException ( "Failed to retrieve file info for " + fileInfoCache . containsKey ( resolvedPath ) , e ) ; } } catch ( Exception e ) { throw new RemoteDataException ( "Failed to retrieve file info for " + fileInfoCache . containsKey ( resolvedPath ) , e ) ; } finally { try { reader . close ( ) ; } catch ( Exception e ) { } } }
Uses legacy list command with file filter to get the file info
Uses legacy list command with file filter to get the file info
// check the cache so we can save a query when possible //			setLocalPassive(); //			setActive(); //			setActive(localServer.setPassive()); // transfer done. Data is in received stream. // convert it to a vector. // add to cache since this file may have changed //			ByteArrayDataSink sink = new ByteArrayDataSink(); // //	        List<RemoteFileInfo> listing = doLegacyLs(resolvedPath); //	         // //	        ByteArrayOutputStream received = sink.getData(); // //	        // transfer done. Data is in received stream. //	        // convert it to a vector. // //	        reader = new BufferedReader(new StringReader(received.toString())); // //	        String line = null; // //	        while ((line = reader.readLine()) != null) { //	            line = line.trim(); //	            if(line.equals("")) //	            { //	                continue; //	            } //	            if (line.startsWith("total")) //	                continue; //	            RemoteFileInfo childInfo = new RemoteFileInfo(line); //				if (StringUtils.equals(childInfo.getName(), ".") ||  //						StringUtils.equals(childInfo.getName(), FilenameUtils.getName(StringUtils.removeEnd(resolvedPath, "/"))))  //				{ //					fileInfo = childInfo; //				} //	        }