Re: Possible memory leak in Wicket 1.5.12

2014-12-20 Thread Satrix
Hi,

It would be quite hard to reproduce the problem in quickstart application.
Here is the code of DynamicImageResource:

@Override
protected byte[] getImageData(IResource.Attributes attributes) {
try {
return IOUtils.toByteArray(stream);
} catch (IOException ex) {
LOG.error(Could not return byte[] from  + stream, ex);

return null;
} finally {
if(stream != null){
try {  
stream.close();
} catch (IOException ex) {
LOG.error(Could not close stream, ex);
}
}
}
}

And then I use the NonCachingImage in conjunction with my
DynamicImageResource implementation class.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Possible-memory-leak-in-Wicket-1-5-12-tp4668856p4668863.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Possible memory leak in Wicket 1.5.12

2014-12-20 Thread Francois Meillet
Can you show up the entire class ?


François Meillet
Formation Wicket - Développement Wicket





Le 20 déc. 2014 à 09:56, Satrix satrix...@gmail.com a écrit :

 Hi,
 
 It would be quite hard to reproduce the problem in quickstart application.
 Here is the code of DynamicImageResource:
 
 @Override
protected byte[] getImageData(IResource.Attributes attributes) {
try {
return IOUtils.toByteArray(stream);
} catch (IOException ex) {
LOG.error(Could not return byte[] from  + stream, ex);
 
return null;
} finally {
if(stream != null){
try {  
stream.close();
} catch (IOException ex) {
LOG.error(Could not close stream, ex);
}
}
}
}
 
 And then I use the NonCachingImage in conjunction with my
 DynamicImageResource implementation class.
 
 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Possible-memory-leak-in-Wicket-1-5-12-tp4668856p4668863.html
 Sent from the Users forum mailing list archive at Nabble.com.
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 



Re: Possible memory leak in Wicket 1.5.12

2014-12-20 Thread Satrix
Yeah, sure. Here is the code:

public class LocalFileResource extends DynamicImageResource {
private final Logger LOG = Logger.getLogger(LocalFileResource.class);

private String filePath;
private InputStream stream;

public LocalFileResource(String filePath) throws FileNotFoundException {
this.filePath = filePath;

File file = new File(filePath);
if(!file.exists()){
throw new FileNotFoundException(Could not load file  +
filePath);
}

try {
stream = new FileInputStream(file);
} catch (FileNotFoundException ex) {
throw new FileNotFoundException(Could not obtain stream from 
+ filePath);
}
}

public LocalFileResource(InputStream stream) {
if(stream == null){
throw new IllegalArgumentException(Stream cannot be null);
}

this.stream = stream;
}

@Override
protected byte[] getImageData(IResource.Attributes attributes) {
try {
return IOUtils.toByteArray(stream);
} catch (IOException ex) {
LOG.error(Could not return byte[] from  + stream);

return null;
} finally {
if(stream != null){
try {  
stream.close();
} catch (IOException ex) {
LOG.error(Could not close stream:  + ex.getMessage());
}
}
}
}
}


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Possible-memory-leak-in-Wicket-1-5-12-tp4668856p4668865.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Switching between wicket tabs

2014-12-20 Thread Francois Meillet
use parameters

PageParameters parameters = new PageParameters();
parameters.set(TAB_NUM, 3);
parameters.set(USERNAME_ID, username);

setResponsePage(YourCLaasContainingTheTabbedPanel.class, pageParameters);

and in your YourCLaasContainingTheTabbedPanel.class
extract the parameters

int tabindex = pageParameters.get(TAB_NUM).toInt();

and set tabbedPanel # setSelectedTab accordingly



François Meillet
Formation Wicket - Développement Wicket





Le 20 déc. 2014 à 08:44, K kondetiudayki...@gmail.com a écrit :

 Hi 
 
 I have a similar issue. i am trying to navigate to tab i intend to but issue
 is i have  parameters i need to forward to that tab. can anyone suggest how
 to handle it.
 
 Scenario: i have list of items displaying in tab1 and when i click on the
 item it has to be redirected to tab3 with the item details (lets say
 username and password).
 
 Thanks in advance
 K
 
 -
 K
 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Switching-between-wicket-tabs-tp3044579p4668862.html
 Sent from the Users forum mailing list archive at Nabble.com.
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 



