com.dd.plist.PropertyListFormatException Java Examples

The following examples show how to use com.dd.plist.PropertyListFormatException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: InflatableData.java    From InflatableDonkey with MIT License 6 votes vote down vote up
public static Optional<InflatableData> from(byte[] bs) {
    InflatableData data;
    try {
        NSDictionary parse = (NSDictionary) PropertyListParser.parse(bs);
        byte[] escrowedKeys = ((NSData) parse.get("escrowedKeys")).bytes();
        UUID deviceUuid = UUID.fromString(((NSString) parse.get("deviceUuid")).getContent());
        String deviceHardWareId = ((NSString) parse.get("deviceHardWareId")).getContent();
        data = new InflatableData(escrowedKeys, deviceUuid, deviceHardWareId);

    } catch (ClassCastException | IllegalArgumentException | IOException | NullPointerException
            | PropertyListFormatException | ParseException | ParserConfigurationException | SAXException ex) {
        logger.warn("-- from() - exception: ", ex);
        data = null;
    }
    return Optional.ofNullable(data);
}
 
Example #2
Source File: PropertyListResponseHandler.java    From InflatableDonkey with MIT License 6 votes vote down vote up
@Override
public T handleEntity(HttpEntity entity) throws IOException {
    NSObject nsObject;

    try {
        // Avoiding PropertyListParser#parse(InputStream) as the current Maven build (1.16) can bug out.
        nsObject = PropertyListParser.parse(EntityUtils.toByteArray(entity));

    } catch (PropertyListFormatException | ParseException | ParserConfigurationException | SAXException ex) {
        throw new BadDataException("failed to parse property list", ex);
    }

    if (to.isAssignableFrom(nsObject.getClass())) {
        return to.cast(nsObject);
    }

    throw new BadDataException("failed to cast property list: " + nsObject.getClass());
}
 
Example #3
Source File: IpaLoader.java    From unidbg with Apache License 2.0 5 votes vote down vote up
private static String parseExecutable(File ipa, String appDir) throws IOException {
    try {
        byte[] data = loadZip(ipa, appDir + "Info.plist");
        if (data == null) {
            throw new IllegalStateException("Find Info.plist failed");
        }
        NSDictionary info = (NSDictionary) PropertyListParser.parse(data);
        NSString bundleExecutable = (NSString) info.get("CFBundleExecutable");
        return bundleExecutable.getContent();
    } catch (PropertyListFormatException | ParseException | ParserConfigurationException | SAXException e) {
        throw new IllegalStateException("load ipa failed", e);
    }
}
 
Example #4
Source File: IpaLoader.java    From unidbg with Apache License 2.0 5 votes vote down vote up
private static String parseVersion(File ipa, String appDir) throws IOException {
    try {
        byte[] data = loadZip(ipa, appDir + "Info.plist");
        if (data == null) {
            throw new IllegalStateException("Find Info.plist failed");
        }
        NSDictionary info = (NSDictionary) PropertyListParser.parse(data);
        NSString bundleVersion = (NSString) info.get("CFBundleVersion");
        return bundleVersion.getContent();
    } catch (PropertyListFormatException | ParseException | ParserConfigurationException | SAXException e) {
        throw new IllegalStateException("load ipa failed", e);
    }
}
 
Example #5
Source File: IpaLoader.java    From unidbg with Apache License 2.0 5 votes vote down vote up
private static String parseCFBundleIdentifier(File ipa, String appDir) throws IOException {
    try {
        byte[] data = loadZip(ipa, appDir + "Info.plist");
        if (data == null) {
            throw new IllegalStateException("Find Info.plist failed");
        }
        NSDictionary info = (NSDictionary) PropertyListParser.parse(data);
        NSString bundleIdentifier = (NSString) info.get("CFBundleIdentifier");
        return bundleIdentifier.getContent();
    } catch (PropertyListFormatException | ParseException | ParserConfigurationException | SAXException e) {
        throw new IllegalStateException("load ipa failed", e);
    }
}
 
