Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[udig-devel] Troubles using FeatureWriter

Hello, I've been having a lot of troubles trying to write to a shapefile.
I've done it before but it always worked and now I don't know what I'm doing
wrong.
This is my piece of code:

try {

           FilterFactory filterFactory =
FilterFactoryFinder.createFilterFactory ();
           CompareFilter filter = filterFactory.createCompareFilter(
FilterType.COMPARE_EQUALS);
           filter.addLeftValue(filterFactory.createAttributeExpression
(...........));
           filter.addRightValue(filterFactory.createLiteralExpression (
feature.getAttribute(.....................)));

           Transaction transaction = new DefaultTransaction();
           FeatureWriter fw = fs.getDataStore().getFeatureWriter(
fs.getSchema().getTypeName(),filter, transaction);

           try {

               while(fw.hasNext()) {

                   Feature changedFeature = fw.next();
                   changedFeature.setAttribute (...........,
..............);

                   fw.write();
               }

               fw.close();
               transaction.commit();


           }
           catch (Exception e) {
               transaction.rollback();
           }
           finally {
               fw.close();
               transaction.close();
           }

       } catch (IOException ioe) {
List-Post: <mailto:udig-devel@xxxxxxxxxxxxxxxxxxxxx>
List-Help: <mailto:udig-devel-request@xxxxxxxxxxxxxxxxxxxxx?subject=help>
List-Subscribe: <http://lists.refractions.net/mailman/listinfo/udig-devel>,
	<mailto:udig-devel-request@xxxxxxxxxxxxxxxxxxxxx?subject=subscribe>
X-List-Received-Date: Mon, 21 Aug 2006 15:46:17 -0000

Hi All,

I'm back from vacation and have yet to read any mail.  Well I read
one that indicated a lot of work has gone on to fix the bugs found
with the release... The bugs were really easy to fix.  I spent a
couple of hours on my vacation and managed to fix them all so that
everything worked correctly.  I'm going to spend today getting
everything merged and fixed the fixes so that everything still works :).

Ok now to the email.

Jesse


Back to the top