ADDITIONAL SYSTEM INFORMATION :
Mac OS X
Java 1.8.0_131
Android Debug Bridge version 1.0.40
A DESCRIPTION OF THE PROBLEM :
The following Android ADB command executes normally on the terminal, however it fails when executed by Java's Runtime.exec method:
adb logcat -d -v threadtime -v year -s System.out -t "2018-09-18 11:15:40.446"
Returning:
-t ""2018-09-18" not in time format
It also doesn't work when replacing the " for ' in the command.
This same command works perfectly
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1 - Install Android SDK, including build-tools
2 - Add the adb executable to the PATH
3 - Connect a device to the PC or start an Android Emulator
4 - Execute the command from the "Source code for an executable test case" section
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
No error and empty String
ACTUAL -
On the errorr stream:
[-t ""2018-09-18" not in time format]
---------- BEGIN SOURCE ----------
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.List;
import java.util.stream.Collectors;
public class JavaMain {
public static void main(String[] args) {
String cmd = "adb logcat -d -v threadtime -v year -s System.out -t \"2018-09-18 11:15:40.446\"";
System.out.println(cmd);
Process proc;
try {
proc = Runtime.getRuntime().exec(cmd);
BufferedReader input = new BufferedReader(new InputStreamReader(proc.getInputStream()));
String line = input.readLine();
while (line != null) {
System.out.println(line);
line = input.readLine();
}
int exitVal = proc.waitFor();
System.out.println("Exited with error code " + exitVal);
if (exitVal > 0) {
List<String> error = new BufferedReader(new InputStreamReader(proc.getErrorStream())).lines().collect(Collectors.toList());
System.out.print(error);
}
} catch (IOException | InterruptedException e) {
e.printStackTrace();
}
}
}
---------- END SOURCE ----------
FREQUENCY : always
Mac OS X
Java 1.8.0_131
Android Debug Bridge version 1.0.40
A DESCRIPTION OF THE PROBLEM :
The following Android ADB command executes normally on the terminal, however it fails when executed by Java's Runtime.exec method:
adb logcat -d -v threadtime -v year -s System.out -t "2018-09-18 11:15:40.446"
Returning:
-t ""2018-09-18" not in time format
It also doesn't work when replacing the " for ' in the command.
This same command works perfectly
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1 - Install Android SDK, including build-tools
2 - Add the adb executable to the PATH
3 - Connect a device to the PC or start an Android Emulator
4 - Execute the command from the "Source code for an executable test case" section
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
No error and empty String
ACTUAL -
On the errorr stream:
[-t ""2018-09-18" not in time format]
---------- BEGIN SOURCE ----------
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.List;
import java.util.stream.Collectors;
public class JavaMain {
public static void main(String[] args) {
String cmd = "adb logcat -d -v threadtime -v year -s System.out -t \"2018-09-18 11:15:40.446\"";
System.out.println(cmd);
Process proc;
try {
proc = Runtime.getRuntime().exec(cmd);
BufferedReader input = new BufferedReader(new InputStreamReader(proc.getInputStream()));
String line = input.readLine();
while (line != null) {
System.out.println(line);
line = input.readLine();
}
int exitVal = proc.waitFor();
System.out.println("Exited with error code " + exitVal);
if (exitVal > 0) {
List<String> error = new BufferedReader(new InputStreamReader(proc.getErrorStream())).lines().collect(Collectors.toList());
System.out.print(error);
}
} catch (IOException | InterruptedException e) {
e.printStackTrace();
}
}
}
---------- END SOURCE ----------
FREQUENCY : always