GithubHelp home page GithubHelp logo

Comments (7)

GoogleCodeExporter avatar GoogleCodeExporter commented on June 14, 2024
wow. finally a real bug report and a patch (vs. the crap other people submit). 
you rock. =)

i'll get that fixed in svn as soon as i have a chance.

Original comment by [email protected] on 9 Feb 2009 at 9:52

  • Changed state: Accepted

from kaptcha.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 14, 2024
Hey, thanks for answering so fast. I think it is a nice feature, keep up the 
good
work :-)

Original comment by [email protected] on 10 Feb 2009 at 9:15

from kaptcha.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 14, 2024

Original comment by [email protected] on 17 Feb 2009 at 12:57

  • Added labels: Milestone-2.3.1

from kaptcha.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 14, 2024

Original comment by [email protected] on 16 Nov 2010 at 8:33

from kaptcha.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 14, 2024
This issue was closed by revision r117.

Original comment by [email protected] on 20 Nov 2010 at 7:28

  • Changed state: Fixed

from kaptcha.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 14, 2024
What steps will reproduce the problem?
1. Get kaptcha up and running
2. Configure a simple textproducer char string for the DefaultTextCreator,
i.e. use the following parameters:
kaptcha.textproducer.char.string="abcefghijklmnopqrstuvwxyz"
kaptcha.textproducer.char.length=5

What is the expected output? What do you see instead?
Captcha image containing a random sequence of the configured characters.
Instead, only first 5 characters appear. This is due to previous bug fix on 
version 2.3

What version of the product are you using? On what operating system?
kaptcha-2.3.1.jar on Windows XP (will happen on any environment as the
error is in the source code, see below)

Please provide any additional information below.
Take a look at the getText method:

        int length = getConfig().getTextProducerCharLength();
    char[] chars = getConfig().getTextProducerCharString();
    Random rand = new Random();
    StringBuffer text = new StringBuffer();
    for (int i = 0; i < length; i++)
    {
        text.append(chars[rand.nextInt(length)]);
    }

    return text.toString();

This will only produce the first "length" (5) characters.

The correct version is to change line 25 adding "chars.length" instead of 
"length":


        int length = getConfig().getTextProducerCharLength();
    char[] chars = getConfig().getTextProducerCharString();
    Random rand = new Random();
    StringBuffer text = new StringBuffer();
    for (int i = 0; i < length; i++)
    {
        text.append(chars[rand.nextInt(chars.length)]);
    }

    return text.toString();

Attached is a patch to fix this. It simply changes line 25.

Original comment by [email protected] on 25 Nov 2010 at 1:05

Attachments:

from kaptcha.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 14, 2024
ok, i've committed this fix.

Original comment by [email protected] on 5 Dec 2010 at 11:37

  • Added labels: Milestone-2.3.2

from kaptcha.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.