| author | xwu | 2012-02-07 03:55:44 (EST) |
|---|---|---|
| committer | xwu | 2012-02-07 04:00:09 (EST) |
| commit | fd76bcfb97d1b22b48b58e6170bbd555338f2aa3 (patch) (side-by-side diff) | |
| tree | b2e8b925df6caa8677c835eab5804f11b54e6d1a | |
| parent | 7749b805549fcb561a53f1609a12837a8ca14c5c (diff) | |
| download | org.eclipse.birt-fd76bcfb97d1b22b48b58e6170bbd555338f2aa3.zip org.eclipse.birt-fd76bcfb97d1b22b48b58e6170bbd555338f2aa3.tar.gz org.eclipse.birt-fd76bcfb97d1b22b48b58e6170bbd555338f2aa3.tar.bz2 | |
- Summary:
Fixed [Issue 47260] DTPUtil not encoding URI on linux correctly.
- Description of Issue:
DTPUtil not encoding URI on linux correctly.
- Description or Resolution:
Use the 4-arg constructor which internally handles the encoding issue
public URI(String scheme, String host, String path, String fragment)
instead of encoding input file location by our own.
- TED(s) Resolved:
[Issue 47260]
- Regression ( Yes/No ):
NO
- Code Owner Team:
Birt DTE
- Code Reviewers:
Bin Feng
- Project ID:
1577
- Manual Test Description:
Tested.
- Tests Automated Cases Executed:
None
- Special Notes:
None
| -rw-r--r-- | UI/org.eclipse.birt.report.designer.ui.data/src/org/eclipse/birt/report/designer/data/ui/util/DTPUtil.java | 46 |
1 files changed, 29 insertions, 17 deletions
diff --git a/UI/org.eclipse.birt.report.designer.ui.data/src/org/eclipse/birt/report/designer/data/ui/util/DTPUtil.java b/UI/org.eclipse.birt.report.designer.ui.data/src/org/eclipse/birt/report/designer/data/ui/util/DTPUtil.java index ec82607..e2105cf 100644 --- a/UI/org.eclipse.birt.report.designer.ui.data/src/org/eclipse/birt/report/designer/data/ui/util/DTPUtil.java +++ b/UI/org.eclipse.birt.report.designer.ui.data/src/org/eclipse/birt/report/designer/data/ui/util/DTPUtil.java @@ -416,18 +416,38 @@ public class DTPUtil .getReportDesignHandle( ); if ( handle != null ) { - return new URI( encode( handle.getResourceFolder( ) ) ); + String rscFolder = handle.getResourceFolder( ); + try + { + return new URI( rscFolder ); + } + catch ( URISyntaxException ex ) + { + return new URI( null, + null, + convertURI( rscFolder ), + null ); + } } } catch ( URISyntaxException e ) { + return null; } } try { - return new URI( encode( ReportPlugin.getDefault( ) + String rscFolder = ReportPlugin.getDefault( ) .getResourceFolder( getCurrentProject( ), - (ModuleHandle) null ) ) ); + (ModuleHandle) null ); + try + { + return new URI( rscFolder ); + } + catch ( URISyntaxException ex ) + { + return new URI( null, null, convertURI( rscFolder ), null ); + } } catch ( URISyntaxException e ) { @@ -435,6 +455,12 @@ public class DTPUtil } } + private static String convertURI( String fileURL ) + { + return fileURL.replace( '\\', '/' ); + } + + /** * Guarantee getting current project within the scope of UI thread. * @@ -466,20 +492,6 @@ public class DTPUtil return project[0]; } - private String encode( String location ) - { - try - { - return new File( location ).toURI( ) - .toASCIIString( ) - .replace( new File( "" ).toURI( ).toASCIIString( ), "" ); //$NON-NLS-1$//$NON-NLS-2$ - } - catch ( Exception e ) - { - return location; - } - } - /** * Create a DesignSessionRequest with the specified dataSetHandle * |