Example #6
Source File: ApplicationInfoService.java    From justtestlah with Apache License 2.0 5 votes vote down vote up
protected NSDictionary getDictionary(File path) {
  try {
    return (NSDictionary) PropertyListParser.parse(path);
  } catch (IOException
      | PropertyListFormatException
      | ParseException
      | ParserConfigurationException
      | SAXException exception) {
    String errorMessage = String.format("Error reading dictionary from %s", path);
    LOG.error(errorMessage, exception);
    throw new MobileToolsException(errorMessage, exception);
  }
}
 
Example #7
Source File: DictionaryLicense.java    From cyberduck with GNU General Public License v3.0 5 votes vote down vote up
private NSDictionary read(final Local file) {
    try {
        return (NSDictionary) XMLPropertyListParser.parse(file.getInputStream());
    }
    catch(ParserConfigurationException
            | IOException
            | SAXException
            | PropertyListFormatException
            | ParseException
            | AccessDeniedException e) {
        log.warn(String.format("Failure %s reading dictionary from %s", e.getMessage(), file));
    }
    return null;
}
 
Example #8
Source File: PlistReader.java    From cyberduck with GNU General Public License v3.0 5 votes vote down vote up
private NSObject parse(final InputStream in) throws AccessDeniedException {
    try {
        return XMLPropertyListParser.parse(in);
    }
    catch(ParserConfigurationException | IOException | SAXException | ParseException | PropertyListFormatException e) {
        throw new AccessDeniedException("Failure parsing XML property list", e);
    }
}
 
Example #9
Source File: Accounts.java    From InflatableDonkey with MIT License 5 votes vote down vote up
public static Account account(byte[] bs) {
    try {
        NSDictionary dict = (NSDictionary) PropertyListParser.parse(bs);
        return account(dict);
    } catch (IOException | PropertyListFormatException | ParseException | ParserConfigurationException | SAXException ex) {
        throw new IllegalArgumentException(ex);
    }
}
 
Example #10
Source File: PListsLegacy.java    From InflatableDonkey with MIT License 5 votes vote down vote up
public static Optional<NSObject> parse(byte[] data) {
    try {
        NSObject nsObject = PropertyListParser.parse(data);
        return Optional.of(nsObject);

    } catch (IOException | PropertyListFormatException | ParseException | ParserConfigurationException | SAXException ex) {
        logger.warn("-- parse() - failed to parse NSObject data: 0x{}", Hex.toHexString(data));
        return Optional.empty();
    }
}
 
Example #11
Source File: PListsLegacy.java    From InflatableDonkey with MIT License 5 votes vote down vote up
@Deprecated
public static <T> T parseLegacy(byte[] data) {
    try {
        return (T) PropertyListParser.parse(data);

    } catch (ClassCastException |
            IOException |
            PropertyListFormatException |
            ParseException |
            ParserConfigurationException |
            SAXException ex) {

        throw new IllegalArgumentException("failed to parse property list", ex);
    }
}
 
Example #12
Source File: NSDictionaries.java    From InflatableDonkey with MIT License 5 votes vote down vote up
static Optional<NSObject> parseNSObject(byte[] data) {
    try {
        NSObject nsObject = PropertyListParser.parse(data);
        return Optional.of(nsObject);

    } catch (IOException | PropertyListFormatException | ParseException | ParserConfigurationException |
            SAXException ex) {
        logger.warn("-- parseNSObject() - failed to parse data: {} 0x{}", ex.getMessage(), Hex.toHexString(data));
        return Optional.empty();
    }
}
 
Example #13
Source File: PropertyLists.java    From LiquidDonkey with MIT License 5 votes vote down vote up
static <T> T parse(byte[] data) throws BadDataException {
    try {
        return (T) PropertyListParser.parse(data);

    } catch (ClassCastException |
            IOException |
            PropertyListFormatException |
            ParseException |
            ParserConfigurationException |
            SAXException ex) {

        throw new BadDataException("Failed to parse property list", ex);
    }
}