ThreadUtils.java
597 Bytes
/*
* Decompiled with CFR 0_118.
*/
package com.day.cq.dam.scene7.impl.utils;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
public class ThreadUtils {
private static ThreadLocal<SimpleDateFormat> sdfTL = new ThreadLocal();
public static Date parse(String string, String pattern) throws ParseException {
SimpleDateFormat sdf = sdfTL.get();
if (sdf == null || !pattern.equals(sdf.toPattern())) {
sdf = new SimpleDateFormat(pattern);
sdfTL.set(sdf);
}
return sdf.parse(string);
}
}