<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>user@commons.apache.org Archives</title>
<link rel="self" href="http://mail-archives.apache.org/mod_mbox/commons-user/?format=atom"/>
<link href="http://mail-archives.apache.org/mod_mbox/commons-user/"/>
<id>http://mail-archives.apache.org/mod_mbox/commons-user/</id>
<updated>2009-12-05T17:25:50Z</updated>
<entry>
<title>Re: Commons Codec: base64 &quot;strict&quot; mode?</title>
<author><name>Adam Rabung &lt;adamrabung@gmail.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/commons-user/200912.mbox/%3cd5eb7dbb0912041039na8ed75dia056f9eeeed90884@mail.gmail.com%3e"/>
<id>urn:uuid:%3cd5eb7dbb0912041039na8ed75dia056f9eeeed90884@mail-gmail-com%3e</id>
<updated>2009-12-04T18:39:47Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Interesting.  I would vote for raising an exception any time a
character is ignored.

With respect to my real problem - it absolutely is the client and not
Codec.  However, a strict mode would have saved me some time figuring
that out!

Thanks for all of the feedback.  BTW, I did log a bug for this:
https://issues.apache.org/jira/browse/CODEC-95


On Fri, Dec 4, 2009 at 1:11 PM, Julius Davies &lt;juliusdavies@gmail.com&gt; wrote:
&gt;&gt;
&gt;&gt; On Fri, Dec 4, 2009 at 10:24 AM, Adam Rabung &lt;adamrabung@gmail.com&gt; wrote:
&gt;&gt;&gt; Julius,
&gt;&gt;&gt; My particular problem was the client was not encoding url-safe, and
&gt;&gt;&gt; then sending over http.  The result was I was trying to decode " "
&gt;&gt;&gt; where the client had encoded "+" - so I wasn't get a "+" OR a "-".  A
&gt;&gt;&gt; strict Base64 would have caught this immediately.  I'm not very
&gt;&gt;&gt; familiar w/ the base 64 spec, so your #1 concerns me a little.  Would
&gt;&gt;&gt; it be reasonable for strict mode to reject "abc def", where that space
&gt;&gt;&gt; is literally ascii 32 space?
&gt;&gt;&gt;
&gt;
&gt;
&gt; I don't know if that would be reasonable!  I think this is the
&gt; pertinent info from the spec:
&gt; ---
&gt; In base64 data, characters other than (those in Table 1, line breaks,
&gt; and other white space) probably indicate a transmission error
&gt; ---
&gt;
&gt; I wouldn't vote against rejecting "abc def".  But I wouldn't vote for
&gt; it, either.
&gt;
&gt;
&gt; In your particular situation the real problem is probably a bug in
&gt; your client's code.  Maybe you can get your client to use the
&gt; commons-codec-1.4 Base64.encodeBase64URLSafe() method?
&gt;
&gt;
&gt; By the way, you may find this method useful:
&gt;
&gt; Base64.isArrayByteBase64()
&gt;
&gt; Unfortunately it treats whitespace as valid.
&gt;
&gt;
&gt;
&gt; --
&gt; yours,
&gt;
&gt; Julius Davies
&gt; 250-592-2284 (Home)
&gt; 250-893-4579 (Mobile)
&gt; http://juliusdavies.ca/logging.html
&gt;
&gt; ---------------------------------------------------------------------
&gt; To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
&gt; For additional commands, e-mail: user-help@commons.apache.org
&gt;
&gt;

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org



</pre>
</div>
</content>
</entry>
<entry>
<title>Re: Commons Codec: base64 &quot;strict&quot; mode?</title>
<author><name>Julius Davies &lt;juliusdavies@gmail.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/commons-user/200912.mbox/%3c598ad5b50912041011i608f0ecakd9806013e2928e9e@mail.gmail.com%3e"/>
<id>urn:uuid:%3c598ad5b50912041011i608f0ecakd9806013e2928e9e@mail-gmail-com%3e</id>
<updated>2009-12-04T18:11:36Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
&gt;
&gt; On Fri, Dec 4, 2009 at 10:24 AM, Adam Rabung &lt;adamrabung@gmail.com&gt; wrote:
&gt;&gt; Julius,
&gt;&gt; My particular problem was the client was not encoding url-safe, and
&gt;&gt; then sending over http.  The result was I was trying to decode " "
&gt;&gt; where the client had encoded "+" - so I wasn't get a "+" OR a "-".  A
&gt;&gt; strict Base64 would have caught this immediately.  I'm not very
&gt;&gt; familiar w/ the base 64 spec, so your #1 concerns me a little.  Would
&gt;&gt; it be reasonable for strict mode to reject "abc def", where that space
&gt;&gt; is literally ascii 32 space?
&gt;&gt;


I don't know if that would be reasonable!  I think this is the
pertinent info from the spec:
---
In base64 data, characters other than (those in Table 1, line breaks,
and other white space) probably indicate a transmission error
---

I wouldn't vote against rejecting "abc def".  But I wouldn't vote for
it, either.


In your particular situation the real problem is probably a bug in
your client's code.  Maybe you can get your client to use the
commons-codec-1.4 Base64.encodeBase64URLSafe() method?


By the way, you may find this method useful:

Base64.isArrayByteBase64()

Unfortunately it treats whitespace as valid.



-- 
yours,

Julius Davies
250-592-2284 (Home)
250-893-4579 (Mobile)
http://juliusdavies.ca/logging.html

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org



</pre>
</div>
</content>
</entry>
<entry>
<title>zip example on wiki</title>
<author><name>ChadDavis &lt;chadmichaeldavis@gmail.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/commons-user/200912.mbox/%3c4fe4c4f50912040913s39dd67daj4c95d6f15cb8b44e@mail.gmail.com%3e"/>
<id>urn:uuid:%3c4fe4c4f50912040913s39dd67daj4c95d6f15cb8b44e@mail-gmail-com%3e</id>
<updated>2009-12-04T17:13:36Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Here's the zip example from the wiki:

		final OutputStream out = new FileOutputStream("myfile.zip");
		ArchiveOutputStream os = new
ArchiveStreamFactory().createArchiveOutputStream("zip", out);

		os.putArchiveEntry(new ZipArchiveEntry("testdata/test1.xml"));
		IOUtils.copy(new FileInputStream(file1), os);
		os.closeArchiveEntry();

		os.putArchiveEntry(new ZipArchiveEntry("testdata/test2.xml"));
		IOUtils.copy(new FileInputStream(file2), os);
		os.closeArchiveEntry();
		
		out.finish();
		os.close();


Questions:

1) the second to last line, out.finish() -- there's no finish method
on an OutputStream.  Is this supposed to be calling the finish method
on the "os" stream, the ArchiveOutputStream I mean.

2) If so ( referring to question #1), why is this necessary?  The docs
make it sound as if finish() is only for when you want to stop and add
some more later . . .

3) Why is the output stream decalred as "final"?

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org



</pre>
</div>
</content>
</entry>
<entry>
<title>Creating Zip For Native Windows Archive Software</title>
<author><name>ChadDavis &lt;chadmichaeldavis@gmail.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/commons-user/200912.mbox/%3c4fe4c4f50912040855u51195c17qd1d31a89200f8062@mail.gmail.com%3e"/>
<id>urn:uuid:%3c4fe4c4f50912040855u51195c17qd1d31a89200f8062@mail-gmail-com%3e</id>
<updated>2009-12-04T16:55:20Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
The Compress page specifically mentions that Window's native
"compressed folders" feature has problems with zip's created in Java.
It mentions that this is due to encoding in UTF-8 and suggests that
you encode with the target encoding.  Here's what I'm reading on the
site:

"If Windows' "compressed folders" is your primary consumer, then your
best option is to explicitly set the encoding to the target platform.
You may want to enable creation of Unicode extra fields so the tools
that support them will extract the file names correctly."

So, I tried this, using cp1252, cp437, and latin1 -- none of which work.

What do I need to do to get the zip archive to show up on windows?

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org



</pre>
</div>
</content>
</entry>
<entry>
<title>Re: Commons Codec: base64 &quot;strict&quot; mode?</title>
<author><name>Paul Benedict &lt;pbenedict@apache.org&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/commons-user/200912.mbox/%3cb9e663070912040828y45b272a0ue70e2c1de0391598@mail.gmail.com%3e"/>
<id>urn:uuid:%3cb9e663070912040828y45b272a0ue70e2c1de0391598@mail-gmail-com%3e</id>
<updated>2009-12-04T16:28:51Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Adam,

Attach all patches to a JIRA ticket so your effort isn't lost. If one
doesn't exist, just go create it.

Paul

On Fri, Dec 4, 2009 at 10:24 AM, Adam Rabung &lt;adamrabung@gmail.com&gt; wrote:
&gt; Julius,
&gt; My particular problem was the client was not encoding url-safe, and
&gt; then sending over http.  The result was I was trying to decode " "
&gt; where the client had encoded "+" - so I wasn't get a "+" OR a "-".  A
&gt; strict Base64 would have caught this immediately.  I'm not very
&gt; familiar w/ the base 64 spec, so your #1 concerns me a little.  Would
&gt; it be reasonable for strict mode to reject "abc def", where that space
&gt; is literally ascii 32 space?
&gt;
&gt; Paul,
&gt; Sounds good.  It would be great if this ability were exposed to the
&gt; Base64 input/output streams as well.
&gt;
&gt; I threw together a quick patch (attached).  Not sure how much it will
&gt; really help, as I don't know much about the base 64 spec or Apache
&gt; coding guidelines (adding checked exceptions to existing methods?),
&gt; but it's a start.
&gt;
&gt; Thanks!
&gt; Adam
&gt;
&gt; On Thu, Dec 3, 2009 at 4:44 PM, Paul Benedict &lt;pbenedict@apache.org&gt; wrote:
&gt;&gt; Base64 could also be given a protected method that allows subclasses
&gt;&gt; to handle un-decodable characters. Default op is to do nothing.
&gt;&gt;
&gt;&gt; protected void handleBadChar(char[] c, int position, other-stuff );
&gt;&gt;
&gt;&gt; Paul
&gt;&gt;
&gt;&gt; On Thu, Dec 3, 2009 at 3:38 PM, Julius Davies &lt;juliusdavies@gmail.com&gt; wrote:
&gt;&gt;&gt; Hi, Adam,
&gt;&gt;&gt;
&gt;&gt;&gt; It doesn't currently do that.  Also, Base64 seamlessly decodes
&gt;&gt;&gt; URL_SAFE and REGULAR encodings, as well as mixes of the two, even
&gt;&gt;&gt; though a mix or URL_SAFE and REGULAR would technically be invalid.
&gt;&gt;&gt;
&gt;&gt;&gt; I'm not a committer, but I could certainly put together a patch for a
&gt;&gt;&gt; strict mode.  Something like this?
&gt;&gt;&gt;
&gt;&gt;&gt; 1.  If character is not whitespace, and is not valid, throw exception.
&gt;&gt;&gt;
&gt;&gt;&gt; 2.  If character is inappropriate for our current mode (URL_SAFE or
&gt;&gt;&gt; REGULAR), throw exception.
&gt;&gt;&gt;
&gt;&gt;&gt; 3.  Note:  Personally I think it's too much trouble to detect weird
&gt;&gt;&gt; things like === (technically only at most == should ever exist), or
&gt;&gt;&gt; characters after ==.  What do you think?
&gt;&gt;&gt;
&gt;&gt;&gt;
&gt;&gt;&gt; ps.  I'd probably do it as a subclass:  Base64Strict extends Base64
&gt;&gt;&gt;
&gt;&gt;&gt;
&gt;&gt;&gt; yours,
&gt;&gt;&gt;
&gt;&gt;&gt; Julius
&gt;&gt;&gt;
&gt;&gt;&gt;
&gt;&gt;&gt; On Thu, Dec 3, 2009 at 9:05 AM, Adam Rabung &lt;adamrabung@gmail.com&gt; wrote:
&gt;&gt;&gt;&gt; Hello,
&gt;&gt;&gt;&gt; Currently, Codec skips base64 characters that are outside of the
&gt;&gt;&gt;&gt; encode table.  I realize this is perfectly to spec, but I wonder if
&gt;&gt;&gt;&gt; other users might appreciate a "strict" mode that throws an exception
&gt;&gt;&gt;&gt; when one of these illegal characters are encountered.  For example, I
&gt;&gt;&gt;&gt; would love an exception to be thrown here:
&gt;&gt;&gt;&gt; new Base64().decode("!@#$ iHaveIllegalCharsAtBeginningAndEnd %^&amp;"));
&gt;&gt;&gt;&gt;
&gt;&gt;&gt;&gt; My apologies if I'm missing the point or if this functionality already exists,
&gt;&gt;&gt;&gt; Adam
&gt;&gt;&gt;&gt;
&gt;&gt;&gt;&gt; ---------------------------------------------------------------------
&gt;&gt;&gt;&gt; To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
&gt;&gt;&gt;&gt; For additional commands, e-mail: user-help@commons.apache.org
&gt;&gt;&gt;&gt;
&gt;&gt;&gt;&gt;
&gt;&gt;&gt;
&gt;&gt;&gt;
&gt;&gt;&gt;
&gt;&gt;&gt; --
&gt;&gt;&gt; yours,
&gt;&gt;&gt;
&gt;&gt;&gt; Julius Davies
&gt;&gt;&gt; 250-592-2284 (Home)
&gt;&gt;&gt; 250-893-4579 (Mobile)
&gt;&gt;&gt; http://juliusdavies.ca/logging.html
&gt;&gt;&gt;
&gt;&gt;&gt; ---------------------------------------------------------------------
&gt;&gt;&gt; To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
&gt;&gt;&gt; For additional commands, e-mail: user-help@commons.apache.org
&gt;&gt;&gt;
&gt;&gt;&gt;
&gt;&gt;
&gt;&gt; ---------------------------------------------------------------------
&gt;&gt; To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
&gt;&gt; For additional commands, e-mail: user-help@commons.apache.org
&gt;&gt;
&gt;&gt;
&gt;
&gt;
&gt; ---------------------------------------------------------------------
&gt; To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
&gt; For additional commands, e-mail: user-help@commons.apache.org
&gt;

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org



</pre>
</div>
</content>
</entry>
<entry>
<title>Re: Commons Codec: base64 &quot;strict&quot; mode?</title>
<author><name>Adam Rabung &lt;adamrabung@gmail.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/commons-user/200912.mbox/%3cd5eb7dbb0912040824h4362ff49q3e33cadfa0110997@mail.gmail.com%3e"/>
<id>urn:uuid:%3cd5eb7dbb0912040824h4362ff49q3e33cadfa0110997@mail-gmail-com%3e</id>
<updated>2009-12-04T16:24:52Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Julius,
My particular problem was the client was not encoding url-safe, and
then sending over http.  The result was I was trying to decode " "
where the client had encoded "+" - so I wasn't get a "+" OR a "-".  A
strict Base64 would have caught this immediately.  I'm not very
familiar w/ the base 64 spec, so your #1 concerns me a little.  Would
it be reasonable for strict mode to reject "abc def", where that space
is literally ascii 32 space?

Paul,
Sounds good.  It would be great if this ability were exposed to the
Base64 input/output streams as well.

I threw together a quick patch (attached).  Not sure how much it will
really help, as I don't know much about the base 64 spec or Apache
coding guidelines (adding checked exceptions to existing methods?),
but it's a start.

Thanks!
Adam

On Thu, Dec 3, 2009 at 4:44 PM, Paul Benedict &lt;pbenedict@apache.org&gt; wrote:
&gt; Base64 could also be given a protected method that allows subclasses
&gt; to handle un-decodable characters. Default op is to do nothing.
&gt;
&gt; protected void handleBadChar(char[] c, int position, other-stuff );
&gt;
&gt; Paul
&gt;
&gt; On Thu, Dec 3, 2009 at 3:38 PM, Julius Davies &lt;juliusdavies@gmail.com&gt; wrote:
&gt;&gt; Hi, Adam,
&gt;&gt;
&gt;&gt; It doesn't currently do that.  Also, Base64 seamlessly decodes
&gt;&gt; URL_SAFE and REGULAR encodings, as well as mixes of the two, even
&gt;&gt; though a mix or URL_SAFE and REGULAR would technically be invalid.
&gt;&gt;
&gt;&gt; I'm not a committer, but I could certainly put together a patch for a
&gt;&gt; strict mode.  Something like this?
&gt;&gt;
&gt;&gt; 1.  If character is not whitespace, and is not valid, throw exception.
&gt;&gt;
&gt;&gt; 2.  If character is inappropriate for our current mode (URL_SAFE or
&gt;&gt; REGULAR), throw exception.
&gt;&gt;
&gt;&gt; 3.  Note:  Personally I think it's too much trouble to detect weird
&gt;&gt; things like === (technically only at most == should ever exist), or
&gt;&gt; characters after ==.  What do you think?
&gt;&gt;
&gt;&gt;
&gt;&gt; ps.  I'd probably do it as a subclass:  Base64Strict extends Base64
&gt;&gt;
&gt;&gt;
&gt;&gt; yours,
&gt;&gt;
&gt;&gt; Julius
&gt;&gt;
&gt;&gt;
&gt;&gt; On Thu, Dec 3, 2009 at 9:05 AM, Adam Rabung &lt;adamrabung@gmail.com&gt; wrote:
&gt;&gt;&gt; Hello,
&gt;&gt;&gt; Currently, Codec skips base64 characters that are outside of the
&gt;&gt;&gt; encode table.  I realize this is perfectly to spec, but I wonder if
&gt;&gt;&gt; other users might appreciate a "strict" mode that throws an exception
&gt;&gt;&gt; when one of these illegal characters are encountered.  For example, I
&gt;&gt;&gt; would love an exception to be thrown here:
&gt;&gt;&gt; new Base64().decode("!@#$ iHaveIllegalCharsAtBeginningAndEnd %^&amp;"));
&gt;&gt;&gt;
&gt;&gt;&gt; My apologies if I'm missing the point or if this functionality already exists,
&gt;&gt;&gt; Adam
&gt;&gt;&gt;
&gt;&gt;&gt; ---------------------------------------------------------------------
&gt;&gt;&gt; To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
&gt;&gt;&gt; For additional commands, e-mail: user-help@commons.apache.org
&gt;&gt;&gt;
&gt;&gt;&gt;
&gt;&gt;
&gt;&gt;
&gt;&gt;
&gt;&gt; --
&gt;&gt; yours,
&gt;&gt;
&gt;&gt; Julius Davies
&gt;&gt; 250-592-2284 (Home)
&gt;&gt; 250-893-4579 (Mobile)
&gt;&gt; http://juliusdavies.ca/logging.html
&gt;&gt;
&gt;&gt; ---------------------------------------------------------------------
&gt;&gt; To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
&gt;&gt; For additional commands, e-mail: user-help@commons.apache.org
&gt;&gt;
&gt;&gt;
&gt;
&gt; ---------------------------------------------------------------------
&gt; To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
&gt; For additional commands, e-mail: user-help@commons.apache.org
&gt;
&gt;


