Dorairaj M | 4 Feb 11:25 2015

[net] Unable to connect FTPS server

Hi,

Could not able to connect to FileCopa server by using commons-net-3.3 jar but connecting from FileZilla
FTP client.

When connecting to explicit FTPS from java client then output as

220-InterVations FileCOPA FTP Server Version 9.01 11th December 2014
Trial Version. 25 days remaining
220 while connect to Dhorrairaaj ftp server
AUTH TLS
224 Authenticating with TLS

When connecting to implicit FTPS from java client then output as

220-InterVations FileCOPA FTP Server Version 9.01 11th December 2014
Trial Version. 25 days remaining
220 while connect to Dhorrairaaj ftp server
USER clinapps
331 Password required for clinapps
PASS clinappsftp
500  is not understood

Can anybody please let me know the reason why unable to connect from commons-net-3.3 api,

protected void execAUTH() throws SSLException, IOException {
        int replyCode = sendCommand(CMD_AUTH, auth);
        if (FTPReply.SECURITY_MECHANISM_IS_OK == replyCode) {
            // replyCode = 334
            // I carry out an ADAT command.
(Continue reading)

Syed Mudassir | 3 Feb 21:20 2015
Picon

Apache common pooling 2

Guys,
  I have a question.
  I am using GenericKeyedObjectPool for pooling SFTP sessions.  Suppose I have one session in the pool.
  Can this session be shared among multiple threads at the same time?
  I mean suppose if there are four threads running parallely, can this session be used at the same time by all the four threads simultaneously?
  If it is possible, any sample code to get it done?
--
Peter Ashford | 2 Feb 04:35 2015
Picon

[exec] Can't kill process?

Hi there

I'm trying to use ExecuteWatchDog.destroyProcess() to kill a running
process but it doesn't seem to work.  I've pasted a minimal test case below
which shows what I'm trying to do: it creates a frame with a text area
which the process output is echoed to.  I've set it up so that ctrl + c
should kill the running process but it doesn't appear to work.

This test case changes directory to y:\ (my mapped drive where my mercurial
repository lives) and does a "hg log" which runs for a long time on my
machine, giving me time to kill the process).  If you wanted to run this
test, you'd have to choose a directory and long running process appropriate
for your machine.

I've confirmed that the break signal is being received - there's a write to
std.err in the code that executes correctly.

If anyone could help me with this, i'd really appreciate it!

Cheers!

Peter.

----------------

package jcon2;
import java.awt.Dimension;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.ScrollPaneConstants;
import javax.swing.UIManager;
import javax.swing.text.Document;
import org.apache.commons.exec.*;

public class Test implements KeyListener {
    JFrame    frame;
    JTextArea text;
    Document  textDoc;
    boolean   breakFlag   = false;
    boolean   execProcessRunning;
    File      currentDir  = new File("y:\\");
    BufferedOutputStream execIn;

    class JCStream extends OutputStream {
        public void write(int b) throws IOException {
            writeCon(new String(new byte[]{ (byte) b}));
            moveCaretToEnd();
        }
    }

    public Test(){
        frame = new JFrame("JCon2");
        text  = new JTextArea();
        textDoc = text.getDocument();
        JScrollPane scroller = new JScrollPane(text);

scroller.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
        frame.add(scroller);
        frame.setPreferredSize(new Dimension(600,800));
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        text.addKeyListener(this);
        frame.pack();
        frame.setVisible(true);
    }

    /**
     * Write to the console
     *  <at> param str The text to write
     */
    private void writeCon(String str){
        try {
            if(str != null && str.length()>0){
                textDoc.insertString(textDoc.getLength(), str, null);
            }
        } catch (Exception ex) {
            // ignore
        }
    }

    private void moveCaretToEnd(){
        text.setCaretPosition(text.getDocument().getLength());
    }

    private void processCommand(String cmd) {
        writeCon("\n");

        DefaultExecutor ex = new DefaultExecutor();
        CommandLine cmdLine;

        cmdLine = new CommandLine("cmd.exe");
        cmdLine.addArguments("/E:1900 /C " + cmd);

        new Thread(()-> {
                JCStream out = new JCStream();

                PumpStreamHandler streamHandler = new
PumpStreamHandler(out, out, System.in);
                ex.setStreamHandler(streamHandler);
                ex.setWorkingDirectory(currentDir);
                ex.setExitValues(null);
                breakFlag = false;

                ExecuteWatchdog watchDog = new
ExecuteWatchdog(ExecuteWatchdog.INFINITE_TIMEOUT);
                ex.setWatchdog(watchDog);

                new Thread(()->{
                    while(execProcessRunning){
                        if(breakFlag){
                            System.err.println("Break!");   // <<< this
happens on ctrl + c
                            watchDog.destroyProcess();      // <<< but
output to textarea isn't stopped
                            breakFlag = false;
                            return;
                        }
                        try {
                            Thread.sleep(50);
                        } catch (InterruptedException ex1) {
                            // ignore
                        }
                    }
                }).start();

                try {
                    execProcessRunning = true;
                    ex.execute(cmdLine);
                } catch (IOException ex1) {
                    // ignore
                }

                execProcessRunning = false;
                writeCon("\n");
            }
        ).start();
    }

    public void keyPressed(KeyEvent e) {
        int keyCode = e.getKeyCode();

        if(e.isControlDown() && keyCode == KeyEvent.VK_C){
            e.consume();
            breakFlag = true;
        }
    }
    public void keyTyped(KeyEvent e) {}
    public void keyReleased(KeyEvent e) {}

    public static void main(String[] args)  {
        try {

UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        } catch(Exception e){
            // don't care
        }

        Test t = new Test();
        t.processCommand("hg log");
    }
}
Wong, Nancy | 28 Jan 16:31 2015

[daemon] Problem using procrun for Java service

I have installed my java application as a Windows service using following:

prunsrv.exe //IS//SG_FileSync --Install="S:\Automation\prunsrv.exe" --Jvm=auto --Startup=auto
--StartMode jvm --Classpath="S:\Automation\SG_FileSync.jar" --StartClass=SyncFile --StartMethod=main

I can run the program successfully in console mode:

prunsrv.exe //TS//SG_FileSync

But I cannot start the service directly in Windows, or using prunsrv.exe //ES//SG_FileSync or via
prunmgr.  I get the following error message:

The system cannot find the file specified.  Failed to start service.

What am I able to run my application in console mode but not using ES?

Thanks,
Nancy

________________________________
The information contained in this message is intended only for the recipient, and may be a confidential
attorney-client communication or may otherwise be privileged and confidential and protected from
disclosure. If the reader of this message is not the intended recipient, or an employee or agent
responsible for delivering this message to the intended recipient, please be aware that any
dissemination or copying of this communication is strictly prohibited. If you have received this
communication in error, please immediately notify us by replying to the message and deleting it from your
computer. McGraw Hill Financial reserves the right, subject to applicable local law, to monitor, review
and process the content of any electronic message or information sent to or from McGraw Hill Financial
e-mail addresses without informing the sender or recipient of the message. By sending electronic
message or information to McGraw Hill Financial e-mail addresses you, as the sender, are consenting to
McGraw Hill Financial processing any of your personal data therein.
andrea antonello | 28 Jan 11:41 2015
Picon

[math] find an approximate curve for 3d points

Hello everyone,
I was wondering if there is a way to create an approximated curve in
3d given a set of xyz coordinates.
To make myself more clear with an example, lets assume I have the
center point of a tree section at different heights and I would like
to create curve representing the tree stem (give that trees tend to
bend in one direction and often have the top meters away from the
bottom).

Any advice if very appreciated.

Thanks a ton,
Andrea
Cuenca, Sergio | 27 Jan 13:56 2015

[dbcp] SQLException: Error preloading the connection pool after upgrade to commons-dbcp2

TITLE: SQLException: Error preloading the connection pool after upgrade to commons-dbcp2
ENVIRONTMENT:

  *   Windows XP
  *   Junit 4.11
  *   Java 1.7
  *   Spring 4.0
  *   maven-compiler-plugin 3.2
  *   maven.surefire.plugin 2.17
  *   maven-cobertura-plugin 2.6
  *   Jenkins 1.549
RELATED ISSUE: https://issues.apache.org/jira/browse/DBCP-431?filter=-2
DESCRIPTION:

Hi all,
We have a continuous integration environment (Jenkins) to launch our JUnits tests.
We had the version 1.4 of commons-dbcp to create the connection pools with Spring. The configuration was
the following:

<bean id="dataSourceTemplate" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
                  <property name="driverClassName"><value>${aplicacion.datasource.driverClassName}</value></property>
                  <property name="url"><value>${aplicacion.datasource.url}</value></property>
                  <property name="username"><value>${aplicacion.datasource.user}</value></property>
                  <property name="password"><value>${aplicacion.datasource.password}</value></property>
                  <property name="initialSize"><value>1</value></property>
                  <property name="maxActive"><value>15</value></property>
                  <property name="maxIdle"><value>2</value></property>
                  <property name="accessToUnderlyingConnectionAllowed"><value>${aplicacion.datasource.accessToUnderlyingConnectionAllowed}</value></property>
</bean>

We use JUnit 4.11 and maven cobertura plugin 1.6. to launch the tests.
This configuration was working CORRECTLY.
After upgrade to commons-dbcp2, version 2.0.1. Some unit tests are reporting errors with the following message:
java.sql.SQLException: Error preloading the connection pool.
We launch one unit test each time, one by one. We create and destroy the connection pool every time.
What can we do to solve this problem??

Thank you very much.

Sergio Cuenca Guirado
R&D Department
Logister, S.A. - GRIFOLS
Polígon Llevant
C/Palou, 6
08150 Parets del Vallès
Tel: + 34 93 571 02 78
Fax: + 34 93 571 02 94

P  Do you need to print this message? Let's protect the environment.

La información contenida en el presente e-mail es confidencial y está reservada para el uso exclusivo de
su destinatario. Se prohíbe estrictamente la distribución, copia o utilización de esta
información sin el previo permiso de su destinatario. Si usted no fuera el destinatario, por favor
notifíquelo inmediatamente al remitente y elimine el presente mensaje de su sistema informático.

Information contained in this e-mail is confidential and is intended for the use of the addressee only. Any
dissemination, distribution, copying or use of this communication without prior permission of the
addressee is strictly prohibited. If you are not the intended addressee, please notify the sender
immediately by reply and then delete this message from your computer system.
Tim Cronin | 22 Jan 17:42 2015

JSC 1.3 thread cleanup

I'm getting tomcat errors on shutdown:

2015-01-22 16:41:51,186 [localhost-startStop-2] ERROR
org.apache.catalina.loader.WebappClassLoader- The web application
[/api] appears to have started a thread named
[ElementEventQueue.QProcessor-1] but has failed to stop it. This is very l
ikely to create a memory leak.

i tracked it down to

org.apache.jcs.engine.control.CompositeCache:

    /**
     * EventQueue for handling element events. 1 should be enough for all
the regions. Else should
     * create as needed per region.
     */
    public static IElementEventQueue elementEventQ = new ElementEventQueue(
"AllRegionQueue" );

then calling CompositeCache.elementEventQ.destroy();

but it can be flaky and IMO should be handled via
CompositeCacheManager.shutdown().

is there a better way to handle this and do i need to file a bug on this?
Bernd | 20 Jan 18:26 2015
Picon

Commos Vfs2 release state

Hello Helder,

it is hard to say how long the release process will take - it depends on
how often votes will fail and what will be required to make them pass.

I am working on it and I think I can start the vote next month. I am
somehwat positive that we will manage a release this year :)

You can track the state here or on dev <at> commons mailing list.

https://wiki.apache.org/commons/VfsReleaseState

It is generally a good idea to do testing now, I do not plan to add any
more bugfixes (unless somebody sends a clean and simple patch which
includes tests).

Gruss

Bernd

*Von:* Hélder Sousa [mailto:htmsousa <at> gmail.com]
*Gesendet:* Dienstag, 20. Januar 2015 18:08
*An:* ecki <at> apache.org
*Betreff:* Commos Vfs2

Hi Bernd,

Any idea when the Commos Vfs2 version 2.1 will be released?
Thanks

Helder
Jan Swaelens | 16 Jan 17:12 2015
Picon

[JCS] Dynamic Cache Expiration on get

Hello,

I have a region set up to expire its data lets say after 60 seconds.
There's also a shrink thread running every 100 seconds.

We add an event handler when storing certain items, in this handler we
implement some logic to re-insert the expired item on the same key.

The problem is, when an item expires 'on get' the expiry handler fires
async and we can't get the updated value in the requesting thread.

Is it possible to act before the item is actually removed to take the
keep/toss away call instead of re-inserting it? Any other suggestions for
solving this pattern?

thanks
ntysdd | 14 Jan 14:25 2015
Picon

[math] About Math.round

Hi,
  I found Oracle has changed the specification of Math.round and
