Skip to content

Commit

Permalink
Updated extension MD2023: StringUtils, NPE errors, Fixes for Mac and …
Browse files Browse the repository at this point in the history
…FileDialog etc...
  • Loading branch information
yogi1967 committed Apr 4, 2023
1 parent 54a0e95 commit 8bd55fc
Show file tree
Hide file tree
Showing 39 changed files with 660 additions and 560 deletions.
3 changes: 3 additions & 0 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
<property name="privatekey" value="private.key"/>
<property name="publickey" value="public.key"/>
<property name="privatekeyid" value="99"/>
<property name="keypass" value=""/>
</target>

<target name="-post-jar">
Expand All @@ -92,6 +93,7 @@
<java newenvironment="true"
classpath="externals/moneydance/extadmin.jar:externals/moneydance/moneydance.jar"
classname="com.moneydance.admin.KeyAdmin">
<sysproperty key="moneydance_key_pass" value="${keypass}"/>
<arg value="signextjar"/>
<arg value="${privatekey}"/>
<arg value="${privatekeyid}"/>
Expand All @@ -111,6 +113,7 @@

<target name="genkeys" depends="init">
<java
fork="true"
classpath="externals/moneydance/extadmin.jar"
classname="com.moneydance.admin.KeyAdmin">
<arg value="genkey"/>
Expand Down
4 changes: 2 additions & 2 deletions build/built-jar.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#Sun, 20 Mar 2016 22:38:40 -0400
#Tue, 04 Apr 2023 14:30:20 +0100


F\:\\github\\mdcsvimporter2015=
/Users/stu/Documents/Moneydance/mdcsvimporter2015=
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import com.moneydance.modules.features.mdcsvimporter.CSVData;
import com.moneydance.modules.features.mdcsvimporter.DateGuesser;
import com.moneydance.modules.features.mdcsvimporter.TransactionReader;
import com.moneydance.util.CustomDateFormat;
import com.moneydance.util.StringUtils;
import com.infinitekind.util.StringUtils;
import java.io.IOException;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import com.moneydance.modules.features.mdcsvimporter.TransactionReader;
import com.moneydance.apps.md.model.OnlineTxn;
import com.moneydance.modules.features.mdcsvimporter.CSVData;
import com.moneydance.util.CustomDateFormat;
import com.moneydance.util.StringUtils;
import com.infinitekind.util.StringUtils;
import java.io.IOException;

public class CitiBankCanadaReader
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import com.moneydance.modules.features.mdcsvimporter.TransactionReader;
import com.moneydance.apps.md.model.OnlineTxn;
import com.moneydance.modules.features.mdcsvimporter.CSVData;
import com.moneydance.util.CustomDateFormat;
import com.moneydance.util.StringUtils;
import com.infinitekind.util.StringUtils;
import java.io.IOException;

public class INGNetherlandsReader
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import com.moneydance.modules.features.mdcsvimporter.CSVData;
import com.moneydance.modules.features.mdcsvimporter.DateGuesser;
import com.moneydance.modules.features.mdcsvimporter.TransactionReader;
import com.moneydance.util.CustomDateFormat;
import com.moneydance.util.StringUtils;
import com.infinitekind.util.StringUtils;
import java.io.IOException;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import com.moneydance.apps.md.model.OnlineTxn;
import com.moneydance.modules.features.mdcsvimporter.CSVData;
import com.moneydance.modules.features.mdcsvimporter.TransactionReader;
import com.moneydance.util.CustomDateFormat;
import com.moneydance.util.StringUtils;
import com.infinitekind.util.StringUtils;
import java.io.IOException;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import com.moneydance.apps.md.model.OnlineTxn;
import com.moneydance.modules.features.mdcsvimporter.CSVData;
import com.moneydance.modules.features.mdcsvimporter.TransactionReader;
import com.moneydance.util.CustomDateFormat;
import com.moneydance.util.StringUtils;
import com.infinitekind.util.StringUtils;
import java.io.IOException;

