mirror of
https://github.com/zxing/zxing.git
synced 2025-03-05 20:48:51 -08:00
Various changes from IJ12.1 inspections
git-svn-id: https://zxing.googlecode.com/svn/trunk@2581 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
4b124b109d
commit
b01cff36fa
|
@ -221,7 +221,7 @@ public class IntentIntegrator {
|
|||
setTargetApplications(list);
|
||||
}
|
||||
|
||||
public void setTargetApplications(List<String> targetApplications) {
|
||||
public final void setTargetApplications(List<String> targetApplications) {
|
||||
if (targetApplications.isEmpty()) {
|
||||
throw new IllegalArgumentException("No target applications");
|
||||
}
|
||||
|
@ -236,14 +236,14 @@ public class IntentIntegrator {
|
|||
return moreExtras;
|
||||
}
|
||||
|
||||
public void addExtra(String key, Object value) {
|
||||
public final void addExtra(String key, Object value) {
|
||||
moreExtras.put(key, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initiates a scan for all known barcode types.
|
||||
*/
|
||||
public AlertDialog initiateScan() {
|
||||
public final AlertDialog initiateScan() {
|
||||
return initiateScan(ALL_CODE_TYPES);
|
||||
}
|
||||
|
||||
|
@ -255,7 +255,7 @@ public class IntentIntegrator {
|
|||
* @return the {@link AlertDialog} that was shown to the user prompting them to download the app
|
||||
* if a prompt was needed, or null otherwise
|
||||
*/
|
||||
public AlertDialog initiateScan(Collection<String> desiredBarcodeFormats) {
|
||||
public final AlertDialog initiateScan(Collection<String> desiredBarcodeFormats) {
|
||||
Intent intentScan = new Intent(BS_PACKAGE + ".SCAN");
|
||||
intentScan.addCategory(Intent.CATEGORY_DEFAULT);
|
||||
|
||||
|
@ -371,7 +371,7 @@ public class IntentIntegrator {
|
|||
* Defaults to type "TEXT_TYPE".
|
||||
* @see #shareText(CharSequence, CharSequence)
|
||||
*/
|
||||
public AlertDialog shareText(CharSequence text) {
|
||||
public final AlertDialog shareText(CharSequence text) {
|
||||
return shareText(text, "TEXT_TYPE");
|
||||
}
|
||||
|
||||
|
@ -384,7 +384,7 @@ public class IntentIntegrator {
|
|||
* @return the {@link AlertDialog} that was shown to the user prompting them to download the app
|
||||
* if a prompt was needed, or null otherwise
|
||||
*/
|
||||
public AlertDialog shareText(CharSequence text, CharSequence type) {
|
||||
public final AlertDialog shareText(CharSequence text, CharSequence type) {
|
||||
Intent intent = new Intent();
|
||||
intent.addCategory(Intent.CATEGORY_DEFAULT);
|
||||
intent.setAction(BS_PACKAGE + ".ENCODE");
|
||||
|
|
|
@ -131,7 +131,7 @@ public final class CaptureActivityHandler extends Handler {
|
|||
|
||||
try {
|
||||
activity.startActivity(intent);
|
||||
} catch (ActivityNotFoundException anfe) {
|
||||
} catch (ActivityNotFoundException ignored) {
|
||||
Log.w(TAG, "Can't find anything to handle VIEW of URI " + url);
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -23,7 +23,7 @@ package com.google.zxing.client.android.book;
|
|||
*/
|
||||
final class SearchBookContentsResult {
|
||||
|
||||
private static String query;
|
||||
private static String query = null;
|
||||
|
||||
private final String pageId;
|
||||
private final String pageNumber;
|
||||
|
|
|
@ -47,8 +47,8 @@ final class MECARDContactEncoder extends ContactEncoder {
|
|||
String url,
|
||||
String note) {
|
||||
StringBuilder newContents = new StringBuilder(100);
|
||||
StringBuilder newDisplayContents = new StringBuilder(100);
|
||||
newContents.append("MECARD:");
|
||||
StringBuilder newDisplayContents = new StringBuilder(100);
|
||||
appendUpToUnique(newContents, newDisplayContents, "N", names, 1, new Formatter() {
|
||||
@Override
|
||||
public String format(String source) {
|
||||
|
|
|
@ -181,7 +181,7 @@ final class QRCodeEncoder {
|
|||
if (bundle == null) {
|
||||
throw new WriterException("No extras");
|
||||
}
|
||||
Uri uri = (Uri) bundle.getParcelable(Intent.EXTRA_STREAM);
|
||||
Uri uri = bundle.getParcelable(Intent.EXTRA_STREAM);
|
||||
if (uri == null) {
|
||||
throw new WriterException("No EXTRA_STREAM");
|
||||
}
|
||||
|
|
|
@ -46,9 +46,9 @@ final class VCardContactEncoder extends ContactEncoder {
|
|||
String url,
|
||||
String note) {
|
||||
StringBuilder newContents = new StringBuilder(100);
|
||||
StringBuilder newDisplayContents = new StringBuilder(100);
|
||||
newContents.append("BEGIN:VCARD").append(TERMINATOR);
|
||||
newContents.append("VERSION:3.0").append(TERMINATOR);
|
||||
StringBuilder newDisplayContents = new StringBuilder(100);
|
||||
appendUpToUnique(newContents, newDisplayContents, "N", names, 1, null);
|
||||
append(newContents, newDisplayContents, "ORG", organization);
|
||||
appendUpToUnique(newContents, newDisplayContents, "ADR", addresses, 1, null);
|
||||
|
|
|
@ -267,7 +267,6 @@ public final class HistoryManager {
|
|||
* </ul>
|
||||
*/
|
||||
CharSequence buildHistory() {
|
||||
StringBuilder historyText = new StringBuilder(1000);
|
||||
SQLiteOpenHelper helper = new DBHelper(activity);
|
||||
SQLiteDatabase db = null;
|
||||
Cursor cursor = null;
|
||||
|
@ -278,6 +277,7 @@ public final class HistoryManager {
|
|||
null, null, null, null,
|
||||
DBHelper.TIMESTAMP_COL + " DESC");
|
||||
|
||||
StringBuilder historyText = new StringBuilder(1000);
|
||||
while (cursor.moveToNext()) {
|
||||
|
||||
historyText.append('"').append(massageHistoryField(cursor.getString(0))).append("\",");
|
||||
|
|
|
@ -434,7 +434,7 @@ public abstract class ResultHandler {
|
|||
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
|
||||
try {
|
||||
launchIntent(intent);
|
||||
} catch (ActivityNotFoundException anfe) {
|
||||
} catch (ActivityNotFoundException ignored) {
|
||||
Log.w(TAG, "Nothing available to handle " + intent);
|
||||
}
|
||||
}
|
||||
|
@ -491,7 +491,7 @@ public abstract class ResultHandler {
|
|||
final void launchIntent(Intent intent) {
|
||||
try {
|
||||
rawLaunchIntent(intent);
|
||||
} catch (ActivityNotFoundException e) {
|
||||
} catch (ActivityNotFoundException ignored) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
|
||||
builder.setTitle(R.string.app_name);
|
||||
builder.setMessage(R.string.msg_intent_failed);
|
||||
|
|
|
@ -65,12 +65,12 @@ public final class SMSResultHandler extends ResultHandler {
|
|||
@Override
|
||||
public CharSequence getDisplayContents() {
|
||||
SMSParsedResult smsResult = (SMSParsedResult) getResult();
|
||||
StringBuilder contents = new StringBuilder(50);
|
||||
String[] rawNumbers = smsResult.getNumbers();
|
||||
String[] formattedNumbers = new String[rawNumbers.length];
|
||||
for (int i = 0; i < rawNumbers.length; i++) {
|
||||
formattedNumbers[i] = PhoneNumberUtils.formatNumber(rawNumbers[i]);
|
||||
}
|
||||
StringBuilder contents = new StringBuilder(50);
|
||||
ParsedResult.maybeAppend(formattedNumbers, contents);
|
||||
ParsedResult.maybeAppend(smsResult.getSubject(), contents);
|
||||
ParsedResult.maybeAppend(smsResult.getBody(), contents);
|
||||
|
|
|
@ -45,7 +45,7 @@ final class URIResultInfoRetriever extends SupplementalInfoRetriever {
|
|||
URI oldURI;
|
||||
try {
|
||||
oldURI = new URI(result.getURI());
|
||||
} catch (URISyntaxException e) {
|
||||
} catch (URISyntaxException ignored) {
|
||||
return;
|
||||
}
|
||||
URI newURI = HttpHelper.unredirect(oldURI);
|
||||
|
|
|
@ -177,13 +177,12 @@ public final class ShareActivity extends Activity {
|
|||
return; // Show error?
|
||||
}
|
||||
ContentResolver resolver = getContentResolver();
|
||||
Bundle bundle = new Bundle();
|
||||
|
||||
Cursor cursor;
|
||||
try {
|
||||
// We're seeing about six reports a week of this exception although I don't understand why.
|
||||
cursor = resolver.query(contactUri, null, null, null, null);
|
||||
} catch (IllegalArgumentException e) {
|
||||
} catch (IllegalArgumentException ignored) {
|
||||
return;
|
||||
}
|
||||
if (cursor == null) {
|
||||
|
@ -208,6 +207,7 @@ public final class ShareActivity extends Activity {
|
|||
}
|
||||
|
||||
// Don't require a name to be present, this contact might be just a phone number.
|
||||
Bundle bundle = new Bundle();
|
||||
if (name != null && name.length() > 0) {
|
||||
bundle.putString(ContactsContract.Intents.Insert.NAME, massageContactData(name));
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ public final class WifiConfigManager extends AsyncTask<WifiParsedResult,Object,O
|
|||
NetworkType networkType;
|
||||
try {
|
||||
networkType = NetworkType.forIntentValue(networkTypeString);
|
||||
} catch (IllegalArgumentException iae) {
|
||||
} catch (IllegalArgumentException ignored) {
|
||||
Log.w(TAG, "Bad network type; see NetworkType values: " + networkTypeString);
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -105,7 +105,7 @@ final class BenchmarkThread implements Runnable {
|
|||
BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
|
||||
result = multiFormatReader.decodeWithState(bitmap);
|
||||
success = true;
|
||||
} catch (ReaderException e) {
|
||||
} catch (ReaderException ignored) {
|
||||
success = false;
|
||||
}
|
||||
now = Debug.threadCpuTimeNanos() - now;
|
||||
|
|
|
@ -84,7 +84,7 @@ public final class ZXingTestActivity extends Activity {
|
|||
PackageInfo info = getPackageManager().getPackageInfo(PACKAGE_NAME, 0);
|
||||
versionCode = info.versionCode;
|
||||
versionName = info.versionName;
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
} catch (PackageManager.NameNotFoundException ignored) {
|
||||
versionCode = 0;
|
||||
versionName = "unknown";
|
||||
}
|
||||
|
|
|
@ -84,6 +84,7 @@ public final class MultiFormatWriter implements Writer {
|
|||
break;
|
||||
case DATA_MATRIX:
|
||||
writer = new DataMatrixWriter();
|
||||
break;
|
||||
case AZTEC:
|
||||
writer = new AztecWriter();
|
||||
break;
|
||||
|
|
|
@ -316,7 +316,7 @@ public final class Decoder {
|
|||
try {
|
||||
ReedSolomonDecoder rsDecoder = new ReedSolomonDecoder(gf);
|
||||
rsDecoder.decode(dataWords, numECCodewords);
|
||||
} catch (ReedSolomonException rse) {
|
||||
} catch (ReedSolomonException ignored) {
|
||||
throw FormatException.getFormatInstance();
|
||||
}
|
||||
|
||||
|
|
|
@ -237,7 +237,7 @@ public final class Detector {
|
|||
try {
|
||||
ReedSolomonDecoder rsDecoder = new ReedSolomonDecoder(GenericGF.AZTEC_PARAM);
|
||||
rsDecoder.decode(parameterWords, numECCodewords);
|
||||
} catch (ReedSolomonException rse) {
|
||||
} catch (ReedSolomonException ignored) {
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,6 @@ import java.util.Map;
|
|||
import com.google.zxing.BarcodeFormat;
|
||||
import com.google.zxing.EncodeHintType;
|
||||
import com.google.zxing.Writer;
|
||||
import com.google.zxing.WriterException;
|
||||
import com.google.zxing.common.BitMatrix;
|
||||
|
||||
public final class AztecWriter implements Writer {
|
||||
|
@ -30,14 +29,13 @@ public final class AztecWriter implements Writer {
|
|||
private static final Charset LATIN_1 = Charset.forName("ISO-8859-1");
|
||||
|
||||
@Override
|
||||
public BitMatrix encode(String contents, BarcodeFormat format, int width, int height) throws WriterException {
|
||||
public BitMatrix encode(String contents, BarcodeFormat format, int width, int height) {
|
||||
AztecCode aztec = Encoder.encode(contents.getBytes(LATIN_1), 30);
|
||||
return aztec.getMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BitMatrix encode(String contents, BarcodeFormat format, int width, int height, Map<EncodeHintType, ?> hints)
|
||||
throws WriterException {
|
||||
public BitMatrix encode(String contents, BarcodeFormat format, int width, int height, Map<EncodeHintType, ?> hints) {
|
||||
return encode(contents, format, width, height);
|
||||
}
|
||||
|
||||
|
|
|
@ -138,7 +138,6 @@ public final class Encoder {
|
|||
* @return Aztec symbol matrix with metadata
|
||||
*/
|
||||
public static AztecCode encode(byte[] data, int minECCPercent) {
|
||||
AztecCode aztec = new AztecCode();
|
||||
|
||||
// High-level encode
|
||||
BitArray bits = highLevelEncode(data);
|
||||
|
@ -266,6 +265,7 @@ public final class Encoder {
|
|||
}
|
||||
}
|
||||
|
||||
AztecCode aztec = new AztecCode();
|
||||
aztec.setCompact(compact);
|
||||
aztec.setSize(matrixSize);
|
||||
aztec.setLayers(layers);
|
||||
|
|
|
@ -151,7 +151,6 @@ public final class ExpandedProductResultParser extends ResultParser {
|
|||
}
|
||||
|
||||
private static String findAIvalue(int i, String rawText) {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
char c = rawText.charAt(i);
|
||||
// First character must be a open parenthesis.If not, ERROR
|
||||
if (c != '(') {
|
||||
|
@ -160,6 +159,7 @@ public final class ExpandedProductResultParser extends ResultParser {
|
|||
|
||||
String rawTextAux = rawText.substring(i + 1);
|
||||
|
||||
StringBuilder buf = new StringBuilder();
|
||||
for (int index = 0; index < rawTextAux.length(); index++) {
|
||||
char currentChar = rawTextAux.charAt(index);
|
||||
if (currentChar == ')') {
|
||||
|
|
|
@ -64,7 +64,7 @@ public final class GeoResultParser extends ResultParser {
|
|||
return null;
|
||||
}
|
||||
}
|
||||
} catch (NumberFormatException nfe) {
|
||||
} catch (NumberFormatException ignored) {
|
||||
return null;
|
||||
}
|
||||
return new GeoParsedResult(latitude, longitude, altitude, query);
|
||||
|
|
|
@ -65,7 +65,7 @@ public final class VEventResultParser extends ResultParser {
|
|||
try {
|
||||
latitude = Double.parseDouble(geoString.substring(0, semicolon));
|
||||
longitude = Double.parseDouble(geoString.substring(semicolon + 1));
|
||||
} catch (NumberFormatException nfe) {
|
||||
} catch (NumberFormatException ignored) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ public final class VEventResultParser extends ResultParser {
|
|||
description,
|
||||
latitude,
|
||||
longitude);
|
||||
} catch (IllegalArgumentException iae) {
|
||||
} catch (IllegalArgumentException ignored) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -123,7 +123,7 @@ public final class Decoder {
|
|||
int numECCodewords = codewordBytes.length - numDataCodewords;
|
||||
try {
|
||||
rsDecoder.decode(codewordsInts, numECCodewords);
|
||||
} catch (ReedSolomonException rse) {
|
||||
} catch (ReedSolomonException ignored) {
|
||||
throw ChecksumException.getChecksumInstance();
|
||||
}
|
||||
// Copy back into array of bytes -- only need to worry about the bytes that were data
|
||||
|
|
|
@ -111,9 +111,8 @@ class C40Encoder implements Encoder {
|
|||
}
|
||||
if (context.hasMoreCharacters()) {
|
||||
context.writeCodeword(HighLevelEncoder.C40_UNLATCH);
|
||||
} else {
|
||||
//No unlatch
|
||||
}
|
||||
// else no unlatch
|
||||
context.pos--;
|
||||
} else if (rest == 0) {
|
||||
while (buffer.length() >= 3) {
|
||||
|
|
|
@ -99,7 +99,7 @@ public final class Decoder {
|
|||
}
|
||||
try {
|
||||
rsDecoder.decode(codewordsInts, ecCodewords / divisor);
|
||||
} catch (ReedSolomonException rse) {
|
||||
} catch (ReedSolomonException ignored) {
|
||||
throw ChecksumException.getChecksumInstance();
|
||||
}
|
||||
// Copy back into array of bytes -- only need to worry about the bytes that were data
|
||||
|
|
|
@ -76,7 +76,7 @@ public final class GenericMultipleBarcodeReader implements MultipleBarcodeReader
|
|||
Result result;
|
||||
try {
|
||||
result = delegate.decode(image, hints);
|
||||
} catch (ReaderException re) {
|
||||
} catch (ReaderException ignored) {
|
||||
return;
|
||||
}
|
||||
boolean alreadyFound = false;
|
||||
|
|
|
@ -60,7 +60,7 @@ public final class EAN13Writer extends UPCEANWriter {
|
|||
if (!UPCEANReader.checkStandardUPCEANChecksum(contents)) {
|
||||
throw new IllegalArgumentException("Contents do not pass checksum");
|
||||
}
|
||||
} catch (FormatException fe) {
|
||||
} catch (FormatException ignored) {
|
||||
throw new IllegalArgumentException("Illegal contents");
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ import java.util.Map;
|
|||
* <p>Implements decoding of the ITF format, or Interleaved Two of Five.</p>
|
||||
*
|
||||
* <p>This Reader will scan ITF barcodes of certain lengths only.
|
||||
* At the moment it reads length 6, 10, 12, 14, 16, 24, and 44 as these have appeared "in the wild". Not all
|
||||
* At the moment it reads length 6, 8, 10, 12, 14, 16, 18, 20, 24, and 44 as these have appeared "in the wild". Not all
|
||||
* lengths are scanned, especially shorter ones, to avoid false positives. This in turn is due to a lack of
|
||||
* required checksum function.</p>
|
||||
*
|
||||
|
|
|
@ -63,7 +63,7 @@ public final class ITFWriter extends OneDimensionalCodeWriter {
|
|||
int two = Character.digit(contents.charAt(i+1), 10);
|
||||
int[] encoding = new int[18];
|
||||
for (int j = 0; j < 5; j++) {
|
||||
encoding[(j << 1)] = ITFReader.PATTERNS[one][j];
|
||||
encoding[j << 1] = ITFReader.PATTERNS[one][j];
|
||||
encoding[(j << 1) + 1] = ITFReader.PATTERNS[two][j];
|
||||
}
|
||||
pos += appendPattern(result, pos, encoding, true);
|
||||
|
|
|
@ -75,7 +75,7 @@ public final class MultiFormatUPCEANReader extends OneDReader {
|
|||
Result result;
|
||||
try {
|
||||
result = reader.decodeRow(rowNumber, row, startGuardPattern, hints);
|
||||
} catch (ReaderException re) {
|
||||
} catch (ReaderException ignored) {
|
||||
continue;
|
||||
}
|
||||
// Special case: a 12-digit code encoded in UPC-A is identical to a "0"
|
||||
|
|
|
@ -133,7 +133,7 @@ public abstract class OneDReader implements Reader {
|
|||
// Estimate black point for this row and load it:
|
||||
try {
|
||||
row = image.getBlackRow(rowNumber, row);
|
||||
} catch (NotFoundException nfe) {
|
||||
} catch (NotFoundException ignored) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ import java.util.Map;
|
|||
public abstract class OneDimensionalCodeWriter implements Writer {
|
||||
|
||||
@Override
|
||||
public BitMatrix encode(String contents, BarcodeFormat format, int width, int height)
|
||||
public final BitMatrix encode(String contents, BarcodeFormat format, int width, int height)
|
||||
throws WriterException {
|
||||
return encode(contents, format, width, height, null);
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ final class UPCEANExtensionSupport {
|
|||
int[] extensionStartRange = UPCEANReader.findGuardPattern(row, rowOffset, false, EXTENSION_START_PATTERN);
|
||||
try {
|
||||
return fiveSupport.decodeRow(rowNumber, row, extensionStartRange);
|
||||
} catch (ReaderException re) {
|
||||
} catch (ReaderException ignored) {
|
||||
return twoSupport.decodeRow(rowNumber, row, extensionStartRange);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,12 +35,12 @@ public class DataCharacter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
public final String toString() {
|
||||
return value + "(" + checksumPortion + ')';
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
public final boolean equals(Object o) {
|
||||
if(!(o instanceof DataCharacter)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ public class DataCharacter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
public final int hashCode() {
|
||||
return value ^ checksumPortion;
|
||||
}
|
||||
|
||||
|
|
|
@ -143,11 +143,11 @@ public final class RSS14Reader extends AbstractRSSReader {
|
|||
}
|
||||
|
||||
private static boolean checkChecksum(Pair leftPair, Pair rightPair) {
|
||||
int leftFPValue = leftPair.getFinderPattern().getValue();
|
||||
int rightFPValue = rightPair.getFinderPattern().getValue();
|
||||
if ((leftFPValue == 0 && rightFPValue == 8) ||
|
||||
(leftFPValue == 8 && rightFPValue == 0)) {
|
||||
}
|
||||
//int leftFPValue = leftPair.getFinderPattern().getValue();
|
||||
//int rightFPValue = rightPair.getFinderPattern().getValue();
|
||||
//if ((leftFPValue == 0 && rightFPValue == 8) ||
|
||||
// (leftFPValue == 8 && rightFPValue == 0)) {
|
||||
//}
|
||||
int checkValue = (leftPair.getChecksumPortion() + 16 * rightPair.getChecksumPortion()) % 79;
|
||||
int targetCheckValue =
|
||||
9 * leftPair.getFinderPattern().getValue() + rightPair.getFinderPattern().getValue();
|
||||
|
@ -182,7 +182,7 @@ public final class RSS14Reader extends AbstractRSSReader {
|
|||
return new Pair(1597 * outside.getValue() + inside.getValue(),
|
||||
outside.getChecksumPortion() + 4 * inside.getChecksumPortion(),
|
||||
pattern);
|
||||
} catch (NotFoundException re) {
|
||||
} catch (NotFoundException ignored) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -241,7 +241,6 @@ public final class RSSExpandedReader extends AbstractRSSReader {
|
|||
return checkRows(rs, i + 1);
|
||||
} catch (NotFoundException e) {
|
||||
// We failed, try the next candidate
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -456,7 +455,7 @@ public final class RSSExpandedReader extends AbstractRSSReader {
|
|||
DataCharacter rightChar;
|
||||
try {
|
||||
rightChar = this.decodeDataCharacter(row, pattern, isOddPattern, false);
|
||||
} catch(NotFoundException nfe) {
|
||||
} catch(NotFoundException ignored) {
|
||||
rightChar = null;
|
||||
}
|
||||
boolean mayBeLast = true;
|
||||
|
@ -579,7 +578,7 @@ public final class RSSExpandedReader extends AbstractRSSReader {
|
|||
int value;
|
||||
try {
|
||||
value = parseFinderValue(counters, FINDER_PATTERNS);
|
||||
} catch (NotFoundException nfe) {
|
||||
} catch (NotFoundException ignored) {
|
||||
return null;
|
||||
}
|
||||
return new FinderPattern(value, new int[] {start, end}, start, end, rowNumber);
|
||||
|
|
|
@ -46,7 +46,7 @@ public class QRCodeReader implements Reader {
|
|||
|
||||
private final Decoder decoder = new Decoder();
|
||||
|
||||
protected Decoder getDecoder() {
|
||||
protected final Decoder getDecoder() {
|
||||
return decoder;
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ public class QRCodeReader implements Reader {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Result decode(BinaryBitmap image, Map<DecodeHintType,?> hints)
|
||||
public final Result decode(BinaryBitmap image, Map<DecodeHintType,?> hints)
|
||||
throws NotFoundException, ChecksumException, FormatException {
|
||||
DecoderResult decoderResult;
|
||||
ResultPoint[] points;
|
||||
|
|
|
@ -163,7 +163,7 @@ final class DecodedBitStreamParser {
|
|||
|
||||
try {
|
||||
result.append(new String(buffer, StringUtils.GB2312));
|
||||
} catch (UnsupportedEncodingException uee) {
|
||||
} catch (UnsupportedEncodingException ignored) {
|
||||
throw FormatException.getFormatInstance();
|
||||
}
|
||||
}
|
||||
|
@ -199,7 +199,7 @@ final class DecodedBitStreamParser {
|
|||
// Shift_JIS may not be supported in some environments:
|
||||
try {
|
||||
result.append(new String(buffer, StringUtils.SHIFT_JIS));
|
||||
} catch (UnsupportedEncodingException uee) {
|
||||
} catch (UnsupportedEncodingException ignored) {
|
||||
throw FormatException.getFormatInstance();
|
||||
}
|
||||
}
|
||||
|
@ -232,7 +232,7 @@ final class DecodedBitStreamParser {
|
|||
}
|
||||
try {
|
||||
result.append(new String(readBytes, encoding));
|
||||
} catch (UnsupportedEncodingException uce) {
|
||||
} catch (UnsupportedEncodingException ignored) {
|
||||
throw FormatException.getFormatInstance();
|
||||
}
|
||||
byteSegments.add(readBytes);
|
||||
|
|
|
@ -133,7 +133,7 @@ public final class Decoder {
|
|||
int numECCodewords = codewordBytes.length - numDataCodewords;
|
||||
try {
|
||||
rsDecoder.decode(codewordsInts, numECCodewords);
|
||||
} catch (ReedSolomonException rse) {
|
||||
} catch (ReedSolomonException ignored) {
|
||||
throw ChecksumException.getChecksumInstance();
|
||||
}
|
||||
// Copy back into array of bytes -- only need to worry about the bytes that were data
|
||||
|
|
|
@ -95,7 +95,7 @@ public final class Version {
|
|||
}
|
||||
try {
|
||||
return getVersionForNumber((dimension - 17) >> 2);
|
||||
} catch (IllegalArgumentException iae) {
|
||||
} catch (IllegalArgumentException ignored) {
|
||||
throw FormatException.getFormatInstance();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -214,7 +214,7 @@ public final class Encoder {
|
|||
byte[] bytes;
|
||||
try {
|
||||
bytes = content.getBytes("Shift_JIS");
|
||||
} catch (UnsupportedEncodingException uee) {
|
||||
} catch (UnsupportedEncodingException ignored) {
|
||||
return false;
|
||||
}
|
||||
int length = bytes.length;
|
||||
|
|
|
@ -179,7 +179,7 @@ public abstract class AbstractBlackBoxTestCase extends Assert {
|
|||
} else {
|
||||
misreadCounts[x]++;
|
||||
}
|
||||
} catch (ReaderException re) {
|
||||
} catch (ReaderException ignored) {
|
||||
log.fine(String.format("could not read at rotation %f", rotation));
|
||||
}
|
||||
try {
|
||||
|
@ -188,7 +188,7 @@ public abstract class AbstractBlackBoxTestCase extends Assert {
|
|||
} else {
|
||||
tryHaderMisreadCounts[x]++;
|
||||
}
|
||||
} catch (ReaderException re) {
|
||||
} catch (ReaderException ignored) {
|
||||
log.fine(String.format("could not read at rotation %f w/TH", rotation));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ public abstract class AbstractNegativeBlackBoxTestCase extends AbstractBlackBoxT
|
|||
testResults = new ArrayList<TestResult>();
|
||||
}
|
||||
|
||||
protected void addTest(int falsePositivesAllowed, float rotation) {
|
||||
protected final void addTest(int falsePositivesAllowed, float rotation) {
|
||||
testResults.add(new TestResult(falsePositivesAllowed, rotation));
|
||||
}
|
||||
|
||||
|
|
|
@ -34,12 +34,12 @@ public final class DataMatrixWriterTestCase extends Assert {
|
|||
|
||||
@Test
|
||||
public void testDataMatrixImageWriter() {
|
||||
DataMatrixWriter writer = new DataMatrixWriter();
|
||||
|
||||
Map<EncodeHintType,Object> hints = new EnumMap<EncodeHintType,Object>(EncodeHintType.class);
|
||||
hints.put(EncodeHintType.DATA_MATRIX_SHAPE, SymbolShapeHint.FORCE_SQUARE);
|
||||
|
||||
int bigEnough = 64;
|
||||
DataMatrixWriter writer = new DataMatrixWriter();
|
||||
BitMatrix matrix = writer.encode("Hello Google", BarcodeFormat.DATA_MATRIX, bigEnough, bigEnough, hints);
|
||||
assertNotNull(matrix);
|
||||
assertTrue(bigEnough >= matrix.getWidth());
|
||||
|
@ -48,12 +48,12 @@ public final class DataMatrixWriterTestCase extends Assert {
|
|||
|
||||
@Test
|
||||
public void testDataMatrixWriter() {
|
||||
DataMatrixWriter writer = new DataMatrixWriter();
|
||||
|
||||
Map<EncodeHintType,Object> hints = new EnumMap<EncodeHintType,Object>(EncodeHintType.class);
|
||||
hints.put(EncodeHintType.DATA_MATRIX_SHAPE, SymbolShapeHint.FORCE_SQUARE);
|
||||
|
||||
int bigEnough = 14;
|
||||
DataMatrixWriter writer = new DataMatrixWriter();
|
||||
BitMatrix matrix = writer.encode("Hello Me", BarcodeFormat.DATA_MATRIX, bigEnough, bigEnough, hints);
|
||||
assertNotNull(matrix);
|
||||
assertEquals(bigEnough, matrix.getWidth());
|
||||
|
|
|
@ -223,7 +223,6 @@ public final class RSSExpandedImage2binaryTestCase extends Assert {
|
|||
}
|
||||
|
||||
private static void assertCorrectImage2binary(String path, String expected) throws IOException, NotFoundException {
|
||||
RSSExpandedReader rssExpandedReader = new RSSExpandedReader();
|
||||
|
||||
File file = new File(path);
|
||||
if (!file.exists()) {
|
||||
|
@ -238,6 +237,7 @@ public final class RSSExpandedImage2binaryTestCase extends Assert {
|
|||
|
||||
List<ExpandedPair> pairs;
|
||||
try {
|
||||
RSSExpandedReader rssExpandedReader = new RSSExpandedReader();
|
||||
pairs = rssExpandedReader.decodeRow2pairs(rowNumber, row);
|
||||
} catch (ReaderException re) {
|
||||
fail(re.toString());
|
||||
|
|
|
@ -76,7 +76,6 @@ public final class RSSExpandedImage2resultTestCase extends Assert {
|
|||
|
||||
private static void assertCorrectImage2result(String path, ExpandedProductParsedResult expected)
|
||||
throws IOException, NotFoundException {
|
||||
RSSExpandedReader rssExpandedReader = new RSSExpandedReader();
|
||||
|
||||
File file = new File(path);
|
||||
if (!file.exists()) {
|
||||
|
@ -91,6 +90,7 @@ public final class RSSExpandedImage2resultTestCase extends Assert {
|
|||
|
||||
Result theResult;
|
||||
try {
|
||||
RSSExpandedReader rssExpandedReader = new RSSExpandedReader();
|
||||
theResult = rssExpandedReader.decodeRow(rowNumber, row, null);
|
||||
} catch (ReaderException re) {
|
||||
fail(re.toString());
|
||||
|
|
|
@ -266,7 +266,6 @@ public final class RSSExpandedImage2stringTestCase extends Assert {
|
|||
}
|
||||
|
||||
private static void assertCorrectImage2string(String path, String expected) throws IOException, NotFoundException {
|
||||
RSSExpandedReader rssExpandedReader = new RSSExpandedReader();
|
||||
|
||||
File file = new File(path);
|
||||
if (!file.exists()) {
|
||||
|
@ -281,6 +280,7 @@ public final class RSSExpandedImage2stringTestCase extends Assert {
|
|||
|
||||
Result result;
|
||||
try {
|
||||
RSSExpandedReader rssExpandedReader = new RSSExpandedReader();
|
||||
result = rssExpandedReader.decodeRow(rowNumber, row, null);
|
||||
} catch (ReaderException re) {
|
||||
fail(re.toString());
|
||||
|
|
|
@ -52,7 +52,6 @@ public final class RSSExpandedInternalTestCase extends Assert {
|
|||
|
||||
@Test
|
||||
public void testFindFinderPatterns() throws Exception {
|
||||
RSSExpandedReader rssExpandedReader = new RSSExpandedReader();
|
||||
|
||||
String path = "test/data/blackbox/rssexpanded-1/2.png";
|
||||
File file = new File(path);
|
||||
|
@ -67,6 +66,7 @@ public final class RSSExpandedInternalTestCase extends Assert {
|
|||
BitArray row = binaryMap.getBlackRow(rowNumber, null);
|
||||
List<ExpandedPair> previousPairs = new ArrayList<ExpandedPair>();
|
||||
|
||||
RSSExpandedReader rssExpandedReader = new RSSExpandedReader();
|
||||
ExpandedPair pair1 = rssExpandedReader.retrieveNextPair(row, previousPairs, rowNumber);
|
||||
previousPairs.add(pair1);
|
||||
FinderPattern finderPattern = pair1.getFinderPattern();
|
||||
|
@ -96,7 +96,6 @@ public final class RSSExpandedInternalTestCase extends Assert {
|
|||
|
||||
@Test
|
||||
public void testRetrieveNextPairPatterns() throws Exception {
|
||||
RSSExpandedReader rssExpandedReader = new RSSExpandedReader();
|
||||
|
||||
String path = "test/data/blackbox/rssexpanded-1/3.png";
|
||||
File file = new File(path);
|
||||
|
@ -111,6 +110,7 @@ public final class RSSExpandedInternalTestCase extends Assert {
|
|||
BitArray row = binaryMap.getBlackRow(rowNumber, null);
|
||||
List<ExpandedPair> previousPairs = new ArrayList<ExpandedPair>();
|
||||
|
||||
RSSExpandedReader rssExpandedReader = new RSSExpandedReader();
|
||||
ExpandedPair pair1 = rssExpandedReader.retrieveNextPair(row, previousPairs, rowNumber);
|
||||
previousPairs.add(pair1);
|
||||
FinderPattern finderPattern = pair1.getFinderPattern();
|
||||
|
@ -126,7 +126,6 @@ public final class RSSExpandedInternalTestCase extends Assert {
|
|||
|
||||
@Test
|
||||
public void testDecodeCheckCharacter() throws Exception {
|
||||
RSSExpandedReader rssExpandedReader = new RSSExpandedReader();
|
||||
|
||||
String path = "test/data/blackbox/rssexpanded-1/3.png";
|
||||
File file = new File(path);
|
||||
|
@ -143,6 +142,7 @@ public final class RSSExpandedInternalTestCase extends Assert {
|
|||
int value = 0;// A
|
||||
FinderPattern finderPatternA1 = new FinderPattern(value, startEnd, startEnd[0], startEnd[1], image.getHeight() / 2);
|
||||
//{1, 8, 4, 1, 1};
|
||||
RSSExpandedReader rssExpandedReader = new RSSExpandedReader();
|
||||
DataCharacter dataCharacter = rssExpandedReader.decodeDataCharacter(row, finderPatternA1, true, true);
|
||||
|
||||
assertEquals(98, dataCharacter.getValue());
|
||||
|
@ -150,7 +150,6 @@ public final class RSSExpandedInternalTestCase extends Assert {
|
|||
|
||||
@Test
|
||||
public void testDecodeDataCharacter() throws Exception {
|
||||
RSSExpandedReader rssExpandedReader = new RSSExpandedReader();
|
||||
|
||||
String path = "test/data/blackbox/rssexpanded-1/3.png";
|
||||
File file = new File(path);
|
||||
|
@ -167,6 +166,7 @@ public final class RSSExpandedInternalTestCase extends Assert {
|
|||
int value = 0; // A
|
||||
FinderPattern finderPatternA1 = new FinderPattern(value, startEnd, startEnd[0], startEnd[1], image.getHeight() / 2);
|
||||
//{1, 8, 4, 1, 1};
|
||||
RSSExpandedReader rssExpandedReader = new RSSExpandedReader();
|
||||
DataCharacter dataCharacter = rssExpandedReader.decodeDataCharacter(row, finderPatternA1, true, false);
|
||||
|
||||
assertEquals(19, dataCharacter.getValue());
|
||||
|
|
|
@ -41,7 +41,7 @@ final class TestCaseUtil {
|
|||
private TestCaseUtil() {
|
||||
}
|
||||
|
||||
static BufferedImage getBufferedImage(String path) throws IOException {
|
||||
private static BufferedImage getBufferedImage(String path) throws IOException {
|
||||
File file = new File(path);
|
||||
if (!file.exists()) {
|
||||
// Support running from project root too
|
||||
|
|
|
@ -110,9 +110,9 @@ public final class QRCodeWriterTestCase extends Assert {
|
|||
BitMatrix goldenResult = createMatrixFromImage(image);
|
||||
assertNotNull(goldenResult);
|
||||
|
||||
QRCodeWriter writer = new QRCodeWriter();
|
||||
Map<EncodeHintType,Object> hints = new EnumMap<EncodeHintType,Object>(EncodeHintType.class);
|
||||
hints.put(EncodeHintType.ERROR_CORRECTION, ecLevel);
|
||||
QRCodeWriter writer = new QRCodeWriter();
|
||||
BitMatrix generatedResult = writer.encode(contents, BarcodeFormat.QR_CODE, resolution,
|
||||
resolution, hints);
|
||||
|
||||
|
|
|
@ -455,9 +455,8 @@ public final class EncoderTestCase extends Assert {
|
|||
}
|
||||
{
|
||||
// Invalid data.
|
||||
BitArray bits = new BitArray();
|
||||
try {
|
||||
Encoder.appendAlphanumericBytes("abc", bits);
|
||||
Encoder.appendAlphanumericBytes("abc", new BitArray());
|
||||
} catch (WriterException we) {
|
||||
// good
|
||||
}
|
||||
|
|
|
@ -189,10 +189,10 @@ public final class MatrixUtilTestCase extends Assert {
|
|||
@Test
|
||||
public void testEmbedDataBits() throws WriterException {
|
||||
// Cells other than basic patterns should be filled with zero.
|
||||
BitArray bits = new BitArray();
|
||||
ByteMatrix matrix = new ByteMatrix(21, 21);
|
||||
MatrixUtil.clearMatrix(matrix);
|
||||
MatrixUtil.embedBasicPatterns(Version.getVersionForNumber(1), matrix);
|
||||
BitArray bits = new BitArray();
|
||||
MatrixUtil.embedDataBits(bits, -1, matrix);
|
||||
String expected =
|
||||
" 1 1 1 1 1 1 1 0 0 0 0 0 0 0 1 1 1 1 1 1 1\n" +
|
||||
|
|
|
@ -221,11 +221,11 @@ public final class StringsResourceTranslator {
|
|||
}
|
||||
|
||||
private static SortedMap<String,String> readLines(File file) throws IOException {
|
||||
SortedMap<String,String> entries = new TreeMap<String,String>();
|
||||
BufferedReader reader = null;
|
||||
try {
|
||||
reader = new BufferedReader(new InputStreamReader(new FileInputStream(file), UTF8));
|
||||
String line;
|
||||
SortedMap<String,String> entries = new TreeMap<String,String>();
|
||||
while ((line = reader.readLine()) != null) {
|
||||
Matcher m = ENTRY_PATTERN.matcher(line);
|
||||
if (m.find()) {
|
||||
|
|
|
@ -55,7 +55,6 @@ public final class CommandLineRunner {
|
|||
}
|
||||
|
||||
Config config = new Config();
|
||||
Queue<String> inputs = new ConcurrentLinkedQueue<String>();
|
||||
|
||||
for (String arg : args) {
|
||||
if ("--try_harder".equals(arg)) {
|
||||
|
@ -89,6 +88,7 @@ public final class CommandLineRunner {
|
|||
}
|
||||
config.setHints(buildHints(config));
|
||||
|
||||
Queue<String> inputs = new ConcurrentLinkedQueue<String>();
|
||||
for (String arg : args) {
|
||||
if (!arg.startsWith("--")) {
|
||||
addArgumentToInputs(arg, config, inputs);
|
||||
|
@ -150,7 +150,6 @@ public final class CommandLineRunner {
|
|||
|
||||
// Manually turn on all formats, even those not yet considered production quality.
|
||||
private static Map<DecodeHintType,?> buildHints(Config config) {
|
||||
Map<DecodeHintType, Object> hints = new EnumMap<DecodeHintType,Object>(DecodeHintType.class);
|
||||
Collection<BarcodeFormat> vector = new ArrayList<BarcodeFormat>(8);
|
||||
vector.add(BarcodeFormat.UPC_A);
|
||||
vector.add(BarcodeFormat.UPC_E);
|
||||
|
@ -170,6 +169,7 @@ public final class CommandLineRunner {
|
|||
vector.add(BarcodeFormat.CODABAR);
|
||||
vector.add(BarcodeFormat.MAXICODE);
|
||||
}
|
||||
Map<DecodeHintType, Object> hints = new EnumMap<DecodeHintType, Object>(DecodeHintType.class);
|
||||
hints.put(DecodeHintType.POSSIBLE_FORMATS, vector);
|
||||
if (config.isTryHarder()) {
|
||||
hints.put(DecodeHintType.TRY_HARDER, Boolean.TRUE);
|
||||
|
|
|
@ -140,7 +140,7 @@ final class DecodeWorker implements Callable<Integer> {
|
|||
BufferedImage image;
|
||||
try {
|
||||
image = ImageIO.read(uri.toURL());
|
||||
} catch (IllegalArgumentException iae) {
|
||||
} catch (IllegalArgumentException ignored) {
|
||||
throw new FileNotFoundException("Resource not found: " + uri);
|
||||
}
|
||||
if (image == null) {
|
||||
|
@ -176,7 +176,7 @@ final class DecodeWorker implements Callable<Integer> {
|
|||
}
|
||||
|
||||
return result;
|
||||
} catch (NotFoundException nfe) {
|
||||
} catch (NotFoundException ignored) {
|
||||
System.out.println(uri.toString() + ": No barcode found");
|
||||
return null;
|
||||
}
|
||||
|
@ -186,7 +186,7 @@ final class DecodeWorker implements Callable<Integer> {
|
|||
BufferedImage image;
|
||||
try {
|
||||
image = ImageIO.read(uri.toURL());
|
||||
} catch (IllegalArgumentException iae) {
|
||||
} catch (IllegalArgumentException ignored) {
|
||||
throw new FileNotFoundException("Resource not found: " + uri);
|
||||
}
|
||||
if (image == null) {
|
||||
|
@ -229,7 +229,7 @@ final class DecodeWorker implements Callable<Integer> {
|
|||
}
|
||||
}
|
||||
return results;
|
||||
} catch (NotFoundException nfe) {
|
||||
} catch (NotFoundException ignored) {
|
||||
System.out.println(uri.toString() + ": No barcode found");
|
||||
return null;
|
||||
}
|
||||
|
@ -296,7 +296,8 @@ final class DecodeWorker implements Callable<Integer> {
|
|||
}
|
||||
}
|
||||
}
|
||||
} catch (NotFoundException nfe) {
|
||||
} catch (NotFoundException ignored) {
|
||||
// continue
|
||||
}
|
||||
|
||||
writeResultImage(stride, height, pixels, uri, inputName, ".mono.png");
|
||||
|
@ -331,9 +332,9 @@ final class DecodeWorker implements Callable<Integer> {
|
|||
if (!ImageIO.write(result, "png", outStream)) {
|
||||
System.err.println("Could not encode an image to " + resultName);
|
||||
}
|
||||
} catch (FileNotFoundException e) {
|
||||
} catch (FileNotFoundException ignored) {
|
||||
System.err.println("Could not create " + resultName);
|
||||
} catch (IOException e) {
|
||||
} catch (IOException ignored) {
|
||||
System.err.println("Could not write to " + resultName);
|
||||
} finally {
|
||||
try {
|
||||
|
|
|
@ -63,17 +63,17 @@ public final class Generator implements EntryPoint {
|
|||
public void onModuleLoad() {
|
||||
loadGenerators();
|
||||
|
||||
HorizontalPanel mainPanel = new HorizontalPanel();
|
||||
setupLeftPanel();
|
||||
topPanel.getElement().setId("leftpanel");
|
||||
Widget leftPanel = topPanel;
|
||||
|
||||
HorizontalPanel mainPanel = new HorizontalPanel();
|
||||
mainPanel.add(leftPanel);
|
||||
|
||||
SimplePanel div = new SimplePanel();
|
||||
SimplePanel div2 = new SimplePanel();
|
||||
div2.add(result);
|
||||
div2.getElement().setId("innerresult");
|
||||
SimplePanel div = new SimplePanel();
|
||||
div.add(div2);
|
||||
div.getElement().setId("imageresult");
|
||||
|
||||
|
|
|
@ -12,12 +12,12 @@
|
|||
<h1>Zebra Crossing <span>from the ZXing Project</span></h1>
|
||||
</div>
|
||||
|
||||
<table width="600" cellpadding="4" cellspacing="8">
|
||||
<table style="width:600px">
|
||||
<tr>
|
||||
<td valign="top">
|
||||
<img src="/zxingicon.png" width="128" height="128"/>
|
||||
<td style="vertical-align:top;padding:4px;margin:8px">
|
||||
<img src="/zxingicon.png" width="128" height="128" alt="ZXing"/>
|
||||
</td>
|
||||
<td valign="top">
|
||||
<td style="vertical-align:top;padding:4px;margin:8px">
|
||||
<p>Welcome to the Zebra Crossing site at zxing.appspot.com.</p>
|
||||
<p> This site features a <a href="/generator">QR Code Generator</a>, which
|
||||
allows you to create a two-dimensional barcode that can be scanned
|
||||
|
|
|
@ -12,12 +12,12 @@
|
|||
<h1>Zebra Crossing <span>from the ZXing Project</span></h1>
|
||||
</div>
|
||||
|
||||
<table cellpadding="4" cellspacing="8">
|
||||
<table>
|
||||
<tr>
|
||||
<td valign="top">
|
||||
<img src="/zxingiconsmall.png" width="48" height="48"/>
|
||||
<td style="vertical-align:top;padding:4px;margin:8px">
|
||||
<img src="/zxingiconsmall.png" width="48" height="48" alt="ZXing"/>
|
||||
</td>
|
||||
<td valign="top">
|
||||
<td style="vertical-align:top;padding:4px;margin:8px">
|
||||
<p>A web page you are viewing would like to scan a barcode with your camera phone. To do
|
||||
this, you need to install a new application.</p>
|
||||
<p>If you are using an Android device,
|
||||
|
@ -44,7 +44,7 @@
|
|||
tail = query.indexOf ( "&" , head );
|
||||
if (tail < 0)
|
||||
tail = query.length;
|
||||
return unescape(query.substring(head, tail));
|
||||
return decodeURIComponent(query.substring(head, tail));
|
||||
}
|
||||
function process(form) {
|
||||
if (window.ret == null)
|
||||
|
|
|
@ -122,11 +122,11 @@ public final class DecodeServlet extends HttpServlet {
|
|||
URL imageURL;
|
||||
try {
|
||||
imageURL = new URI(imageURIString).toURL();
|
||||
} catch (URISyntaxException urise) {
|
||||
} catch (URISyntaxException ignored) {
|
||||
log.info("URI was not valid: " + imageURIString);
|
||||
response.sendRedirect("badurl.jspx");
|
||||
return;
|
||||
} catch (MalformedURLException mue) {
|
||||
} catch (MalformedURLException ignored) {
|
||||
log.info("URI was not valid: " + imageURIString);
|
||||
response.sendRedirect("badurl.jspx");
|
||||
return;
|
||||
|
@ -135,7 +135,7 @@ public final class DecodeServlet extends HttpServlet {
|
|||
HttpURLConnection connection;
|
||||
try {
|
||||
connection = (HttpURLConnection) imageURL.openConnection();
|
||||
} catch (IllegalArgumentException iae) {
|
||||
} catch (IllegalArgumentException ignored) {
|
||||
log.info("URI could not be opened: " + imageURL);
|
||||
response.sendRedirect("badurl.jspx");
|
||||
return;
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
<jsp:directive.page session="false"/>
|
||||
<script type="text/javascript">
|
||||
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
|
||||
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
|
||||
document.write(decodeURIComponent("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
var pageTracker = _gat._getTracker("UA-788492-5");
|
||||
|
|
Loading…
Reference in a new issue