</pre>
</div>
</content>
</entry>
<entry>
<title>RE: Commons-Compress tar entry name encoding</title>
<author><name>Martin Gainty &lt;mgainty@hotmail.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/commons-user/200912.mbox/%3cBLU142-W114155DD16850FB983897BAE930@phx.gbl%3e"/>
<id>urn:uuid:%3cBLU142-W114155DD16850FB983897BAE930@phx-gbl%3e</id>
<updated>2009-12-04T12:29:57Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>

you'll need to accomodate russian cyrillic characters in your java code, xml files and database
either that or stick with english

Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de dÃ©ni et de confidentialitÃ©
 
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten
wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist
unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet
keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen
wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut Ãªtre privilÃ©giÃ©. Si vous n'Ãªtes pas le destinataire
prÃ©vu, nous te demandons avec bontÃ© que pour satisfaire informez l'expÃ©diteur. N'importe
quelle diffusion non autorisÃ©e ou la copie de ceci est interdite. Ce message sert Ã  l'information
seulement et n'aura pas n'importe quel effet lÃ©galement obligatoire. Ã‰tant donnÃ© que les
email peuvent facilement Ãªtre sujets Ã  la manipulation, nous ne pouvons accepter aucune
responsabilitÃ© pour le contenu fourni.




&gt; Date: Fri, 4 Dec 2009 10:52:22 +0300
&gt; Subject: Commons-Compress tar entry name encoding
&gt; From: tezqatlipoca@gmail.com
&gt; To: user@commons.apache.org
&gt; 
&gt; Hellow,
&gt; 
&gt; May anyone help me? How can I create TarArchiveEntry with cyrillic name?
&gt; 
&gt; when i do that:
&gt; TarArchiveEntry entry = new TarArchiveEntry(name);
&gt; 
&gt; where name = "Ð½Ð°Ð¿Ñ€Ð¸Ð¼ÐµÑ€.doc"
&gt; 
&gt; in tar archive it represents as something like this: @&lt;h:@:@.doc
&gt; 
&gt; I have tried  to encode  entry name string to various encodings, but
&gt; in tar it represents as "????" or other symbols.
&gt; 
&gt; best regards,
&gt; anton kutergin
&gt; 
&gt; ---------------------------------------------------------------------
&gt; To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
&gt; For additional commands, e-mail: user-help@commons.apache.org
&gt; 
 		 	   		  
_________________________________________________________________
Windows Live Hotmail is faster and more secure than ever.
http://www.microsoft.com/windows/windowslive/hotmail_bl1/hotmail_bl1.aspx?ocid=PID23879::T:WLMTAGL:ON:WL:en-ww:WM_IMHM_1:092009
</pre>
</div>
</content>
</entry>
<entry>
<title>Re: Commons-Compress tar entry name encoding</title>
<author><name>Anton Kutergin &lt;tezqatlipoca@gmail.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/commons-user/200912.mbox/%3c7e7794a60912040256i671b5afbt9a9579d8543b2efd@mail.gmail.com%3e"/>
<id>urn:uuid:%3c7e7794a60912040256i671b5afbt9a9579d8543b2efd@mail-gmail-com%3e</id>
<updated>2009-12-04T10:56:32Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
&gt;
&gt; where name = "ÎÁÐÒÉÍÅÒ.doc"
&gt;
Sorry, name was written in cyrillic.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org



</pre>
</div>
</content>
</entry>
<entry>
<title>Re: problem uploading pdf file</title>
<author><name>=?ISO-8859-1?Q?Jaime_Mart=EDn?= &lt;jaime.martin@rbcdexia-is.es&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/commons-user/200912.mbox/%3c4B18D110.7010702@rbcdexia-is.es%3e"/>
<id>urn:uuid:%3c4B18D110-7010702@rbcdexia-is-es%3e</id>
<updated>2009-12-04T09:06:24Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Thank you very much for your answer I read that FAQ but I didn´t know that

request.getParameter()

caused the stream to be consumed ;-(

I removed that lines but I still receive no items.

My doPost is now :

 protected void doPost(HttpServletRequest request, HttpServletResponse
response)
  throws ServletException, IOException {
      String nomFichero ="";

      boolean isMultipart = ServletFileUpload.isMultipartContent(request);
            if(isMultipart) {
          // Create a factory for disk-based file items
          DiskFileItemFactory factory = new DiskFileItemFactory();
          // Set factory constraints
          factory.setSizeThreshold(1000000);
          File ff = new File("C:/firma-jmp.pdf");
          factory.setRepository(ff);
          // Create a new file upload handler
          ServletFileUpload upload = new ServletFileUpload(factory);
          // Set overall request size constraint
          upload.setSizeMax(10000000);
          upload.setHeaderEncoding("multipart/form-data");
     // Parse the request
          List&lt;FileItemitems;
          try {
              items = upload.parseRequest(request);&gt;
          for(FileItem item : items) {
                        if (item.isFormField()) {
              String name = item.getFieldName();
              String value = item.getString();
              System.out.println("name "+name);
              System.out.println("value "+value);
              String uploadFileName="D:/test/"+name ;
              File f = new File(uploadFileName);
              item.write(f);
          }
           }
          }
          catch (FileUploadException e) {
              e.printStackTrace();
          }
          catch (Exception e) {
              e.printStackTrace();
          }
      }
  }

any idea?



Martin Cooper escribió:
&gt; http://commons.apache.org/fileupload/faq.html#empty-parse
&gt;
&gt; Please read the very first FAQ item.
&gt;
&gt; This is at least one problem you have. Your call to
&gt; request.getParameter() causes the input stream to be consumed and
&gt; processed by the servlet container.
&gt;
&gt; --
&gt; Martin Cooper
&gt;
&gt;
&gt; 2009/12/3 Jaime Martín &lt;jaime.martin@rbcdexia-is.es&gt;:
&gt;   
&gt;&gt; Hi:
&gt;&gt; I´m using FileUpload 1.2.1 I want to upload a pdf file. As a first approach
&gt;&gt; I want to achieve this:
&gt;&gt; I have a file C:/firm-jmp.pdf and I want to upload it to
&gt;&gt; D:/test/firm-jmp.pdf
&gt;&gt;
&gt;&gt; On the one hand I invoke the servlet this way:
&gt;&gt;
&gt;&gt;   public String saveFile()
&gt;&gt;   {
&gt;&gt;       String fileName ="";
&gt;&gt;       try{
&gt;&gt;           fileName = "firm-jmp.pdf";
&gt;&gt;           String nombreFichero ="C:/".concat(fileName);
&gt;&gt;
&gt;&gt;           URL url = new URL("http://localhost:8080/FondvalCNMV/upload");
&gt;&gt;           URLConnection con = url.openConnection();
&gt;&gt;            // inform the connection that we will send output and accept
&gt;&gt; input
&gt;&gt;           con.setDoInput(true);
&gt;&gt;           con.setDoOutput(true);
&gt;&gt;
&gt;&gt;          // Don't use a cached version of URL connection.
&gt;&gt;          con.setUseCaches (false);
&gt;&gt;          con.setDefaultUseCaches (false);
&gt;&gt;
&gt;&gt;          con.setRequestProperty("Content-Type",
&gt;&gt; "multipart/form-data;boundary=---------------------------7d711d1020176");
&gt;&gt;                  // define a new PrintWriter on the output stream
&gt;&gt;          PrintWriter outWriter = new PrintWriter(con.getOutputStream());
&gt;&gt;
&gt;&gt;          // send data to the servlet
&gt;&gt;          outWriter.print("fileName="+nombreFichero);
&gt;&gt;                  outWriter.close();
&gt;&gt;                  InputStream input = con.getInputStream();
&gt;&gt;          File outputFile = new File(fileName);
&gt;&gt;          FileOutputStream out = new FileOutputStream(outputFile);
&gt;&gt;
&gt;&gt;          boolean eof = false;
&gt;&gt;          // read all bytes from the input and write them to the output
&gt;&gt;          while (!eof) {
&gt;&gt;              // read  the stream
&gt;&gt;            int byteValue = input.read();
&gt;&gt;            out.write(byteValue);
&gt;&gt;            if (byteValue  == -1)
&gt;&gt;              eof = true;
&gt;&gt;          }
&gt;&gt;          out.flush();
&gt;&gt;          out.close();
&gt;&gt;       }catch (Exception e) {
&gt;&gt;           e.printStackTrace();
&gt;&gt;           fileName ="";
&gt;&gt;       }
&gt;&gt;       return fileName;
&gt;&gt;   }
&gt;&gt;
&gt;&gt; On the other hand this is my servlet´s doPost.
&gt;&gt;
&gt;&gt;
&gt;&gt;   protected void doPost(HttpServletRequest request, HttpServletResponse
&gt;&gt; response)
&gt;&gt;   throws ServletException, IOException {
&gt;&gt;       String nomFichero ="";
&gt;&gt;       if (request.getParameter("firmaApoderado") != null) {
&gt;&gt;           nomFichero = request.getParameter("firmaApoderado");
&gt;&gt;           System.out.println("nomFichero"+nomFichero);
&gt;&gt;       }
&gt;&gt;       boolean isMultipart = ServletFileUpload.isMultipartContent(request);
&gt;&gt;             if(isMultipart) {
&gt;&gt;           // Create a factory for disk-based file items
&gt;&gt;           DiskFileItemFactory factory = new DiskFileItemFactory();
&gt;&gt;           // Set factory constraints
&gt;&gt;           factory.setSizeThreshold(1000000);
&gt;&gt;           File ff = new File("C:/firma-jmp.pdf");
&gt;&gt;           factory.setRepository(ff);
&gt;&gt;           // Create a new file upload handler
&gt;&gt;           ServletFileUpload upload = new ServletFileUpload(factory);
&gt;&gt;           // Set overall request size constraint
&gt;&gt;           upload.setSizeMax(10000000);
&gt;&gt;           upload.setHeaderEncoding("multipart/form-data");
&gt;&gt;      // Parse the request
&gt;&gt;           List&lt;FileItem&gt; items;
&gt;&gt;           try {
&gt;&gt;               items = upload.parseRequest(request);
&gt;&gt;
&gt;&gt;           for(FileItem item : items) {
&gt;&gt;                         if (item.isFormField()) {
&gt;&gt;               String name = item.getFieldName();
&gt;&gt;               String value = item.getString();
&gt;&gt;               System.out.println("name "+name);
&gt;&gt;               System.out.println("value "+value);
&gt;&gt;               String uploadFileName="D:/test/"+name ;
&gt;&gt;               File f = new File(uploadFileName);
&gt;&gt;               item.write(f);
&gt;&gt;           }
&gt;&gt;            }
&gt;&gt;           }
&gt;&gt;           catch (FileUploadException e) {
&gt;&gt;               e.printStackTrace();
&gt;&gt;           }
&gt;&gt;           catch (Exception e) {
&gt;&gt;               e.printStackTrace();
&gt;&gt;           }
&gt;&gt;       }
&gt;&gt;   }
&gt;&gt;
&gt;&gt; I have no error, the matter is that items = upload.parseRequest(request);
&gt;&gt; turns out to return no items, it seems that I receive no file in the
&gt;&gt; request.
&gt;&gt; I guess I´m doing something wrong as for my invocation.
&gt;&gt; thanks in advance!
&gt;&gt;
&gt;&gt; AVISO LEGAL
&gt;&gt; Este mensaje de correo electrónico y sus documentos adjuntos están dirigidos
&gt;&gt; exclusivamente a los destinatarios especificados. Puede contener información
&gt;&gt; confidencial o legalmente protegida. No hay renuncia a la confidencialidad o
&gt;&gt; privilegio por cualquier transmisión errónea. Si usted no es el destinatario
&gt;&gt; indicado, le rogamos que lo elimine y se lo comunique al remitente. No debe,
&gt;&gt; directa o indirectamente, usar, revelar, distribuir, imprimir o copiar
&gt;&gt; ninguna de las partes de este mensaje. Si siendo destinatario de este
&gt;&gt; mensaje no consintiera el uso de correo electrónico, rogamos nos lo
&gt;&gt; comunique inmediatamente.
&gt;&gt; RBCDexia Investor Services E,S.A. y sus filiales no serán responsables de
&gt;&gt; las
&gt;&gt; opiniones o informaciones incluidas en este mensaje salvo cuando el
&gt;&gt; remitente esté autorizado para establecer que dichas opiniones proceden de
&gt;&gt; RBCDexia Investor
&gt;&gt; Services ,S.A.  y sus filiales.
&gt;&gt;
&gt;&gt; DISCLAIMER
&gt;&gt; Addressee/s identified herein. It may contain confidential or legally
&gt;&gt; privileged information. No confidentiality privilege is waived or lost
&gt;&gt; by any mistransmission. If you are not the intended recipient, please
&gt;&gt; immediately delete it and notify the sender. You must not, directly or
&gt;&gt; indirectly, disclose, distribute, print, or copy any part of this message.
&gt;&gt; If you are the addressee of this message and do not consent to the use of
&gt;&gt; e-mail, please communicate it to us immediately. RBCDexia Investor Services
&gt;&gt; S.A. and its subsidiaries are not responsible for the opinions or
&gt;&gt; information
&gt;&gt; included in this message except when the sender is authorised to state them
&gt;&gt; to
&gt;&gt; be the views of RBCDexia Investor Services, S.A. and its subsidiaries.
&gt;&gt;
&gt;&gt; ---------------------------------------------------------------------
&gt;&gt; To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
&gt;&gt; For additional commands, e-mail: user-help@commons.apache.org
&gt;&gt;
&gt;&gt;
&gt;&gt;     
&gt;
&gt; ---------------------------------------------------------------------
&gt; To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
&gt; For additional commands, e-mail: user-help@commons.apache.org
&gt;
&gt;
&gt;   

-- 
*Jaime Martín Pérez*
Information Services

*RBC Dexia Investor Services* *España S.A.*
T (+34) 913 609 900
F (+34) 913 609 901
_*www.rbcdexia-is.com*_


AVISO LEGAL
Este mensaje de correo electrónico y sus documentos adjuntos están dirigidos
exclusivamente a los destinatarios especificados. Puede contener información
confidencial o legalmente protegida. No hay renuncia a la confidencialidad o
privilegio por cualquier transmisión errónea. Si usted no es el destinatario
indicado, le rogamos que lo elimine y se lo comunique al remitente. No debe,
directa o indirectamente, usar, revelar, distribuir, imprimir o copiar 
ninguna de las partes de este mensaje. Si siendo destinatario de este 
mensaje no consintiera el uso de correo electrónico, rogamos nos lo 
comunique inmediatamente.
RBCDexia Investor Services E,S.A. y sus filiales no serán responsables de las
opiniones o informaciones incluidas en este mensaje salvo cuando el remitente esté 
autorizado para establecer que dichas opiniones proceden de RBCDexia Investor
Services ,S.A.  y sus filiales.

DISCLAIMER
Addressee/s identified herein. It may contain confidential or legally 
privileged information. No confidentiality privilege is waived or lost
by any mistransmission. If you are not the intended recipient, please
immediately delete it and notify the sender. You must not, directly or
indirectly, disclose, distribute, print, or copy any part of this message.
If you are the addressee of this message and do not consent to the use of
e-mail, please communicate it to us immediately. RBCDexia Investor Services
S.A. and its subsidiaries are not responsible for the opinions or information
included in this message except when the sender is authorised to state them to
 be the views of RBCDexia Investor Services, S.A. and its subsidiaries.


</pre>
</div>
</content>
</entry>
<entry>
<title>Commons-Compress tar entry name encoding</title>
<author><name>Anton Kutergin &lt;tezqatlipoca@gmail.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/commons-user/200912.mbox/%3c7e7794a60912032352v4af17f4avc2402ed622a0f881@mail.gmail.com%3e"/>
<id>urn:uuid:%3c7e7794a60912032352v4af17f4avc2402ed622a0f881@mail-gmail-com%3e</id>
<updated>2009-12-04T07:52:22Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Hellow,

May anyone help me? How can I create TarArchiveEntry with cyrillic name?

when i do that:
TarArchiveEntry entry = new TarArchiveEntry(name);

where name = "ÎÁÐÒÉÍÅÒ.doc"

in tar archive it represents as something like this: @&lt;h:@:@.doc

I have tried  to encode  entry name string to various encodings, but
in tar it represents as "????" or other symbols.

best regards,
anton kutergin

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org



</pre>
</div>
</content>
</entry>
<entry>
<title>The exception of IllegalStateException  in TelnetInputStream</title>
<author><name>&quot;manan&quot; &lt;manan@gcrj.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/commons-user/200912.mbox/%3c30EBBDB2F8B29D4CA156ED881E27299A1E2AE8@gcexch2-c.LOCAL.GCRJ.COM%3e"/>
<id>urn:uuid:%3c30EBBDB2F8B29D4CA156ED881E27299A1E2AE8@gcexch2-c-LOCAL-GCRJ-COM%3e</id>
<updated>2009-12-04T00:40:06Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Hello 

  I am using Telnet library of common.net. And I got an exception 

in TelnetInputStream once in a while. 

 

The exception message was as following.

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

Exception in thread "Thread-9399" java.lang.IllegalStateException: Queue
is full! Cannot process another character.

        at
org.apache.commons.net.telnet.TelnetInputStream.__processChar(TelnetInpu
tStream.java:306)

        at
org.apache.commons.net.telnet.TelnetInputStream.run(TelnetInputStream.ja
va:596)

        at java.lang.Thread.run(Thread.java:619)

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

 

At first, I think it is possible that I didn't call read() in time to
read the data in TelnetInputStream so that the buffer

of TelnetInputStream overflowed. But then I wrote a simple program to
test it and I found that it is not the cause.

 

Then I studied the source of TelnetInputStream. The segment of function
__processChar is as following.

280
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#280&gt;      private void __processChar(int ch) throws
InterruptedException
281
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#281&gt;      {
282
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#282&gt;          // Critical section because we're
altering __bytesAvailable,
283
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#283&gt;          // __queueTail, and the contents of
_queue.
284
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#284&gt;          synchronized (__queue)
285
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#285&gt;          {
286
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#286&gt;              while (__bytesAvailable &gt;=
__queue.length - 1)
287
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#287&gt;              {
288
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#288&gt;                  // The queue is full. We need to
wait before adding any more data to it. Hopefully the stream owner
289
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#289&gt;                  // will consume some data soon! 
290
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#290&gt;                  if(__threaded)
291
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#291&gt;                  {
292
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#292&gt;                      __queue.notify();
293
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#293&gt;                      try
294
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#294&gt;                      {
295
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#295&gt;                          __queue.wait();
296
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#296&gt;                      }
297
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#297&gt;                      catch (InterruptedException
e)
298
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#298&gt;                      {
299
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#299&gt;                          throw e;
300
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#300&gt;                      }
301
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#301&gt;                  }
302
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#302&gt;                  else
303
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#303&gt;                  {
304
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#304&gt;                      // We've been asked to add
another character to the queue, but it is already full and there's
305
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#305&gt;                      // no other thread to drain
it. This should not have happened! 
306
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#306&gt;                      throw new
IllegalStateException("Queue is full! Cannot process another
character.");
307
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#307&gt;                  }
308
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#308&gt;              }
309
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#309&gt;  
310
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#310&gt;              // Need to do this in case we're not
full, but block on a read
311
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#311&gt;              if (__readIsWaiting &amp;&amp; __threaded)
312
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#312&gt;              {
313
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#313&gt;                  __queue.notify();
314
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#314&gt;              }
315
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#315&gt;  
316
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#316&gt;              __queue[__queueTail] = ch;
317
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#317&gt;              ++__bytesAvailable;
318
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#318&gt;  
319
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#319&gt;              if (++__queueTail &gt;= __queue.length)
320
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#320&gt;                  __queueTail = 0;
321
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#321&gt;          }
322
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#322&gt;      }

 

In line 306 the exception IllegalStateException is thrown. In this
condition, the variable __threaded should be false.

But I didn't call TelnetClient.setReaderThread
&lt;http://commons.apache.org/net/api/org/apache/commons/net/telnet/TelnetC
lient.html#setReaderThread%28boolean%29&gt;  to set it to false.

 

The __threaded is set to true in _start() of TelnetInputStream

84
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#84&gt;       void _start()
85
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#85&gt;       {
86
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#86&gt;           if(__thread == null)
87
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#87&gt;               return;
88
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#88&gt;   
89
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#89&gt;           int priority;
90
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#90&gt;           __isClosed = false;
91
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#91&gt;           // TODO remove this
92
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#92&gt;           // Need to set a higher priority in case
JVM does not use pre-emptive
93
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#93&gt;           // threads.  This should prevent
scheduler induced deadlock (rather than
94
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#94&gt;           // deadlock caused by a bug in this
code).
95
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#95&gt;           priority =
Thread.currentThread().getPriority() + 1;
96
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#96&gt;           if (priority &gt; Thread.MAX_PRIORITY)
97
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#97&gt;               priority = Thread.MAX_PRIORITY;
98
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#98&gt;           __thread.setPriority(priority);
99
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#99&gt;           __thread.setDaemon(true);
100
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#100&gt;          __thread.start();
101
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#101&gt;          __threaded = true;
102
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#102&gt;      }
 
I guess that is there a possibility that the thread in __thread.start()
is started so fast that when __processChar() is called, the __threaded
has not been set to true.
So the exception IllegalStateException is thrown.
I think line 101 should be moved up of line 100.

 



</pre>
</div>
</content>
</entry>
<entry>
<title>Re: Commons Codec: base64 &quot;strict&quot; mode?</title>
<author><name>Paul Benedict &lt;pbenedict@apache.org&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/commons-user/200912.mbox/%3cb9e663070912031344j6c32904cl4afd67aab85d5348@mail.gmail.com%3e"/>
<id>urn:uuid:%3cb9e663070912031344j6c32904cl4afd67aab85d5348@mail-gmail-com%3e</id>
<updated>2009-12-03T21:44:50Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Base64 could also be given a protected method that allows subclasses
to handle un-decodable characters. Default op is to do nothing.

protected void handleBadChar(char[] c, int position, other-stuff );

Paul

On Thu, Dec 3, 2009 at 3:38 PM, Julius Davies &lt;juliusdavies@gmail.com&gt; wrote:
&gt; Hi, Adam,
&gt;
&gt; It doesn't currently do that.  Also, Base64 seamlessly decodes
&gt; URL_SAFE and REGULAR encodings, as well as mixes of the two, even
&gt; though a mix or URL_SAFE and REGULAR would technically be invalid.
&gt;
&gt; I'm not a committer, but I could certainly put together a patch for a
&gt; strict mode.  Something like this?
&gt;
&gt; 1.  If character is not whitespace, and is not valid, throw exception.
&gt;
&gt; 2.  If character is inappropriate for our current mode (URL_SAFE or
&gt; REGULAR), throw exception.
&gt;
&gt; 3.  Note:  Personally I think it's too much trouble to detect weird
&gt; things like === (technically only at most == should ever exist), or
&gt; characters after ==.  What do you think?
&gt;
&gt;
&gt; ps.  I'd probably do it as a subclass:  Base64Strict extends Base64
&gt;
&gt;
&gt; yours,
&gt;
&gt; Julius
&gt;
&gt;
&gt; On Thu, Dec 3, 2009 at 9:05 AM, Adam Rabung &lt;adamrabung@gmail.com&gt; wrote:
&gt;&gt; Hello,
&gt;&gt; Currently, Codec skips base64 characters that are outside of the
&gt;&gt; encode table.  I realize this is perfectly to spec, but I wonder if
&gt;&gt; other users might appreciate a "strict" mode that throws an exception
&gt;&gt; when one of these illegal characters are encountered.  For example, I
&gt;&gt; would love an exception to be thrown here:
&gt;&gt; new Base64().decode("!@#$ iHaveIllegalCharsAtBeginningAndEnd %^&amp;"));
&gt;&gt;
&gt;&gt; My apologies if I'm missing the point or if this functionality already exists,
&gt;&gt; Adam
&gt;&gt;
&gt;&gt; ---------------------------------------------------------------------
&gt;&gt; To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
&gt;&gt; For additional commands, e-mail: user-help@commons.apache.org
&gt;&gt;
&gt;&gt;
&gt;
&gt;
&gt;
&gt; --
&gt; yours,
&gt;
&gt; Julius Davies
&gt; 250-592-2284 (Home)
&gt; 250-893-4579 (Mobile)
&gt; http://juliusdavies.ca/logging.html
&gt;
&gt; ---------------------------------------------------------------------
&gt; To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
&gt; For additional commands, e-mail: user-help@commons.apache.org
&gt;
&gt;

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org



