@Nullable public String getNameSecure () { return FilenameHelper.getAsSecureValidFilename (m_sName); }
@Nullable @ReturnsMutableCopy public ICommonsList <MimeTypeInfo> getAllInfosOfFilename (@Nullable final File aFile) { if (aFile == null) return null; final String sExtension = FilenameHelper.getExtension (aFile); return getAllInfosOfExtension (sExtension); }
AuditHasFilename (@Nullable final String sBaseDir) { ValueEnforcer.isTrue (StringHelper.hasNoText (sBaseDir) || FilenameHelper.endsWithPathSeparatorChar (sBaseDir), () -> "BaseDir '" + sBaseDir + "' must end with path separator!"); m_sBaseDir = sBaseDir; }
public AbstractUserDataObject (@Nonnull @Nonempty final String sPath, final boolean bIsTemporary) { ValueEnforcer.notEmpty (sPath, "Path"); // Ensure only forward slashes m_sPath = FilenameHelper.getPathUsingUnixSeparator (FilenameHelper.ensurePathStartingWithSeparator (sPath)); m_bIsTemporary = bIsTemporary; }
final String sFilenameToUse = FilenameHelper.getWithoutPath (FilenameHelper.getAsSecureValidFilename (sFilename)); if (!sFilename.equals (sFilenameToUse)) logWarn ("Content-Dispostion filename was internally modified from '" +
protected final boolean isValidFilenameAccordingToTheRules (@Nullable final String sRelativeFilename) final String sFilename = FilenameHelper.getWithoutPath (sRelativeFilename); final String sUnifiedExt = getUnifiedItem (FilenameHelper.getExtension (sFilename));
FilenameHelper.getWithoutPath (aSchematronResource.getPath ()) + ".min-xslt.sch"), sXML, FilenameHelper.getWithoutPath (aSchematronResource.getPath ()) + ".xslt"), sXML, XMLWriterSettings.DEFAULT_XML_CHARSET_OBJ);
final String sDirectory = aRequestScope.params ().getAsString (PARAM_DIRECTORY); final boolean bDirectoryPresent = StringHelper.hasText (sDirectory); if (bDirectoryPresent && !FilenameHelper.isValidFilenameWithPaths (sDirectory)) ret = createError ("The passed directory name '" + sDirectory + "' is invalid!"); else String sPath = bDirectoryPresent ? FilenameHelper.ensurePathEndingWithSeparator (sDirectory) : "/"; final String sExt = FilenameHelper.getExtension (aFileItem.getNameSecure ()); if (StringHelper.hasText (sExt)) sPath += "." + sExt;
FilenameHelper.getWithoutExtension (sFilename) + m_sXsltExtension);
final String sAPIPath = FilenameHelper.ensurePathStartingWithSeparator (aRequestScope.getPathWithinServlet ()); final EHttpMethod eHTTPMethod = aRequestScope.getHttpMethod (); final IAPIInvoker aAPIMgr = m_aFactory.get ();
FilenameHelper.getWithoutPath (aSchematronResource.getPath ()) + ".min-xslt.sch"), sXML, FilenameHelper.getWithoutPath (aSchematronResource.getPath ()) + ".xslt"), sXML, XMLWriterSettings.DEFAULT_XML_CHARSET_OBJ);
final File aCompressed = new File (FilenameHelper.getWithoutExtension (aChild.getAbsolutePath ()) + targetFileExtension); if (aCompressed.lastModified () < aChild.lastModified () || forceCompress)
@Nullable public String getNameSecure () { final String sSecureName = FilenameHelper.getAsSecureValidFilename (m_sFilename); if (!EqualsHelper.equals (sSecureName, m_sFilename)) if (LOGGER.isInfoEnabled ()) LOGGER.info ("FileItem filename was changed from '" + m_sFilename + "' to '" + sSecureName + "'"); return sSecureName; }
_addOutgoingHeaders (ret, FilenameHelper.getWithoutPath (aSrcFile));
@Nullable @ReturnsMutableCopy public ICommonsList <MimeTypeInfo> getAllInfosOfFilename (@Nullable final String sFilename) { if (StringHelper.hasNoText (sFilename)) return null; final String sExtension = FilenameHelper.getExtension (sFilename); return getAllInfosOfExtension (sExtension); }
@Nonnull public static File getUniqueFile (@Nonnull final File aDir, @Nullable final String sFilename) { final String sBaseFilename = FilenameHelper.getAsSecureValidFilename (sFilename); int nCounter = -1; while (true) { final File aTest = new File (aDir, nCounter == -1 ? sBaseFilename : sBaseFilename + "." + Integer.toString (nCounter)); if (!aTest.exists ()) return aTest; nCounter++; } }
/** * Get the primary (=first) mime type associated with the specified filename. * * @param sFilename * The filename to retrieve the primary mime type from. May neither be * <code>null</code> nor empty. * @return <code>null</code> if no mime type is associated with the extension * of the passed filename */ @Nullable public IMimeType getPrimaryMimeTypeForFilename (@Nonnull @Nonempty final String sFilename) { ValueEnforcer.notEmpty (sFilename, "Filename"); final String sExtension = FilenameHelper.getExtension (sFilename); return getPrimaryMimeTypeForExtension (sExtension); }
public JettyStarter (@Nonnull @Nonempty final String sAppName) { ValueEnforcer.notEmpty (sAppName, "AppName"); m_sAppName = sAppName; m_sDirBaseName = FilenameHelper.getAsSecureValidFilename (sAppName); if (StringHelper.hasNoText (m_sDirBaseName)) throw new IllegalStateException ("FolderName for application name '" + sAppName + "' is empty."); // Must be directly called on System to have an effect! System.setProperty ("log4j2.disable.jmx", "true"); }
/** * Get the primary (=first) mime type associated with the specified filename. * * @param sFilename * The filename to retrieve the primary mime type from. May neither be * <code>null</code> nor empty. * @return <code>null</code> if no mime type is associated with the extension * of the passed filename */ @Nullable public String getPrimaryMimeTypeStringForFilename (@Nonnull @Nonempty final String sFilename) { ValueEnforcer.notEmpty (sFilename, "Filename"); final String sExtension = FilenameHelper.getExtension (sFilename); return getPrimaryMimeTypeStringForExtension (sExtension); }
/** * @since 2007-06-01 * @param aMsg * The source message * @param sFileParam * The parameter name including the filename * @param sAction * Action name * @return File The {@link File} to be used * @throws IOException * In case of IO error * @throws OpenAS2Exception * In case of error */ protected File getFile (final IMessage aMsg, final String sFileParam, final String sAction) throws IOException, OpenAS2Exception { final String sFilename = getFilename (aMsg, sFileParam, sAction); // make sure the parent directories exist final File aFile = new File (sFilename); AS2IOHelper.getFileOperationManager ().createDirRecursiveIfNotExisting (aFile.getParentFile ()); // don't overwrite existing files return AS2IOHelper.getUniqueFile (aFile.getParentFile (), FilenameHelper.getAsSecureValidFilename (aFile.getName ())); }