/*
Expand Down Expand Up @@ -237,7 +237,7 @@ public class YodleeReader
}

public void createSupportedDateFormats(String dateFormatArg) {
System.err.println("\n--------- entered createSupportedDateFormats() dateFormatArg =" + dateFormatArg + "= -------------");
Util.logConsole("\n--------- entered createSupportedDateFormats() dateFormatArg =" + dateFormatArg + "= -------------");
String[] tmp = new String[1];
tmp[0] = dateFormatArg;
SUPPORTED_DATE_FORMATS = tmp;
Expand All @@ -261,7 +261,7 @@ public class YodleeReader
return;
}

System.err.println("setDateFormat() format =" + format + "= dateFormatString =" + dateFormatString + "=");
Util.logConsole("setDateFormat() format =" + format + "= dateFormatString =" + dateFormatString + "=");
if (!format.equals(dateFormatStringSelected)) {
dateFormat = new CustomDateFormat(format);
dateFormatStringSelected = format;
Expand Down
Binary file removed dist/lib/extadmin.jar
Binary file not shown.
Binary file modified dist/mdcsvimporter.mxt
Binary file not shown.
Binary file modified dist/mdcsvimporter.zip
Binary file not shown.
Binary file modified externals/moneydance/extadmin.jar
Binary file not shown.
1 change: 1 addition & 0 deletions nbproject/project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ javac.processorpath=\
${javac.classpath}
javac.source=11
javac.target=11
javac.fork=true
javac.test.classpath=\
${javac.classpath}:\
${build.classes.dir}:\
Expand Down
13 changes: 0 additions & 13 deletions private.key

This file was deleted.

8 changes: 0 additions & 8 deletions public.key

This file was deleted.

72 changes: 36 additions & 36 deletions src/com/moneydance/modules/features/mdcsvimporter/CSVData.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ public void parseIntoLines( CustomReaderData customReaderData )
{
for ( String s = reader.nextField(); s != null; s = reader.nextField() )
{
//System.err.println( " line.add string =" + s + "=" );
//Util.logConsole( " line.add string =" + s + "=" );
line.add( s );
}

System.err.println( " line.size() =" + line.size() + "=\n" );
Util.logConsole( " line.size() =" + line.size() + "=\n" );
if ( line.size() > maxFoundCols )
{
maxFoundCols = line.size();
Expand All @@ -86,44 +86,44 @@ public void parseIntoLines( CustomReaderData customReaderData )

data = new String[file.size()][];
file.toArray( data );
System.err.println( " parsed lines total =" + file.size() + "= maxFoundCols =" + maxFoundCols );
Util.logConsole( " parsed lines total =" + file.size() + "= maxFoundCols =" + maxFoundCols );
currentLineIndex = -1;
currentFieldIndex = -1;

int maxr = file.size();
dataErr = new String[maxr][];
//System.err.println( " reset maxr =" + maxr );
//Util.logConsole( " reset maxr =" + maxr );
for ( int r = 0; r < maxr; r++ )
{
int maxc = maxFoundCols + 1;
String[] newLine = new String[ maxFoundCols + 1 ];
for ( int c = 0; c < maxc; c++ )
{
//System.err.println( " reset r =" + r + " c =" + c );
//Util.logConsole( " reset r =" + r + " c =" + c );
newLine[c] = "";
}
dataErr[r] = newLine;
}

// System.err.println( "PRINT OUT RESET dataErr" );
// Util.logConsole( "PRINT OUT RESET dataErr" );
// maxr = dataErr.length;
// System.err.println( " reset maxr =" + maxr );
// Util.logConsole( " reset maxr =" + maxr );
// for ( int r = 0; r < maxr; r++ )
// {
// int maxc = dataErr[r].length;
// System.err.println( " reset maxc =" + maxc );
// Util.logConsole( " reset maxc =" + maxc );
// for ( int c = 0; c < maxc; c++ )
// {
// System.err.println( "dataErr blank [" + r + "][" + c +"] =" + dataErr[r][c] );
// Util.logConsole( "dataErr blank [" + r + "][" + c +"] =" + dataErr[r][c] );
// }
// }
}

public void reverseListRangeOrder( long beg, long end )
{
//System.err.println( "hasZeroFields() ---- currentLineIndex =" + currentLineIndex + "= data.length =" + data.length );
System.err.println( "revLine beg: " + beg );
System.err.println( "revLine end: " + end );
//Util.logConsole( "hasZeroFields() ---- currentLineIndex =" + currentLineIndex + "= data.length =" + data.length );
Util.logConsole( "revLine beg: " + beg );
Util.logConsole( "revLine end: " + end );
if ( end <= beg )
{
return;
Expand All @@ -150,22 +150,22 @@ public boolean nextLine()
currentFieldIndex = -1;
}

//System.err.println( "nextLine() ---- currentLineIndex =" + currentLineIndex + "= data.length =" + data.length + " ans =" + (currentLineIndex < data.length ? "true" : "false" ) );
//Util.logConsole( "nextLine() ---- currentLineIndex =" + currentLineIndex + "= data.length =" + data.length + " ans =" + (currentLineIndex < data.length ? "true" : "false" ) );
return currentLineIndex < data.length;
}

public boolean hasEnoughFieldsPerCurrentLine( int neededFields )
{
System.err.println( "fieldsPerCurrentLine() data[currentLineIndex].length + 1 =" + (data[currentLineIndex].length + 1) + " >= neededFields =" + neededFields );
Util.logConsole( "fieldsPerCurrentLine() data[currentLineIndex].length + 1 =" + (data[currentLineIndex].length + 1) + " >= neededFields =" + neededFields );
return data[currentLineIndex].length + 1 >= neededFields;
}

public boolean nextField()
{
//System.err.println( "nextField() ---- currentLineIndex =" + currentLineIndex + "= data.length =" + data.length );
//Util.logConsole( "nextField() ---- currentLineIndex =" + currentLineIndex + "= data.length =" + data.length );
if ( currentLineIndex < 0 || currentLineIndex >= data.length )
{
//System.err.println( "nextField() ---- return false" );
//Util.logConsole( "nextField() ---- return false" );
return false;
}

Expand All @@ -174,20 +174,20 @@ public boolean nextField()
++currentFieldIndex;
}

//System.err.println( "nextField()2 ---- currentLineIndex =" + currentLineIndex + "= data.length =" + data.length + " ans =" + (currentFieldIndex < data[currentLineIndex].length ? "true" : "false" ) );
//Util.logConsole( "nextField()2 ---- currentLineIndex =" + currentLineIndex + "= data.length =" + data.length + " ans =" + (currentFieldIndex < data[currentLineIndex].length ? "true" : "false" ) );
return currentFieldIndex < data[currentLineIndex].length;
}

public boolean hasZeroFields()
{
//System.err.println( "hasZeroFields() ---- currentLineIndex =" + currentLineIndex + "= data.length =" + data.length );
//Util.logConsole( "hasZeroFields() ---- currentLineIndex =" + currentLineIndex + "= data.length =" + data.length );
if ( currentLineIndex < 0 || currentLineIndex >= data.length )
{
//System.err.println( "hasZeroFields() ---- return false" );
//Util.logConsole( "hasZeroFields() ---- return false" );
return false;
}

//System.err.println( "hasZeroFields()2 ---- currentLineIndex =" + currentLineIndex + "= data.length =" + data.length + " ans =" + (0 < data[currentLineIndex].length ? "true" : "false" ) );
//Util.logConsole( "hasZeroFields()2 ---- currentLineIndex =" + currentLineIndex + "= data.length =" + data.length + " ans =" + (0 < data[currentLineIndex].length ? "true" : "false" ) );
return 0 < data[currentLineIndex].length;
}

Expand All @@ -207,7 +207,7 @@ public String getField()

public String getFieldErr()
{
//System.err.println( "getFieldErr current ptr [" + currentLineIndex + "][" + currentFieldIndex + "]" );
//Util.logConsole( "getFieldErr current ptr [" + currentLineIndex + "][" + currentFieldIndex + "]" );
if ( currentLineIndex < 0 || currentLineIndex >= dataErr.length )
{
return "";
Expand All @@ -222,7 +222,7 @@ public String getFieldErr()

public void setFieldErr( String errStr )
{
//System.err.println( "setFieldErr current ptr [" + currentLineIndex + "][" + currentFieldIndex + "]" );
//Util.logConsole( "setFieldErr current ptr [" + currentLineIndex + "][" + currentFieldIndex + "]" );
if ( currentLineIndex < 0 || currentLineIndex >= dataErr.length )
{
return;
Expand All @@ -237,7 +237,7 @@ public void setFieldErr( String errStr )

public String getFieldErr( int row, int col )
{
//System.err.println( "getFieldErr [" + row + "][" + col + "]" );
//Util.logConsole( "getFieldErr [" + row + "][" + col + "]" );
if ( row < 0 || row >= dataErr.length )
{
return "";
Expand All @@ -252,7 +252,7 @@ public String getFieldErr( int row, int col )

public void setFieldErr( int row, int col, String errStr )
{
//System.err.println( "setFieldErr [" + row + "][" + col + "]" );
//Util.logConsole( "setFieldErr [" + row + "][" + col + "]" );
if ( row < 0 || row >= dataErr.length )
{
return;
Expand Down Expand Up @@ -305,43 +305,43 @@ public String printCurrentLine()
{
if ( currentLineIndex < 0 || currentLineIndex >= data.length )
{
System.err.append( "currentLineIndex out of range =" + currentLineIndex );
Util.logConsoleAppend( "currentLineIndex out of range =" + currentLineIndex );
return "";
}

System.err.append( "\n curr line >" );
Util.logConsoleAppend( "\n curr line >" );
try {
for ( int i = 0; i < data[currentLineIndex].length; i ++ )
{
if ( i > 0 )
System.err.append( "|" );
System.err.append( data[currentLineIndex][currentFieldIndex] );
Util.logConsoleAppend( "|" );
Util.logConsoleAppend( data[currentLineIndex][currentFieldIndex] );
}
}
catch( Exception ex )
{
System.err.append( "*** Error in printCurrentLine at currentLineIndex =" + currentLineIndex + " currentFieldIndex =" + currentFieldIndex );
Util.logConsoleAppend( "*** Error in printCurrentLine at currentLineIndex =" + currentLineIndex + " currentFieldIndex =" + currentFieldIndex );
}
System.err.append( "< curr line." );
Util.logConsoleAppend( "< curr line." );
return "";
}

public void printFile()
{
System.err.append( "\n ------------- PRINT FILE ---------------" );
Util.logConsoleAppend( "\n ------------- PRINT FILE ---------------" );
int maxRows = data.length;
for ( int row = 0; row < maxRows; row++ )
{
System.err.append( "\n line [" + row + "] >" );
Util.logConsoleAppend( "\n line [" + row + "] >" );
for ( int fieldIndex = 0; fieldIndex < data[ row ].length; fieldIndex++ )
{
if ( fieldIndex > 0 )
System.err.append( "|" );
System.err.append( data[ row ][ fieldIndex ] );
Util.logConsoleAppend( "|" );
Util.logConsoleAppend( data[ row ][ fieldIndex ] );
}
System.err.append( "<" );
Util.logConsoleAppend( "<" );
}
System.err.append( "\n ------------- END PRINT FILE ---------------" );
Util.logConsoleAppend( "\n ------------- END PRINT FILE ---------------" );
}

public CSVReader getReader() {
Expand Down
16 changes: 8 additions & 8 deletions src/com/moneydance/modules/features/mdcsvimporter/CSVReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -201,11 +201,11 @@ public boolean nextLine()
public String nextField()
throws IOException
{
//System.err.println( "nextField() fieldSeparator =" + (char)fieldSeparator + "=" );
//Util.logConsole( "nextField() fieldSeparator =" + (char)fieldSeparator + "=" );

if ( isEol( lastChar ) || isEof( lastChar ) )
{
//System.err.println( "nextField() return null for Eol or Eof" );
//Util.logConsole( "nextField() return null for Eol or Eof" );
return null;
}

Expand All @@ -219,10 +219,10 @@ public String nextField()
{
builder.appendCodePoint( lastChar );
lastChar = reader.read();
//System.err.println( "lastChar =" + lastChar + "=" );
//Util.logConsole( "lastChar =" + lastChar + "=" );
}
//System.err.println( "end field" );
//System.err.println( "read field =" + builder.toString() + "=" );
//Util.logConsole( "end field" );
//Util.logConsole( "read field =" + builder.toString() + "=" );

if ( !isQuote( lastChar ) )
{
Expand Down Expand Up @@ -261,19 +261,19 @@ public String nextField()

if ( trimFields )
{
//System.err.println( "CSVReader return nextField trim =" + builder.toString().trim() + "=" );
//Util.logConsole( "CSVReader return nextField trim =" + builder.toString().trim() + "=" );
return builder.toString().trim();
}
else
{
//System.err.println( "CSVReader return nextField =" + builder.toString() + "=" );
//Util.logConsole( "CSVReader return nextField =" + builder.toString() + "=" );
return builder.toString();
}
}

public void setFieldSeparator( int fieldSeparator )
{
//System.err.println( "CSVReader.setFieldSeparator =" + (char)fieldSeparator + "=" );
//Util.logConsole( "CSVReader.setFieldSeparator =" + (char)fieldSeparator + "=" );
this.fieldSeparator = fieldSeparator;
}

Expand Down
Loading

0 comments on commit 8bd55fc

Please sign in to comment.