</pre>
</div>
</content>
</entry>
<entry>
<title>Re: Commons Codec: base64 &quot;strict&quot; mode?</title>
<author><name>Julius Davies &lt;juliusdavies@gmail.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/commons-user/200912.mbox/%3c598ad5b50912031338s7d6767e1ked61a5467ce565f6@mail.gmail.com%3e"/>
<id>urn:uuid:%3c598ad5b50912031338s7d6767e1ked61a5467ce565f6@mail-gmail-com%3e</id>
<updated>2009-12-03T21:38:18Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Hi, Adam,

It doesn't currently do that.  Also, Base64 seamlessly decodes
URL_SAFE and REGULAR encodings, as well as mixes of the two, even
though a mix or URL_SAFE and REGULAR would technically be invalid.

I'm not a committer, but I could certainly put together a patch for a
strict mode.  Something like this?

1.  If character is not whitespace, and is not valid, throw exception.

2.  If character is inappropriate for our current mode (URL_SAFE or
REGULAR), throw exception.

3.  Note:  Personally I think it's too much trouble to detect weird
things like === (technically only at most == should ever exist), or
characters after ==.  What do you think?


ps.  I'd probably do it as a subclass:  Base64Strict extends Base64


yours,

Julius


On Thu, Dec 3, 2009 at 9:05 AM, Adam Rabung &lt;adamrabung@gmail.com&gt; wrote:
&gt; Hello,
&gt; Currently, Codec skips base64 characters that are outside of the
&gt; encode table.  I realize this is perfectly to spec, but I wonder if
&gt; other users might appreciate a "strict" mode that throws an exception
&gt; when one of these illegal characters are encountered.  For example, I
&gt; would love an exception to be thrown here:
&gt; new Base64().decode("!@#$ iHaveIllegalCharsAtBeginningAndEnd %^&amp;"));
&gt;
&gt; My apologies if I'm missing the point or if this functionality already exists,
&gt; Adam
&gt;
&gt; ---------------------------------------------------------------------
&gt; To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
&gt; For additional commands, e-mail: user-help@commons.apache.org
&gt;
&gt;



-- 
yours,

Julius Davies
250-592-2284 (Home)
250-893-4579 (Mobile)
http://juliusdavies.ca/logging.html

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org



</pre>
</div>
</content>
</entry>
<entry>
<title>Re: problem uploading pdf file</title>
<author><name>Martin Cooper &lt;martinc@apache.org&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/commons-user/200912.mbox/%3c16d6c6200912030951n697d7a2k563d051f8d3e65a8@mail.gmail.com%3e"/>
<id>urn:uuid:%3c16d6c6200912030951n697d7a2k563d051f8d3e65a8@mail-gmail-com%3e</id>
<updated>2009-12-03T17:51:55Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
http://commons.apache.org/fileupload/faq.html#empty-parse

Please read the very first FAQ item.

This is at least one problem you have. Your call to
request.getParameter() causes the input stream to be consumed and
processed by the servlet container.

--
Martin Cooper


2009/12/3 Jaime Martín &lt;jaime.martin@rbcdexia-is.es&gt;:
&gt; Hi:
&gt; I´m using FileUpload 1.2.1 I want to upload a pdf file. As a first approach
&gt; I want to achieve this:
&gt; I have a file C:/firm-jmp.pdf and I want to upload it to
&gt; D:/test/firm-jmp.pdf
&gt;
&gt; On the one hand I invoke the servlet this way:
&gt;
&gt;   public String saveFile()
&gt;   {
&gt;       String fileName ="";
&gt;       try{
&gt;           fileName = "firm-jmp.pdf";
&gt;           String nombreFichero ="C:/".concat(fileName);
&gt;
&gt;           URL url = new URL("http://localhost:8080/FondvalCNMV/upload");
&gt;           URLConnection con = url.openConnection();
&gt;            // inform the connection that we will send output and accept
&gt; input
&gt;           con.setDoInput(true);
&gt;           con.setDoOutput(true);
&gt;
&gt;          // Don't use a cached version of URL connection.
&gt;          con.setUseCaches (false);
&gt;          con.setDefaultUseCaches (false);
&gt;
&gt;          con.setRequestProperty("Content-Type",
&gt; "multipart/form-data;boundary=---------------------------7d711d1020176");
&gt;                  // define a new PrintWriter on the output stream
&gt;          PrintWriter outWriter = new PrintWriter(con.getOutputStream());
&gt;
&gt;          // send data to the servlet
&gt;          outWriter.print("fileName="+nombreFichero);
&gt;                  outWriter.close();
&gt;                  InputStream input = con.getInputStream();
&gt;          File outputFile = new File(fileName);
&gt;          FileOutputStream out = new FileOutputStream(outputFile);
&gt;
&gt;          boolean eof = false;
&gt;          // read all bytes from the input and write them to the output
&gt;          while (!eof) {
&gt;              // read  the stream
&gt;            int byteValue = input.read();
&gt;            out.write(byteValue);
&gt;            if (byteValue  == -1)
&gt;              eof = true;
&gt;          }
&gt;          out.flush();
&gt;          out.close();
&gt;       }catch (Exception e) {
&gt;           e.printStackTrace();
&gt;           fileName ="";
&gt;       }
&gt;       return fileName;
&gt;   }
&gt;
&gt; On the other hand this is my servlet´s doPost.
&gt;
&gt;
&gt;   protected void doPost(HttpServletRequest request, HttpServletResponse
&gt; response)
&gt;   throws ServletException, IOException {
&gt;       String nomFichero ="";
&gt;       if (request.getParameter("firmaApoderado") != null) {
&gt;           nomFichero = request.getParameter("firmaApoderado");
&gt;           System.out.println("nomFichero"+nomFichero);
&gt;       }
&gt;       boolean isMultipart = ServletFileUpload.isMultipartContent(request);
&gt;             if(isMultipart) {
&gt;           // Create a factory for disk-based file items
&gt;           DiskFileItemFactory factory = new DiskFileItemFactory();
&gt;           // Set factory constraints
&gt;           factory.setSizeThreshold(1000000);
&gt;           File ff = new File("C:/firma-jmp.pdf");
&gt;           factory.setRepository(ff);
&gt;           // Create a new file upload handler
&gt;           ServletFileUpload upload = new ServletFileUpload(factory);
&gt;           // Set overall request size constraint
&gt;           upload.setSizeMax(10000000);
&gt;           upload.setHeaderEncoding("multipart/form-data");
&gt;      // Parse the request
&gt;           List&lt;FileItem&gt; items;
&gt;           try {
&gt;               items = upload.parseRequest(request);
&gt;
&gt;           for(FileItem item : items) {
&gt;                         if (item.isFormField()) {
&gt;               String name = item.getFieldName();
&gt;               String value = item.getString();
&gt;               System.out.println("name "+name);
&gt;               System.out.println("value "+value);
&gt;               String uploadFileName="D:/test/"+name ;
&gt;               File f = new File(uploadFileName);
&gt;               item.write(f);
&gt;           }
&gt;            }
&gt;           }
&gt;           catch (FileUploadException e) {
&gt;               e.printStackTrace();
&gt;           }
&gt;           catch (Exception e) {
&gt;               e.printStackTrace();
&gt;           }
&gt;       }
&gt;   }
&gt;
&gt; I have no error, the matter is that items = upload.parseRequest(request);
&gt; turns out to return no items, it seems that I receive no file in the
&gt; request.
&gt; I guess I´m doing something wrong as for my invocation.
&gt; thanks in advance!
&gt;
&gt; AVISO LEGAL
&gt; Este mensaje de correo electrónico y sus documentos adjuntos están dirigidos
&gt; exclusivamente a los destinatarios especificados. Puede contener información
&gt; confidencial o legalmente protegida. No hay renuncia a la confidencialidad o
&gt; privilegio por cualquier transmisión errónea. Si usted no es el destinatario
&gt; indicado, le rogamos que lo elimine y se lo comunique al remitente. No debe,
&gt; directa o indirectamente, usar, revelar, distribuir, imprimir o copiar
&gt; ninguna de las partes de este mensaje. Si siendo destinatario de este
&gt; mensaje no consintiera el uso de correo electrónico, rogamos nos lo
&gt; comunique inmediatamente.
&gt; RBCDexia Investor Services E,S.A. y sus filiales no serán responsables de
&gt; las
&gt; opiniones o informaciones incluidas en este mensaje salvo cuando el
&gt; remitente esté autorizado para establecer que dichas opiniones proceden de
&gt; RBCDexia Investor
&gt; Services ,S.A.  y sus filiales.
&gt;
&gt; DISCLAIMER
&gt; Addressee/s identified herein. It may contain confidential or legally
&gt; privileged information. No confidentiality privilege is waived or lost
&gt; by any mistransmission. If you are not the intended recipient, please
&gt; immediately delete it and notify the sender. You must not, directly or
&gt; indirectly, disclose, distribute, print, or copy any part of this message.
&gt; If you are the addressee of this message and do not consent to the use of
&gt; e-mail, please communicate it to us immediately. RBCDexia Investor Services
&gt; S.A. and its subsidiaries are not responsible for the opinions or
&gt; information
&gt; included in this message except when the sender is authorised to state them
&gt; to
&gt; be the views of RBCDexia Investor Services, S.A. and its subsidiaries.
&gt;
&gt; ---------------------------------------------------------------------
&gt; To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
&gt; For additional commands, e-mail: user-help@commons.apache.org
&gt;
&gt;

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org



