Changeset 1457 for trunk


Ignore:
Timestamp:
11/29/19 15:17:33 (4 years ago)
Author:
bnemhaus
Message:

Fixed bug that did not get correct label names and was therefore causing Expeditee to attempt to display encrypted primaries.

Suppressed using MessageBay because the way the code is currently structured this causes recursive infinite loop. Until code restructured, the 'fix' is to use std err instead.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/encryption/items/surrogates/Label.java

    r1443 r1457  
    44import java.util.Arrays;
    55import java.util.Base64;
    6 import java.util.Collection;
    76import java.util.List;
    87import java.util.function.Predicate;
     
    1110
    1211import org.expeditee.gui.ItemsList;
    13 import org.expeditee.gui.MessageBay;
    1412import org.expeditee.items.Item;
    1513import org.expeditee.items.Text;
     
    125123                        }
    126124                } else {
    127                         return getLabelsFromContext(itemsList);
     125                        List<String> labelsFromContext = getLabelsFromContext(itemsList);
     126                        ArrayList<String> copy = new ArrayList<String>(labelsFromContext);
     127                        copy.retainAll(userLabels);
     128                        return copy;
    128129                }
    129130        }
     
    146147                                surrogateStep = 0;
    147148                                isInSurrogateMode = false;
    148                                 MessageBay.displayMessage("You have lost access to the encryption label "
     149//                              MessageBay.displayMessage("You have lost access to the encryption label "
     150//                                              + surrogateMode + ".  Dropping out of surrogate mode.");
     151                                System.out.println("You have lost access to the encryption label "
    149152                                                + surrogateMode + ".  Dropping out of surrogate mode.");
    150153                        }
     
    179182        private static List<String> getLabelsFromContext(ItemsList context) {
    180183                Predicate<Item> hasEncryptionLabel = item -> item.getEncryptionLabel() != null && !item.getEncryptionLabel().isEmpty();
    181                 Collection<Item> local = new ItemsList(context).underlying();
     184                List<Item> local = context.cloneList();
    182185                Stream<Item> itemsWithLabel = local.stream().filter(hasEncryptionLabel);
    183186                Stream<String> labels = itemsWithLabel.map(item -> item.getEncryptionLabel()).distinct();
Note: See TracChangeset for help on using the changeset viewer.