Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 206260 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/tptp/monitoring/logui/internal/wizards/LogLocationUI.java (-3 / +3 lines)
Lines 453-459 Link Here
453
				if(value!=null){	
453
				if(value!=null){	
454
					((IImportWizardWidget)widget).setValue(value);
454
					((IImportWizardWidget)widget).setValue(value);
455
					if(id.equals("file_path")){
455
					if(id.equals("file_path")){
456
						boolean hostEnabled = !(value.startsWith("ftp://") || value.startsWith("http://"));
456
						boolean hostEnabled = !(value.startsWith("ftp://") || value.startsWith("http://") || value.startsWith("https://"));
457
						details.setHostEnabled(hostEnabled);
457
						details.setHostEnabled(hostEnabled);
458
					}
458
					}
459
										
459
										
Lines 614-620 Link Here
614
			String key = (String) iterator.next();
614
			String key = (String) iterator.next();
615
			if(key.equals("file_path")){
615
			if(key.equals("file_path")){
616
				String value = (String)values.get(key);
616
				String value = (String)values.get(key);
617
				if(value !=  null && (value.startsWith("ftp://") || value.startsWith("http://"))){
617
				if(value !=  null && (value.startsWith("ftp://") || value.startsWith("http://") || value.startsWith("https://"))){
618
					String host = extractHostFromURL(value);
618
					String host = extractHostFromURL(value);
619
					if(host != null){
619
					if(host != null){
620
						logElem.setVirtualHost(host);
620
						logElem.setVirtualHost(host);
Lines 645-651 Link Here
645
			ImportWizardTextField filePathTextField = (ImportWizardTextField)activeComposite.getControlLookup().get("file_path");
645
			ImportWizardTextField filePathTextField = (ImportWizardTextField)activeComposite.getControlLookup().get("file_path");
646
			if(filePathTextField != null && filePathTextField.getText().equals(e.widget)){
646
			if(filePathTextField != null && filePathTextField.getText().equals(e.widget)){
647
				// a modification happened in the text field, verify if the file path is an ftp or http URL. If so, disable host selection and extract the host from the URL 
647
				// a modification happened in the text field, verify if the file path is an ftp or http URL. If so, disable host selection and extract the host from the URL 
648
				boolean hostEnabledState = !(((Text)e.widget).getText().startsWith("ftp://") || ((Text)e.widget).getText().startsWith("http://"));
648
				boolean hostEnabledState = !(((Text)e.widget).getText().startsWith("ftp://") || ((Text)e.widget).getText().startsWith("http://") || ((Text)e.widget).getText().startsWith("https://"));
649
				details.setHostEnabled(hostEnabledState);
649
				details.setHostEnabled(hostEnabledState);
650
				
650
				
651
			}
651
			}
(-)src/org/eclipse/tptp/monitoring/logui/internal/wizards/ImportLogWizard.java (-1 / +1 lines)
Lines 1996-2002 Link Here
1996
		}
1996
		}
1997
		LocalLogImportJob job = new LocalLogImportJob(LogUIMessages._7, handler, element);
1997
		LocalLogImportJob job = new LocalLogImportJob(LogUIMessages._7, handler, element);
1998
		final String filePath = (String) element.getValues().get("file_path");
1998
		final String filePath = (String) element.getValues().get("file_path");
1999
		if (filePath != null && (filePath.startsWith("ftp://") || filePath.startsWith("http://"))) {
1999
		if (filePath != null && (filePath.startsWith("ftp://") || filePath.startsWith("http://")  || filePath.startsWith("https://"))) {
2000
			Authenticator authenticator = new Authenticator(){
2000
			Authenticator authenticator = new Authenticator(){
2001
				ImportPasswordAuthentication importLogAuthentication = null;
2001
				ImportPasswordAuthentication importLogAuthentication = null;
2002
				
2002
				
(-)cbe.import/org/eclipse/tptp/monitoring/log/internal/core/CBEServiceFactoryImpl.java (-1 / +1 lines)
Lines 23-29 Link Here
23
		IImportHandler handler = null;
23
		IImportHandler handler = null;
24
		if (element.isLocalhost()){
24
		if (element.isLocalhost()){
25
			final String filePath = (String) element.getValues().get("file_path");
25
			final String filePath = (String) element.getValues().get("file_path");
26
			if (filePath != null && (filePath.startsWith("ftp://") || filePath.startsWith("http://"))) {
26
			if (filePath != null && (filePath.startsWith("ftp://") || filePath.startsWith("http://") || filePath.startsWith("https://"))) {
27
				handler =  new LocalDownloadImportHandler(element ,context);				
27
				handler =  new LocalDownloadImportHandler(element ,context);				
28
			}
28
			}
29
			else{
29
			else{
(-)cbe.import/org/eclipse/tptp/monitoring/log/internal/core/LocalDownloadImportHandler.java (-2 / +23 lines)
Lines 19-24 Link Here
19
import java.io.InputStream;
19
import java.io.InputStream;
20
import java.io.OutputStream;
20
import java.io.OutputStream;
21
import java.net.Authenticator;
21
import java.net.Authenticator;
22
import java.net.HttpURLConnection;
22
import java.net.URL;
23
import java.net.URL;
23
import java.net.URLConnection;
24
import java.net.URLConnection;
24
import java.util.Date;
25
import java.util.Date;
Lines 53-59 Link Here
53
		String destPath = (String)context.getProperty(IImportHandler.TEMP_DIRECTORY);
54
		String destPath = (String)context.getProperty(IImportHandler.TEMP_DIRECTORY);
54
		final String fileURL = (String)element.getValues().get("file_path"); //$NON-NLS-1$
55
		final String fileURL = (String)element.getValues().get("file_path"); //$NON-NLS-1$
55
		
56
		
56
		//**Need to authenticate **//
57
		//**Need to authenticate **///
57
		monitor.beginTask(element.getAgentName(), IProgressMonitor.UNKNOWN);
58
		monitor.beginTask(element.getAgentName(), IProgressMonitor.UNKNOWN);
58
		monitor.subTask(" "+StringUtil.replace(Messages.getString("LocalDownloadImportHandler.2", locale),"{0}", fileURL)); //$NON-NLS-1$ //$NON-NLS-2$
59
		monitor.subTask(" "+StringUtil.replace(Messages.getString("LocalDownloadImportHandler.2", locale),"{0}", fileURL)); //$NON-NLS-1$ //$NON-NLS-2$
59
		Authenticator.setDefault (authenticator);
60
		Authenticator.setDefault (authenticator);
Lines 61-68 Link Here
61
		File file;			
62
		File file;			
62
		String key = GLAHelper.getAdapterPathKey(parserInput);
63
		String key = GLAHelper.getAdapterPathKey(parserInput);
63
		try {
64
		try {
64
			
65
 
65
			URLConnection connection = (new URL(fileURL)).openConnection();
66
			URLConnection connection = (new URL(fileURL)).openConnection();
67
			//fix for bugzilla 206260
68
			if(connection instanceof HttpURLConnection)
69
			{
70
				// Redirect a maximum of five times. This is a generally accepted check which makes sure that
71
				// multiple redirects are supported, but this is not infinite.
72
				for(int i =0; i < 5;i++)
73
				{
74
					int retCode = ((HttpURLConnection)connection).getResponseCode();
75
					if( retCode >= 300 && retCode < 400)
76
					{
77
						String location = connection.getHeaderField("location");
78
						connection = (new URL(location)).openConnection();
79
					}
80
					else
81
					{
82
						break;
83
					}
84
				}				
85
			}
86
			//end of fix for bugzilla 206260
66
			InputStream inputStream = connection.getInputStream();
87
			InputStream inputStream = connection.getInputStream();
67
			SimpleDateFormat format = new SimpleDateFormat("yyyymmddhhMMss");   //$NON-NLS-1$
88
			SimpleDateFormat format = new SimpleDateFormat("yyyymmddhhMMss");   //$NON-NLS-1$
68
	
89
	

Return to bug 206260