</pre>
</div>
</content>
</entry>
<entry>
<title>problem uploading pdf file</title>
<author><name>=?ISO-8859-1?Q?Jaime_Mart=EDn?= &lt;jaime.martin@rbcdexia-is.es&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/commons-user/200912.mbox/%3c4B17F897.20406@rbcdexia-is.es%3e"/>
<id>urn:uuid:%3c4B17F897-20406@rbcdexia-is-es%3e</id>
<updated>2009-12-03T17:42:47Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Hi:
I´m using FileUpload 1.2.1 I want to upload a pdf file. As a first 
approach I want to achieve this:
I have a file C:/firm-jmp.pdf and I want to upload it to 
D:/test/firm-jmp.pdf

On the one hand I invoke the servlet this way:

    public String saveFile()
    {
        String fileName ="";
        try{
            fileName = "firm-jmp.pdf";
            String nombreFichero ="C:/".concat(fileName);

            URL url = new URL("http://localhost:8080/FondvalCNMV/upload");
            URLConnection con = url.openConnection();
             // inform the connection that we will send output and 
accept input
            con.setDoInput(true);
            con.setDoOutput(true);

           // Don't use a cached version of URL connection.
           con.setUseCaches (false);
           con.setDefaultUseCaches (false);

           con.setRequestProperty("Content-Type", 
"multipart/form-data;boundary=---------------------------7d711d1020176");
          
           // define a new PrintWriter on the output stream
           PrintWriter outWriter = new PrintWriter(con.getOutputStream());

           // send data to the servlet
           outWriter.print("fileName="+nombreFichero);
          
           outWriter.close();
          
           InputStream input = con.getInputStream();
           File outputFile = new File(fileName);
           FileOutputStream out = new FileOutputStream(outputFile);

           boolean eof = false;
           // read all bytes from the input and write them to the output
           while (!eof) {
               // read  the stream
             int byteValue = input.read();
             out.write(byteValue);
             if (byteValue  == -1)
               eof = true;
           }
           out.flush();
           out.close();
        }catch (Exception e) {
            e.printStackTrace();
            fileName ="";
        }
        return fileName;
    }

On the other hand this is my servlet´s doPost.


    protected void doPost(HttpServletRequest request, 
HttpServletResponse response)
    throws ServletException, IOException {
        String nomFichero ="";
        if (request.getParameter("firmaApoderado") != null) {
            nomFichero = request.getParameter("firmaApoderado");
            System.out.println("nomFichero"+nomFichero);
        }
        boolean isMultipart = ServletFileUpload.isMultipartContent(request);
        
        if(isMultipart) {
            // Create a factory for disk-based file items
            DiskFileItemFactory factory = new DiskFileItemFactory();
            // Set factory constraints
            factory.setSizeThreshold(1000000);
            File ff = new File("C:/firma-jmp.pdf");
            factory.setRepository(ff);
            // Create a new file upload handler
            ServletFileUpload upload = new ServletFileUpload(factory);
            // Set overall request size constraint
            upload.setSizeMax(10000000);
            upload.setHeaderEncoding("multipart/form-data");
       // Parse the request
            List&lt;FileItem&gt; items;
            try {
                items = upload.parseRequest(request);

            for(FileItem item : items) {
               
            if (item.isFormField()) {
                String name = item.getFieldName();
                String value = item.getString();
                System.out.println("name "+name);
                System.out.println("value "+value);
                String uploadFileName="D:/test/"+name ;
                File f = new File(uploadFileName);
                item.write(f);
            }
             }
            }
            catch (FileUploadException e) {
                e.printStackTrace();
            }
            catch (Exception e) {
                e.printStackTrace();
            }                   
           

        }
    }

I have no error, the matter is that items = 
upload.parseRequest(request); turns out to return no items, it seems 
that I receive no file in the request.
I guess I´m doing something wrong as for my invocation.
thanks in advance!

AVISO LEGAL
Este mensaje de correo electrónico y sus documentos adjuntos están dirigidos
exclusivamente a los destinatarios especificados. Puede contener información
confidencial o legalmente protegida. No hay renuncia a la confidencialidad o
privilegio por cualquier transmisión errónea. Si usted no es el destinatario
indicado, le rogamos que lo elimine y se lo comunique al remitente. No debe,
directa o indirectamente, usar, revelar, distribuir, imprimir o copiar 
ninguna de las partes de este mensaje. Si siendo destinatario de este 
mensaje no consintiera el uso de correo electrónico, rogamos nos lo 
comunique inmediatamente.
RBCDexia Investor Services E,S.A. y sus filiales no serán responsables de las
opiniones o informaciones incluidas en este mensaje salvo cuando el remitente esté 
autorizado para establecer que dichas opiniones proceden de RBCDexia Investor
Services ,S.A.  y sus filiales.

DISCLAIMER
Addressee/s identified herein. It may contain confidential or legally 
privileged information. No confidentiality privilege is waived or lost
by any mistransmission. If you are not the intended recipient, please
immediately delete it and notify the sender. You must not, directly or
indirectly, disclose, distribute, print, or copy any part of this message.
If you are the addressee of this message and do not consent to the use of
e-mail, please communicate it to us immediately. RBCDexia Investor Services
S.A. and its subsidiaries are not responsible for the opinions or information
included in this message except when the sender is authorised to state them to
 be the views of RBCDexia Investor Services, S.A. and its subsidiaries.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org



</pre>
</div>
</content>
</entry>
<entry>
<title>Commons Codec: base64 &quot;strict&quot; mode?</title>
<author><name>Adam Rabung &lt;adamrabung@gmail.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/commons-user/200912.mbox/%3cd5eb7dbb0912030905n69a36bctbea9c5c27b131cb1@mail.gmail.com%3e"/>
<id>urn:uuid:%3cd5eb7dbb0912030905n69a36bctbea9c5c27b131cb1@mail-gmail-com%3e</id>
<updated>2009-12-03T17:05:21Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Hello,
Currently, Codec skips base64 characters that are outside of the
encode table.  I realize this is perfectly to spec, but I wonder if
other users might appreciate a "strict" mode that throws an exception
when one of these illegal characters are encountered.  For example, I
would love an exception to be thrown here:
new Base64().decode("!@#$ iHaveIllegalCharsAtBeginningAndEnd %^&amp;"));

My apologies if I'm missing the point or if this functionality already exists,
Adam

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org



</pre>
</div>
</content>
</entry>
<entry>
<title>Re: net, VxWorks parser?</title>
<author><name>Andreas Johansson &lt;fri.radikal@gmail.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/commons-user/200912.mbox/%3c1e789b420912030752r27dfb762p38ce69f9bfb2e1f5@mail.gmail.com%3e"/>
<id>urn:uuid:%3c1e789b420912030752r27dfb762p38ce69f9bfb2e1f5@mail-gmail-com%3e</id>
<updated>2009-12-03T15:52:17Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
I have updated the commons-net code to use the Unix parser
(UnixFTPEntryParser) to interpret the VxWorks file structure, and in
my limited tests it works fine. Does anyone see a problem with this
approach? If not I'll create a Jira issue including the patch.


Kind Regards
Andreas

2009/11/20 Andreas Johansson &lt;fri.radikal@gmail.com&gt;:
&gt; Hi,
&gt;
&gt; I'm using the commons-net library to connect to a VxWorks
&gt; FTP-server/OS and when doing so an
&gt; "org.apache.commons.net.ftp.parser.ParserInitializationException:
&gt; Unknown parser type: VxWorks OS(NT)
&gt; " exception is thrown. The problem is that
&gt; "org.apache.commons.net.ftp.parser.DefaultFTPFileEntryParserFactory"
&gt; does not have a parser for the VxWorks OS. Have anyone looked into
&gt; this? What is the best way to implement support for the VxWorks OS?
&gt; Any information is appreciated.
&gt;
&gt;
&gt; Kind Regards
&gt; Andreas
&gt;

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org



</pre>
</div>
</content>
</entry>
<entry>
<title>Re: commons-graph</title>
<author><name>Siegfried Goeschl &lt;siegfried.goeschl@it20one.at&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/commons-user/200912.mbox/%3c4B16D63B.6070009@it20one.at%3e"/>
<id>urn:uuid:%3c4B16D63B-6070009@it20one-at%3e</id>
<updated>2009-12-02T21:03:55Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Hi Weijan,

