Re: Transaction API, ReadWriteLock

2005-07-07 Thread Oliver Zeigermann
Yes, all participating threads would need to access the same
transaction manager.

Oliver

On 7/6/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 
 
 
 
 
 Switching to use a manager to manage lock references eliminates the need to
 mange lock references, but doesn't this just push this reference problem to
 the manager object?
 
 If classes foo1 and foo2 needed to write to the same file, they would need
 to reference the same manager object to be aware of the lock that was
 created by the other class.  If so, then the creation of the manager object
 would need to be placed in Singleton object so both classes could obtain
 the same reference to the manager object.  Correct?
 
 LeRoy
 
 
 
 
 
 
  Oliver Zeigermann
  oliver.zeigerman
  [EMAIL PROTECTED]   
 To
Jakarta Commons Users List
  07/06/2005 09:47  commons-user@jakarta.apache.org
  AM cc
 
Subject
  Please respond to Re: Transaction API, ReadWriteLock
  Jakarta Commons
 Users List
  [EMAIL PROTECTED]
  arta.apache.org
 
 
 
 
 
 
 Exactly. In most cases I would recommend to use a manager.
 
 Oliver
 
 On 7/6/05, Aaron Hamid [EMAIL PROTECTED] wrote:
  I see, so if I do not wish to manage the lock references myself, I (and
 LeRoy also) should always obtain locks through a LockManager.
 
  Aaron
 
  Oliver Zeigermann wrote:
   By the way, when giving me first advice I stumbled over exactly this
   difference between the lock manager and the lock itself...
  
   Oliver
  
   On 7/6/05, Oliver Zeigermann [EMAIL PROTECTED] wrote:
  
  You are right, but only for the lock manager. The lock manager takes
  care of uniquely mapping a resource id to a lock, but when you work on
  a lock *directly* it must - of course - be the same object.
  
  Oliver
  
  On 7/6/05, Aaron Hamid [EMAIL PROTECTED] wrote:
  
  Is this true?  It was my impression, have first written such a class,
 and then finding and skimming the javadoc for [ReadWrite]LockManager, and
 particularly 'getLock' and 'createLock', that lock singletons would be
 automatically created and managed.  Otherwise the developer must write a
 lot of boilerplate code for keeping a singleton map of locks.  Surely only
 the 'resourceId' must be the same, and not the actual ReadWriteLock
 reference?
  
  LockManager: Encapsulates creation, removal, and retrieval of locks.
 Each resource can have at most a single lock.
  
  Aaron
  
  Oliver Zeigermann wrote:
  
  Ooops, sorry, you are right. Not only the resource Id, but the lock
  *itself* must be the same in both threads.
  
  Doing it this way:
  
final ReadWriteLock fileLock = new
 ReadWriteLock(Huhu, loggerFacade);
Runnable run = new Runnable() {
  
public void run() {
  
try {
System.out.println(before
 acquiring a lock 
+
 Thread.currentThread());
boolean result =
 fileLock.acquireWrite(Thread
  
 .currentThread(), Long.MAX_VALUE);
System.out.println(lock
 result:  + result +  
+
 Thread.currentThread());
Thread.sleep(2);
System.out.println(after
 sleeping 
+
 Thread.currentThread());
} catch (InterruptedException e) {
e.printStackTrace(System.err);
  
} finally {
  
 fileLock.release(Thread.currentThread());
}
}
  
};
  
Thread t1 = new Thread(run, Thread1);
Thread t2 = new Thread(run, Thread2);
t1.start();
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
}
t2.start();
  
  
  works fine for me.
  
  HTH
  
  Oliver
  
  On 7/6/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
  
  
  
  
  
  Oliver,
  
  I tried your suggestion by changing my ReadWriteLock statement to
  
  ReadWriteLock fileLock = new
 ReadWriteLock(c:/logRec.txt,loggerFacade);
  
  However, I received the same results as when I used new File(..).
  
  LeRoy
  
  
  
  
  
  
  Oliver Zeigermann
  oliver.zeigerman
  [EMAIL PROTECTED]
 To
Jakarta Commons Users List
  07/06/2005 01:44
 

[FileUpload] It's works under Firefox but not on IE, why ?

2005-07-07 Thread Maxime
Hello Everybody,
During 2 days, I was testing FileUpload on IE and it never work. After that, I 
tried on Firefox and it's works perfectly.
Can you tell me why and how to resolve this problem ?
It's a really pain in an ... :)

Thank you.
Maxime



Here the form :
HTML 
HEAD 
/HEAD 

BODY BGCOLOR=#FDF5E6 

h1Upload de Fichier/h1 

form name=upload method=post action=/UploadFileServlet 
enctype=multipart/form-data  

Upload File:input type=file name=source size=30 
  
input type=submit name=submitFile value=Upload title=Upload 

/form 
/BODY 
/HTML 

Here the Servlet :

import java.io.*; 
import java.util.*; 
import javax.servlet.*; 
import javax.servlet.http.*; 
import org.apache.commons.fileupload.*; 
import org.apache.commons.fileupload.*; 


public class UploadFileServlet extends HttpServlet { 
public void doPost(HttpServletRequest request, HttpServletResponse response) 
throws ServletException, IOException { 

System.out.println (Uploading-Servlet); 
try{
   // Create a new file upload handler 
   DiskFileUpload upload = new DiskFileUpload(); 

   // Set upload parameters 
   int  yourMaxMemorySize = 512 * 1024 * 8; 
   int  yourMaxRequestSize = 1024 * 1024 * 8; 
   String yourTempDirectory = c:\\; 

   upload.setSizeThreshold(yourMaxMemorySize); 
   upload.setSizeMax(yourMaxRequestSize); 
   upload.setRepositoryPath(yourTempDirectory); 

   //Parse the request 
   List items = upload.parseRequest(request); 

   // Process the uploaded items 
   Iterator iter = items.iterator(); 
   while (iter.hasNext()) { 

   FileItem item = (FileItem) iter.next(); 

   //   Process a regular form field 
   if (item.isFormField()) { 
   String name = item.getFieldName(); 
   String value = item.getString(); 

   } 
  // Process a file upload 
  else { 
   String fieldName = item.getFieldName(); 
   String fileName = item.getName(); 
   String contentType = item.getContentType(); 
   boolean isInMemory = item.isInMemory(); 
   File uploadedFile = new File(yourTempDirectory + 
fileName); 
   item.write(uploadedFile); 

  } 
   } 
} catch (ServletException e) { 
   e.printStackTrace(); 
} catch (IOException e) { 
   e.printStackTrace(); 
} catch (FileUploadException e) { 
   e.printStackTrace(); 
} catch (Exception e) { 
   e.printStackTrace(); 
} 

   } 

} 

Re: JELLY: Escaping output of JEXL expression

2005-07-07 Thread Christian Kalkhoff