Re: Possible memory leak in Wicket 1.5.12

2014-12-20 Thread Francois Meillet
Hi Satrix,

When the second constructor is used, with the inputsream argument,
the stream is open.

When this inputsream is opened ?


François Meillet





Le 20 déc. 2014 à 10:03, Satrix satrix...@gmail.com a écrit :

 Yeah, sure. Here is the code:
 
 public class LocalFileResource extends DynamicImageResource {
private final Logger LOG = Logger.getLogger(LocalFileResource.class);
 
private String filePath;
private InputStream stream;
 
public LocalFileResource(String filePath) throws FileNotFoundException {
this.filePath = filePath;
 
File file = new File(filePath);
if(!file.exists()){
throw new FileNotFoundException(Could not load file  +
 filePath);
}
 
try {
stream = new FileInputStream(file);
} catch (FileNotFoundException ex) {
throw new FileNotFoundException(Could not obtain stream from 
 + filePath);
}
}
 
public LocalFileResource(InputStream stream) {
if(stream == null){
throw new IllegalArgumentException(Stream cannot be null);
}
 
this.stream = stream;
}
 
@Override
protected byte[] getImageData(IResource.Attributes attributes) {
try {
return IOUtils.toByteArray(stream);
} catch (IOException ex) {
LOG.error(Could not return byte[] from  + stream);
 
return null;
} finally {
if(stream != null){
try {  
stream.close();
} catch (IOException ex) {
LOG.error(Could not close stream:  + ex.getMessage());
}
}
}
}
 }
 
 
 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Possible-memory-leak-in-Wicket-1-5-12-tp4668856p4668865.html
 Sent from the Users forum mailing list archive at Nabble.com.
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 



Re: Possible memory leak in Wicket 1.5.12

2014-12-20 Thread Satrix
Hi,

It's used very rarely so it should not be a problem. However I've moved the
stream creation from the constructor to getImageData method. 

The important point here - it only happens when the crawler visits my
website. When normal users visit my website the file descriptors are closed
successfully.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Possible-memory-leak-in-Wicket-1-5-12-tp4668856p4668868.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Possible memory leak in Wicket 1.5.12

2014-12-20 Thread Francois Meillet
Can you show me the class when you open the stream ?

Did you moved the stream creation to the getImageData this morning ?

François Meillet
Formation Wicket - Développement Wicket





Le 20 déc. 2014 à 10:58, Satrix satrix...@gmail.com a écrit :

 Hi,
 
 It's used very rarely so it should not be a problem. However I've moved the
 stream creation from the constructor to getImageData method. 
 
 The important point here - it only happens when the crawler visits my
 website. When normal users visit my website the file descriptors are closed
 successfully.
 
 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Possible-memory-leak-in-Wicket-1-5-12-tp4668856p4668868.html
 Sent from the Users forum mailing list archive at Nabble.com.
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 



Re: Possible memory leak in Wicket 1.5.12

2014-12-20 Thread Satrix
Actually I've checked the code in the second constructor and the stream is
the ByteArrayInputStream instance. But I've moved the stream creation from
the first constructor to the getImageData because that's the constructor I
use to create the 99% of the images in my website.

And yes I've changed it today.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Possible-memory-leak-in-Wicket-1-5-12-tp4668856p4668870.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Possible memory leak in Wicket 1.5.12

2014-12-20 Thread Francois Meillet
Moving the stream creation, opening and closing it in getImageData is a good 
thing.
You should also remove the second constructor (with the inputstream argument).

Now with your tests classes with the WicketTester, (you do have tests ;-)  ), 
you can play yours pages with a debugger and see what happens.

François Meillet
Formation Wicket - Développement Wicket





