Commit 03f50b89 authored by Makayla Shepherd's avatar Makayla Shepherd
Browse files

An error will be displayed when attempting to modify the label of a read-only cube. Fixes #2213.

git-svn-id: http://subversion.wr.usgs.gov/repos/prog/isis3/trunk@6360 41f8697f-d340-4b68-9986-7bafba869bb8
parent c793affc
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -288,7 +288,7 @@ void IsisMain() {
      inputLabels = FileName::createTempFile( ui.GetFileName("TEMPFILE") );
      label.write( inputLabels.expanded() );
      Cube cube;
      cube.open(inputLabels.expanded(), "r");
      cube.open(inputLabels.expanded(), "rw");
      kernelSuccess = tryKernels(cube, label, p, lk, pck, targetSpk,
                                 realCkKernel, fk, ik, sclk, spk,
                                 iak, dem, exk);
+3 −0
Original line number Diff line number Diff line
@@ -47,6 +47,9 @@
      (from spiceinit), causing spiceserver to return an incorrect end time for the spice
      information. Added TEMPFILE parameter for testing purposes. Fixes #2030.
    </change>
    <change name="Makayla Shepherd" date="2015-09-08">
      Modified to open the temporary cube correctly. Fixes #2213.
    </change>
  </history>

  <groups>
+8 −1
Original line number Diff line number Diff line
@@ -498,7 +498,7 @@ namespace Isis {


  /**
   * This method will open an isis sube for reading or reading/writing.
   * This method will open an isis cube for reading or reading/writing.
   *
   * @param[in] cubeFileName Name of the cube file to open. Environment
   *     variables in the filename will be automatically expanded.
@@ -1624,6 +1624,13 @@ namespace Isis {
   * @param[in] group Label containing the group to put.
   */
  void Cube::putGroup(const PvlGroup &group) {
    if (isReadOnly()) {
      QString msg = "Cannot add a group to the label of cube [" + (QString)QFileInfo(fileName()).fileName() +
          "] because it is opened read-only";
      throw IException(IException::Programmer, msg, _FILEINFO_);
      return;
    }
    
    PvlObject &isiscube = label()->findObject("IsisCube");
    if (isiscube.hasGroup(group.name())) {
      isiscube.findGroup(group.name()) = group;
+2 −0
Original line number Diff line number Diff line
@@ -147,6 +147,8 @@ namespace Isis {
   *                           Added cases to test creating bsq and large bsq cubes.
   *                           References #1689.
   *   @history 2015-01-30 Ian Humphrey - Deallocated copied cubes in unittest. References #2082.
   *   @history 2015-06-22 Makayla Shepherd - Using putGroup() a group on the label of a read-only 
   *                           cube now throws an error.
   */
  class Cube {
    public:
+1 −0
Original line number Diff line number Diff line
@@ -290,6 +290,7 @@ Testing errors ...
**PROGRAMMER ERROR** SetDimensions:  Invalid number of sample, lines or bands.
**I/O ERROR** Failed to open [...] with read/write access.
**ERROR** Cannot create the cube [shouldntExist.cub] with a pixel type set to None.
**PROGRAMMER ERROR** Cannot add a group to the label of cube [IsisCube_06.cub] because it is opened read-only.

Test creating an ecub
Object = IsisCube
Loading