Hi Dion,

thank you very much for this hint. It didn´t solve my problem directly 
but pointed me into the right direction. Just for reference what the 
problem was:


Situation is, that i use jelly embedded in Java. I create an XMLOutput 
Stream and run the script with it.


I searched through the WhitespaceTag Example and the TagSupport and 
everywhere were methods taking XMLOutput instances. There were also 
references to escapeText on the TagSupport.java file but that wasn´t 
helpful.


After a few minutes i realized that i am the dude who is creating the 
output stream on top of the call stack. I switched to the file, put in a 
true into the constructor and see, it works.


Sometimes i really think i sleep when i code. :)

Thank you again for the help. That saved me hours and nerves.

Christian

Dion Gillard wrote:

The tags all have an escapeText attribute that tells Jelly whether or
not to escape XML.

See http://jakarta.apache.org/commons/jelly/tags.html#core:whitespace
for an example.

On 7/6/05, Christian Kalkhoff [EMAIL PROTECTED] wrote:


Hi,

i ran into the problem, that jelly outputs invalid xml if one of the
beans available as context variables contains e.g. an  char. Is there a
way to tell jelly (or jexl) to escape such xml special chars. Are there
workarounds?

Regards,
Christian

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]









-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [jelly] Schema validation problems

2005-07-07 Thread Adrian Herscu

Dion,

First, thanks for your reply.
Now, I will introduce myself -- well, I am a retard!
Really, I am playing with this Jelly stuff for about ten-twenty hours.
Anyway, your clues are great!

Have a nice day,
Adrian.

Dion Gillard wrote:

On 7/7/05, Adrian Herscu [EMAIL PROTECTED] wrote:


Hi all,

I am trying to build a Maven plugin for validating XML. Currently I have
this code:

!-- assume ${schema.type.uri} is http://www.w3.org/2001/XMLSchema --
core:set
  var=verifierFactory
  value=
${org.iso_relax.verifier.VerifierFactory.newInstance(schema.type.uri)} /



I'm reasonably sure the above variable will be null.



!-- assume everything in ${file.set} is an XML file --
ant:fileScanner var=fileSet
  ant:fileset dir=${file.set} /
/ant:fileScanner

validate:verifier
  var=verifier
  factory=${verifierFactory}
  uri=schema.uri /

!-- THIS DOES NOT WORK -- RETURNS AN EMPTY STRING --
echoValidating using ${verifierFactory.getClass().toString()}/echo

core:forEach items=${fileSet.iterator()} var=file
  echoValidating ${file}/echo

  validate:validate var=validationResult verifier=${verifier}
core:include uri=file:///${file} /
  /validate:validate

  echoValidation result: ${validationResult}/echo
/core:forEach

There are several problems with this code:

1. If the schema file pointed by ${schema.uri} references other schema
file by using a relative URL, then that URL is resolved relatively to
the location from where the validation process was started (the path
from where Maven was launched), instead of being resolved relatively to
the first schema file location (this is what XML schema validators do --
checked with MSXML3.0 and with Xerces).



Is that because you are validating the body of the validate tag?



2. If the schema instance (i.e. the validated file) contains an
xsi:schemaLocation attribute in its root element then this error is
thrown:
error column=-1 line=-1unexpected attribute
xsi:schemaLocation/error
and the ${validationResult} is set to 'false'.



Is this an issue with the validator or the validate tag?