Le 20 déc. 2014 à 11:40, Satrix satrix...@gmail.com a écrit :

 Actually I've checked the code in the second constructor and the stream is
 the ByteArrayInputStream instance. But I've moved the stream creation from
 the first constructor to the getImageData because that's the constructor I
 use to create the 99% of the images in my website.
 
 And yes I've changed it today.
 
 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Possible-memory-leak-in-Wicket-1-5-12-tp4668856p4668870.html
 Sent from the Users forum mailing list archive at Nabble.com.
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 



Re: OnChangeAjaxBehavior listened event modified in 1.6.18

2014-12-20 Thread guillaume.mary
Hi,

I agree, while typing 'change' is not fired. But 'inputchange' is. (it's an
implementation of Wicket, its not an native browser event)

So I refined my used case and my problem appears on 'number' text field,
when the user uses the arrows to increment or decrement the value: both
events are fired (at least on FF)

Please note that JQuery is not only suffiscient since its doesn't support
'inpuchange', but Wicket does.

I'm trying to create a JSFiddle but as I said it needs Wicket Javascript
librairies to demonstrate and I don't have any server that can server those
resources at the moment.




Martin Grigorov-4 wrote
 Hi,
 
 On Wed, Dec 17, 2014 at 12:26 PM, guillaume.mary 

 guillaume.mary@

 wrote:

 Hi all,

 With WICKET-5711 OnChangeAjaxBehavior now listen both change and
 inputchange on TextField. Hence when you type in the TextField, the
 behavior is called twice because both events are fired by the browser.
 It's

 
 'change' event shouldn't be fired when typing.
 Just tried it at http://jquery.com/. In the JS console executed:
 $('input[name=s]').change(function()
 {console.log('BOOM')})
 It doesn't log while typing in the search field. It logs when I leave the
 text field.
 
 Which browser ? OS?



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/OnChangeAjaxBehavior-listened-event-modified-in-1-6-18-tp4668814p4668872.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: OnChangeAjaxBehavior listened event modified in 1.6.18

2014-12-20 Thread Martin Grigorov
'inputchange' is 'input' for non-IE browsers and cut/paste for IE

If just 'change' does the job then use
AjaxFormComponentUpdatingBehavior(change).
We have to improve the javadoc of OnChangeAjaxBehavior
On Dec 20, 2014 2:13 PM, guillaume.mary guillaume.m...@interview-efm.com
wrote:

 Hi,

 I agree, while typing 'change' is not fired. But 'inputchange' is. (it's an
 implementation of Wicket, its not an native browser event)

 So I refined my used case and my problem appears on 'number' text field,
 when the user uses the arrows to increment or decrement the value: both
 events are fired (at least on FF)

 Please note that JQuery is not only suffiscient since its doesn't support
 'inpuchange', but Wicket does.

 I'm trying to create a JSFiddle but as I said it needs Wicket Javascript
 librairies to demonstrate and I don't have any server that can server those
 resources at the moment.




 Martin Grigorov-4 wrote
  Hi,
 
  On Wed, Dec 17, 2014 at 12:26 PM, guillaume.mary 

  guillaume.mary@

  wrote:
 
  Hi all,
 
  With WICKET-5711 OnChangeAjaxBehavior now listen both change and
  inputchange on TextField. Hence when you type in the TextField, the
  behavior is called twice because both events are fired by the browser.
  It's
 
 
  'change' event shouldn't be fired when typing.
  Just tried it at http://jquery.com/. In the JS console executed:
  $('input[name=s]').change(function()
  {console.log('BOOM')})
  It doesn't log while typing in the search field. It logs when I leave the
  text field.
 
  Which browser ? OS?



 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/OnChangeAjaxBehavior-listened-event-modified-in-1-6-18-tp4668814p4668872.html
 Sent from the Users forum mailing list archive at Nabble.com.

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




Re: Possible memory leak in Wicket 1.5.12

2014-12-20 Thread Satrix
Looks like it's working now :)

Thank you Francois for your help :)

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Possible-memory-leak-in-Wicket-1-5-12-tp4668856p4668874.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org