You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by rh...@apache.org on 2008/01/31 18:45:09 UTC
svn commit: r617170 - in /db/derby/code/trunk/java/demo/vtis:
java/org/apache/derbyDemo/vtis/example/PropertyFileVTI.java
sql/demoFileVtis.sql
Author: rhillegas
Date: Thu Jan 31 09:45:04 2008
New Revision: 617170
URL: http://svn.apache.org/viewvc?rev=617170&view=rev
Log:
DERBY-3129: Make the property-file reading VTI handle continuation lines.
Modified:
db/derby/code/trunk/java/demo/vtis/java/org/apache/derbyDemo/vtis/example/PropertyFileVTI.java
db/derby/code/trunk/java/demo/vtis/sql/demoFileVtis.sql
Modified: db/derby/code/trunk/java/demo/vtis/java/org/apache/derbyDemo/vtis/example/PropertyFileVTI.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/demo/vtis/java/org/apache/derbyDemo/vtis/example/PropertyFileVTI.java?rev=617170&r1=617169&r2=617170&view=diff
==============================================================================
--- db/derby/code/trunk/java/demo/vtis/java/org/apache/derbyDemo/vtis/example/PropertyFileVTI.java (original)
+++ db/derby/code/trunk/java/demo/vtis/java/org/apache/derbyDemo/vtis/example/PropertyFileVTI.java Thu Jan 31 09:45:04 2008
@@ -105,20 +105,40 @@
{
String[] newRow = new String[ COLUMN_NAMES.length ];
String nextLine = null;
+ String oldLine = "";
while( true )
{
+ boolean isContinuationLine = ( oldLine.length() != 0 );
+
nextLine = readLine();
// if at EOF, get out of here
- if ( nextLine == null ) { return null; }
+ if ( nextLine == null )
+ {
+ if ( !isContinuationLine ) { return null; }
+ else { nextLine = oldLine; }
+ }
nextLine = nextLine.trim();
// skip blank lines and lines which start with the comment character
if ( nextLine.startsWith( "#" ) ) { continue; }
- else if ( nextLine.length() == 0 ) { continue; }
- else { break; }
+ else if ( nextLine.length() == 0 )
+ {
+ if ( !isContinuationLine ) { continue; }
+ }
+
+ // handle continuation lines
+ nextLine = oldLine + nextLine;
+
+ if ( nextLine.endsWith( "\\" ) )
+ {
+ oldLine = nextLine.substring( 0, nextLine.length() - 1 );
+ continue;
+ }
+
+ break;
}
int equalsIdx = nextLine.indexOf( '=' );
@@ -127,7 +147,7 @@
if ( equalsIdx >= 0 )
{
newRow[ PROPERTY_KEY ] = nextLine.substring( 0, equalsIdx );
- newRow[ PROPERTY_VALUE ] = nextLine.substring( equalsIdx, nextLine.length() );
+ newRow[ PROPERTY_VALUE ] = nextLine.substring( equalsIdx + 1, nextLine.length() );
}
else
{
Modified: db/derby/code/trunk/java/demo/vtis/sql/demoFileVtis.sql
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/demo/vtis/sql/demoFileVtis.sql?rev=617170&r1=617169&r2=617170&view=diff
==============================================================================
--- db/derby/code/trunk/java/demo/vtis/sql/demoFileVtis.sql (original)
+++ db/derby/code/trunk/java/demo/vtis/sql/demoFileVtis.sql Thu Jan 31 09:45:04 2008
@@ -107,8 +107,8 @@
--
----------------------------------------------------------------------------------------
--- find the messages whihc have not been translated into french
-select m_english.messageID
+-- find the messages which have not been translated into french
+select *
from table( propertyFileVTI( '/opt/DerbyTrunk/java/engine/org/apache/derby/loc/messages_en.properties' ) ) m_english
where m_english.messageID not in
(