Skip to content

Commit

Permalink
Merge pull request #190 from forcedotcom/BeanIntrospectorFix
Browse files Browse the repository at this point in the history
Bean introspector fix
  • Loading branch information
jjinsfdc authored Aug 27, 2019
2 parents 81d24e1 + 22988d4 commit 120d507
Show file tree
Hide file tree
Showing 16 changed files with 55 additions and 56 deletions.
11 changes: 1 addition & 10 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<groupId>com.force</groupId>
<artifactId>dataloader</artifactId>
<packaging>jar</packaging>
<version>46.0.0</version>
<version>46.1.0</version>
<name>Data Loader</name>
<url>https://github.com/forcedotcom/dataloader</url>
<organization>
Expand Down Expand Up @@ -98,12 +98,6 @@
<version>1.4.197</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.7.0</version>
</dependency>
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
Expand All @@ -114,14 +108,12 @@
<artifactId>commons-io</artifactId>
<version>2.6</version>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13-beta-1</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
Expand All @@ -132,7 +124,6 @@
<artifactId>httpclient</artifactId>
<version>4.5.6</version>
</dependency>

<dependency>
<groupId>org.eclipse</groupId>
<artifactId>core.commands</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion release/mac/dataloader.command
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ then
else
echo "$JAVA_HOME"
cd DATALODER_WORK_DIRECTORY_PLACEHOLDER #change to your own customized directory
java -XstartOnFirstThread -jar dataloader-46.0.0-uber.jar salesforce.config.dir=DATALODER_WORK_DIRECTORY_PLACEHOLDER/configs
java -XstartOnFirstThread -jar dataloader-46.1.0-uber.jar salesforce.config.dir=DATALODER_WORK_DIRECTORY_PLACEHOLDER/configs
fi
4 changes: 2 additions & 2 deletions release/mac/install.command
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
DATALOADER_VERSION="46.0.0"
DATALOADER_VERSION="46.1.0"
DATALOADER_SHORT_VERSION="46"
DATALOADER_UBER_JAR_NAME="dataloader-46.0.0-uber.jar"
DATALOADER_UBER_JAR_NAME="dataloader-46.1.0-uber.jar"

echo ""
echo "*************************************************************************"
Expand Down
5 changes: 4 additions & 1 deletion release/win/bin/encrypt.bat
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@ IF "%JAVA_HOME%" == "" (
IF NOT EXIST "%JAVA_HOME%" (
echo We couldn't find the Java Runtime Environment ^(JRE^) in directory "%JAVA_HOME%". To run process.bat, set the JAVA_HOME environment variable to the directory where the JRE is installed.
) ELSE (
"%JAVA_HOME%\bin\java" -cp ..\dataloader-46.0.0-uber.jar com.salesforce.dataloader.security.EncryptionUtil %*
"%JAVA_HOME%\bin\java" -cp ..\dataloader-46.1.0-uber.jar com.salesforce.dataloader.security.EncryptionUtil %*
)
)





4 changes: 2 additions & 2 deletions release/win/bin/process.bat
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ if not [%2]==[] set PROCESS_OPTION=process.name=%2


