Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/scripts/generate-quality-report.py
Original file line number Diff line number Diff line change
Expand Up @@ -908,7 +908,9 @@ def _is_exempt(f: Finding) -> bool:
"MissingOverride",
"ControlStatementBraces",
"UnnecessaryFullyQualifiedName",
"UseCollectionIsEmpty"
"UseCollectionIsEmpty",
"UnusedPrivateField",
"UnnecessaryLocalBeforeReturn"
}
violations = [f for f in pmd.findings if f.rule in forbidden_pmd_rules]
if violations:
Expand Down
3 changes: 1 addition & 2 deletions CodenameOne/src/com/codename1/ads/AdsService.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ protected AdsService() {
*/
public static AdsService createAdsService() {
try {
AdsService adsService = (AdsService) service.newInstance();
return adsService;
return (AdsService) service.newInstance();
} catch (InstantiationException ex) {
ex.printStackTrace();
} catch (IllegalAccessException ex) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ public String[] getTitles(int index) {
* @return the XY series
*/
public XYSeries toXYSeries() {
XYSeries xySeries = new XYSeries(mTitle);
return xySeries;
return new XYSeries(mTitle);
}
}
6 changes: 2 additions & 4 deletions CodenameOne/src/com/codename1/charts/models/XYSeries.java
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,7 @@ private static double ulp(double value) {
return Double.longBitsToDouble(bits) - Double.longBitsToDouble(bits - 1);
}
double nextValue = Double.longBitsToDouble(bits + 1);
double result = nextValue - value;
return result;
return nextValue - value;
}

public int getScaleNumber() {
Expand Down Expand Up @@ -536,8 +535,7 @@ public int getIndexForKey(K key) {
Collections.sort(indexList, null);
sorted = true;
}
int out = Collections.binarySearch(indexList, key, null);
return out;
return Collections.binarySearch(indexList, key, null);
}
}
}
Expand Down
18 changes: 6 additions & 12 deletions CodenameOne/src/com/codename1/charts/util/ColorUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,33 +39,27 @@ public class ColorUtil {


public static int argb(int a, int r, int g, int b) {
IColor c = new IColor(a, r, g, b);
return c.argb;
return new IColor(a, r, g, b).argb;
}

public static int alpha(int c) {
IColor pc = new IColor(c);
return pc.alpha;
return new IColor(c).alpha;
}

public static int red(int c) {
IColor pc = new IColor(c);
return pc.red;
return new IColor(c).red;
}

public static int green(int c) {
IColor pc = new IColor(c);
return pc.green;
return new IColor(c).green;
}

public static int blue(int c) {
IColor pc = new IColor(c);
return pc.blue;
return new IColor(c).blue;
}

public static int rgb(int r, int g, int b) {
IColor c = new IColor(r, g, b);
return c.argb;
return new IColor(r, g, b).argb;
}


Expand Down
6 changes: 2 additions & 4 deletions CodenameOne/src/com/codename1/charts/util/NumberFormat.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,10 @@ public double parseDouble(String format) throws ParseException {
return Double.parseDouble(t);
} catch (Exception err) {
try {
double val = L10NManager.getInstance().parseDouble(format);
return val;
return L10NManager.getInstance().parseDouble(format);
} catch (Exception err2) {
try {
double v2 = L10NManager.getInstance().parseCurrency(format);
return v2;
return L10NManager.getInstance().parseCurrency(format);
} catch (Exception err3) {
Log.e(err3);
return 0;
Expand Down
3 changes: 1 addition & 2 deletions CodenameOne/src/com/codename1/charts/views/PieMapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,7 @@ public boolean isOnPieChart(Point screenPoint) {
mCenterY - screenPoint.getY(), 2));

double radiusSquared = mPieChartRadius * mPieChartRadius;
boolean isOnPieChart = sqValue <= radiusSquared;
return isOnPieChart;
return sqValue <= radiusSquared;
}

/**
Expand Down
2 changes: 2 additions & 0 deletions CodenameOne/src/com/codename1/db/ThreadSafeDatabase.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public void run() throws IOException {
private void invokeWithException(final RunnableWithIOException r) throws IOException {
IOException err = et.run(new RunnableWithResultSync<IOException>() {
@Override
@SuppressWarnings("PMD.UnnecessaryLocalBeforeReturn")
public IOException run() {
try {
r.run();
Expand All @@ -89,6 +90,7 @@ public IOException run() {
private Object invokeWithException(final RunnableWithResponseOrIOException r) throws IOException {
Object ret = et.run(new RunnableWithResultSync<Object>() {
@Override
@SuppressWarnings("PMD.UnnecessaryLocalBeforeReturn")
public Object run() {
try {
return r.run();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ public abstract class CodenameOneImplementation {
*/
private static final int RTL_RANGE_BEGIN = 0x590;
private static final int RTL_RANGE_END = 0x7BF;
private static boolean pollingThreadRunning;
private static PushCallback callback;
private static PurchaseCallback purchaseCallback;
private static Runnable onCurrentFormChange;
Expand Down Expand Up @@ -268,7 +267,6 @@ public static Class getObjectArrayClass() {
* Stops the polling push loop
*/
protected static void stopPolling() {
pollingThreadRunning = false;
}

/**
Expand Down
3 changes: 1 addition & 2 deletions CodenameOne/src/com/codename1/io/CSVParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,7 @@ private int peekNextChar() throws IOException {
}
bufferOffset = 0;
}
int response = buffer[bufferOffset];
return response;
return buffer[bufferOffset];
}

/**
Expand Down
3 changes: 1 addition & 2 deletions CodenameOne/src/com/codename1/io/ConnectionRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -449,8 +449,7 @@ public static Map<String, Object> fetchJSON(String url) throws IOException {
}
}
JSONParser jp = new JSONParser();
Map<String, Object> result = jp.parseJSON(new InputStreamReader(new ByteArrayInputStream(cr.getResponseData()), "UTF-8"));
return result;
return jp.parseJSON(new InputStreamReader(new ByteArrayInputStream(cr.getResponseData()), "UTF-8"));
}

/**
Expand Down
3 changes: 1 addition & 2 deletions CodenameOne/src/com/codename1/io/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -2532,14 +2532,13 @@ private static long getUniqueDeviceID() {
* @return
*/
private static long generateLongFromDeviceInfo() {
long random = CN.getDeviceDensity()
return CN.getDeviceDensity()
* CN.getDisplayHeight()
* CN.getDisplayWidth()
* CN.convertToPixels(10)
* Long.parseLong(sanitizeString(CN.getPlatformName()), 36)
* Long.parseLong(sanitizeString(CN.getProperty("User-Agent", "1")), 36)
* Long.parseLong(sanitizeString(CN.getProperty("OSVer", "1")), 36);
return random;
}

/**
Expand Down
5 changes: 0 additions & 5 deletions CodenameOne/src/com/codename1/io/gzip/Deflate.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,24 +74,19 @@ final class Deflate {
static final private int Z_DEFAULT_STRATEGY = 0;
static final private int Z_NO_FLUSH = 0;
static final private int Z_PARTIAL_FLUSH = 1;
static final private int Z_SYNC_FLUSH = 2;
static final private int Z_FULL_FLUSH = 3;
static final private int Z_FINISH = 4;
static final private int Z_OK = 0;
static final private int Z_STREAM_END = 1;
static final private int Z_NEED_DICT = 2;
static final private int Z_ERRNO = -1;
static final private int Z_STREAM_ERROR = -2;
static final private int Z_DATA_ERROR = -3;
static final private int Z_MEM_ERROR = -4;
static final private int Z_BUF_ERROR = -5;
static final private int Z_VERSION_ERROR = -6;
static final private int INIT_STATE = 42;
static final private int BUSY_STATE = 113;
static final private int FINISH_STATE = 666;
// The deflate compression method
static final private int Z_DEFLATED = 8;
static final private int STORED_BLOCK = 0;
static final private int STATIC_TREES = 1;
static final private int DYN_TREES = 2;
// The three kinds of block type
Expand Down
16 changes: 0 additions & 16 deletions CodenameOne/src/com/codename1/io/gzip/Deflater.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,25 +37,9 @@ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
final public class Deflater extends ZStream {

static final private int MAX_WBITS = 15; // 32K LZ77 window
static final private int DEF_WBITS = MAX_WBITS;

static final private int Z_NO_FLUSH = 0;
static final private int Z_PARTIAL_FLUSH = 1;
static final private int Z_SYNC_FLUSH = 2;
static final private int Z_FULL_FLUSH = 3;
static final private int Z_FINISH = 4;

static final private int MAX_MEM_LEVEL = 9;

static final private int Z_OK = 0;
static final private int Z_STREAM_END = 1;
static final private int Z_NEED_DICT = 2;
static final private int Z_ERRNO = -1;
static final private int Z_STREAM_ERROR = -2;
static final private int Z_DATA_ERROR = -3;
static final private int Z_MEM_ERROR = -4;
static final private int Z_BUF_ERROR = -5;
static final private int Z_VERSION_ERROR = -6;

private boolean finished = false;

Expand Down
4 changes: 0 additions & 4 deletions CodenameOne/src/com/codename1/io/gzip/InfBlocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,9 @@ final class InfBlocks {
static final private int[] inflate_mask = {0x00000000, 0x00000001, 0x00000003, 0x00000007, 0x0000000f, 0x0000001f, 0x0000003f, 0x0000007f, 0x000000ff, 0x000001ff, 0x000003ff, 0x000007ff, 0x00000fff, 0x00001fff, 0x00003fff, 0x00007fff, 0x0000ffff};
static final private int Z_OK = 0;
static final private int Z_STREAM_END = 1;
static final private int Z_NEED_DICT = 2;
static final private int Z_ERRNO = -1;
static final private int Z_STREAM_ERROR = -2;
static final private int Z_DATA_ERROR = -3;
static final private int Z_MEM_ERROR = -4;
static final private int Z_BUF_ERROR = -5;
static final private int Z_VERSION_ERROR = -6;

static final private int TYPE = 0; // get type bits (3, including end bit)
static final private int LENS = 1; // get lengths for stored
Expand Down
5 changes: 0 additions & 5 deletions CodenameOne/src/com/codename1/io/gzip/InfCodes.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,8 @@ final class InfCodes {

static final private int Z_OK = 0;
static final private int Z_STREAM_END = 1;
static final private int Z_NEED_DICT = 2;
static final private int Z_ERRNO = -1;
static final private int Z_STREAM_ERROR = -2;
static final private int Z_DATA_ERROR = -3;
static final private int Z_MEM_ERROR = -4;
static final private int Z_BUF_ERROR = -5;
static final private int Z_VERSION_ERROR = -6;

// waiting for "i:"=input,
// "o:"=output,
Expand Down
5 changes: 0 additions & 5 deletions CodenameOne/src/com/codename1/io/gzip/InfTree.java
Original file line number Diff line number Diff line change
Expand Up @@ -202,14 +202,9 @@ final class InfTree {
static final int BMAX = 15; // maximum bit length of any code
static final private int MANY = 1440;
static final private int Z_OK = 0;
static final private int Z_STREAM_END = 1;
static final private int Z_NEED_DICT = 2;
static final private int Z_ERRNO = -1;
static final private int Z_STREAM_ERROR = -2;
static final private int Z_DATA_ERROR = -3;
static final private int Z_MEM_ERROR = -4;
static final private int Z_BUF_ERROR = -5;
static final private int Z_VERSION_ERROR = -6;
int[] hn = null; // hufts used in space
int[] v = null; // work area for huftBuild
int[] c = null; // bit length count table
Expand Down
7 changes: 1 addition & 6 deletions CodenameOne/src/com/codename1/io/gzip/Inflate.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,15 @@ final class Inflate {
static final int Z_FULL_FLUSH = 3;
static final int Z_FINISH = 4;
static final int INFLATE_ANY = 0x40000000;
static final private int MAX_WBITS = 15; // 32K LZ77 window
// preset dictionary flag in zlib header
static final private int PRESET_DICT = 0x20;
static final private int Z_DEFLATED = 8;
static final private int Z_OK = 0;
static final private int Z_STREAM_END = 1;
static final private int Z_NEED_DICT = 2;
static final private int Z_ERRNO = -1;
static final private int Z_STREAM_ERROR = -2;
static final private int Z_DATA_ERROR = -3;
static final private int Z_MEM_ERROR = -4;
static final private int Z_BUF_ERROR = -5;
static final private int Z_VERSION_ERROR = -6;
static final private int METHOD = 0; // waiting for method byte
static final private int FLAG = 1; // waiting for flag byte
static final private int DICT4 = 2; // four dictionary check bytes to go
static final private int DICT3 = 3; // three dictionary check bytes to go
static final private int DICT2 = 4; // two dictionary check bytes to go
Expand Down Expand Up @@ -169,6 +163,7 @@ int inflateInit(int w) {
return Z_OK;
}

@SuppressWarnings("PMD.UnnecessaryLocalBeforeReturn")
int inflate(int f) {
int hold = 0;

Expand Down
17 changes: 1 addition & 16 deletions CodenameOne/src/com/codename1/io/gzip/Inflater.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,23 +40,9 @@ final public class Inflater extends ZStream {
static final private int MAX_WBITS = 15; // 32K LZ77 window
static final private int DEF_WBITS = MAX_WBITS;

static final private int Z_NO_FLUSH = 0;
static final private int Z_PARTIAL_FLUSH = 1;
static final private int Z_SYNC_FLUSH = 2;
static final private int Z_FULL_FLUSH = 3;
static final private int Z_FINISH = 4;

static final private int MAX_MEM_LEVEL = 9;

static final private int Z_OK = 0;
static final private int Z_STREAM_END = 1;
static final private int Z_NEED_DICT = 2;
static final private int Z_ERRNO = -1;
static final private int Z_STREAM_ERROR = -2;
static final private int Z_DATA_ERROR = -3;
static final private int Z_MEM_ERROR = -4;
static final private int Z_BUF_ERROR = -5;
static final private int Z_VERSION_ERROR = -6;
private boolean finished = false;

public Inflater() {
Expand Down Expand Up @@ -144,9 +130,8 @@ public int end() {
if (istate == null) {
return Z_STREAM_ERROR;
}
int ret = istate.inflateEnd();
// istate = null;
return ret;
return istate.inflateEnd();
}

public int sync() {
Expand Down
2 changes: 0 additions & 2 deletions CodenameOne/src/com/codename1/io/gzip/Tree.java
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,6 @@ final class Tree {
// The lengths of the bit length codes are sent in order of decreasing
// probability, to avoid transmitting the lengths for unused bit
// length codes.
static final private int BL_CODES = 19;
static final private int D_CODES = 30;
static final private int LITERALS = 256;
static final private int LENGTH_CODES = 29;
static final private int L_CODES = (LITERALS + 1 + LENGTH_CODES);
Expand Down
3 changes: 1 addition & 2 deletions CodenameOne/src/com/codename1/io/gzip/ZStream.java
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,8 @@ public int inflateEnd() {
if (istate == null) {
return Z_STREAM_ERROR;
}
int ret = istate.inflateEnd();
// istate = null;
return ret;
return istate.inflateEnd();
}

public int inflateSync() {
Expand Down
3 changes: 1 addition & 2 deletions CodenameOne/src/com/codename1/io/rest/RequestBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -562,8 +562,7 @@ public Response<byte[]> getAsBytes() {
ConnectionRequest request = createRequest(false);
fetched = true;
CN.addToQueueAndWait(request);
Response res = new Response(request.getResponseCode(), request.getResponseData(), request.getResponseErrorMessage());
return res;
return new Response(request.getResponseCode(), request.getResponseData(), request.getResponseErrorMessage());
}

/**
Expand Down
4 changes: 0 additions & 4 deletions CodenameOne/src/com/codename1/javascript/JSObject.java
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,6 @@ public class JSObject {
*/
private static final String R1 = "ca_weblite_codename1_js_JSObject_R1";

/**
* Javascript register variable 2.
*/
private static final String R2 = "ca_weblite_codename1_js_JSObject_R2";
/**
* The Javascript context that this object belongs to.
*/
Expand Down
3 changes: 1 addition & 2 deletions CodenameOne/src/com/codename1/maps/MapComponent.java
Original file line number Diff line number Diff line change
Expand Up @@ -764,8 +764,7 @@ public int getLayersConut() {
* (index &lt; 0 || index &gt;= size())
*/
public Layer getLayerAt(int index) {
Layer l = ((LayerWithZoomLevels) _layers.elementAt(index)).layer;
return l;
return ((LayerWithZoomLevels) _layers.elementAt(index)).layer;
}

/**
Expand Down
Loading
Loading