Skip to content
This repository was archived by the owner on Jan 27, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
41e62c3
Issue #4 - Removing Unused Variable in AndroidInputHandler.java
AminAmani83 Oct 5, 2024
055b909
Merge pull request #5 from hanif-ali/Issue#4-UnusedVariableRemoval
AminAmani83 Oct 5, 2024
6323050
Issue #2 and #3 resolved by changing field name to ESCAPEEVENT and ty…
nisarg291 Oct 5, 2024
b3cf6c1
Issue#1-removed commented out code
ZazibaAhmed Oct 6, 2024
76cc2c6
#9 Remove commented code from AndroidGestureProcessor.java
Oct 6, 2024
070e43c
Merge pull request #10 from hanif-ali/9-Remove-commentedcode
aashvi1802 Oct 6, 2024
5ec71bf
Update MjpegFileWriter.java and deleted commented-out-line
istiaqahmed121998 Oct 7, 2024
1154c69
Merge pull request #7 from hanif-ali/Issue-#1-Remove-Commented-Out-Code
ZazibaAhmed Oct 7, 2024
8198255
Merge pull request #14 from hanif-ali/issue-46-commented-out-lines-of…
istiaqahmed121998 Oct 9, 2024
52831a4
Remove unnecessary intermediate variables before return
hanif-ali Oct 10, 2024
c1cb853
Fix ordering of modifiers in jme3-android to comply with Java spec
hanif-ali Oct 10, 2024
b2b7395
Eliminated a code duplication in AndroidLocator.java
TejasSonawane Nov 12, 2024
85274d9
remove duplicated code and added a helper method
istiaqahmed121998 Nov 12, 2024
0e33c6f
Merge branch 'rilling:master' into master
nisarg291 Nov 12, 2024
8b7adc3
Removing Duplicate Code in RendererUtil.java - Issue#97 (#27)
nisarg291 Nov 12, 2024
f239d4d
Issue#79-removed clone in long press show press methods (#23)
ZazibaAhmed Nov 12, 2024
3e7d834
Fixes #72 (#22)
AminAmani83 Nov 12, 2024
396013f
Merge branch 'master' into Issue#82---Eliminate-Code-Duplication-in-A…
hanif-ali Nov 13, 2024
7ba8620
Merge branch 'master' into issue#89-remove-software-clone
hanif-ali Nov 13, 2024
6f1ee7c
Issue #28 Remove code duplication in GlfwKeymap.java
hanif-ali-prtsr Nov 13, 2024
4820026
Merge pull request #24 from hanif-ali/Issue#82---Eliminate-Code-Dupli…
hanif-ali Nov 13, 2024
07230fe
Merge pull request #25 from hanif-ali/issue#89-remove-software-clone
hanif-ali Nov 13, 2024
13b0024
Merge pull request #29 from hanif-ali/hanif-ali-remove-duplication
hanif-ali Nov 13, 2024
c4101d8
Merge branch 'master' into master
hanif-ali Nov 13, 2024
c4c0b8c
Fixes #116
Nov 18, 2024
bead2b6
Merge branch 'rilling:master' into master
aashvi1802 Dec 2, 2024
9034de5
Issue#155-fixed Insecure Configuration vulnerability
ZazibaAhmed Dec 2, 2024
cdabf8e
Issue#155-fixed Insecure Configuration vulnerability
ZazibaAhmed Dec 2, 2024
4d98ddc
Issue#155-fixed Insecure Configuration vulnerability
ZazibaAhmed Dec 2, 2024
3a8aa97
fix: Make sure the use of WRITE_EXTERNAL_STORAGE permission is necess…
aashvi1802 Dec 2, 2024
a858c0c
Merge pull request #33 from hanif-ali/dev_aashvi_vulnerability
aashvi1802 Dec 2, 2024
e86c22f
Update XMLImporter.java
istiaqahmed121998 Dec 3, 2024
1bfb9e2
#35 Fix MALICIOUS_CODE vulnerability identified by SpotBugs
hanif-ali-prtsr Dec 3, 2024
11839fd
Merge pull request #36 from hanif-ali/hanif-ali-case-study-3
hanif-ali Dec 3, 2024
5f286f9
Merge pull request #34 from hanif-ali/issues#170-fix-XML-External-Entity
hanif-ali Dec 3, 2024
de5ac33
Merge pull request #31 from hanif-ali/Issue#155-debug-feature-deactiv…
hanif-ali Dec 3, 2024
cad27d0
Merge pull request #30 from hanif-ali/Issue#116-OWASP-Dependency-Check
hanif-ali Dec 3, 2024
1a3f7eb
Merge branch 'master' into master
hanif-ali Dec 3, 2024
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
2 changes: 1 addition & 1 deletion common.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ tasks.withType(Sign) {
}

