Checks to make sure that the files specified in a content spec are valid and exist.

@param contentSpec The content spec to check.
@return True if all the files are valid, otherwise false.
162389
protected boolean validateFiles(final ContentSpec contentSpec) {
        final FileList fileList = contentSpec.getFileList();
        boolean valid = true;

        if (fileList != null && !fileList.getValue().isEmpty()) {
            for (final File file : fileList.getValue()) {
                FileWrapper fileWrapper = null;
                try {
                    fileWrapper = fileProvider.getFile(file.getId(), file.getRevision());
                } catch (NotFoundException e) {
                    log.debug("Could not find file for id " + file.getId());
                }

                if (fileWrapper == null) {
                    log.error(String.format(ProcessorConstants.ERROR_FILE_ID_NONEXIST_MSG, fileList.getLineNumber(), file.getText()));
                    valid = false;
                } else if (file.getTitle() != null) {
                    // Make sure the titles sync up, as a title was specified.
                    if (!fileWrapper.getFilename().equals(file.getTitle())) {
                        final String errorMsg = String.format(ProcessorConstants.ERROR_FILE_TITLE_NO_MATCH_MSG, fileList.getLineNumber(),
                                file.getTitle(), fileWrapper.getFilename());
                        if (processingOptions.isStrictTitles()) {
                            log.error(errorMsg);
                            valid = false;
                        } else {
                            log.warn(errorMsg);
                            file.setTitle(fileWrapper.getFilename());
                        }
                    }
                } else {
                    // The short format was used if the title is null, so add it
                    file.setTitle(fileWrapper.getFilename());
                }
            }
        }

        return valid;
    }
519814
protected boolean hasContentType() {

        boolean result = false;
        if(this.request.getHeader(RestMessageHeaders.CONTENT_TYPE) != null) {
            result = true;
        } else {
            logger.error("Error when validating put request. Missing Content-Type header.");
            RestErrorHandler.writeErrorResponse(this.messageEvent,
                                                HttpResponseStatus.BAD_REQUEST,
                                                "Missing Content-Type header");
        }
        return result;
    }
1170394
def isSupportedContent(cls, fileContent):
        """"""
        magic = bytearray(fileContent)[:4]
        return magic == p('>I', 0xfeedface) or magic == p('>I', 0xfeedfacf) or magic == p('<I', 0xfeedface) or magic == p('<I', 0xfeedfacf)
1027361
public boolean preValidateBugLinks(final ContentSpec contentSpec) {
        // If Bug Links are turned off then there isn't any need to validate them.
        if (!contentSpec.isInjectBugLinks()) {
            return true;
        }

        final BugLinkOptions bugOptions;
        final BugLinkType type;
        if (contentSpec.getBugLinks().equals(BugLinkType.JIRA)) {
            type = BugLinkType.JIRA;
            bugOptions = contentSpec.getJIRABugLinkOptions();
        } else {
            type = BugLinkType.BUGZILLA;
            bugOptions = contentSpec.getBugzillaBugLinkOptions();
        }
        final BaseBugLinkStrategy bugLinkStrategy = BugLinkStrategyFactory.getInstance().create(type, bugOptions.getBaseUrl());

        // Validate the content in the bug options using the appropriate bug link strategy
        try {
            bugLinkStrategy.checkValidValues(bugOptions);
        } catch (ValidationException e) {
            final Throwable cause = ExceptionUtilities.getRootCause(e);
            log.error(cause.getMessage());
            return false;
        }

        return true;
    }
1151435
public boolean includesDefinedInContent() {

        if ((m_types == null) || m_types.isEmpty()) {
            return true;
        }
        Iterator<CmsRelationType> itTypes = m_types.iterator();
        while (itTypes.hasNext()) {
            CmsRelationType type = itTypes.next();
            if (type.isDefinedInContent()) {
                return true;
            }
        }
        return false;
    }
706183
public final void getContent (@Nonnull final WPECTYPE aWPEC)
  {
    if (isValidToDisplayPage (aWPEC).isValid ())
    {
      // "before"-callback
      beforeFillContent (aWPEC);

      // Create the main page content
      fillContent (aWPEC);

      // "after"-callback
      afterFillContent (aWPEC);
    }
    else
    {
      // Invalid to display page
      onInvalidToDisplayPage (aWPEC);
    }
  }
543208
protected boolean hasContentLength() {
        boolean result = false;
        String contentLength = this.request.getHeader(RestMessageHeaders.CONTENT_LENGTH);
        if(contentLength != null) {
            try {
                Long.parseLong(contentLength);
                result = true;
            } catch(NumberFormatException nfe) {
                logger.error("Exception when validating put request. Incorrect content length parameter. Cannot parse this to long: "
                                     + contentLength + ". Details: " + nfe.getMessage(),
                             nfe);
                RestErrorHandler.writeErrorResponse(this.messageEvent,
                                                    HttpResponseStatus.BAD_REQUEST,
                                                    "Incorrect content length parameter. Cannot parse this to long: "
                                                            + contentLength + ". Details: "
                                                            + nfe.getMessage());
            }
        } else {
            logger.error("Error when validating put request. Missing Content-Length header.");
            RestErrorHandler.writeErrorResponse(this.messageEvent,
                                                HttpResponseStatus.BAD_REQUEST,
                                                "Missing Content-Length header");
        }

        return result;
    }