commons-graph is not maintained and did not make it into commons (I have
seen the source code somewhere) - therefore I'm using jgrapht
(http://jgrapht.sourceforge.net/) which is under LGPL

Cheers,

Siegfried Goeschl

Weijian Fang wrote:
&gt; Hi,
&gt;
&gt; Here (https://olex.openlogic.com/packages/commons-graph) says "Commons
&gt; Graph is now a defunct Apache commons project." And I can not find it
&gt; mentioned anywhere on apache commons website.
&gt;
&gt; Is commons-graph no more a desired component of apache commons? Any
&gt; alternatives recommended? Many thanks in advance!
&gt;
&gt; Cheers,
&gt;
&gt; Weijian
&gt;
&gt; ---------------------------------------------------------------------
&gt; To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
&gt; For additional commands, e-mail: user-help@commons.apache.org
&gt;
&gt;
&gt;
&gt;   

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org



</pre>
</div>
</content>
</entry>
<entry>
<title>Re: commons-graph</title>
<author><name>Ista Pouss &lt;istaous@gmail.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/commons-user/200912.mbox/%3c419ba5470912021244s77b1a901lb5b752134b2c5da3@mail.gmail.com%3e"/>
<id>urn:uuid:%3c419ba5470912021244s77b1a901lb5b752134b2c5da3@mail-gmail-com%3e</id>
<updated>2009-12-02T20:44:40Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
2009/12/2 Weijian Fang &lt;wf@ecs.soton.ac.uk&gt;:
&gt; Hi,
&gt;
&gt; Here (https://olex.openlogic.com/packages/commons-graph) says "Commons
&gt; Graph is now a defunct Apache commons project." And I can not find it
&gt; mentioned anywhere on apache commons website.
&gt;
&gt; Is commons-graph no more a desired component of apache commons? Any
&gt; alternatives recommended? Many thanks in advance!
&gt;

Perhaps http://xmlgraphics.apache.org/commons/ ?

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org



</pre>
</div>
</content>
</entry>
<entry>
<title>commons-graph</title>
<author><name>Weijian Fang &lt;wf@ecs.soton.ac.uk&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/commons-user/200912.mbox/%3c5d3b96380912020647g24b0fabfx86d5b2cf7cfd67ee@mail.gmail.com%3e"/>
<id>urn:uuid:%3c5d3b96380912020647g24b0fabfx86d5b2cf7cfd67ee@mail-gmail-com%3e</id>
<updated>2009-12-02T14:47:44Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Hi,

Here (https://olex.openlogic.com/packages/commons-graph) says "Commons
Graph is now a defunct Apache commons project." And I can not find it
mentioned anywhere on apache commons website.

Is commons-graph no more a desired component of apache commons? Any
alternatives recommended? Many thanks in advance!

Cheers,

Weijian

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org



</pre>
</div>
</content>
</entry>
<entry>
<title>Re: Determine if an object is in a list</title>
<author><name>Guy Rouillier &lt;guyr-ml1@burntmail.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/commons-user/200912.mbox/%3c4B15AA83.3050105@burntmail.com%3e"/>
<id>urn:uuid:%3c4B15AA83-3050105@burntmail-com%3e</id>
<updated>2009-12-01T23:45:07Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Brent Worden wrote:
&gt; On Mon, Nov 30, 2009 at 10:38 PM, Guy Rouillier &lt;guyr-ml1@burntmail.com&gt; wrote:
&gt;&gt; James Carman wrote:
&gt;&gt;&gt; It's not that hard to create your own predicate that does what you
&gt;&gt;&gt; want.  We did that for our project.  Here are the two classes we use
&gt;&gt;&gt; (the first one is a useful superclass for property value-based
&gt;&gt;&gt; predicates):
&gt;&gt; James, thank you.  This is indeed what I was looking for.  Mind if I include
&gt;&gt; your classes with a feature request? (with attribution, of course.)  I think
&gt;&gt; this is basic functionality that should be included with Commons
&gt;&gt; Collections.
&gt;&gt;
&gt; 
&gt; I think commons-beanutils has the predicate you need.
&gt; 
&gt; http://commons.apache.org/beanutils/v1.8.2/apidocs/org/apache/commons/beanutils/BeanPropertyValueEqualsPredicate.html
&gt; 

Brent, thanks, that is exactly what I want!  Complete with an example 
relevant to my need, no less.  Interesting that this one predicate is 
packaged with BeanUtils instead of Collections, since it depends 
completely on the Collections classes.  I would not have thought to look 
in BeanUtils for a Collections predicate, so I appreciate you pointing 
it out.

-- 
Guy Rouillier

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org



</pre>
</div>
</content>
</entry>
<entry>
<title>Re: Determine if an object is in a list</title>
<author><name>James Carman &lt;james@carmanconsulting.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/commons-user/200912.mbox/%3cf2e8eedf0912010757u6aa6af72y71ffcb5f768310d5@mail.gmail.com%3e"/>
<id>urn:uuid:%3cf2e8eedf0912010757u6aa6af72y71ffcb5f768310d5@mail-gmail-com%3e</id>
<updated>2009-12-01T15:57:45Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
I was looking for that.  It used to be in collections I believe.

On Tue, Dec 1, 2009 at 10:43 AM, Brent Worden &lt;brent.worden@gmail.com&gt; wrote:
&gt; On Mon, Nov 30, 2009 at 10:38 PM, Guy Rouillier &lt;guyr-ml1@burntmail.com&gt; wrote:
&gt;&gt; James Carman wrote:
&gt;&gt;&gt;
&gt;&gt;&gt; It's not that hard to create your own predicate that does what you
&gt;&gt;&gt; want.  We did that for our project.  Here are the two classes we use
&gt;&gt;&gt; (the first one is a useful superclass for property value-based
&gt;&gt;&gt; predicates):
&gt;&gt;
&gt;&gt; James, thank you.  This is indeed what I was looking for.  Mind if I include
&gt;&gt; your classes with a feature request? (with attribution, of course.)  I think
&gt;&gt; this is basic functionality that should be included with Commons
&gt;&gt; Collections.
&gt;&gt;
&gt;
&gt; I think commons-beanutils has the predicate you need.
&gt;
&gt; http://commons.apache.org/beanutils/v1.8.2/apidocs/org/apache/commons/beanutils/BeanPropertyValueEqualsPredicate.html
&gt;
&gt; Brent
&gt;
&gt; ---------------------------------------------------------------------
&gt; To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
&gt; For additional commands, e-mail: user-help@commons.apache.org
&gt;
&gt;

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org



</pre>
</div>
</content>
</entry>
<entry>
<title>Re: Determine if an object is in a list</title>
<author><name>Brent Worden &lt;brent.worden@gmail.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/commons-user/200912.mbox/%3cbb73f6570912010743v5ef5c365m54873caf9e37b0b8@mail.gmail.com%3e"/>
<id>urn:uuid:%3cbb73f6570912010743v5ef5c365m54873caf9e37b0b8@mail-gmail-com%3e</id>
<updated>2009-12-01T15:43:11Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
On Mon, Nov 30, 2009 at 10:38 PM, Guy Rouillier &lt;guyr-ml1@burntmail.com&gt; wrote:
&gt; James Carman wrote:
&gt;&gt;
&gt;&gt; It's not that hard to create your own predicate that does what you
&gt;&gt; want.  We did that for our project.  Here are the two classes we use
&gt;&gt; (the first one is a useful superclass for property value-based
&gt;&gt; predicates):
&gt;
&gt; James, thank you.  This is indeed what I was looking for.  Mind if I include
&gt; your classes with a feature request? (with attribution, of course.)  I think
&gt; this is basic functionality that should be included with Commons
&gt; Collections.
&gt;

I think commons-beanutils has the predicate you need.

http://commons.apache.org/beanutils/v1.8.2/apidocs/org/apache/commons/beanutils/BeanPropertyValueEqualsPredicate.html

Brent

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org



</pre>
</div>
</content>
</entry>
<entry>
<title>Re: Determine if an object is in a list</title>
<author><name>James Carman &lt;james@carmanconsulting.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/commons-user/200912.mbox/%3cf2e8eedf0911302056w6a211a2fuc1e2c05ec8bf189a@mail.gmail.com%3e"/>
<id>urn:uuid:%3cf2e8eedf0911302056w6a211a2fuc1e2c05ec8bf189a@mail-gmail-com%3e</id>
<updated>2009-12-01T04:56:46Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
I don't know if it would get through (I'd probably vote against it and
I'm the author).  We don't want to get to "beanutilsy" in collections.
 Collections only provides the framework.

On Mon, Nov 30, 2009 at 11:38 PM, Guy Rouillier &lt;guyr-ml1@burntmail.com&gt; wrote:
&gt; James Carman wrote:
&gt;&gt;
&gt;&gt; It's not that hard to create your own predicate that does what you
&gt;&gt; want.  We did that for our project.  Here are the two classes we use
&gt;&gt; (the first one is a useful superclass for property value-based
&gt;&gt; predicates):
&gt;
&gt; James, thank you.  This is indeed what I was looking for.  Mind if I include
&gt; your classes with a feature request? (with attribution, of course.)  I think
&gt; this is basic functionality that should be included with Commons
&gt; Collections.
&gt;
&gt;&gt;
&gt;&gt; public abstract class AbstractPropertyValuePredicate implements Predicate
&gt;&gt; {
&gt;&gt;
&gt;&gt;    private final String propertyName;
&gt;&gt;
&gt;&gt;    public AbstractPropertyValuePredicate (final String propertyName)  {
&gt;&gt;        this.propertyName = propertyName;
&gt;&gt;    }
&gt;&gt;
&gt;&gt;    public final boolean evaluate( Object o )
&gt;&gt;    {
&gt;&gt;        try
&gt;&gt;        {
&gt;&gt;            final Object propertyValue = PropertyUtils.getProperty( o,
&gt;&gt; propertyName );
&gt;&gt;            return evaluatePropertyValue(propertyValue);
&gt;&gt;        }
&gt;&gt;        catch( IllegalAccessException e )
&gt;&gt;        {
&gt;&gt;            throw new RuntimeException(e);
&gt;&gt;        }
&gt;&gt;        catch( InvocationTargetException e )
&gt;&gt;        {
&gt;&gt;            throw new RuntimeException(e);
&gt;&gt;        }
&gt;&gt;        catch( NoSuchMethodException e )
&gt;&gt;        {
&gt;&gt;            throw new RuntimeException(e);
&gt;&gt;        }
&gt;&gt;    }
&gt;&gt;
&gt;&gt;    protected abstract boolean evaluatePropertyValue(Object value);
&gt;&gt; }
&gt;&gt;
&gt;&gt; public class PropertyValuePredicate extends AbstractPropertyValuePredicate
&gt;&gt; {
&gt;&gt;    private final Object targetValue;
&gt;&gt;
&gt;&gt;    public PropertyValuePredicate (String propertyName, Object targetValue)
&gt;&gt; {
&gt;&gt;        super( propertyName );
&gt;&gt;        this.targetValue = targetValue;
&gt;&gt;    }
&gt;&gt;
&gt;&gt;    protected boolean evaluatePropertyValue( Object value )
&gt;&gt;    {
&gt;&gt;        return targetValue == value || (targetValue != null &amp;&amp;
&gt;&gt; targetValue.equals( value ));
&gt;&gt;    }
&gt;&gt; }
&gt;&gt; On Mon, Nov 30, 2009 at 10:37 PM, Guy Rouillier &lt;guyr-ml1@burntmail.com&gt;
&gt;&gt; wrote:
&gt;&gt;&gt;
&gt;&gt;&gt; I have a list of objects of class X.  X has a unique identifier property
&gt;&gt;&gt;  P.
&gt;&gt;&gt;  Given a value p, I want to see if the list contains an object where x.P
&gt;&gt;&gt; =
&gt;&gt;&gt; p.  Very simple, I ended up using a for loop to iterate over the objects
&gt;&gt;&gt; in
&gt;&gt;&gt; listX, breaking when I found the first occurrence.
&gt;&gt;&gt;
&gt;&gt;&gt; Before doing that, however, I tried to find something in Commons that
&gt;&gt;&gt; would
&gt;&gt;&gt; do this for me.  The closest I could find was
&gt;&gt;&gt; org.apache.commons.collections.CollectionUtils.find(java.util.Collection
&gt;&gt;&gt; collection, Predicate predicate).  However, I couldn't find a simple
&gt;&gt;&gt; PropertyPredicate that allowed me to say "look for objects whose property
&gt;&gt;&gt; P
&gt;&gt;&gt; is p".  That seems like one of the most obvious uses of find, so I
&gt;&gt;&gt; believe
&gt;&gt;&gt; I'm just not looking in the right place.
&gt;&gt;&gt;
&gt;&gt;&gt; I'd appreciate a pointer to where I can find this.  Thanks.
&gt;&gt;&gt;
&gt;&gt;&gt; --
&gt;&gt;&gt; Guy Rouillier
&gt;&gt;&gt;
&gt;&gt;&gt; ---------------------------------------------------------------------
&gt;&gt;&gt; To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
&gt;&gt;&gt; For additional commands, e-mail: user-help@commons.apache.org
&gt;&gt;&gt;
&gt;&gt;&gt;
&gt;&gt;
&gt;&gt; ---------------------------------------------------------------------
&gt;&gt; To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
&gt;&gt; For additional commands, e-mail: user-help@commons.apache.org
&gt;&gt;
&gt;&gt;
&gt;
&gt;
&gt; --
&gt; Guy Rouillier
&gt;
&gt; ---------------------------------------------------------------------
&gt; To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
&gt; For additional commands, e-mail: user-help@commons.apache.org
&gt;
&gt;

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org



</pre>
</div>
</content>
</entry>
<entry>
<title>Re: Determine if an object is in a list</title>
<author><name>Guy Rouillier &lt;guyr-ml1@burntmail.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/commons-user/200912.mbox/%3c4B149DCD.4000805@burntmail.com%3e"/>
<id>urn:uuid:%3c4B149DCD-4000805@burntmail-com%3e</id>
<updated>2009-12-01T04:38:37Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
James Carman wrote:
&gt; It's not that hard to create your own predicate that does what you
&gt; want.  We did that for our project.  Here are the two classes we use
&gt; (the first one is a useful superclass for property value-based
&gt; predicates):

James, thank you.  This is indeed what I was looking for.  Mind if I 
include your classes with a feature request? (with attribution, of 
course.)  I think this is basic functionality that should be included 
with Commons Collections.

&gt; 
&gt; public abstract class AbstractPropertyValuePredicate implements Predicate {
&gt; 
&gt;     private final String propertyName;
&gt; 
&gt;     public AbstractPropertyValuePredicate (final String propertyName)  {
&gt;         this.propertyName = propertyName;
&gt;     }
&gt; 
&gt;     public final boolean evaluate( Object o )
&gt;     {
&gt;         try
&gt;         {
&gt;             final Object propertyValue = PropertyUtils.getProperty( o,
&gt; propertyName );
&gt;             return evaluatePropertyValue(propertyValue);
&gt;         }
&gt;         catch( IllegalAccessException e )
&gt;         {
&gt;             throw new RuntimeException(e);
&gt;         }
&gt;         catch( InvocationTargetException e )
&gt;         {
&gt;             throw new RuntimeException(e);
&gt;         }
&gt;         catch( NoSuchMethodException e )
&gt;         {
&gt;             throw new RuntimeException(e);
&gt;         }
&gt;     }
&gt; 
&gt;     protected abstract boolean evaluatePropertyValue(Object value);
&gt; }
&gt; 
&gt; public class PropertyValuePredicate extends AbstractPropertyValuePredicate {
&gt;     private final Object targetValue;
&gt; 
&gt;     public PropertyValuePredicate (String propertyName, Object targetValue) {
&gt;         super( propertyName );
&gt;         this.targetValue = targetValue;
&gt;     }
&gt; 
&gt;     protected boolean evaluatePropertyValue( Object value )
&gt;     {
&gt;         return targetValue == value || (targetValue != null &amp;&amp;
&gt; targetValue.equals( value ));
&gt;     }
&gt; }
&gt; On Mon, Nov 30, 2009 at 10:37 PM, Guy Rouillier &lt;guyr-ml1@burntmail.com&gt; wrote:
&gt;&gt; I have a list of objects of class X.  X has a unique identifier property  P.
&gt;&gt;  Given a value p, I want to see if the list contains an object where x.P =
&gt;&gt; p.  Very simple, I ended up using a for loop to iterate over the objects in
&gt;&gt; listX, breaking when I found the first occurrence.
&gt;&gt;
&gt;&gt; Before doing that, however, I tried to find something in Commons that would
&gt;&gt; do this for me.  The closest I could find was
&gt;&gt; org.apache.commons.collections.CollectionUtils.find(java.util.Collection
&gt;&gt; collection, Predicate predicate).  However, I couldn't find a simple
&gt;&gt; PropertyPredicate that allowed me to say "look for objects whose property P
&gt;&gt; is p".  That seems like one of the most obvious uses of find, so I believe
&gt;&gt; I'm just not looking in the right place.
&gt;&gt;
&gt;&gt; I'd appreciate a pointer to where I can find this.  Thanks.
&gt;&gt;
&gt;&gt; --
&gt;&gt; Guy Rouillier
&gt;&gt;
&gt;&gt; ---------------------------------------------------------------------
&gt;&gt; To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
&gt;&gt; For additional commands, e-mail: user-help@commons.apache.org
&gt;&gt;
&gt;&gt;
&gt; 
&gt; ---------------------------------------------------------------------
&gt; To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
&gt; For additional commands, e-mail: user-help@commons.apache.org
&gt; 
&gt; 


-- 
Guy Rouillier

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org



</pre>
</div>
</content>
</entry>
<entry>
<title>Re: Determine if an object is in a list</title>
<author><name>James Carman &lt;james@carmanconsulting.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/commons-user/200912.mbox/%3cf2e8eedf0911301950k7c4943cer4ae6b0a9453f6f3f@mail.gmail.com%3e"/>
<id>urn:uuid:%3cf2e8eedf0911301950k7c4943cer4ae6b0a9453f6f3f@mail-gmail-com%3e</id>
<updated>2009-12-01T03:50:35Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
It's not that hard to create your own predicate that does what you
want.  We did that for our project.  Here are the two classes we use
(the first one is a useful superclass for property value-based
predicates):

public abstract class AbstractPropertyValuePredicate implements Predicate {

    private final String propertyName;

    public AbstractPropertyValuePredicate (final String propertyName)  {
        this.propertyName = propertyName;
    }

    public final boolean evaluate( Object o )
    {
        try
        {
            final Object propertyValue = PropertyUtils.getProperty( o,
propertyName );
            return evaluatePropertyValue(propertyValue);
        }
        catch( IllegalAccessException e )
        {
            throw new RuntimeException(e);
        }
        catch( InvocationTargetException e )
        {
            throw new RuntimeException(e);
        }
        catch( NoSuchMethodException e )
        {
            throw new RuntimeException(e);
        }
    }

    protected abstract boolean evaluatePropertyValue(Object value);
}

public class PropertyValuePredicate extends AbstractPropertyValuePredicate {
    private final Object targetValue;

    public PropertyValuePredicate (String propertyName, Object targetValue) {
        super( propertyName );
        this.targetValue = targetValue;
    }

    protected boolean evaluatePropertyValue( Object value )
    {
        return targetValue == value || (targetValue != null &amp;&amp;
targetValue.equals( value ));
    }
}
On Mon, Nov 30, 2009 at 10:37 PM, Guy Rouillier &lt;guyr-ml1@burntmail.com&gt; wrote:
&gt; I have a list of objects of class X.  X has a unique identifier property  P.
&gt;  Given a value p, I want to see if the list contains an object where x.P =
&gt; p.  Very simple, I ended up using a for loop to iterate over the objects in
&gt; listX, breaking when I found the first occurrence.
&gt;
&gt; Before doing that, however, I tried to find something in Commons that would
&gt; do this for me.  The closest I could find was
&gt; org.apache.commons.collections.CollectionUtils.find(java.util.Collection
&gt; collection, Predicate predicate).  However, I couldn't find a simple
&gt; PropertyPredicate that allowed me to say "look for objects whose property P
&gt; is p".  That seems like one of the most obvious uses of find, so I believe
&gt; I'm just not looking in the right place.
&gt;
&gt; I'd appreciate a pointer to where I can find this.  Thanks.
&gt;
&gt; --
&gt; Guy Rouillier
&gt;
&gt; ---------------------------------------------------------------------
&gt; To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
&gt; For additional commands, e-mail: user-help@commons.apache.org
&gt;
&gt;

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org



</pre>
</div>
</content>
</entry>
<entry>
<title>Determine if an object is in a list</title>
<author><name>Guy Rouillier &lt;guyr-ml1@burntmail.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/commons-user/200912.mbox/%3c4B148F62.6070205@burntmail.com%3e"/>
<id>urn:uuid:%3c4B148F62-6070205@burntmail-com%3e</id>
<updated>2009-12-01T03:37:06Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
I have a list of objects of class X.  X has a unique identifier property 
  P.  Given a value p, I want to see if the list contains an object 
where x.P = p.  Very simple, I ended up using a for loop to iterate over 
the objects in listX, breaking when I found the first occurrence.

Before doing that, however, I tried to find something in Commons that 
would do this for me.  The closest I could find was 
org.apache.commons.collections.CollectionUtils.find(java.util.Collection 
collection, Predicate predicate).  However, I couldn't find a simple 
PropertyPredicate that allowed me to say "look for objects whose 
property P is p".  That seems like one of the most obvious uses of find, 
so I believe I'm just not looking in the right place.

I'd appreciate a pointer to where I can find this.  Thanks.

-- 
Guy Rouillier

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org



</pre>
</div>
</content>
</entry>
<entry>
<title>fileupload 5GB to 50GB</title>
<author><name>baeschtu baeschtu &lt;baeschtu@gmail.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/commons-user/200911.mbox/%3cac8dde840911300501g62e19fbfh1f2a23cc1e29d14d@mail.gmail.com%3e"/>
<id>urn:uuid:%3cac8dde840911300501g62e19fbfh1f2a23cc1e29d14d@mail-gmail-com%3e</id>
<updated>2009-11-30T13:01:11Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
I need a fileupload for very large files. 5GB to 50GB, I also need
functionality to continue aborted uploads.
Is http://commons.apache.org/fileupload the right choice for this?

tnx
Bast


</pre>
</div>
</content>
</entry>
<entry>
<title>[VFS]Cache Questions</title>
<author><name>rzo &lt;rzo@gmx.de&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/commons-user/200911.mbox/%3c4B1041B3.6010503@gmx.de%3e"/>
<id>urn:uuid:%3c4B1041B3-6010503@gmx-de%3e</id>
<updated>2009-11-27T21:16:35Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Hello,

is there a way to maintain the cache across sessions (that is jvm restart)
is there a way to confgure VFS so that files are reloaded to the cache 
only if their lastChangeTime are different ?

-- ron
http://yajsw.sourceforge.net

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org



</pre>
</div>
</content>
</entry>
<entry>
<title>The exception of IllegalStateException  in TelnetInputStream</title>
<author><name>&quot;manan&quot; &lt;manan@gcrj.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/commons-user/200911.mbox/%3c30EBBDB2F8B29D4CA156ED881E27299A1E2684@gcexch2-c.LOCAL.GCRJ.COM%3e"/>
<id>urn:uuid:%3c30EBBDB2F8B29D4CA156ED881E27299A1E2684@gcexch2-c-LOCAL-GCRJ-COM%3e</id>
<updated>2009-11-26T07:31:20Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Hello 

  I am using Telnet library of common.net. And I got an exception 

in TelnetInputStream once in a while. 

 

The exception message was as following.

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

Exception in thread "Thread-9399" java.lang.IllegalStateException: Queue
is full! Cannot process another character.

        at
org.apache.commons.net.telnet.TelnetInputStream.__processChar(TelnetInpu
tStream.java:306)

        at
org.apache.commons.net.telnet.TelnetInputStream.run(TelnetInputStream.ja
va:596)

        at java.lang.Thread.run(Thread.java:619)

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

 

At first, I think it is possible that I didn't call read() in time to
read the data in TelnetInputStream so that the buffer

of TelnetInputStream overflowed. But then I wrote a simple program to
test it and I found that it is not the cause.

 

Then I studied the source of TelnetInputStream. The segment of function
__processChar is as following.

280
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#280&gt;      private void __processChar(int ch) throws
InterruptedException
281
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#281&gt;      {
282
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#282&gt;          // Critical section because we're
altering __bytesAvailable,
283
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#283&gt;          // __queueTail, and the contents of
_queue.
284
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#284&gt;          synchronized (__queue)
285
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#285&gt;          {
286
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#286&gt;              while (__bytesAvailable &gt;=
__queue.length - 1)
287
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#287&gt;              {
288
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#288&gt;                  // The queue is full. We need to
wait before adding any more data to it. Hopefully the stream owner
289
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#289&gt;                  // will consume some data soon! 
290
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#290&gt;                  if(__threaded)
291
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#291&gt;                  {
292
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#292&gt;                      __queue.notify();
293
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#293&gt;                      try
294
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#294&gt;                      {
295
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#295&gt;                          __queue.wait();
296
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#296&gt;                      }
297
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#297&gt;                      catch (InterruptedException
e)
298
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#298&gt;                      {
299
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#299&gt;                          throw e;
300
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#300&gt;                      }
301
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#301&gt;                  }
302
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#302&gt;                  else
303
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#303&gt;                  {
304
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#304&gt;                      // We've been asked to add
another character to the queue, but it is already full and there's
305
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#305&gt;                      // no other thread to drain
it. This should not have happened! 
306
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#306&gt;                      throw new
IllegalStateException("Queue is full! Cannot process another
character.");
307
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#307&gt;                  }
308
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#308&gt;              }
309
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#309&gt;  
310
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#310&gt;              // Need to do this in case we're not
full, but block on a read
311
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#311&gt;              if (__readIsWaiting &amp;&amp; __threaded)
312
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#312&gt;              {
313
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#313&gt;                  __queue.notify();
314
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#314&gt;              }
315
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#315&gt;  
316
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#316&gt;              __queue[__queueTail] = ch;
317
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#317&gt;              ++__bytesAvailable;
318
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#318&gt;  
319
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#319&gt;              if (++__queueTail &gt;= __queue.length)
320
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#320&gt;                  __queueTail = 0;
321
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#321&gt;          }
322
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#322&gt;      }

 

In line 306 the exception IllegalStateException is thrown. In this
condition, the variable __threaded should be false.

But I didn't call TelnetClient.setReaderThread
&lt;http://commons.apache.org/net/api/org/apache/commons/net/telnet/TelnetC
lient.html#setReaderThread%28boolean%29&gt;  to set it to false.

 

The __threaded is set to true in _start() of TelnetInputStream

84
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#84&gt;       void _start()
85
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#85&gt;       {
86
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#86&gt;           if(__thread == null)
87
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#87&gt;               return;
88
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#88&gt;   
89
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#89&gt;           int priority;
90
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#90&gt;           __isClosed = false;
91
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#91&gt;           // TODO remove this
92
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#92&gt;           // Need to set a higher priority in case
JVM does not use pre-emptive
93
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#93&gt;           // threads.  This should prevent
scheduler induced deadlock (rather than
94
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#94&gt;           // deadlock caused by a bug in this
code).
95
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#95&gt;           priority =
Thread.currentThread().getPriority() + 1;
96
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#96&gt;           if (priority &gt; Thread.MAX_PRIORITY)
97
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#97&gt;               priority = Thread.MAX_PRIORITY;
98
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#98&gt;           __thread.setPriority(priority);
99
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#99&gt;           __thread.setDaemon(true);
100
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#100&gt;          __thread.start();
101
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#101&gt;          __threaded = true;
102
&lt;http://commons.apache.org/net/xref/org/apache/commons/net/telnet/Telnet
InputStream.html#102&gt;      }
 
I guess that is there a possibility that the thread in __thread.start()
is started so fast that when __processChar() is called, the __threaded
has not been set to true.
So the exception IllegalStateException is thrown.
I think line 101 should be moved up of line 100.

 



</pre>
</div>
</content>
</entry>
<entry>
<title>RE: [FILEUPLOAD] feasibility of using fileupload apache api without boundary</title>
<author><name>&lt;vishal.mestri@techprocess.co.in&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/commons-user/200911.mbox/%3cVSNLCHNFE0014iwYjr3000212f4@VSNLCHNFE001.VSNLXCHANGE.COM%3e"/>
<id>urn:uuid:%3cVSNLCHNFE0014iwYjr3000212f4@VSNLCHNFE001-VSNLXCHANGE-COM%3e</id>
<updated>2009-11-24T16:08:44Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Thanx martin,

But is there any other api which I can use to address this issue as per you
info..

-----Original Message-----
From: mfncooper@gmail.com [mailto:mfncooper@gmail.com] On Behalf Of Martin
Cooper
Sent: Tuesday, November 24, 2009 9:35 PM
To: Commons Users List
Subject: Re: [FILEUPLOAD] feasibility of using fileupload apache api without
boundary

The boundary is defined by RFC 1867, which is the spec that Commons
FileUpload implements. The RFC is linked to from the FileUpload home
page, which you referenced. I'd recommend reading that spec.

If you don't want the boundary for some reason (and I can't think of
any good reason for removing it), then you don't want Commons
FileUpload. You'll likely have to create your own protocol in place of
RFC 1867.

--
Martin Cooper


On Tue, Nov 24, 2009 at 7:57 AM,  &lt;vishal.mestri@techprocess.co.in&gt; wrote:
&gt; hi all,
&gt;
&gt; i am using file upload api for io operation to download files on server
&gt; using multipart/form-data.
&gt;
&gt; link given below:-
&gt;
&gt; http://commons.apache.org/fileupload
&gt;
&gt;
&gt;
&gt; If we are using normal html file for upload no issue, browser takes care
of
&gt; "boundary"...
&gt;
&gt;
&gt;
&gt; but if we write core java app to connect to filedownload app, we need to
set
&gt; "boundary" manually...
&gt;
&gt; I have set boundary manually,it works.But it does not work without
boundary.
&gt;
&gt;
&gt;
&gt; is it possible to download files without boundary?
&gt;
&gt; is there any other api which can do it?
&gt;
&gt;
&gt;
&gt; if I remove boundary from code it gives me error:
&gt;
&gt; org.apache.commons.fileupload.FileUploadException: the request was
rejected
&gt; because no multipart boundary was found
&gt;
&gt;
&gt;
&gt; my html code being used to connect to filedownload app:-
&gt;
&gt; -----------------------------
&gt;
&gt; &lt;html&gt;
&gt;
&gt; &lt;head&gt;
&gt;
&gt; &lt;script language="JavaScript"&gt;
&gt;
&gt; function show(){}
&gt;
&gt;  &lt;/script&gt;
&gt;
&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"&gt;
&gt;
&gt; &lt;title&gt;Insert title here&lt;/title&gt;
&gt;
&gt; &lt;/head&gt;
&gt;
&gt; &lt;body&gt;
&gt;
&gt; &lt;form AUTOCOMPLETE="off"  name="addFiles" method="post"
&gt; action="https://tpslvl0109:8443/FileDownload/pushFile"
&gt; enctype="multipart/form-data"&gt;
&gt;
&gt; username:&lt;input type=text name=username id=username
value="myusername"&gt;&lt;br&gt;
&gt;
&gt; password:&lt;input type=password name=password id=password
&gt; value="mypassword"&gt;&lt;br&gt;
&gt;
&gt; Input file1:&lt;input name="inputfile1" type="file" id="inputfile1"
&gt; size="55"&gt;&lt;br&gt;
&gt;
&gt; &lt;input type=submit name=submit value=submit onClick="show()" &gt;
&gt;
&gt; &lt;/form&gt;&lt;/body&gt;&lt;/html&gt;
&gt;
&gt; -----------------------------
&gt;
&gt; my core java client app used to connect to same filedownload app
&gt;
&gt; ---------------------------------
&gt;
&gt; import java.io.DataOutputStream;
&gt;
&gt; import java.io.File;
&gt;
&gt; import java.io.FileInputStream;
&gt;
&gt; import java.io.InputStream;
&gt;
&gt; import java.io.InputStreamReader;
&gt;
&gt; import java.io.Reader;
&gt;
&gt; import java.net.HttpURLConnection;
&gt;
&gt; import java.net.URL;
&gt;
&gt; import javax.net.ssl.HostnameVerifier;
&gt;
&gt; import javax.net.ssl.HttpsURLConnection;
&gt;
&gt; import javax.net.ssl.SSLContext;
&gt;
&gt; import javax.net.ssl.SSLSession;
&gt;
&gt; import javax.net.ssl.TrustManager;
&gt;
&gt; import javax.net.ssl.X509TrustManager;
&gt;
&gt;
&gt;
&gt; public class connect implements HostnameVerifier{
&gt;
&gt;      public connect(){}
&gt;
&gt;      public void try_connect(){
&gt;
&gt;      try {
&gt;
&gt;              String boundary =  "*****";
&gt;
&gt;            System.setProperty( "java.protocol.handler.pkgs" ,
&gt; "javax.net.ssl" );
&gt;
&gt;            java.security.Security.addProvider( new
&gt; com.sun.net.ssl.internal.ssl.Provider() );
&gt;
&gt;            TrustManager[] trustAllCerts = new TrustManager[] {
&gt;
&gt;                        new X509TrustManager(){
&gt;
&gt;                              public java.security.cert.X509Certificate[]
&gt; getAcceptedIssuers(){
&gt;
&gt;                                    return null;
&gt;
&gt;                              }
&gt;
&gt;                        public void checkClientTrusted(
&gt; java.security.cert.X509Certificate[] certs, String authType ) { }
&gt;
&gt;                              public void checkServerTrusted(
&gt; java.security.cert.X509Certificate[] certs, String authType ) { }
&gt;
&gt;                        }
&gt;
&gt;                  };
&gt;
&gt;            SSLContext sc = SSLContext.getInstance( "SSL" );
&gt;
&gt;            sc.init( null, trustAllCerts, new java.security.SecureRandom()
&gt; );
&gt;
&gt;            HttpsURLConnection.setDefaultSSLSocketFactory(
&gt; sc.getSocketFactory() );
&gt;
&gt;            URL url = new URL("https", "tpslvl0109", 8443,
&gt; "/FileDownload/pushFile");
&gt;
&gt;            System.out.println(url.getQuery());
&gt;
&gt;             HttpsURLConnection m_oHttpURLConnection =
 (HttpsURLConnection)
&gt; url.openConnection();
&gt;
&gt;            m_oHttpURLConnection.setDoInput( true );
&gt;
&gt;            m_oHttpURLConnection.setDoOutput( true );
&gt;
&gt;            m_oHttpURLConnection.setUseCaches( false );
&gt;
&gt;            m_oHttpURLConnection.setRequestProperty("Connection",
&gt; "Keep-Alive");
&gt;
&gt;            m_oHttpURLConnection.setRequestProperty( "Content-Type",
&gt; "multipart/form-data;boundary="+boundary );
&gt;
&gt;            m_oHttpURLConnection.setAllowUserInteraction( true );
&gt;
&gt;            m_oHttpURLConnection.setRequestMethod("POST");
&gt;
&gt;            m_oHttpURLConnection.setInstanceFollowRedirects( true );
&gt;
&gt;           ( ( HttpsURLConnection )( m_oHttpURLConnection )
&gt; ).setHostnameVerifier( this );
&gt;
&gt;
&gt;
&gt;          m_oHttpURLConnection.connect();
&gt;
&gt;          DataOutputStream dos = null;
&gt;
&gt;              String exsistingFileName =
&gt; "D:\\projects\\104-FileDownload\\TestFilefrom.txt";
&gt;
&gt;          String lineEnd = "\r\n";
&gt;
&gt;          String twoHyphens = "--";
&gt;
&gt;              dos = new DataOutputStream(
&gt; m_oHttpURLConnection.getOutputStream() );
&gt;
&gt;          dos.writeBytes(twoHyphens + boundary + lineEnd);
&gt;
&gt;                           dos.writeBytes("Content-Disposition: form-data;
&gt; name=username ;  " + lineEnd );
&gt;
&gt;                           dos.writeBytes(lineEnd);
&gt;
&gt;                           dos.writeBytes("myusername");
&gt;
&gt;                           dos.writeBytes(lineEnd);
&gt;
&gt;                           dos.writeBytes(twoHyphens + boundary + lineEnd);
&gt;
&gt;                           dos.writeBytes("Content-Disposition: form-data;
&gt; name=password ; " + lineEnd );
&gt;
&gt;                           dos.writeBytes(lineEnd);
&gt;
&gt;                           dos.writeBytes("mypassword");
&gt;
&gt;                           dos.writeBytes(lineEnd);
&gt;
&gt;
&gt;
&gt;                           dos.writeBytes(twoHyphens + boundary + lineEnd);
&gt;
&gt;                           dos.writeBytes("Content-Disposition: form-data;
&gt; name=\"upload\";"
&gt;
&gt;                              + " filename=\"" + exsistingFileName +"\"" +
&gt; lineEnd );
&gt;
&gt;                           dos.writeBytes(lineEnd);
&gt;
&gt;                           FileInputStream fileInputStream = new
&gt; FileInputStream( new
&gt;
&gt;                                                   File(exsistingFileName)
&gt; );
&gt;
&gt;                           int bytesRead, bytesAvailable, bufferSize;
&gt;
&gt;                                      byte[] buffer;int maxBufferSize =
&gt; 1*1024*1024;
&gt;
&gt;                           bytesAvailable = fileInputStream.available();
&gt;
&gt;                           bufferSize = Math.min(bytesAvailable,
&gt; maxBufferSize);
&gt;
&gt;                           buffer = new byte[bufferSize];
&gt;
&gt;                           bytesRead = fileInputStream.read(buffer, 0,
&gt; bufferSize);
&gt;
&gt;                           while (bytesRead &gt; 0)
&gt;
&gt;                           {
&gt;
&gt;                            dos.write(buffer, 0, bufferSize);
&gt;
&gt;                            bytesAvailable = fileInputStream.available();
&gt;
&gt;                            bufferSize = Math.min(bytesAvailable,
&gt; maxBufferSize);
&gt;
&gt;                            bytesRead = fileInputStream.read(buffer, 0,
&gt; bufferSize);
&gt;
&gt;                           }
&gt;
&gt;                           dos.writeBytes(lineEnd);
&gt;
&gt;                           dos.writeBytes(twoHyphens + boundary +
twoHyphens
&gt; + lineEnd);
&gt;
&gt;                           fileInputStream.close();
&gt;
&gt;                           dos.flush();
&gt;
&gt;                           dos.close();
&gt;
&gt;          System.out.println("It's Connected");
&gt;
&gt;         InputStream is = m_oHttpURLConnection.getInputStream (  ) ;
&gt;
&gt;      if  ( is == null )   {
&gt;
&gt;          throw new Exception ( "Got a null content object!" ) ;
&gt;
&gt;       }
&gt;
&gt;      StringBuffer putBackTogether = new StringBuffer (  ) ;
&gt;
&gt;      Reader r = new InputStreamReader ( is, "UTF-8" ) ;
&gt;
&gt;      char [  ]  cb = new char [ 2048 ] ;
&gt;
&gt;      int amtRead = r.read ( cb ) ;
&gt;
&gt;      while  ( amtRead  &gt;  0 )   {
&gt;
&gt;          putBackTogether.append ( cb, 0, amtRead ) ;
&gt;
&gt;          amtRead = r.read ( cb ) ;
&gt;
&gt;       }
&gt;
&gt;      String pageSource = putBackTogether.toString (  ) ;
&gt;
&gt;      System.out.println(pageSource);
&gt;
&gt;            } catch (Exception e){
&gt;
&gt;                  e.printStackTrace();
&gt;
&gt;            }
&gt;
&gt;      }
&gt;
&gt;
&gt;
&gt;      public boolean verify(String hostname, SSLSession session) {
&gt;
&gt;            return true;
&gt;
&gt;      }
&gt;
&gt;      public static void main(String[] args) {
&gt;
&gt;                        try{connect c=new connect();
&gt;
&gt;                        c.try_connect();}catch(Exception e){
&gt;
&gt;                                    e.printStackTrace(System.out);
&gt;
&gt; }}                      }
&gt;
&gt; ---------------------------------
&gt;
&gt;
&gt;
&gt; Disclaimer: ""Unless indicated otherwise, the information contained in
this message is privileged and confidential, and is
&gt; intended only for the use of the addressee(s) named above and others who
have been specifically authorized to receive it.
&gt; If you are not the intended recipient, you are hereby notified that any
dissemination, distribution or copying of this
&gt; message and/or attachments is strictly prohibited. TechProcess Solutions
Ltd. accepts no liability for any damage caused by
&gt; any virus transmitted by this email. Furthermore, the company does not
warrant a proper and complete transmission of this
&gt; information, nor does it accept liability for any delays. If you have
received this message in error, please contact the
&gt; sender and delete the message. Thank you.""
&gt;
&gt;
&gt;

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org



Disclaimer: ""Unless indicated otherwise, the information contained in this message is privileged
and confidential, and is
intended only for the use of the addressee(s) named above and others who have been specifically
authorized to receive it. 
If you are not the intended recipient, you are hereby notified that any dissemination, distribution
or copying of this 
message and/or attachments is strictly prohibited. TechProcess Solutions Ltd. accepts no liability
for any damage caused by
any virus transmitted by this email. Furthermore, the company does not warrant a proper and
complete transmission of this
information, nor does it accept liability for any delays. If you have received this message
in error, please contact the
sender and delete the message. Thank you.""




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org



</pre>
</div>
</content>
</entry>
<entry>
<title>Re: [FILEUPLOAD] feasibility of using fileupload apache api without	boundary</title>
<author><name>Martin Cooper &lt;martinc@apache.org&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/commons-user/200911.mbox/%3c16d6c6200911240804v60ec8576v774e6be04e6c4090@mail.gmail.com%3e"/>
<id>urn:uuid:%3c16d6c6200911240804v60ec8576v774e6be04e6c4090@mail-gmail-com%3e</id>
<updated>2009-11-24T16:04:49Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
The boundary is defined by RFC 1867, which is the spec that Commons
FileUpload implements. The RFC is linked to from the FileUpload home
page, which you referenced. I'd recommend reading that spec.

If you don't want the boundary for some reason (and I can't think of
any good reason for removing it), then you don't want Commons
FileUpload. You'll likely have to create your own protocol in place of
RFC 1867.

--
Martin Cooper


On Tue, Nov 24, 2009 at 7:57 AM,  &lt;vishal.mestri@techprocess.co.in&gt; wrote:
&gt; hi all,
&gt;
&gt; i am using file upload api for io operation to download files on server
&gt; using multipart/form-data.
&gt;
&gt; link given below:-
&gt;
&gt; http://commons.apache.org/fileupload
&gt;
&gt;
&gt;
&gt; If we are using normal html file for upload no issue, browser takes care of
&gt; "boundary"...
&gt;
&gt;
&gt;
&gt; but if we write core java app to connect to filedownload app, we need to set
&gt; "boundary" manually...
&gt;
&gt; I have set boundary manually,it works.But it does not work without boundary.
&gt;
&gt;
&gt;
&gt; is it possible to download files without boundary?
&gt;
&gt; is there any other api which can do it?
&gt;
&gt;
&gt;
&gt; if I remove boundary from code it gives me error:
&gt;
&gt; org.apache.commons.fileupload.FileUploadException: the request was rejected
&gt; because no multipart boundary was found
&gt;
&gt;
&gt;
&gt; my html code being used to connect to filedownload app:-
&gt;
&gt; -----------------------------
&gt;
&gt; &lt;html&gt;
&gt;
&gt; &lt;head&gt;
&gt;
&gt; &lt;script language="JavaScript"&gt;
&gt;
&gt; function show(){}
&gt;
&gt;  &lt;/script&gt;
&gt;
&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"&gt;
&gt;
&gt; &lt;title&gt;Insert title here&lt;/title&gt;
&gt;
&gt; &lt;/head&gt;
&gt;
&gt; &lt;body&gt;
&gt;
&gt; &lt;form AUTOCOMPLETE="off"  name="addFiles" method="post"
&gt; action="https://tpslvl0109:8443/FileDownload/pushFile"
&gt; enctype="multipart/form-data"&gt;
&gt;
&gt; username:&lt;input type=text name=username id=username value="myusername"&gt;&lt;br&gt;
&gt;
&gt; password:&lt;input type=password name=password id=password
&gt; value="mypassword"&gt;&lt;br&gt;
&gt;
&gt; Input file1:&lt;input name="inputfile1" type="file" id="inputfile1"
&gt; size="55"&gt;&lt;br&gt;
&gt;
&gt; &lt;input type=submit name=submit value=submit onClick="show()" &gt;
&gt;
&gt; &lt;/form&gt;&lt;/body&gt;&lt;/html&gt;
&gt;
&gt; -----------------------------
&gt;
&gt; my core java client app used to connect to same filedownload app
&gt;
&gt; ---------------------------------
&gt;
&gt; import java.io.DataOutputStream;
&gt;
&gt; import java.io.File;
&gt;
&gt; import java.io.FileInputStream;
&gt;
&gt; import java.io.InputStream;
&gt;
&gt; import java.io.InputStreamReader;
&gt;
&gt; import java.io.Reader;
&gt;
&gt; import java.net.HttpURLConnection;
&gt;
&gt; import java.net.URL;
&gt;
&gt; import javax.net.ssl.HostnameVerifier;
&gt;
&gt; import javax.net.ssl.HttpsURLConnection;
&gt;
&gt; import javax.net.ssl.SSLContext;
&gt;
&gt; import javax.net.ssl.SSLSession;
&gt;
&gt; import javax.net.ssl.TrustManager;
&gt;
&gt; import javax.net.ssl.X509TrustManager;
&gt;
&gt;
&gt;
&gt; public class connect implements HostnameVerifier{
&gt;
&gt;      public connect(){}
&gt;
&gt;      public void try_connect(){
&gt;
&gt;      try {
&gt;
&gt;              String boundary =  "*****";
&gt;
&gt;            System.setProperty( "java.protocol.handler.pkgs" ,
&gt; "javax.net.ssl" );
&gt;
&gt;            java.security.Security.addProvider( new
&gt; com.sun.net.ssl.internal.ssl.Provider() );
&gt;
&gt;            TrustManager[] trustAllCerts = new TrustManager[] {
&gt;
&gt;                        new X509TrustManager(){
&gt;
&gt;                              public java.security.cert.X509Certificate[]
&gt; getAcceptedIssuers(){
&gt;
&gt;                                    return null;
&gt;
&gt;                              }
&gt;
&gt;                        public void checkClientTrusted(
&gt; java.security.cert.X509Certificate[] certs, String authType ) { }
&gt;
&gt;                              public void checkServerTrusted(
&gt; java.security.cert.X509Certificate[] certs, String authType ) { }
&gt;
&gt;                        }
&gt;
&gt;                  };
&gt;
&gt;            SSLContext sc = SSLContext.getInstance( "SSL" );
&gt;
&gt;            sc.init( null, trustAllCerts, new java.security.SecureRandom()
&gt; );
&gt;
&gt;            HttpsURLConnection.setDefaultSSLSocketFactory(
&gt; sc.getSocketFactory() );
&gt;
&gt;            URL url = new URL("https", "tpslvl0109", 8443,
&gt; "/FileDownload/pushFile");
&gt;
&gt;            System.out.println(url.getQuery());
&gt;
&gt;             HttpsURLConnection m_oHttpURLConnection =  (HttpsURLConnection)
&gt; url.openConnection();
&gt;
&gt;            m_oHttpURLConnection.setDoInput( true );
&gt;
&gt;            m_oHttpURLConnection.setDoOutput( true );
&gt;
&gt;            m_oHttpURLConnection.setUseCaches( false );
&gt;
&gt;            m_oHttpURLConnection.setRequestProperty("Connection",
&gt; "Keep-Alive");
&gt;
&gt;            m_oHttpURLConnection.setRequestProperty( "Content-Type",
&gt; "multipart/form-data;boundary="+boundary );
&gt;
&gt;            m_oHttpURLConnection.setAllowUserInteraction( true );
&gt;
&gt;            m_oHttpURLConnection.setRequestMethod("POST");
&gt;
&gt;            m_oHttpURLConnection.setInstanceFollowRedirects( true );
&gt;
&gt;           ( ( HttpsURLConnection )( m_oHttpURLConnection )
&gt; ).setHostnameVerifier( this );
&gt;
&gt;
&gt;
&gt;          m_oHttpURLConnection.connect();
&gt;
&gt;          DataOutputStream dos = null;
&gt;
&gt;              String exsistingFileName =
&gt; "D:\\projects\\104-FileDownload\\TestFilefrom.txt";
&gt;
&gt;          String lineEnd = "\r\n";
&gt;
&gt;          String twoHyphens = "--";
&gt;
&gt;              dos = new DataOutputStream(
&gt; m_oHttpURLConnection.getOutputStream() );
&gt;
&gt;          dos.writeBytes(twoHyphens + boundary + lineEnd);
&gt;
&gt;                           dos.writeBytes("Content-Disposition: form-data;
&gt; name=username ;  " + lineEnd );
&gt;
&gt;                           dos.writeBytes(lineEnd);
&gt;
&gt;                           dos.writeBytes("myusername");
&gt;
&gt;                           dos.writeBytes(lineEnd);
&gt;
&gt;                           dos.writeBytes(twoHyphens + boundary + lineEnd);
&gt;
&gt;                           dos.writeBytes("Content-Disposition: form-data;
&gt; name=password ; " + lineEnd );
&gt;
&gt;                           dos.writeBytes(lineEnd);
&gt;
&gt;                           dos.writeBytes("mypassword");
&gt;
&gt;                           dos.writeBytes(lineEnd);
&gt;
&gt;
&gt;
&gt;                           dos.writeBytes(twoHyphens + boundary + lineEnd);
&gt;
&gt;                           dos.writeBytes("Content-Disposition: form-data;
&gt; name=\"upload\";"
&gt;
&gt;                              + " filename=\"" + exsistingFileName +"\"" +
&gt; lineEnd );
&gt;
&gt;                           dos.writeBytes(lineEnd);
&gt;
&gt;                           FileInputStream fileInputStream = new
&gt; FileInputStream( new
&gt;
&gt;                                                   File(exsistingFileName)
&gt; );
&gt;
&gt;                           int bytesRead, bytesAvailable, bufferSize;
&gt;
&gt;                                      byte[] buffer;int maxBufferSize =
&gt; 1*1024*1024;
&gt;
&gt;                           bytesAvailable = fileInputStream.available();
&gt;
&gt;                           bufferSize = Math.min(bytesAvailable,
&gt; maxBufferSize);
&gt;
&gt;                           buffer = new byte[bufferSize];
&gt;
&gt;                           bytesRead = fileInputStream.read(buffer, 0,
&gt; bufferSize);
&gt;
&gt;                           while (bytesRead &gt; 0)
&gt;
&gt;                           {
&gt;
&gt;                            dos.write(buffer, 0, bufferSize);
&gt;
&gt;                            bytesAvailable = fileInputStream.available();
&gt;
&gt;                            bufferSize = Math.min(bytesAvailable,
&gt; maxBufferSize);
&gt;
&gt;                            bytesRead = fileInputStream.read(buffer, 0,
&gt; bufferSize);
&gt;
&gt;                           }
&gt;
&gt;                           dos.writeBytes(lineEnd);
&gt;
&gt;                           dos.writeBytes(twoHyphens + boundary + twoHyphens
&gt; + lineEnd);
&gt;
&gt;                           fileInputStream.close();
&gt;
&gt;                           dos.flush();
&gt;
&gt;                           dos.close();
&gt;
&gt;          System.out.println("It's Connected");
&gt;
&gt;         InputStream is = m_oHttpURLConnection.getInputStream (  ) ;
&gt;
&gt;      if  ( is == null )   {
&gt;
&gt;          throw new Exception ( "Got a null content object!" ) ;
&gt;
&gt;       }
&gt;
&gt;      StringBuffer putBackTogether = new StringBuffer (  ) ;
&gt;
&gt;      Reader r = new InputStreamReader ( is, "UTF-8" ) ;
&gt;
&gt;      char [  ]  cb = new char [ 2048 ] ;
&gt;
&gt;      int amtRead = r.read ( cb ) ;
&gt;
&gt;      while  ( amtRead  &gt;  0 )   {
&gt;
&gt;          putBackTogether.append ( cb, 0, amtRead ) ;
&gt;
&gt;          amtRead = r.read ( cb ) ;
&gt;
&gt;       }
&gt;
&gt;      String pageSource = putBackTogether.toString (  ) ;
&gt;
&gt;      System.out.println(pageSource);
&gt;
&gt;            } catch (Exception e){
&gt;
&gt;                  e.printStackTrace();
&gt;
&gt;            }
&gt;
&gt;      }
&gt;
&gt;
&gt;
&gt;      public boolean verify(String hostname, SSLSession session) {
&gt;
&gt;            return true;
&gt;
&gt;      }
&gt;
&gt;      public static void main(String[] args) {
&gt;
&gt;                        try{connect c=new connect();
&gt;
&gt;                        c.try_connect();}catch(Exception e){
&gt;
&gt;                                    e.printStackTrace(System.out);
&gt;
&gt; }}                      }
&gt;
&gt; ---------------------------------
&gt;
&gt;
&gt;
&gt; Disclaimer: ""Unless indicated otherwise, the information contained in this message is
privileged and confidential, and is
&gt; intended only for the use of the addressee(s) named above and others who have been specifically
authorized to receive it.
&gt; If you are not the intended recipient, you are hereby notified that any dissemination,
distribution or copying of this
&gt; message and/or attachments is strictly prohibited. TechProcess Solutions Ltd. accepts
no liability for any damage caused by
&gt; any virus transmitted by this email. Furthermore, the company does not warrant a proper
and complete transmission of this
&gt; information, nor does it accept liability for any delays. If you have received this message
in error, please contact the
&gt; sender and delete the message. Thank you.""
&gt;
&gt;
&gt;

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org



</pre>
</div>
</content>
</entry>
<entry>
<title>[FILEUPLOAD] feasibility of using fileupload apache api without boundary</title>
<author><name>&lt;vishal.mestri@techprocess.co.in&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/commons-user/200911.mbox/%3cVSNLCHNFE001O1AAwl60002125f@VSNLCHNFE001.VSNLXCHANGE.COM%3e"/>
<id>urn:uuid:%3cVSNLCHNFE001O1AAwl60002125f@VSNLCHNFE001-VSNLXCHANGE-COM%3e</id>
<updated>2009-11-24T15:57:36Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
hi all,

i am using file upload api for io operation to download files on server
using multipart/form-data.

link given below:-

http://commons.apache.org/fileupload

 

If we are using normal html file for upload no issue, browser takes care of
"boundary"...

 

but if we write core java app to connect to filedownload app, we need to set
"boundary" manually...

I have set boundary manually,it works.But it does not work without boundary.

 

is it possible to download files without boundary?

is there any other api which can do it?

 

if I remove boundary from code it gives me error:

org.apache.commons.fileupload.FileUploadException: the request was rejected
because no multipart boundary was found

 

my html code being used to connect to filedownload app:-

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

&lt;html&gt;

&lt;head&gt;

&lt;script language="JavaScript"&gt;

function show(){}

 &lt;/script&gt;

&lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"&gt;

&lt;title&gt;Insert title here&lt;/title&gt;

&lt;/head&gt;

&lt;body&gt;

&lt;form AUTOCOMPLETE="off"  name="addFiles" method="post"
action="https://tpslvl0109:8443/FileDownload/pushFile"
enctype="multipart/form-data"&gt;

username:&lt;input type=text name=username id=username value="myusername"&gt;&lt;br&gt;

password:&lt;input type=password name=password id=password
value="mypassword"&gt;&lt;br&gt;

Input file1:&lt;input name="inputfile1" type="file" id="inputfile1"
size="55"&gt;&lt;br&gt;

&lt;input type=submit name=submit value=submit onClick="show()" &gt;

&lt;/form&gt;&lt;/body&gt;&lt;/html&gt;

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

my core java client app used to connect to same filedownload app

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

import java.io.DataOutputStream;

import java.io.File;

import java.io.FileInputStream;

import java.io.InputStream;

import java.io.InputStreamReader;

import java.io.Reader;

import java.net.HttpURLConnection;

import java.net.URL;

import javax.net.ssl.HostnameVerifier;

import javax.net.ssl.HttpsURLConnection;

import javax.net.ssl.SSLContext;

import javax.net.ssl.SSLSession;

import javax.net.ssl.TrustManager;

import javax.net.ssl.X509TrustManager;

 

public class connect implements HostnameVerifier{

      public connect(){}

      public void try_connect(){

      try {

              String boundary =  "*****";

            System.setProperty( "java.protocol.handler.pkgs" ,
"javax.net.ssl" );

            java.security.Security.addProvider( new
com.sun.net.ssl.internal.ssl.Provider() );

            TrustManager[] trustAllCerts = new TrustManager[] {

                        new X509TrustManager(){

                              public java.security.cert.X509Certificate[]
getAcceptedIssuers(){

                                    return null;

                              }

                        public void checkClientTrusted(
java.security.cert.X509Certificate[] certs, String authType ) { }

                              public void checkServerTrusted(
java.security.cert.X509Certificate[] certs, String authType ) { }

                        }

                  };

            SSLContext sc = SSLContext.getInstance( "SSL" );

            sc.init( null, trustAllCerts, new java.security.SecureRandom()
);

            HttpsURLConnection.setDefaultSSLSocketFactory(
sc.getSocketFactory() );

            URL url = new URL("https", "tpslvl0109", 8443,
"/FileDownload/pushFile");

            System.out.println(url.getQuery());

             HttpsURLConnection m_oHttpURLConnection =  (HttpsURLConnection)
url.openConnection();

            m_oHttpURLConnection.setDoInput( true );

            m_oHttpURLConnection.setDoOutput( true );

            m_oHttpURLConnection.setUseCaches( false );

            m_oHttpURLConnection.setRequestProperty("Connection",
"Keep-Alive");

            m_oHttpURLConnection.setRequestProperty( "Content-Type",
"multipart/form-data;boundary="+boundary );

            m_oHttpURLConnection.setAllowUserInteraction( true );

            m_oHttpURLConnection.setRequestMethod("POST");            

            m_oHttpURLConnection.setInstanceFollowRedirects( true );

           ( ( HttpsURLConnection )( m_oHttpURLConnection )
).setHostnameVerifier( this );      

            

          m_oHttpURLConnection.connect();

          DataOutputStream dos = null;

              String exsistingFileName =
"D:\\projects\\104-FileDownload\\TestFilefrom.txt";

          String lineEnd = "\r\n";

          String twoHyphens = "--";

              dos = new DataOutputStream(
m_oHttpURLConnection.getOutputStream() );

          dos.writeBytes(twoHyphens + boundary + lineEnd);

                           dos.writeBytes("Content-Disposition: form-data;
name=username ;  " + lineEnd );

                           dos.writeBytes(lineEnd);

                           dos.writeBytes("myusername");

                           dos.writeBytes(lineEnd);

                           dos.writeBytes(twoHyphens + boundary + lineEnd);

                           dos.writeBytes("Content-Disposition: form-data;
name=password ; " + lineEnd );

                           dos.writeBytes(lineEnd);

                           dos.writeBytes("mypassword");

                           dos.writeBytes(lineEnd);

 

                           dos.writeBytes(twoHyphens + boundary + lineEnd);

                           dos.writeBytes("Content-Disposition: form-data;
name=\"upload\";"

                              + " filename=\"" + exsistingFileName +"\"" +
lineEnd );

                           dos.writeBytes(lineEnd);

                           FileInputStream fileInputStream = new
FileInputStream( new

                                                   File(exsistingFileName)
);

                           int bytesRead, bytesAvailable, bufferSize;

                                      byte[] buffer;int maxBufferSize =
1*1024*1024;

                           bytesAvailable = fileInputStream.available();

                           bufferSize = Math.min(bytesAvailable,
maxBufferSize);

                           buffer = new byte[bufferSize];

                           bytesRead = fileInputStream.read(buffer, 0,
bufferSize);

                           while (bytesRead &gt; 0)

                           {

                            dos.write(buffer, 0, bufferSize);

                            bytesAvailable = fileInputStream.available();

                            bufferSize = Math.min(bytesAvailable,
maxBufferSize);

                            bytesRead = fileInputStream.read(buffer, 0,
bufferSize);

                           }

                           dos.writeBytes(lineEnd);

                           dos.writeBytes(twoHyphens + boundary + twoHyphens
+ lineEnd);

                           fileInputStream.close();

                           dos.flush();

                           dos.close();

          System.out.println("It's Connected");

         InputStream is = m_oHttpURLConnection.getInputStream (  ) ;

      if  ( is == null )   {  

          throw new Exception ( "Got a null content object!" ) ;

       }  

      StringBuffer putBackTogether = new StringBuffer (  ) ;

      Reader r = new InputStreamReader ( is, "UTF-8" ) ;

      char [  ]  cb = new char [ 2048 ] ;

      int amtRead = r.read ( cb ) ;

      while  ( amtRead  &gt;  0 )   {  

          putBackTogether.append ( cb, 0, amtRead ) ;

          amtRead = r.read ( cb ) ;

       }  

      String pageSource = putBackTogether.toString (  ) ;

      System.out.println(pageSource);

            } catch (Exception e){

                  e.printStackTrace();

            }

      }

 

      public boolean verify(String hostname, SSLSession session) {

            return true;

      }

      public static void main(String[] args) {

                        try{connect c=new connect();

                        c.try_connect();}catch(Exception e){

                                    e.printStackTrace(System.out);

}}                      }

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



Disclaimer: ""Unless indicated otherwise, the information contained in this message is privileged
and confidential, and is
intended only for the use of the addressee(s) named above and others who have been specifically
authorized to receive it. 
If you are not the intended recipient, you are hereby notified that any dissemination, distribution
or copying of this 
message and/or attachments is strictly prohibited. TechProcess Solutions Ltd. accepts no liability
for any damage caused by
any virus transmitted by this email. Furthermore, the company does not warrant a proper and
complete transmission of this
information, nor does it accept liability for any delays. If you have received this message
in error, please contact the
sender and delete the message. Thank you.""




</pre>
</div>
</content>
</entry>
<entry>
<title>RE: [IO] Problem finding right filepath</title>
<author><name>&quot;Ludwig Magnusson&quot; &lt;ludwig@itcatapult.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/commons-user/200911.mbox/%3c00fd01ca6c6d$01e06a40$05a13ec0$@com%3e"/>
<id>urn:uuid:%3c00fd01ca6c6d$01e06a40$05a13ec0$@com%3e</id>
<updated>2009-11-23T18:44:35Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
I did post it there and I got a solution.
If anyone is interested, it can be found here:
http://markmail.org/search/?q=list%3Aorg.apache.tomcat.user/#query:list%3Aor
g.apache.tomcat.user%2F+page:1+mid:fbpkjgjtwhtwq4co+state:results
/Ludwig

-----Original Message-----
From: Mark Thomas [mailto:markt@apache.org] 
Sent: den 23 november 2009 17:42
To: Commons Users List
Subject: Re: [IO] Problem finding right filepath

Ludwig Magnusson wrote:
&gt; Hello!
&gt; 
&gt; We are a team developing a webapp running on a tomcat server. We need to
&gt; list the files in a certain directory in our application, but we cannot
find
&gt; a way to always get the correct path on the different platforms and
&gt; environments. Is this solvable through some IO-function or do we need to
&gt; specify the path to our project in each environment?

This is probably better suited to the Tomcat users list.

That said, as a general rule it is not safe to assume that your web
application is deployed on a file system. Your app could be packaged as
a WAR file sitting on a database.

That said, there are some Servlet API calls that can tell you if you or
on a file system and if you are, where you are on the file system.

Follow up on the Tomcat users list if you need more info.

Mark




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org



</pre>
</div>
</content>
</entry>
<entry>
<title>Re: [IO] Problem finding right filepath</title>
<author><name>Mark Thomas &lt;markt@apache.org&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/commons-user/200911.mbox/%3c4B0ABB3B.1050304@apache.org%3e"/>
<id>urn:uuid:%3c4B0ABB3B-1050304@apache-org%3e</id>
<updated>2009-11-23T16:41:31Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Ludwig Magnusson wrote:
&gt; Hello!
&gt; 
&gt; We are a team developing a webapp running on a tomcat server. We need to
&gt; list the files in a certain directory in our application, but we cannot find
&gt; a way to always get the correct path on the different platforms and
&gt; environments. Is this solvable through some IO-function or do we need to
&gt; specify the path to our project in each environment?

This is probably better suited to the Tomcat users list.

That said, as a general rule it is not safe to assume that your web
application is deployed on a file system. Your app could be packaged as
a WAR file sitting on a database.

That said, there are some Servlet API calls that can tell you if you or
on a file system and if you are, where you are on the file system.

Follow up on the Tomcat users list if you need more info.

Mark




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org



</pre>
</div>
</content>
</entry>
<entry>
<title>[IO] Problem finding right filepath</title>
<author><name>&quot;Ludwig Magnusson&quot; &lt;ludwig@itcatapult.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/commons-user/200911.mbox/%3c00e201ca6c5a$d286b360$77941a20$@com%3e"/>
<id>urn:uuid:%3c00e201ca6c5a$d286b360$77941a20$@com%3e</id>
<updated>2009-11-23T16:34:25Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Hello!

We are a team developing a webapp running on a tomcat server. We need to
list the files in a certain directory in our application, but we cannot find
a way to always get the correct path on the different platforms and
environments. Is this solvable through some IO-function or do we need to
specify the path to our project in each environment?

/Ludwig



</pre>
</div>
</content>
</entry>
<entry>
<title>Re: Commons CLI : Executing from shell script ?</title>
<author><name>Carsten Schlipf &lt;carsten.schlipf@yeap.de&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/commons-user/200911.mbox/%3c4B0863E1.2040608@yeap.de%3e"/>
<id>urn:uuid:%3c4B0863E1-2040608@yeap-de%3e</id>
<updated>2009-11-21T22:04:17Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
In case of a space in an argument $* will not help, but $@.

Henri Yandell wrote:
&gt; Does using $* help? Even if it doesn't, it would be more concise.
&gt; 
&gt; I'm assuming one of the variables you're passing through contains a
&gt; space and is splitting things up after the quotes surrounding it are
&gt; lost. Does the number of arguments increase?
&gt; 
&gt; Hen
&gt; 
&gt; On Thu, Nov 19, 2009 at 2:21 AM, Ashika Umanga Umagiliya
&gt; &lt;aumanga@biggjapan.com&gt; wrote:
&gt;&gt; Greetings all,
&gt;&gt;
&gt;&gt; In my application I have used Commons CLI to parse command line arguments.
&gt;&gt; I want to run my JAR file using shell script because , I have to setup some
&gt;&gt; environment variables.
&gt;&gt; But it seems that shell script messing around with argument order/number.
&gt;&gt;
&gt;&gt; My shell script is as follows:
&gt;&gt;
&gt;&gt;
&gt;&gt; export ARCH=lx24-amd64
&gt;&gt; export SGE_ROOT=/SGE6/sge6.2
&gt;&gt; export LD_LIBRARY_PATH=$SGE_ROOT/lib/$ARCH/
&gt;&gt; #echo $SGE_ROOT
&gt;&gt; #echo $LD_LIBRARY_PATH
&gt;&gt; java -jar analyse.jar $1 $2 $3 $4 $5 $6 $7 $8 $9 $10 $11 $12 $13 $14 $15 $16
&gt;&gt; $17 $18 $19 $20
&gt;&gt;
&gt;&gt;
&gt;&gt; But  when I run directly from shell using "java -jar analyse.jar ..... "
&gt;&gt; everything works fine.
&gt;&gt;
&gt;&gt; Any tips?
&gt;&gt;
&gt;&gt; Thanks in advance.
&gt;&gt;
&gt;&gt;
&gt;&gt; ---------------------------------------------------------------------
&gt;&gt; To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
&gt;&gt; For additional commands, e-mail: user-help@commons.apache.org
&gt;&gt;
&gt;&gt;
&gt; 
&gt; ---------------------------------------------------------------------
&gt; To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
&gt; For additional commands, e-mail: user-help@commons.apache.org
&gt; 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org



</pre>
</div>
</content>
</entry>
<entry>
<title>[ANNOUNCEMENT]  Apache Commons Pool 1.5.4 Released</title>
<author><name>Phil Steitz &lt;psteitz@apache.org&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/commons-user/200911.mbox/%3c4B0735F0.3040105@apache.org%3e"/>
<id>urn:uuid:%3c4B0735F0-3040105@apache-org%3e</id>
<updated>2009-11-21T00:36:00Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
The Apache Commons team is pleased to announce the release of
version 1.5.4 of Commons Pool.  Commons Pool provides a general
purpose object pooling API, an implementation toolkit and some pool
implementations.

Version 1.5.4 is a patch release including a fix for a regression
introduced in version 1.5. Source and binary distributions are
available for download from the Apache Commons Pool download site:
http://commons.apache.org/pool/download_pool.cgi

Please verify signatures using the KEYS file available at the above
location when downloading the release.

For more information on Apache Commons Pool, visit the Pool home page:
http://commons.apache.org/pool/

Feedback, suggestions for improvement or bug reports are welcome via
the "Mailing Lists" and "Issue Tracking" links here:
http://commons.apache.org/pool/project-info.html

Phil Steitz
- On behalf of the Apache Commons community

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org



</pre>
</div>
</content>
</entry>
<entry>
<title>Re: [VFS] sftp upload fails with permission denied error while setting the last updated timestamp</title>
<author><name>Ralph Goers &lt;ralph.goers@dslextreme.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/commons-user/200911.mbox/%3c7F06DD89-351F-4D29-B3E2-8D021F0CDEB5@dslextreme.com%3e"/>
<id>urn:uuid:%3c7F06DD89-351F-4D29-B3E2-8D021F0CDEB5@dslextreme-com%3e</id>
<updated>2009-11-20T14:16:21Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Sorry, I meant the logs from the target system where the files are, not from the application
using commons vfs.

Ralph

On Nov 20, 2009, at 3:15 AM, Bhaskar Annamalai wrote:

&gt; Hi,
&gt;  Sorry for the delay. There is no information in the log regarding the
&gt; issue except for the exception stacktrace.
&gt; 
&gt; Thanks,
&gt; Bhaskar 
&gt; 
&gt; -----Original Message-----
&gt; From: Ralph Goers [mailto:ralph.goers@dslextreme.com] 
&gt; Sent: Wednesday, November 18, 2009 11:44 AM
&gt; To: Commons Users List
&gt; Subject: Re: [VFS] sftp upload fails with permission denied error while
&gt; setting the last updated timestamp
&gt; 
&gt; I know this isn't going to be much help. I don't use the SFTP provider
&gt; so I don't really have a lot of advice to give. I was hoping some of the
&gt; other folks who do use it - and I know there are some - would have
&gt; jumped in.  Have you checked the logs on the server?
&gt; 
&gt; Ralph
&gt; 
&gt; On Nov 16, 2009, at 9:00 PM, Bhaskar Annamalai wrote:
&gt; 
&gt;&gt; Hi,
&gt;&gt; I tried to use VFS for uploading a file to a sftp url. The file gets
&gt;&gt; uploaded to the location which is specified in the url. But it gets a
&gt;&gt; permission denied error while setting the last updated time of the
&gt; file.
&gt;&gt; Below is the stack trace of the error.
&gt;&gt; 
&gt;&gt; 
&gt;&gt; org.apache.commons.vfs.FileSystemException: Could not set the last
&gt;&gt; modified timestamp of &lt;sftp url&gt;.
&gt;&gt;       at
&gt;&gt; 
&gt; org.apache.commons.vfs.provider.DefaultFileContent.setLastModifiedTime(D
&gt;&gt; efaultFileContent
&gt;&gt; .java:196)
&gt;&gt;       at
&gt;&gt; 
&gt; org.apache.commons.vfs.provider.AbstractFileObject.moveTo(AbstractFileOb
&gt;&gt; ject.java:1001)
&gt;&gt;       at
&gt;&gt; 
&gt; org.apache.synapse.transport.vfs.VFSTransportListener.moveOrDeleteAfterP
&gt;&gt; rocessing(VFSTran
&gt;&gt; sportListener.java:331)
&gt;&gt;       at
&gt;&gt; 
&gt; org.apache.synapse.transport.vfs.VFSTransportListener.scanFileOrDirector
&gt;&gt; y(VFSTransportLis
&gt;&gt; tener.java:262)
&gt;&gt;       at
&gt;&gt; 
&gt; org.apache.synapse.transport.vfs.VFSTransportListener.poll(VFSTransportL
&gt;&gt; istener.java:154)
&gt;&gt; 
&gt;&gt;       at
&gt;&gt; 
&gt; org.apache.synapse.transport.vfs.VFSTransportListener.poll(VFSTransportL
&gt;&gt; istener.java:117)
&gt;&gt; 
&gt;&gt;       at
&gt;&gt; 
&gt; org.apache.axis2.transport.base.AbstractPollingTransportListener$1$1.run
&gt;&gt; (AbstractPollingT
&gt;&gt; ransportListener.java:99)
&gt;&gt;       at
&gt;&gt; 
&gt; org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWor
&gt;&gt; kerPool.java:58)
&gt;&gt;       at
&gt;&gt; 
&gt; java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecuto
&gt;&gt; r.java:886)
&gt;&gt;       at
&gt;&gt; 
&gt; java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.ja
&gt;&gt; va:908)
&gt;&gt;       at java.lang.Thread.run(Thread.java:619)
&gt;&gt; Caused by: 3: Permission denied
&gt;&gt;       at
&gt;&gt; com.jcraft.jsch.ChannelSftp.throwStatusError(ChannelSftp.java:2289)
&gt;&gt;       at com.jcraft.jsch.ChannelSftp._setStat(ChannelSftp.java:1871)
&gt;&gt;       at com.jcraft.jsch.ChannelSftp.setStat(ChannelSftp.java:1845)
&gt;&gt;       at
&gt;&gt; 
&gt; org.apache.commons.vfs.provider.sftp.SftpFileObject.doSetLastModifiedTim
&gt;&gt; e(SftpFileObject.
&gt;&gt; java:237)
&gt;&gt;       at
&gt;&gt; 
&gt; org.apache.commons.vfs.provider.AbstractFileObject.doSetLastModTime(Abst
&gt;&gt; ractFileObject.ja
&gt;&gt; va:262)
&gt;&gt;       at
&gt;&gt; 
&gt; org.apache.commons.vfs.provider.DefaultFileContent.setLastModifiedTime(D
&gt;&gt; efaultFileContent
&gt;&gt; .java:189)
&gt;&gt;       ... 10 more
&gt;&gt; 
&gt;&gt; Please suggest.
&gt;&gt; 
&gt;&gt; Thanks,
&gt;&gt; Bhaskar
&gt;&gt; 
&gt;&gt; ---------------------------------------------------------------------
&gt;&gt; To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
&gt;&gt; For additional commands, e-mail: user-help@commons.apache.org
&gt;&gt; 
&gt; 
&gt; 
&gt; ---------------------------------------------------------------------
&gt; To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
&gt; For additional commands, e-mail: user-help@commons.apache.org
&gt; 
&gt; 
&gt; ---------------------------------------------------------------------
&gt; To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
&gt; For additional commands, e-mail: user-help@commons.apache.org
&gt; 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org



</pre>
</div>
</content>
</entry>
<entry>
<title>Re: [SANSELAN] Problem reading GPS-Information from Images</title>
<author><name>Franz &lt;graff@cip.ifi.lmu.de&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/commons-user/200911.mbox/%3c4B068C08.202@cip.ifi.lmu.de%3e"/>
<id>urn:uuid:%3c4B068C08-202@cip-ifi-lmu-de%3e</id>
<updated>2009-11-20T12:31:04Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Hi,
thanks for the link to jira.
For those who're interesed: there's already an open issue for this at
https://issues.apache.org/jira/browse/SANSELAN-21

Charles Matthew Chen wrote:
&gt; Hi Franz,
&gt; 
&gt;    Please open an issue and attach an image that demonstrates the issue.
&gt; 
&gt; Thanks,
&gt;    Charles
&gt; 
&gt; https://issues.apache.org/jira/browse/SANSELAN
&gt; 
&gt; 
&gt; On Thu, Nov 19, 2009 at 3:38 PM, Franz &lt;graff@cip.ifi.lmu.de&gt; wrote:
&gt;&gt; Hello,
&gt;&gt;
&gt;&gt; I'm playing around with sanselan and wanted to extract the geotags of an
&gt;&gt; image and compare the data with the data displayed by IrvanView
&gt;&gt; (The image was geotagged using 'locr' before).
&gt;&gt;
&gt;&gt; IrfanView correctly extracts the GeoTags:
&gt;&gt; GPS Version ID: 2.2.0.0
&gt;&gt; GPS Latitude Ref: N
&gt;&gt; GPS Latitude: 47 49 2.29
&gt;&gt; GPS Longitude Ref: E
&gt;&gt; GPS Longitude: 11, 36, 40.114
&gt;&gt;
&gt;&gt; while Sanselan produces the following output
&gt;&gt; GPS Version ID: Not Found.
&gt;&gt; GPS Latitude Ref: 'R98'     &lt;- should be N?
&gt;&gt; GPS Latitude: 48, 49, 48, 48&lt;- should be 47 49 2.29?
&gt;&gt; GPS Longitude Ref: 'E'
&gt;&gt; GPS Longitude: 11, 36, 40114/1000 (40,114)
&gt;&gt;
&gt;&gt; My question now: are the Latitude values not correct or do I make a
&gt;&gt; mistake?
&gt;&gt;
&gt;&gt; The code to extract the GPS-Data is:
&gt;&gt;
&gt;&gt;&gt; static void getLocation(File file) throws IOException, ImageReadException {
&gt;&gt;&gt;     IImageMetadata metadata = Sanselan.getMetadata(file);
&gt;&gt;&gt;     if (metadata instanceof JpegImageMetadata) {
&gt;&gt;&gt;         JpegImageMetadata jpegMetadata = (JpegImageMetadata) metadata;
&gt;&gt;&gt;         for (TagInfo ti : GPSTagConstants.ALL_GPS_TAGS) {
&gt;&gt;&gt;             TiffField field = jpegMetadata.findEXIFValue(ti);
&gt;&gt;&gt;             if (field != null) {
&gt;&gt;&gt;                 System.out.println(ti.name + ": " + field.getValueDescription());
&gt;&gt;&gt;             }
&gt;&gt;&gt;         }
&gt;&gt;&gt;     }
&gt;&gt;&gt; }
&gt;&gt; The image can be found at http://www.locked.de/geo1.jpg


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org



</pre>
</div>
</content>
</entry>
</feed>
