[jira] [Commented] (IO-354) Commons IO Tailer does not respect UTF-8 Charset

2012-10-27 Thread Gary Gregory (JIRA)

[ 
https://issues.apache.org/jira/browse/IO-354?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13485535#comment-13485535
 ] 

Gary Gregory commented on IO-354:
-

Feel free to provide a patch! :)

> Commons IO Tailer does not respect UTF-8 Charset
> 
>
> Key: IO-354
> URL: https://issues.apache.org/jira/browse/IO-354
> Project: Commons IO
>  Issue Type: Bug
>  Components: Utilities
>Affects Versions: 2.3
> Environment: JDK 7 
> RHEL Linux
> Apache Commons IO version 2.4
>Reporter: Liyu Yi
>  Labels: Charset, Encoding, Tailer
>
> I just realized there is a defect in the source code of 
> "org.apache.commons.io.input.Tailer.java". Basically, the current 
> implementation does not work for multi-byte encoded files. See the following 
> snippet,
> 448private long readLines(RandomAccessFile reader) throws IOException {
> 449StringBuilder sb = new StringBuilder();
> 450
> 451long pos = reader.getFilePointer();
> 452long rePos = pos; // position to re-read
> 453
> 454int num;
> 455boolean seenCR = false;
> 456while (run && ((num = reader.read(inbuf)) != -1)) {
> 457for (int i = 0; i < num; i++) {
> 458byte ch = inbuf[i];
> 459switch (ch) {
> 460case '\n':
> 461seenCR = false; // swallow CR before LF
> 462listener.handle(sb.toString());
> 463sb.setLength(0);
> 464rePos = pos + i + 1;
> 465break;
> 466case '\r':
> 467if (seenCR) {
> 468sb.append('\r');
> 469}
> 470seenCR = true;
> 471break;
> 472default:
> 473if (seenCR) {
> 474seenCR = false; // swallow final CR
> 475listener.handle(sb.toString());
> 476sb.setLength(0);
> 477rePos = pos + i + 1;
> 478}
> 479sb.append((char) ch); // add character, not its ascii 
> value
> 480}
> 481}
> 482
> 483pos = reader.getFilePointer();
> 484}
> 485
> 486reader.seek(rePos); // Ensure we can re-read if necessary
> 487return rePos;
> 488}
> At line 479, the conversion of byte to char type breaks the encoding.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Commented] (VFS-440) [SFTP] Stream (e.g. netcat) proxy for Sftp file system (aka ProxyCommand)

2012-10-27 Thread Gary Gregory (JIRA)

[ 
https://issues.apache.org/jira/browse/VFS-440?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13485533#comment-13485533
 ] 

Gary Gregory commented on VFS-440:
--

Patch v6 is missing SftpStreamProxy and therefore does not compile. The patch 
also changes PermissionsTests which previous versions did not touch IIRC. 
Please resubmit.

> [SFTP] Stream (e.g. netcat) proxy for Sftp file system (aka ProxyCommand)
> -
>
> Key: VFS-440
> URL: https://issues.apache.org/jira/browse/VFS-440
> Project: Commons VFS
>  Issue Type: Improvement
>Reporter: Benjamin Piwowarski
>Priority: Minor
>  Labels: proxy, sftp
> Attachments: sftp-stream-proxy.diff, sftp-stream-proxy-v2.diff, 
> sftp-stream-proxy-v3.diff, sftp-stream-proxy-v4.diff, 
> sftp-stream-proxy-v5.diff, sftp-stream-proxy-v6.diff
>
>
> What I propose is to add the possibility to connect to a remote SSH server 
> through an SSH connection stream (instead of an HTTP or SOCKS proxy). See for 
> instance
> http://backdrift.org/transparent-proxy-with-ssh
> for a use case.
> This simulates a ProxyCommand where the command is run on a SSH host.
> The patch also contains a test for the new functionality. 
> Example of use (with the netcat command nc -q 0 HOSTNAME PORT)
> {code:java}
> builder.setProxyType(opts, SftpFileSystemConfigBuilder.PROXY_STREAM);
> builder.setProxyCommand(opts, SftpStreamProxy.NETCAT_COMMAND);
> builder.setProxyHost(opts, "gate.way.host");
> builder.setProxyPort(opts, 22);
> builder.setProxyOptions(opts, proxyOptions);
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Updated] (MATH-883) "getSquareRoot" in "EigenDecomposition"

2012-10-27 Thread Gilles (JIRA)

 [ 
https://issues.apache.org/jira/browse/MATH-883?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Gilles updated MATH-883:


Attachment: MATH-883.patch

OK to apply the attached patch?

> "getSquareRoot" in "EigenDecomposition"
> ---
>
> Key: MATH-883
> URL: https://issues.apache.org/jira/browse/MATH-883
> Project: Commons Math
>  Issue Type: New Feature
>Reporter: Gilles
>Assignee: Gilles
>Priority: Minor
>  Labels: features
> Fix For: 3.1
>
> Attachments: MATH-883.patch
>
>
> I propose to add a method "getSquareRoot" in class "EigenDecomposition" 
> (package "o.a.c.m.linear").
> When assuming that the matrix is symmetric and positive definite, the 
> implementation is trivial (see ["By 
> diagonalisation"|http://en.wikipedia.org/wiki/Square_root_of_a_matrix]).
> I would also suggest that the "isSymmetric" method be moved from 
> "EigenDecomposition" to "MatrixUtils".

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Updated] (VFS-440) [SFTP] Stream (e.g. netcat) proxy for Sftp file system (aka ProxyCommand)

2012-10-27 Thread Benjamin Piwowarski (JIRA)

 [ 
https://issues.apache.org/jira/browse/VFS-440?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Benjamin Piwowarski updated VFS-440:


Attachment: sftp-stream-proxy-v6.diff

Patch v6 cleans up properly the tests by shutting down the SFtp server. I tried 
a better solution, but it seems that some resources (files) are freed much 
latter.

> [SFTP] Stream (e.g. netcat) proxy for Sftp file system (aka ProxyCommand)
> -
>
> Key: VFS-440
> URL: https://issues.apache.org/jira/browse/VFS-440
> Project: Commons VFS
>  Issue Type: Improvement
>Reporter: Benjamin Piwowarski
>Priority: Minor
>  Labels: proxy, sftp
> Attachments: sftp-stream-proxy.diff, sftp-stream-proxy-v2.diff, 
> sftp-stream-proxy-v3.diff, sftp-stream-proxy-v4.diff, 
> sftp-stream-proxy-v5.diff, sftp-stream-proxy-v6.diff
>
>
> What I propose is to add the possibility to connect to a remote SSH server 
> through an SSH connection stream (instead of an HTTP or SOCKS proxy). See for 
> instance
> http://backdrift.org/transparent-proxy-with-ssh
> for a use case.
> This simulates a ProxyCommand where the command is run on a SSH host.
> The patch also contains a test for the new functionality. 
> Example of use (with the netcat command nc -q 0 HOSTNAME PORT)
> {code:java}
> builder.setProxyType(opts, SftpFileSystemConfigBuilder.PROXY_STREAM);
> builder.setProxyCommand(opts, SftpStreamProxy.NETCAT_COMMAND);
> builder.setProxyHost(opts, "gate.way.host");
> builder.setProxyPort(opts, 22);
> builder.setProxyOptions(opts, proxyOptions);
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira