Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 85196 Details for
Bug 208778
[efs][api] RSEFileStore#getOutputStream() does not support EFS#APPEND
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Folding of isBinary into options
patch.txt (text/plain), 18.98 KB, created by
Kevin Doyle
on 2007-12-13 11:40:14 EST
(
hide
)
Description:
Folding of isBinary into options
Filename:
MIME Type:
Creator:
Kevin Doyle
Created:
2007-12-13 11:40:14 EST
Size:
18.98 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.rse.services.local >Index: src/org/eclipse/rse/internal/services/local/files/LocalFileService.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.services.local/src/org/eclipse/rse/internal/services/local/files/LocalFileService.java,v >retrieving revision 1.23 >diff -u -r1.23 LocalFileService.java >--- src/org/eclipse/rse/internal/services/local/files/LocalFileService.java 30 Nov 2007 20:39:46 -0000 1.23 >+++ src/org/eclipse/rse/internal/services/local/files/LocalFileService.java 13 Dec 2007 16:37:34 -0000 >@@ -1641,24 +1641,15 @@ > * @see org.eclipse.rse.services.files.AbstractFileService#getOutputStream(String, String, boolean, IProgressMonitor) > */ > public OutputStream getOutputStream(String remoteParent, String remoteFile, boolean isBinary, IProgressMonitor monitor) throws SystemMessageException { >- File file = new File(remoteParent, remoteFile); >- OutputStream stream = null; >- >- try { >- stream = new FileOutputStream(file); >- } >- catch (Exception e) { >- throw new RemoteFileIOException(e); >- } >- >- return stream; >+ int options = isBinary ? IFileService.NONE : IFileService.TEXT_MODE; >+ return getOutputStream(remoteParent, remoteFile, options, monitor); > } > > /* > * (non-Javadoc) > * @see org.eclipse.rse.services.files.AbstractFileService#getOutputStream(java.lang.String, java.lang.String, boolean, int, org.eclipse.core.runtime.IProgressMonitor) > */ >- public OutputStream getOutputStream(String remoteParent, String remoteFile, boolean isBinary, int options, IProgressMonitor monitor) throws SystemMessageException { >+ public OutputStream getOutputStream(String remoteParent, String remoteFile, int options, IProgressMonitor monitor) throws SystemMessageException { > File file = new File(remoteParent, remoteFile); > OutputStream stream = null; > >#P org.eclipse.rse.services.dstore >Index: src/org/eclipse/rse/internal/services/dstore/files/DStoreFileService.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/internal/services/dstore/files/DStoreFileService.java,v >retrieving revision 1.40 >diff -u -r1.40 DStoreFileService.java >--- src/org/eclipse/rse/internal/services/dstore/files/DStoreFileService.java 4 Dec 2007 17:49:02 -0000 1.40 >+++ src/org/eclipse/rse/internal/services/dstore/files/DStoreFileService.java 13 Dec 2007 16:37:35 -0000 >@@ -1963,28 +1963,16 @@ > * @see org.eclipse.rse.services.files.IFileService#getOutputStream(org.eclipse.core.runtime.IProgressMonitor, java.lang.String, java.lang.String, boolean) > */ > public OutputStream getOutputStream(String remoteParent, String remoteFile, boolean isBinary, IProgressMonitor monitor) throws SystemMessageException { >- String remotePath = remoteParent + getSeparator(remoteParent) + remoteFile; >- int mode; >- >- if (isBinary) >- { >- mode = IUniversalDataStoreConstants.BINARY_MODE; >- } >- else >- { >- mode = IUniversalDataStoreConstants.TEXT_MODE; >- } >- >- DStoreOutputStream outputStream = new DStoreOutputStream(getDataStore(), remotePath, getEncoding(monitor), mode, unixStyle, IFileService.NONE); >- return outputStream; >+ int options = isBinary ? IFileService.NONE : IFileService.TEXT_MODE; >+ return getOutputStream(remoteParent, remoteFile, options, monitor); > } > > >- public OutputStream getOutputStream(String remoteParent, String remoteFile, boolean isBinary, int options, IProgressMonitor monitor) throws SystemMessageException { >+ public OutputStream getOutputStream(String remoteParent, String remoteFile, int options, IProgressMonitor monitor) throws SystemMessageException { > String remotePath = remoteParent + getSeparator(remoteParent) + remoteFile; > int mode; > >- if (isBinary) >+ if ((options & IFileService.TEXT_MODE) == 0) > { > mode = IUniversalDataStoreConstants.BINARY_MODE; > } >#P org.eclipse.rse.efs >Index: src/org/eclipse/rse/internal/efs/RSEFileStoreImpl.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.efs/src/org/eclipse/rse/internal/efs/RSEFileStoreImpl.java,v >retrieving revision 1.10 >diff -u -r1.10 RSEFileStoreImpl.java >--- src/org/eclipse/rse/internal/efs/RSEFileStoreImpl.java 30 Nov 2007 20:39:42 -0000 1.10 >+++ src/org/eclipse/rse/internal/efs/RSEFileStoreImpl.java 13 Dec 2007 16:37:36 -0000 >@@ -678,7 +678,7 @@ > } else { > options = IFileService.NONE; > } >- return subSys.getOutputStream(remoteFile.getParentPath(), remoteFile.getName(), true, options, monitor); >+ return subSys.getOutputStream(remoteFile.getParentPath(), remoteFile.getName(), options, monitor); > } > catch (SystemMessageException e) { > throw new CoreException(new Status(IStatus.ERROR, >#P org.eclipse.rse.services >Index: src/org/eclipse/rse/services/files/AbstractFileService.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/files/AbstractFileService.java,v >retrieving revision 1.24 >diff -u -r1.24 AbstractFileService.java >--- src/org/eclipse/rse/services/files/AbstractFileService.java 6 Dec 2007 11:18:34 -0000 1.24 >+++ src/org/eclipse/rse/services/files/AbstractFileService.java 13 Dec 2007 16:37:36 -0000 >@@ -215,11 +215,12 @@ > * Gets the output stream to write/append to a remote file. > * The default implementation returns <code>null</code>. > * Clients can override to return an output stream to the file. >- * @see org.eclipse.rse.services.files.IFileService#getOutputStream(String, String, boolean, int, IProgressMonitor) >+ * @see org.eclipse.rse.services.files.IFileService#getOutputStream(String, String, int, IProgressMonitor) > */ >- public OutputStream getOutputStream(String remoteParent, String remoteFile, boolean isBinary, int options, IProgressMonitor monitor) throws SystemMessageException { >+ public OutputStream getOutputStream(String remoteParent, String remoteFile, int options, IProgressMonitor monitor) throws SystemMessageException { > if ((options & IFileService.APPEND) == 0) { > //forward to old deprecated implementation for backward compatibility with old services >+ boolean isBinary = (options & IFileService.TEXT_MODE) == 0 ? true : false; > return getOutputStream(remoteParent, remoteFile, isBinary, monitor); > } > return null; >Index: src/org/eclipse/rse/services/files/IFileService.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/files/IFileService.java,v >retrieving revision 1.25 >diff -u -r1.25 IFileService.java >--- src/org/eclipse/rse/services/files/IFileService.java 4 Dec 2007 17:48:53 -0000 1.25 >+++ src/org/eclipse/rse/services/files/IFileService.java 13 Dec 2007 16:37:36 -0000 >@@ -104,11 +104,19 @@ > * Options constant (value 1 <<0) for specifying a stream > * that will append data to a file. > * >- * @see IFileService#getOutputStream(String, String, boolean, int, IProgressMonitor) >+ * @see IFileService#getOutputStream(String, String, int, IProgressMonitor) > */ > public static final int APPEND = 1 << 0; > > /** >+ * Options constant (value 2 <<0) for specifying that a file >+ * is Text instead of the default Binary. >+ * >+ * @see IFileService#getOutputStream(String, String, int, IProgressMonitor) >+ */ >+ public static final int TEXT_MODE = 2 << 0; >+ >+ /** > * Options constant (value 0) to indicate that no bit options are set. > */ > public static final int NONE = 0; >@@ -470,7 +478,7 @@ > * @throws SystemMessageException if an error occurs. > * @since 2.0 > * @deprecated As of 3.0M4, replaced by >- * {@link #getOutputStream(String, String, boolean, int, IProgressMonitor)} >+ * {@link #getOutputStream(String, String, int, IProgressMonitor)} > */ > public OutputStream getOutputStream(String remoteParent, String remoteFile, boolean isBinary, IProgressMonitor monitor) throws SystemMessageException; > >@@ -478,14 +486,13 @@ > * Gets the output stream to write/append to a remote file. Clients should close the output stream when done. > * @param remoteParent the absolute path of the parent. > * @param remoteFile the name of the remote file. >- * @param isBinary <code>true</code> if the file is a binary file, <code>false</code> otherwise. >- * @param options bit wise or of option constants. Valid constants are {@link IFileService#APPEND} and {@link IFileService#NONE} >+ * @param options bit wise or of option constants. Valid constants are {@link IFileService#APPEND}, {@link IFileService#TEXT_MODE}, and {@link IFileService#NONE} > * @param monitor the progress monitor. > * @return the input stream to access the contents of the remote file. > * @throws SystemMessageException if an error occurs. > * @since 3.0 > */ >- public OutputStream getOutputStream(String remoteParent, String remoteFile, boolean isBinary, int options, IProgressMonitor monitor) throws SystemMessageException; >+ public OutputStream getOutputStream(String remoteParent, String remoteFile, int options, IProgressMonitor monitor) throws SystemMessageException; > > /** > * Indicates whether this file service supports code page conversion using >#P org.eclipse.rse.services.files.ftp >Index: src/org/eclipse/rse/internal/services/files/ftp/FTPService.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.services.files.ftp/src/org/eclipse/rse/internal/services/files/ftp/FTPService.java,v >retrieving revision 1.48 >diff -u -r1.48 FTPService.java >--- src/org/eclipse/rse/internal/services/files/ftp/FTPService.java 30 Nov 2007 20:40:06 -0000 1.48 >+++ src/org/eclipse/rse/internal/services/files/ftp/FTPService.java 13 Dec 2007 16:37:37 -0000 >@@ -1627,33 +1627,15 @@ > * @see org.eclipse.rse.services.files.AbstractFileService#getOutputStream(java.lang.String, java.lang.String, boolean, org.eclipse.core.runtime.IProgressMonitor) > */ > public OutputStream getOutputStream(String remoteParent, String remoteFile, boolean isBinary, IProgressMonitor monitor) throws SystemMessageException { >- remoteParent = checkEncoding(remoteParent); >- remoteFile = checkEncoding(remoteFile); >- >- if (monitor != null && monitor.isCanceled()){ >- throw new RemoteFileCancelledException(); >- } >- >- OutputStream stream = null; >- >- try { >- FTPClient ftpClient = cloneFTPClient(isBinary); >- clearCache(remoteParent); >- ftpClient.changeWorkingDirectory(remoteParent); >- stream = new FTPBufferedOutputStream(ftpClient.storeFileStream(remoteFile), ftpClient); >- } >- catch (Exception e) { >- throw new RemoteFileIOException(e); >- } >- >- return stream; >+ int options = isBinary ? IFileService.NONE : IFileService.TEXT_MODE; >+ return getOutputStream(remoteParent, remoteFile, options, monitor); > } > > /* > * (non-Javadoc) > * @see org.eclipse.rse.services.files.AbstractFileService#getOutputStream(java.lang.String, java.lang.String, boolean, int, org.eclipse.core.runtime.IProgressMonitor) > */ >- public OutputStream getOutputStream(String remoteParent, String remoteFile, boolean isBinary, int options, IProgressMonitor monitor) throws SystemMessageException { >+ public OutputStream getOutputStream(String remoteParent, String remoteFile, int options, IProgressMonitor monitor) throws SystemMessageException { > remoteParent = checkEncoding(remoteParent); > remoteFile = checkEncoding(remoteFile); > >@@ -1664,6 +1646,7 @@ > OutputStream stream = null; > > try { >+ boolean isBinary = (options & IFileService.TEXT_MODE) == 0 ? true : false; > FTPClient ftpClient = cloneFTPClient(isBinary); > clearCache(remoteParent); > ftpClient.changeWorkingDirectory(remoteParent); >#P org.eclipse.rse.subsystems.files.core >Index: src/org/eclipse/rse/subsystems/files/core/subsystems/IRemoteFileSubSystem.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/IRemoteFileSubSystem.java,v >retrieving revision 1.29 >diff -u -r1.29 IRemoteFileSubSystem.java >--- src/org/eclipse/rse/subsystems/files/core/subsystems/IRemoteFileSubSystem.java 4 Dec 2007 17:48:58 -0000 1.29 >+++ src/org/eclipse/rse/subsystems/files/core/subsystems/IRemoteFileSubSystem.java 13 Dec 2007 16:37:38 -0000 >@@ -660,7 +660,7 @@ > * @throws SystemMessageException if an error occurs. > * @since 2.0 > * @deprecated As of 3.0M4, replaced by >- * {@link #getOutputStream(String, String, boolean, int, IProgressMonitor)} >+ * {@link #getOutputStream(String, String, boolean, IProgressMonitor)} > */ > public OutputStream getOutputStream(String remoteParent, String remoteFile, boolean isBinary, IProgressMonitor monitor) throws SystemMessageException; > >@@ -668,14 +668,13 @@ > * Gets the output stream to write/append to a remote file. Clients should close the output stream when done. Implementations should not return <code>null</code>. > * @param remoteParent the absolute path of the parent. > * @param remoteFile the name of the remote file. >- * @param isBinary <code>true</code> if the file is a binary file, <code>false</code> otherwise. >- * @param options bit wise or of option constants. Valid constants are {@link IFileService#APPEND} and {@link IFileService#NONE} >+ * @param options bit wise or of option constants. Valid constants are {@link IFileService#APPEND}, {@link IFileService#TEXT_MODE}, and {@link IFileService#NONE} > * @return the input stream to access the contents of the remote file. > * @param monitor the progress monitor. > * @throws SystemMessageException if an error occurs. > * @since 3.0 > */ >- public OutputStream getOutputStream(String remoteParent, String remoteFile, boolean isBinary, int options, IProgressMonitor monitor) throws SystemMessageException; >+ public OutputStream getOutputStream(String remoteParent, String remoteFile, int options, IProgressMonitor monitor) throws SystemMessageException; > > /** > * Indicates whether this file subsystem supports code page conversion using >Index: src/org/eclipse/rse/subsystems/files/core/servicesubsystem/FileServiceSubSystem.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/servicesubsystem/FileServiceSubSystem.java,v >retrieving revision 1.57 >diff -u -r1.57 FileServiceSubSystem.java >--- src/org/eclipse/rse/subsystems/files/core/servicesubsystem/FileServiceSubSystem.java 4 Dec 2007 17:48:58 -0000 1.57 >+++ src/org/eclipse/rse/subsystems/files/core/servicesubsystem/FileServiceSubSystem.java 13 Dec 2007 16:37:38 -0000 >@@ -1030,8 +1030,8 @@ > return new FileSubSystemOutputStream(getFileService().getOutputStream(remoteParent, remoteFile, isBinary, monitor), remoteParent, remoteFile, this); > } > >- public OutputStream getOutputStream(String remoteParent, String remoteFile, boolean isBinary, int options, IProgressMonitor monitor) throws SystemMessageException { >- return new FileSubSystemOutputStream(getFileService().getOutputStream(remoteParent, remoteFile, isBinary, options, monitor), remoteParent, remoteFile, this); >+ public OutputStream getOutputStream(String remoteParent, String remoteFile, int options, IProgressMonitor monitor) throws SystemMessageException { >+ return new FileSubSystemOutputStream(getFileService().getOutputStream(remoteParent, remoteFile, options, monitor), remoteParent, remoteFile, this); > } > > /** >#P org.eclipse.rse.services.ssh >Index: src/org/eclipse/rse/internal/services/ssh/files/SftpFileService.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.services.ssh/src/org/eclipse/rse/internal/services/ssh/files/SftpFileService.java,v >retrieving revision 1.31 >diff -u -r1.31 SftpFileService.java >--- src/org/eclipse/rse/internal/services/ssh/files/SftpFileService.java 30 Nov 2007 21:05:23 -0000 1.31 >+++ src/org/eclipse/rse/internal/services/ssh/files/SftpFileService.java 13 Dec 2007 16:37:39 -0000 >@@ -1031,8 +1031,7 @@ > if (permNew != permOld) { > //getChannel("SftpFileService.setReadOnly").chmod(permNew, path); //$NON-NLS-1$ > attr.setPERMISSIONS(permNew); >- getChannel("SftpFileService.setReadOnly").setStat(recode(path), attr); //$NON-NLS-1$ >- ok=true; >+ getChannel("SftpFileService.setReadOnly").setStat(recode(path), attr); //$NON-NLS-1$ ok=true; > Activator.trace("SftpFileService.setReadOnly ok"); //$NON-NLS-1$ > } else { > ok=true; >@@ -1080,41 +1079,15 @@ > * @see org.eclipse.rse.services.files.AbstractFileService#getOutputStream(String, String, boolean, IProgressMonitor) > */ > public OutputStream getOutputStream(String remoteParent, String remoteFile, boolean isBinary, IProgressMonitor monitor) throws SystemMessageException { >- >- if (monitor == null) { >- monitor = new NullProgressMonitor(); >- } >- >- OutputStream stream = null; >- String dst = remoteParent; >- if (remoteFile!=null) { >- dst = concat(remoteParent, remoteFile); >- } >- >- try { >- SftpProgressMonitor sftpMonitor = new MyProgressMonitor(monitor); >- int mode = ChannelSftp.OVERWRITE; >- getChannel("SftpFileService.getOutputStream " + remoteFile); //check the session is healthy //$NON-NLS-1$ >- ChannelSftp channel = (ChannelSftp)fSessionProvider.getSession().openChannel("sftp"); //$NON-NLS-1$ >- channel.connect(); >- stream = new SftpBufferedOutputStream(channel.put(recodeSafe(dst), sftpMonitor, mode), channel); >- Activator.trace("SftpFileService.getOutputStream " + remoteFile + " ok"); //$NON-NLS-1$ //$NON-NLS-2$ >- } >- catch (Exception e) { >- Activator.trace("SftpFileService.getOutputStream " + dst + " failed: " + e.toString()); //$NON-NLS-1$ //$NON-NLS-2$ >- throw makeSystemMessageException(e); >- } >- if (monitor.isCanceled()) { >- throw new RemoteFileCancelledException(); >- } >- return stream; >+ int options = isBinary ? IFileService.NONE : IFileService.TEXT_MODE; >+ return getOutputStream(remoteParent, remoteFile, options, monitor); > } > > /* > * (non-Javadoc) > * @see org.eclipse.rse.services.files.AbstractFileService#getOutputStream(java.lang.String, java.lang.String, boolean, int, org.eclipse.core.runtime.IProgressMonitor) > */ >- public OutputStream getOutputStream(String remoteParent, String remoteFile, boolean isBinary, int options, IProgressMonitor monitor) throws SystemMessageException { >+ public OutputStream getOutputStream(String remoteParent, String remoteFile, int options, IProgressMonitor monitor) throws SystemMessageException { > > if (monitor == null) { > monitor = new NullProgressMonitor();
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 208778
: 85196