3. If the validation failed once (like in #3), then errors are not
thrown anymore, only the ${validationResult} is set to 'false'.



I'm not too familiar with the validate tag lib, but maybe you need a
new error handler??



4. If core:include uri=... / references a local file path then that
file path must be prepended with file:///, otherwise it is prepended
at run-time with the process launch path. For example:
- local file path: E:\myxmldir\foo.xml
- process launch path: E:\myworkdir
then Jelly will seek for something impossible:
E:\myworkdir\E:\myxmldir\foo.xml

Thanks a lot for your time,
Adrian.






-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [FileUpload] It's works under Firefox but not on IE, why ?

2005-07-07 Thread Maxime

Well,
I am working under Windows XP SP 2 for the test of servlet and JSP. After 
that , I move all the work on a server Debian station.
Strangely, I have no error message (I searched on TomCat logs, I have found 
nothing). Error logs can be elsewhere ?

I am using Netbeans 4.1 and Java 1.5.0.0_4

Thank you.
Maxime


perhaps you can describe your problem a little bit more, for example: do 
you getting an error message, stack trace or something. on what platforms 
are you working windows, linux, ...



-Ursprüngliche Nachricht-
Von: Maxime [mailto:[EMAIL PROTECTED]
Gesendet: Donnerstag, 7. Juli 2005 10:19
An: commons-user@jakarta.apache.org
Betreff: [FileUpload] It's works under Firefox but not on IE, why ?

Hello Everybody,
During 2 days, I was testing FileUpload on IE and it never
work. After that, I tried on Firefox and it's works perfectly.
Can you tell me why and how to resolve this problem ?
It's a really pain in an ... :)

Thank you.
Maxime



Here the form :
HTML
HEAD
/HEAD

BODY BGCOLOR=#FDF5E6

h1Upload de Fichier/h1

form name=upload method=post action=/UploadFileServlet
enctype=multipart/form-data 

Upload File:input type=file name=source size=30

input type=submit name=submitFile value=Upload title=Upload

/form
/BODY
/HTML

Here the Servlet :

import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import org.apache.commons.fileupload.*;
import org.apache.commons.fileupload.*;


public class UploadFileServlet extends HttpServlet {
public void doPost(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {

System.out.println (Uploading-Servlet);
try{
   // Create a new file upload handler
   DiskFileUpload upload = new DiskFileUpload();

   // Set upload parameters
   int  yourMaxMemorySize = 512 * 1024 * 8;
   int  yourMaxRequestSize = 1024 * 1024 * 8;
   String yourTempDirectory = c:\\;

   upload.setSizeThreshold(yourMaxMemorySize);
   upload.setSizeMax(yourMaxRequestSize);
   upload.setRepositoryPath(yourTempDirectory);

   //Parse the request
   List items = upload.parseRequest(request);

   // Process the uploaded items
   Iterator iter = items.iterator();
   while (iter.hasNext()) {

   FileItem item = (FileItem) iter.next();

   //   Process a regular form field
   if (item.isFormField()) {
   String name = item.getFieldName();
   String value = item.getString();

   }
  // Process a file upload
  else {
   String fieldName = item.getFieldName();
   String fileName = item.getName();
   String contentType = item.getContentType();
   boolean isInMemory = item.isInMemory();
   File uploadedFile = new
File(yourTempDirectory + fileName);
   item.write(uploadedFile);

  }
   }
} catch (ServletException e) {
   e.printStackTrace();
} catch (IOException e) {
   e.printStackTrace();
} catch (FileUploadException e) {
   e.printStackTrace();
} catch (Exception e) {
   e.printStackTrace();
}

   }

}



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



AW: [FileUpload] It's works under Firefox but not on IE, why ?

2005-07-07 Thread Knezevic, Mihael
if you have not specified an extra logger for the web app the output should go 
to catalina.out. e.printStackTrace() puts everything on the error output stream 
which also goes to catalina.out.

FileItem.getName() will return different paths for ie and firefox. firefox only 
returns the name and ie the whole path (hmmm. or the other way round). there 
was a discussion some weeks ago about this topic. 

and you'll run into a little problem (which is resolvable) when you move to 
debian. cause the file separator are different and when you get a the absolute 
file name from the ie for the uploaded file, you have to figure out on your own 
what belongs to the filename and what to the path because of the different file 
separator. there was also a discussion of this topic some weeks ago. just have 
a look at the archives about that.

i would try and check for item.getName() and take a look at it via 
System.err.println(item.getName());

 -Ursprüngliche Nachricht-
 Von: Maxime [mailto:[EMAIL PROTECTED] 
 Gesendet: Donnerstag, 7. Juli 2005 11:20
 An: Jakarta Commons Users List
 Betreff: Re: [FileUpload] It's works under Firefox but not on 
 IE, why ?
 
 Well,
 I am working under Windows XP SP 2 for the test of servlet 
 and JSP. After 
 that , I move all the work on a server Debian station.
 Strangely, I have no error message (I searched on TomCat 
 logs, I have found 
 nothing). Error logs can be elsewhere ?
 I am using Netbeans 4.1 and Java 1.5.0.0_4
 
 Thank you.
 Maxime
 
 
 perhaps you can describe your problem a little bit more, for 
 example: do 
 you getting an error message, stack trace or something. on 
 what platforms 
 are you working windows, linux, ...
 
  -Ursprüngliche Nachricht-
  Von: Maxime [mailto:[EMAIL PROTECTED]
  Gesendet: Donnerstag, 7. Juli 2005 10:19
  An: commons-user@jakarta.apache.org
  Betreff: [FileUpload] It's works under Firefox but not on IE, why ?
 
  Hello Everybody,
  During 2 days, I was testing FileUpload on IE and it never
  work. After that, I tried on Firefox and it's works perfectly.
  Can you tell me why and how to resolve this problem ?
  It's a really pain in an ... :)
 
  Thank you.
  Maxime
 
 
 
  Here the form :
  HTML
  HEAD
  /HEAD
 
  BODY BGCOLOR=#FDF5E6
 
  h1Upload de Fichier/h1
 
  form name=upload method=post action=/UploadFileServlet
  enctype=multipart/form-data 
 
  Upload File:input type=file name=source size=30
 
  input type=submit name=submitFile value=Upload 
 title=Upload
 
  /form
  /BODY
  /HTML
 
  Here the Servlet :
 
  import java.io.*;
  import java.util.*;
  import javax.servlet.*;
  import javax.servlet.http.*;
  import org.apache.commons.fileupload.*;
  import org.apache.commons.fileupload.*;
 
 
  public class UploadFileServlet extends HttpServlet {
  public void doPost(HttpServletRequest request,
  HttpServletResponse response)
  throws ServletException, IOException {
 
  System.out.println (Uploading-Servlet);
  try{
 // Create a new file upload handler
 DiskFileUpload upload = new DiskFileUpload();
 
 // Set upload parameters
 int  yourMaxMemorySize = 512 * 1024 * 8;
 int  yourMaxRequestSize = 1024 * 1024 * 8;
 String yourTempDirectory = c:\\;
 
 upload.setSizeThreshold(yourMaxMemorySize);
 upload.setSizeMax(yourMaxRequestSize);
 upload.setRepositoryPath(yourTempDirectory);
 
 //Parse the request
 List items = upload.parseRequest(request);
 
 // Process the uploaded items
 Iterator iter = items.iterator();
 while (iter.hasNext()) {
 
 FileItem item = (FileItem) iter.next();
 
 //   Process a regular form field
 if (item.isFormField()) {
 String name = item.getFieldName();
 String value = item.getString();
 
 }
// Process a file upload
else {
 String fieldName = item.getFieldName();
 String fileName = item.getName();
 String contentType = item.getContentType();
 boolean isInMemory = item.isInMemory();
 File uploadedFile = new
  File(yourTempDirectory + fileName);
 item.write(uploadedFile);
 
}
 }
  } catch (ServletException e) {
 e.printStackTrace();
  } catch (IOException e) {
 e.printStackTrace();
  } catch (FileUploadException e) {
 e.printStackTrace();
  } catch (Exception e) {
 e.printStackTrace();
  }
 
 }
 
  }
 
 
 -
 To unsubscribe, e-mail: [EMAIL 

Re: [DBUtils] QueryRunner.fillStatement is not static

2005-07-07 Thread Elifarley
Hmm... I see.

And what about this:

-- 
  protected void fillStatement(PreparedStatement stmt, Object[] params)
  throws SQLException {
defaultFillStatement(stmt, params);
  }


  public static void defaultFillStatement(PreparedStatement stmt, Object[] 
params)
  throws SQLException {

if (params == null) {
  return;
}

for (int i = 0; i  params.length; i++) {
  if (params[i] != null) {
  stmt.setObject(i + 1, params[i]);
  } else {
  stmt.setNull(i + 1, Types.OTHER);
  }
}

  }
--

Doing so still allows the method to be subclassed and does not force me to
create an instance to use this functionality.

Cheers,
Elifarley

On Wed, 06 Jul 2005 17:36:35 -0700, David Graham wrote:

 Referencing instance state is not a worthy criteria for making a method
 static.  Changing fillStatement() to static would break the many
 subclasses that override this method to provide customized behavior.
 Static methods cannot be overridden.
 
 David
 
 
 --- Elifarley [EMAIL PROTECTED] wrote:
 
 The method 'QueryRunner.fillStatement' is not static even though no
 instance state is referenced. Could it be officially changed into a
 static
 method ?
 
 (I need to use this functionality but I don't want to instantiate this
 class just to use this method).
 
 Regards,
 Elifarley
 
 
 Get Firefox!
 http://www.mozilla.org/firefox/
 
 
 
  Sell on Yahoo!
 Auctions – no fees. Bid on great items. http://auctions.yahoo.com/



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [FileUpload] It's works under Firefox but not on IE, why ?

2005-07-07 Thread Maxime

Hello Mihael,
Thank you veru much for your answer and the advice about Debian.
Now I did some checking like : out.println(fileName);
and it's returning all the path of the file under IE.

out.println(fileName);

IE  : D:\DOCUMENTS\photo.jpg
FireFox : photo.jpg

It's look like the problem is coming from here because for writing a file I 
use that :


String fileName = item.getName();
File uploadedFile = new File(yourTempDirectory + fileName);
item.write(uploadedFile);

Well well, I wonder how I have to do in order to have the same result as 
FireFox.

Any idea ?
Thank you very much anyway.

Maxime


- Original Message - 
From: Knezevic, Mihael [EMAIL PROTECTED]

To: Jakarta Commons Users List commons-user@jakarta.apache.org
Sent: Thursday, July 07, 2005 11:36 AM
Subject: AW: [FileUpload] It's works under Firefox but not on IE, why ?


if you have not specified an extra logger for the web app the output should 
go to catalina.out. e.printStackTrace() puts everything on the error output 
stream which also goes to catalina.out.


FileItem.getName() will return different paths for ie and firefox. firefox 
only returns the name and ie the whole path (hmmm. or the other way round). 
there was a discussion some weeks ago about this topic.


and you'll run into a little problem (which is resolvable) when you move to 
debian. cause the file separator are different and when you get a the 
absolute file name from the ie for the uploaded file, you have to figure out 
on your own what belongs to the filename and what to the path because of the 
different file separator. there was also a discussion of this topic some 
weeks ago. just have a look at the archives about that.


i would try and check for item.getName() and take a look at it via 
System.err.println(item.getName());



-Ursprüngliche Nachricht-
Von: Maxime [mailto:[EMAIL PROTECTED]
Gesendet: Donnerstag, 7. Juli 2005 11:20
An: Jakarta Commons Users List
Betreff: Re: [FileUpload] It's works under Firefox but not on
IE, why ?

Well,
I am working under Windows XP SP 2 for the test of servlet
and JSP. After
that , I move all the work on a server Debian station.
Strangely, I have no error message (I searched on TomCat
logs, I have found
nothing). Error logs can be elsewhere ?
I am using Netbeans 4.1 and Java 1.5.0.0_4

Thank you.
Maxime


perhaps you can describe your problem a little bit more, for
example: do
you getting an error message, stack trace or something. on
what platforms
are you working windows, linux, ...

 -Ursprüngliche Nachricht-
 Von: Maxime [mailto:[EMAIL PROTECTED]
 Gesendet: Donnerstag, 7. Juli 2005 10:19
 An: commons-user@jakarta.apache.org
 Betreff: [FileUpload] It's works under Firefox but not on IE, why ?

 Hello Everybody,
 During 2 days, I was testing FileUpload on IE and it never
 work. After that, I tried on Firefox and it's works perfectly.
 Can you tell me why and how to resolve this problem ?
 It's a really pain in an ... :)

 Thank you.
 Maxime



 Here the form :
 HTML
 HEAD
 /HEAD

 BODY BGCOLOR=#FDF5E6

 h1Upload de Fichier/h1

 form name=upload method=post action=/UploadFileServlet
 enctype=multipart/form-data 

 Upload File:input type=file name=source size=30

 input type=submit name=submitFile value=Upload
title=Upload

 /form
 /BODY
 /HTML

 Here the Servlet :

 import java.io.*;
 import java.util.*;
 import javax.servlet.*;
 import javax.servlet.http.*;
 import org.apache.commons.fileupload.*;
 import org.apache.commons.fileupload.*;


 public class UploadFileServlet extends HttpServlet {
 public void doPost(HttpServletRequest request,
 HttpServletResponse response)
 throws ServletException, IOException {

 System.out.println (Uploading-Servlet);
 try{
// Create a new file upload handler
DiskFileUpload upload = new DiskFileUpload();

// Set upload parameters
int  yourMaxMemorySize = 512 * 1024 * 8;
int  yourMaxRequestSize = 1024 * 1024 * 8;
String yourTempDirectory = c:\\;

upload.setSizeThreshold(yourMaxMemorySize);
upload.setSizeMax(yourMaxRequestSize);
upload.setRepositoryPath(yourTempDirectory);

//Parse the request
List items = upload.parseRequest(request);

// Process the uploaded items
Iterator iter = items.iterator();
while (iter.hasNext()) {

FileItem item = (FileItem) iter.next();

//   Process a regular form field
if (item.isFormField()) {
String name = item.getFieldName();
String value = item.getString();

}
   // Process a file upload
   else {
String fieldName = item.getFieldName();
String fileName = item.getName();

Re: [jira] Commented: (JELLY-213) Generating xml nodes with attributes in diferente namespaces (for schemas..)

2005-07-07 Thread Paul Libbrecht

Diogo,

Le 7 juil. 05, à 11:09, Diogo Bacelar Quintela (JIRA) a écrit :

I'll investigate what you said.
Btw, I am adding a tag to jelly-xml tags that i'll add as a patch 
later...

A tag to suppport namespace subtitution, i'll explain it's needs then..


That might be then better together.
I tried looking around, maybe not long enough, but did not find a way 
to find registered namespaces so that the namespace URI would be pulled 
from the environment... but I forgot to look at XPath-based tags yet...


paul

PS: I am unclear how much the need for start end endPrefixMapping are 
fundamental... it may be not needed since we're not talking as a 
parser...


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Transaction API, ReadWriteLock - RESOLVED

2005-07-07 Thread LeRoy . Yanta





Oliver,

Thanks for your help on this issue.

LeRoy





   
 Oliver Zeigermann 
 oliver.zeigerman 
 [EMAIL PROTECTED]   
To 
   Jakarta Commons Users List  
 07/07/2005 02:47  commons-user@jakarta.apache.org   
 AM cc 
   
   Subject 
 Please respond to Re: Transaction API, ReadWriteLock  
 Jakarta Commons  
Users List
 [EMAIL PROTECTED] 
 arta.apache.org  
   
   




Yes, all participating threads would need to access the same
transaction manager.

Oliver

On 7/6/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:





 Switching to use a manager to manage lock references eliminates the need
to
 mange lock references, but doesn't this just push this reference problem
to
 the manager object?

 If classes foo1 and foo2 needed to write to the same file, they would
need
 to reference the same manager object to be aware of the lock that was
 created by the other class.  If so, then the creation of the manager
object
 would need to be placed in Singleton object so both classes could obtain
 the same reference to the manager object.  Correct?

 LeRoy






  Oliver Zeigermann
  oliver.zeigerman
  [EMAIL PROTECTED]
To
Jakarta Commons Users List
  07/06/2005 09:47  commons-user@jakarta.apache.org
  AM
cc


Subject
  Please respond to Re: Transaction API, ReadWriteLock
  Jakarta Commons
 Users List
  [EMAIL PROTECTED]
  arta.apache.org






 Exactly. In most cases I would recommend to use a manager.

 Oliver

 On 7/6/05, Aaron Hamid [EMAIL PROTECTED] wrote:
  I see, so if I do not wish to manage the lock references myself, I (and
 LeRoy also) should always obtain locks through a LockManager.
 
  Aaron
 
  Oliver Zeigermann wrote:
   By the way, when giving me first advice I stumbled over exactly this
   difference between the lock manager and the lock itself...
  
   Oliver
  
   On 7/6/05, Oliver Zeigermann [EMAIL PROTECTED] wrote:
  
  You are right, but only for the lock manager. The lock manager takes
  care of uniquely mapping a resource id to a lock, but when you work
on
  a lock *directly* it must - of course - be the same object.
  
  Oliver
  
  On 7/6/05, Aaron Hamid [EMAIL PROTECTED] wrote:
  
  Is this true?  It was my impression, have first written such a
class,
 and then finding and skimming the javadoc for [ReadWrite]LockManager, and
 particularly 'getLock' and 'createLock', that lock singletons would be
 automatically created and managed.  Otherwise the developer must write a
 lot of boilerplate code for keeping a singleton map of locks.  Surely
only
 the 'resourceId' must be the same, and not the actual ReadWriteLock
 reference?
  
  LockManager: Encapsulates creation, removal, and retrieval of
locks.
 Each resource can have at most a single lock.
  
  Aaron
  
  Oliver Zeigermann wrote:
  
  Ooops, sorry, you are right. Not only the resource Id, but the lock
  *itself* must be the same in both threads.
  
  Doing it this way:
  
final ReadWriteLock fileLock = new
 ReadWriteLock(Huhu, loggerFacade);
Runnable run = new Runnable() {
  
public void run() {
  
try {
System.out.println(before
 acquiring a lock 
+
 Thread.currentThread());
boolean result =
 fileLock.acquireWrite(Thread
  
 .currentThread(), Long.MAX_VALUE);
System.out.println(lock
 result:  + result +  
+
 Thread.currentThread());
Thread.sleep(2);
System.out.println(after
 sleeping 
+
 Thread.currentThread());
} catch (InterruptedException e) {
  
e.printStackTrace(System.err);
  

Re: [FileUpload] It's works under Firefox but not on IE, why ?

2005-07-07 Thread Schalk Neethling

Greetings

This should help you get started:

if(item.getFieldName().equals(uploadPDF)) {
  
   int i = item.getName().lastIndexOf('\\');
   uploadPDF = 
servletUtilities.filter(item.getName().substring(i+1));
   File savedFile = new File(serverFolder, 
servletUtilities.filter(item.getName().substring(i+1)) );

   item.write(savedFile);

Maxime wrote:


Hello Mihael,
Thank you veru much for your answer and the advice about Debian.
Now I did some checking like : out.println(fileName);
and it's returning all the path of the file under IE.

out.println(fileName);

IE  : D:\DOCUMENTS\photo.jpg
FireFox : photo.jpg

It's look like the problem is coming from here because for writing a 
file I use that :


String fileName = item.getName();
File uploadedFile = new File(yourTempDirectory + fileName);
item.write(uploadedFile);

Well well, I wonder how I have to do in order to have the same result 
as FireFox.

Any idea ?
Thank you very much anyway.

Maxime


- Original Message - From: Knezevic, Mihael 
[EMAIL PROTECTED]

To: Jakarta Commons Users List commons-user@jakarta.apache.org
Sent: Thursday, July 07, 2005 11:36 AM
Subject: AW: [FileUpload] It's works under Firefox but not on IE, why ?


if you have not specified an extra logger for the web app the output 
should go to catalina.out. e.printStackTrace() puts everything on the 
error output stream which also goes to catalina.out.


FileItem.getName() will return different paths for ie and firefox. 
firefox only returns the name and ie the whole path (hmmm. or the 
other way round). there was a discussion some weeks ago about this topic.


and you'll run into a little problem (which is resolvable) when you 
move to debian. cause the file separator are different and when you 
get a the absolute file name from the ie for the uploaded file, you 
have to figure out on your own what belongs to the filename and what 
to the path because of the different file separator. there was also a 
discussion of this topic some weeks ago. just have a look at the 
archives about that.


i would try and check for item.getName() and take a look at it via 
System.err.println(item.getName());



-Ursprüngliche Nachricht-
Von: Maxime [mailto:[EMAIL PROTECTED]
Gesendet: Donnerstag, 7. Juli 2005 11:20
An: Jakarta Commons Users List
Betreff: Re: [FileUpload] It's works under Firefox but not on
IE, why ?

Well,
I am working under Windows XP SP 2 for the test of servlet
and JSP. After
that , I move all the work on a server Debian station.
Strangely, I have no error message (I searched on TomCat
logs, I have found
nothing). Error logs can be elsewhere ?
I am using Netbeans 4.1 and Java 1.5.0.0_4

Thank you.
Maxime


perhaps you can describe your problem a little bit more, for
example: do
you getting an error message, stack trace or something. on
what platforms
are you working windows, linux, ...

 -Ursprüngliche Nachricht-
 Von: Maxime [mailto:[EMAIL PROTECTED]
 Gesendet: Donnerstag, 7. Juli 2005 10:19
 An: commons-user@jakarta.apache.org
 Betreff: [FileUpload] It's works under Firefox but not on IE, why ?

 Hello Everybody,
 During 2 days, I was testing FileUpload on IE and it never
 work. After that, I tried on Firefox and it's works perfectly.
 Can you tell me why and how to resolve this problem ?
 It's a really pain in an ... :)

 Thank you.
 Maxime



 Here the form :
 HTML
 HEAD
 /HEAD

 BODY BGCOLOR=#FDF5E6

 h1Upload de Fichier/h1

 form name=upload method=post action=/UploadFileServlet
 enctype=multipart/form-data 

 Upload File:input type=file name=source size=30

 input type=submit name=submitFile value=Upload
title=Upload

 /form
 /BODY
 /HTML

 Here the Servlet :

 import java.io.*;
 import java.util.*;
 import javax.servlet.*;
 import javax.servlet.http.*;
 import org.apache.commons.fileupload.*;
 import org.apache.commons.fileupload.*;


 public class UploadFileServlet extends HttpServlet {
 public void doPost(HttpServletRequest request,
 HttpServletResponse response)
 throws ServletException, IOException {

 System.out.println (Uploading-Servlet);
 try{
// Create a new file upload handler
DiskFileUpload upload = new DiskFileUpload();

// Set upload parameters
int  yourMaxMemorySize = 512 * 1024 * 8;
int  yourMaxRequestSize = 1024 * 1024 * 8;
String yourTempDirectory = c:\\;

upload.setSizeThreshold(yourMaxMemorySize);
upload.setSizeMax(yourMaxRequestSize);
upload.setRepositoryPath(yourTempDirectory);

//Parse the request
List items = upload.parseRequest(request);

// Process the uploaded items
Iterator iter = items.iterator();
while (iter.hasNext()) {

FileItem item = (FileItem) iter.next();

//   Process a 

Re: [collections] Name that data structure

2005-07-07 Thread Wendy Smoak

From: Tim O'Brien [EMAIL PROTECTED]


Or you could do something that takes more work, but I think it more fun:



A belated thank you for the suggestions... I haven't gotten back around to 
working on this requirement yet, but I'm sure one or more of the things in 
this thread will help tremendously.


--
Wendy Smoak 




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[DBUtils] Oracle Row Processor

2005-07-07 Thread Henry Voyer
Hi everyone

Is there a free implementation of an Oracle Row processor ?

Where can i find it ?

Regards


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [DBUtils] QueryRunner.fillStatement is not static

2005-07-07 Thread David Graham
The problem is with the setNull() handling.  In the latest code we're
using Types.VARCHAR because OTHER did not work for all drivers.  In fact,
the primary reason the method is protected is so you can override the null
behavior if it doesn't work for your driver.

We could add a DbUtils.fillStatement() static method.  Of course, this
wouldn't work for everyone and wouldn't be customizable because it's
static.  If you really want this method please open a Bugzilla enhancement
ticket and attach a cvs diff -u formatted patch.

http://issues.apache.org/bugzilla/

Thanks,
David


--- Elifarley [EMAIL PROTECTED] wrote:

 Hmm... I see.
 
 And what about this:
 
 -- 
   protected void fillStatement(PreparedStatement stmt, Object[] params)
   throws SQLException {
 defaultFillStatement(stmt, params);
   }
 
 
   public static void defaultFillStatement(PreparedStatement stmt,
 Object[] params)
   throws SQLException {
 
 if (params == null) {
   return;
 }
 
 for (int i = 0; i  params.length; i++) {
   if (params[i] != null) {
   stmt.setObject(i + 1, params[i]);
   } else {
   stmt.setNull(i + 1, Types.OTHER);
   }
 }
 
   }
 --
 
 Doing so still allows the method to be subclassed and does not force me
 to
 create an instance to use this functionality.
 
 Cheers,
 Elifarley
 
 On Wed, 06 Jul 2005 17:36:35 -0700, David Graham wrote:
 
  Referencing instance state is not a worthy criteria for making a
 method
  static.  Changing fillStatement() to static would break the many
  subclasses that override this method to provide customized behavior.
  Static methods cannot be overridden.
  
  David
  
  
  --- Elifarley [EMAIL PROTECTED] wrote:
  
  The method 'QueryRunner.fillStatement' is not static even though no
  instance state is referenced. Could it be officially changed into a
  static
  method ?
  
  (I need to use this functionality but I don't want to instantiate
 this
  class just to use this method).
  
  Regards,
  Elifarley
  

Get Firefox!
http://www.mozilla.org/firefox/




Sell on Yahoo! Auctions – no fees. Bid on great items.  
http://auctions.yahoo.com/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [DBUtils] Oracle Row Processor

2005-07-07 Thread David Graham
I'm not quite sure what you mean.  Can you be more specific about why the
current implementation doesn't work for Oracle?

Thanks,
David

--- Henry Voyer [EMAIL PROTECTED] wrote:

 Hi everyone
 
 Is there a free implementation of an Oracle Row processor ?
 
 Where can i find it ?
 
 Regards
 
 


Get Firefox!
http://www.mozilla.org/firefox/




Sell on Yahoo! Auctions – no fees. Bid on great items.  
http://auctions.yahoo.com/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: [DBUtils] Oracle Row Processor

2005-07-07 Thread Henry Voyer
Hi

I just created my oracle row processor.

The current implementation of BasicRowProcessor has a method
that checks if the field is valid :
private boolean isCompatibleType(Object value, Class type)

This method ignore dates and most important specific JDBC values.

Oracle timestamp is transformed in the jdbc process into a oracle.sql.DATE
object that needs to be transformed into a java.util.date .

So in order to use dates in oracle we need to add the transformation process
in the row processor.

Regards



-Original Message-
From: David Graham [mailto:[EMAIL PROTECTED]
Sent: Thursday, July 07, 2005 12:37 PM
To: Jakarta Commons Users List; [EMAIL PROTECTED]
Subject: Re: [DBUtils] Oracle Row Processor


I'm not quite sure what you mean.  Can you be more specific about why the
current implementation doesn't work for Oracle?

Thanks,
David

--- Henry Voyer [EMAIL PROTECTED] wrote:

 Hi everyone

 Is there a free implementation of an Oracle Row processor ?

 Where can i find it ?

 Regards




Get Firefox!
http://www.mozilla.org/firefox/




Sell on Yahoo! Auctions – no fees. Bid on great items.
http://auctions.yahoo.com/


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: JVM Crash calling Configuration on 64-Bit Server VM (1.5.0_04-b05) for solaris-amd64

2005-07-07 Thread Oliver Heger
Strange, especially that it happens only sometimes. I would be 
interested in Sun's answer.


But I would guess that this is more likely a problem with the JVM. 
Normal Java code (that does not directly call native code) should not be 
able to crash the JVM.


Oliver

William Evans wrote:


Oliver,
The JVM crash happens before any message is printed out, probably during
class loading/compilation. However, it doesn't always happen - probably
50% of the time.

I could, I suppose iterate through all the classes in the Configuration
jars and load them manually until I hit the problem. What do you think?

Yesterday, I opened up a case with Sun Support (we have paid support),
so I am hoping that they'll pursue as well.

Incidentally, I have had similar problems running the 64bit JVM on
Fedora. I only posted here because I managed to recreate with very
simple code.

Thanks for your interest.
Regards
Bill




-Original Message-
From: Oliver Heger [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, July 06, 2005 10:51 PM

To: Jakarta Commons Users List
Subject: Re: JVM Crash calling Configuration on 64-Bit Server VM
(1.5.0_04-b05) for solaris-amd64

William Evans wrote:
 


I have an application that uses Commons Configuration.

It runs on an AMD64 SunFire (dual processor) box under Solaris 10.

When I run with the JVM in 32 bit it runs fine but as soon as I try it
in 64 bit mode it takes a JVM crash.



I isolated the problem to calls into the Configuration package and
   


wrote
 


a test class that does only the following:



   try {

   Configuration config = new
PropertiesConfiguration(args[0]);

   System.out.println(Properties:);

   for (Iterator iter = config.getKeys();
   


iter.hasNext();)
 


{

   String key = (String) iter.next();

   System.out.println(\n + key +  =  +
config.getString(key));

   }

   }

   catch (Exception e) {

   System.out.println(Error reading file  + args[0] +
\n + e.toString());

   }



Almost every time I run it crashes the JVM but only when running in 64
bit mode.



Has anyone else seen this? 


Bill

   



I haven't seen this before. What makes me wonder is that 
PropertiesConfiguration by inheriting from BaseConfiguration is (at 
least for the methods you use in your test) only a thin wrapper for a 
map object (in fact it's a

org.apache.commons.collections.map.LinkedMap).

Any chance that you can find out the concrete line where the crash 
happens (maybe by adding further trace statements and flushing the 
output stream after each write)?


Oliver

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


 




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: JVM Crash calling Configuration on 64-Bit Server VM (1.5.0_04-b05) for solaris-amd64

2005-07-07 Thread William Evans
I'll let you know Sun's response.

-Original Message-
From: Oliver Heger [mailto:[EMAIL PROTECTED] 
Sent: Thursday, July 07, 2005 10:42 AM
To: Jakarta Commons Users List
Subject: Re: JVM Crash calling Configuration on 64-Bit Server VM
(1.5.0_04-b05) for solaris-amd64

Strange, especially that it happens only sometimes. I would be 
interested in Sun's answer.

But I would guess that this is more likely a problem with the JVM. 
Normal Java code (that does not directly call native code) should not be

able to crash the JVM.

Oliver

William Evans wrote:

Oliver,
The JVM crash happens before any message is printed out, probably
during
class loading/compilation. However, it doesn't always happen - probably
50% of the time.

I could, I suppose iterate through all the classes in the Configuration
jars and load them manually until I hit the problem. What do you think?

Yesterday, I opened up a case with Sun Support (we have paid support),
so I am hoping that they'll pursue as well.

Incidentally, I have had similar problems running the 64bit JVM on
Fedora. I only posted here because I managed to recreate with very
simple code.

Thanks for your interest.
Regards
Bill




-Original Message-
From: Oliver Heger [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, July 06, 2005 10:51 PM
To: Jakarta Commons Users List
Subject: Re: JVM Crash calling Configuration on 64-Bit Server VM
(1.5.0_04-b05) for solaris-amd64

William Evans wrote:
  

I have an application that uses Commons Configuration.

It runs on an AMD64 SunFire (dual processor) box under Solaris 10.

When I run with the JVM in 32 bit it runs fine but as soon as I try it
in 64 bit mode it takes a JVM crash.

 

I isolated the problem to calls into the Configuration package and


wrote
  

a test class that does only the following:

 

try {

Configuration config = new
PropertiesConfiguration(args[0]);

System.out.println(Properties:);

for (Iterator iter = config.getKeys();


iter.hasNext();)
  

{

String key = (String) iter.next();

System.out.println(\n + key +  =  +
config.getString(key));

}

}

catch (Exception e) {

System.out.println(Error reading file  + args[0] +
\n + e.toString());

}

 

Almost every time I run it crashes the JVM but only when running in 64
bit mode.

 

Has anyone else seen this? 

Bill




I haven't seen this before. What makes me wonder is that 
PropertiesConfiguration by inheriting from BaseConfiguration is (at 
least for the methods you use in your test) only a thin wrapper for a 
map object (in fact it's a
org.apache.commons.collections.map.LinkedMap).

Any chance that you can find out the concrete line where the crash 
happens (maybe by adding further trace statements and flushing the 
output stream after each write)?

Oliver

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


  



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: [DBUtils] Oracle Row Processor

2005-07-07 Thread David Graham


--- Henry Voyer [EMAIL PROTECTED] wrote:

 Hi
 
 I just created my oracle row processor.
 
 The current implementation of BasicRowProcessor has a method
 that checks if the field is valid :
 private boolean isCompatibleType(Object value, Class type)
 
 This method ignore dates and most important specific JDBC values.

That's not true.  The first thing that method checks is if the object is
an instance of the setter method's parameter type.  This will handle all
Objects.  The rest of the method is only needed for primitive values.

 
 Oracle timestamp is transformed in the jdbc process into a
 oracle.sql.DATE
 object that needs to be transformed into a java.util.date .
 
 So in order to use dates in oracle we need to add the transformation
 process
 in the row processor.

I think the method you're interested in is BeanProcessor.processColumn()
http://jakarta.apache.org/commons/dbutils/xref/org/apache/commons/dbutils/BeanProcessor.html#378

Notice that if your bean property is a java.sql.Timestamp,
ResultSet.getTimestamp() is called.  Oracle will give you a proper
Timestamp object rather than their horrible custom class.

Download a nightly DbUtils build, change your bean property to Timestamp,
and I think you'll find the default implementation works fine.

David


 
 Regards
 
 
 
 -Original Message-
 From: David Graham [mailto:[EMAIL PROTECTED]
 Sent: Thursday, July 07, 2005 12:37 PM
 To: Jakarta Commons Users List; [EMAIL PROTECTED]
 Subject: Re: [DBUtils] Oracle Row Processor
 
 
 I'm not quite sure what you mean.  Can you be more specific about why
 the
 current implementation doesn't work for Oracle?
 
 Thanks,
 David
 
 --- Henry Voyer [EMAIL PROTECTED] wrote:
 
  Hi everyone
 
  Is there a free implementation of an Oracle Row processor ?
 
  Where can i find it ?
 
  Regards
 

Get Firefox!
http://www.mozilla.org/firefox/

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[betwixt] AddDefaultsRule bug in 0.7RC2

2005-07-07 Thread Glenn Goldenberg
I think there may be a bug in the 
org.apache.commons.betwixt.digester.AddDefaultsRule class.  I was testing the 
add-adders and add-properties flags on the addDefaults element in the 
.betwixt file.  The flags didn't seem to work correctly, so I debugged into 
AddDefaultsRule and saw on line 69:

addProperties = Boolean.valueOf(addAddersAttributeValue).booleanValue();

I changed this to:

addAdders = Boolean.valueOf(addAddersAttributeValue).booleanValue();

and things worked as expected.

thanks,
glenn

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[io] experience with phonetical encoders in other languages ?

2005-07-07 Thread Paul Libbrecht


Hi,

I would like to know wether the phonetical encoders found in commons-io 
have been used by someone with different langauges than English.
I'm pretty sure they fail for Chinese at least but I'd like to know if 
Soundex and Metaphone have a chance for, say, european languages...


thanks

paul


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: [DBUtils] Oracle Row Processor

2005-07-07 Thread Henry Voyer
Hi David

The version i have is the one that is available as 1.1

i have this in the callSetter method !!!

 try {
   // Don't call setter if the value object isn't the right type
   if (this.isCompatibleType(value, params[0])) {
setter.invoke(target, new Object[] { value });
  }




-Original Message-
From: David Graham [mailto:[EMAIL PROTECTED]
Sent: Thursday, July 07, 2005 3:49 PM
To: Jakarta Commons Users List; [EMAIL PROTECTED]
Subject: RE: [DBUtils] Oracle Row Processor




--- Henry Voyer [EMAIL PROTECTED] wrote:

 Hi

 I just created my oracle row processor.

 The current implementation of BasicRowProcessor has a method
 that checks if the field is valid :
 private boolean isCompatibleType(Object value, Class type)

 This method ignore dates and most important specific JDBC values.

That's not true.  The first thing that method checks is if the object is
an instance of the setter method's parameter type.  This will handle all
Objects.  The rest of the method is only needed for primitive values.


 Oracle timestamp is transformed in the jdbc process into a
 oracle.sql.DATE
 object that needs to be transformed into a java.util.date .

 So in order to use dates in oracle we need to add the transformation
 process
 in the row processor.

I think the method you're interested in is BeanProcessor.processColumn()
http://jakarta.apache.org/commons/dbutils/xref/org/apache/commons/dbutils/Be
anProcessor.html#378

Notice that if your bean property is a java.sql.Timestamp,
ResultSet.getTimestamp() is called.  Oracle will give you a proper
Timestamp object rather than their horrible custom class.

Download a nightly DbUtils build, change your bean property to Timestamp,
and I think you'll find the default implementation works fine.

David



 Regards



 -Original Message-
 From: David Graham [mailto:[EMAIL PROTECTED]
 Sent: Thursday, July 07, 2005 12:37 PM
 To: Jakarta Commons Users List; [EMAIL PROTECTED]
 Subject: Re: [DBUtils] Oracle Row Processor


 I'm not quite sure what you mean.  Can you be more specific about why
 the
 current implementation doesn't work for Oracle?

 Thanks,
 David

 --- Henry Voyer [EMAIL PROTECTED] wrote:

  Hi everyone
 
  Is there a free implementation of an Oracle Row processor ?
 
  Where can i find it ?
 
  Regards
 

Get Firefox!
http://www.mozilla.org/firefox/

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: [DBUtils] Oracle Row Processor

2005-07-07 Thread Alfredo Ledezma Melendez


Henry,

I had the same problem, but it got fixed downloading a nightly build. The one I
have is 1.1-dev and it works pretty well.

Regards,

Alfredo Ledezma Meléndez.
Gerencia de Sistemas CRM
Consultor Externo de Sistemas de Atención a Clientes
RadioMovil DIPSA, S. A. de C. V.
Ejército Nacional No. 488, Col. Anahuac, C.P. 11570
México D.F.

-Original Message-
From: Henry Voyer [mailto:[EMAIL PROTECTED]
Sent: Thursday, July 07, 2005 3:08 PM
To: 'David Graham'; 'Jakarta Commons Users List'
Subject: RE: [DBUtils] Oracle Row Processor

Hi David

The version i have is the one that is available as 1.1

i have this in the callSetter method !!!

 try {
   // Don't call setter if the value object isn't the right type
   if (this.isCompatibleType(value, params[0])) {
setter.invoke(target, new Object[] { value });
  }




-Original Message-
From: David Graham [mailto:[EMAIL PROTECTED]
Sent: Thursday, July 07, 2005 3:49 PM
To: Jakarta Commons Users List; [EMAIL PROTECTED]
Subject: RE: [DBUtils] Oracle Row Processor




--- Henry Voyer [EMAIL PROTECTED] wrote:

 Hi

 I just created my oracle row processor.

 The current implementation of BasicRowProcessor has a method
 that checks if the field is valid :
 private boolean isCompatibleType(Object value, Class type)

 This method ignore dates and most important specific JDBC values.

That's not true.  The first thing that method checks is if the object is
an instance of the setter method's parameter type.  This will handle all
Objects.  The rest of the method is only needed for primitive values.


 Oracle timestamp is transformed in the jdbc process into a
 oracle.sql.DATE
 object that needs to be transformed into a java.util.date .

 So in order to use dates in oracle we need to add the transformation
 process
 in the row processor.

I think the method you're interested in is BeanProcessor.processColumn()
http://jakarta.apache.org/commons/dbutils/xref/org/apache/commons/dbutils/Be
anProcessor.html#378

Notice that if your bean property is a java.sql.Timestamp,
ResultSet.getTimestamp() is called.  Oracle will give you a proper
Timestamp object rather than their horrible custom class.

Download a nightly DbUtils build, change your bean property to Timestamp,
and I think you'll find the default implementation works fine.

David



 Regards



 -Original Message-
 From: David Graham [mailto:[EMAIL PROTECTED]
 Sent: Thursday, July 07, 2005 12:37 PM
 To: Jakarta Commons Users List; [EMAIL PROTECTED]
 Subject: Re: [DBUtils] Oracle Row Processor


 I'm not quite sure what you mean.  Can you be more specific about why
 the
 current implementation doesn't work for Oracle?

 Thanks,
 David

 --- Henry Voyer [EMAIL PROTECTED] wrote:

  Hi everyone
 
  Is there a free implementation of an Oracle Row processor ?
 
  Where can i find it ?
 
  Regards
 

Get Firefox!
http://www.mozilla.org/firefox/

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Este mensaje es exclusivamente para el uso de la persona o entidad a quien esta 
dirigido; contiene informacion estrictamente confidencial y legalmente 
protegida, cuya divulgacion es sancionada por la ley. Si el lector de este 
mensaje no es a quien esta dirigido, ni se trata del empleado o agente 
responsable de esta informacion, se le notifica por medio del presente, que su 
reproduccion y distribucion, esta estrictamente prohibida. Si Usted recibio 
este comunicado por error, favor de notificarlo inmediatamente al remitente y 
destruir el mensaje. Todas las opiniones contenidas en este mail son propias 
del autor del mensaje y no necesariamente coinciden con las de Radiomovil 
Dipsa, S.A. de C.V. o alguna de sus empresas controladas, controladoras, 
afiliadas y subsidiarias. Este mensaje intencionalmente no contiene acentos.

This message is for the sole use of the person or entity to whom it is being 
sent.  Therefore, it contains strictly confidential and legally protected 
material whose disclosure is subject to penalty by law.  If the person reading 
this message is not the one to whom it is being sent and/or is not an employee 
or the responsible agent for this information, this person is herein notified 
that any unauthorized dissemination, distribution or copying of the materials 
included in this facsimile is strictly prohibited.  If you received this 
document by mistake please notify  immediately to the subscriber and destroy 
the message. Any opinions contained in this e-mail are those of the author of 
the message and do not necessarily coincide with those of Radiomovil Dipsa, 
S.A. de C.V. or any of its control, controlled, affiliates and subsidiaries 
companies. No part 

Re: [codec] experience with phonetical encoders in other languages ?

2005-07-07 Thread Stephen Colebourne


Resending to correct project - [codec]

Paul Libbrecht wrote:


Hi,

I would like to know wether the phonetical encoders found in commons-io 
have been used by someone with different langauges than English.
I'm pretty sure they fail for Chinese at least but I'd like to know if 
Soundex and Metaphone have a chance for, say, european languages...


thanks


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]