checkstyle {
toolVersion '9.3'
toolVersion '10.20.1'
configFile file("${gradle.rootProject.rootDir}/config/checkstyle/checkstyle.xml")
}

Expand Down
2 changes: 1 addition & 1 deletion jme3-android-examples/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
android:normalScreens="true"
android:smallScreens="true"/>

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.VIBRATE"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,46 +99,44 @@ public class AndroidAssetInfo extends AssetInfo {
this.resourceId = resourceId;
}

private android.content.res.Resources getAndroidResources() {
return JmeAndroidSystem.getView().getContext().getResources();
}

private InputStream getResourceAsStream(String assetPath, int resourceId) throws AssetLoadException {
android.content.res.Resources androidResources = getAndroidResources();
try {
if (resourceId == 0) {
return androidResources.getAssets().open(assetPath);
} else {
return androidResources.openRawResource(resourceId);
}
} catch (IOException | Resources.NotFoundException ex) {
throw new AssetLoadException("Failed to open asset " + assetPath, ex);
}
}

@Override
public InputStream openStream() {
if (in != null){
// Reuse the already existing stream (only once)
if (in != null) {
InputStream in2 = in;
in = null;
return in2;
}else{
// Create a new stream for subsequent invocations.
android.content.res.Resources androidResources = JmeAndroidSystem.getView().getContext().getResources();
if (resourceId == 0) {
try {
return androidResources.getAssets().open(assetPath);
} catch (IOException ex) {
throw new AssetLoadException(AssetOpenError + assetPath, ex);
}
} else {
try {
return androidResources.openRawResource(resourceId);
} catch (Resources.NotFoundException ex) {
throw new AssetLoadException(AssetOpenError + assetPath, ex);
}
}
} else {
return getResourceAsStream(assetPath, resourceId);
}
}

public AssetFileDescriptor openFileDescriptor() {
android.content.res.Resources androidResources = JmeAndroidSystem.getView().getContext().getResources();
if (resourceId == 0) {
try {
android.content.res.Resources androidResources = getAndroidResources();
try {
if (resourceId == 0) {
return androidResources.getAssets().openFd(assetPath);
} catch (IOException ex) {
throw new AssetLoadException(AssetOpenError + assetPath, ex);
}
} else {
try {
} else {
return androidResources.openRawResourceFd(resourceId);
} catch (Resources.NotFoundException ex) {
throw new AssetLoadException(AssetOpenError + assetPath, ex);
}
} catch (IOException | Resources.NotFoundException ex) {
throw new AssetLoadException("Failed to open asset " + assetPath, ex);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,15 @@ public boolean onSingleTapUp(MotionEvent event) {

@Override
public void onShowPress(MotionEvent event) {
float jmeX = touchInput.getJmeX(event.getX());
float jmeY = touchInput.invertY(touchInput.getJmeY(event.getY()));
prepareTouchEvent(TouchEvent.Type.SHOWPRESS, event, jmeX, jmeY);
pressEventHandler(event, TouchEvent.Type.SHOWPRESS);
}

@Override
public void onLongPress(MotionEvent event) {
pressEventHandler(event, TouchEvent.Type.LONGPRESSED);
}

private void pressEventHandler(MotionEvent event, TouchEvent.Type eventType) {
float jmeX = touchInput.getJmeX(event.getX());
float jmeY = touchInput.invertY(touchInput.getJmeY(event.getY()));
prepareTouchEvent(TouchEvent.Type.LONGPRESSED, event, jmeX, jmeY);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,11 @@ public boolean onKey(KeyEvent event) {

return consumed;
}

private void logRemap(String original, String logicalId) {
if (logger.isLoggable(Level.FINE) && !Objects.equals(logicalId, original)) {
logger.log(Level.FINE, "Remapped: {0} to: {1}", new Object[]{original, logicalId});
}
}
protected class AndroidJoystick extends AbstractJoystick {

private JoystickAxis nullAxis;
Expand Down Expand Up @@ -335,13 +339,8 @@ protected JoystickButton addButton( int keyCode ) {
original = JoystickButton.BUTTON_11;
}

// String logicalId = JoystickCompatibilityMappings.remapButton( getName(), original );
// if (logger.isLoggable(Level.FINE) && !Objects.equals(logicalId, original)) {
// logger.log(Level.FINE, "Remapped: {0} to: {1}",
// new Object[]{original, logicalId});
// }
String logicalId = JoystickCompatibilityMappings.remapButton(getName(), original);
logRemappingIfNeeded(original, logicalId, logger);
String logicalId = JoystickCompatibilityMappings.remapButton( getName(), original );
logRemap(original, logicalId);

JoystickButton button = new DefaultJoystickButton( getInputManager(), this, getButtonCount(),
name, logicalId );
Expand All @@ -350,6 +349,7 @@ protected JoystickButton addButton( int keyCode ) {
return button;
}


protected JoystickAxis addAxis(MotionRange motionRange) {

String name = MotionEvent.axisToString(motionRange.getAxis());
Expand All @@ -368,10 +368,8 @@ protected JoystickAxis addAxis(MotionRange motionRange) {
} else if (motionRange.getAxis() == MotionEvent.AXIS_HAT_Y) {
original = JoystickAxis.POV_Y;
}

String logicalId = JoystickCompatibilityMappings.remapAxis(getName(), original);
logRemappingIfNeeded(original, logicalId, logger);

String logicalId = JoystickCompatibilityMappings.remapAxis( getName(), original );
logRemap(original, logicalId);
JoystickAxis axis = new DefaultJoystickAxis(getInputManager(),
this,
getAxisCount(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,6 @@ public static void checkGLError() {
if (!ENABLE_ERROR_CHECKING) {
return;
}
checkAndThrowGLError();
checkGLErrorForced();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -164,18 +164,12 @@ private EGLConfig[] getConfigs(EGL10 egl, EGLDisplay display) {
{
// Get back to openGL ES 2
configSpec[1]=EGL_OPENGL_ES2_BIT;
if (!egl.eglChooseConfig(display, configSpec, null, 0, num_config)) {
RendererUtil.checkEGLError(egl);
throw new AssertionError();
}
checkEGL(egl.eglChooseConfig(display, configSpec, null, 0, num_config), egl);
}

int numConfigs = num_config[0];
EGLConfig[] configs = new EGLConfig[numConfigs];
if (!egl.eglChooseConfig(display, configSpec, configs, numConfigs, num_config)) {
RendererUtil.checkEGLError(egl);
throw new AssertionError();
}
checkEGL(egl.eglChooseConfig(display, configSpec, configs, numConfigs, num_config), egl);

logger.fine("--------------Display Configurations---------------");
for (EGLConfig eGLConfig : configs) {
Expand All @@ -186,6 +180,13 @@ private EGLConfig[] getConfigs(EGL10 egl, EGLDisplay display) {
return configs;
}

private static void checkEGL(boolean isEGL, EGL10 egl10) {
if (!isEGL) {
RendererUtil.checkEGLError(egl10);
throw new AssertionError();
}
}

private EGLConfig chooseConfig(
EGL10 egl, EGLDisplay display, EGLConfig[] configs, Config requestedConfig,
boolean higherRGB, boolean higherAlpha,
Expand Down
6 changes: 5 additions & 1 deletion jme3-desktop/src/main/java/com/jme3/app/AppletHarness.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
import java.util.HashMap;
import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
import java.util.logging.*;

/**
* @author Kirill Vainer
Expand All @@ -71,6 +72,7 @@ public static Applet getApplet(Application app){
@SuppressWarnings("unchecked")
private void createCanvas(){
AppSettings settings = new AppSettings(true);
Logger logger = Logger.getLogger(this.getClass().getName());

// load app cfg
if (appCfg != null){
Expand All @@ -80,14 +82,16 @@ private void createCanvas(){
settings.load(in);
in.close();
} catch (IOException ex){
// Log the exception securely
logger.log(Level.SEVERE, "Error loading applet configuration", ex);

// Called before application has been created ....
// Display error message through AWT
JOptionPane.showMessageDialog(this, "An error has occurred while "
+ "loading applet configuration"
+ ex.getMessage(),
"jME3 Applet",
JOptionPane.ERROR_MESSAGE);
ex.printStackTrace();
} finally {
if (in != null)
try {
Expand Down
Loading
Loading