Skip to content

Commit

Permalink
[CLEANUP] Reverts 6a53700 30fc3fc 6cf0f2e
Browse files Browse the repository at this point in the history
  • Loading branch information
lucboudreau committed Jan 25, 2018
1 parent 752f7f5 commit 8b96553
Show file tree
Hide file tree
Showing 7 changed files with 203 additions and 293 deletions.
22 changes: 14 additions & 8 deletions core/src/main/java/org/pentaho/di/core/row/RowMeta.java
Expand Up @@ -2,7 +2,7 @@
* *
* Pentaho Data Integration * Pentaho Data Integration
* *
* Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com
* *
******************************************************************************* *******************************************************************************
* *
Expand Down Expand Up @@ -75,7 +75,8 @@ public RowMeta() {
private RowMeta( RowMeta rowMeta, Integer targetType ) throws KettlePluginException { private RowMeta( RowMeta rowMeta, Integer targetType ) throws KettlePluginException {
this( new ArrayList<ValueMetaInterface>( rowMeta.valueMetaList.size() ), new RowMetaCache( rowMeta.cache ) ); this( new ArrayList<ValueMetaInterface>( rowMeta.valueMetaList.size() ), new RowMetaCache( rowMeta.cache ) );
for ( ValueMetaInterface valueMetaInterface : rowMeta.valueMetaList ) { for ( ValueMetaInterface valueMetaInterface : rowMeta.valueMetaList ) {
valueMetaList.add( ValueMetaFactory.cloneValueMeta( valueMetaInterface, targetType == null ? valueMetaInterface.getType() : targetType ) ); valueMetaList.add( ValueMetaFactory
.cloneValueMeta( valueMetaInterface, targetType == null ? valueMetaInterface.getType() : targetType ) );
} }
this.needRealClone = rowMeta.needRealClone; this.needRealClone = rowMeta.needRealClone;
} }
Expand Down Expand Up @@ -543,7 +544,6 @@ public int indexOfValue( String valueName ) {
// but it makes no harm as they will put the same value, // but it makes no harm as they will put the same value,
// because valueMetaList is defended from modifications by read lock // because valueMetaList is defended from modifications by read lock
cache.storeMapping( valueName, index ); cache.storeMapping( valueName, index );
needRealClone = null;
} }
} }
if ( index == null ) { if ( index == null ) {
Expand Down Expand Up @@ -730,7 +730,8 @@ public RowMeta( DataInputStream inputStream ) throws KettleFileException, Socket
} catch ( SocketTimeoutException e ) { } catch ( SocketTimeoutException e ) {
throw e; throw e;
} catch ( EOFException e ) { } catch ( EOFException e ) {
throw new KettleEOFException( "End of file while reading the number of metadata values in the row metadata", e ); throw new KettleEOFException(
"End of file while reading the number of metadata values in the row metadata", e );
} catch ( IOException e ) { } catch ( IOException e ) {
throw new KettleFileException( "Unable to read nr of metadata values: " + e.toString(), e ); throw new KettleFileException( "Unable to read nr of metadata values: " + e.toString(), e );
} }
Expand Down Expand Up @@ -794,7 +795,8 @@ public void removeValueMeta( String valueName ) throws KettleValueException {
try { try {
int index = indexOfValue( valueName ); int index = indexOfValue( valueName );
if ( index < 0 ) { if ( index < 0 ) {
throw new KettleValueException( "Unable to find value metadata with name '" + valueName + "', so I can't delete it." ); throw new KettleValueException( "Unable to find value metadata with name '"
+ valueName + "', so I can't delete it." );
} }
removeValueMeta( index ); removeValueMeta( index );
} finally { } finally {
Expand Down Expand Up @@ -958,7 +960,8 @@ public boolean equals( Object[] rowData1, Object[] rowData2, int[] fieldnrs ) th
* @throws KettleValueException * @throws KettleValueException
*/ */
@Override @Override
public int compare( Object[] rowData1, Object[] rowData2, int[] fieldnrs1, int[] fieldnrs2 ) throws KettleValueException { public int compare( Object[] rowData1, Object[] rowData2, int[] fieldnrs1, int[] fieldnrs2 )
throws KettleValueException {
int len = ( fieldnrs1.length < fieldnrs2.length ) ? fieldnrs1.length : fieldnrs2.length; int len = ( fieldnrs1.length < fieldnrs2.length ) ? fieldnrs1.length : fieldnrs2.length;
lock.readLock().lock(); lock.readLock().lock();
try { try {
Expand Down Expand Up @@ -990,7 +993,8 @@ public int compare( Object[] rowData1, Object[] rowData2, int[] fieldnrs1, int[]
* @throws KettleValueException * @throws KettleValueException
*/ */
@Override @Override
public int compare( Object[] rowData1, RowMetaInterface rowMeta2, Object[] rowData2, int[] fieldnrs1, int[] fieldnrs2 ) throws KettleValueException { public int compare( Object[] rowData1, RowMetaInterface rowMeta2, Object[] rowData2, int[] fieldnrs1,
int[] fieldnrs2 ) throws KettleValueException {
int len = ( fieldnrs1.length < fieldnrs2.length ) ? fieldnrs1.length : fieldnrs2.length; int len = ( fieldnrs1.length < fieldnrs2.length ) ? fieldnrs1.length : fieldnrs2.length;
lock.readLock().lock(); lock.readLock().lock();
try { try {
Expand Down Expand Up @@ -1197,7 +1201,8 @@ public RowMeta( Node node ) throws KettleException {
int nrValues = XMLHandler.countNodes( node, ValueMeta.XML_META_TAG ); int nrValues = XMLHandler.countNodes( node, ValueMeta.XML_META_TAG );
for ( int i = 0; i < nrValues; i++ ) { for ( int i = 0; i < nrValues; i++ ) {
ValueMeta valueMetaSource = new ValueMeta( XMLHandler.getSubNodeByNr( node, ValueMeta.XML_META_TAG, i ) ); ValueMeta valueMetaSource = new ValueMeta( XMLHandler.getSubNodeByNr( node, ValueMeta.XML_META_TAG, i ) );
ValueMetaInterface valueMeta = ValueMetaFactory.createValueMeta( valueMetaSource.getName(), valueMetaSource.getType(), valueMetaSource.getLength(), valueMetaSource.getPrecision() ); ValueMetaInterface valueMeta = ValueMetaFactory.createValueMeta( valueMetaSource.getName(), valueMetaSource.getType(),
valueMetaSource.getLength(), valueMetaSource.getPrecision() );
ValueMetaFactory.cloneInfo( valueMetaSource, valueMeta ); ValueMetaFactory.cloneInfo( valueMetaSource, valueMeta );
addValueMeta( valueMeta ); addValueMeta( valueMeta );
} }
Expand Down Expand Up @@ -1310,3 +1315,4 @@ Integer findAndCompare( String name, List<? extends ValueMetaInterface> metas )


} }
} }

0 comments on commit 8b96553

Please sign in to comment.