Post
Topic
Board CPU/GPU Bitcoin mining hardware
Re: DiabloMiner GPU Miner (Long Poll, BFI_INT, async networking, multipool)
by
ellipsis
on 17/07/2011, 02:28:42 UTC
Eh, too much trouble. I see you already fixed the exec java bit for Linux. For the others, replace your !"".equals(String) calls (8 instances) with a call to a method like this:

Code:
protected boolean hasLength(String str) {
    return str != null && str.length() > 0;
}

Your splitting on commas for pool support breaks values with commas in them (e.g., passwords).

Around 831, there should be a null check on getWorkParser.

Java coders prefer checking against "" instead of checking length for some reason. Almost all the places I check also check for null as well.

Maybe retarded Java coders. !"".equals(null) evaluates as true (!false). You intend for it to return false, as in this case:

Code:
        if(!"".equals(url.getUserInfo())) {
          String[] userPassSplit = url.getUserInfo().split(":");

If url.getUserInfo() returns null, you will proceed into the conditional block and dereference a null.

Code:
        if(hasLength(url.getUserInfo())) {
          String[] userPassSplit = url.getUserInfo().split(":");

hasLength will return false, and skip the block. Hurrah.

And why around 831? At no point can that be null.

Really? What if you get an InterruptedException before you return from getWorkQueue.take()?

Lesson complete.