Author: nextgens
Date: 2006-07-09 22:41:26 +0000 (Sun, 09 Jul 2006)
New Revision: 9531
Modified:
trunk/freenet/src/freenet/client/ArchiveManager.java
trunk/freenet/src/freenet/client/ClientMetadata.java
trunk/freenet/src/freenet/client/DefaultMIMETypes.java
trunk/freenet/src/freenet/client/Metadata.java
trunk/freenet/src/freenet/client/StandardOnionFECCodec.java
trunk/freenet/src/freenet/client/async/BaseSingleFileFetcher.java
trunk/freenet/src/freenet/client/async/ClientGetter.java
trunk/freenet/src/freenet/client/async/ClientRequestScheduler.java
trunk/freenet/src/freenet/client/async/SimpleManifestPutter.java
trunk/freenet/src/freenet/client/async/SingleBlockInserter.java
trunk/freenet/src/freenet/client/async/SingleFileFetcher.java
trunk/freenet/src/freenet/client/async/SingleFileInserter.java
trunk/freenet/src/freenet/client/async/SplitFileFetcher.java
trunk/freenet/src/freenet/client/async/SplitFileFetcherSegment.java
trunk/freenet/src/freenet/client/async/SplitFileInserter.java
trunk/freenet/src/freenet/client/async/SplitFileInserterSegment.java
trunk/freenet/src/freenet/client/async/USKFetcher.java
trunk/freenet/src/freenet/client/async/USKInserter.java
trunk/freenet/src/freenet/client/async/USKManager.java
trunk/freenet/src/freenet/client/events/SplitfileProgressEvent.java
trunk/freenet/src/freenet/clients/http/BookmarkManager.java
trunk/freenet/src/freenet/clients/http/ConfigToadlet.java
trunk/freenet/src/freenet/clients/http/DarknetConnectionsToadlet.java
trunk/freenet/src/freenet/clients/http/FProxyToadlet.java
trunk/freenet/src/freenet/clients/http/HTTPRequest.java
trunk/freenet/src/freenet/clients/http/N2NTMToadlet.java
trunk/freenet/src/freenet/clients/http/NinjaSpider.java
trunk/freenet/src/freenet/clients/http/PageMaker.java
trunk/freenet/src/freenet/clients/http/PluginToadlet.java
trunk/freenet/src/freenet/clients/http/PproxyToadlet.java
trunk/freenet/src/freenet/clients/http/QueueToadlet.java
trunk/freenet/src/freenet/clients/http/SimpleToadletServer.java
trunk/freenet/src/freenet/clients/http/Spider.java
trunk/freenet/src/freenet/clients/http/StaticToadlet.java
trunk/freenet/src/freenet/clients/http/ToadletContextImpl.java
trunk/freenet/src/freenet/clients/http/WelcomeToadlet.java
trunk/freenet/src/freenet/clients/http/filter/CSSTokenizerFilter.java
trunk/freenet/src/freenet/clients/http/filter/ContentFilter.java
trunk/freenet/src/freenet/clients/http/filter/GenericReadFilterCallback.java
trunk/freenet/src/freenet/clients/http/filter/HTMLFilter.java
trunk/freenet/src/freenet/crypt/DSA.java
trunk/freenet/src/freenet/crypt/DSAGroup.java
trunk/freenet/src/freenet/crypt/DSAGroupGenerator.java
trunk/freenet/src/freenet/crypt/DSASignature.java
trunk/freenet/src/freenet/crypt/Util.java
trunk/freenet/src/freenet/crypt/Yarrow.java
trunk/freenet/src/freenet/crypt/ciphers/Rijndael.java
trunk/freenet/src/freenet/crypt/ciphers/Rijndael_Algorithm.java
trunk/freenet/src/freenet/crypt/ciphers/Rijndael_Properties.java
trunk/freenet/src/freenet/crypt/ciphers/Twofish.java
trunk/freenet/src/freenet/crypt/ciphers/Twofish_Algorithm.java
trunk/freenet/src/freenet/crypt/ciphers/Twofish_Properties.java
trunk/freenet/src/freenet/io/comm/FreenetInetAddress.java
trunk/freenet/src/freenet/io/comm/IOStatisticCollector.java
trunk/freenet/src/freenet/io/comm/MessageFilter.java
trunk/freenet/src/freenet/io/comm/UdpSocketManager.java
trunk/freenet/src/freenet/io/xfer/BlockTransmitter.java
trunk/freenet/src/freenet/keys/CHKBlock.java
trunk/freenet/src/freenet/keys/ClientCHK.java
trunk/freenet/src/freenet/keys/ClientCHKBlock.java
trunk/freenet/src/freenet/keys/ClientSSK.java
trunk/freenet/src/freenet/keys/FreenetURI.java
trunk/freenet/src/freenet/keys/InsertableClientSSK.java
trunk/freenet/src/freenet/keys/InsertableUSK.java
trunk/freenet/src/freenet/keys/Key.java
trunk/freenet/src/freenet/keys/NodeSSK.java
trunk/freenet/src/freenet/keys/USK.java
trunk/freenet/src/freenet/node/ARKFetcher.java
trunk/freenet/src/freenet/node/CHKInsertSender.java
trunk/freenet/src/freenet/node/FNPPacketMangler.java
trunk/freenet/src/freenet/node/IPDetectorPluginManager.java
trunk/freenet/src/freenet/node/InsertHandler.java
trunk/freenet/src/freenet/node/KeyTracker.java
trunk/freenet/src/freenet/node/Location.java
trunk/freenet/src/freenet/node/LocationManager.java
trunk/freenet/src/freenet/node/LoggingConfigHandler.java
trunk/freenet/src/freenet/node/Node.java
trunk/freenet/src/freenet/node/NodeDispatcher.java
trunk/freenet/src/freenet/node/PacketSender.java
trunk/freenet/src/freenet/node/PeerManager.java
trunk/freenet/src/freenet/node/PeerNode.java
trunk/freenet/src/freenet/node/RequestSender.java
trunk/freenet/src/freenet/node/RequestStarter.java
trunk/freenet/src/freenet/node/SSKInsertHandler.java
trunk/freenet/src/freenet/node/SSKInsertSender.java
trunk/freenet/src/freenet/node/TextModeClientInterface.java
trunk/freenet/src/freenet/node/Version.java
trunk/freenet/src/freenet/node/fcp/ClientGet.java
trunk/freenet/src/freenet/node/fcp/ClientGetMessage.java
trunk/freenet/src/freenet/node/fcp/ClientPut.java
trunk/freenet/src/freenet/node/fcp/ClientPutBase.java
trunk/freenet/src/freenet/node/fcp/ClientPutDir.java
trunk/freenet/src/freenet/node/fcp/ClientPutDirMessage.java
trunk/freenet/src/freenet/node/fcp/ClientPutMessage.java
trunk/freenet/src/freenet/node/fcp/ClientRequest.java
trunk/freenet/src/freenet/node/fcp/DirPutFile.java
trunk/freenet/src/freenet/node/fcp/FCPClient.java
trunk/freenet/src/freenet/node/fcp/FCPConnectionHandler.java
trunk/freenet/src/freenet/node/fcp/FCPConnectionInputHandler.java
trunk/freenet/src/freenet/node/fcp/FCPServer.java
trunk/freenet/src/freenet/node/fcp/GetRequestStatusMessage.java
trunk/freenet/src/freenet/node/fcp/PersistentPutDir.java
trunk/freenet/src/freenet/node/fcp/SimpleProgressMessage.java
trunk/freenet/src/freenet/node/updater/NodeUpdater.java
trunk/freenet/src/freenet/node/useralerts/PeerManagerUserAlert.java
trunk/freenet/src/freenet/pluginmanager/DetectedIP.java
trunk/freenet/src/freenet/pluginmanager/PluginManager.java
trunk/freenet/src/freenet/store/BerkeleyDBFreenetStore.java
trunk/freenet/src/freenet/support/Base64.java
trunk/freenet/src/freenet/support/BitArray.java
trunk/freenet/src/freenet/support/BucketTools.java
trunk/freenet/src/freenet/support/CPUInformation/CPUID.java
trunk/freenet/src/freenet/support/DoublyLinkedListImpl.java
trunk/freenet/src/freenet/support/Fields.java
trunk/freenet/src/freenet/support/FileLoggerHook.java
trunk/freenet/src/freenet/support/HTMLDecoder.java
trunk/freenet/src/freenet/support/HexUtil.java
trunk/freenet/src/freenet/support/ImmutableByteArrayWrapper.java
trunk/freenet/src/freenet/support/LimitedRangeIntByteArrayMap.java
trunk/freenet/src/freenet/support/Logger.java
trunk/freenet/src/freenet/support/LoggerHook.java
trunk/freenet/src/freenet/support/MultiValueTable.java
trunk/freenet/src/freenet/support/NumberedItemComparator.java
trunk/freenet/src/freenet/support/NumberedRecentItems.java
trunk/freenet/src/freenet/support/PaddedEphemerallyEncryptedBucket.java
trunk/freenet/src/freenet/support/RandomGrabArray.java
trunk/freenet/src/freenet/support/ReceivedPacketNumbers.java
trunk/freenet/src/freenet/support/SectoredRandomGrabArray.java
trunk/freenet/src/freenet/support/Serializer.java
trunk/freenet/src/freenet/support/SimpleFieldSet.java
trunk/freenet/src/freenet/support/SimpleIntNumberedItemComparator.java
trunk/freenet/src/freenet/support/SizeUtil.java
trunk/freenet/src/freenet/support/SortedLongSet.java
trunk/freenet/src/freenet/support/SortedVectorByNumber.java
trunk/freenet/src/freenet/support/UpdatableSortedLinkedList.java
trunk/freenet/src/freenet/support/io/FilenameGenerator.java
trunk/freenet/src/freenet/support/io/LineReadingInputStream.java
trunk/freenet/src/freenet/support/io/PersistentTempBucketFactory.java
trunk/freenet/src/freenet/support/io/SpyInputStream.java
trunk/freenet/src/freenet/support/math/BootstrappingDecayingRunningAverage.java
trunk/freenet/src/freenet/support/math/SimpleBinaryRunningAverage.java
trunk/freenet/src/freenet/support/math/TimeDecayingRunningAverage.java
trunk/freenet/src/freenet/transport/IPAddressDetector.java
trunk/freenet/src/freenet/transport/IPUtil.java
trunk/freenet/src/net/i2p/util/NativeBigInteger.java
Log:
big patch adding brackets around conditions
Modified: trunk/freenet/src/freenet/client/ArchiveManager.java
===================================================================
--- trunk/freenet/src/freenet/client/ArchiveManager.java 2006-07-09
22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/client/ArchiveManager.java 2006-07-09
22:41:26 UTC (rev 9531)
@@ -168,7 +168,7 @@
* after we have unpacked everything.
*/
boolean throwAtExit = false;
- if(expectedSize != -1 && archiveSize != expectedSize) {
+ if((expectedSize != -1) && (archiveSize != expectedSize)) {
throwAtExit = true;
ctx.setLastSize(archiveSize);
}
@@ -334,7 +334,7 @@
after = "";
} else
after = name.substring(x+1, name.length());
- Object o = (Object) dir.get(before);
+ Object o = dir.get(before);
HashMap map;
if(o == null) {
map = new HashMap();
@@ -382,7 +382,7 @@
* Call synchronized on storedData.
*/
private void trimStoredData() {
- while(cachedData > maxCachedData || storedData.size() >
maxCachedElements) {
+ while((cachedData > maxCachedData) || (storedData.size() >
maxCachedElements)) {
ArchiveStoreItem e = (ArchiveStoreItem)
storedData.popValue();
e.finalize();
}
Modified: trunk/freenet/src/freenet/client/ClientMetadata.java
===================================================================
--- trunk/freenet/src/freenet/client/ClientMetadata.java 2006-07-09
22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/client/ClientMetadata.java 2006-07-09
22:41:26 UTC (rev 9531)
@@ -20,7 +20,7 @@
/** Get the document MIME type. Will always be a valid MIME type,
unless there
* has been an error; if it is unknown, will return
application/octet-stream. */
public String getMIMEType() {
- if(mimeType == null || mimeType.length() == 0)
+ if((mimeType == null) || (mimeType.length() == 0))
return DefaultMIMETypes.DEFAULT_MIME_TYPE;
return mimeType;
}
@@ -30,12 +30,12 @@
* existing information.
*/
public void mergeNoOverwrite(ClientMetadata clientMetadata) {
- if(mimeType == null || mimeType.equals(""))
+ if((mimeType == null) || mimeType.equals(""))
mimeType = clientMetadata.mimeType;
}
public boolean isTrivial() {
- return (mimeType == null || mimeType.equals(""));
+ return ((mimeType == null) || mimeType.equals(""));
}
public Object clone() {
Modified: trunk/freenet/src/freenet/client/DefaultMIMETypes.java
===================================================================
--- trunk/freenet/src/freenet/client/DefaultMIMETypes.java 2006-07-09
22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/client/DefaultMIMETypes.java 2006-07-09
22:41:26 UTC (rev 9531)
@@ -65,7 +65,7 @@
Logger.normal(DefaultMIMETypes.class,
"Extension "+ext+" assigned to "+byNumber(s.shortValue())+" in preference to
"+number+":"+type);
} else {
// If only one, make it primary
- if(outExtension == null &&
extensions.length == 1)
+ if((outExtension == null) &&
(extensions.length == 1))
primaryExtensionByMimeNumber.put(t, ext);
mimeTypesByExtension.put(ext, t);
}
@@ -96,7 +96,7 @@
* Get a known MIME type by number.
*/
public static String byNumber(short x) {
- if(x > mimeTypesByNumber.size() || x < 0)
+ if((x > mimeTypesByNumber.size()) || (x < 0))
return null;
return (String) mimeTypesByNumber.get(x);
}
@@ -738,7 +738,7 @@
/** Guess a MIME type from a filename */
public static String guessMIMEType(String arg) {
int x = arg.lastIndexOf('.');
- if(x == -1 || x == arg.length()-1)
+ if((x == -1) || (x == arg.length()-1))
return DEFAULT_MIME_TYPE;
String ext = arg.substring(x+1).toLowerCase();
Short mimeIndexOb = (Short) mimeTypesByExtension.get(ext);
Modified: trunk/freenet/src/freenet/client/Metadata.java
===================================================================
--- trunk/freenet/src/freenet/client/Metadata.java 2006-07-09 22:28:14 UTC
(rev 9530)
+++ trunk/freenet/src/freenet/client/Metadata.java 2006-07-09 22:41:26 UTC
(rev 9531)
@@ -169,13 +169,13 @@
if(version != 0)
throw new MetadataParseException("Unsupported version
"+version);
documentType = dis.readByte();
- if(documentType < 0 || documentType > 5)
+ if((documentType < 0) || (documentType > 5))
throw new MetadataParseException("Unsupported document
type: "+documentType);
Logger.minor(this, "Document type: "+documentType);
boolean compressed = false;
- if(documentType == SIMPLE_REDIRECT || documentType ==
MULTI_LEVEL_METADATA
- || documentType == ZIP_MANIFEST || documentType
== ZIP_INTERNAL_REDIRECT) {
+ if((documentType == SIMPLE_REDIRECT) || (documentType ==
MULTI_LEVEL_METADATA)
+ || (documentType == ZIP_MANIFEST) ||
(documentType == ZIP_INTERNAL_REDIRECT)) {
short flags = dis.readShort();
splitfile = (flags & FLAGS_SPLITFILE) ==
FLAGS_SPLITFILE;
dbr = (flags & FLAGS_DBR) == FLAGS_DBR;
@@ -222,7 +222,7 @@
Logger.minor(this, "Compressed MIME");
short x = dis.readShort();
compressedMIMEValue = (short) (x & 32767); //
chop off last bit
- hasCompressedMIMEParams =
((int)compressedMIMEValue & 32768) == 32768;
+ hasCompressedMIMEParams = (compressedMIMEValue
& 32768) == 32768;
if(hasCompressedMIMEParams) {
compressedMIMEParams = dis.readShort();
if(compressedMIMEParams != 0) {
@@ -261,15 +261,15 @@
clientMetadata = new ClientMetadata(mimeType);
- if((!splitfile) && (documentType == SIMPLE_REDIRECT ||
documentType == ZIP_MANIFEST)) {
+ if((!splitfile) && ((documentType == SIMPLE_REDIRECT) ||
(documentType == ZIP_MANIFEST))) {
simpleRedirectKey = readKey(dis);
} else if(splitfile) {
splitfileAlgorithm = dis.readShort();
- if(!(splitfileAlgorithm == SPLITFILE_NONREDUNDANT ||
- splitfileAlgorithm ==
SPLITFILE_ONION_STANDARD))
+ if(!((splitfileAlgorithm == SPLITFILE_NONREDUNDANT) ||
+ (splitfileAlgorithm ==
SPLITFILE_ONION_STANDARD)))
throw new MetadataParseException("Unknown
splitfile algorithm "+splitfileAlgorithm);
- if(splitfileAlgorithm == SPLITFILE_NONREDUNDANT &&
+ if((splitfileAlgorithm == SPLITFILE_NONREDUNDANT) &&
!(fullKeys || splitUseLengths))
throw new MetadataParseException("Non-redundant
splitfile invalid unless whacky");
@@ -522,17 +522,17 @@
* @param cm The client metadata, if any.
*/
public Metadata(byte docType, FreenetURI uri, ClientMetadata cm) {
- if(docType == SIMPLE_REDIRECT || docType == ZIP_MANIFEST) {
+ if((docType == SIMPLE_REDIRECT) || (docType == ZIP_MANIFEST)) {
documentType = docType;
clientMetadata = cm;
- if(cm != null && !cm.isTrivial()) {
+ if((cm != null) && !cm.isTrivial()) {
setMIMEType(cm.getMIMEType());
} else {
setMIMEType(DefaultMIMETypes.DEFAULT_MIME_TYPE);
noMIME = true;
}
simpleRedirectKey = uri;
- if(!(uri.getKeyType().equals("CHK") &&
(uri.getAllMetaStrings() == null || uri.getAllMetaStrings().length == 0)))
+ if(!(uri.getKeyType().equals("CHK") &&
((uri.getAllMetaStrings() == null) || (uri.getAllMetaStrings().length == 0))))
fullKeys = true;
} else
throw new IllegalArgumentException();
@@ -617,7 +617,7 @@
freenetURI.writeFullBinaryKeyWithLength(dos);
} else {
String[] meta = freenetURI.getAllMetaStrings();
- if(meta != null && meta.length > 0)
+ if((meta != null) && (meta.length > 0))
throw new MalformedURLException("Not a plain
CHK");
BaseClientKey key =
BaseClientKey.getBaseKey(freenetURI);
if(key instanceof ClientCHK) {
@@ -651,9 +651,9 @@
* Does the metadata point to a single URI?
*/
public boolean isSingleFileRedirect() {
- return ((!splitfile) &&
- documentType == SIMPLE_REDIRECT || documentType
== MULTI_LEVEL_METADATA ||
- documentType == ZIP_MANIFEST);
+ return (((!splitfile) &&
+ (documentType == SIMPLE_REDIRECT)) ||
(documentType == MULTI_LEVEL_METADATA) ||
+ (documentType == ZIP_MANIFEST));
}
/**
@@ -700,7 +700,7 @@
/** Is this a simple splitfile? */
public boolean isSimpleSplitfile() {
- return splitfile && documentType == SIMPLE_REDIRECT;
+ return splitfile && (documentType == SIMPLE_REDIRECT);
}
/** Is multi-level/indirect metadata? */
@@ -727,8 +727,8 @@
dos.writeLong(FREENET_METADATA_MAGIC);
dos.writeShort(0); // version
dos.writeByte(documentType);
- if(documentType == SIMPLE_REDIRECT || documentType ==
MULTI_LEVEL_METADATA
- || documentType == ZIP_MANIFEST || documentType
== ZIP_INTERNAL_REDIRECT) {
+ if((documentType == SIMPLE_REDIRECT) || (documentType ==
MULTI_LEVEL_METADATA)
+ || (documentType == ZIP_MANIFEST) ||
(documentType == ZIP_INTERNAL_REDIRECT)) {
short flags = 0;
if(splitfile) flags |= FLAGS_SPLITFILE;
if(dbr) flags |= FLAGS_DBR;
@@ -775,7 +775,7 @@
if(extraMetadata)
throw new UnsupportedOperationException("No extra
metadata support yet");
- if((!splitfile) && (documentType == SIMPLE_REDIRECT ||
documentType == ZIP_MANIFEST)) {
+ if((!splitfile) && ((documentType == SIMPLE_REDIRECT) ||
(documentType == ZIP_MANIFEST))) {
writeKey(dos, simpleRedirectKey);
} else if(splitfile) {
dos.writeShort(splitfileAlgorithm);
Modified: trunk/freenet/src/freenet/client/StandardOnionFECCodec.java
===================================================================
--- trunk/freenet/src/freenet/client/StandardOnionFECCodec.java 2006-07-09
22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/client/StandardOnionFECCodec.java 2006-07-09
22:41:26 UTC (rev 9531)
@@ -8,6 +8,7 @@
import com.onionnetworks.fec.DefaultFECCodeFactory;
import com.onionnetworks.fec.FECCode;
+import com.onionnetworks.fec.FECCodeFactory;
import com.onionnetworks.util.Buffer;
import freenet.support.Bucket;
@@ -89,7 +90,7 @@
public boolean equals(Object o) {
if(o instanceof MyKey) {
MyKey key = (MyKey)o;
- return key.n == n && key.k == k;
+ return (key.n == n) && (key.k == k);
} else return false;
}
@@ -125,7 +126,7 @@
this.k = k;
this.n = n;
// Best performance, doesn't crash
- encoder = DefaultFECCodeFactory.getDefault().createFECCode(k,n);
+ encoder = FECCodeFactory.getDefault().createFECCode(k,n);
// revert to below if above causes JVM crashes
// Worst performance, but decode crashes
//decoder = new PureCode(k,n);
@@ -362,8 +363,8 @@
+ " data blocks, " + checkBlockStatus.length
+ " check blocks, block length " + blockLength
+ " with "
+ this);
- if (dataBlockStatus.length + checkBlockStatus.length != n ||
- dataBlockStatus.length != k)
+ if ((dataBlockStatus.length + checkBlockStatus.length != n) ||
+ (dataBlockStatus.length != k))
throw new IllegalArgumentException("Data blocks:
"+dataBlockStatus.length+", Check blocks: "+checkBlockStatus.length+", n:
"+n+", k: "+k);
Buffer[] dataPackets = new Buffer[k];
Buffer[] checkPackets = new Buffer[n - k];
Modified: trunk/freenet/src/freenet/client/async/BaseSingleFileFetcher.java
===================================================================
--- trunk/freenet/src/freenet/client/async/BaseSingleFileFetcher.java
2006-07-09 22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/client/async/BaseSingleFileFetcher.java
2006-07-09 22:41:26 UTC (rev 9531)
@@ -58,7 +58,7 @@
retryCount++;
Logger.minor(this, "Attempting to retry... (max "+maxRetries+",
current "+retryCount+")");
// We want 0, 1, ... maxRetries i.e. maxRetries+1 attempts
(maxRetries=0 => try once)
- if(retryCount <= maxRetries || maxRetries == -1) {
+ if((retryCount <= maxRetries) || (maxRetries == -1)) {
schedule();
return true;
}
Modified: trunk/freenet/src/freenet/client/async/ClientGetter.java
===================================================================
--- trunk/freenet/src/freenet/client/async/ClientGetter.java 2006-07-09
22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/client/async/ClientGetter.java 2006-07-09
22:41:26 UTC (rev 9531)
@@ -68,7 +68,7 @@
public void onSuccess(FetchResult result, ClientGetState state) {
finished = true;
currentState = null;
- if(returnBucket != null && result.asBucket() != returnBucket) {
+ if((returnBucket != null) && (result.asBucket() !=
returnBucket)) {
Bucket from = result.asBucket();
Bucket to = returnBucket;
try {
Modified: trunk/freenet/src/freenet/client/async/ClientRequestScheduler.java
===================================================================
--- trunk/freenet/src/freenet/client/async/ClientRequestScheduler.java
2006-07-09 22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/client/async/ClientRequestScheduler.java
2006-07-09 22:41:26 UTC (rev 9531)
@@ -113,7 +113,7 @@
public void register(SendableRequest req) {
Logger.minor(this, "Registering "+req, new Exception("debug"));
- if((!isInsertScheduler) && req instanceof ClientPutter)
+ if((!isInsertScheduler) && (req instanceof ClientPutter))
throw new IllegalArgumentException("Expected a
ClientPut: "+req);
if(req instanceof SendableGet) {
SendableGet getter = (SendableGet)req;
@@ -153,7 +153,7 @@
}
private synchronized void addToGrabArray(short priorityClass, int
retryCount, Object client, ClientRequester cr, SendableRequest req) {
- if(priorityClass > RequestStarter.MINIMUM_PRIORITY_CLASS ||
priorityClass < RequestStarter.MAXIMUM_PRIORITY_CLASS)
+ if((priorityClass > RequestStarter.MINIMUM_PRIORITY_CLASS) ||
(priorityClass < RequestStarter.MAXIMUM_PRIORITY_CLASS))
throw new IllegalStateException("Invalid priority:
"+priorityClass+" - range is "+RequestStarter.MAXIMUM_PRIORITY_CLASS+" (most
important) to "+RequestStarter.MINIMUM_PRIORITY_CLASS+" (least important)");
// Priority
SortedVectorByNumber prio = priorities[priorityClass];
@@ -194,7 +194,7 @@
while(iteration++ < RequestStarter.NUMBER_OF_PRIORITY_CLASSES +
1){
priority = fuzz<0 ?
tweakedPrioritySelector[random.nextInt(tweakedPrioritySelector.length)] :
prioritySelector[Math.abs(fuzz % prioritySelector.length)];
result = priorities[priority];
- if(result != null && !result.isEmpty()) {
+ if((result != null) && !result.isEmpty()) {
Logger.minor(this, "Found "+priority);
return result;
}
Modified: trunk/freenet/src/freenet/client/async/SimpleManifestPutter.java
===================================================================
--- trunk/freenet/src/freenet/client/async/SimpleManifestPutter.java
2006-07-09 22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/client/async/SimpleManifestPutter.java
2006-07-09 22:41:26 UTC (rev 9531)
@@ -76,7 +76,7 @@
private final Bucket data;
public void start() throws InserterException {
- if(origSFI == null && metadata != null) return;
+ if((origSFI == null) && (metadata != null)) return;
origSFI.start();
origSFI = null;
}
@@ -279,8 +279,8 @@
// FIXME support multiple ZIPs and size
limits.
// FIXME support better heuristics.
int sz = (int)data.size() + 40 +
element.fullName.length();
- if(data.size() <= 65536 &&
- bytesOnZip + sz <
((2048-64)*1024)) { // totally dumb heuristic!
+ if((data.size() <= 65536) &&
+ (bytesOnZip + sz <
((2048-64)*1024))) { // totally dumb heuristic!
bytesOnZip += sz;
// Put it in the zip.
ph = new PutHandler(name,
ZipPrefix+element.fullName, cm, data);
Modified: trunk/freenet/src/freenet/client/async/SingleBlockInserter.java
===================================================================
--- trunk/freenet/src/freenet/client/async/SingleBlockInserter.java
2006-07-09 22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/client/async/SingleBlockInserter.java
2006-07-09 22:41:26 UTC (rev 9531)
@@ -160,7 +160,7 @@
consecutiveRNFs = 0;
Logger.minor(this, "Failed: "+e);
retries++;
- if(retries > ctx.maxInsertRetries && ctx.maxInsertRetries !=
-1) {
+ if((retries > ctx.maxInsertRetries) && (ctx.maxInsertRetries !=
-1)) {
if(errors.isOneCodeOnly())
fail(new
InserterException(errors.getFirstCode()));
else
Modified: trunk/freenet/src/freenet/client/async/SingleFileFetcher.java
===================================================================
--- trunk/freenet/src/freenet/client/async/SingleFileFetcher.java
2006-07-09 22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/client/async/SingleFileFetcher.java
2006-07-09 22:41:26 UTC (rev 9531)
@@ -292,7 +292,7 @@
Logger.minor(this, "Redirecting to "+uri);
ClientKey key;
try {
- BaseClientKey k =
ClientKey.getBaseKey(uri);
+ BaseClientKey k =
BaseClientKey.getBaseKey(uri);
if(k instanceof ClientKey)
key = (ClientKey) k;
else
@@ -303,7 +303,7 @@
} catch (MalformedURLException e) {
throw new
FetchException(FetchException.INVALID_URI, e);
}
- if(key instanceof ClientCHK &&
!((ClientCHK)key).isMetadata())
+ if((key instanceof ClientCHK) &&
!((ClientCHK)key).isMetadata())
rcb.onBlockSetFinished(this);
LinkedList newMetaStrings =
uri.listMetaStrings();
@@ -339,8 +339,8 @@
if(metadata.uncompressedDataLength() > len)
len = metadata.uncompressedDataLength();
- if(len > ctx.maxOutputLength ||
- len > ctx.maxTempLength) {
+ if((len > ctx.maxOutputLength) ||
+ (len > ctx.maxTempLength)) {
boolean finished = (rcb == parent);
@@ -541,7 +541,7 @@
}
public static ClientGetState create(ClientGetter parent,
GetCompletionCallback cb, ClientMetadata clientMetadata, FreenetURI uri,
FetcherContext ctx, ArchiveContext actx, int maxRetries, int recursionLevel,
boolean dontTellClientGet, Object token, boolean isEssential, Bucket
returnBucket) throws MalformedURLException, FetchException {
- BaseClientKey key = ClientKey.getBaseKey(uri);
+ BaseClientKey key = BaseClientKey.getBaseKey(uri);
if(key instanceof ClientKey)
return new SingleFileFetcher(parent, cb,
clientMetadata, (ClientKey)key, uri.listMetaStrings(), ctx, actx, maxRetries,
recursionLevel, dontTellClientGet, token, isEssential, returnBucket);
else {
Modified: trunk/freenet/src/freenet/client/async/SingleFileInserter.java
===================================================================
--- trunk/freenet/src/freenet/client/async/SingleFileInserter.java
2006-07-09 22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/client/async/SingleFileInserter.java
2006-07-09 22:41:26 UTC (rev 9531)
@@ -114,7 +114,7 @@
Compressor bestCodec = null;
Bucket bestCompressedData = null;
- if(origSize > blockSize && (!ctx.dontCompress) &&
(!dontCompress)) {
+ if((origSize > blockSize) && (!ctx.dontCompress) &&
(!dontCompress)) {
// Try to compress the data.
// Try each algorithm, starting with the fastest and
weakest.
// Stop when run out of algorithms, or the compressed
data fits in a single block.
@@ -135,12 +135,12 @@
bestCompressedData = data;
break;
}
- if(bestCompressedData != null &&
result.size() < bestCompressedData.size()) {
+ if((bestCompressedData != null) &&
(result.size() < bestCompressedData.size())) {
ctx.bf.freeBucket(bestCompressedData);
bestCompressedData = result;
data = result;
bestCodec = comp;
- } else if(bestCompressedData == null &&
result.size() < data.size()) {
+ } else if((bestCompressedData == null)
&& (result.size() < data.size())) {
bestCompressedData = result;
bestCodec = comp;
data = result;
@@ -167,7 +167,7 @@
if(block.getData().size() > Integer.MAX_VALUE)
throw new
InserterException(InserterException.INTERNAL_ERROR, "2GB+ should not encode to
one block!", null);
- if((block.clientMetadata == null ||
block.clientMetadata.isTrivial()) && !insertAsArchiveManifest) {
+ if(((block.clientMetadata == null) ||
block.clientMetadata.isTrivial()) && !insertAsArchiveManifest) {
if(data.size() < blockSize) {
// Just insert it
ClientPutState bi =
Modified: trunk/freenet/src/freenet/client/async/SplitFileFetcher.java
===================================================================
--- trunk/freenet/src/freenet/client/async/SplitFileFetcher.java
2006-07-09 22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/client/async/SplitFileFetcher.java
2006-07-09 22:41:26 UTC (rev 9531)
@@ -85,12 +85,12 @@
segmentCount = 1;
} else if(splitfileType == Metadata.SPLITFILE_ONION_STANDARD) {
byte[] params = metadata.splitfileParams();
- if(params == null || params.length < 8)
+ if((params == null) || (params.length < 8))
throw new MetadataParseException("No splitfile
params");
blocksPerSegment = Fields.bytesToInt(params, 0);
checkBlocksPerSegment = Fields.bytesToInt(params, 4);
- if(blocksPerSegment >
fetchContext.maxDataBlocksPerSegment
- || checkBlocksPerSegment >
fetchContext.maxCheckBlocksPerSegment)
+ if((blocksPerSegment >
fetchContext.maxDataBlocksPerSegment)
+ || (checkBlocksPerSegment >
fetchContext.maxCheckBlocksPerSegment))
throw new
FetchException(FetchException.TOO_MANY_BLOCKS_PER_SEGMENT, "Too many blocks per
segment: "+blocksPerSegment+" data, "+checkBlocksPerSegment+" check");
segmentCount = (splitfileDataBlocks.length /
blocksPerSegment) +
(splitfileDataBlocks.length % blocksPerSegment
== 0 ? 0 : 1);
@@ -143,7 +143,7 @@
OutputStream os = null;
Bucket output;
try {
- if(returnBucket != null && decompressors.isEmpty())
+ if((returnBucket != null) && decompressors.isEmpty())
output = returnBucket;
else
output =
fetchContext.bucketFactory.makeBucket(finalLength);
Modified: trunk/freenet/src/freenet/client/async/SplitFileFetcherSegment.java
===================================================================
--- trunk/freenet/src/freenet/client/async/SplitFileFetcherSegment.java
2006-07-09 22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/client/async/SplitFileFetcherSegment.java
2006-07-09 22:41:26 UTC (rev 9531)
@@ -106,7 +106,7 @@
/** Write the decoded segment's data to an OutputStream */
public long writeDecodedDataTo(OutputStream os, long truncateLength)
throws IOException {
long len = decodedData.size();
- if(truncateLength >= 0 && truncateLength < len)
+ if((truncateLength >= 0) && (truncateLength < len))
len = truncateLength;
BucketTools.copyTo(decodedData, os, Math.min(truncateLength,
decodedData.size()));
return len;
Modified: trunk/freenet/src/freenet/client/async/SplitFileInserter.java
===================================================================
--- trunk/freenet/src/freenet/client/async/SplitFileInserter.java
2006-07-09 22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/client/async/SplitFileInserter.java
2006-07-09 22:41:26 UTC (rev 9531)
@@ -9,6 +9,7 @@
import freenet.client.InserterContext;
import freenet.client.InserterException;
import freenet.client.Metadata;
+import freenet.keys.CHKBlock;
import freenet.keys.ClientCHKBlock;
import freenet.keys.FreenetURI;
import freenet.support.Bucket;
@@ -49,7 +50,7 @@
this.ctx = ctx;
Bucket[] dataBuckets;
try {
- dataBuckets = BucketTools.split(data,
ClientCHKBlock.DATA_LENGTH, ctx.bf);
+ dataBuckets = BucketTools.split(data,
CHKBlock.DATA_LENGTH, ctx.bf);
} catch (IOException e) {
throw new
InserterException(InserterException.BUCKET_ERROR, e, null);
}
@@ -81,7 +82,7 @@
Vector segs = new Vector();
// First split the data up
- if(dataBlocks < segmentSize || segmentSize == -1) {
+ if((dataBlocks < segmentSize) || (segmentSize == -1)) {
// Single segment
FECCodec codec = FECCodec.getCodec(splitfileAlgorithm,
origDataBlocks.length);
SplitFileInserterSegment onlySeg = new
SplitFileInserterSegment(this, codec, origDataBlocks, ctx, getCHKOnly, 0);
@@ -117,7 +118,7 @@
Logger.minor(this, "Encoded segment "+segment.segNo+" of
"+this);
synchronized(this) {
for(int i=0;i<segments.length;i++) {
- if(segments[i] == null ||
!segments[i].isEncoded())
+ if((segments[i] == null) ||
!segments[i].isEncoded())
return;
}
}
@@ -228,7 +229,7 @@
if(!segments[i].isFinished()) allGone = false;
InserterException e = segment.getException();
- if(e != null && e.isFatal()) {
+ if((e != null) && e.isFatal()) {
cancel();
} else {
if(!allGone) return;
Modified: trunk/freenet/src/freenet/client/async/SplitFileInserterSegment.java
===================================================================
--- trunk/freenet/src/freenet/client/async/SplitFileInserterSegment.java
2006-07-09 22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/client/async/SplitFileInserterSegment.java
2006-07-09 22:41:26 UTC (rev 9531)
@@ -8,6 +8,7 @@
import freenet.client.InserterException;
import freenet.client.Metadata;
import freenet.keys.BaseClientKey;
+import freenet.keys.CHKBlock;
import freenet.keys.ClientCHKBlock;
import freenet.keys.FreenetURI;
import freenet.support.Bucket;
@@ -55,7 +56,7 @@
public void start() throws InserterException {
for(int i=0;i<dataBlockInserters.length;i++) {
dataBlockInserters[i] =
- new SingleBlockInserter(parent.parent,
dataBlocks[i], (short)-1, FreenetURI.EMPTY_CHK_URI, blockInsertContext, this,
false, ClientCHKBlock.DATA_LENGTH, i, getCHKOnly, false, false, parent.token);
+ new SingleBlockInserter(parent.parent,
dataBlocks[i], (short)-1, FreenetURI.EMPTY_CHK_URI, blockInsertContext, this,
false, CHKBlock.DATA_LENGTH, i, getCHKOnly, false, false, parent.token);
dataBlockInserters[i].schedule();
}
if(splitfileAlgo == null) {
@@ -77,11 +78,11 @@
void encode() {
try {
- splitfileAlgo.encode(dataBlocks, checkBlocks,
ClientCHKBlock.DATA_LENGTH, blockInsertContext.bf);
+ splitfileAlgo.encode(dataBlocks, checkBlocks,
CHKBlock.DATA_LENGTH, blockInsertContext.bf);
// Start the inserts
for(int i=0;i<checkBlockInserters.length;i++) {
checkBlockInserters[i] =
- new SingleBlockInserter(parent.parent,
checkBlocks[i], (short)-1, FreenetURI.EMPTY_CHK_URI, blockInsertContext, this,
false, ClientCHKBlock.DATA_LENGTH, i + dataBlocks.length, getCHKOnly, false,
false, parent.token);
+ new SingleBlockInserter(parent.parent,
checkBlocks[i], (short)-1, FreenetURI.EMPTY_CHK_URI, blockInsertContext, this,
false, CHKBlock.DATA_LENGTH, i + dataBlocks.length, getCHKOnly, false, false,
parent.token);
checkBlockInserters[i].schedule();
}
// Tell parent only after have started the inserts.
Modified: trunk/freenet/src/freenet/client/async/USKFetcher.java
===================================================================
--- trunk/freenet/src/freenet/client/async/USKFetcher.java 2006-07-09
22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/client/async/USKFetcher.java 2006-07-09
22:41:26 UTC (rev 9531)
@@ -235,7 +235,7 @@
sleepTime = origSleepTime;
} else {
// Not exponential; it is more likely
that it is close to the known edition than not.
- long newMinFailures =
Math.max(((int)((double)minFailures * 1.25)), minFailures+1);
+ long newMinFailures =
Math.max(((int)(minFailures * 1.25)), minFailures+1);
if(newMinFailures > maxMinFailures)
newMinFailures = maxMinFailures;
minFailures = newMinFailures;
@@ -248,7 +248,7 @@
long end = now + sleepTime;
long newValAtEnd = valAtEnd;
// FIXME do this without occupying a thread
- while(now < end && ((newValAtEnd =
uskManager.lookup(origUSK)) == valAtEnd)) {
+ while((now < end) && ((newValAtEnd =
uskManager.lookup(origUSK)) == valAtEnd)) {
long d = end - now;
if(d > 0)
try {
@@ -320,7 +320,7 @@
// So don't start obsolete requests.
USKAttempt a = (USKAttempt) i.next();
lastEd = uskManager.lookup(origUSK);
- if(lastEd <= a.number && !a.cancelled)
+ if((lastEd <= a.number) && !a.cancelled)
a.schedule();
}
}
Modified: trunk/freenet/src/freenet/client/async/USKInserter.java
===================================================================
--- trunk/freenet/src/freenet/client/async/USKInserter.java 2006-07-09
22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/client/async/USKInserter.java 2006-07-09
22:41:26 UTC (rev 9531)
@@ -77,8 +77,8 @@
public void onFoundEdition(long l, USK key) {
edition = Math.max(l, edition);
consecutiveCollisions = 0;
- if(fetcher.lastContentWasMetadata() == isMetadata &&
fetcher.hasLastData()
- && fetcher.lastCompressionCodec() ==
compressionCodec) {
+ if((fetcher.lastContentWasMetadata() == isMetadata) &&
fetcher.hasLastData()
+ && (fetcher.lastCompressionCodec() ==
compressionCodec)) {
try {
byte[] myData = BucketTools.toByteArray(data);
byte[] hisData =
BucketTools.toByteArray(fetcher.getLastData());
Modified: trunk/freenet/src/freenet/client/async/USKManager.java
===================================================================
--- trunk/freenet/src/freenet/client/async/USKManager.java 2006-07-09
22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/client/async/USKManager.java 2006-07-09
22:41:26 UTC (rev 9531)
@@ -83,7 +83,7 @@
if(temporaryBackgroundFetchersLRU.contains(clear))
temporaryBackgroundFetchersLRU.push(clear);
if(f != null) {
- if(f.parent.priorityClass == parent.priorityClass &&
f.ctx.equals(ctx))
+ if((f.parent.priorityClass == parent.priorityClass) &&
f.ctx.equals(ctx))
return f;
}
f = new USKFetcher(usk, this, ctx, parent, 3, false);
@@ -136,7 +136,7 @@
synchronized(this) {
Long l = (Long) latestVersionByClearUSK.get(clear);
Logger.minor(this, "Old value: "+l);
- if(l == null || number > l.longValue()) {
+ if((l == null) || (number > l.longValue())) {
l = new Long(number);
latestVersionByClearUSK.put(clear, l);
Logger.minor(this, "Put "+number);
@@ -195,7 +195,7 @@
int j=0;
for(int i=0;i<callbacks.length;i++) {
USKCallback c = callbacks[i];
- if(c != null && c != cb) {
+ if((c != null) && (c != cb)) {
callbacks[j++] = c;
}
}
Modified: trunk/freenet/src/freenet/client/events/SplitfileProgressEvent.java
===================================================================
--- trunk/freenet/src/freenet/client/events/SplitfileProgressEvent.java
2006-07-09 22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/client/events/SplitfileProgressEvent.java
2006-07-09 22:41:26 UTC (rev 9531)
@@ -26,7 +26,7 @@
public String getDescription() {
StringBuffer sb = new StringBuffer();
sb.append("Completed ");
- if(minSuccessfulBlocks == 0 && fetchedBlocks == 0)
+ if((minSuccessfulBlocks == 0) && (fetchedBlocks == 0))
minSuccessfulBlocks = 1;
if(minSuccessfulBlocks == 0) {
if(Logger.globalGetThreshold() > Logger.MINOR)
Modified: trunk/freenet/src/freenet/clients/http/BookmarkManager.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/BookmarkManager.java 2006-07-09
22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/clients/http/BookmarkManager.java 2006-07-09
22:41:26 UTC (rev 9531)
@@ -29,7 +29,7 @@
StringBuffer buf = new StringBuffer("");
for (Enumeration e = bookmarks.elements();
e.hasMoreElements(); ) {
- buf.append((String)e.nextElement().toString());
+ buf.append(e.nextElement().toString());
buf.append(StringArrOption.delimiter);
}
Modified: trunk/freenet/src/freenet/clients/http/ConfigToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/ConfigToadlet.java 2006-07-09
22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/clients/http/ConfigToadlet.java 2006-07-09
22:41:26 UTC (rev 9531)
@@ -48,7 +48,7 @@
}
String pass = request.getParam("formPassword");
- if(pass == null || !pass.equals(node.formPassword)) {
+ if((pass == null) || !pass.equals(node.formPassword)) {
MultiValueTable headers = new MultiValueTable();
headers.put("Location", "/config/");
ctx.sendReplyHeaders(302, "Found", headers, null, 0);
Modified: trunk/freenet/src/freenet/clients/http/DarknetConnectionsToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/DarknetConnectionsToadlet.java
2006-07-09 22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/clients/http/DarknetConnectionsToadlet.java
2006-07-09 22:41:26 UTC (rev 9531)
@@ -268,7 +268,7 @@
long routingBackedOffUntil =
pn.getRoutingBackedOffUntil();
int backoff =
(int)(Math.max(routingBackedOffUntil - now, 0));
// Don't list the backoff as zero before it's
actually zero
- if(backoff > 0 && backoff < 1000 )
+ if((backoff > 0) && (backoff < 1000) )
backoff = 1000;
// Elements must be HTML encoded.
@@ -339,7 +339,7 @@
}
}
String statusString = ((PeerNode)
row[0]).getPeerNodeStatusString();
- if(!advancedEnabled && ((PeerNode)
row[0]).getPeerNodeStatus() == Node.PEER_NODE_STATUS_ROUTING_BACKED_OFF) {
+ if(!advancedEnabled && (((PeerNode)
row[0]).getPeerNodeStatus() == Node.PEER_NODE_STATUS_ROUTING_BACKED_OFF)) {
statusString = "BUSY";
}
row[2] = "<span class=\""+((PeerNode)
row[0]).getPeerNodeStatusCSSClassName()+"\">"+statusString+arkAsterisk+"</span>";
@@ -354,7 +354,7 @@
continue;
}
if(!advancedEnabled) { // if not in
advanced Darknet page output mode
- if( j == 4 || j == 6 || j == 7
) { // skip IP address/name, location and backoff times
+ if( (j == 4) || (j == 6) || (j
== 7) ) { // skip IP address/name, location and backoff times
continue;
}
}
@@ -466,7 +466,7 @@
HTTPRequest request = new HTTPRequest(uri, data, ctx);
String pass = request.getPartAsString("formPassword", 32);
- if(pass == null || !pass.equals(node.formPassword)) {
+ if((pass == null) || !pass.equals(node.formPassword)) {
MultiValueTable headers = new MultiValueTable();
headers.put("Location", "/darknet/");
ctx.sendReplyHeaders(302, "Found", headers, null, 0);
@@ -623,7 +623,7 @@
return " ";
}
long idleSeconds = (now - idle) / 1000;
- if(idleSeconds < 60 && (peerNodeStatus ==
Node.PEER_NODE_STATUS_CONNECTED || peerNodeStatus ==
Node.PEER_NODE_STATUS_ROUTING_BACKED_OFF)) {
+ if((idleSeconds < 60) && ((peerNodeStatus ==
Node.PEER_NODE_STATUS_CONNECTED) || (peerNodeStatus ==
Node.PEER_NODE_STATUS_ROUTING_BACKED_OFF))) {
return "0m";
}
return timeIntervalToString( idleSeconds );
Modified: trunk/freenet/src/freenet/clients/http/FProxyToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/FProxyToadlet.java 2006-07-09
22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/clients/http/FProxyToadlet.java 2006-07-09
22:41:26 UTC (rev 9531)
@@ -392,7 +392,7 @@
String ext = DefaultMIMETypes.getExtension(expectedMimeType);
if(ext == null)
ext = "bin";
- if(dotIdx == -1 && expectedMimeType != null) {
+ if((dotIdx == -1) && (expectedMimeType != null)) {
s += "." + ext;
return s;
}
@@ -407,7 +407,7 @@
private String getFilename(FetchException e, FreenetURI uri) {
String fnam = sanitize(uri.getDocName());
- if(fnam != null && fnam.length() > 0) return fnam;
+ if((fnam != null) && (fnam.length() > 0)) return fnam;
String[] meta = uri.getAllMetaStrings();
if(meta != null) {
for(int i=meta.length-1;i>=0;i++) {
@@ -415,7 +415,7 @@
if(s == null) continue;
if(s.length() == 0) continue;
fnam = sanitize(s);
- if(s != null && s.length() > 0) return fnam;
+ if((s != null) && (s.length() > 0)) return fnam;
}
}
return Base64.encode(uri.getRoutingKey());
@@ -427,8 +427,8 @@
for(int i=0;i<s.length();i++) {
char c = s.charAt(i);
if(Character.isLetterOrDigit(c) ||
- c == ' ' || c == '.' || c == '-' || c
== '_' ||
- c == '+' || c == ',')
+ (c == ' ') || (c == '.') || (c == '-')
|| (c == '_') ||
+ (c == '+') || (c == ','))
sb.append(c);
}
return sb.toString();
Modified: trunk/freenet/src/freenet/clients/http/HTTPRequest.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/HTTPRequest.java 2006-07-09
22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/clients/http/HTTPRequest.java 2006-07-09
22:41:26 UTC (rev 9531)
@@ -89,7 +89,7 @@
this.data = null;
this.parts = null;
this.bucketfactory = null;
- if (encodedQueryString!=null && encodedQueryString.length()>0) {
+ if ((encodedQueryString!=null) &&
(encodedQueryString.length()>0)) {
this.uri = new URI(path+"?"+encodedQueryString);
} else {
this.uri = new URI(path);
@@ -155,7 +155,7 @@
Logger.minor(this, "queryString is "+queryString+",
doUrlDecoding="+doUrlDecoding);
// nothing to do if there was no query string in the URI
- if (queryString == null || queryString.length() == 0) {
+ if ((queryString == null) || (queryString.length() == 0)) {
return;
}
@@ -406,19 +406,19 @@
String s = new String(buf, "us-ascii");
parseRequestParameters(s, true);
}
- if
(!ctypeparts[0].trim().equalsIgnoreCase("multipart/form-data") ||
ctypeparts.length < 2) {
+ if
(!ctypeparts[0].trim().equalsIgnoreCase("multipart/form-data") ||
(ctypeparts.length < 2)) {
return;
}
String boundary = null;
for (int i = 0; i < ctypeparts.length; i++) {
String[] subparts = ctypeparts[i].split("=");
- if (subparts.length == 2 &&
subparts[0].trim().equalsIgnoreCase("boundary")) {
+ if ((subparts.length == 2) &&
subparts[0].trim().equalsIgnoreCase("boundary")) {
boundary = subparts[1];
}
}
- if (boundary == null || boundary.length() == 0) return;
+ if ((boundary == null) || (boundary.length() == 0)) return;
if (boundary.charAt(0) == '"') boundary = boundary.substring(1);
if (boundary.charAt(boundary.length() - 1) == '"')
boundary = boundary.substring(0, boundary.length() - 1);
@@ -430,7 +430,7 @@
String line;
line = lis.readLine(100, 100, false); // really it's US-ASCII,
but ISO-8859-1 is close enough.
- while (is.available() > 0 && !line.equals(boundary)) {
+ while ((is.available() > 0) && !line.equals(boundary)) {
line = lis.readLine(100, 100, false);
}
@@ -480,13 +480,13 @@
byte[] buf = new byte[boundary.length()];
byte[] bbound = boundary.getBytes("UTF-8");
int offset = 0;
- while (is.available() > 0 && !boundary.equals(new
String(buf))) {
+ while ((is.available() > 0) && !boundary.equals(new
String(buf))) {
byte b = (byte)is.read();
if (b == bbound[offset]) {
buf[offset] = b;
offset++;
- } else if (b != bbound[offset] && offset > 0) {
+ } else if ((b != bbound[offset]) && (offset >
0)) {
// empty the buffer out
bucketos.write(buf, 0, offset);
bucketos.write(b);
Modified: trunk/freenet/src/freenet/clients/http/N2NTMToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/N2NTMToadlet.java 2006-07-09
22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/clients/http/N2NTMToadlet.java 2006-07-09
22:41:26 UTC (rev 9531)
@@ -95,7 +95,7 @@
StringBuffer buf = new StringBuffer(1024);
String pass = request.getPartAsString("formPassword", 32);
- if(pass == null || !pass.equals(node.formPassword)) {
+ if((pass == null) || !pass.equals(node.formPassword)) {
MultiValueTable headers = new MultiValueTable();
headers.put("Location", "/send_n2ntm/");
ctx.sendReplyHeaders(302, "Found", headers, null, 0);
Modified: trunk/freenet/src/freenet/clients/http/NinjaSpider.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/NinjaSpider.java 2006-07-09
22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/clients/http/NinjaSpider.java 2006-07-09
22:41:26 UTC (rev 9531)
@@ -122,8 +122,8 @@
*/
if(htmlOnly
- && uri.toString(false).toLowerCase().indexOf(".htm") < 0
- && uriBytes[uriBytes.length - 1] != '/')
+ && (uri.toString(false).toLowerCase().indexOf(".htm") < 0)
+ && (uriBytes[uriBytes.length - 1] != '/'))
return;
/* We remove HTML targets from URI
(http://my.server/file#target) */
@@ -156,7 +156,7 @@
int running = runningFetchesByURI.size();
int queued = queuedURIList.size();
- if (running >= maxParallelRequests || queued == 0)
+ if ((running >= maxParallelRequests) || (queued == 0))
return;
toStart = new ArrayList(Math.min(maxParallelRequests -
running, queued));
@@ -252,8 +252,8 @@
return;
}
- if(type != null && type.length() != 0 &&
type.toLowerCase().equals("title")
- && s != null && s.length() != 0 && s.indexOf('\n') < 0) {
+ if((type != null) && (type.length() != 0) &&
type.toLowerCase().equals("title")
+ && (s != null) && (s.length() != 0) && (s.indexOf('\n') <
0)) {
/* We should have a correct title */
titlesOfURIs.put(uri.toString(false), s);
type = "title";
@@ -273,7 +273,7 @@
for (int i = 0; i < words.length; i++) {
String word = words[i];
- if (word == null || word.length() == 0)
+ if ((word == null) || (word.length() == 0))
continue;
word = word.toLowerCase();
Modified: trunk/freenet/src/freenet/clients/http/PageMaker.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/PageMaker.java 2006-07-09
22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/clients/http/PageMaker.java 2006-07-09
22:41:26 UTC (rev 9531)
@@ -114,7 +114,7 @@
if (url.getProtocol().equals("file")) {
File themesDirectory = new
File(URLDecoder.decode(url.getPath(), "ISO-8859-1").replaceAll("\\|", ":"));
File[] themeDirectories =
themesDirectory.listFiles();
- for (int themeIndex = 0; themeDirectories !=
null && themeIndex < themeDirectories.length; themeIndex++) {
+ for (int themeIndex = 0; (themeDirectories !=
null) && (themeIndex < themeDirectories.length); themeIndex++) {
File themeDirectory =
themeDirectories[themeIndex];
if (themeDirectory.isDirectory() &&
!themeDirectory.getName().startsWith(".")) {
themes.add(themeDirectory.getName());
Modified: trunk/freenet/src/freenet/clients/http/PluginToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/PluginToadlet.java 2006-07-09
22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/clients/http/PluginToadlet.java 2006-07-09
22:41:26 UTC (rev 9531)
@@ -121,7 +121,7 @@
}
String pass = httpRequest.getParam("formPassword");
- if(pass == null || !pass.equals(node.formPassword)) {
+ if((pass == null) || !pass.equals(node.formPassword)) {
MultiValueTable headers = new MultiValueTable();
headers.put("Location", "/plugin/");
ctx.sendReplyHeaders(302, "Found", headers, null, 0);
Modified: trunk/freenet/src/freenet/clients/http/PproxyToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/PproxyToadlet.java 2006-07-09
22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/clients/http/PproxyToadlet.java 2006-07-09
22:41:26 UTC (rev 9531)
@@ -56,7 +56,7 @@
MultiValueTable headers = new MultiValueTable();
String pass = request.getParam("formPassword");
- if(pass == null || !pass.equals(node.formPassword)) {
+ if((pass == null) || !pass.equals(node.formPassword)) {
MultiValueTable hdrs = new MultiValueTable();
headers.put("Location", "/queue/");
ctx.sendReplyHeaders(302, "Found", hdrs, null, 0);
Modified: trunk/freenet/src/freenet/clients/http/QueueToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/QueueToadlet.java 2006-07-09
22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/clients/http/QueueToadlet.java 2006-07-09
22:41:26 UTC (rev 9531)
@@ -45,14 +45,14 @@
HTTPRequest request = new HTTPRequest(uri, data, ctx);
String pass = request.getParam("formPassword");
- if(pass == null || !pass.equals(node.formPassword)) {
+ if((pass == null) || !pass.equals(node.formPassword)) {
MultiValueTable headers = new MultiValueTable();
headers.put("Location", "/queue/");
ctx.sendReplyHeaders(302, "Found", headers, null, 0);
return;
}
- if(request.isParameterSet("remove_request") &&
request.getParam("remove_request").length() > 0) {
+ if(request.isParameterSet("remove_request") &&
(request.getParam("remove_request").length() > 0)) {
String identifier = request.getParam("identifier");
Logger.minor(this, "Removing "+identifier);
try {
@@ -62,7 +62,7 @@
}
writePermanentRedirect(ctx, "Done", "/queue/");
return;
- }else if(request.isParameterSet("remove_AllRequests") &&
request.getParam("remove_AllRequests").length() > 0) {
+ }else if(request.isParameterSet("remove_AllRequests") &&
(request.getParam("remove_AllRequests").length() > 0)) {
ClientRequest[] reqs = fcp.getGlobalRequests();
Logger.minor(this, "Request count: "+reqs.length);
Modified: trunk/freenet/src/freenet/clients/http/SimpleToadletServer.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/SimpleToadletServer.java
2006-07-09 22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/clients/http/SimpleToadletServer.java
2006-07-09 22:41:26 UTC (rev 9531)
@@ -103,7 +103,7 @@
}
public void set(String CSSName) throws
InvalidConfigValueException {
- if(CSSName.indexOf(':') != -1 || CSSName.indexOf('/')
!= -1)
+ if((CSSName.indexOf(':') != -1) ||
(CSSName.indexOf('/') != -1))
throw new InvalidConfigValueException("CSS name
must not contain slashes or colons!");
cssName = CSSName;
}
@@ -169,7 +169,7 @@
if (url.getProtocol().equals("file")) {
File themesDirectory = new
File(URLDecoder.decode(url.getPath(), "ISO-8859-1").replaceAll("\\|", ":"));
File[] themeDirectories =
themesDirectory.listFiles();
- for (int themeIndex = 0; themeDirectories !=
null && themeIndex < themeDirectories.length; themeIndex++) {
+ for (int themeIndex = 0; (themeDirectories !=
null) && (themeIndex < themeDirectories.length); themeIndex++) {
File themeDirectory =
themeDirectories[themeIndex];
if (themeDirectory.isDirectory() &&
!themeDirectory.getName().startsWith(".")) {
themes.add(themeDirectory.getName());
@@ -219,7 +219,7 @@
bindTo = fproxyConfig.getString("bindTo");
allowedHosts = fproxyConfig.getString("allowedHosts");
cssName = fproxyConfig.getString("css");
- if(cssName.indexOf(':') != -1 || cssName.indexOf('/') != -1)
+ if((cssName.indexOf(':') != -1) || (cssName.indexOf('/') != -1))
throw new InvalidConfigValueException("CSS name must
not contain slashes or colons!");
this.advancedDarknetEnabled =
fproxyConfig.getBoolean("advancedDarknetEnabled");
Modified: trunk/freenet/src/freenet/clients/http/Spider.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/Spider.java 2006-07-09 22:28:14 UTC
(rev 9530)
+++ trunk/freenet/src/freenet/clients/http/Spider.java 2006-07-09 22:41:26 UTC
(rev 9531)
@@ -101,7 +101,7 @@
int running = runningFetchesByURI.size();
int queued = queuedURIList.size();
- if (running >= maxParallelRequests || queued == 0)
+ if ((running >= maxParallelRequests) || (queued == 0))
return;
toStart = new ArrayList(Math.min(maxParallelRequests -
running, queued));
@@ -193,8 +193,8 @@
return;
}
- if(type != null && type.length() != 0 &&
type.toLowerCase().equals("title")
- && s != null && s.length() != 0 && s.indexOf('\n') < 0) {
+ if((type != null) && (type.length() != 0) &&
type.toLowerCase().equals("title")
+ && (s != null) && (s.length() != 0) && (s.indexOf('\n') <
0)) {
/* We should have a correct title */
titlesOfURIs.put(uri.toString(false), s);
}
@@ -203,7 +203,7 @@
String[] words = s.split("[^A-Za-z0-9]");
for (int i = 0; i < words.length; i++) {
String word = words[i];
- if (word == null || word.length() == 0)
+ if ((word == null) || (word.length() == 0))
continue;
word = word.toLowerCase();
addWord(word, uri);
Modified: trunk/freenet/src/freenet/clients/http/StaticToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/StaticToadlet.java 2006-07-09
22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/clients/http/StaticToadlet.java 2006-07-09
22:41:26 UTC (rev 9531)
@@ -36,7 +36,7 @@
}
// be very strict about what characters we allow in the path,
since
- if (!path.matches("^[A-Za-z0-9\\._\\/\\-]*$") ||
path.indexOf("..") != -1) {
+ if (!path.matches("^[A-Za-z0-9\\._\\/\\-]*$") ||
(path.indexOf("..") != -1)) {
this.sendErrorPage(ctx, 404, "Path not found", "The
given URI contains disallowed characters.");
return;
}
Modified: trunk/freenet/src/freenet/clients/http/ToadletContextImpl.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/ToadletContextImpl.java
2006-07-09 22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/clients/http/ToadletContextImpl.java
2006-07-09 22:41:26 UTC (rev 9531)
@@ -154,7 +154,7 @@
char prev = 0;
for(int i=0;i<key.length();i++) {
char c = key.charAt(i);
- if(i == 0 || prev == '-') {
+ if((i == 0) || (prev == '-')) {
c = Character.toUpperCase(c);
}
sb.append(c);
Modified: trunk/freenet/src/freenet/clients/http/WelcomeToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/WelcomeToadlet.java 2006-07-09
22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/clients/http/WelcomeToadlet.java 2006-07-09
22:41:26 UTC (rev 9531)
@@ -243,7 +243,7 @@
if(e.uri != null)
buf.append("URI would have
been: "+e.uri+"<br>");
int mode = e.getMode();
- if(mode ==
InserterException.FATAL_ERRORS_IN_BLOCKS || mode ==
InserterException.TOO_MANY_RETRIES_IN_BLOCKS) {
+ if((mode ==
InserterException.FATAL_ERRORS_IN_BLOCKS) || (mode ==
InserterException.TOO_MANY_RETRIES_IN_BLOCKS)) {
buf.append("Splitfile-specific
error:\n"+e.errorCodes.toVerboseString()+"<br>");
}
}
@@ -352,7 +352,7 @@
if (useragent != null) {
useragent = useragent.toLowerCase();
- if (useragent.indexOf("msie") > -1 &&
useragent.indexOf("opera") == -1) {
+ if ((useragent.indexOf("msie") > -1) &&
(useragent.indexOf("opera") == -1)) {
buf.append("<div class=\"infobox
infobox-alert\">\n");
buf.append("<div class=\"infobox-header\">\n");
buf.append("Security risk!\n");
@@ -427,7 +427,7 @@
// Compatibility code ... will be removed
}
- if(Version.buildNumber() < Version.highestSeenBuild &&
advancedDarknetOutputEnabled) {
+ if((Version.buildNumber() < Version.highestSeenBuild) &&
advancedDarknetOutputEnabled) {
buf.append("<br />");
buf.append("<b>A newer version is available! (Build
#"+Version.highestSeenBuild+")</b>");
}
Modified: trunk/freenet/src/freenet/clients/http/filter/CSSTokenizerFilter.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/filter/CSSTokenizerFilter.java
2006-07-09 22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/clients/http/filter/CSSTokenizerFilter.java
2006-07-09 22:41:26 UTC (rev 9531)
@@ -692,9 +692,9 @@
// This is not very efficient. The parser below knows the quoting rules
too.
static boolean isHexDigit(char c) {
- return ('a' <= c && c <= 'f' ||
- 'A' <= c && c <= 'F' ||
- '0' <= c && c <= '9');
+ return ((('a' <= c) && (c <= 'f')) ||
+ (('A' <= c) && (c <= 'F')) ||
+ (('0' <= c) && (c <= '9')));
}
class DecodedStringThingy {
@@ -708,7 +708,7 @@
url = true;
}
char q = s.charAt(0);
- if(q == '\'' || q == '\"') {
+ if((q == '\'') || (q == '\"')) {
quote = q;
s = s.substring(1);
} else quote = ' ';
@@ -734,7 +734,7 @@
justEscaping = false;
}
} else if(stillEscaping) {
- if(isHexDigit(c) && hexEscape.length()
< 6) {
+ if(isHexDigit(c) && (hexEscape.length()
< 6)) {
hexEscape.append(c);
} else if(Character.isWhitespace(c)) {
// Ignore one whitespace char
after an escape
@@ -772,7 +772,7 @@
hexEscape = new StringBuffer();
}
} else {
- if(quote != ' ' && c == quote) {
+ if((quote != ' ') && (c == quote)) {
break;
} else if (c == '\\') {
justEscaping = true;
@@ -802,7 +802,7 @@
StringBuffer sb = new StringBuffer();
for(int i=0;i<data.length();i++) {
char c = data.charAt(i);
- if(c == quote || c == '\n') {
+ if((c == quote) || (c == '\n')) {
sb.append('\\');
}
sb.append(c);
@@ -1176,7 +1176,7 @@
if(debug) log("URL now: "+s);
s = processURL(s);
dst.data = s;
- if(s == null || s.equals("")) {
+ if((s == null) || s.equals("")) {
if(debug) log("URL invalid");
w.write("url()");
} else {
@@ -1223,7 +1223,7 @@
s = dst.data;
if(debug) log("URL: "+s);
s = processURL(s);
- if (!(s == null || s.equals(""))) {
+ if (!((s == null) || s.equals(""))) {
if(debug) log("URL now: "+s);
s = "@import "+dst.toString();
if(debug) log("Writing: "+s);
@@ -1326,7 +1326,7 @@
{
String s = yytext();
if(debug) log("Matched string: "+s);
- if(paranoidStringCheck && s.indexOf(':') != -1) {
+ if(paranoidStringCheck && (s.indexOf(':') != -1)) {
w.write("/* Deleted disallowed string */");
log("Deleted disallowed string: "+s);
} else {
@@ -1483,7 +1483,7 @@
}
case 336: break;
default:
- if (yy_input == YYEOF && yy_startRead == yy_currentPos) {
+ if ((yy_input == YYEOF) && (yy_startRead == yy_currentPos)) {
yy_atEOF = true;
return null;
}
Modified: trunk/freenet/src/freenet/clients/http/filter/ContentFilter.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/filter/ContentFilter.java
2006-07-09 22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/clients/http/filter/ContentFilter.java
2006-07-09 22:41:26 UTC (rev 9531)
@@ -89,7 +89,7 @@
synchronized(mimeTypesByName) {
mimeTypesByName.put(mimeType.primaryMimeType, mimeType);
String[] alt = mimeType.alternateMimeTypes;
- if(alt != null && alt.length > 0) {
+ if((alt != null) && (alt.length > 0)) {
for(int i=0;i<alt.length;i++)
mimeTypesByName.put(alt[i], mimeType);
}
@@ -160,7 +160,7 @@
}
if(handler.readFilter != null) {
- if(handler.takesACharset && (charset == null ||
charset.length() == 0)) {
+ if(handler.takesACharset && ((charset == null)
|| (charset.length() == 0))) {
charset = detectCharset(data, handler);
}
@@ -180,7 +180,7 @@
String charset = detectBOM(data);
- if(charset == null && handler.charsetExtractor != null) {
+ if((charset == null) && (handler.charsetExtractor != null)) {
// Obviously, this is slow!
// This is why we need to detect on insert.
Modified:
trunk/freenet/src/freenet/clients/http/filter/GenericReadFilterCallback.java
===================================================================
---
trunk/freenet/src/freenet/clients/http/filter/GenericReadFilterCallback.java
2006-07-09 22:28:14 UTC (rev 9530)
+++
trunk/freenet/src/freenet/clients/http/filter/GenericReadFilterCallback.java
2006-07-09 22:41:26 UTC (rev 9531)
@@ -65,7 +65,7 @@
// mailto: not supported yet - FIXME what to do with it? what
queries are allowed? can it possibly hurt us? how to construct safely? etc
HTTPRequest req = new HTTPRequest(uri);
- if (path != null && path.equals("/") &&
req.isParameterSet("newbookmark")) {
+ if ((path != null) && path.equals("/") &&
req.isParameterSet("newbookmark")) {
// allow links to the root to add bookmarks
String bookmark_key = req.getParam("newbookmark");
String bookmark_desc = req.getParam("desc");
Modified: trunk/freenet/src/freenet/clients/http/filter/HTMLFilter.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/filter/HTMLFilter.java
2006-07-09 22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/clients/http/filter/HTMLFilter.java
2006-07-09 22:41:26 UTC (rev 9531)
@@ -179,7 +179,7 @@
splitTag.add(b.toString());
mode =
INTAGWHITESPACE;
b.setLength(0);
- } else if (c == '<' &&
Character.isWhitespace(balt.charAt(0))) {
+ } else if ((c == '<')
&& Character.isWhitespace(balt.charAt(0))) {
// Previous was
an un-escaped < in a script.
saveText(b,
currentTag, w, this);
@@ -195,10 +195,10 @@
balt.setLength(0);
mode = INTEXT;
} else if (
- b.length() == 2
- && c ==
'-'
- &&
prevC == '-'
- &&
pprevC == '!') {
+ (b.length() ==
2)
+ && (c
== '-')
+ &&
(prevC == '-')
+ &&
(pprevC == '!')) {
mode =
INTAGCOMMENT;
b.append(c);
} else if (c == '"') {
@@ -218,7 +218,7 @@
if (c == '"') {
mode = INTAG;
b.append(c); //
Part of the element
- } else if (c == '>' ||
c == '<') {
+ } else if ((c == '>')
|| (c == '<')) {
if
(!deleteErrors) {
throwFilterException("Tags in markup");
b.append(c);
@@ -247,7 +247,7 @@
if (c == '\'') {
mode = INTAG;
b.append(c); //
Part of the element
- } else if (c == '>' ||
c == '<') {
+ } else if ((c == '>')
|| (c == '<')) {
if
(!deleteErrors) {
throwFilterException("Tags in markup");
b.append(c);
@@ -294,7 +294,7 @@
* (avian)
*/
case INTAGCOMMENT :
- if (b.length() >= 4 &&
c == '-' && prevC == '-') {
+ if ((b.length() >= 4)
&& (c == '-') && (prevC == '-')) {
b.append(c);
mode =
INTAGCOMMENTCLOSING;
} else
@@ -324,7 +324,7 @@
b.setLength(0);
balt.setLength(0);
mode = INTEXT;
- } else if (c == '<' &&
Character.isWhitespace(balt.charAt(0))) {
+ } else if ((c == '<')
&& Character.isWhitespace(balt.charAt(0))) {
// Previous was
an un-escaped < in a script.
saveText(balt,
currentTag, w, this);
balt.setLength(0);
@@ -375,7 +375,7 @@
for(int i=0;i<s.length();i++) {
char c = s.charAt(i);
- if(c < 32 && c != '\n' && c != '\r' ) {
+ if((c < 32) && (c != '\n') && (c != '\r') ) {
// Not a real character
// STRONGLY suggests somebody is using a bogus
charset.
// This could be in order to break the filter.
@@ -417,7 +417,7 @@
if (pc.writeStyleScriptWithTag) {
pc.writeStyleScriptWithTag = false;
String style =
pc.currentStyleScriptChunk;
- if (style == null || style.length() ==
0)
+ if ((style == null) || (style.length()
== 0))
pc.writeAfterTag += "<!--
deleted unknown style -->";
else
w.write(style);
@@ -438,7 +438,7 @@
void saveComment(StringBuffer s, Writer w, HTMLParseContext pc)
throws IOException {
- if(s.length() > 3 && s.charAt(0) == '!' && s.charAt(1) == '-'
&& s.charAt(2) == '-') {
+ if((s.length() > 3) && (s.charAt(0) == '!') && (s.charAt(1) ==
'-') && (s.charAt(2) == '-')) {
s.delete(0, 3);
if(s.charAt(s.length()-1) == '-')
s.setLength(s.length()-1);
@@ -506,7 +506,7 @@
return;
}
String s = (String) v.elementAt(len - 1);
- if ((len - 1 != 0 || s.length() > 1) &&
s.endsWith("/")) {
+ if (((len - 1 != 0) || (s.length() > 1)) &&
s.endsWith("/")) {
s = s.substring(0, s.length() - 1);
v.setElementAt(s, len - 1);
if (s.length() == 0)
@@ -515,7 +515,7 @@
// Don't need to set it back because everything
is an I-value
} else endSlash = false;
s = (String) v.elementAt(0);
- if (s.length() > 1 && s.startsWith("/")) {
+ if ((s.length() > 1) && s.startsWith("/")) {
s = s.substring(1);
v.setElementAt(s, 0);
startSlash = true;
@@ -1228,7 +1228,7 @@
if (s != null)
hn.put("xml:lang", s);
s = getHashString(h, "dir");
- if (s != null
+ if ((s != null)
&& (s.equalsIgnoreCase("ltr") ||
s.equalsIgnoreCase("rtl")))
hn.put("dir", s);
return hn;
@@ -1241,7 +1241,7 @@
int n = quotes.length();
for (int x = 0; x < n; x++) {
char cc = quotes.charAt(x);
- if (s.charAt(0) == cc && s.charAt(s.length() -
1) == cc) {
+ if ((s.charAt(0) == cc) && (s.charAt(s.length()
- 1) == cc)) {
if (s.length() > 2)
s = s.substring(1, s.length() -
1);
else
@@ -1541,7 +1541,7 @@
if (type != null) {
String[] typesplit = splitType(type);
type = typesplit[0];
- if (typesplit[1] != null &&
typesplit[1].length() > 0)
+ if ((typesplit[1] != null) &&
(typesplit[1].length() > 0))
charset = typesplit[1];
Logger.debug(
this,
@@ -1585,7 +1585,7 @@
hn.put("type", type);
if (charset != null)
hn.put("charset", charset);
- if (charset != null && hreflang != null)
+ if ((charset != null) && (hreflang !=
null))
hn.put("hreflang", hreflang);
}
}
@@ -1685,7 +1685,7 @@
String scheme = getHashString(h, "scheme");
Logger.minor(this, "meta: name="+name+",
content="+content+", http-equiv="+http_equiv+", scheme="+scheme);
if (content != null) {
- if (name != null && http_equiv == null) {
+ if ((name != null) && (http_equiv == null)) {
if (name.equalsIgnoreCase("Author")) {
hn.put("name", name);
hn.put("content", content);
@@ -1696,7 +1696,7 @@
hn.put("name", name);
hn.put("content", content);
}
- } else if (http_equiv != null && name == null) {
+ } else if ((http_equiv != null) && (name ==
null)) {
if
(http_equiv.equalsIgnoreCase("Expires")) {
hn.put("http-equiv",
http_equiv);
hn.put("content", content);
@@ -1724,7 +1724,7 @@
for(int
i=0;i<typesplit.length;i++)
Logger.minor(this,
"["+i+"] = "+typesplit[i]);
if
(typesplit[0].equalsIgnoreCase("text/html")
- && (typesplit[1] == null
+ && ((typesplit[1] ==
null)
||
typesplit[1].equalsIgnoreCase(pc.charset))) {
hn.put("http-equiv",
http_equiv);
hn.put(
@@ -1779,7 +1779,7 @@
}
ParsedTag sanitize(ParsedTag t, HTMLParseContext pc) {
- if (!(t.unparsedAttrs.length == 3 ||
t.unparsedAttrs.length == 4))
+ if (!((t.unparsedAttrs.length == 3) ||
(t.unparsedAttrs.length == 4)))
return null;
if (!t.unparsedAttrs[0].equalsIgnoreCase("html"))
return null;
@@ -1791,7 +1791,7 @@
if (t.unparsedAttrs.length == 4) {
String ss = stripQuotes(t.unparsedAttrs[3]);
String spec = getHashString(DTDs, s);
- if (spec != null && !spec.equals(ss))
+ if ((spec != null) && !spec.equals(ss))
return null;
}
return t;
@@ -1831,7 +1831,7 @@
HTMLParseContext pc) throws DataFilterException {
Hashtable hn = super.sanitizeHash(h, p, pc);
String xmlns = getHashString(h, "xmlns");
- if (xmlns != null &&
xmlns.equals("http://www.w3.org/1999/xhtml"))
+ if ((xmlns != null) &&
xmlns.equals("http://www.w3.org/1999/xhtml"))
hn.put("xmlns", xmlns);
return hn;
}
@@ -1887,7 +1887,7 @@
throw e;
}
String s = w.toString();
- if (s == null || s.length() == 0)
+ if ((s == null) || (s.length() == 0))
return null;
// Core.logger.log(SaferFilter.class, "Style now:
" + s, Logger.DEBUG);
Logger.debug(HTMLFilter.class, "Style finally: " + s);
@@ -1969,7 +1969,7 @@
if (curPos > maxPos)
return null;
start = curPos;
- while (curPos < maxPos && str.charAt(curPos) != c)
+ while ((curPos < maxPos) && (str.charAt(curPos) != c))
curPos++;
end = curPos;
curPos++;
@@ -1983,7 +1983,7 @@
String overrideCharset,
FilterCallback cb) {
Logger.minor(HTMLFilter.class, "Sanitizing URI: "+suri+" (
override type "+overrideType +" override charset "+overrideCharset+" )");
- if(overrideCharset != null && overrideCharset.length() > 0)
+ if((overrideCharset != null) && (overrideCharset.length() > 0))
overrideType += ";charset="+overrideCharset;
return cb.processURI(suri, overrideType);
}
Modified: trunk/freenet/src/freenet/crypt/DSA.java
===================================================================
--- trunk/freenet/src/freenet/crypt/DSA.java 2006-07-09 22:28:14 UTC (rev
9530)
+++ trunk/freenet/src/freenet/crypt/DSA.java 2006-07-09 22:41:26 UTC (rev
9531)
@@ -29,7 +29,7 @@
BigInteger k;
do {
k=new NativeBigInteger(256, r);
- } while (k.compareTo(g.getQ())>-1 || k.compareTo(BigInteger.ZERO)==0);
+ } while ((k.compareTo(g.getQ())>-1) ||
(k.compareTo(BigInteger.ZERO)==0));
return sign(g, x, k, m);
}
@@ -44,7 +44,7 @@
BigInteger k;
do {
k=new NativeBigInteger(160, r);
- } while (k.compareTo(g.getQ())>-1 ||
k.compareTo(BigInteger.ZERO)==0);
+ } while ((k.compareTo(g.getQ())>-1) ||
(k.compareTo(BigInteger.ZERO)==0));
result[i][0] = g.getG().modPow(k, g.getP()); // r
result[i][1] = k.modInverse(g.getQ()); // k^-1
Modified: trunk/freenet/src/freenet/crypt/DSAGroup.java
===================================================================
--- trunk/freenet/src/freenet/crypt/DSAGroup.java 2006-07-09 22:28:14 UTC
(rev 9530)
+++ trunk/freenet/src/freenet/crypt/DSAGroup.java 2006-07-09 22:41:26 UTC
(rev 9531)
@@ -46,8 +46,8 @@
this.gAsHexString = gAsHexString;
//Sanity check. Needed because of the Kaffe workaround further down
- if (pAsHexString == null || qAsHexString == null
- || gAsHexString == null)
+ if ((pAsHexString == null) || (qAsHexString == null)
+ || (gAsHexString == null))
throw new NullPointerException("Invalid DSAGroup");
try {
@@ -267,11 +267,11 @@
q = grp.getQ();
g = grp.getG();
BigInteger pmin1 = p.subtract(BigInteger.ONE);
- boolean rv = !(p.bitLength() > 1024 || p.bitLength() < 512)
- && (p.bitLength() % 64) == 0 && q.bitLength() == 160
- && q.compareTo(p) == -1 && isPrime(p, 80) && isPrime(q, 80)
+ boolean rv = !((p.bitLength() > 1024) || (p.bitLength() < 512))
+ && ((p.bitLength() % 64) == 0) && (q.bitLength() == 160)
+ && (q.compareTo(p) == -1) && isPrime(p, 80) && isPrime(q, 80)
&& pmin1.mod(q).equals(BigInteger.ZERO)
- && g.compareTo(BigInteger.ONE) == 1
+ && (g.compareTo(BigInteger.ONE) == 1)
&& !g.equals(pmin1.modPow(pmin1.divide(q), p));
return rv;
}
Modified: trunk/freenet/src/freenet/crypt/DSAGroupGenerator.java
===================================================================
--- trunk/freenet/src/freenet/crypt/DSAGroupGenerator.java 2006-07-09
22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/crypt/DSAGroupGenerator.java 2006-07-09
22:41:26 UTC (rev 9531)
@@ -169,7 +169,7 @@
System.exit(1);
}
}
- System.out.println("Successfully signed and verified 10,000 times,
average sig time "+(double)totalSigTime / 10000.0 +", average verify time
"+(double)totalVerifyTime/10000.0);
+ System.out.println("Successfully signed and verified 10,000 times,
average sig time "+totalSigTime / 10000.0 +", average verify time
"+totalVerifyTime/10000.0);
}
private static byte[] increment(byte[] seed) {
Modified: trunk/freenet/src/freenet/crypt/DSASignature.java
===================================================================
--- trunk/freenet/src/freenet/crypt/DSASignature.java 2006-07-09 22:28:14 UTC
(rev 9530)
+++ trunk/freenet/src/freenet/crypt/DSASignature.java 2006-07-09 22:41:26 UTC
(rev 9531)
@@ -54,7 +54,7 @@
public DSASignature(BigInteger r, BigInteger s) {
this.r=r;
this.s=s;
- if(r == null || s == null) //Do not allow this sice we wont do
any sanity checking beyond this place
+ if((r == null) || (s == null)) //Do not allow this sice we wont
do any sanity checking beyond this place
throw new NullPointerException();
}
Modified: trunk/freenet/src/freenet/crypt/Util.java
===================================================================
--- trunk/freenet/src/freenet/crypt/Util.java 2006-07-09 22:28:14 UTC (rev
9530)
+++ trunk/freenet/src/freenet/crypt/Util.java 2006-07-09 22:41:26 UTC (rev
9531)
@@ -108,7 +108,7 @@
public static BigInteger readMPI(InputStream in) throws IOException {
int b1 = in.read();
int b2 = in.read();
- if (b1 == -1 || b2 == -1)
+ if ((b1 == -1) || (b2 == -1))
throw new EOFException();
byte[] data = new byte[(((b1 << 8) + b2) + 8) >> 3];
readFully(in, data, 0, data.length);
@@ -194,7 +194,7 @@
//if you have two method if you have two equally sized arrays
public static boolean byteArrayEqual(byte[] a, byte[] b, int offset,
int length) {
int lim = offset + length;
- if (a.length < lim || b.length < lim)
+ if ((a.length < lim) || (b.length < lim))
return false;
for (int i = offset; i < lim; ++i)
if (a[i] != b[i])
@@ -272,7 +272,7 @@
}
public static void main(String[] args) throws Exception {
- if (args.length == 0 || args[0].equals("write")) {
+ if ((args.length == 0) || args[0].equals("write")) {
writeMPI(new BigInteger("9"), System.out);
writeMPI(new BigInteger("1234567890123456789"),
System.out);
writeMPI(new BigInteger("100200300400500600700800900"),
System.out);
@@ -309,7 +309,7 @@
*/
public static int log2(long n) {
int log2 = 0;
- while (log2 < 63 && 1L << log2 < n)
+ while ((log2 < 63) && (1L << log2 < n))
++log2;
return log2;
}
Modified: trunk/freenet/src/freenet/crypt/Yarrow.java
===================================================================
--- trunk/freenet/src/freenet/crypt/Yarrow.java 2006-07-09 22:28:14 UTC (rev
9530)
+++ trunk/freenet/src/freenet/crypt/Yarrow.java 2006-07-09 22:41:26 UTC (rev
9531)
@@ -459,7 +459,7 @@
// "+slow_entropy, Logger.NORMAL);
System.err.println("Fast pool: " + fast_entropy
+ "\tSlow pool: " + slow_entropy);
}
- if (performedPoolReseed && seedfile != null) {
+ if (performedPoolReseed && (seedfile != null)) {
//Dont do this while synchronized on 'this' since
//opening a file seems to be suprisingly slow on windows
write_seed(seedfile);
@@ -595,7 +595,7 @@
byte[] b = new byte[1024];
- if (args.length == 0 || args[0].equalsIgnoreCase("latency")) {
+ if ((args.length == 0) || args[0].equalsIgnoreCase("latency")) {
if (args.length == 2)
b = new byte[Integer.parseInt(args[1])];
long start = System.currentTimeMillis();
@@ -666,7 +666,7 @@
}
}
} else if (args[0].equalsIgnoreCase("sample")) {
- if (args.length == 1 || args[1].equals("general")) {
+ if ((args.length == 1) || args[1].equals("general")) {
System.out.println("nextInt(): ");
for (int i = 0; i < 3; i++)
System.out.println(r.nextInt());
Modified: trunk/freenet/src/freenet/crypt/ciphers/Rijndael.java
===================================================================
--- trunk/freenet/src/freenet/crypt/ciphers/Rijndael.java 2006-07-09
22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/crypt/ciphers/Rijndael.java 2006-07-09
22:41:26 UTC (rev 9531)
@@ -31,13 +31,13 @@
}
public Rijndael(int keysize, int blocksize) throws
UnsupportedCipherException {
- if (! (keysize == 128 ||
- keysize == 192 ||
- keysize == 256))
+ if (! ((keysize == 128) ||
+ (keysize == 192) ||
+ (keysize == 256)))
throw new UnsupportedCipherException("Invalid keysize");
- if (! (blocksize == 128 ||
- blocksize == 192 ||
- blocksize == 256))
+ if (! ((blocksize == 128) ||
+ (blocksize == 192) ||
+ (blocksize == 256)))
throw new UnsupportedCipherException("Invalid blocksize");
this.keysize=keysize;
this.blocksize=blocksize;
Modified: trunk/freenet/src/freenet/crypt/ciphers/Rijndael_Algorithm.java
===================================================================
--- trunk/freenet/src/freenet/crypt/ciphers/Rijndael_Algorithm.java
2006-07-09 22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/crypt/ciphers/Rijndael_Algorithm.java
2006-07-09 22:41:26 UTC (rev 9531)
@@ -88,7 +88,7 @@
static {
long time = System.currentTimeMillis();
-if (RDEBUG && debuglevel > 6) {
+if (RDEBUG && (debuglevel > 6)) {
System.out.println("Algorithm Name: "+Rijndael_Properties.FULL_NAME);
System.out.println("Electronic Codebook (ECB) Mode");
System.out.println();
@@ -224,7 +224,7 @@
time = System.currentTimeMillis() - time;
-if (RDEBUG && debuglevel > 8) {
+if (RDEBUG && (debuglevel > 8)) {
System.out.println("==========");
System.out.println();
System.out.println("Static Data");
@@ -273,7 +273,7 @@
// multiply two elements of GF(2^m)
static final int mul (int a, int b) {
- return (a != 0 && b != 0) ?
+ return ((a != 0) && (b != 0)) ?
alog[(log[a & 0xFF] + log[b & 0xFF]) % 255] :
0;
}
@@ -361,7 +361,7 @@
t1 = a1;
t2 = a2;
t3 = a3;
-if (RDEBUG && debuglevel > 6)
System.out.println("CT"+r+"="+intToString(t0)+intToString(t1)+intToString(t2)+intToString(t3));
+if (RDEBUG && (debuglevel > 6))
System.out.println("CT"+r+"="+intToString(t0)+intToString(t1)+intToString(t2)+intToString(t3));
}
// last round is special
@@ -386,7 +386,7 @@
result[13] = (byte)(S[(t0 >>> 16) & 0xFF] ^ (tt >>> 16));
result[14] = (byte)(S[(t1 >>> 8) & 0xFF] ^ (tt >>> 8));
result[15] = (byte)(S[ t2 & 0xFF] ^ tt );
-if (RDEBUG && debuglevel > 6) {
+if (RDEBUG && (debuglevel > 6)) {
System.out.println("CT="+toString(result));
System.out.println();
}
@@ -450,7 +450,7 @@
t1 = a1;
t2 = a2;
t3 = a3;
-if (RDEBUG && debuglevel > 6)
System.out.println("PT"+r+"="+intToString(t0)+intToString(t1)+intToString(t2)+intToString(t3));
+if (RDEBUG && (debuglevel > 6))
System.out.println("PT"+r+"="+intToString(t0)+intToString(t1)+intToString(t2)+intToString(t3));
}
// last round is special
@@ -475,7 +475,7 @@
result[13] = (byte)(Si[(t2 >>> 16) & 0xFF] ^ (tt >>> 16));
result[14] = (byte)(Si[(t1 >>> 8) & 0xFF] ^ (tt >>> 8));
result[15] = (byte)(Si[ t0 & 0xFF] ^ tt );
-if (RDEBUG && debuglevel > 6) {
+if (RDEBUG && (debuglevel > 6)) {
System.out.println("PT="+toString(result));
System.out.println();
}
@@ -514,7 +514,7 @@
if (RDEBUG) trace(IN, "makeKey("+k+", "+blockSize+")");
if (k == null)
throw new InvalidKeyException("Empty key");
- if (!(k.length == 16 || k.length == 24 || k.length == 32))
+ if (!((k.length == 16) || (k.length == 24) || (k.length == 32)))
throw new InvalidKeyException("Incorrect key length");
int ROUNDS = getRounds(k.length, blockSize);
int BC = blockSize / 4;
@@ -638,7 +638,7 @@
T3[(t[(i + s2) % BC] >>> 8) & 0xFF] ^
T4[ t[(i + s3) % BC] & 0xFF] ) ^ Ke[r][i];
System.arraycopy(a, 0, t, 0, BC);
-if (RDEBUG && debuglevel > 6) System.out.println("CT"+r+"="+toString(t));
+if (RDEBUG && (debuglevel > 6)) System.out.println("CT"+r+"="+toString(t));
}
for (i = 0; i < BC; i++) { // last round is special
tt = Ke[ROUNDS][i];
@@ -647,7 +647,7 @@
result[j++] = (byte)(S[(t[(i + s2) % BC] >>> 8) & 0xFF] ^ (tt >>>
8));
result[j++] = (byte)(S[ t[(i + s3) % BC] & 0xFF] ^ tt);
}
-if (RDEBUG && debuglevel > 6) {
+if (RDEBUG && (debuglevel > 6)) {
System.out.println("CT="+toString(result));
System.out.println();
}
@@ -697,7 +697,7 @@
T7[(t[(i + s2) % BC] >>> 8) & 0xFF] ^
T8[ t[(i + s3) % BC] & 0xFF] ) ^ Kd[r][i];
System.arraycopy(a, 0, t, 0, BC);
-if (RDEBUG && debuglevel > 6) System.out.println("PT"+r+"="+toString(t));
+if (RDEBUG && (debuglevel > 6)) System.out.println("PT"+r+"="+toString(t));
}
for (i = 0; i < BC; i++) { // last round is special
tt = Kd[ROUNDS][i];
@@ -706,7 +706,7 @@
result[j++] = (byte)(Si[(t[(i + s2) % BC] >>> 8) & 0xFF] ^ (tt
>>> 8));
result[j++] = (byte)(Si[ t[(i + s3) % BC] & 0xFF] ^ tt);
}
-if (RDEBUG && debuglevel > 6) {
+if (RDEBUG && (debuglevel > 6)) {
System.out.println("PT="+toString(result));
System.out.println();
}
@@ -727,7 +727,7 @@
for (i = 0; i < BLOCK_SIZE; i++)
pt[i] = (byte) i;
-if (RDEBUG && debuglevel > 6) {
+if (RDEBUG && (debuglevel > 6)) {
System.out.println("==========");
System.out.println();
System.out.println("KEYSIZE="+(8*keysize));
@@ -736,7 +736,7 @@
}
Object key = makeKey(kb, BLOCK_SIZE);
-if (RDEBUG && debuglevel > 6) {
+if (RDEBUG && (debuglevel > 6)) {
System.out.println("Intermediate Ciphertext Values (Encryption)");
System.out.println();
System.out.println("PT="+toString(pt));
@@ -744,7 +744,7 @@
byte[] ct = new byte[BLOCK_SIZE];
blockEncrypt(pt, ct, 0, key, BLOCK_SIZE);
-if (RDEBUG && debuglevel > 6) {
+if (RDEBUG && (debuglevel > 6)) {
System.out.println("Intermediate Plaintext Values (Decryption)");
System.out.println();
System.out.println("CT="+toString(ct));
@@ -757,12 +757,12 @@
throw new RuntimeException("Symmetric operation failed");
}
catch (Exception x) {
-if (RDEBUG && debuglevel > 0) {
+if (RDEBUG && (debuglevel > 0)) {
debug("Exception encountered during self-test: " + x.getMessage());
x.printStackTrace();
}
}
-if (RDEBUG && debuglevel > 0) debug("Self-test OK? " + ok);
+if (RDEBUG && (debuglevel > 0)) debug("Self-test OK? " + ok);
if (RDEBUG) trace(OUT, "self_test()");
return ok;
}
Modified: trunk/freenet/src/freenet/crypt/ciphers/Rijndael_Properties.java
===================================================================
--- trunk/freenet/src/freenet/crypt/ciphers/Rijndael_Properties.java
2006-07-09 22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/crypt/ciphers/Rijndael_Properties.java
2006-07-09 22:41:26 UTC (rev 9531)
@@ -180,7 +180,7 @@
static PrintWriter getOutput() {
PrintWriter pw;
String name = getProperty("Output");
- if (name != null && name.equals("out"))
+ if ((name != null) && name.equals("out"))
pw = new PrintWriter(System.out, true);
else
pw = new PrintWriter(System.err, true);
Modified: trunk/freenet/src/freenet/crypt/ciphers/Twofish.java
===================================================================
--- trunk/freenet/src/freenet/crypt/ciphers/Twofish.java 2006-07-09
22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/crypt/ciphers/Twofish.java 2006-07-09
22:41:26 UTC (rev 9531)
@@ -25,10 +25,10 @@
}
public Twofish(int keysize) throws UnsupportedCipherException {
- if (! (keysize == 64 ||
- keysize == 128 ||
- keysize == 192 ||
- keysize == 256))
+ if (! ((keysize == 64) ||
+ (keysize == 128) ||
+ (keysize == 192) ||
+ (keysize == 256)))
throw new UnsupportedCipherException("Invalid keysize");
this.keysize=keysize;
}
Modified: trunk/freenet/src/freenet/crypt/ciphers/Twofish_Algorithm.java
===================================================================
--- trunk/freenet/src/freenet/crypt/ciphers/Twofish_Algorithm.java
2006-07-09 22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/crypt/ciphers/Twofish_Algorithm.java
2006-07-09 22:41:26 UTC (rev 9531)
@@ -255,7 +255,7 @@
static {
long time = System.currentTimeMillis();
-if (TDEBUG && debuglevel > 6) {
+if (TDEBUG && (debuglevel > 6)) {
System.out.println("Algorithm Name: "+Twofish_Properties.FULL_NAME);
System.out.println("Electronic Codebook (ECB) Mode");
System.out.println();
@@ -298,7 +298,7 @@
time = System.currentTimeMillis() - time;
-if (TDEBUG && debuglevel > 8) {
+if (TDEBUG && (debuglevel > 8)) {
System.out.println("==========");
System.out.println();
System.out.println("Static Data");
@@ -347,10 +347,10 @@
if (k == null)
throw new InvalidKeyException("Empty key");
int length = k.length;
- if (!(length == 8 || length == 16 || length == 24 || length == 32))
+ if (!((length == 8) || (length == 16) || (length == 24) || (length ==
32)))
throw new InvalidKeyException("Incorrect key length");
-if (TDEBUG && debuglevel > 7) {
+if (TDEBUG && (debuglevel > 7)) {
System.out.println("Intermediate Session Key Values");
System.out.println();
System.out.println("Raw="+toString(k));
@@ -366,7 +366,7 @@
// compute S-box keys using (12, 8) Reed-Solomon code over GF(256)
//
int i, j, offset = 0;
- for (i = 0, j = k64Cnt-1; i < 4 && offset < length; i++, j--) {
+ for (i = 0, j = k64Cnt-1; (i < 4) && (offset < length); i++, j--) {
k32e[i] = (k[offset++] & 0xFF) |
(k[offset++] & 0xFF) << 8 |
(k[offset++] & 0xFF) << 16 |
@@ -428,7 +428,7 @@
Object sessionKey = new Object[] { sBox, subKeys };
-if (TDEBUG && debuglevel > 7) {
+if (TDEBUG && (debuglevel > 7)) {
System.out.println("S-box[]:");
for(i=0;i<64;i++) { for(j=0;j<4;j++)
System.out.print("0x"+intToString(sBox[i*4+j])+", "); System.out.println();}
System.out.println();
@@ -464,7 +464,7 @@
int[] sBox = (int[]) sk[0];
int[] sKey = (int[]) sk[1];
-if (TDEBUG && debuglevel > 6) System.out.println("PT="+toString(in, inOffset,
BLOCK_SIZE));
+if (TDEBUG && (debuglevel > 6)) System.out.println("PT="+toString(in,
inOffset, BLOCK_SIZE));
int x0 = (in[inOffset++] & 0xFF) |
(in[inOffset++] & 0xFF) << 8 |
@@ -487,7 +487,7 @@
x1 ^= sKey[INPUT_WHITEN + 1];
x2 ^= sKey[INPUT_WHITEN + 2];
x3 ^= sKey[INPUT_WHITEN + 3];
-if (TDEBUG && debuglevel > 6)
System.out.println("PTw="+intToString(x0)+intToString(x1)+intToString(x2)+intToString(x3));
+if (TDEBUG && (debuglevel > 6))
System.out.println("PTw="+intToString(x0)+intToString(x1)+intToString(x2)+intToString(x3));
int t0, t1;
int k = ROUND_SUBKEYS;
@@ -498,7 +498,7 @@
x2 = x2 >>> 1 | x2 << 31;
x3 = x3 << 1 | x3 >>> 31;
x3 ^= t0 + 2*t1 + sKey[k++];
-if (TDEBUG && debuglevel > 6)
System.out.println("CT"+(R)+"="+intToString(x0)+intToString(x1)+intToString(x2)+intToString(x3));
+if (TDEBUG && (debuglevel > 6))
System.out.println("CT"+(R)+"="+intToString(x0)+intToString(x1)+intToString(x2)+intToString(x3));
t0 = Fe32_0( sBox, x2 );
t1 = Fe32_3( sBox, x3 );
@@ -506,13 +506,13 @@
x0 = x0 >>> 1 | x0 << 31;
x1 = x1 << 1 | x1 >>> 31;
x1 ^= t0 + 2*t1 + sKey[k++];
-if (TDEBUG && debuglevel > 6)
System.out.println("CT"+(R+1)+"="+intToString(x0)+intToString(x1)+intToString(x2)+intToString(x3));
+if (TDEBUG && (debuglevel > 6))
System.out.println("CT"+(R+1)+"="+intToString(x0)+intToString(x1)+intToString(x2)+intToString(x3));
}
x2 ^= sKey[OUTPUT_WHITEN ];
x3 ^= sKey[OUTPUT_WHITEN + 1];
x0 ^= sKey[OUTPUT_WHITEN + 2];
x1 ^= sKey[OUTPUT_WHITEN + 3];
-if (TDEBUG && debuglevel > 6)
System.out.println("CTw="+intToString(x0)+intToString(x1)+intToString(x2)+intToString(x3));
+if (TDEBUG && (debuglevel > 6))
System.out.println("CTw="+intToString(x0)+intToString(x1)+intToString(x2)+intToString(x3));
result[0] = (byte) x2;
result[1] = (byte)(x2 >>> 8);
@@ -531,7 +531,7 @@
result[14] = (byte)(x1 >>> 16);
result[15] = (byte)(x1 >>> 24);
-if (TDEBUG && debuglevel > 6) {
+if (TDEBUG && (debuglevel > 6)) {
System.out.println("CT="+toString(result));
System.out.println();
}
@@ -552,7 +552,7 @@
int[] sBox = (int[]) sk[0];
int[] sKey = (int[]) sk[1];
-if (TDEBUG && debuglevel > 6) System.out.println("CT="+toString(in, inOffset,
BLOCK_SIZE));
+if (TDEBUG && (debuglevel > 6)) System.out.println("CT="+toString(in,
inOffset, BLOCK_SIZE));
int x2 = (in[inOffset++] & 0xFF) |
(in[inOffset++] & 0xFF) << 8 |
@@ -575,7 +575,7 @@
x3 ^= sKey[OUTPUT_WHITEN + 1];
x0 ^= sKey[OUTPUT_WHITEN + 2];
x1 ^= sKey[OUTPUT_WHITEN + 3];
-if (TDEBUG && debuglevel > 6)
System.out.println("CTw="+intToString(x2)+intToString(x3)+intToString(x0)+intToString(x1));
+if (TDEBUG && (debuglevel > 6))
System.out.println("CTw="+intToString(x2)+intToString(x3)+intToString(x0)+intToString(x1));
int k = ROUND_SUBKEYS + 2*ROUNDS - 1;
int t0, t1;
@@ -586,7 +586,7 @@
x1 = x1 >>> 1 | x1 << 31;
x0 = x0 << 1 | x0 >>> 31;
x0 ^= t0 + t1 + sKey[k--];
-if (TDEBUG && debuglevel > 6)
System.out.println("PT"+(ROUNDS-R)+"="+intToString(x2)+intToString(x3)+intToString(x0)+intToString(x1));
+if (TDEBUG && (debuglevel > 6))
System.out.println("PT"+(ROUNDS-R)+"="+intToString(x2)+intToString(x3)+intToString(x0)+intToString(x1));
t0 = Fe32_0( sBox, x0 );
t1 = Fe32_3( sBox, x1 );
@@ -594,13 +594,13 @@
x3 = x3 >>> 1 | x3 << 31;
x2 = x2 << 1 | x2 >>> 31;
x2 ^= t0 + t1 + sKey[k--];
-if (TDEBUG && debuglevel > 6)
System.out.println("PT"+(ROUNDS-R-1)+"="+intToString(x2)+intToString(x3)+intToString(x0)+intToString(x1));
+if (TDEBUG && (debuglevel > 6))
System.out.println("PT"+(ROUNDS-R-1)+"="+intToString(x2)+intToString(x3)+intToString(x0)+intToString(x1));
}
x0 ^= sKey[INPUT_WHITEN ];
x1 ^= sKey[INPUT_WHITEN + 1];
x2 ^= sKey[INPUT_WHITEN + 2];
x3 ^= sKey[INPUT_WHITEN + 3];
-if (TDEBUG && debuglevel > 6)
System.out.println("PTw="+intToString(x2)+intToString(x3)+intToString(x0)+intToString(x1));
+if (TDEBUG && (debuglevel > 6))
System.out.println("PTw="+intToString(x2)+intToString(x3)+intToString(x0)+intToString(x1));
result[0] = (byte) x0;
@@ -620,7 +620,7 @@
result[14] = (byte)(x3 >>> 16);
result[15] = (byte)(x3 >>> 24);
-if (TDEBUG && debuglevel > 6) {
+if (TDEBUG && (debuglevel > 6)) {
System.out.println("PT="+toString(result));
System.out.println();
}
@@ -744,7 +744,7 @@
for (i = 0; i < BLOCK_SIZE; i++)
pt[i] = (byte) i;
-if (TDEBUG && debuglevel > 6) {
+if (TDEBUG && (debuglevel > 6)) {
System.out.println("==========");
System.out.println();
System.out.println("KEYSIZE="+(8*keysize));
@@ -753,14 +753,14 @@
}
Object key = makeKey(kb);
-if (TDEBUG && debuglevel > 6) {
+if (TDEBUG && (debuglevel > 6)) {
System.out.println("Intermediate Ciphertext Values (Encryption)");
System.out.println();
}
byte[] ct = new byte[BLOCK_SIZE];
blockEncrypt(pt, ct, 0, key);
-if (TDEBUG && debuglevel > 6) {
+if (TDEBUG && (debuglevel > 6)) {
System.out.println("Intermediate Plaintext Values (Decryption)");
System.out.println();
}
@@ -771,12 +771,12 @@
if (!ok)
throw new RuntimeException("Symmetric operation failed");
} catch (Exception x) {
-if (TDEBUG && debuglevel > 0) {
+if (TDEBUG && (debuglevel > 0)) {
debug("Exception encountered during self-test: " + x.getMessage());
x.printStackTrace();
}
}
-if (TDEBUG && debuglevel > 0) debug("Self-test OK? " + ok);
+if (TDEBUG && (debuglevel > 0)) debug("Self-test OK? " + ok);
if (TDEBUG) trace(OUT, "self_test()");
return ok;
}
Modified: trunk/freenet/src/freenet/crypt/ciphers/Twofish_Properties.java
===================================================================
--- trunk/freenet/src/freenet/crypt/ciphers/Twofish_Properties.java
2006-07-09 22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/crypt/ciphers/Twofish_Properties.java
2006-07-09 22:41:26 UTC (rev 9531)
@@ -180,7 +180,7 @@
static PrintWriter getOutput() {
PrintWriter pw;
String name = getProperty("Output");
- if (name != null && name.equals("out"))
+ if ((name != null) && name.equals("out"))
pw = new PrintWriter(System.out, true);
else
pw = new PrintWriter(System.err, true);
Modified: trunk/freenet/src/freenet/io/comm/FreenetInetAddress.java
===================================================================
--- trunk/freenet/src/freenet/io/comm/FreenetInetAddress.java 2006-07-09
22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/io/comm/FreenetInetAddress.java 2006-07-09
22:41:26 UTC (rev 9531)
@@ -56,7 +56,7 @@
public FreenetInetAddress(String host, boolean allowUnknown) throws
UnknownHostException {
InetAddress addr = null;
- if(host != null && host.startsWith("/")) host = host.substring(1);
+ if((host != null) && host.startsWith("/")) host = host.substring(1);
// if we were created with an explicit IP address, use it as such
// debugging log messages because AddressIdentifier doesn't appear to
handle all IPv6 literals correctly, such as "fe80::204:1234:dead:beef"
AddressIdentifier.AddressType addressType =
AddressIdentifier.getAddressType(host);
@@ -97,12 +97,12 @@
return false;
}
// Now that we know we have the same hostname, we can
propagate the IP.
- if(_address != null && addr._address == null)
+ if((_address != null) && (addr._address == null))
addr._address = _address;
- if(addr._address != null && _address == null)
+ if((addr._address != null) && (_address == null))
_address = addr._address;
// Except if we actually do have two different
looked-up IPs!
- if(addr._address != null && _address != null &&
!addr._address.equals(_address))
+ if((addr._address != null) && (_address != null) &&
!addr._address.equals(_address))
return false;
// Equal.
return true;
@@ -124,12 +124,12 @@
return false;
}
// Now that we know we have the same hostname, we can
propagate the IP.
- if(_address != null && addr._address == null)
+ if((_address != null) && (addr._address == null))
addr._address = _address;
- if(addr._address != null && _address == null)
+ if((addr._address != null) && (_address == null))
_address = addr._address;
// Except if we actually do have two different
looked-up IPs!
- if(addr._address != null && _address != null &&
!addr._address.equals(_address))
+ if((addr._address != null) && (_address != null) &&
!addr._address.equals(_address))
return false;
// Equal.
return true;
@@ -179,7 +179,7 @@
*/
public InetAddress getHandshakeAddress() {
// Since we're handshaking, hostname-to-IP may have changed
- if (_address != null && hostname == null) {
+ if ((_address != null) && (hostname == null)) {
Logger.minor(this, "hostname is null, returning "+_address);
return _address;
} else {
Modified: trunk/freenet/src/freenet/io/comm/IOStatisticCollector.java
===================================================================
--- trunk/freenet/src/freenet/io/comm/IOStatisticCollector.java 2006-07-09
22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/io/comm/IOStatisticCollector.java 2006-07-09
22:41:26 UTC (rev 9531)
@@ -124,8 +124,8 @@
tin += inres[i];
tout += outres[i];
- int in = (int) (((double)tin*10.0) /
(divby*(double)(i+1)));
- int out =(int) (((double)tout*10.0)
/(divby*(double)(i+1)));
+ int in = (int) ((tin*10.0) / (divby*(i+1)));
+ int out =(int) ((tout*10.0) /(divby*(i+1)));
System.err.print("i:" + (in/10) + "." +
(in%10));
System.err.print(" o:" + (out/10) + "." +
(out%10));
Modified: trunk/freenet/src/freenet/io/comm/MessageFilter.java
===================================================================
--- trunk/freenet/src/freenet/io/comm/MessageFilter.java 2006-07-09
22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/io/comm/MessageFilter.java 2006-07-09
22:41:26 UTC (rev 9531)
@@ -108,7 +108,7 @@
}
public MessageFilter or(MessageFilter or) {
- if(or != null && _or != null) {
+ if((or != null) && (_or != null)) {
// FIXME maybe throw? this is almost certainly a bug,
and a nasty one too!
Logger.error(this, "or() replacement: "+_or+" -> "+or,
new Exception("error"));
}
@@ -196,7 +196,7 @@
}
public void onDroppedConnection(PeerContext ctx) {
- if(_matchesDroppedConnections && _source == ctx) {
+ if(_matchesDroppedConnections && (_source == ctx)) {
_droppedConnection = ctx;
}
}
Modified: trunk/freenet/src/freenet/io/comm/UdpSocketManager.java
===================================================================
--- trunk/freenet/src/freenet/io/comm/UdpSocketManager.java 2006-07-09
22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/io/comm/UdpSocketManager.java 2006-07-09
22:41:26 UTC (rev 9531)
@@ -386,7 +386,7 @@
ListIterator i = _filters.listIterator();
while (i.hasNext()) {
MessageFilter f = (MessageFilter) i.next();
- if(f.matchesDroppedConnection() && f._source ==
ctx) {
+ if(f.matchesDroppedConnection() && (f._source ==
ctx)) {
f.onDroppedConnection(ctx);
if(f.droppedConnection() != null) {
synchronized(f) {
@@ -402,7 +402,7 @@
Logger.debug(this, "Waiting for "+filter);
long startTime = System.currentTimeMillis();
Message ret = null;
- if(lowLevelFilter != null && filter._source != null &&
+ if((lowLevelFilter != null) && (filter._source != null) &&
filter.matchesDroppedConnection() &&
lowLevelFilter.isDisconnected(filter._source))
throw new DisconnectedException();
@@ -448,7 +448,7 @@
// Precaution against filter getting
matched between being added to _filters and
// here - bug discovered by Mason
boolean fmatched = false;
- while(!(fmatched = (filter.matched() ||
filter.droppedConnection() != null))) {
+ while(!(fmatched = (filter.matched() ||
(filter.droppedConnection() != null)))) {
long wait =
filter.getTimeout()-System.currentTimeMillis();
if(wait > 0)
filter.wait(wait);
@@ -472,7 +472,7 @@
// }
long endTime = System.currentTimeMillis();
Logger.debug(this, "Returning in "+(endTime-startTime)+"ms");
- if(ctr != null && ret != null)
+ if((ctr != null) && (ret != null))
ctr.receivedBytes(ret._receivedByteCount);
return ret;
}
Modified: trunk/freenet/src/freenet/io/xfer/BlockTransmitter.java
===================================================================
--- trunk/freenet/src/freenet/io/xfer/BlockTransmitter.java 2006-07-09
22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/io/xfer/BlockTransmitter.java 2006-07-09
22:41:26 UTC (rev 9531)
@@ -237,8 +237,8 @@
if(_sendComplete)
return false;
if (msg == null) {
- if(timeAllSent > 0 &&
(System.currentTimeMillis() - timeAllSent) > SEND_TIMEOUT &&
- getNumSent() ==
_prb.getNumPackets()) {
+ if((timeAllSent > 0) &&
((System.currentTimeMillis() - timeAllSent) > SEND_TIMEOUT) &&
+ (getNumSent() ==
_prb.getNumPackets())) {
synchronized(_senderThread) {
_sendComplete = true;
_senderThread.notifyAll();
Modified: trunk/freenet/src/freenet/keys/CHKBlock.java
===================================================================
--- trunk/freenet/src/freenet/keys/CHKBlock.java 2006-07-09 22:28:14 UTC
(rev 9530)
+++ trunk/freenet/src/freenet/keys/CHKBlock.java 2006-07-09 22:41:26 UTC
(rev 9531)
@@ -48,7 +48,7 @@
throw new IllegalArgumentException("Wrong length:
"+headers.length+" should be "+TOTAL_HEADERS_LENGTH);
hashIdentifier = (short)(((headers[0] & 0xff) << 8) + (headers[1] &
0xff));
// Logger.debug(CHKBlock.class, "Data length: "+data.length+", header
length: "+header.length);
- if(key != null && !verify) {
+ if((key != null) && !verify) {
this.chk = key;
return;
}
Modified: trunk/freenet/src/freenet/keys/ClientCHK.java
===================================================================
--- trunk/freenet/src/freenet/keys/ClientCHK.java 2006-07-09 22:28:14 UTC
(rev 9530)
+++ trunk/freenet/src/freenet/keys/ClientCHK.java 2006-07-09 22:41:26 UTC
(rev 9531)
@@ -63,7 +63,7 @@
routingKey = uri.getRoutingKey();
cryptoKey = uri.getCryptoKey();
byte[] extra = uri.getExtra();
- if(extra == null || extra.length < 5)
+ if((extra == null) || (extra.length < 5))
throw new MalformedURLException();
cryptoAlgorithm = (short)(((extra[0] & 0xff) << 8) + (extra[1] &
0xff));
if(cryptoAlgorithm != Key.ALGO_AES_PCFB_256_SHA256)
Modified: trunk/freenet/src/freenet/keys/ClientCHKBlock.java
===================================================================
--- trunk/freenet/src/freenet/keys/ClientCHKBlock.java 2006-07-09 22:28:14 UTC
(rev 9530)
+++ trunk/freenet/src/freenet/keys/ClientCHKBlock.java 2006-07-09 22:41:26 UTC
(rev 9531)
@@ -115,7 +115,7 @@
throw new CHKDecodeException("Check failed: Decrypted IV ==
H(decryption key)");
// Checks complete
int size = ((hbuf[32] & 0xff) << 8) + (hbuf[33] & 0xff);
- if(size > 32768 || size < 0)
+ if((size > 32768) || (size < 0))
throw new CHKDecodeException("Invalid size: "+size);
byte[] output = new byte[size];
// No particular reason to check the padding, is there?
@@ -177,8 +177,8 @@
// IV = E(H(crypto key))
byte[] plainIV = md256.digest(encKey);
header = new byte[plainIV.length+2+2];
- header[0] = (byte)(CHKBlock.HASH_SHA256 >> 8);
- header[1] = (byte)(CHKBlock.HASH_SHA256 & 0xff);
+ header[0] = (byte)(KeyBlock.HASH_SHA256 >> 8);
+ header[1] = (byte)(KeyBlock.HASH_SHA256 & 0xff);
System.arraycopy(plainIV, 0, header, 2, plainIV.length);
header[plainIV.length+2] = (byte)(finalData.length >> 8);
header[plainIV.length+3] = (byte)(finalData.length & 0xff);
Modified: trunk/freenet/src/freenet/keys/ClientSSK.java
===================================================================
--- trunk/freenet/src/freenet/keys/ClientSSK.java 2006-07-09 22:28:14 UTC
(rev 9530)
+++ trunk/freenet/src/freenet/keys/ClientSSK.java 2006-07-09 22:41:26 UTC
(rev 9531)
@@ -74,7 +74,7 @@
}
public void setPublicKey(DSAPublicKey pubKey) {
- if(this.pubKey != null && this.pubKey != pubKey &&
!this.pubKey.equals(pubKey))
+ if((this.pubKey != null) && (this.pubKey != pubKey) &&
!this.pubKey.equals(pubKey))
throw new IllegalArgumentException("Cannot reassign:
was "+this.pubKey+" now "+pubKey);
this.pubKey = pubKey;
}
@@ -87,7 +87,7 @@
// 5 bytes.
byte[] extra = new byte[5];
- short cryptoAlgorithm = NodeSSK.ALGO_AES_PCFB_256_SHA256;
+ short cryptoAlgorithm = Key.ALGO_AES_PCFB_256_SHA256;
extra[0] = NodeSSK.SSK_VERSION;
extra[1] = (byte) (cryptoAlgorithm >> 8);
Modified: trunk/freenet/src/freenet/keys/FreenetURI.java
===================================================================
--- trunk/freenet/src/freenet/keys/FreenetURI.java 2006-07-09 22:28:14 UTC
(rev 9530)
+++ trunk/freenet/src/freenet/keys/FreenetURI.java 2006-07-09 22:41:26 UTC
(rev 9531)
@@ -101,16 +101,16 @@
if(keyType.equals("USK")) {
if(!(suggestedEdition == f.suggestedEdition))
return false;
}
- if(docName == null ^ f.docName == null) return false;
- if(metaStr == null ^ f.metaStr == null) return false;
- if(routingKey == null ^ f.routingKey == null) return
false;
- if(cryptoKey == null ^ f.cryptoKey == null) return
false;
- if(extra == null ^ f.extra == null) return false;
- if(docName != null && !docName.equals(f.docName))
return false;
- if(metaStr != null && !Arrays.equals(metaStr,
f.metaStr)) return false;
- if(routingKey != null && !Arrays.equals(routingKey,
f.routingKey)) return false;
- if(cryptoKey != null && !Arrays.equals(cryptoKey,
f.cryptoKey)) return false;
- if(extra != null && !Arrays.equals(extra, f.extra))
return false;
+ if((docName == null) ^ (f.docName == null)) return
false;
+ if((metaStr == null) ^ (f.metaStr == null)) return
false;
+ if((routingKey == null) ^ (f.routingKey == null))
return false;
+ if((cryptoKey == null) ^ (f.cryptoKey == null)) return
false;
+ if((extra == null) ^ (f.extra == null)) return false;
+ if((docName != null) && !docName.equals(f.docName))
return false;
+ if((metaStr != null) && !Arrays.equals(metaStr,
f.metaStr)) return false;
+ if((routingKey != null) && !Arrays.equals(routingKey,
f.routingKey)) return false;
+ if((cryptoKey != null) && !Arrays.equals(cryptoKey,
f.cryptoKey)) return false;
+ if((extra != null) && !Arrays.equals(extra, f.extra))
return false;
return true;
}
}
@@ -213,7 +213,7 @@
}
// check scheme
int colon = URI.indexOf(':');
- if (colon != -1
+ if ((colon != -1)
&& !URI.substring(0,
colon).equalsIgnoreCase("freenet")) {
throw new MalformedURLException("Invalid scheme for
Freenet URI");
}
@@ -354,7 +354,7 @@
}
public String getMetaString() {
- return (metaStr == null || metaStr.length == 0 ? null :
metaStr[0]);
+ return ((metaStr == null) || (metaStr.length == 0) ? null :
metaStr[0]);
}
public String[] getAllMetaStrings() {
@@ -382,7 +382,7 @@
*/
public FreenetURI popMetaString() {
String[] newMetaStr = null;
- if (metaStr != null && metaStr.length > 1) {
+ if ((metaStr != null) && (metaStr.length > 1)) {
newMetaStr = new String[metaStr.length - 1];
System.arraycopy(metaStr, 1, newMetaStr, 0,
newMetaStr.length);
}
@@ -568,7 +568,7 @@
byte[] routingKey = null;
byte[] cryptoKey = null;
byte[] extra = null;
- if(type == CHK || type == SSK) {
+ if((type == CHK) || (type == SSK)) {
// routingKey is a hash, so is exactly 32 bytes
routingKey = new byte[32];
dis.readFully(routingKey);
@@ -638,9 +638,9 @@
if(cryptoKey.length != 32)
throw new MalformedURLException("Crypto key
must be of length 32");
dos.write(cryptoKey);
- if(keyType.equals("CHK") && extra.length !=
ClientCHK.EXTRA_LENGTH)
+ if(keyType.equals("CHK") && (extra.length !=
ClientCHK.EXTRA_LENGTH))
throw new MalformedURLException("Wrong number
of extra bytes for CHK");
- if(keyType.equals("SSK") && extra.length !=
ClientSSK.EXTRA_LENGTH)
+ if(keyType.equals("SSK") && (extra.length !=
ClientSSK.EXTRA_LENGTH))
throw new MalformedURLException("Wrong number
of extra bytes for SSK");
dos.write(extra);
}
@@ -700,7 +700,7 @@
StringBuffer sb = new StringBuffer(s.length());
for(int i=0;i<s.length();i++) {
char c = s.charAt(i);
- if(c == '/' || c == '\\' || c == '%' || c == '>' || c
== '<' || c == ':' || c == '\'' || c == '\"')
+ if((c == '/') || (c == '\\') || (c == '%') || (c ==
'>') || (c == '<') || (c == ':') || (c == '\'') || (c == '\"'))
continue;
if(Character.isDigit(c))
sb.append(c);
@@ -708,7 +708,7 @@
sb.append(c);
else if(Character.isWhitespace(c))
sb.append(' ');
- else if(c == '-' || c == '_' || c == '.')
+ else if((c == '-') || (c == '_') || (c == '.'))
sb.append(c);
}
return sb.toString();
Modified: trunk/freenet/src/freenet/keys/InsertableClientSSK.java
===================================================================
--- trunk/freenet/src/freenet/keys/InsertableClientSSK.java 2006-07-09
22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/keys/InsertableClientSSK.java 2006-07-09
22:41:26 UTC (rev 9531)
@@ -37,7 +37,7 @@
return ClientKSK.create(uri);
if(!uri.getKeyType().equalsIgnoreCase("SSK"))
throw new MalformedURLException();
- if(uri.getDocName() == null || uri.getDocName().length() == 0)
+ if((uri.getDocName() == null) || (uri.getDocName().length() ==
0))
throw new MalformedURLException("SSK URIs must have a
document name (to avoid ambiguity)");
if(uri.getExtra() != null)
throw new MalformedURLException("Insertable SSK URIs
must NOT have ,extra - inserting from a pubkey rather than the privkey
perhaps?");
@@ -58,7 +58,7 @@
byte[] compressedData;
short compressionAlgo;
try {
- Compressed comp = Key.compress(sourceData,
dontCompress, alreadyCompressedCodec, sourceLength,
ClientSSKBlock.MAX_DECOMPRESSED_DATA_LENGTH, ClientSSKBlock.DATA_LENGTH, true);
+ Compressed comp = Key.compress(sourceData,
dontCompress, alreadyCompressedCodec, sourceLength,
ClientSSKBlock.MAX_DECOMPRESSED_DATA_LENGTH, SSKBlock.DATA_LENGTH, true);
compressedData = comp.compressedData;
compressionAlgo = comp.compressionAlgorithm;
} catch (KeyEncodeException e) {
@@ -74,17 +74,17 @@
}
byte[] data;
// First pad it
- if(compressedData.length != ClientSSKBlock.DATA_LENGTH) {
+ if(compressedData.length != SSKBlock.DATA_LENGTH) {
// Hash the data
if(compressedData.length != 0)
md256.update(compressedData);
byte[] digest = md256.digest();
MersenneTwister mt = new MersenneTwister(digest);
- data = new byte[ClientSSKBlock.DATA_LENGTH];
+ data = new byte[SSKBlock.DATA_LENGTH];
System.arraycopy(compressedData, 0, data, 0,
compressedData.length);
- byte[] randomBytes = new
byte[ClientSSKBlock.DATA_LENGTH-compressedData.length];
+ byte[] randomBytes = new
byte[SSKBlock.DATA_LENGTH-compressedData.length];
mt.nextBytes(randomBytes);
- System.arraycopy(randomBytes, 0, data, compressedData.length,
ClientSSKBlock.DATA_LENGTH-compressedData.length);
+ System.arraycopy(randomBytes, 0, data, compressedData.length,
SSKBlock.DATA_LENGTH-compressedData.length);
} else {
data = compressedData;
}
@@ -114,8 +114,8 @@
byte[] headers = new byte[SSKBlock.TOTAL_HEADERS_LENGTH];
// First two bytes = hash ID
int x = 0;
- headers[x++] = (byte) (ClientSSKBlock.HASH_SHA256 >> 8);
- headers[x++] = (byte) (ClientSSKBlock.HASH_SHA256);
+ headers[x++] = (byte) (KeyBlock.HASH_SHA256 >> 8);
+ headers[x++] = (byte) (KeyBlock.HASH_SHA256);
// Then crypto ID
headers[x++] = (byte) (Key.ALGO_AES_PCFB_256_SHA256 >> 8);
headers[x++] = (byte) (Key.ALGO_AES_PCFB_256_SHA256);
@@ -149,8 +149,8 @@
// Pack R and S into 32 bytes each, and copy to headers.
// Then create and return the ClientSSKBlock.
- byte[] rBuf = truncate(sig.getR().toByteArray(),
ClientSSKBlock.SIG_R_LENGTH);
- byte[] sBuf = truncate(sig.getS().toByteArray(),
ClientSSKBlock.SIG_S_LENGTH);
+ byte[] rBuf = truncate(sig.getR().toByteArray(),
SSKBlock.SIG_R_LENGTH);
+ byte[] sBuf = truncate(sig.getS().toByteArray(),
SSKBlock.SIG_S_LENGTH);
System.arraycopy(rBuf, 0, headers, x, rBuf.length);
x+=rBuf.length;
System.arraycopy(sBuf, 0, headers, x, sBuf.length);
Modified: trunk/freenet/src/freenet/keys/InsertableUSK.java
===================================================================
--- trunk/freenet/src/freenet/keys/InsertableUSK.java 2006-07-09 22:28:14 UTC
(rev 9530)
+++ trunk/freenet/src/freenet/keys/InsertableUSK.java 2006-07-09 22:41:26 UTC
(rev 9531)
@@ -29,7 +29,7 @@
public static InsertableUSK createInsertable(FreenetURI uri) throws
MalformedURLException {
if(!uri.getKeyType().equalsIgnoreCase("USK"))
throw new MalformedURLException();
- if(uri.getDocName() == null || uri.getDocName().length() == 0)
+ if((uri.getDocName() == null) || (uri.getDocName().length() ==
0))
throw new MalformedURLException("USK URIs must have a
document name (to avoid ambiguity)");
if(uri.getExtra() != null)
throw new MalformedURLException("Insertable SSK URIs
must NOT have ,extra - inserting from a pubkey rather than the privkey
perhaps?");
Modified: trunk/freenet/src/freenet/keys/Key.java
===================================================================
--- trunk/freenet/src/freenet/keys/Key.java 2006-07-09 22:28:14 UTC (rev
9530)
+++ trunk/freenet/src/freenet/keys/Key.java 2006-07-09 22:41:26 UTC (rev
9531)
@@ -136,7 +136,7 @@
// because compressing it improves its entropy.
if(sourceData.size() > MAX_LENGTH_BEFORE_COMPRESSION)
throw new KeyEncodeException("Too big");
- if((!dontCompress) || alreadyCompressedCodec >= 0) {
+ if((!dontCompress) || (alreadyCompressedCodec >= 0)) {
byte[] cbuf = null;
if(alreadyCompressedCodec >= 0) {
if(sourceData.size() > MAX_COMPRESSED_DATA_LENGTH)
Modified: trunk/freenet/src/freenet/keys/NodeSSK.java
===================================================================
--- trunk/freenet/src/freenet/keys/NodeSSK.java 2006-07-09 22:28:14 UTC (rev
9530)
+++ trunk/freenet/src/freenet/keys/NodeSSK.java 2006-07-09 22:41:26 UTC (rev
9531)
@@ -130,7 +130,7 @@
public void setPubKey(DSAPublicKey pubKey2) throws SSKVerifyException {
if(pubKey == pubKey2) return;
if(pubKey2 == null) return;
- if(pubKey == null || !pubKey2.equals(pubKey)) {
+ if((pubKey == null) || !pubKey2.equals(pubKey)) {
if(pubKey2 != null) {
MessageDigest md256;
try {
Modified: trunk/freenet/src/freenet/keys/USK.java
===================================================================
--- trunk/freenet/src/freenet/keys/USK.java 2006-07-09 22:28:14 UTC (rev
9530)
+++ trunk/freenet/src/freenet/keys/USK.java 2006-07-09 22:41:26 UTC (rev
9531)
@@ -103,7 +103,7 @@
if(!Arrays.equals(pubKeyHash, u.pubKeyHash)) return
false;
if(!Arrays.equals(cryptoKey, u.cryptoKey)) return false;
if(!siteName.equals(u.siteName)) return false;
- if(includeVersion && suggestedEdition !=
u.suggestedEdition) return false;
+ if(includeVersion && (suggestedEdition !=
u.suggestedEdition)) return false;
return true;
}
return false;
Modified: trunk/freenet/src/freenet/node/ARKFetcher.java
===================================================================
--- trunk/freenet/src/freenet/node/ARKFetcher.java 2006-07-09 22:28:14 UTC
(rev 9530)
+++ trunk/freenet/src/freenet/node/ARKFetcher.java 2006-07-09 22:41:26 UTC
(rev 9531)
@@ -196,7 +196,7 @@
queueWithBackoff();
return;
}
- Logger.minor(this, "Failed to fetch ARK for "+peer.getPeer()+",
now backing off ARK fetches for "+(int) (backoff / 1000)+" seconds");
+ Logger.minor(this, "Failed to fetch ARK for "+peer.getPeer()+",
now backing off ARK fetches for "+(backoff / 1000)+" seconds");
// We may be on the PacketSender thread.
// FIXME should this be exponential backoff?
queueWithBackoff();
Modified: trunk/freenet/src/freenet/node/CHKInsertSender.java
===================================================================
--- trunk/freenet/src/freenet/node/CHKInsertSender.java 2006-07-09 22:28:14 UTC
(rev 9530)
+++ trunk/freenet/src/freenet/node/CHKInsertSender.java 2006-07-09 22:41:26 UTC
(rev 9531)
@@ -282,7 +282,7 @@
* followed by an Accepted. So we must loop here.
*/
- while (msg==null || (msg.getSpec() != DMT.FNPAccepted)) {
+ while ((msg==null) || (msg.getSpec() != DMT.FNPAccepted)) {
try {
msg = node.usm.waitFor(mf, this);
@@ -333,7 +333,7 @@
// Otherwise is an FNPAccepted
}
- if(msg == null || msg.getSpec() != DMT.FNPAccepted) continue;
+ if((msg == null) || (msg.getSpec() != DMT.FNPAccepted)) continue;
Logger.minor(this, "Got Accepted on "+this);
@@ -396,7 +396,7 @@
if (receiveFailed)
return;
- if (msg == null || msg.getSpec() ==
DMT.FNPRejectedTimeout) {
+ if ((msg == null) || (msg.getSpec() ==
DMT.FNPRejectedTimeout)) {
// Timeout :(
// Fairly serious problem
Logger.error(this, "Timeout (" + msg
@@ -527,7 +527,7 @@
setStatusTime = System.currentTimeMillis();
- if(code == ROUTE_NOT_FOUND && !sentRequest)
+ if((code == ROUTE_NOT_FOUND) && !sentRequest)
code = ROUTE_REALLY_NOT_FOUND;
status = code;
@@ -554,8 +554,8 @@
notifyAll();
}
- if(code != TIMED_OUT && code != GENERATED_REJECTED_OVERLOAD && code !=
INTERNAL_ERROR
- && code != ROUTE_REALLY_NOT_FOUND) {
+ if((code != TIMED_OUT) && (code != GENERATED_REJECTED_OVERLOAD) &&
(code != INTERNAL_ERROR)
+ && (code != ROUTE_REALLY_NOT_FOUND)) {
Logger.minor(this, "CHK insert cost
"+getTotalSentBytes()+"/"+getTotalReceivedBytes()+" bytes ("+code+")");
(source == null ? node.localChkInsertBytesSentAverage :
node.remoteChkInsertBytesSentAverage)
.report(getTotalSentBytes());
@@ -638,7 +638,7 @@
synchronized(this) {
long now = System.currentTimeMillis();
- if(status == NOT_FINISHED || setStatusTime ==
-1) {
+ if((status == NOT_FINISHED) || (setStatusTime
== -1)) {
// Wait 5 seconds, then try again
timeout = 5000;
} else {
Modified: trunk/freenet/src/freenet/node/FNPPacketMangler.java
===================================================================
--- trunk/freenet/src/freenet/node/FNPPacketMangler.java 2006-07-09
22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/node/FNPPacketMangler.java 2006-07-09
22:41:26 UTC (rev 9531)
@@ -126,7 +126,7 @@
if(tryProcessAuth(buf, offset, length, pn, peer)) return;
}
}
- if(opn != null && !opn.isConnected())
+ if((opn != null) && !opn.isConnected())
Logger.minor(this,"Unmatchable packet from "+peer);
else
Logger.error(this,"Unmatchable packet from "+peer);
@@ -212,7 +212,7 @@
return;
}
int packetType = payload[2];
- if(packetType < 0 || packetType > 3) {
+ if((packetType < 0) || (packetType > 3)) {
Logger.error(this, "Decrypted auth packet but unknown packet type
"+packetType+" from "+replyTo+" possibly from "+pn);
return;
}
@@ -318,7 +318,7 @@
int targetLength = DiffieHellman.modulusLengthInBytes();
if(data.length != targetLength) {
byte[] newData = new byte[targetLength];
- if(data.length == targetLength+1 && data[0] == 0) {
+ if((data.length == targetLength+1) && (data[0] == 0)) {
// Sign bit
System.arraycopy(data, 1, newData, 0, targetLength);
} else if(data.length < targetLength) {
@@ -406,7 +406,7 @@
*/
private DiffieHellmanContext processDHTwoOrThree(int i, byte[] payload,
PeerNode pn, Peer replyTo, boolean sendCompletion) {
DiffieHellmanContext ctx = pn.getDHContext();
- if(ctx == null || !ctx.canGetCipher()) {
+ if((ctx == null) || !ctx.canGetCipher()) {
if(shouldLogErrorInHandshake()) {
Logger.error(this, "Cannot get cipher");
}
@@ -473,7 +473,7 @@
*/
private DiffieHellmanContext processDHZeroOrOne(int phase, byte[] payload,
PeerNode pn) {
- if(phase == 0 && pn.hasLiveHandshake(System.currentTimeMillis())) {
+ if((phase == 0) && pn.hasLiveHandshake(System.currentTimeMillis())) {
Logger.minor(this, "Rejecting phase "+phase+" handshake on "+pn+"
- already running one");
return null;
}
@@ -582,7 +582,7 @@
} else {
// Now is it credible?
// As long as it's within +/- 256, this is valid.
- if(targetSeqNumber != -1 && Math.abs(targetSeqNumber - seqNumber)
> MAX_PACKETS_IN_FLIGHT)
+ if((targetSeqNumber != -1) && (Math.abs(targetSeqNumber -
seqNumber) > MAX_PACKETS_IN_FLIGHT))
return false;
}
Logger.minor(this, "Sequence number received: "+seqNumber);
@@ -618,7 +618,7 @@
// Verify
tracker.pn.verified(tracker);
- if(seqNumber != -1 && tracker.alreadyReceived(seqNumber)) {
+ if((seqNumber != -1) && tracker.alreadyReceived(seqNumber)) {
tracker.queueAck(seqNumber);
Logger.normal(this, "Received packet twice from
"+tracker.pn.getPeer()+": "+seqNumber);
return true;
@@ -888,8 +888,8 @@
}
if(x != callbacksCount) throw new IllegalStateException();
- if(length < node.usm.getMaxPacketSize() &&
- messageData.length < 256) {
+ if((length < node.usm.getMaxPacketSize()) &&
+ (messageData.length < 256)) {
try {
innerProcessOutgoing(messageData, 0, messageData.length,
length, pn, neverWaitForPacketNumber, callbacks, alreadyReportedBytes);
for(int i=0;i<messageData.length;i++) {
@@ -935,7 +935,7 @@
// Send the last lot, then send this
}
count++;
- if(newLength > node.usm.getMaxPacketSize() || count > 255 || i
== messages.length) {
+ if((newLength > node.usm.getMaxPacketSize()) || (count > 255)
|| (i == messages.length)) {
// lastIndex up to the message right before this one
// e.g. lastIndex = 0, i = 1, we just send message 0
if(lastIndex != i) {
@@ -1126,7 +1126,7 @@
else log += (""+callbacks.length+(callbacks.length >= 1 ?
String.valueOf(callbacks[0]) : ""));
Logger.minor(this, log);
}
- if(tracker == null || (!tracker.pn.isConnected())) {
+ if((tracker == null) || (!tracker.pn.isConnected())) {
throw new NotConnectedException();
}
@@ -1214,7 +1214,7 @@
int ackSeq = acks[i];
Logger.minor(this, "Acking "+ackSeq);
int offsetSeq = otherSideSeqNumber - ackSeq;
- if(offsetSeq > 255 || offsetSeq < 0)
+ if((offsetSeq > 255) || (offsetSeq < 0))
throw new PacketSequenceException("bad ack offset "+offsetSeq+
" - seqNumber="+otherSideSeqNumber+",
ackNumber="+ackSeq+" talking to "+tracker.pn.getPeer());
plaintext[ptr++] = (byte)offsetSeq;
@@ -1225,7 +1225,7 @@
int reqSeq = resendRequests[i];
Logger.minor(this, "Resend req: "+reqSeq);
int offsetSeq = otherSideSeqNumber - reqSeq;
- if(offsetSeq > 255 || offsetSeq < 0)
+ if((offsetSeq > 255) || (offsetSeq < 0))
throw new PacketSequenceException("bad resend request offset
"+offsetSeq+
" - reqSeq="+reqSeq+",
otherSideSeqNumber="+otherSideSeqNumber+" talking to "+tracker.pn.getPeer());
plaintext[ptr++] = (byte)offsetSeq;
@@ -1239,7 +1239,7 @@
// Relative to packetNumber - we are asking them to ack
// a packet we sent to them.
int offsetSeq = realSeqNumber - ackReqSeq;
- if(offsetSeq > 255 || offsetSeq < 0)
+ if((offsetSeq > 255) || (offsetSeq < 0))
throw new PacketSequenceException("bad ack requests offset:
"+offsetSeq+
" - ackReqSeq="+ackReqSeq+",
packetNumber="+realSeqNumber+" talking to "+tracker.pn.getPeer());
plaintext[ptr++] = (byte)offsetSeq;
Modified: trunk/freenet/src/freenet/node/IPDetectorPluginManager.java
===================================================================
--- trunk/freenet/src/freenet/node/IPDetectorPluginManager.java 2006-07-09
22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/node/IPDetectorPluginManager.java 2006-07-09
22:41:26 UTC (rev 9531)
@@ -148,12 +148,12 @@
HashSet addressesConnected = null;
for(int i=0;i<peers.length;i++) {
PeerNode p = peers[i];
- if(p.isConnected() || now -
p.lastReceivedPacketTime() < 24*60*60*1000) {
+ if(p.isConnected() || (now -
p.lastReceivedPacketTime() < 24*60*60*1000)) {
// Has been connected in the
last 24 hours.
// Unique IP address?
Peer peer = p.getPeer();
InetAddress addr =
peer.getAddress(false);
- if(p.isConnected() && peer !=
null && addr != null && IPUtil.checkAddress(peer.getAddress())) {
+ if(p.isConnected() && (peer !=
null) && (addr != null) && IPUtil.checkAddress(peer.getAddress())) {
// Connected node, on a
real internet IP address.
// Is it internal?
boolean internal =
false;
@@ -178,7 +178,7 @@
}
}
long l = p.getPeerAddedTime();
- if(l <= 0 || now - l < 30*60*1000) {
+ if((l <= 0) || (now - l < 30*60*1000)) {
// Less than 30 minutes old,
don't run a detection yet as
// it is likely we are simply
directly connected. (But we do
// want it to work out of the
box if we are not!).
@@ -242,7 +242,7 @@
if(!node.hasDirectlyDetectedIP()) {
- if(conns.length > 0 && conns.length <
3) {
+ if((conns.length > 0) && (conns.length
< 3)) {
// No locally detected IP, only
one or two connections.
// Have we had more relatively
recently?
int count = 0;
@@ -250,7 +250,7 @@
if(firstTimeMaybeFakePeers > 0)
timeref = firstTimeMaybeFakePeers;
for(int i=0;i<peers.length;i++)
{
PeerNode p = peers[i];
- if((!p.isConnected())
|| now - p.lastReceivedPacketTime() < 5*60*1000) {
+ if((!p.isConnected())
|| (now - p.lastReceivedPacketTime() < 5*60*1000)) {
// Not
connected now but has been within the past 5 minutes.
count++;
}
@@ -338,7 +338,7 @@
failed = true;
for(int i=0;i<v.size();i++) {
DetectedIP ip = (DetectedIP)
v.get(i);
- if(!(ip.publicAddress == null
|| !IPUtil.checkAddress(ip.publicAddress))) {
+ if(!((ip.publicAddress == null)
|| !IPUtil.checkAddress(ip.publicAddress))) {
Logger.minor(this,
"Address checked out");
failed = false;
}
Modified: trunk/freenet/src/freenet/node/InsertHandler.java
===================================================================
--- trunk/freenet/src/freenet/node/InsertHandler.java 2006-07-09 22:28:14 UTC
(rev 9530)
+++ trunk/freenet/src/freenet/node/InsertHandler.java 2006-07-09 22:41:26 UTC
(rev 9531)
@@ -103,7 +103,7 @@
if(msg == null) {
try {
- if(source.isConnected() && startTime >
(source.timeLastConnected()+Node.HANDSHAKE_TIMEOUT*4))
+ if(source.isConnected() && (startTime >
(source.timeLastConnected()+Node.HANDSHAKE_TIMEOUT*4)))
Logger.error(this, "Did not receive DataInsert
on "+uid+" from "+source+" !");
Message tooSlow = DMT.createFNPRejectedTimeout(uid);
source.sendAsync(tooSlow, null, 0, null);
@@ -220,9 +220,9 @@
// Local RejectedOverload's (fatal).
// Internal error counts as overload. It'd only create a timeout
otherwise, which is the same thing anyway.
// We *really* need a good way to deal with nodes that constantly
R_O!
- if(status == CHKInsertSender.TIMED_OUT ||
- status == CHKInsertSender.GENERATED_REJECTED_OVERLOAD ||
- status == CHKInsertSender.INTERNAL_ERROR) {
+ if((status == CHKInsertSender.TIMED_OUT) ||
+ (status == CHKInsertSender.GENERATED_REJECTED_OVERLOAD)
||
+ (status == CHKInsertSender.INTERNAL_ERROR)) {
msg = DMT.createFNPRejectedOverload(uid, true);
try {
source.send(msg, null);
@@ -231,14 +231,14 @@
return;
}
// Might as well store it anyway.
- if(status == CHKInsertSender.TIMED_OUT ||
- status ==
CHKInsertSender.GENERATED_REJECTED_OVERLOAD)
+ if((status == CHKInsertSender.TIMED_OUT) ||
+ (status ==
CHKInsertSender.GENERATED_REJECTED_OVERLOAD))
canCommit = true;
finish();
return;
}
- if(status == CHKInsertSender.ROUTE_NOT_FOUND || status ==
CHKInsertSender.ROUTE_REALLY_NOT_FOUND) {
+ if((status == CHKInsertSender.ROUTE_NOT_FOUND) || (status ==
CHKInsertSender.ROUTE_REALLY_NOT_FOUND)) {
msg = DMT.createFNPRouteNotFound(uid, sender.getHTL());
try {
source.send(msg, null);
@@ -327,7 +327,7 @@
Message toSend = null;
synchronized(this) { // REDFLAG do not use synch(this) for any other
purpose!
- if(prb == null || prb.isAborted()) return;
+ if((prb == null) || prb.isAborted()) return;
try {
if(!canCommit) return;
if(!prb.allReceived()) return;
Modified: trunk/freenet/src/freenet/node/KeyTracker.java
===================================================================
--- trunk/freenet/src/freenet/node/KeyTracker.java 2006-07-09 22:28:14 UTC
(rev 9530)
+++ trunk/freenet/src/freenet/node/KeyTracker.java 2006-07-09 22:41:26 UTC
(rev 9531)
@@ -390,7 +390,7 @@
}
if(seqNumber > max) {
try {
- if(max != -1 && seqNumber - max > 1) {
+ if((max != -1) && (seqNumber - max > 1)) {
Logger.minor(this, "Queueing resends from "+max+" to
"+seqNumber);
// Missed some packets out
for(int i=max+1;i<seqNumber;i++) {
Modified: trunk/freenet/src/freenet/node/Location.java
===================================================================
--- trunk/freenet/src/freenet/node/Location.java 2006-07-09 22:28:14 UTC
(rev 9530)
+++ trunk/freenet/src/freenet/node/Location.java 2006-07-09 22:41:26 UTC
(rev 9531)
@@ -36,7 +36,7 @@
}
public void setValue(double newLoc) {
- if(loc < 0.0 || loc > 1.0)
+ if((loc < 0.0) || (loc > 1.0))
throw new IllegalArgumentException();
this.loc = newLoc;
long l = Double.doubleToLongBits(newLoc);
Modified: trunk/freenet/src/freenet/node/LocationManager.java
===================================================================
--- trunk/freenet/src/freenet/node/LocationManager.java 2006-07-09 22:28:14 UTC
(rev 9530)
+++ trunk/freenet/src/freenet/node/LocationManager.java 2006-07-09 22:41:26 UTC
(rev 9531)
@@ -253,7 +253,7 @@
byte[] hisBuf =
((ShortBuffer)commit.getObject(DMT.DATA)).getData();
- if(hisBuf.length % 8 != 0 || hisBuf.length < 16) {
+ if((hisBuf.length % 8 != 0) || (hisBuf.length < 16)) {
Logger.error(this, "Bad content length in SwapComplete -
malicious node? on "+uid);
return;
}
@@ -274,7 +274,7 @@
long hisRandom = hisBufLong[0];
double hisLoc = Double.longBitsToDouble(hisBufLong[1]);
- if(hisLoc < 0.0 || hisLoc > 1.0) {
+ if((hisLoc < 0.0) || (hisLoc > 1.0)) {
Logger.error(this, "Bad loc: "+hisLoc+" on "+uid);
return;
}
@@ -283,7 +283,7 @@
double[] hisFriendLocs = new double[hisBufLong.length-2];
for(int i=0;i<hisFriendLocs.length;i++) {
hisFriendLocs[i] = Double.longBitsToDouble(hisBufLong[i+2]);
- if(hisFriendLocs[i] < 0.0 || hisFriendLocs[i] > 1.0) {
+ if((hisFriendLocs[i] < 0.0) || (hisFriendLocs[i] > 1.0)) {
Logger.error(this, "Bad friend loc: "+hisFriendLocs[i]+"
on "+uid);
return;
}
@@ -386,7 +386,7 @@
}
if(reply == null) {
- if(pn.isConnected() && System.currentTimeMillis() -
pn.timeLastConnected() > TIMEOUT*2) {
+ if(pn.isConnected() && (System.currentTimeMillis() -
pn.timeLastConnected() > TIMEOUT*2)) {
// Timed out! Abort...
Logger.error(this, "Timed out waiting for
SwapRejected/SwapReply on "+uid);
}
@@ -421,7 +421,7 @@
}
if(reply == null) {
- if(pn.isConnected() && System.currentTimeMillis() -
pn.timeLastConnected() > TIMEOUT*2) {
+ if(pn.isConnected() && (System.currentTimeMillis() -
pn.timeLastConnected() > TIMEOUT*2)) {
// Hrrrm!
Logger.error(this, "Timed out waiting for SwapComplete
- malicious node?? on "+uid);
}
@@ -435,7 +435,7 @@
byte[] hisBuf =
((ShortBuffer)reply.getObject(DMT.DATA)).getData();
- if(hisBuf.length % 8 != 0 || hisBuf.length < 16) {
+ if((hisBuf.length % 8 != 0) || (hisBuf.length < 16)) {
Logger.error(this, "Bad content length in SwapComplete -
malicious node? on "+uid);
return;
}
@@ -456,7 +456,7 @@
long hisRandom = hisBufLong[0];
double hisLoc = Double.longBitsToDouble(hisBufLong[1]);
- if(hisLoc < 0.0 || hisLoc > 1.0) {
+ if((hisLoc < 0.0) || (hisLoc > 1.0)) {
Logger.error(this, "Bad loc: "+hisLoc+" on "+uid);
return;
}
@@ -465,7 +465,7 @@
double[] hisFriendLocs = new double[hisBufLong.length-2];
for(int i=0;i<hisFriendLocs.length;i++) {
hisFriendLocs[i] =
Double.longBitsToDouble(hisBufLong[i+2]);
- if(hisFriendLocs[i] < 0.0 || hisFriendLocs[i] > 1.0) {
+ if((hisFriendLocs[i] < 0.0) || (hisFriendLocs[i] > 1.0)) {
Logger.error(this, "Bad friend loc:
"+hisFriendLocs[i]+" on "+uid);
return;
}
Modified: trunk/freenet/src/freenet/node/LoggingConfigHandler.java
===================================================================
--- trunk/freenet/src/freenet/node/LoggingConfigHandler.java 2006-07-09
22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/node/LoggingConfigHandler.java 2006-07-09
22:41:26 UTC (rev 9531)
@@ -272,7 +272,7 @@
for(int i=0;i<files.length;i++) {
File f = files[i];
String s = f.getName();
- if(s.startsWith("freenet-") &&
s.indexOf(".log") != -1) {
+ if(s.startsWith("freenet-") &&
(s.indexOf(".log") != -1)) {
if(f.isFile()) {
if(!f.delete()) failed = true;
} else if(f.isDirectory()) {
Modified: trunk/freenet/src/freenet/node/Node.java
===================================================================
--- trunk/freenet/src/freenet/node/Node.java 2006-07-09 22:28:14 UTC (rev
9530)
+++ trunk/freenet/src/freenet/node/Node.java 2006-07-09 22:41:26 UTC (rev
9531)
@@ -704,7 +704,7 @@
br.close();
// Read contents
String[] udp = fs.getAll("physical.udp");
- if(udp != null && udp.length > 0) {
+ if((udp != null) && (udp.length > 0)) {
// Just keep the first one.
Peer myOldPeer;
try {
@@ -1309,7 +1309,7 @@
logConfigHandler.forceEnableLogging();
}
int x = Logger.globalGetThreshold();
- if(!(x == Logger.MINOR || x == Logger.DEBUG)) {
+ if(!((x == Logger.MINOR) || (x == Logger.DEBUG))) {
System.err.println("Forcing log threshold to
MINOR for testnet, was "+x);
Logger.globalSetThreshold(Logger.MINOR);
}
@@ -1446,7 +1446,7 @@
}
public void set(long storeSize) throws
InvalidConfigValueException {
- if(storeSize < 0 || storeSize <
(32 * 1024 * 1024))
+ if((storeSize < 0) ||
(storeSize < (32 * 1024 * 1024)))
throw new
InvalidConfigValueException("Invalid store size");
long newMaxStoreKeys =
storeSize / sizePerKey;
if(newMaxStoreKeys ==
maxStoreKeys) return;
@@ -1500,7 +1500,7 @@
System.out.println("Initializing CHK Datastore
("+maxStoreKeys+" keys)");
BerkeleyDBFreenetStore tmp;
try {
- if(lastVersion > 0 && lastVersion < 852) {
+ if((lastVersion > 0) && (lastVersion < 852)) {
throw new
DatabaseException("Reconstructing store because started from old version");
}
tmp = new
BerkeleyDBFreenetStore(storeDir.getPath()+File.separator+"store-"+portNumber,
maxStoreKeys, 32768, CHKBlock.TOTAL_HEADERS_LENGTH, true);
@@ -1515,7 +1515,7 @@
Logger.normal(this, "Initializing pubKey Datastore");
System.out.println("Initializing pubKey Datastore");
try {
- if(lastVersion > 0 && lastVersion < 852) {
+ if((lastVersion > 0) && (lastVersion < 852)) {
throw new
DatabaseException("Reconstructing store because started from old version");
}
tmp = new
BerkeleyDBFreenetStore(storeDir.getPath()+File.separator+"pubkeystore-"+portNumber,
maxStoreKeys, DSAPublicKey.PADDED_SIZE, 0, true);
@@ -1774,7 +1774,7 @@
// If we are using the wrapper, we ignore:
// Any problem should be detected by the watchdog and the node
will be restarted
if(osName.equals("Linux") && jvmVendor.startsWith("Sun ") &&
- (osVersion.indexOf("nptl")!=-1 ||
osVersion.startsWith("2.6") ||
+ ((osVersion.indexOf("nptl")!=-1) ||
osVersion.startsWith("2.6") ||
osVersion.startsWith("2.7") ||
osVersion.startsWith("3."))
&& !isUsingWrapper()) {
// Hopefully we won't still have to deal with this ****
when THAT comes out!
@@ -1788,7 +1788,7 @@
assumeKernel = null;
assumeKernel =
WrapperManager.getProperties().getProperty("set.LD_ASSUME_KERNEL");
}
- if(assumeKernel == null || assumeKernel.length() == 0
|| (!(assumeKernel.startsWith("2.2") || assumeKernel.startsWith("2.4")))) {
+ if((assumeKernel == null) || (assumeKernel.length() ==
0) || (!(assumeKernel.startsWith("2.2") || assumeKernel.startsWith("2.4")))) {
System.err.println(ERROR_SUN_NPTL);
Logger.error(this, ERROR_SUN_NPTL);
this.alerts.register(new UserAlert() {
@@ -1880,18 +1880,18 @@
if(status == RequestSender.NOT_FINISHED)
continue;
- if(status == RequestSender.TIMED_OUT ||
- status ==
RequestSender.GENERATED_REJECTED_OVERLOAD) {
+ if((status == RequestSender.TIMED_OUT) ||
+ (status ==
RequestSender.GENERATED_REJECTED_OVERLOAD)) {
if(!rejectedOverload) {
// See below
throttleWindow.rejectedOverload();
rejectedOverload = true;
}
} else {
- if(status == RequestSender.DATA_NOT_FOUND ||
- status == RequestSender.SUCCESS
||
- status ==
RequestSender.ROUTE_NOT_FOUND ||
- status ==
RequestSender.VERIFY_FAILURE) {
+ if((status == RequestSender.DATA_NOT_FOUND) ||
+ (status ==
RequestSender.SUCCESS) ||
+ (status ==
RequestSender.ROUTE_NOT_FOUND) ||
+ (status ==
RequestSender.VERIFY_FAILURE)) {
long rtt = System.currentTimeMillis() -
startTime;
if(!rejectedOverload)
throttleWindow.requestCompleted();
@@ -1969,17 +1969,17 @@
if(status == RequestSender.NOT_FINISHED)
continue;
- if(status == RequestSender.TIMED_OUT ||
- status ==
RequestSender.GENERATED_REJECTED_OVERLOAD) {
+ if((status == RequestSender.TIMED_OUT) ||
+ (status ==
RequestSender.GENERATED_REJECTED_OVERLOAD)) {
if(!rejectedOverload) {
throttleWindow.rejectedOverload();
rejectedOverload = true;
}
} else {
- if(status == RequestSender.DATA_NOT_FOUND ||
- status == RequestSender.SUCCESS
||
- status ==
RequestSender.ROUTE_NOT_FOUND ||
- status ==
RequestSender.VERIFY_FAILURE) {
+ if((status == RequestSender.DATA_NOT_FOUND) ||
+ (status ==
RequestSender.SUCCESS) ||
+ (status ==
RequestSender.ROUTE_NOT_FOUND) ||
+ (status ==
RequestSender.VERIFY_FAILURE)) {
long rtt = System.currentTimeMillis() -
startTime;
if(!rejectedOverload)
@@ -2092,8 +2092,8 @@
// Finished?
if(!hasReceivedRejectedOverload) {
// Is it ours? Did we send a request?
- if(is.sentRequest() && is.uid == uid && (is.getStatus()
== CHKInsertSender.ROUTE_NOT_FOUND
- || is.getStatus() ==
CHKInsertSender.SUCCESS)) {
+ if(is.sentRequest() && (is.uid == uid) &&
((is.getStatus() == CHKInsertSender.ROUTE_NOT_FOUND)
+ || (is.getStatus() ==
CHKInsertSender.SUCCESS))) {
// It worked!
long endTime = System.currentTimeMillis();
long len = endTime - startTime;
@@ -2191,8 +2191,8 @@
// Finished?
if(!hasReceivedRejectedOverload) {
// Is it ours? Did we send a request?
- if(is.sentRequest() && is.uid == uid && (is.getStatus()
== SSKInsertSender.ROUTE_NOT_FOUND
- || is.getStatus() ==
SSKInsertSender.SUCCESS)) {
+ if(is.sentRequest() && (is.uid == uid) &&
((is.getStatus() == SSKInsertSender.ROUTE_NOT_FOUND)
+ || (is.getStatus() ==
SSKInsertSender.SUCCESS))) {
// It worked!
long endTime = System.currentTimeMillis();
long rtt = endTime - startTime;
@@ -2289,7 +2289,7 @@
// Round trip time
double pingTime = nodePinger.averagePingTime();
if(pingTime > MAX_PING_TIME) {
- if(now - lastAcceptedRequest > MAX_INTERREQUEST_TIME &&
canAcceptAnyway) {
+ if((now - lastAcceptedRequest > MAX_INTERREQUEST_TIME)
&& canAcceptAnyway) {
Logger.minor(this, "Accepting request anyway
(take one every 10 secs to keep bwlimitDelayTime updated)");
lastAcceptedRequest = now;
return null;
@@ -2307,7 +2307,7 @@
Logger.minor(this, "bwlimitDelayTime = "+bwlimitDelayTime);
if(bwlimitDelayTime > MAX_THROTTLE_DELAY) {
- if(now - lastAcceptedRequest > MAX_INTERREQUEST_TIME &&
canAcceptAnyway) {
+ if((now - lastAcceptedRequest > MAX_INTERREQUEST_TIME)
&& canAcceptAnyway) {
Logger.minor(this, "Accepting request anyway
(take one every 10 secs to keep bwlimitDelayTime updated)");
lastAcceptedRequest = now;
return null;
@@ -2402,7 +2402,7 @@
if(!addresses.contains(a))
addresses.add(a);
}
- if(pluginDetectedIPs != null && pluginDetectedIPs.length > 0) {
+ if((pluginDetectedIPs != null) && (pluginDetectedIPs.length >
0)) {
for(int i=0;i<pluginDetectedIPs.length;i++) {
InetAddress addr =
pluginDetectedIPs[i].publicAddress;
if(addr == null) continue;
@@ -2411,7 +2411,7 @@
addresses.add(a);
}
}
- if(detectedAddr == null && oldIPAddress != null &&
!oldIPAddress.equals(overrideIPAddress))
+ if((detectedAddr == null) && (oldIPAddress != null) &&
!oldIPAddress.equals(overrideIPAddress))
addresses.add(new Peer(oldIPAddress, portNumber));
// Try to pick it up from our connections
if(peers != null) {
@@ -2420,7 +2420,7 @@
// FIXME use a standard mutable int object, we have one
somewhere
for(int i=0;i<peerList.length;i++) {
Peer p = peerList[i].getRemoteDetectedPeer();
- if(p == null || p.isNull()) continue;
+ if((p == null) || p.isNull()) continue;
// DNSRequester doesn't deal with our own node
InetAddress ip = p.getAddress(true);
if(!IPUtil.checkAddress(ip)) continue;
@@ -2454,10 +2454,10 @@
}
}
if(best != null) {
- if(bestPopularity > 2 || detectedAddr
== null) {
+ if((bestPopularity > 2) ||
(detectedAddr == null)) {
if(!addresses.contains(best))
addresses.add(best);
- if(secondBest != null &&
secondBestPopularity > 2) {
+ if((secondBest != null) &&
(secondBestPopularity > 2)) {
if(!addresses.contains(secondBest))
addresses.add(secondBest);
}
@@ -2599,7 +2599,7 @@
public boolean equals(Object o) {
if(o instanceof KeyHTLPair) {
KeyHTLPair p = (KeyHTLPair) o;
- return (p.key.equals(key) && p.htl == htl);
+ return (p.key.equals(key) && (p.htl == htl));
} else return false;
}
@@ -2854,7 +2854,7 @@
synchronized(insertSenders) {
int x = getNumInserts();
sb.append(x);
- if(x < 5 && x > 0) {
+ if((x < 5) && (x > 0)) {
sb.append('\n');
// Dump
Iterator i = insertSenders.values().iterator();
@@ -3044,7 +3044,7 @@
ImmutableByteArrayWrapper w = new
ImmutableByteArrayWrapper(hash);
synchronized(cachedPubKeys) {
DSAPublicKey key2 = (DSAPublicKey) cachedPubKeys.get(w);
- if(key2 != null && !key2.equals(key)) {
+ if((key2 != null) && !key2.equals(key)) {
MessageDigest md256;
// Check the hash.
try {
@@ -3510,7 +3510,7 @@
} else {
firstBwlimitDelayTimeThresholdBreak = 0;
}
- if(firstBwlimitDelayTimeThresholdBreak != 0 && (now -
firstBwlimitDelayTimeThresholdBreak) >= MAX_BWLIMIT_DELAY_TIME_ALERT_DELAY) {
+ if((firstBwlimitDelayTimeThresholdBreak != 0) && ((now
- firstBwlimitDelayTimeThresholdBreak) >= MAX_BWLIMIT_DELAY_TIME_ALERT_DELAY)) {
bwlimitDelayAlertRelevant = true;
} else {
bwlimitDelayAlertRelevant = false;
@@ -3522,7 +3522,7 @@
} else {
firstNodeAveragePingTimeThresholdBreak = 0;
}
- if(firstNodeAveragePingTimeThresholdBreak != 0 && (now
- firstNodeAveragePingTimeThresholdBreak) >=
MAX_NODE_AVERAGE_PING_TIME_ALERT_DELAY) {
+ if((firstNodeAveragePingTimeThresholdBreak != 0) &&
((now - firstNodeAveragePingTimeThresholdBreak) >=
MAX_NODE_AVERAGE_PING_TIME_ALERT_DELAY)) {
nodeAveragePingAlertRelevant = true;
} else {
nodeAveragePingAlertRelevant = false;
Modified: trunk/freenet/src/freenet/node/NodeDispatcher.java
===================================================================
--- trunk/freenet/src/freenet/node/NodeDispatcher.java 2006-07-09 22:28:14 UTC
(rev 9530)
+++ trunk/freenet/src/freenet/node/NodeDispatcher.java 2006-07-09 22:41:26 UTC
(rev 9531)
@@ -256,7 +256,7 @@
*/
boolean handleRouted(Message m) {
Logger.minor(this, "handleRouted("+m+")");
- if(m.getSource() != null && (!(m.getSource() instanceof PeerNode))) {
+ if((m.getSource() != null) && (!(m.getSource() instanceof PeerNode))) {
Logger.error(this, "Routed message but source "+m.getSource()+"
not a PeerNode!");
return true;
}
Modified: trunk/freenet/src/freenet/node/PacketSender.java
===================================================================
--- trunk/freenet/src/freenet/node/PacketSender.java 2006-07-09 22:28:14 UTC
(rev 9530)
+++ trunk/freenet/src/freenet/node/PacketSender.java 2006-07-09 22:41:26 UTC
(rev 9531)
@@ -63,7 +63,7 @@
long now = System.currentTimeMillis();
long recordedTime = ((long)lastTimeInSeconds) *
1000;
long diff = now - recordedTime;
- if(diff > 3*60*1000 && node.isHasStarted()) {
+ if((diff > 3*60*1000) && node.isHasStarted()) {
if(!Node.logConfigHandler.getFileLoggerHook().hasRedirectedStdOutErrNoLock())
System.err.println("Restarting
node: PacketSender froze for 3 minutes! ("+diff+")");
@@ -219,14 +219,14 @@
// Any messages to send?
MessageItem[] messages = null;
messages = pn.grabQueuedMessageItems();
- if(messages != null && messages.length > 0) {
+ if((messages != null) && (messages.length > 0)) {
long l = Long.MAX_VALUE;
int sz = 56; // overhead; FIXME should be a constant or
something
for(int j=0;j<messages.length;j++) {
if(l > messages[j].submitted) l =
messages[j].submitted;
sz += 2 + /* FIXME only 2? */
messages[j].getData(node.packetMangler, pn).length;
}
- if(l + 100 > now && sz < 1024) {
+ if((l + 100 > now) && (sz < 1024)) {
// Don't send immediately
if(nextActionTime > (l+100))
nextActionTime = l+100;
Modified: trunk/freenet/src/freenet/node/PeerManager.java
===================================================================
--- trunk/freenet/src/freenet/node/PeerManager.java 2006-07-09 22:28:14 UTC
(rev 9530)
+++ trunk/freenet/src/freenet/node/PeerManager.java 2006-07-09 22:41:26 UTC
(rev 9531)
@@ -133,7 +133,7 @@
// removing from connectedPeers
ArrayList a = new ArrayList();
for(int i=0;i<myPeers.length;i++) {
- if(myPeers[i]!=pn && myPeers[i].isConnected())
+ if((myPeers[i]!=pn) && myPeers[i].isConnected())
a.add(myPeers[i]);
}
@@ -168,7 +168,7 @@
// removing from connectedPeers
ArrayList a = new ArrayList();
for(int i=0;i<myPeers.length;i++) {
- if(myPeers[i]!=pn && myPeers[i].isConnected())
+ if((myPeers[i]!=pn) && myPeers[i].isConnected())
a.add(myPeers[i]);
}
PeerNode[] newConnectedPeers = new PeerNode[a.size()];
@@ -311,7 +311,7 @@
}
}
int lengthWithoutExcluded = v.size();
- if(exclude != null && exclude.isConnected())
+ if((exclude != null) && exclude.isConnected())
v.add(exclude);
PeerNode[] newConnectedPeers = new PeerNode[v.size()];
newConnectedPeers = (PeerNode[]) v.toArray(newConnectedPeers);
@@ -383,7 +383,7 @@
*/
public PeerNode closerPeer(PeerNode pn, HashSet routedTo, HashSet
notIgnored, double loc, boolean ignoreSelf) {
PeerNode best = _closerPeer(pn, routedTo, notIgnored, loc, ignoreSelf,
false);
- if (best != null && node.getToadletContainer() != null &&
+ if ((best != null) && (node.getToadletContainer() != null) &&
node.getToadletContainer().isAdvancedDarknetEnabled()) {
PeerNode nbo = _closerPeer(pn, routedTo, notIgnored, loc,
ignoreSelf, true);
if(nbo != null) {
@@ -435,7 +435,7 @@
any = p;
double diff = distance(p, loc);
Logger.minor(this, "p.loc="+p.getLocation().getValue()+",
loc="+loc+", d="+distance(p.getLocation().getValue(), loc)+" usedD="+diff+" for
"+p.getPeer());
- if((!ignoreSelf) && diff > maxDiff) continue;
+ if((!ignoreSelf) && (diff > maxDiff)) continue;
if(diff < bestDiff) {
best = p;
bestDiff = diff;
Modified: trunk/freenet/src/freenet/node/PeerNode.java
===================================================================
--- trunk/freenet/src/freenet/node/PeerNode.java 2006-07-09 22:28:14 UTC
(rev 9530)
+++ trunk/freenet/src/freenet/node/PeerNode.java 2006-07-09 22:41:26 UTC
(rev 9531)
@@ -477,7 +477,7 @@
}
if(ark != null) {
- if(myARK == null || (myARK != ark && !myARK.equals(ark))) {
+ if((myARK == null) || ((myARK != ark) && !myARK.equals(ark))) {
myARK = ark;
return true;
}
@@ -610,7 +610,7 @@
Peer p = myNominalPeer[i];
if(p == null) continue;
if(detectedPeer != null) {
- if(p != detectedPeer && p.equals(detectedPeer)) {
+ if((p != detectedPeer) && p.equals(detectedPeer)) {
// Equal but not the same object; need to
update the copy.
detectedDuplicate = p;
}
@@ -635,7 +635,7 @@
localHandshakeIPs = updateHandshakeIPs(localHandshakeIPs,
ignoreHostnames);
synchronized(this) {
handshakeIPs = localHandshakeIPs;
- if(detectedDuplicate != null &&
detectedDuplicate.equals(detectedPeer)) {
+ if((detectedDuplicate != null) &&
detectedDuplicate.equals(detectedPeer)) {
detectedPeer = detectedDuplicate;
}
}
@@ -845,7 +845,7 @@
DiffieHellmanContext c = ctx;
if(c != null)
Logger.minor(this, "Last used: "+(now - c.lastUsedTime()));
- return !(c == null || now - c.lastUsedTime() > Node.HANDSHAKE_TIMEOUT);
+ return !((c == null) || (now - c.lastUsedTime() >
Node.HANDSHAKE_TIMEOUT));
}
boolean firstHandshake = true;
@@ -873,7 +873,7 @@
this.handshakeCount++;
}
// Don't fetch ARKs for peers we have verified (through handshake) to
be incompatible with us
- if(handshakeCount == MAX_HANDSHAKE_COUNT &&
!(verifiedIncompatibleOlderVersion || verifiedIncompatibleNewerVersion)) {
+ if((handshakeCount == MAX_HANDSHAKE_COUNT) &&
!(verifiedIncompatibleOlderVersion || verifiedIncompatibleNewerVersion)) {
long arkFetcherStartTime1 = System.currentTimeMillis();
arkFetcher.queue();
long arkFetcherStartTime2 = System.currentTimeMillis();
@@ -999,7 +999,7 @@
private void setDetectedPeer(Peer newPeer) {
// Only clear lastAttemptedHandshakeIPUpdateTime if we have a new IP.
// Also, we need to call .equals() to propagate any DNS lookups that
have been done if the two have the same domain.
- if(newPeer != null && (detectedPeer == null ||
!detectedPeer.equals(newPeer))) {
+ if((newPeer != null) && ((detectedPeer == null) ||
!detectedPeer.equals(newPeer))) {
this.detectedPeer=newPeer;
this.lastAttemptedHandshakeIPUpdateTime = 0;
}
@@ -1049,8 +1049,8 @@
* can be used in handshaking when the connection hasn't been verified yet.
*/
synchronized void receivedPacket(boolean dontLog) throws
NotConnectedException {
- if(isConnected == false && !dontLog) {
- if(unverifiedTracker == null && currentTracker == null) {
+ if((isConnected == false) && !dontLog) {
+ if((unverifiedTracker == null) && (currentTracker == null)) {
Logger.error(this, "Received packet while
disconnected!: "+this, new Exception("error"));
throw new NotConnectedException();
} else {
@@ -1460,7 +1460,7 @@
public String getTMCIPeerInfo() {
long now = System.currentTimeMillis();
int idle = (int) ((now - timeLastReceivedPacket) / 1000);
- if(peerNodeStatus == Node.PEER_NODE_STATUS_NEVER_CONNECTED &&
peerAddedTime > 1)
+ if((peerNodeStatus == Node.PEER_NODE_STATUS_NEVER_CONNECTED) &&
(peerAddedTime > 1))
idle = (int) ((now - peerAddedTime) / 1000);
return
myName+"\t"+getPeer()+"\t"+getIdentityString()+"\t"+currentLocation.getValue()+"\t"+getPeerNodeStatusString()+"\t"+idle;
}
@@ -1581,17 +1581,17 @@
if(item.pn != this)
throw new IllegalArgumentException("item.pn != this!");
KeyTracker kt = cur;
- if(kt != null && item.kt == kt) {
+ if((kt != null) && (item.kt == kt)) {
kt.resendPacket(item.packetNumber);
continue;
}
kt = prev;
- if(kt != null && item.kt == kt) {
+ if((kt != null) && (item.kt == kt)) {
kt.resendPacket(item.packetNumber);
continue;
}
kt = unv;
- if(kt != null && item.kt == kt) {
+ if((kt != null) && (item.kt == kt)) {
kt.resendPacket(item.packetNumber);
continue;
}
@@ -1969,7 +1969,7 @@
peerNodeStatus = Node.PEER_NODE_STATUS_CONNECTED;
if(now < routingBackedOffUntil) {
peerNodeStatus =
Node.PEER_NODE_STATUS_ROUTING_BACKED_OFF;
-
if(!lastRoutingBackoffReason.equals(previousRoutingBackoffReason) ||
previousRoutingBackoffReason == null) {
+
if(!lastRoutingBackoffReason.equals(previousRoutingBackoffReason) ||
(previousRoutingBackoffReason == null)) {
if(previousRoutingBackoffReason !=
null) {
node.removePeerNodeRoutingBackoffReason(previousRoutingBackoffReason, this);
}
@@ -1995,7 +1995,7 @@
} else {
peerNodeStatus = Node.PEER_NODE_STATUS_DISCONNECTED;
}
- if(!isConnected && previousRoutingBackoffReason != null) {
+ if(!isConnected && (previousRoutingBackoffReason != null)) {
node.removePeerNodeRoutingBackoffReason(previousRoutingBackoffReason, this);
previousRoutingBackoffReason = null;
}
Modified: trunk/freenet/src/freenet/node/RequestSender.java
===================================================================
--- trunk/freenet/src/freenet/node/RequestSender.java 2006-07-09 22:28:14 UTC
(rev 9530)
+++ trunk/freenet/src/freenet/node/RequestSender.java 2006-07-09 22:41:26 UTC
(rev 9531)
@@ -94,7 +94,7 @@
}
public void run() {
- if(key instanceof NodeSSK && pubKey == null) {
+ if((key instanceof NodeSSK) && (pubKey == null)) {
pubKey = ((NodeSSK)key).getPubKey();
if(pubKey == null)
pubKey = node.getKey(((NodeSSK)key).getPubKeyHash());
@@ -209,7 +209,7 @@
break;
}
- if(msg == null || msg.getSpec() != DMT.FNPAccepted) {
+ if((msg == null) || (msg.getSpec() != DMT.FNPAccepted)) {
// Try another node
continue;
}
@@ -466,7 +466,7 @@
hadROLastTimeWaited = true;
return true;
}
- if((!prbWasNonNull) && prb != null) {
+ if((!prbWasNonNull) && (prb != null)) {
prbWasNonNull = true;
return false;
}
@@ -499,7 +499,7 @@
throw new IllegalStateException("finish() called with "+code+"
when was already "+status);
status = code;
- if(status != TIMED_OUT && status != GENERATED_REJECTED_OVERLOAD &&
status != INTERNAL_ERROR) {
+ if((status != TIMED_OUT) && (status != GENERATED_REJECTED_OVERLOAD) &&
(status != INTERNAL_ERROR)) {
if(key instanceof NodeSSK) {
Logger.minor(this, "SSK fetch cost
"+getTotalSentBytes()+"/"+getTotalReceivedBytes()+" bytes ("+status+")");
(source == null ? node.localSskFetchBytesSentAverage :
node.remoteSskFetchBytesSentAverage)
Modified: trunk/freenet/src/freenet/node/RequestStarter.java
===================================================================
--- trunk/freenet/src/freenet/node/RequestStarter.java 2006-07-09 22:28:14 UTC
(rev 9530)
+++ trunk/freenet/src/freenet/node/RequestStarter.java 2006-07-09 22:41:26 UTC
(rev 9531)
@@ -35,7 +35,7 @@
public static final short NUMBER_OF_PRIORITY_CLASSES =
MINIMUM_PRIORITY_CLASS - MAXIMUM_PRIORITY_CLASS + 1; // include 0 and max !!
public static boolean isValidPriorityClass(int prio) {
- return !(prio < MAXIMUM_PRIORITY_CLASS || prio >
MINIMUM_PRIORITY_CLASS);
+ return !((prio < MAXIMUM_PRIORITY_CLASS) || (prio >
MINIMUM_PRIORITY_CLASS));
}
final BaseRequestThrottle throttle;
Modified: trunk/freenet/src/freenet/node/SSKInsertHandler.java
===================================================================
--- trunk/freenet/src/freenet/node/SSKInsertHandler.java 2006-07-09
22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/node/SSKInsertHandler.java 2006-07-09
22:41:26 UTC (rev 9531)
@@ -146,7 +146,7 @@
SSKBlock storedBlock = node.fetch(key);
- if(storedBlock != null && !storedBlock.equals(block)) {
+ if((storedBlock != null) && !storedBlock.equals(block)) {
Message msg = DMT.createFNPSSKDataFound(uid,
storedBlock.getRawHeaders(), storedBlock.getRawData());
try {
source.send(msg, null);
@@ -226,9 +226,9 @@
// Local RejectedOverload's (fatal).
// Internal error counts as overload. It'd only create a timeout
otherwise, which is the same thing anyway.
// We *really* need a good way to deal with nodes that constantly
R_O!
- if(status == SSKInsertSender.TIMED_OUT ||
- status == SSKInsertSender.GENERATED_REJECTED_OVERLOAD ||
- status == SSKInsertSender.INTERNAL_ERROR) {
+ if((status == SSKInsertSender.TIMED_OUT) ||
+ (status == SSKInsertSender.GENERATED_REJECTED_OVERLOAD)
||
+ (status == SSKInsertSender.INTERNAL_ERROR)) {
Message msg = DMT.createFNPRejectedOverload(uid, true);
try {
source.send(msg, null);
@@ -237,14 +237,14 @@
return;
}
// Might as well store it anyway.
- if(status == SSKInsertSender.TIMED_OUT ||
- status ==
SSKInsertSender.GENERATED_REJECTED_OVERLOAD)
+ if((status == SSKInsertSender.TIMED_OUT) ||
+ (status ==
SSKInsertSender.GENERATED_REJECTED_OVERLOAD))
canCommit = true;
finish();
return;
}
- if(status == SSKInsertSender.ROUTE_NOT_FOUND || status ==
SSKInsertSender.ROUTE_REALLY_NOT_FOUND) {
+ if((status == SSKInsertSender.ROUTE_NOT_FOUND) || (status ==
SSKInsertSender.ROUTE_REALLY_NOT_FOUND)) {
Message msg = DMT.createFNPRouteNotFound(uid, sender.getHTL());
try {
source.send(msg, null);
Modified: trunk/freenet/src/freenet/node/SSKInsertSender.java
===================================================================
--- trunk/freenet/src/freenet/node/SSKInsertSender.java 2006-07-09 22:28:14 UTC
(rev 9530)
+++ trunk/freenet/src/freenet/node/SSKInsertSender.java 2006-07-09 22:41:26 UTC
(rev 9531)
@@ -233,7 +233,7 @@
break;
}
- if(msg == null || msg.getSpec() != DMT.FNPSSKAccepted) continue;
+ if((msg == null) || (msg.getSpec() != DMT.FNPSSKAccepted))
continue;
Logger.minor(this, "Got Accepted on "+this);
@@ -442,7 +442,7 @@
if(status != NOT_FINISHED)
throw new IllegalStateException("finish() called with "+code+"
when was already "+status);
- if(code == ROUTE_NOT_FOUND && !sentRequest)
+ if((code == ROUTE_NOT_FOUND) && !sentRequest)
code = ROUTE_REALLY_NOT_FOUND;
status = code;
@@ -451,8 +451,8 @@
notifyAll();
}
- if(code != TIMED_OUT && code != GENERATED_REJECTED_OVERLOAD && code !=
INTERNAL_ERROR
- && code != ROUTE_REALLY_NOT_FOUND) {
+ if((code != TIMED_OUT) && (code != GENERATED_REJECTED_OVERLOAD) &&
(code != INTERNAL_ERROR)
+ && (code != ROUTE_REALLY_NOT_FOUND)) {
Logger.minor(this, "SSK insert cost
"+getTotalSentBytes()+"/"+getTotalReceivedBytes()+" bytes ("+code+")");
(source == null ? node.localChkInsertBytesSentAverage :
node.remoteChkInsertBytesSentAverage)
.report(getTotalSentBytes());
Modified: trunk/freenet/src/freenet/node/TextModeClientInterface.java
===================================================================
--- trunk/freenet/src/freenet/node/TextModeClientInterface.java 2006-07-09
22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/node/TextModeClientInterface.java 2006-07-09
22:41:26 UTC (rev 9531)
@@ -198,9 +198,9 @@
if(uline.startsWith("GET:")) {
// Should have a key next
String key = line.substring("GET:".length());
- while(key.length() > 0 && key.charAt(0) == ' ')
+ while((key.length() > 0) && (key.charAt(0) == ' '))
key = key.substring(1);
- while(key.length() > 0 && key.charAt(key.length()-1) == ' ')
+ while((key.length() > 0) && (key.charAt(key.length()-1) == ' '))
key = key.substring(0, key.length()-2);
Logger.normal(this, "Key: "+key);
FreenetURI uri;
@@ -239,7 +239,7 @@
outsb.append(new String(dataBytes));
} catch (FetchException e) {
outsb.append("Error: "+e.getMessage()+"\r\n");
- if(e.getMode() == FetchException.SPLITFILE_ERROR &&
e.errorCodes != null) {
+ if((e.getMode() == FetchException.SPLITFILE_ERROR) &&
(e.errorCodes != null)) {
outsb.append(e.errorCodes.toVerboseString());
}
if(e.newURI != null)
@@ -248,9 +248,9 @@
} else if(uline.startsWith("GETFILE:")) {
// Should have a key next
String key = line.substring("GETFILE:".length());
- while(key.length() > 0 && key.charAt(0) == ' ')
+ while((key.length() > 0) && (key.charAt(0) == ' '))
key = key.substring(1);
- while(key.length() > 0 && key.charAt(key.length()-1) == ' ')
+ while((key.length() > 0) && (key.charAt(key.length()-1) == ' '))
key = key.substring(0, key.length()-2);
Logger.normal(this, "Key: "+key);
FreenetURI uri;
@@ -272,7 +272,7 @@
if(fnam.length() == 0) {
fnam =
"freenet-download-"+HexUtil.bytesToHex(BucketTools.hash(data), 0, 10);
String ext =
DefaultMIMETypes.getExtension(cm.getMIMEType());
- if(ext != null && !ext.equals(""))
+ if((ext != null) && !ext.equals(""))
fnam += "." + ext;
}
File f = new File(downloadsDir, fnam);
@@ -302,7 +302,7 @@
outsb.append("Download rate: "+rate+" bytes / second");
} catch (FetchException e) {
outsb.append("Error: "+e.getMessage());
- if(e.getMode() == FetchException.SPLITFILE_ERROR &&
e.errorCodes != null) {
+ if((e.getMode() == FetchException.SPLITFILE_ERROR) &&
(e.errorCodes != null)) {
outsb.append(e.errorCodes.toVerboseString());
}
if(e.newURI != null)
@@ -328,7 +328,7 @@
out.write(sb.toString().getBytes());
out.flush();
n.getNodeStarter().restart();
- } else if(uline.startsWith("QUIT") && n.directTMCI == this) {
+ } else if(uline.startsWith("QUIT") && (n.directTMCI == this)) {
StringBuffer sb = new StringBuffer();
sb.append("QUIT command not available in console mode.\r\n");
out.write(sb.toString().getBytes());
@@ -349,9 +349,9 @@
line = line.substring(("GETCHK:").length());
else
line = line.substring("PUT:".length());
- while(line.length() > 0 && line.charAt(0) == ' ')
+ while((line.length() > 0) && (line.charAt(0) == ' '))
line = line.substring(1);
- while(line.length() > 0 && line.charAt(line.length()-1) == ' ')
+ while((line.length() > 0) && (line.charAt(line.length()-1) == ' '))
line = line.substring(0, line.length()-2);
String content;
if(line.length() > 0) {
@@ -374,7 +374,7 @@
if(e.uri != null)
outsb.append("URI would have been: "+e.uri);
int mode = e.getMode();
- if(mode == InserterException.FATAL_ERRORS_IN_BLOCKS || mode ==
InserterException.TOO_MANY_RETRIES_IN_BLOCKS) {
+ if((mode == InserterException.FATAL_ERRORS_IN_BLOCKS) || (mode
== InserterException.TOO_MANY_RETRIES_IN_BLOCKS)) {
outsb.append("Splitfile-specific
error:\n"+e.errorCodes.toVerboseString());
}
return false;
@@ -464,9 +464,9 @@
} else {
line = line.substring("PUTFILE:".length());
}
- while(line.length() > 0 && line.charAt(0) == ' ')
+ while((line.length() > 0) && (line.charAt(0) == ' '))
line = line.substring(1);
- while(line.length() > 0 && line.charAt(line.length()-1) == ' ')
+ while((line.length() > 0) && (line.charAt(line.length()-1) == ' '))
line = line.substring(0, line.length()-2);
String mimeType = DefaultMIMETypes.guessMIMEType(line);
if (line.indexOf('#') > -1) {
@@ -569,9 +569,9 @@
} else {
key = line.substring("ADDPEER:".length());
}
- while(key.length() > 0 && key.charAt(0) == ' ')
+ while((key.length() > 0) && (key.charAt(0) == ' '))
key = key.substring(1);
- while(key.length() > 0 && key.charAt(key.length()-1) == ' ')
+ while((key.length() > 0) && (key.charAt(key.length()-1) == ' '))
key = key.substring(0, key.length()-2);
String content = null;
@@ -602,9 +602,9 @@
} else if(uline.startsWith("NAME:")) {
outsb.append("Node name currently: "+n.myName);
String key = line.substring("NAME:".length());
- while(key.length() > 0 && key.charAt(0) == ' ')
+ while((key.length() > 0) && (key.charAt(0) == ' '))
key = key.substring(1);
- while(key.length() > 0 && key.charAt(key.length()-1) == ' ')
+ while((key.length() > 0) && (key.charAt(key.length()-1) == ' '))
key = key.substring(0, key.length()-2);
outsb.append("New name: "+key);
@@ -843,7 +843,7 @@
int x = 0;
for(int j=before.length()-1;j>=0;j--) {
char c = before.charAt(j);
- if(c == '.' ||
Character.isLetterOrDigit(c)) {
+ if((c == '.') ||
Character.isLetterOrDigit(c)) {
// Valid character for field
} else {
x=j+1;
@@ -997,7 +997,7 @@
StringBuffer sb = new StringBuffer(fnam.length());
for(int i=0;i<fnam.length();i++) {
char c = fnam.charAt(i);
- if(Character.isLetterOrDigit(c) || c == '-' || c == '.')
+ if(Character.isLetterOrDigit(c) || (c == '-') || (c == '.'))
sb.append(c);
}
return sb.toString();
Modified: trunk/freenet/src/freenet/node/Version.java
===================================================================
--- trunk/freenet/src/freenet/node/Version.java 2006-07-09 22:28:14 UTC (rev
9530)
+++ trunk/freenet/src/freenet/node/Version.java 2006-07-09 22:41:26 UTC (rev
9531)
@@ -108,7 +108,7 @@
}
String[] v = Fields.commaList(version);
- if (v.length < 3 || !goodProtocol(v[2])) {
+ if ((v.length < 3) || !goodProtocol(v[2])) {
return false;
}
if (sameVersion(v)) {
@@ -176,10 +176,10 @@
String[] v = Fields.commaList(version);
String[] lgv = Fields.commaList(lastGoodVersion);
- if (v.length < 3 || !goodProtocol(v[2])) {
+ if ((v.length < 3) || !goodProtocol(v[2])) {
return false;
}
- if (lgv.length < 3 || !goodProtocol(lgv[2])) {
+ if ((lgv.length < 3) || !goodProtocol(lgv[2])) {
return false;
}
if (sameArbitraryVersion(v,lgv)) {
@@ -234,7 +234,7 @@
public static final String explainBadVersion(String version) {
String[] v = Fields.commaList(version);
- if (v.length < 3 || !goodProtocol(v[2])) {
+ if ((v.length < 3) || !goodProtocol(v[2])) {
return "Required protocol version is "
+ protocolVersion
// uncomment next line if accepting stable, see also goodProtocol() above
@@ -275,7 +275,7 @@
}
String[] v = Fields.commaList(version);
- if (v.length < 3 || !goodProtocol(v[2])) {
+ if ((v.length < 3) || !goodProtocol(v[2])) {
throw new NumberFormatException();
}
return Integer.parseInt(v[3]);
@@ -317,7 +317,7 @@
public static boolean sameVersion(String[] v) {
return v[0].equals(nodeName)
&& v[1].equals(nodeVersion)
- && v.length >= 4;
+ && (v.length >= 4);
}
/**
@@ -327,8 +327,8 @@
public static boolean sameArbitraryVersion(String[] v, String[] lgv) {
return v[0].equals(lgv[0])
&& v[1].equals(lgv[1])
- && v.length >= 4
- && lgv.length >= 4;
+ && (v.length >= 4)
+ && (lgv.length >= 4);
}
/**
@@ -337,7 +337,7 @@
private static boolean stableVersion(String[] v) {
return v[0].equals(nodeName)
&& v[1].equals(stableNodeVersion)
- && v.length >= 4;
+ && (v.length >= 4);
}
public static void main(String[] args) throws Throwable {
Modified: trunk/freenet/src/freenet/node/fcp/ClientGet.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/ClientGet.java 2006-07-09 22:28:14 UTC
(rev 9530)
+++ trunk/freenet/src/freenet/node/fcp/ClientGet.java 2006-07-09 22:41:26 UTC
(rev 9531)
@@ -162,7 +162,7 @@
throw e;
}
getter = new ClientGetter(this, client.node.chkFetchScheduler,
client.node.sskFetchScheduler, uri, fctx, priorityClass, client, returnBucket);
- if(persistenceType != PERSIST_CONNECTION && handler != null)
+ if((persistenceType != PERSIST_CONNECTION) && (handler != null))
sendPendingMessages(handler.outputHandler, true, true,
false);
}
@@ -286,7 +286,7 @@
postFetchProtocolErrorMessage = new
ProtocolErrorMessage(ProtocolErrorMessage.COULD_NOT_WRITE_FILE, false, null,
identifier);
}
try {
- if(fos != null && !closed)
+ if((fos != null) && !closed)
fos.close();
} catch (IOException e) {
Logger.error(this, "Caught "+e+"
closing file "+tempFile, e);
@@ -361,7 +361,7 @@
if(finished)
trySendDataFoundOrGetFailed(handler);
}
- if(includeData && allDataPending != null)
+ if(includeData && (allDataPending != null))
handler.queue(allDataPending);
}
Modified: trunk/freenet/src/freenet/node/fcp/ClientGetMessage.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/ClientGetMessage.java 2006-07-09
22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/node/fcp/ClientGetMessage.java 2006-07-09
22:41:26 UTC (rev 9531)
@@ -156,14 +156,14 @@
} else {
try {
priorityClass =
Short.parseShort(priorityString, 10);
- if(priorityClass <
RequestStarter.MAXIMUM_PRIORITY_CLASS || priorityClass >
RequestStarter.MINIMUM_PRIORITY_CLASS)
+ if((priorityClass <
RequestStarter.MAXIMUM_PRIORITY_CLASS) || (priorityClass >
RequestStarter.MINIMUM_PRIORITY_CLASS))
throw new
MessageInvalidException(ProtocolErrorMessage.INVALID_FIELD, "Valid priorities
are from "+RequestStarter.MAXIMUM_PRIORITY_CLASS+" to
"+RequestStarter.MINIMUM_PRIORITY_CLASS, identifier);
} catch (NumberFormatException e) {
throw new
MessageInvalidException(ProtocolErrorMessage.ERROR_PARSING_NUMBER, "Error
parsing PriorityClass field: "+e.getMessage(), identifier);
}
}
String persistenceString = fs.get("Persistence");
- if(persistenceString == null ||
persistenceString.equalsIgnoreCase("connection")) {
+ if((persistenceString == null) ||
persistenceString.equalsIgnoreCase("connection")) {
// Default: persists until connection loss.
persistenceType = ClientRequest.PERSIST_CONNECTION;
} else if(persistenceString.equalsIgnoreCase("reboot")) {
@@ -176,7 +176,7 @@
} else {
throw new
MessageInvalidException(ProtocolErrorMessage.ERROR_PARSING_NUMBER, "Error
parsing Persistence field: "+persistenceString, identifier);
}
- if(global && persistenceType ==
ClientRequest.PERSIST_CONNECTION) {
+ if(global && (persistenceType ==
ClientRequest.PERSIST_CONNECTION)) {
throw new
MessageInvalidException(ProtocolErrorMessage.NOT_SUPPORTED, "Global requests
must be persistent", identifier);
}
}
@@ -237,7 +237,7 @@
public static short parseValidReturnType(String string) {
short s = parseReturnType(string);
- if(s == RETURN_TYPE_DIRECT || s == RETURN_TYPE_NONE || s ==
RETURN_TYPE_DISK)
+ if((s == RETURN_TYPE_DIRECT) || (s == RETURN_TYPE_NONE) || (s
== RETURN_TYPE_DISK))
return s;
throw new IllegalArgumentException("Invalid or unsupported
return type: "+returnTypeString(s));
}
Modified: trunk/freenet/src/freenet/node/fcp/ClientPut.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/ClientPut.java 2006-07-09 22:28:14 UTC
(rev 9530)
+++ trunk/freenet/src/freenet/node/fcp/ClientPut.java 2006-07-09 22:41:26 UTC
(rev 9531)
@@ -71,7 +71,7 @@
inserter = new ClientPutter(this, data, uri, cm,
ctx, client.node.chkPutScheduler,
client.node.sskPutScheduler, priorityClass,
getCHKOnly, isMetadata, client);
- if(persistenceType != PERSIST_CONNECTION && handler != null)
+ if((persistenceType != PERSIST_CONNECTION) && (handler != null))
sendPendingMessages(handler.outputHandler, true, false,
false);
}
Modified: trunk/freenet/src/freenet/node/fcp/ClientPutBase.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/ClientPutBase.java 2006-07-09
22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/node/fcp/ClientPutBase.java 2006-07-09
22:41:26 UTC (rev 9531)
@@ -108,7 +108,7 @@
public void onGeneratedURI(FreenetURI uri, BaseClientPutter state) {
synchronized(this) {
- if(generatedURI != null && !uri.equals(generatedURI))
+ if((generatedURI != null) && !uri.equals(generatedURI))
Logger.error(this,
"onGeneratedURI("+uri+","+state+") but already set generatedURI to
"+generatedURI);
generatedURI = uri;
}
Modified: trunk/freenet/src/freenet/node/fcp/ClientPutDir.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/ClientPutDir.java 2006-07-09
22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/node/fcp/ClientPutDir.java 2006-07-09
22:41:26 UTC (rev 9531)
@@ -77,7 +77,7 @@
Logger.minor(this, "Parsing "+i);
Logger.minor(this, "UploadFrom="+uploadFrom);
ManifestElement me;
- if(uploadFrom == null ||
uploadFrom.equalsIgnoreCase("direct")) {
+ if((uploadFrom == null) ||
uploadFrom.equalsIgnoreCase("direct")) {
long sz =
Long.parseLong(subset.get("DataLength"));
if(!finished) {
// Direct (persistent temp bucket)
@@ -111,7 +111,7 @@
} else
throw new PersistenceParseException("Don't know
UploadFrom="+uploadFrom);
v.add(me);
- if(data != null && data.size() > 0)
+ if((data != null) && (data.size() > 0))
size += data.size();
}
manifestElements = SimpleManifestPutter.unflatten(v);
Modified: trunk/freenet/src/freenet/node/fcp/ClientPutDirMessage.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/ClientPutDirMessage.java 2006-07-09
22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/node/fcp/ClientPutDirMessage.java 2006-07-09
22:41:26 UTC (rev 9531)
@@ -83,7 +83,7 @@
} else {
try {
priorityClass =
Short.parseShort(priorityString, 10);
- if(priorityClass <
RequestStarter.MAXIMUM_PRIORITY_CLASS || priorityClass >
RequestStarter.MINIMUM_PRIORITY_CLASS)
+ if((priorityClass <
RequestStarter.MAXIMUM_PRIORITY_CLASS) || (priorityClass >
RequestStarter.MINIMUM_PRIORITY_CLASS))
throw new
MessageInvalidException(ProtocolErrorMessage.INVALID_FIELD, "Valid priorities
are from "+RequestStarter.MAXIMUM_PRIORITY_CLASS+" to
"+RequestStarter.MINIMUM_PRIORITY_CLASS, identifier);
} catch (NumberFormatException e) {
throw new
MessageInvalidException(ProtocolErrorMessage.ERROR_PARSING_NUMBER, "Error
parsing PriorityClass field: "+e.getMessage(), identifier);
@@ -91,7 +91,7 @@
}
dontCompress = Fields.stringToBool(fs.get("DontCompress"),
false);
String persistenceString = fs.get("Persistence");
- if(persistenceString == null ||
persistenceString.equalsIgnoreCase("connection")) {
+ if((persistenceString == null) ||
persistenceString.equalsIgnoreCase("connection")) {
// Default: persists until connection loss.
persistenceType = ClientRequest.PERSIST_CONNECTION;
} else if(persistenceString.equalsIgnoreCase("reboot")) {
Modified: trunk/freenet/src/freenet/node/fcp/ClientPutMessage.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/ClientPutMessage.java 2006-07-09
22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/node/fcp/ClientPutMessage.java 2006-07-09
22:41:26 UTC (rev 9531)
@@ -99,14 +99,14 @@
} else {
try {
priorityClass =
Short.parseShort(priorityString, 10);
- if(priorityClass <
RequestStarter.MAXIMUM_PRIORITY_CLASS || priorityClass >
RequestStarter.MINIMUM_PRIORITY_CLASS)
+ if((priorityClass <
RequestStarter.MAXIMUM_PRIORITY_CLASS) || (priorityClass >
RequestStarter.MINIMUM_PRIORITY_CLASS))
throw new
MessageInvalidException(ProtocolErrorMessage.INVALID_FIELD, "Valid priorities
are from "+RequestStarter.MAXIMUM_PRIORITY_CLASS+" to
"+RequestStarter.MINIMUM_PRIORITY_CLASS, identifier);
} catch (NumberFormatException e) {
throw new
MessageInvalidException(ProtocolErrorMessage.ERROR_PARSING_NUMBER, "Error
parsing PriorityClass field: "+e.getMessage(), identifier);
}
}
String uploadFrom = fs.get("UploadFrom");
- if(uploadFrom == null || uploadFrom.equalsIgnoreCase("direct"))
{
+ if((uploadFrom == null) ||
uploadFrom.equalsIgnoreCase("direct")) {
uploadFromType = UPLOAD_FROM_DIRECT;
String dataLengthString = fs.get("DataLength");
if(dataLengthString == null)
@@ -148,7 +148,7 @@
throw new
MessageInvalidException(ProtocolErrorMessage.INVALID_FIELD, "UploadFrom invalid
or unrecognized: "+uploadFrom, identifier);
dontCompress = Fields.stringToBool(fs.get("DontCompress"),
false);
String persistenceString = fs.get("Persistence");
- if(persistenceString == null ||
persistenceString.equalsIgnoreCase("connection")) {
+ if((persistenceString == null) ||
persistenceString.equalsIgnoreCase("connection")) {
// Default: persists until connection loss.
persistenceType = ClientRequest.PERSIST_CONNECTION;
} else if(persistenceString.equalsIgnoreCase("reboot")) {
Modified: trunk/freenet/src/freenet/node/fcp/ClientRequest.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/ClientRequest.java 2006-07-09
22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/node/fcp/ClientRequest.java 2006-07-09
22:41:26 UTC (rev 9531)
@@ -93,7 +93,7 @@
persistenceType =
ClientRequest.parsePersistence(fs.get("Persistence"));
if(persistenceType == ClientRequest.PERSIST_CONNECTION)
throw new IllegalArgumentException("Reading persistent
get with type CONNECTION !!");
- if(!(persistenceType == ClientRequest.PERSIST_FOREVER ||
persistenceType == ClientRequest.PERSIST_REBOOT))
+ if(!((persistenceType == ClientRequest.PERSIST_FOREVER) ||
(persistenceType == ClientRequest.PERSIST_REBOOT)))
throw new IllegalArgumentException("Unknown persistence
type "+ClientRequest.persistenceTypeString(persistenceType));
this.client = client2;
this.origHandler = null;
@@ -128,7 +128,7 @@
}
public static short parsePersistence(String string) {
- if(string == null || string.equalsIgnoreCase("connection"))
+ if((string == null) || string.equalsIgnoreCase("connection"))
return PERSIST_CONNECTION;
if(string.equalsIgnoreCase("reboot"))
return PERSIST_REBOOT;
Modified: trunk/freenet/src/freenet/node/fcp/DirPutFile.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/DirPutFile.java 2006-07-09 22:28:14 UTC
(rev 9530)
+++ trunk/freenet/src/freenet/node/fcp/DirPutFile.java 2006-07-09 22:41:26 UTC
(rev 9531)
@@ -39,7 +39,7 @@
*/
public static DirPutFile create(SimpleFieldSet subset, String
identifier, BucketFactory bf) throws MessageInvalidException {
String type = subset.get("UploadFrom");
- if(type == null || type.equalsIgnoreCase("direct")) {
+ if((type == null) || type.equalsIgnoreCase("direct")) {
return new DirectDirPutFile(subset, identifier, bf);
} else if(type.equalsIgnoreCase("disk")) {
return new DiskDirPutFile(subset, identifier);
Modified: trunk/freenet/src/freenet/node/fcp/FCPClient.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/FCPClient.java 2006-07-09 22:28:14 UTC
(rev 9530)
+++ trunk/freenet/src/freenet/node/fcp/FCPClient.java 2006-07-09 22:41:26 UTC
(rev 9531)
@@ -131,7 +131,7 @@
synchronized(this) {
String ident = cg.getIdentifier();
ClientRequest old = (ClientRequest)
clientRequestsByIdentifier.get(ident);
- if(old != null && old != cg)
+ if((old != null) && (old != cg))
throw new IdentifierCollisionException();
if(cg.hasFinished())
completedUnackedRequests.push(cg);
Modified: trunk/freenet/src/freenet/node/fcp/FCPConnectionHandler.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/FCPConnectionHandler.java
2006-07-09 22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/node/fcp/FCPConnectionHandler.java
2006-07-09 22:41:26 UTC (rev 9531)
@@ -47,7 +47,7 @@
}
for(int i=0;i<requests.length;i++)
requests[i].onLostConnection();
- if(client != null && !client.hasPersistentRequests())
+ if((client != null) && !client.hasPersistentRequests())
server.unregisterClient(client);
}
@@ -102,7 +102,7 @@
String id = message.identifier;
ClientGet cg = null;
boolean success;
- boolean persistent = message.persistenceType !=
ClientGet.PERSIST_CONNECTION;
+ boolean persistent = message.persistenceType !=
ClientRequest.PERSIST_CONNECTION;
synchronized(this) {
if(isClosed) return;
// We need to track non-persistent requests anyway, so
we may as well check
@@ -140,7 +140,7 @@
String id = message.identifier;
ClientPut cp = null;
boolean success;
- boolean persistent = message.persistenceType !=
ClientGet.PERSIST_CONNECTION;
+ boolean persistent = message.persistenceType !=
ClientRequest.PERSIST_CONNECTION;
synchronized(this) {
if(isClosed) return;
// We need to track non-persistent requests anyway, so
we may as well check
@@ -179,7 +179,7 @@
String id = message.identifier;
ClientPutDir cp = null;
boolean success;
- boolean persistent = message.persistenceType !=
ClientGet.PERSIST_CONNECTION;
+ boolean persistent = message.persistenceType !=
ClientRequest.PERSIST_CONNECTION;
synchronized(this) {
if(isClosed) return;
// We need to track non-persistent requests anyway, so
we may as well check
Modified: trunk/freenet/src/freenet/node/fcp/FCPConnectionInputHandler.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/FCPConnectionInputHandler.java
2006-07-09 22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/node/fcp/FCPConnectionInputHandler.java
2006-07-09 22:41:26 UTC (rev 9531)
@@ -75,7 +75,7 @@
continue;
}
}
- if((!firstMessage) && msg instanceof
ClientHelloMessage) {
+ if((!firstMessage) && (msg instanceof
ClientHelloMessage)) {
FCPMessage err = new
ProtocolErrorMessage(ProtocolErrorMessage.NO_LATE_CLIENT_HELLOS, false, null,
null);
handler.outputHandler.queue(err);
continue;
Modified: trunk/freenet/src/freenet/node/fcp/FCPServer.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/FCPServer.java 2006-07-09 22:28:14 UTC
(rev 9530)
+++ trunk/freenet/src/freenet/node/fcp/FCPServer.java 2006-07-09 22:41:26 UTC
(rev 9531)
@@ -298,7 +298,7 @@
String persistentDownloadsDir =
fcpConfig.getString("persistentDownloadsFile");
- fcpConfig.register("persistentDownloadsInterval",
(long)(5*60*1000), 5, true, "Interval between writing persistent downloads to
disk", "Interval between writing persistent downloads to disk",
+ fcpConfig.register("persistentDownloadsInterval", (5*60*1000),
5, true, "Interval between writing persistent downloads to disk", "Interval
between writing persistent downloads to disk",
cb3 = new
PersistentDownloadsIntervalCallback());
long persistentDownloadsInterval =
fcpConfig.getLong("persistentDownloadsInterval");
@@ -339,7 +339,7 @@
if(f.isFile() && !(f.canRead() && f.canWrite()))
throw new InvalidConfigValueException("File exists but
cannot be read");
File parent = f.getParentFile();
- if(parent != null && !parent.exists())
+ if((parent != null) && !parent.exists())
throw new InvalidConfigValueException("Parent directory
does not exist");
if(!f.exists()) {
try {
@@ -432,7 +432,7 @@
if(killed) return;
long startTime =
System.currentTimeMillis();
long now;
- while((now =
System.currentTimeMillis()) < startTime + persistenceInterval && !storeNow) {
+ while(((now =
System.currentTimeMillis()) < startTime + persistenceInterval) && !storeNow) {
try {
long wait =
Math.max((startTime + persistenceInterval) - now, Integer.MAX_VALUE);
if(wait > 0)
@@ -611,7 +611,7 @@
private File makeReturnFilename(FreenetURI uri, String
expectedMimeType) {
String ext;
- if(expectedMimeType != null && expectedMimeType.length() > 0 &&
+ if((expectedMimeType != null) && (expectedMimeType.length() >
0) &&
!expectedMimeType.equals(DefaultMIMETypes.DEFAULT_MIME_TYPE)) {
ext = DefaultMIMETypes.getExtension(expectedMimeType);
} else ext = null;
Modified: trunk/freenet/src/freenet/node/fcp/GetRequestStatusMessage.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/GetRequestStatusMessage.java
2006-07-09 22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/node/fcp/GetRequestStatusMessage.java
2006-07-09 22:41:26 UTC (rev 9531)
@@ -33,8 +33,7 @@
if(global)
req =
handler.server.globalClient.getRequest(identifier);
else
- req = (ClientRequest)
- handler.getClient().getRequest(identifier);
+ req = handler.getClient().getRequest(identifier);
if(req == null) {
ProtocolErrorMessage msg = new
ProtocolErrorMessage(ProtocolErrorMessage.NO_SUCH_IDENTIFIER, false, null,
identifier);
handler.outputHandler.queue(msg);
Modified: trunk/freenet/src/freenet/node/fcp/PersistentPutDir.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/PersistentPutDir.java 2006-07-09
22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/node/fcp/PersistentPutDir.java 2006-07-09
22:41:26 UTC (rev 9531)
@@ -71,7 +71,7 @@
if(data instanceof FileBucket) {
subset.put("UploadFrom", "disk");
subset.put("Filename",
((FileBucket)data).getFile().getPath());
- } else if(data instanceof
PaddedEphemerallyEncryptedBucket || data == null) {
+ } else if((data instanceof
PaddedEphemerallyEncryptedBucket) || (data == null)) {
subset.put("UploadFrom", "direct");
} else {
throw new IllegalStateException("Don't
know what to do with bucket: "+data);
Modified: trunk/freenet/src/freenet/node/fcp/SimpleProgressMessage.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/SimpleProgressMessage.java
2006-07-09 22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/node/fcp/SimpleProgressMessage.java
2006-07-09 22:41:26 UTC (rev 9531)
@@ -39,23 +39,23 @@
}
public double getMinBlocks() {
- return (double) event.minSuccessfulBlocks;
+ return event.minSuccessfulBlocks;
}
public double getTotalBlocks(){
- return (double) event.totalBlocks;
+ return event.totalBlocks;
}
public double getFetchedBlocks(){
- return (double) event.fetchedBlocks;
+ return event.fetchedBlocks;
}
public double getFailedBlocks(){
- return (double) event.failedBlocks;
+ return event.failedBlocks;
}
public double getFatalyFailedBlocks(){
- return (double) event.fatallyFailedBlocks;
+ return event.fatallyFailedBlocks;
}
public boolean isTotalFinalized() {
Modified: trunk/freenet/src/freenet/node/updater/NodeUpdater.java
===================================================================
--- trunk/freenet/src/freenet/node/updater/NodeUpdater.java 2006-07-09
22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/node/updater/NodeUpdater.java 2006-07-09
22:41:26 UTC (rev 9531)
@@ -143,7 +143,7 @@
System.err.println("Starting the update process: found the
update, now fetching it.");
// We fetch it
try{
- if(cg==null||cg.isCancelled()){
+ if((cg==null)||cg.isCancelled()){
cg = new ClientGetter(this,
node.chkFetchScheduler, node.sskFetchScheduler,
URI.setSuggestedEdition(availableVersion), ctx,
RequestStarter.BULK_SPLITFILE_PRIORITY_CLASS,
this, new ArrayBucket());
@@ -385,10 +385,10 @@
this.cg = state;
isFetching=false;
cg.cancel();
- if(errorCode == FetchException.DATA_NOT_FOUND ||
- errorCode ==
FetchException.ROUTE_NOT_FOUND ||
- errorCode ==
FetchException.PERMANENT_REDIRECT ||
- errorCode ==
FetchException.REJECTED_OVERLOAD){
+ if((errorCode == FetchException.DATA_NOT_FOUND) ||
+ (errorCode ==
FetchException.ROUTE_NOT_FOUND) ||
+ (errorCode ==
FetchException.PERMANENT_REDIRECT) ||
+ (errorCode ==
FetchException.REJECTED_OVERLOAD)){
Logger.normal(this, "Rescheduling new request");
maybeUpdate();
Modified: trunk/freenet/src/freenet/node/useralerts/PeerManagerUserAlert.java
===================================================================
--- trunk/freenet/src/freenet/node/useralerts/PeerManagerUserAlert.java
2006-07-09 22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/node/useralerts/PeerManagerUserAlert.java
2006-07-09 22:41:26 UTC (rev 9531)
@@ -51,9 +51,9 @@
return "Too many open connections";
if(peers > MAX_PEER_ALERT_THRESHOLD)
return "Too many peers";
- if(n.bwlimitDelayAlertRelevant && bwlimitDelayTime >
Node.MAX_BWLIMIT_DELAY_TIME_ALERT_THRESHOLD)
+ if(n.bwlimitDelayAlertRelevant && (bwlimitDelayTime >
Node.MAX_BWLIMIT_DELAY_TIME_ALERT_THRESHOLD))
return "bwlimitDelayTime too high";
- if(n.nodeAveragePingAlertRelevant && nodeAveragePingTime >
Node.MAX_NODE_AVERAGE_PING_TIME_ALERT_THRESHOLD)
+ if(n.nodeAveragePingAlertRelevant && (nodeAveragePingTime >
Node.MAX_NODE_AVERAGE_PING_TIME_ALERT_THRESHOLD))
return "nodeAveragePingTime too high";
if(oldestNeverConnectedPeerAge >
MAX_OLDEST_NEVER_CONNECTED_PEER_AGE_ALERT_THRESHOLD)
return "Never connected peer(s) too old";
@@ -89,9 +89,9 @@
s = "This node has too many connections ("+conns+" >
"+MAX_CONN_ALERT_THRESHOLD+"). We don't encourage such a behaviour; Ubernodes
are hurting the network.";
} else if(peers > MAX_PEER_ALERT_THRESHOLD) {
s = "This node has too many peers ("+peers+" >
"+MAX_PEER_ALERT_THRESHOLD+"). This will impact your performance as all peers
(connected or not) consume bandwidth and CPU. Consider \"cleaning up\" your
peer list.";
- } else if(n.bwlimitDelayAlertRelevant && bwlimitDelayTime >
Node.MAX_BWLIMIT_DELAY_TIME_ALERT_THRESHOLD) {
+ } else if(n.bwlimitDelayAlertRelevant && (bwlimitDelayTime >
Node.MAX_BWLIMIT_DELAY_TIME_ALERT_THRESHOLD)) {
s = "This node has to wait too long for available
bandwidth ("+bwlimitDelayTime+" >
"+Node.MAX_BWLIMIT_DELAY_TIME_ALERT_THRESHOLD+"). Increase your output
bandwidth limit and/or remove some peers to improve the situation.";
- } else if(n.nodeAveragePingAlertRelevant && nodeAveragePingTime
> Node.MAX_NODE_AVERAGE_PING_TIME_ALERT_THRESHOLD) {
+ } else if(n.nodeAveragePingAlertRelevant &&
(nodeAveragePingTime > Node.MAX_NODE_AVERAGE_PING_TIME_ALERT_THRESHOLD)) {
s = "This node is having trouble talking with it's
peers quickly enough ("+nodeAveragePingTime+" >
"+Node.MAX_NODE_AVERAGE_PING_TIME_ALERT_THRESHOLD+"). Decrease your output
bandwidth limit and/or remove some peers to improve the situation.";
} else if(oldestNeverConnectedPeerAge >
MAX_OLDEST_NEVER_CONNECTED_PEER_AGE_ALERT_THRESHOLD) {
s = "One or more of your node's peers have never
connected in the two weeks since they were added. Consider removing them since
they are affecting performance.";
@@ -100,13 +100,13 @@
}
public short getPriorityClass() {
- if(peers == 0 ||
- conns == 0 ||
- (peers - conns) >
MAX_DISCONN_PEER_ALERT_THRESHOLD ||
- conns > MAX_CONN_ALERT_THRESHOLD ||
- peers > MAX_PEER_ALERT_THRESHOLD ||
- (n.bwlimitDelayAlertRelevant &&
bwlimitDelayTime > Node.MAX_BWLIMIT_DELAY_TIME_ALERT_THRESHOLD) ||
- (n.nodeAveragePingAlertRelevant &&
nodeAveragePingTime > Node.MAX_NODE_AVERAGE_PING_TIME_ALERT_THRESHOLD))
+ if((peers == 0) ||
+ (conns == 0) ||
+ ((peers - conns) >
MAX_DISCONN_PEER_ALERT_THRESHOLD) ||
+ (conns > MAX_CONN_ALERT_THRESHOLD) ||
+ (peers > MAX_PEER_ALERT_THRESHOLD) ||
+ (n.bwlimitDelayAlertRelevant &&
(bwlimitDelayTime > Node.MAX_BWLIMIT_DELAY_TIME_ALERT_THRESHOLD)) ||
+ (n.nodeAveragePingAlertRelevant &&
(nodeAveragePingTime > Node.MAX_NODE_AVERAGE_PING_TIME_ALERT_THRESHOLD)))
return UserAlert.CRITICAL_ERROR;
return UserAlert.ERROR;
}
@@ -116,14 +116,14 @@
bwlimitDelayTime = (int) n.getBwlimitDelayTime();
nodeAveragePingTime = (int) n.getNodeAveragePingTime();
oldestNeverConnectedPeerAge = (int)
n.getOldestNeverConnectedPeerAge();
- return (peers == 0 ||
- conns < 3 ||
- (peers - conns) >
MAX_DISCONN_PEER_ALERT_THRESHOLD ||
- conns > MAX_CONN_ALERT_THRESHOLD ||
- peers > MAX_PEER_ALERT_THRESHOLD ||
- (n.bwlimitDelayAlertRelevant &&
bwlimitDelayTime > Node.MAX_BWLIMIT_DELAY_TIME_ALERT_THRESHOLD) ||
- (n.nodeAveragePingAlertRelevant &&
nodeAveragePingTime > Node.MAX_NODE_AVERAGE_PING_TIME_ALERT_THRESHOLD) ||
- oldestNeverConnectedPeerAge >
MAX_OLDEST_NEVER_CONNECTED_PEER_AGE_ALERT_THRESHOLD) &&
+ return ((peers == 0) ||
+ (conns < 3) ||
+ ((peers - conns) >
MAX_DISCONN_PEER_ALERT_THRESHOLD) ||
+ (conns > MAX_CONN_ALERT_THRESHOLD) ||
+ (peers > MAX_PEER_ALERT_THRESHOLD) ||
+ (n.bwlimitDelayAlertRelevant &&
(bwlimitDelayTime > Node.MAX_BWLIMIT_DELAY_TIME_ALERT_THRESHOLD)) ||
+ (n.nodeAveragePingAlertRelevant &&
(nodeAveragePingTime > Node.MAX_NODE_AVERAGE_PING_TIME_ALERT_THRESHOLD)) ||
+ (oldestNeverConnectedPeerAge >
MAX_OLDEST_NEVER_CONNECTED_PEER_AGE_ALERT_THRESHOLD)) &&
isValid;
}
Modified: trunk/freenet/src/freenet/pluginmanager/DetectedIP.java
===================================================================
--- trunk/freenet/src/freenet/pluginmanager/DetectedIP.java 2006-07-09
22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/pluginmanager/DetectedIP.java 2006-07-09
22:41:26 UTC (rev 9531)
@@ -46,7 +46,7 @@
return false;
}
DetectedIP d = (DetectedIP)o;
- return (d.natType == natType &&
d.publicAddress.equals(publicAddress));
+ return ((d.natType == natType) &&
d.publicAddress.equals(publicAddress));
}
public int hashCode() {
Modified: trunk/freenet/src/freenet/pluginmanager/PluginManager.java
===================================================================
--- trunk/freenet/src/freenet/pluginmanager/PluginManager.java 2006-07-09
22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/pluginmanager/PluginManager.java 2006-07-09
22:41:26 UTC (rev 9531)
@@ -135,7 +135,7 @@
Object removeKey = null;
synchronized (pluginInfo) {
Iterator it = pluginInfo.keySet().iterator();
- while (it.hasNext() && removeKey == null) {
+ while (it.hasNext() && (removeKey == null)) {
Object key = it.next();
PluginInfoWrapper pi = (PluginInfoWrapper)
pluginInfo.get(key);
if (pi.sameThread(t)) {
@@ -283,7 +283,7 @@
if ((filename.indexOf("@") >= 0)) {
// Open from external file
- for (int tries = 0 ; tries <= 5 && cls == null ; tries++)
+ for (int tries = 0 ; (tries <= 5) && (cls == null) ; tries++)
try {
String realURL = null;
String realClass = null;
Modified: trunk/freenet/src/freenet/store/BerkeleyDBFreenetStore.java
===================================================================
--- trunk/freenet/src/freenet/store/BerkeleyDBFreenetStore.java 2006-07-09
22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/store/BerkeleyDBFreenetStore.java 2006-07-09
22:41:26 UTC (rev 9531)
@@ -185,8 +185,8 @@
long chkBlocksFromFile = countCHKBlocksFromFile();
lastRecentlyUsed = getMaxRecentlyUsed();
- if((chkBlocksInStore == 0 && chkBlocksFromFile != 0) ||
- ((chkBlocksInStore + 10) * 1.1) <
chkBlocksFromFile) {
+ if(((chkBlocksInStore == 0) && (chkBlocksFromFile != 0)) ||
+ (((chkBlocksInStore + 10) * 1.1) <
chkBlocksFromFile)) {
if(throwOnTooFewKeys) {
try {
close();
@@ -276,7 +276,7 @@
t = null;
- if(deleted == 0 || dontCheck) break;
+ if((deleted == 0) || dontCheck) break;
else {
System.err.println("Checking...");
synchronized(this) {
@@ -1037,7 +1037,7 @@
}
private synchronized void checkSecondaryDatabaseError(Throwable ex) {
- if(ex instanceof DatabaseException && ex.getMessage().indexOf("missing
key in the primary database") > -1) {
+ if((ex instanceof DatabaseException) &&
(ex.getMessage().indexOf("missing key in the primary database") > -1)) {
try {
fixSecondaryFile.createNewFile();
} catch (IOException e) {
Modified: trunk/freenet/src/freenet/support/Base64.java
===================================================================
--- trunk/freenet/src/freenet/support/Base64.java 2006-07-09 22:28:14 UTC
(rev 9530)
+++ trunk/freenet/src/freenet/support/Base64.java 2006-07-09 22:41:26 UTC
(rev 9531)
@@ -123,7 +123,7 @@
int inLength = in.length;
// Strip trailing equals signs.
- while (inLength > 0 && in[inLength-1] == '_')
+ while ((inLength > 0) && (in[inLength-1] == '_'))
inLength--;
int blocks = inLength/4;
Modified: trunk/freenet/src/freenet/support/BitArray.java
===================================================================
--- trunk/freenet/src/freenet/support/BitArray.java 2006-07-09 22:28:14 UTC
(rev 9530)
+++ trunk/freenet/src/freenet/support/BitArray.java 2006-07-09 22:41:26 UTC
(rev 9531)
@@ -58,7 +58,7 @@
}
public static int unsignedByteToInt(byte b) {
- return (int) b & 0xFF;
+ return b & 0xFF;
}
public String toString() {
Modified: trunk/freenet/src/freenet/support/BucketTools.java
===================================================================
--- trunk/freenet/src/freenet/support/BucketTools.java 2006-07-09 22:28:14 UTC
(rev 9530)
+++ trunk/freenet/src/freenet/support/BucketTools.java 2006-07-09 22:41:26 UTC
(rev 9531)
@@ -354,15 +354,15 @@
long bucketLength = data.size();
long bytesRead = 0;
byte[] buf = new byte[4096];
- while(bytesRead < bucketLength || bucketLength == -1) {
+ while((bytesRead < bucketLength) || (bucketLength ==
-1)) {
int readBytes = is.read(buf);
if(readBytes < 0) break;
bytesRead += readBytes;
md.update(buf, 0, readBytes);
}
- if(bytesRead < bucketLength && bucketLength > 0)
+ if((bytesRead < bucketLength) && (bucketLength > 0))
throw new EOFException();
- if(bytesRead != bucketLength && bucketLength > 0)
+ if((bytesRead != bucketLength) && (bucketLength > 0))
throw new IOException("Read "+bytesRead+" but
bucket length "+bucketLength+"!");
return md.digest();
} catch (NoSuchAlgorithmException e) {
Modified: trunk/freenet/src/freenet/support/CPUInformation/CPUID.java
===================================================================
--- trunk/freenet/src/freenet/support/CPUInformation/CPUID.java 2006-07-09
22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/support/CPUInformation/CPUID.java 2006-07-09
22:41:26 UTC (rev 9531)
@@ -152,15 +152,15 @@
{
public boolean IsK6Compatible()
{
- return getCPUFamily() >= 5 && getCPUModel() >= 6;
+ return (getCPUFamily() >= 5) && (getCPUModel() >= 6);
}
public boolean IsK6_2_Compatible()
{
- return getCPUFamily() >= 5 && getCPUModel() >= 8;
+ return (getCPUFamily() >= 5) && (getCPUModel() >= 8);
}
public boolean IsK6_3_Compatible()
{
- return getCPUFamily() >= 5 && getCPUModel() >= 9;
+ return (getCPUFamily() >= 5) && (getCPUModel() >= 9);
}
public boolean IsAthlonCompatible()
{
@@ -168,7 +168,7 @@
}
public boolean IsAthlon64Compatible()
{
- return getCPUFamily() == 15 && getCPUExtendedFamily()
== 0;
+ return (getCPUFamily() == 15) &&
(getCPUExtendedFamily() == 0);
}
public String getCPUModelString() throws UnknownCPUException
@@ -257,15 +257,15 @@
}
public boolean IsPentiumMMXCompatible()
{
- return IsPentium2Compatible() || (getCPUFamily() == 5
&& (getCPUModel() ==4 || getCPUModel() == 8));
+ return IsPentium2Compatible() || ((getCPUFamily() == 5)
&& ((getCPUModel() ==4) || (getCPUModel() == 8)));
}
public boolean IsPentium2Compatible()
{
- return getCPUFamily() > 6 || (getCPUFamily() == 6 &&
getCPUModel() >=3);
+ return (getCPUFamily() > 6) || ((getCPUFamily() == 6)
&& (getCPUModel() >=3));
}
public boolean IsPentium3Compatible()
{
- return getCPUFamily() > 6 || (getCPUFamily() == 6 &&
getCPUModel() >=7);
+ return (getCPUFamily() > 6) || ((getCPUFamily() == 6)
&& (getCPUModel() >=7));
}
public boolean IsPentium4Compatible()
{
Modified: trunk/freenet/src/freenet/support/DoublyLinkedListImpl.java
===================================================================
--- trunk/freenet/src/freenet/support/DoublyLinkedListImpl.java 2006-07-09
22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/support/DoublyLinkedListImpl.java 2006-07-09
22:41:26 UTC (rev 9531)
@@ -211,12 +211,12 @@
public final boolean hasNext(DoublyLinkedList.Item i) {
DoublyLinkedList.Item next = i.getNext();
- return next != null && next != _tailptr;
+ return (next != null) && (next != _tailptr);
}
public final boolean hasPrev(DoublyLinkedList.Item i) {
DoublyLinkedList.Item prev = i.getPrev();
- return prev != null && prev != _headptr;
+ return (prev != null) && (prev != _headptr);
}
public final DoublyLinkedList.Item next(DoublyLinkedList.Item i) {
@@ -245,10 +245,10 @@
if (i.getParent() != this)
throw new PromiscuousItemException(i, i.getParent());
DoublyLinkedList.Item next = i.getNext(), prev = i.getPrev();
- if (next == null && prev == null) return null; // not in the list
- if (next == null || prev == null)
+ if ((next == null) && (prev == null)) return null; // not in the list
+ if ((next == null) || (prev == null))
throw new NullPointerException("next="+next+", prev="+prev); //
partially in the list?!
- if(next.getPrev() != i || prev.getNext() != i) {
+ if((next.getPrev() != i) || (prev.getNext() != i)) {
String msg = "Illegal ERROR: i="+i+", next="+next+",
next.prev="+next.getPrev()+", prev="+prev+", prev.next="+prev.getNext();
Logger.error(this, msg);
throw new IllegalStateException(msg);
@@ -272,7 +272,7 @@
throw new PromiscuousItemException(i, i.getParent());
if (j.getParent() != null)
throw new PromiscuousItemException(j, j.getParent());
- if (j.getNext() != null || j.getPrev() != null)
+ if ((j.getNext() != null) || (j.getPrev() != null))
throw new PromiscuousItemException(j);
DoublyLinkedList.Item prev = i.getPrev();
if (prev == null)
@@ -301,7 +301,7 @@
throw new PromiscuousItemException(i, i.getParent());
if (j.getParent() != null)
throw new PromiscuousItemException(j, i.getParent());
- if (j.getNext() != null || j.getPrev() != null)
+ if ((j.getNext() != null) || (j.getPrev() != null))
throw new PromiscuousItemException(j);
DoublyLinkedList.Item next = i.getNext();
if (next == null)
@@ -351,7 +351,7 @@
protected Enumeration forwardElements(DoublyLinkedList.Item startAt,
boolean inclusive)
throws VirginItemException, NoSuchElementException
{
- if (startAt.getNext() == null || startAt.getPrev() == null)
+ if ((startAt.getNext() == null) || (startAt.getPrev() == null))
throw new VirginItemException(startAt);
else
return new ForwardWalker(startAt, inclusive);
@@ -383,7 +383,7 @@
protected Enumeration reverseElements(DoublyLinkedList.Item startAt,
boolean inclusive)
throws VirginItemException, NoSuchElementException
{
- if (startAt.getNext() == null || startAt.getPrev() == null)
+ if ((startAt.getNext() == null) || (startAt.getPrev() == null))
throw new VirginItemException(startAt);
else
return new ReverseWalker(startAt, inclusive);
Modified: trunk/freenet/src/freenet/support/Fields.java
===================================================================
--- trunk/freenet/src/freenet/support/Fields.java 2006-07-09 22:28:14 UTC
(rev 9530)
+++ trunk/freenet/src/freenet/support/Fields.java 2006-07-09 22:41:26 UTC
(rev 9531)
@@ -223,7 +223,7 @@
if (date.length() == 0)
throw new NumberFormatException("Date time empty");
- if (date.charAt(0) == '-' || date.charAt(0) == '+') {
+ if ((date.charAt(0) == '-') || (date.charAt(0) == '+')) {
// Relative date
StringBuffer sb = new StringBuffer(10);
for (int x = 1; x < date.length(); x++) {
@@ -279,8 +279,8 @@
int dash = date.indexOf('-');
- if (!(dash == -1 && date.length() == 8)
- && !(dash == 8 && date.length() == 17))
+ if (!((dash == -1) && (date.length() == 8))
+ && !((dash == 8) && (date.length() == 17)))
throw new NumberFormatException(
"Date time: " + date + " not correct.");
int year = Integer.parseInt(date.substring(0, 4));
@@ -375,7 +375,7 @@
int aoff,
int boff,
int len) {
- if (a.length < aoff + len || b.length < boff + len)
+ if ((a.length < aoff + len) || (b.length < boff + len))
return false;
for (int i = 0; i < len; ++i)
if (a[i + aoff] != b[i + boff])
@@ -536,7 +536,7 @@
{
1000,
1 << 10 };
- while (x >= 0
+ while ((x >= 0)
&& ((idx = "kK".indexOf(s.charAt(x))) != -1)) {
x--;
res *= l[idx];
@@ -567,7 +567,7 @@
1 << 20,
1000 * 1000 * 1000,
1 << 30 };
- while (x >= 0
+ while ((x >= 0)
&& ((idx = "kKmMgG".indexOf(s.charAt(x))) !=
-1)) {
x--;
res *= l[idx];
@@ -604,7 +604,7 @@
1 << 50,
1000 * 1000 * 1000 * 1000 * 1000 * 1000,
1 << 60 };
- while (x >= 0
+ while ((x >= 0)
&& ((idx = "kKmMgGtTpPeE".indexOf(s.charAt(x)))
!= -1)) {
x--;
res *= l[idx];
Modified: trunk/freenet/src/freenet/support/FileLoggerHook.java
===================================================================
--- trunk/freenet/src/freenet/support/FileLoggerHook.java 2006-07-09
22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/support/FileLoggerHook.java 2006-07-09
22:41:26 UTC (rev 9531)
@@ -45,7 +45,7 @@
private volatile boolean closed = false;
- protected int INTERVAL = GregorianCalendar.MINUTE;
+ protected int INTERVAL = Calendar.MINUTE;
protected int INTERVAL_MULTIPLIER = 5;
/** Name of the local host (called uname in Unix-like operating
systems). */
@@ -254,7 +254,7 @@
try {
thisTime = System.currentTimeMillis();
if (baseFilename != null) {
- if (thisTime > nextHour ||
switchedBaseFilename) {
+ if ((thisTime > nextHour) ||
switchedBaseFilename) {
// Switch logs
try {
logStream.flush();
@@ -506,7 +506,7 @@
name = name.substring(0,
name.length()-".log.gz".length());
}
name = name.substring(prefix.length());
- if(name.length() == 0 || name.charAt(0) != '-')
{
+ if((name.length() == 0) || (name.charAt(0) !=
'-')) {
Logger.minor(this, "Deleting
unrecognized: "+name+" ("+f.getPath()+")");
f.delete();
continue;
@@ -692,7 +692,7 @@
super(threshold);
this.maxOldLogfilesDiskUsage = maxOldLogfilesDiskUsage;
this.logOverwrite = overwrite;
- if (dfmt != null && dfmt.length() != 0) {
+ if ((dfmt != null) && (dfmt.length() != 0)) {
try {
df = new SimpleDateFormat(dfmt);
} catch (RuntimeException e) {
@@ -702,7 +702,7 @@
df = DateFormat.getDateTimeInstance();
df.setTimeZone(TimeZone.getTimeZone("UTC"));
- if (fmt == null || fmt.length() == 0)
+ if ((fmt == null) || (fmt.length() == 0))
fmt = "d:c:h:t:p:m";
char[] f = fmt.toCharArray();
@@ -712,7 +712,7 @@
boolean comment = false;
for (int i = 0; i < f.length; ++i) {
- if (!comment && numberOf(f[i]) != 0) {
+ if (!comment && (numberOf(f[i]) != 0)) {
if (sb.length() > 0) {
strVec.addElement(sb.toString());
fmtVec.addElement(new Integer(0));
@@ -812,9 +812,9 @@
list.add(b);
listBytes += (b.length + 16); /* total guess */
int x = 0;
- if (list.size() > MAX_LIST_SIZE || listBytes >
MAX_LIST_BYTES) {
- while (list.size() > (MAX_LIST_SIZE * 0.9F)
- || listBytes > (MAX_LIST_BYTES * 0.9F))
{
+ if ((list.size() > MAX_LIST_SIZE) || (listBytes >
MAX_LIST_BYTES)) {
+ while ((list.size() > (MAX_LIST_SIZE * 0.9F))
+ || (listBytes > (MAX_LIST_BYTES *
0.9F))) {
byte[] ss = (byte[])
(list.removeFirst());
listBytes -= (ss.length + 16);
x++;
@@ -905,7 +905,7 @@
while(i.hasNext()) {
OldLogFile olf = (OldLogFile) i.next();
Logger.minor(this, "Checking "+time+" against
"+olf.filename+" : start="+olf.start+", end="+olf.end);
- if(time >= olf.start && time < olf.end) {
+ if((time >= olf.start) && (time < olf.end)) {
toReturn = olf;
Logger.minor(this, "Found "+olf);
break;
@@ -963,7 +963,7 @@
long startTime = System.currentTimeMillis();
long endTime = startTime + 10000;
long now;
- while((now = System.currentTimeMillis()) < endTime &&
!switchedBaseFilename) {
+ while(((now = System.currentTimeMillis()) < endTime) &&
!switchedBaseFilename) {
try {
wait(Math.max(1, endTime-now));
} catch (InterruptedException e) {
Modified: trunk/freenet/src/freenet/support/HTMLDecoder.java
===================================================================
--- trunk/freenet/src/freenet/support/HTMLDecoder.java 2006-07-09 22:28:14 UTC
(rev 9530)
+++ trunk/freenet/src/freenet/support/HTMLDecoder.java 2006-07-09 22:41:26 UTC
(rev 9531)
@@ -29,7 +29,7 @@
if (d == '#') {
if (tmpPos < maxPos) {
d = s.charAt(tmpPos++);
- if (d == 'x' || d ==
'X') {
+ if ((d == 'x') || (d ==
'X')) {
if (tmpPos <
maxPos) {
d =
s.charAt(tmpPos++);
if
(isHexDigit(d)) {
@@ -46,8 +46,8 @@
Integer.parseInt(
t,
16);
-
if (i >= 0
-
&& i < 65536) {
+
if ((i >= 0)
+
&& (i < 65536)) {
c = (char) i;
curPos = tmpPos;
}
@@ -70,7 +70,7 @@
tmpPos - 1);
try {
i = Integer.parseInt(t);
-
if (i >= 0 && i < 65536) {
+
if ((i >= 0) && (i < 65536)) {
c = (char) i;
curPos = tmpPos;
}
@@ -114,15 +114,15 @@
}
private static boolean isLetter(char c) {
- return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z');
+ return ((c >= 'a') && (c <= 'z')) || ((c >= 'A') && (c <= 'Z'));
}
private static boolean isHexLetter(char c) {
- return (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F');
+ return ((c >= 'a') && (c <= 'f')) || ((c >= 'A') && (c <= 'F'));
}
private static boolean isDigit(char c) {
- return c >= '0' && c <= '9';
+ return (c >= '0') && (c <= '9');
}
public static String compact(String s) {
@@ -132,7 +132,7 @@
while (curPos < maxPos) {
char c = s.charAt(curPos++);
if (isWhitespace(c)) {
- while (curPos < maxPos &&
isWhitespace(s.charAt(curPos))) {
+ while ((curPos < maxPos) &&
isWhitespace(s.charAt(curPos))) {
curPos++;
}
c = '\u0020';
@@ -144,12 +144,12 @@
// HTML is very particular about what constitutes white space.
public static boolean isWhitespace(char ch) {
- return ch == '\u0020'
- || ch == '\r'
- || ch == '\n'
- || ch == '\u0009'
- || ch == '\u000c'
- || ch == '\u200b';
+ return (ch == '\u0020')
+ || (ch == '\r')
+ || (ch == '\n')
+ || (ch == '\u0009')
+ || (ch == '\u000c')
+ || (ch == '\u200b');
}
static {
Modified: trunk/freenet/src/freenet/support/HexUtil.java
===================================================================
--- trunk/freenet/src/freenet/support/HexUtil.java 2006-07-09 22:28:14 UTC
(rev 9530)
+++ trunk/freenet/src/freenet/support/HexUtil.java 2006-07-09 22:41:26 UTC
(rev 9531)
@@ -43,7 +43,7 @@
int length,
StringBuffer sb) {
sb.ensureCapacity(sb.length() + length * 2);
- for (int i = off; i < (off + length) && i < bs.length; i++) {
+ for (int i = off; (i < (off + length)) && (i < bs.length); i++)
{
sb.append(Character.forDigit((bs[i] >>> 4) & 0xf, 16));
sb.append(Character.forDigit(bs[i] & 0xf, 16));
}
@@ -96,7 +96,7 @@
for (int i = 0; i < slen; i += 2) {
b1 = (byte) Character.digit(s.charAt(i), 16);
b2 = (byte) Character.digit(s.charAt(i + 1), 16);
- if (b1 < 0 || b2 < 0) {
+ if ((b1 < 0) || (b2 < 0)) {
throw new NumberFormatException();
}
out[off + i / 2] = (byte) (b1 << 4 | b2);
Modified: trunk/freenet/src/freenet/support/ImmutableByteArrayWrapper.java
===================================================================
--- trunk/freenet/src/freenet/support/ImmutableByteArrayWrapper.java
2006-07-09 22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/support/ImmutableByteArrayWrapper.java
2006-07-09 22:41:26 UTC (rev 9531)
@@ -17,7 +17,7 @@
public boolean equals(Object o) {
if(o instanceof ImmutableByteArrayWrapper) {
ImmutableByteArrayWrapper w =
(ImmutableByteArrayWrapper) o;
- if(w.hashCode == hashCode &&
+ if((w.hashCode == hashCode) &&
Arrays.equals(data, w.data))
return true;
}
Modified: trunk/freenet/src/freenet/support/LimitedRangeIntByteArrayMap.java
===================================================================
--- trunk/freenet/src/freenet/support/LimitedRangeIntByteArrayMap.java
2006-07-09 22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/support/LimitedRangeIntByteArrayMap.java
2006-07-09 22:41:26 UTC (rev 9531)
@@ -116,7 +116,7 @@
Logger.minor(this, "Interrupted");
throw new InterruptedException();
}
- if(index - minValue < maxRange || minValue == -1) {
+ if((index - minValue < maxRange) || (minValue == -1)) {
Logger.minor(this, "index="+index+", minValue="+minValue+",
maxRange="+maxRange+" - returning");
return;
}
@@ -140,7 +140,7 @@
public synchronized boolean remove(int index) {
Logger.minor(this, "Removing "+index+" - min="+minValue+"
max="+maxValue);
if(contents.remove(new Integer(index)) != null) {
- if(index > minValue && index < maxValue) return true;
+ if((index > minValue) && (index < maxValue)) return true;
if(contents.size() == 0) {
minValue = maxValue = -1;
notifyAll();
Modified: trunk/freenet/src/freenet/support/Logger.java
===================================================================
--- trunk/freenet/src/freenet/support/Logger.java 2006-07-09 22:28:14 UTC
(rev 9530)
+++ trunk/freenet/src/freenet/support/Logger.java 2006-07-09 22:41:26 UTC
(rev 9531)
@@ -227,7 +227,7 @@
public synchronized static void destroyChainIfEmpty() {
if(logger instanceof VoidLogger) return;
- if(logger instanceof LoggerHookChain &&
((LoggerHookChain)logger).getHooks().length == 0) {
+ if((logger instanceof LoggerHookChain) &&
(((LoggerHookChain)logger).getHooks().length == 0)) {
logger = new VoidLogger();
}
}
Modified: trunk/freenet/src/freenet/support/LoggerHook.java
===================================================================
--- trunk/freenet/src/freenet/support/LoggerHook.java 2006-07-09 22:28:14 UTC
(rev 9530)
+++ trunk/freenet/src/freenet/support/LoggerHook.java 2006-07-09 22:41:26 UTC
(rev 9531)
@@ -112,7 +112,7 @@
}
public void setDetailedThresholds(String details) throws
InvalidThresholdException {
- if (details == null || details.length() == 0)
+ if ((details == null) || (details.length() == 0))
return;
StringTokenizer st = new StringTokenizer(details, ",", false);
Vector stuff = new Vector();
@@ -181,7 +181,7 @@
public boolean instanceShouldLog(int priority, Class c) {
int thresh = threshold;
- if (c != null && detailedThresholds.length != 0) {
+ if ((c != null) && (detailedThresholds.length != 0)) {
String cname = c.getName();
for (int i = 0; i < detailedThresholds.length; i++) {
DetailedThreshold dt = detailedThresholds[i];
Modified: trunk/freenet/src/freenet/support/MultiValueTable.java
===================================================================
--- trunk/freenet/src/freenet/support/MultiValueTable.java 2006-07-09
22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/support/MultiValueTable.java 2006-07-09
22:41:26 UTC (rev 9531)
@@ -54,7 +54,7 @@
public boolean containsElement(Object key, Object value) {
synchronized (table) {
Vector v = (Vector) table.get(key);
- return v != null && v.contains(value);
+ return (v != null) && v.contains(value);
}
}
Modified: trunk/freenet/src/freenet/support/NumberedItemComparator.java
===================================================================
--- trunk/freenet/src/freenet/support/NumberedItemComparator.java
2006-07-09 22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/support/NumberedItemComparator.java
2006-07-09 22:41:26 UTC (rev 9531)
@@ -18,11 +18,11 @@
public int ocompare(Object o1, Object o2) {
// Nulls at the end of the list
- if(o1 == null && o2 == null)
+ if((o1 == null) && (o2 == null))
return 0; // null == null
- if(o1 != null && o2 == null)
+ if((o1 != null) && (o2 == null))
return 1; // anything > null
- if(o2 != null && o1 == null)
+ if((o2 != null) && (o1 == null))
return -1;
long i1, i2;
if(o1 instanceof NumberedItem)
Modified: trunk/freenet/src/freenet/support/NumberedRecentItems.java
===================================================================
--- trunk/freenet/src/freenet/support/NumberedRecentItems.java 2006-07-09
22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/support/NumberedRecentItems.java 2006-07-09
22:41:26 UTC (rev 9531)
@@ -89,9 +89,9 @@
for(int i=0;i<Math.min(count, items.length);i++) {
NumberedItem item = items[i];
long num = item == null ? -1 : item.getNumber();
- if(item != null && num < 0)
+ if((item != null) && (num < 0))
throw new IllegalStateException("getNumber() must return
positive numbers");
- if(num < prevNum || num != -1 && num == prevNum) {
+ if((num < prevNum) || ((num != -1) && (num == prevNum))) {
throw new IllegalStateException("Must be higher than prev:
"+num+" "+prevNum);
}
prevNum = num;
Modified:
trunk/freenet/src/freenet/support/PaddedEphemerallyEncryptedBucket.java
===================================================================
--- trunk/freenet/src/freenet/support/PaddedEphemerallyEncryptedBucket.java
2006-07-09 22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/support/PaddedEphemerallyEncryptedBucket.java
2006-07-09 22:41:26 UTC (rev 9531)
@@ -114,7 +114,7 @@
if(closed) throw new IOException("Already closed!");
if(streamNumber != lastOutputStream)
throw new IllegalStateException("Writing to old
stream in "+getName());
- if(b < 0 || b > 255)
+ if((b < 0) || (b > 255))
throw new IllegalArgumentException();
int toWrite = pcfb.encipher(b);
synchronized(PaddedEphemerallyEncryptedBucket.this) {
@@ -202,7 +202,7 @@
public int read(byte[] buf, int offset, int length) throws
IOException {
// FIXME remove debugging
- if(length+offset > buf.length || offset < 0 || length <
0)
+ if((length+offset > buf.length) || (offset < 0) ||
(length < 0))
throw new
ArrayIndexOutOfBoundsException("a="+offset+", b="+length+", length
"+buf.length);
int x = available();
if(x <= 0) return -1;
@@ -248,7 +248,7 @@
throw new Error("Impossible size: "+size+" -
min="+min+", max="+max);
if(size < min)
throw new IllegalStateException("???");
- if(size >= min && size <= max) {
+ if((size >= min) && (size <= max)) {
Logger.minor(this, "Padded: "+max+" was:
"+dataLength+" for "+getName());
return max;
}
Modified: trunk/freenet/src/freenet/support/RandomGrabArray.java
===================================================================
--- trunk/freenet/src/freenet/support/RandomGrabArray.java 2006-07-09
22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/support/RandomGrabArray.java 2006-07-09
22:41:26 UTC (rev 9531)
@@ -54,14 +54,14 @@
if(ret != null)
contents.remove(ret);
// Shrink array
- if(index < reqs.length / 4 && reqs.length > MIN_SIZE) {
+ if((index < reqs.length / 4) && (reqs.length >
MIN_SIZE)) {
// Shrink array
int newSize = Math.max(index * 2, MIN_SIZE);
RandomGrabArrayItem[] r = new
RandomGrabArrayItem[newSize];
System.arraycopy(reqs, 0, r, 0, r.length);
reqs = r;
}
- if(ret != null && !ret.isFinished()) return ret;
+ if((ret != null) && !ret.isFinished()) return ret;
}
}
@@ -69,7 +69,7 @@
if(!contents.contains(it)) return;
contents.remove(it);
for(int i=0;i<index;i++) {
- if(reqs[i] == it || reqs[i].equals(it)) {
+ if((reqs[i] == it) || reqs[i].equals(it)) {
reqs[i] = reqs[--index];
reqs[index] = null;
return;
Modified: trunk/freenet/src/freenet/support/ReceivedPacketNumbers.java
===================================================================
--- trunk/freenet/src/freenet/support/ReceivedPacketNumbers.java
2006-07-09 22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/support/ReceivedPacketNumbers.java
2006-07-09 22:41:26 UTC (rev 9531)
@@ -92,7 +92,7 @@
li.add(r1);
return true;
}
- if(seqNumber >= r.start && seqNumber <= r.end) {
+ if((seqNumber >= r.start) && (seqNumber <= r.end)) {
// Duh
return true;
}
@@ -144,10 +144,10 @@
if(r.start > r.end) {
Logger.error(this, "Bad Range: "+r);
}
- if(last != null && r.start < last.end) {
+ if((last != null) && (r.start < last.end)) {
Logger.error(this, "This range: "+r+" but last was: "+last);
}
- if(r.start <= seqNumber && r.end >= seqNumber)
+ if((r.start <= seqNumber) && (r.end >= seqNumber))
return true;
}
return false;
Modified: trunk/freenet/src/freenet/support/SectoredRandomGrabArray.java
===================================================================
--- trunk/freenet/src/freenet/support/SectoredRandomGrabArray.java
2006-07-09 22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/support/SectoredRandomGrabArray.java
2006-07-09 22:41:26 UTC (rev 9531)
@@ -59,7 +59,7 @@
int x = rand.nextInt(grabArrays.length);
RemoveRandomWithClient rga = grabArrays[x];
RandomGrabArrayItem item = rga.removeRandom();
- if(rga.isEmpty() || item == null) {
+ if(rga.isEmpty() || (item == null)) {
Object client = rga.getClient();
grabArraysByClient.remove(client);
RandomGrabArrayWithClient[] newArray = new
RandomGrabArrayWithClient[grabArrays.length-1];
Modified: trunk/freenet/src/freenet/support/Serializer.java
===================================================================
--- trunk/freenet/src/freenet/support/Serializer.java 2006-07-09 22:28:14 UTC
(rev 9530)
+++ trunk/freenet/src/freenet/support/Serializer.java 2006-07-09 22:41:26 UTC
(rev 9531)
@@ -83,10 +83,10 @@
return new BitArray(dis);
} else if (type.equals(NodeCHK.class)) {
// Use Key.read(...) because write(...) writes the TYPE
field.
- return (NodeCHK) Key.read(dis);
+ return Key.read(dis);
} else if (type.equals(NodeSSK.class)) {
// Use Key.read(...) because write(...) writes the TYPE
field.
- return (NodeSSK) Key.read(dis);
+ return Key.read(dis);
} else if (type.equals(Key.class)) {
return Key.read(dis);
} else {
Modified: trunk/freenet/src/freenet/support/SimpleFieldSet.java
===================================================================
--- trunk/freenet/src/freenet/support/SimpleFieldSet.java 2006-07-09
22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/support/SimpleFieldSet.java 2006-07-09
22:41:26 UTC (rev 9531)
@@ -109,7 +109,7 @@
throw new IOException("No end marker");
return;
}
- if(line.length() == 0 && tolerant) continue; // ignore
+ if((line.length() == 0) && tolerant) continue; // ignore
firstLine = false;
int index = line.indexOf('=');
if(index >= 0) {
@@ -170,7 +170,7 @@
public void put(String key, String value) {
int idx;
if(value == null) return;
- if((!multiLevel) || (idx = key.indexOf(MULTI_LEVEL_CHAR)) ==
-1) {
+ if((!multiLevel) || ((idx = key.indexOf(MULTI_LEVEL_CHAR)) ==
-1)) {
String x = (String) map.get(key);
if(x == null) {
@@ -273,14 +273,14 @@
}
public boolean hasNext() {
- if(subIterator != null && subIterator.hasNext()) return
true;
+ if((subIterator != null) && subIterator.hasNext())
return true;
if(subIterator != null) subIterator = null;
return mapIterator.hasNext();
}
public Object next() {
while(true) { // tail-recurse so we get infinite loop
instead of OOM in case of a loop...
- if(subIterator != null &&
subIterator.hasNext()) {
+ if((subIterator != null) &&
subIterator.hasNext()) {
return subIterator.next();
}
if(subIterator != null) subIterator = null;
@@ -319,7 +319,7 @@
public void remove(String key) {
int idx;
- if((!multiLevel) || (idx = key.indexOf(MULTI_LEVEL_CHAR)) ==
-1) {
+ if((!multiLevel) || ((idx = key.indexOf(MULTI_LEVEL_CHAR)) ==
-1)) {
map.remove(key);
} else {
String before = key.substring(0, idx);
Modified: trunk/freenet/src/freenet/support/SimpleIntNumberedItemComparator.java
===================================================================
--- trunk/freenet/src/freenet/support/SimpleIntNumberedItemComparator.java
2006-07-09 22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/support/SimpleIntNumberedItemComparator.java
2006-07-09 22:41:26 UTC (rev 9531)
@@ -18,11 +18,11 @@
public int ocompare(Object o1, Object o2) {
// Nulls at the end of the list
- if(o1 == null && o2 == null)
+ if((o1 == null) && (o2 == null))
return 0; // null == null
- if(o1 != null && o2 == null)
+ if((o1 != null) && (o2 == null))
return nullAtStart? -1 : 1; // anything > null
- if(o2 != null && o1 == null)
+ if((o2 != null) && (o1 == null))
return nullAtStart ? 1 : -1;
long i1, i2;
if(o1 instanceof IntNumberedItem)
Modified: trunk/freenet/src/freenet/support/SizeUtil.java
===================================================================
--- trunk/freenet/src/freenet/support/SizeUtil.java 2006-07-09 22:28:14 UTC
(rev 9530)
+++ trunk/freenet/src/freenet/support/SizeUtil.java 2006-07-09 22:41:26 UTC
(rev 9531)
@@ -30,7 +30,7 @@
String o = Double.toString(mantissa);
if(o.indexOf('.') == 3)
o = o.substring(0, 3);
- else if(o.indexOf('.') > -1 && o.indexOf('E') == -1 &&
o.length() > 4)
+ else if((o.indexOf('.') > -1) && (o.indexOf('E') == -1)
&& (o.length() > 4))
o = o.substring(0, 4);
o += " " + suffixes[i];
return o;
Modified: trunk/freenet/src/freenet/support/SortedLongSet.java
===================================================================
--- trunk/freenet/src/freenet/support/SortedLongSet.java 2006-07-09
22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/support/SortedLongSet.java 2006-07-09
22:41:26 UTC (rev 9531)
@@ -42,7 +42,7 @@
System.arraycopy(data, x+1, data, x,
length-x-1);
data[--length] = Long.MAX_VALUE;
}
- if(length*4 < data.length && length > MIN_SIZE) {
+ if((length*4 < data.length) && (length > MIN_SIZE)) {
long[] newData = new long[Math.max(data.length/2,
MIN_SIZE)];
System.arraycopy(data, 0, newData, 0, length);
for(int i=length;i<newData.length;i++)
Modified: trunk/freenet/src/freenet/support/SortedVectorByNumber.java
===================================================================
--- trunk/freenet/src/freenet/support/SortedVectorByNumber.java 2006-07-09
22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/support/SortedVectorByNumber.java 2006-07-09
22:41:26 UTC (rev 9531)
@@ -42,7 +42,7 @@
System.arraycopy(data, x+1, data, x,
length-x-1);
data[--length] = null;
}
- if(length*4 < data.length && length > MIN_SIZE) {
+ if((length*4 < data.length) && (length > MIN_SIZE)) {
IntNumberedItem[] newData = new
IntNumberedItem[Math.max(length*2, MIN_SIZE)];
System.arraycopy(data, 0, newData, 0, length);
data = newData;
Modified: trunk/freenet/src/freenet/support/UpdatableSortedLinkedList.java
===================================================================
--- trunk/freenet/src/freenet/support/UpdatableSortedLinkedList.java
2006-07-09 22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/support/UpdatableSortedLinkedList.java
2006-07-09 22:41:26 UTC (rev 9531)
@@ -43,7 +43,7 @@
while(e.hasMoreElements()) {
UpdatableSortedLinkedListItem cur =
(UpdatableSortedLinkedListItem) e.nextElement();
- if(prev != null && cur.compareTo(i) >= 0 && prev.compareTo(i) <=
0) {
+ if((prev != null) && (cur.compareTo(i) >= 0) && (prev.compareTo(i)
<= 0)) {
list.insertNext(prev, i);
checkList();
return;
@@ -112,7 +112,7 @@
checkList();
return;
}
- if(list.head() == list.tail() && i != list.head()) {
+ if((list.head() == list.tail()) && (i != list.head())) {
Logger.error(this, "Only 1 element: "+list.head()+" and updating
"+i+" on "+this, new Exception("error"));
add(i);
checkList();
@@ -121,18 +121,18 @@
// Forwards or backwards?
UpdatableSortedLinkedListItem next = (UpdatableSortedLinkedListItem)
list.next(i);
UpdatableSortedLinkedListItem prev = (UpdatableSortedLinkedListItem)
list.prev(i);
- if(next == null && prev == null) {
+ if((next == null) && (prev == null)) {
return;
}
- if(next != null && prev != null && next.compareTo(i) >= 0 &&
prev.compareTo(i) <= 0)
+ if((next != null) && (prev != null) && (next.compareTo(i) >= 0) &&
(prev.compareTo(i) <= 0))
return; // already exactly where it should be
- if(next == null && prev != null) {
+ if((next == null) && (prev != null)) {
if(prev.compareTo(i) <= 0) return; // already in right place, at
end
}
- if(next != null && prev == null) {
+ if((next != null) && (prev == null)) {
if(next.compareTo(i) >= 0) return; // already where it should be
}
- if(next != null && i.compareTo(next) > 0) {
+ if((next != null) && (i.compareTo(next) > 0)) {
// i > next - move forwards
while(true) {
prev = next;
@@ -140,14 +140,14 @@
if(next == null) {
throw new NullPointerException("impossible - we checked");
}
- if(i.compareTo(next) < 0 && i.compareTo(prev) > 0) {
+ if((i.compareTo(next) < 0) && (i.compareTo(prev) > 0)) {
list.remove(i);
list.insertNext(prev, i);
checkList();
return;
}
}
- } else if(prev != null && i.compareTo(prev) < 0) {
+ } else if((prev != null) && (i.compareTo(prev) < 0)) {
// i < next - move backwards
while(true) {
next = prev;
@@ -155,7 +155,7 @@
if(next == null) {
throw new NullPointerException("impossible - we checked");
}
- if(i.compareTo(next) < 0 && i.compareTo(prev) > 0) {
+ if((i.compareTo(next) < 0) && (i.compareTo(prev) > 0)) {
list.remove(i);
list.insertNext(prev, i);
checkList();
Modified: trunk/freenet/src/freenet/support/io/FilenameGenerator.java
===================================================================
--- trunk/freenet/src/freenet/support/io/FilenameGenerator.java 2006-07-09
22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/support/io/FilenameGenerator.java 2006-07-09
22:41:26 UTC (rev 9531)
@@ -38,7 +38,7 @@
for(int i=0;i<filenames.length;i++) {
File f = filenames[i];
String name = f.getName();
- if((File.separatorChar == '\\' &&
name.toLowerCase().startsWith(prefix.toLowerCase()) ||
+ if((((File.separatorChar == '\\') &&
name.toLowerCase().startsWith(prefix.toLowerCase())) ||
name.startsWith(prefix))) {
f.delete();
}
Modified: trunk/freenet/src/freenet/support/io/LineReadingInputStream.java
===================================================================
--- trunk/freenet/src/freenet/support/io/LineReadingInputStream.java
2006-07-09 22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/support/io/LineReadingInputStream.java
2006-07-09 22:41:26 UTC (rev 9531)
@@ -29,7 +29,7 @@
return new String(buf, 0, ctr, utf ? "UTF-8" :
"ISO-8859-1");
}
// REDFLAG this is definitely safe with the above
charsets, it may not be safe with some wierd ones.
- if(x == (int)'\n') {
+ if(x == '\n') {
if(ctr == 0) return "";
if(buf[ctr-1] == '\r') ctr--;
return new String(buf, 0, ctr, utf ? "UTF-8" :
"ISO-8859-1");
Modified: trunk/freenet/src/freenet/support/io/PersistentTempBucketFactory.java
===================================================================
--- trunk/freenet/src/freenet/support/io/PersistentTempBucketFactory.java
2006-07-09 22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/support/io/PersistentTempBucketFactory.java
2006-07-09 22:41:26 UTC (rev 9531)
@@ -52,7 +52,7 @@
throw new IOException("Directory is not a directory:
"+dir);
originalFiles = new HashSet();
File[] files = dir.listFiles();
- if(files != null && files.length > 0) {
+ if((files != null) && (files.length > 0)) {
for(int i=0;i<files.length;i++) {
File f = files[i];
String name = f.getName();
Modified: trunk/freenet/src/freenet/support/io/SpyInputStream.java
===================================================================
--- trunk/freenet/src/freenet/support/io/SpyInputStream.java 2006-07-09
22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/support/io/SpyInputStream.java 2006-07-09
22:41:26 UTC (rev 9531)
@@ -88,7 +88,7 @@
println(".read(byte[], int, int)");
checkValid();
// FIXME remove debugging
- if(a+b > bytes.length || a < 0 || b < 0)
+ if((a+b > bytes.length) || (a < 0) || (b < 0))
throw new
ArrayIndexOutOfBoundsException("a="+a+", b="+b+", length "+bytes.length);
return in.read(bytes, a, b);
}
Modified:
trunk/freenet/src/freenet/support/math/BootstrappingDecayingRunningAverage.java
===================================================================
---
trunk/freenet/src/freenet/support/math/BootstrappingDecayingRunningAverage.java
2006-07-09 22:28:14 UTC (rev 9530)
+++
trunk/freenet/src/freenet/support/math/BootstrappingDecayingRunningAverage.java
2006-07-09 22:41:26 UTC (rev 9531)
@@ -69,8 +69,8 @@
double decayFactor = 1.0 / (Math.min(reports, maxReports));
currentValue = (d * decayFactor) +
(currentValue * (1-decayFactor));
- if(d < 0.1 && d >= 0.0) zeros++;
- if(d > 0.9 && d <= 1.0) ones++;
+ if((d < 0.1) && (d >= 0.0)) zeros++;
+ if((d > 0.9) && (d <= 1.0)) ones++;
}
public void report(long d) {
@@ -121,7 +121,7 @@
if(reports < 0)
throw new IOException("Negative reports");
currentValue = dis.readDouble();
- if(currentValue < min || currentValue > max)
+ if((currentValue < min) || (currentValue > max))
throw new IOException("Value out of range: "+currentValue);
}
Modified: trunk/freenet/src/freenet/support/math/SimpleBinaryRunningAverage.java
===================================================================
--- trunk/freenet/src/freenet/support/math/SimpleBinaryRunningAverage.java
2006-07-09 22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/support/math/SimpleBinaryRunningAverage.java
2006-07-09 22:41:26 UTC (rev 9531)
@@ -42,7 +42,7 @@
ba = new BitSet(maxSize);
totalZeros = totalOnes = index = 0;
totalReported = 0;
- if(start < 0.0 || start > 1.0) {
+ if((start < 0.0) || (start > 1.0)) {
Logger.error(this, "Illegal default value: "+start+" on
"+this,
new Exception("debug"));
start = Math.max(1.0, Math.min(0.0, start));
@@ -52,12 +52,12 @@
}
public synchronized double currentValue() {
- if(totalZeros < 0 || totalOnes < 0) {
+ if((totalZeros < 0) || (totalOnes < 0)) {
Logger.error(this, "Argh in currentValue(): "+this,
new Exception("debug"));
calculateTotalOnesZeros();
}
- if(totalZeros == 0 && totalOnes == 0)
+ if((totalZeros == 0) && (totalOnes == 0))
return defaultValue;
return ((double)totalOnes) / (double)(totalZeros + totalOnes);
}
@@ -91,7 +91,7 @@
totalZeros++;
if(logDEBUG)
Logger.debug(this, "Reported: "+value+" on "+this);
- if(totalZeros < 0 || totalOnes < 0) {
+ if((totalZeros < 0) || (totalOnes < 0)) {
Logger.error(this, "Argh in report("+value+"): "+this,
new Exception("debug"));
calculateTotalOnesZeros();
@@ -219,7 +219,7 @@
}
public boolean convert(double d) {
- if(d > 1.0 || d < 0.0) throw new
IllegalArgumentException("invalid : "+d);
+ if((d > 1.0) || (d < 0.0)) throw new
IllegalArgumentException("invalid : "+d);
if(d > 0.9) return true;
if(d < 0.1) return false;
throw new IllegalArgumentException("not one or other extreme!");
Modified: trunk/freenet/src/freenet/support/math/TimeDecayingRunningAverage.java
===================================================================
--- trunk/freenet/src/freenet/support/math/TimeDecayingRunningAverage.java
2006-07-09 22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/support/math/TimeDecayingRunningAverage.java
2006-07-09 22:41:26 UTC (rev 9531)
@@ -69,7 +69,7 @@
curValue = dis.readDouble();
if(Double.isInfinite(curValue) || Double.isNaN(curValue))
throw new IOException("Invalid weightedTotal: "+curValue);
- if(curValue < min || curValue > max)
+ if((curValue < min) || (curValue > max))
throw new IOException("Out of range: curValue = "+curValue);
started = dis.readBoolean();
long priorExperienceTime = dis.readLong();
@@ -117,7 +117,7 @@
if((uptime / 4) < thisHalfLife) thisHalfLife = (uptime / 4);
if(thisHalfLife == 0) thisHalfLife = 1;
double changeFactor =
- Math.pow(0.5, ((double)thisInterval) / thisHalfLife);
+ Math.pow(0.5, (thisInterval) / thisHalfLife);
double oldCurValue = curValue;
curValue = curValue * changeFactor /* close to 1.0 if short
interval, close to 0.0 if long interval */
+ (1.0 - changeFactor) * d;
Modified: trunk/freenet/src/freenet/transport/IPAddressDetector.java
===================================================================
--- trunk/freenet/src/freenet/transport/IPAddressDetector.java 2006-07-09
22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/freenet/transport/IPAddressDetector.java 2006-07-09
22:41:26 UTC (rev 9531)
@@ -57,8 +57,8 @@
* @return Detected ip address
*/
public InetAddress getAddress(long recheckTime, String preferedAddress)
{
- if (lastInetAddress == null
- || System.currentTimeMillis() > (lastDetectedTime +
recheckTime))
+ if ((lastInetAddress == null)
+ || (System.currentTimeMillis() > (lastDetectedTime +
recheckTime)))
checkpoint(preferedAddress);
return lastInetAddress;
}
@@ -142,8 +142,8 @@
"Finished scanning interfaces");
}
- if (preferedInetAddress == null
- && lastInetAddress != null
+ if ((preferedInetAddress == null)
+ && (lastInetAddress != null)
? isInternetAddress(lastInetAddress)
: true) //If no specific other address is
preferred then we prefer to keep our old address
preferedInetAddress = lastInetAddress;
@@ -151,7 +151,7 @@
InetAddress oldAddress = lastInetAddress;
onGetAddresses(addrs, preferedInetAddress);
lastDetectedTime = System.currentTimeMillis();
- if (oldAddress != null && lastInetAddress != null &&
+ if ((oldAddress != null) && (lastInetAddress != null) &&
!lastInetAddress.equals(oldAddress)) {
Logger.minor(
this,
@@ -230,7 +230,7 @@
addrDetected = i;
//Use the last detected valid
IP as 'detected' IP
detectedInetAddress = true;
- if (preferedInetAddress != null
+ if ((preferedInetAddress !=
null)
&& addrDetected.equals(
preferedInetAddress)) { //Prefer the specified address if it is still available
to us. Do not look for more ones
if (logDEBUG)
Modified: trunk/freenet/src/freenet/transport/IPUtil.java
===================================================================
--- trunk/freenet/src/freenet/transport/IPUtil.java 2006-07-09 22:28:14 UTC
(rev 9530)
+++ trunk/freenet/src/freenet/transport/IPUtil.java 2006-07-09 22:41:26 UTC
(rev 9531)
@@ -23,20 +23,20 @@
return false;
for (int j = 0 ; j < 4 ; j++)
- if (i[j] < 0 || i[j] > 255)
+ if ((i[j] < 0) || (i[j] > 255))
return false;
- if (i[0] == 10 || (i[0] == 172 && i[1] >= 16 && i[1] < 31)
- || (i[0] == 192 && i[1] == 168)) // local network
+ if ((i[0] == 10) || ((i[0] == 172) && (i[1] >= 16) && (i[1] < 31))
+ || ((i[0] == 192) && (i[1] == 168))) // local network
return false;
- if (i[0] == 169 && i[1] == 254)
+ if ((i[0] == 169) && (i[1] == 254))
return false; // link local
- if (i[0] == 198 && (i[1] == 18 || i[1] == 19))
+ if ((i[0] == 198) && ((i[1] == 18) || (i[1] == 19)))
return false; // RFC2544
- if (i[0] == 192 && i[1] == 0 && i[2] == 2)
+ if ((i[0] == 192) && (i[1] == 0) && (i[2] == 2))
return false; // test-net, see RFC3330
if (i[0] == 127) // loopback
@@ -45,7 +45,7 @@
if (i[0] == 0) // "this" net
return false;
- if (i[0] >= 224 && i[0] < 240)
+ if ((i[0] >= 224) && (i[0] < 240))
return false; // multicast
return true;
@@ -90,7 +90,7 @@
a = st.nextToken();
try {
int p = Integer.parseInt(st.nextToken());
- if (p < 0 || p >= (1 << 16))
+ if ((p < 0) || (p >= (1 << 16)))
return false;
} catch (NumberFormatException e) {
return false;
Modified: trunk/freenet/src/net/i2p/util/NativeBigInteger.java
===================================================================
--- trunk/freenet/src/net/i2p/util/NativeBigInteger.java 2006-07-09
22:28:14 UTC (rev 9530)
+++ trunk/freenet/src/net/i2p/util/NativeBigInteger.java 2006-07-09
22:41:26 UTC (rev 9531)
@@ -541,7 +541,7 @@
String pref = getLibraryPrefix();
String middle = getMiddleName(optimized);
String suff = getLibrarySuffix();
- if(pref == null || middle == null || suff == null)
+ if((pref == null) || (middle == null) || (suff == null))
return null;
return pname+"/"+pref+middle+"."+suff;
}