Select to view content in your preferred language

addin in 10.1 - locking errors while appending - quick fix?

3322
2
06-05-2015 07:56 AM
AnthonyZifer
Deactivated User

i inherited some java code (using eclipse) for an addin that appends files together - in 10.0 the addin worked, now in 10.1 i get locking errors while appending.  Is there a quick code fix for that?

0 Kudos
2 Replies
ToddBlanchette
Frequent Contributor

Hi Anthony,

I'm thinking we'd need to see your code to be able to fully interpret what may be causing your locking issues. Many things could be at play here, especially with all the changes from 10 to 10.1.

0 Kudos
AnthonyZifer
Deactivated User

The following code is within a while loop, thanks for investigating!

if (blnFirstCounty == true)

  {

  // get ref to local_mcd_muni layer if it already exists

  IFeatureLayer lObjLocalMcdMuniFL =  Utilities.FindFeatureLayer(OutputLayerName, lObjMxDoc);

  if (lObjLocalMcdMuniFL == null)

  {

  // LocalMcdMuni layer does not exist, create it using this county

  WriteToLog(lObjLogFile, "Exporting " + lObjFinalLocalMuniFL.getName() + " to " + OutputLayerName );

  Utilities.ExportFeaturesToShape(lObjFinalLocalMuniFL, OutputLayerName, Utilities.ShapeFileOutputPath, null);

  // Add the layer to the map

  WriteToLog(lObjLogFile, "Adding " + lObjFinalLocalMuniFL.getName() + " to the map." );

  Utilities.AddShapeFile(OutputLayerName, Utilities.ShapeFileOutputPath, lObjArcApp);

  //JOptionPane.showMessageDialog(null, "exported " + OutputLayerName);

  }

  else

  {

  // LocalMcdMuni layer does exist, append this county to it.

  WriteToLog(lObjLogFile, "Appending " + lObjFinalLocalMuniFL.getName() + " to " + OutputLayerName);

  Utilities.GeoProcess(lObjFinalLocalMuniFL.getName().concat(".shp"), OutputLayerName.concat(".shp"), Utilities.ShapeFileOutputPath, "", "", "Append");

  }

  blnFirstCounty = false;

}

  else

  {

  // This is not the 1st county, so append it to the master layer

  WriteToLog(lObjLogFile, "Appending " + lObjFinalLocalMuniFL.getName() + " to " + OutputLayerName);

  Utilities.GeoProcess(lObjFinalLocalMuniFL.getName().concat(".shp"), OutputLayerName.concat(".shp"), Utilities.ShapeFileOutputPath, "", "", "Append");

  }

  // Clean up temp files / layers

  Utilities.RemoveLayer(strExplodeLayer, lObjMxDoc);

  Utilities.DeleteShapeFile(Utilities.ShapeFileOutputPath, strExplodeLayer);

  Utilities.RemoveLayer(strMuniMcdIdentiryLayerName, lObjMxDoc);

  Utilities.DeleteShapeFile(Utilities.ShapeFileOutputPath, strMuniMcdIdentiryLayerName);

  Utilities.RemoveLayer(lObjFinalLocalMuniFL.getName(), lObjMxDoc);

  Utilities.DeleteShapeFile(Utilities.ShapeFileOutputPath, lObjFinalLocalMuniFL.getName());

  }

0 Kudos