IF "%JAVA_HOME%" == "" (
for /f "tokens=*" %%i in ('dataloader-46.0.0-java-home.exe') do (
for /f "tokens=*" %%i in ('dataloader-46.1.0-java-home.exe') do (
IF EXIST "%%i" (
set JAVA_HOME=%%i
) ELSE (
Expand All @@ -41,7 +41,7 @@ IF "%JAVA_HOME%" == "" (
IF NOT EXIST "%JAVA_HOME%" (
echo We couldn't find the Java Runtime Environment ^(JRE^) in directory "%JAVA_HOME%". To run process.bat, set the JAVA_HOME environment variable to the directory where the JRE is installed.
) ELSE (
"%JAVA_HOME%\bin\java" -cp ..\dataloader-46.0.0-uber.jar -Dsalesforce.config.dir=%1 com.salesforce.dataloader.process.ProcessRunner %PROCESS_OPTION%
"%JAVA_HOME%\bin\java" -cp ..\dataloader-46.1.0-uber.jar -Dsalesforce.config.dir=%1 com.salesforce.dataloader.process.ProcessRunner %PROCESS_OPTION%
)
)

Expand Down
2 changes: 1 addition & 1 deletion release/win/dataloader.bat
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ echo.
)

:Run
"%ZULU_JAVA_HOME%\bin\java" -jar dataloader-46.0.0-uber.jar salesforce.config.dir=configs
"%ZULU_JAVA_HOME%\bin\java" -jar dataloader-46.1.0-uber.jar salesforce.config.dir=configs

:Exit
endlocal
4 changes: 2 additions & 2 deletions release/win/install.bat
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
@echo off
setlocal

set DATALOADER_VERSION=46.0.0
set DATALOADER_VERSION=46.1.0
set DATALOADER_SHORT_VERSION=46
set DATALOADER_UBER_JAR_NAME=dataloader-46.0.0-uber.jar
set DATALOADER_UBER_JAR_NAME=dataloader-46.1.0-uber.jar

echo.
echo *************************************************************************
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ private void processResult(boolean success, String successMsgKey, String id, Err
startRow = 0;
}
logger.error(Messages.getString("Client.itemError") //$NON-NLS-1$
+ new Integer((itemNbr + startRow)).toString());
+ Integer.valueOf(itemNbr + startRow).toString());
logger.error(Messages.getString("Client.errorCode") + err.getStatusCode().toString()); //$NON-NLS-1$
logger.error(Messages.getString("Client.errorMessage") + err.getMessage()); //$NON-NLS-1$
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/salesforce/dataloader/config/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ public double getDouble(String name) throws ParameterLoadException {
if (value == null || value.length() == 0) return DOUBLE_DEFAULT;
double ival;
try {
ival = new Double(value).doubleValue();
ival = Double.parseDouble(value);
} catch (NumberFormatException e) {
String errMsg = Messages.getFormattedString("Config.errorParameterLoad", new String[]{name,
Double.class.getName()});
Expand All @@ -408,7 +408,7 @@ public float getFloat(String name) throws ParameterLoadException {
if (value == null || value.length() == 0) return FLOAT_DEFAULT;
float ival = FLOAT_DEFAULT;
try {
ival = new Float(value).floatValue();
ival = Float.parseFloat(value);
} catch (NumberFormatException e) {
String errMsg = Messages.getFormattedString("Config.errorParameterLoad", new String[]{name,
Float.class.getName()});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@ public Object convert(Class type, Object value) {
}
if (value instanceof Double) {
return (value);
} else if (value instanceof Number) { return new Double(((Number)value).doubleValue()); }
} else if (value instanceof Number) { return ((Number) value).doubleValue(); }

try {
return (new Double(value.toString()));
return (Double.valueOf(value.toString()));
} catch (Exception e) {
if (useDefault) {
return (defaultValue);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,11 @@ public Object convert(Class type, Object value) {
if (value instanceof Integer) {
return (value);
} else if (value instanceof Number) {
return new Integer(((Number)value).intValue());
return Integer.valueOf(((Number)value).intValue());
}

try {
return (new Integer(value.toString()));
return (Integer.parseInt(value.toString()));
} catch (Exception e) {
if (useDefault) {
return (defaultValue);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,12 +287,12 @@ static public SObject[] getSObjectArray(Controller controller, List<DynaBean> dy
public static SObject getSObject(Controller controller, String entityName, DynaBean dynaBean) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException, ParameterLoadException {
SObject sObj = new SObject();
sObj.setType(entityName);
Map<String, Object> fieldMap = BeanUtils.describe(dynaBean);
Map<String, String> fieldMap = BeanUtils.describe(dynaBean);
for (String fName : fieldMap.keySet()) {
if (fieldMap.get(fName) != null) {
// see if any entity foreign key references are embedded here
Object value = dynaBean.get(fName);
if (value != null && value instanceof SObjectReference) {
if (value instanceof SObjectReference) {
SObjectReference sObjRef = (SObjectReference)value;
if (!sObjRef.isNull()) sObjRef.addReferenceToSObject(controller, sObj, fName);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public static byte[] textToBytes(String text) {
{
tmpValue = (tmpValue - 127) * -1;
}
tmpInteger = new Integer(tmpValue);
tmpInteger = Integer.valueOf(tmpValue);
baBytes[j] = tmpInteger.byteValue();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ private Button createCancelButton(Composite parent) {
button.setText(IDialogConstants.CANCEL_LABEL);
setButtonLayoutData(button);
button.setFont(parent.getFont());
button.setData(new Integer(IDialogConstants.CANCEL_ID));
button.setData(Integer.valueOf(IDialogConstants.CANCEL_ID));
button.addSelectionListener(cancelListener);
return button;
}
Expand All @@ -445,7 +445,7 @@ private Button createCancelButton(Composite parent) {
@Override
protected Button getButton(int id) {
if (id == IDialogConstants.CANCEL_ID) return cancelButton;
return buttons.get(new Integer(id));
return buttons.get(Integer.valueOf(id));
}

/**
Expand Down Expand Up @@ -827,7 +827,7 @@ public void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable
*/
private void saveEnableStateAndSet(Control w, Map<String,Object> h, String key, boolean enabled) {
if (w != null) {
h.put(key, new Boolean(w.getEnabled()));
h.put(key, Boolean.valueOf(w.getEnabled()));
w.setEnabled(enabled);
}
}
Expand Down Expand Up @@ -1246,7 +1246,7 @@ protected Button createButton(Composite parent, int id, String label,boolean def
Button button = new Button(parent, SWT.PUSH | SWT.FLAT);
button.setText(label);
button.setFont(JFaceResources.getDialogFont());
button.setData(new Integer(id));
button.setData(Integer.valueOf(id));
button.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
buttonPressed(((Integer) event.widget.getData()).intValue());
Expand All @@ -1259,7 +1259,7 @@ public void widgetSelected(SelectionEvent event) {
}
}

buttons.put(new Integer(id), button);
buttons.put(Integer.valueOf(id), button);
setButtonLayoutData(button);
return button;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public static boolean handleCompletedUrl(String url, Config config) throws URISy
if (params.containsKey("issued_at")) {
String issued_at = params.get("issued_at");
if (issued_at != null && !issued_at.equals("")) {
token.setIssuedAt(new Long(issued_at));
token.setIssuedAt(Long.valueOf(issued_at));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,27 +101,32 @@ public void testGetFilePath() throws IOException, GeneralSecurityException {

@Test
public void testAutoSetKeyFile() throws IOException, GeneralSecurityException {
EncryptionAesUtil encryptionAesUtil = new EncryptionAesUtil();
String passwordText = "somePassword6c3708b3";
String filePath = encryptionAesUtil.createUserProfileKeyName();
String filePathBak = filePath + ".bak";
Boolean cleanup = false;
if (Files.exists(Paths.get(filePath))) {
cleanup = true;
Files.move(Paths.get(filePath), Paths.get(filePathBak));
boolean cleanup = false;
String filePath = null;
String filePathBak = null;
try {
EncryptionAesUtil encryptionAesUtil = new EncryptionAesUtil();
String passwordText = "somePassword6c3708b3";
filePath = encryptionAesUtil.createUserProfileKeyName();
filePathBak = filePath + ".bak";
if (Files.exists(Paths.get(filePath))) {
cleanup = true;
Files.move(Paths.get(filePath), Paths.get(filePathBak));
}
// without setting the default key
String encryptedMsg = encryptionAesUtil.encryptMsg(passwordText);
String decryptedMsg = encryptionAesUtil.decryptMsg(encryptedMsg);

Assert.assertTrue(Files.exists(Paths.get(filePath)));
Files.delete(Paths.get(filePath));

logger.info("\nEncrypted message:" + encryptedMsg.toString() + "\nText to be encrypted:" + passwordText + "\nDecrypted text:" + decryptedMsg);
Assert.assertNotEquals("Encrypted message should be not be equal to original message", passwordText, encryptedMsg);
Assert.assertEquals("Text recovered from encrypted message is as the expected: ", passwordText, decryptedMsg);
} finally {
if (cleanup) {
Files.move(Paths.get(filePathBak), Paths.get(filePath));
}
}
// without setting the default key
String encryptedMsg = encryptionAesUtil.encryptMsg(passwordText);
String decryptedMsg = encryptionAesUtil.decryptMsg(encryptedMsg);

Assert.assertTrue(Files.exists(Paths.get(filePath)));
Files.delete(Paths.get(filePath));
if (cleanup) {
Files.move(Paths.get(filePathBak), Paths.get(filePath));
}

logger.info("\nEncrypted message:" + encryptedMsg.toString() + "\nText to be encrypted:" + passwordText + "\nDecrypted text:" + decryptedMsg);
Assert.assertNotEquals("Encrpted message should be not be equal to original message", passwordText, new String(encryptedMsg));
Assert.assertEquals("Text recovered from encrypted message is as the expected: ", passwordText, decryptedMsg);
}
}

0 comments on commit 120d507

Please sign in to comment.