1353106
public static boolean compareFiles(final File source, final File compare, final boolean content)
	{
		boolean equal = true;
		// boolean sameLastModified = false;
		// boolean sameAbsolutePath = false;
		boolean sameFilename = false;
		// // Check if the files have the same absolute path.
		// int s = source.compareTo(compare);
		// sameAbsolutePath = s == 0;
		//
		// // Check if the files have same names.
		// sameFilename = source.getName().equals(compare.getName());
		//
		// // Check if the Files have the same lastModified date.
		// sameLastModified = source.lastModified() == compare.lastModified();

		// Check if source file exists.
		if (!source.exists())
		{
			// Check if compare file exists.
			if (!compare.exists())
			{
				// // Check if the files have same names.
				sameFilename = source.getName().equals(compare.getName());
				if (sameFilename)
				{
					return true;
				}
			}
			return false;
		}
		else
		{
			if (!compare.exists())
			{
				return false;
			}
		}

		// Check if the Files have the same lastModified date.
		if (source.length() != compare.length())
		{
			return false;
		}
		// Compare the content?
		if (content)
		{
			try (BufferedReader sourceReader = (BufferedReader)StreamExtensions.getReader(source);
				BufferedReader compareReader = (BufferedReader)StreamExtensions.getReader(compare);)
			{
				String sourceLine;
				String compareLine;

				while ((sourceLine = sourceReader.readLine()) != null)
				{
					compareLine = compareReader.readLine();
					if (compareLine == null || !sourceLine.equals(compareLine))
					{
						equal = false;
						break;
					}
				}
			}
			catch (final FileNotFoundException e)
			{
				equal = false;
			}
			catch (final IOException e)
			{
				equal = false;
			}
		}
		return equal;
	}
1373209
public CmsXmlContentErrorHandler validateContent(Map<String, String> contentValues) throws CmsUgcException {

        checkNotFinished();
        try {
            CmsFile file = m_cms.readFile(m_editResource);
            CmsXmlContent content = addContentValues(file, contentValues);
            return content.validate(m_cms);
        } catch (CmsException e) {
            LOG.error(e.getLocalizedMessage(), e);
            throw new CmsUgcException(e, CmsUgcConstants.ErrorCode.errMisc, e.getLocalizedMessage());
        }
    }
605754
private boolean checkFilesExists(String[] requiredFiles, File childResource) {

        File setupFile = null;
        boolean hasMissingSetupFiles = false;

        for (int j = 0; j < requiredFiles.length; j++) {
            setupFile = new File(childResource.getPath() + File.separatorChar + requiredFiles[j]);

            if (!setupFile.exists() || !setupFile.isFile() || !setupFile.canRead()) {
                hasMissingSetupFiles = true;
                System.err.println(
                    "[" + getClass().getName() + "] missing or unreadable database setup file: " + setupFile.getPath());
                break;
            }

            if (!hasMissingSetupFiles) {
                return true;
            }
        }
        return false;
    }
227317
public static boolean isSpecificationSupported(String spec) {
        return SPEC_1_0.equals(spec) || SPEC_1_1.equals(spec) || SPEC_1_2.equals(spec) || SPEC_1_3.equals(spec);
    }
560968
public static boolean containsInvalid(String fileName) {
		return StrUtil.isBlank(fileName) ? false : ReUtil.contains(FILE_NAME_INVALID_PATTERN_WIN, fileName);
	}
1342912
@Beta
    public boolean isValidSection(SectionHeader header) {
        // sidenote: the readsize should never be > 0 if the section starts
        // outside the file
        // but we make sure that everything is alright
        return getReadSize(header) > 0
                && header.getAlignedPointerToRaw() < file.length();
    }
1019480
public boolean postValidateLevel(final Level level, final ContentSpec contentSpec) {
        // Check if the app should be shutdown
        if (isShuttingDown.get()) {
            shutdown.set(true);
            return false;
        }

        boolean valid = true;

        // Validate the tags
        if (!validateTopicTags(level, level.getTags(false))) {
            valid = false;
        }

        // Validate the info topic
        if (level.getInfoTopic() != null) {
            postValidateInfoTopic(level.getInfoTopic(), contentSpec);
        }

        // Validate the sub levels and topics
        for (final Node childNode : level.getChildNodes()) {
            if (childNode instanceof Level) {
                if (!postValidateLevel((Level) childNode, contentSpec)) {
                    valid = false;
                }
            } else if (childNode instanceof SpecTopic) {
                if (!postValidateTopic((SpecTopic) childNode, contentSpec)) {
                    valid = false;
                }
            }
        }

        return valid;
    }
444268
protected void checkForConflictingCondition(final IOptionsNode node, final ContentSpec contentSpec) {
        if (!isNullOrEmpty(node.getConditionStatement())) {
            final String publicanCfg;
            if (!contentSpec.getDefaultPublicanCfg().equals(CommonConstants.CS_PUBLICAN_CFG_TITLE)) {
                final String name = contentSpec.getDefaultPublicanCfg();
                final Matcher matcher = CSConstants.CUSTOM_PUBLICAN_CFG_PATTERN.matcher(name);
                final String fixedName = matcher.find() ? matcher.group(1) : name;
                publicanCfg = contentSpec.getAdditionalPublicanCfg(fixedName);
            } else {
                publicanCfg = contentSpec.getPublicanCfg();
            }

            // Make sure a publican.cfg is defined before doing any checks
            if (!isNullOrEmpty(publicanCfg)) {
                if (publicanCfg.contains("condition:")) {
                    log.warn(String.format(ProcessorConstants.WARN_CONDITION_IGNORED_MSG, node.getLineNumber(), node.getText()));
                }
            }
        }
    }
1217943
public static Integer getContentSpecID(final String contentSpecString) {
        final Matcher matcher = CS_ID_PATTERN.matcher(contentSpecString);
        if (matcher.find()) {
            return Integer.parseInt(matcher.group("ID"));
        }

        return null;
    }
1190324
public static boolean isMultiPartForm(@CheckForNull String contentType) {
        if (contentType == null) {
            return false;
        }

        String[] parts = contentType.split(";");
        return ArrayUtils.contains(parts, "multipart/form-data");
    }