StrictMath.round.
  See http://bugs.java.com/bugdatabase/view_bug.do?bug_id=6430675
  These methods had surprising behavior for some values. (The bug
report didn't mention that, but these methods would fail also on large
integers. I believe Java 7 still have this bug.)
  Does commons math plan to change the behavior?
Benedikt Ritter | 14 Jan 11:25 2015
Picon

[ANNOUNCEMENT] Apache Commons Validator 1.4.1 released!

The Apache Commons Team is pleased to announce the release of Apache
Commons Validator 1.4.1.

Apache Commons Validator provides the building blocks for both client side
validation and server side data validation. It may be used standalone or
with a framework like Struts.

1.4.1 is fully binary compatible to the last release. No client code
changes are required to migrate from version 1.4 to 1.4.1. The minimum
required JDK version for this release is 1.4.

Source and binary distributions are available for download from the Apache
Commons download site:
  http://commons.apache.org/proper/commons-validator/download_validator.cgi

When downloading, please verify signatures using the KEYS file available at
the above location when downloading the release.

Alternatively the release can be pulled via maven:
<dependency>
  <groupId>commons-validator</groupId>
  <artifactId>commons-validator</artifactId>
  <version>1.4.1</version>
</dependency>

Full details of all the changes in 1.4.1 can be found in the changelog:
  http://commons.apache.org/proper/commons-validator/changes-report.html

For complete information on Commons Validator, including instructions on
how to submit bug reports, patches, or suggestions for improvement, see the
Apache Commons Validator website:

http://commons.apache.org/proper/commons-validator/

Benedikt Ritter,
on behalf of the Apache Commons community

--

-- 
http://people.apache.org/~britter/
http://www.systemoutprintln.de/
http://twitter.com/BenediktRitter
http://github.com/britter

Gmane