rem
stringlengths
0
477k
add
stringlengths
0
313k
context
stringlengths
6
599k
next.addObject("newuserinfo", userInfo);
private void register(HttpServletRequest request, ModelAndView next, WikiPageInfo pageInfo) throws Exception { pageInfo.setSpecial(true); pageInfo.setAction(WikiPageInfo.ACTION_REGISTER); pageInfo.setPageTitle(new WikiMessage("register.title")); String virtualWikiName = Utilities.getVirtualWikiFromURI(request); W...
if (WikiBase.getHandler().lookupWikiUser(user.getLogin()) != null) {
if (user.getUserId() < 1 && WikiBase.getHandler().lookupWikiUser(user.getLogin()) != null) {
private Vector validate(HttpServletRequest request, WikiUser user) throws Exception { Vector errors = new Vector(); try { Utilities.validateUserName(user.getLogin()); } catch (WikiException e) { errors.add(e.getWikiMessage()); } String oldPassword = request.getParameter("oldPassword"); if (user.getUserId() >...
next.addObject("newuser", Utilities.currentUser(request));
WikiUser user = Utilities.currentUser(request); next.addObject("newuser", user); WikiUserInfo userInfo = WikiBase.getHandler().lookupWikiUserInfo(user.getLogin()); next.addObject("newuserinfo", userInfo);
private void view(HttpServletRequest request, ModelAndView next, WikiPageInfo pageInfo) throws Exception { if (Utilities.currentUser(request) != null) { next.addObject("newuser", Utilities.currentUser(request)); } pageInfo.setSpecial(true); pageInfo.setAction(WikiPageInfo.ACTION_REGISTER); pageInfo.setPageTitle...
PreparedStatement removeAnyLockStatement = conn.prepareStatement(STATEMENT_REMOVE_ANY_LOCK);
PreparedStatement removeAnyLockStatement = conn.prepareStatement(STATEMENT_REMOVE_LOCK);
public void unlockTopic(String virtualWiki, String topicName) throws Exception { Connection conn = null; try { conn = DatabaseConnection.getConnection(); PreparedStatement removeAnyLockStatement = conn.prepareStatement(STATEMENT_REMOVE_ANY_LOCK); removeAnyLockStatement.setString(1, topicName); removeAnyLockS...
sampleMenu.addMenuItem("Simple", new MenuItem("RadioSelect", DemoRadioSelect.class));
protected MenuItem buildMenu() throws Exception { MenuItem result = new MenuItem(); result.addMenuItem(null, new MenuItem("Management")); { result.addMenuItem("Management", new MenuItem("Persons")); // example use of simple FlowCreator result.addMenuItem("Management.Persons", new MenuItem("View_Add", new Flo...
String moveCommentsPage = Utilities.decodeURL(request.getParameter("moveCommentsPage"));
String moveCommentsPage = Utilities.decodeFromRequest(request.getParameter("moveCommentsPage"));
private void move(HttpServletRequest request, ModelAndView next, WikiPageInfo pageInfo) throws Exception { String topicName = JAMWikiServlet.getTopicFromRequest(request); if (!StringUtils.hasText(topicName)) { throw new WikiException(new WikiMessage("common.exception.notopic")); } WikiMessage pageTitle = new Wik...
String context = parserInput.getContext(); String virtualWiki = parserInput.getVirtualWiki();
private String buildWikiSignature(ParserInput parserInput, ParserDocument parserDocument, int mode, boolean includeUser, boolean includeDate) { try { String signature = ""; if (includeUser) { String context = parserInput.getContext(); String virtualWiki = parserInput.getVirtualWiki(); String login = pars...
String text = parserInput.getUserIpAddress();
private String buildWikiSignature(ParserInput parserInput, ParserDocument parserDocument, int mode, boolean includeUser, boolean includeDate) { try { String signature = ""; if (includeUser) { String context = parserInput.getContext(); String virtualWiki = parserInput.getVirtualWiki(); String login = pars...
next.addObject("errorMessage", new WikiMessage("admin.message.loginrequired"));
next.addObject("errorMessage", errorMessage);
protected ModelAndView viewLogin(HttpServletRequest request, String topic, WikiMessage errorMessage) throws Exception { ModelAndView next = new ModelAndView("wiki"); WikiPageInfo pageInfo = new WikiPageInfo(); String virtualWikiName = JAMWikiServlet.getVirtualWikiFromURI(request); String redirect = request.getPara...
log.debug("Writing output: " + xml);
public void processAction(Object actionId, InputData input, OutputData output) throws Exception { String str = innerData == null ? null : ((String[]) innerData)[0]; List suggestions = dataProvider.getSuggestions(str); ResponseBuilder responseBuilder = (ResponseBuilder) getConfiguration...
FileHandler.getPathFor(virtualWiki, RECENTFILE).delete();
FileHandler.getPathFor(virtualWiki, null, RECENTFILE).delete();
public void deleteChangeTableFile(String virtualWiki) { try { FileHandler.getPathFor(virtualWiki, RECENTFILE).delete(); } catch (Exception err) { logger.error("Unable to delete recent changes file for " + virtualWiki, err); } }
this.addTopic(topic);
if (WikiBase.getInstance().getHandler() instanceof FileHandler) { unlockTopic(topic); } addTopic(topic);
public synchronized void write(Topic topic, TopicVersion topicVersion) throws Exception { int previousTopicVersionId = 0; if (topic.getTopicId() > 0) { TopicVersion oldVersion = lookupLastTopicVersion(topic.getVirtualWiki(), topic.getName()); if (oldVersion != null) previousTopicVersionId = oldVersion.getTopicVe...
Method method = null; ClassLoader loader = null; URL url = null; File file = null; method = Thread.class.getMethod("getContextClassLoader", null); loader = (ClassLoader)method.invoke(Thread.currentThread(), null); if (loader == null) { throw new Exception("Unable to find class loader");
File file = Utilities.getClassLoaderFile("ApplicationResources.properties"); if (!file.exists()) { throw new Exception("Unable to find class loader root");
public static File getClassLoaderRoot() throws Exception { Method method = null; ClassLoader loader = null; URL url = null; File file = null; // first try to use the standard class loader path method = Thread.class.getMethod("getContextClassLoader", null); loader = (ClassLoader)method.invoke(Thread.currentThrea...
url = loader.getResource("/"); if (url != null) { file = FileUtils.toFile(url); } else { url = ClassLoader.getSystemResource("/"); if (url == null) { throw new Exception("Unable to find class loader root"); } file = FileUtils.toFile(url); } if (file == null | !file.exists() || !file.isDirectory()) { throw new Exception...
return file.getParentFile();
public static File getClassLoaderRoot() throws Exception { Method method = null; ClassLoader loader = null; URL url = null; File file = null; // first try to use the standard class loader path method = Thread.class.getMethod("getContextClassLoader", null); loader = (ClassLoader)method.invoke(Thread.currentThrea...
sig_type = 1;
if (b_type != Type.RRSIG) sig_type = 1;
public int compare(Object o1, Object o2) throws ClassCastException { Record a = (Record) o1; Record b = (Record) o2; if (a == null && b == null) return 0; if (a == null) return 1; if (b == null) return -1; int res = a.getName().compareTo(b.getName()); if (res != 0) return res; int a_type = a....
sig_type = -1;
if (a.getType() != Type.RRSIG) sig_type = -1;
public int compare(Object o1, Object o2) throws ClassCastException { Record a = (Record) o1; Record b = (Record) o2; if (a == null && b == null) return 0; if (a == null) return 1; if (b == null) return -1; int res = a.getName().compareTo(b.getName()); if (res != 0) return res; int a_type = a....
return isAction(request, "edit.action.preview", JAMWikiServlet.ACTION_PREVIEW);
return StringUtils.hasText(request.getParameter("preview"));
private boolean isPreview(HttpServletRequest request) { return isAction(request, "edit.action.preview", JAMWikiServlet.ACTION_PREVIEW); }
return isAction(request, "edit.action.save", JAMWikiServlet.ACTION_SAVE);
return StringUtils.hasText(request.getParameter("save"));
private boolean isSave(HttpServletRequest request) { return isAction(request, "edit.action.save", JAMWikiServlet.ACTION_SAVE); }
if (filename != null) { filename = FilenameUtils.getName(filename); }
filename = FilenameUtils.getName(filename);
private static String sanitizeFilename(String filename) { if (!StringUtils.hasText(filename)) return null; // some browsers set the full path, so strip to just the file name if (filename != null) { filename = FilenameUtils.getName(filename); } filename = StringUtils.replace(filename.trim(), " ", "_"); return f...
fileName = UploadServlet.sanitizeFilename(fileName);
private void upload(HttpServletRequest request, ModelAndView next, WikiPageInfo pageInfo) throws Exception { // FIXME - this method is a mess and needs to be split up. File file = new File(Environment.getValue(Environment.PROP_FILE_DIR_FULL_PATH)); if (!file.exists()) { throw new WikiException(new WikiMessage("up...
if (request.getMethod() != null && request.getMethod().equalsIgnoreCase("GET")) { this.doGet(request, response); } else { this.doPost(request, response); }
this.doGet(request, response);
public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception { ModelAndView next = new ModelAndView("wiki"); if (request.getMethod() != null && request.getMethod().equalsIgnoreCase("GET")) { this.doGet(request, response); } else { this.doPost(request, response); ...
for (int i = pagination.getStart(); i <= pagination.getEnd(); i++) {
for (int i = pagination.getStart(); i < pagination.getEnd(); i++) {
public Collection getRecentChanges(String virtualWiki, Pagination pagination, boolean descending) throws Exception { Vector all = new Vector(); File[] files = retrieveRecentChangeFiles(virtualWiki, descending); if (files == null) return all; for (int i = pagination.getStart(); i <= pagination.getEnd(); i++) { if...
for (int i = pagination.getStart(); i <= pagination.getEnd(); i++) {
for (int i = pagination.getStart(); i < pagination.getEnd(); i++) {
public Collection getUserContributions(String virtualWiki, String userString, Pagination pagination, boolean descending) throws Exception { Vector all = new Vector(); File[] files = retrieveUserContributionsFiles(virtualWiki, userString, descending); if (files == null) return all; for (int i = pagination.getStart(...
String topicName = (String)topicIterator.next();
public Collection lookupTopicByType(String virtualWiki, int topicType, Pagination pagination) throws Exception { // FIXME - this parses every single topic. hugely inefficient Collection topicNames = this.getAllTopicNames(virtualWiki); Collection results = new Vector(); int i = 0; for (Iterator topicIterator = to...
Arrays.sort(files);
private File[] retrieveTopicFiles(String virtualWiki) throws Exception { File file = FileHandler.getPathFor(virtualWiki, null, FileHandler.TOPIC_DIR); File[] files = file.listFiles(); return files; }
next.addObject(WikiServlet.PARAMETER_ACTION, WikiServlet.ACTION_ATTACH); next.addObject(WikiServlet.PARAMETER_SPECIAL, new Boolean(true));
next.addObject(JAMController.PARAMETER_ACTION, JAMController.ACTION_ATTACH); next.addObject(JAMController.PARAMETER_SPECIAL, new Boolean(true));
private void attach(HttpServletRequest request, ModelAndView next) throws Exception { String topic = JAMController.getTopicFromRequest(request); String virtualWiki = JAMController.getVirtualWikiFromURI(request); next.addObject(JAMController.PARAMETER_TITLE, "Attach Files to " + topic); next.addObject(JAMController...
String name = this.parseParamName(param); String defaultValue = this.parseParamDefaultValue(parserInput, param);
String content = param.substring("{{{".length(), param.length() - "}}}".length()); content = this.parseTemplateBody(parserInput, content); String name = this.parseParamName(content); String defaultValue = this.parseParamDefaultValue(parserInput, content);
private String applyParameter(ParserInput parserInput, String param) throws Exception { if (this.parameterValues == null) return param; String name = this.parseParamName(param); String defaultValue = this.parseParamDefaultValue(parserInput, param); String value = (String)this.parameterValues.get(name); if (value ...
return (value != null) ? value : defaultValue;
return (value == null) ? defaultValue : value;
private String applyParameter(ParserInput parserInput, String param) throws Exception { if (this.parameterValues == null) return param; String name = this.parseParamName(param); String defaultValue = this.parseParamDefaultValue(parserInput, param); String value = (String)this.parameterValues.get(name); if (value ...
if (pos + 1 >= raw.length() - "}}}".length()) { return null;
if (pos + 1 >= raw.length()) { return "";
private String parseParamDefaultValue(ParserInput parserInput, String raw) throws Exception { int pos = raw.indexOf("|"); String defaultValue = null; if (pos == -1) { return null; } if (pos + 1 >= raw.length() - "}}}".length()) { return null; } defaultValue = raw.substring(pos + 1, raw.length() - "}}}".leng...
defaultValue = raw.substring(pos + 1, raw.length() - "}}}".length());
defaultValue = raw.substring(pos + 1);
private String parseParamDefaultValue(ParserInput parserInput, String raw) throws Exception { int pos = raw.indexOf("|"); String defaultValue = null; if (pos == -1) { return null; } if (pos + 1 >= raw.length() - "}}}".length()) { return null; } defaultValue = raw.substring(pos + 1, raw.length() - "}}}".leng...
name = raw.substring("{{{".length(), pos);
name = raw.substring(0, pos);
private String parseParamName(String raw) throws Exception { int pos = raw.indexOf("|"); String name = null; if (pos != -1) { name = raw.substring("{{{".length(), pos); } else { name = raw.substring("{{{".length(), raw.length() - "}}}".length()); } name = name.trim(); if (!StringUtils.hasText(name)) { // ...
name = raw.substring("{{{".length(), raw.length() - "}}}".length());
name = raw;
private String parseParamName(String raw) throws Exception { int pos = raw.indexOf("|"); String name = null; if (pos != -1) { name = raw.substring("{{{".length(), pos); } else { name = raw.substring("{{{".length(), raw.length() - "}}}".length()); } name = name.trim(); if (!StringUtils.hasText(name)) { // ...
File changesPath = FileHandler.getPathFor(virtualWiki, RECENTFILE);
File changesPath = FileHandler.getPathFor(virtualWiki, null, RECENTFILE);
private Hashtable getTableFor(String virtualWiki) throws IOException, ClassNotFoundException { if (virtualWiki == null) virtualWiki = ""; if (cache.containsKey(virtualWiki)) { return (Hashtable) cache.get(virtualWiki); } File changesPath = FileHandler.getPathFor(virtualWiki, RECENTFILE); logger.debug("reading c...
File changesPath = FileHandler.getPathFor(virtualWiki, RECENTFILE);
File changesPath = FileHandler.getPathFor(virtualWiki, null, RECENTFILE);
private void saveTableFor(String virtualWiki) throws IOException { if (virtualWiki == null) virtualWiki = ""; File changesPath = FileHandler.getPathFor(virtualWiki, RECENTFILE); FileOutputStream fileOutputStream = new FileOutputStream(changesPath); ObjOut out = new ObjOut(fileOutputStream); Object changeTable = c...
Topic topic = WikiBase.getHandler().lookupTopic(virtualWiki, topicName);
Topic topic = WikiBase.getHandler().lookupTopic(virtualWiki, topicName, true);
private void delete(HttpServletRequest request, ModelAndView next, WikiPageInfo pageInfo) throws Exception { String topicName = JAMWikiServlet.getTopicFromRequest(request); String virtualWiki = JAMWikiServlet.getVirtualWikiFromURI(request); if (topicName == null) { throw new WikiException(new WikiMessage("common....
Topic topic = WikiBase.getHandler().lookupTopic(virtualWiki, topicName);
Topic topic = WikiBase.getHandler().lookupTopic(virtualWiki, topicName, true);
private void permissions(HttpServletRequest request, ModelAndView next, WikiPageInfo pageInfo) throws Exception { String topicName = JAMWikiServlet.getTopicFromRequest(request); String virtualWiki = JAMWikiServlet.getVirtualWikiFromURI(request); if (topicName == null) { throw new WikiException(new WikiMessage("co...
Topic topic = WikiBase.getHandler().lookupTopic(virtualWiki, topicName);
Topic topic = WikiBase.getHandler().lookupTopic(virtualWiki, topicName, true);
private void undelete(HttpServletRequest request, ModelAndView next, WikiPageInfo pageInfo) throws Exception { String topicName = JAMWikiServlet.getTopicFromRequest(request); String virtualWiki = JAMWikiServlet.getVirtualWikiFromURI(request); if (topicName == null) { throw new WikiException(new WikiMessage("commo...
WikiBase.getHandler().writeTopic(topic, topicVersion, null);
WikiBase.getHandler().undeleteTopic(topic, topicVersion);
private void undelete(HttpServletRequest request, ModelAndView next, WikiPageInfo pageInfo) throws Exception { String topicName = JAMWikiServlet.getTopicFromRequest(request); String virtualWiki = JAMWikiServlet.getVirtualWikiFromURI(request); if (topicName == null) { throw new WikiException(new WikiMessage("commo...
Topic topic = WikiBase.getHandler().lookupTopic(virtualWiki, topicName);
Topic topic = WikiBase.getHandler().lookupTopic(virtualWiki, topicName, true);
private void view(HttpServletRequest request, ModelAndView next, WikiPageInfo pageInfo) throws Exception { String topicName = JAMWikiServlet.getTopicFromRequest(request); String virtualWiki = JAMWikiServlet.getVirtualWikiFromURI(request); Topic topic = WikiBase.getHandler().lookupTopic(virtualWiki, topicName); if ...
topic.setDeleteDate(Timestamp.valueOf(XMLUtil.getTextContent(rootChild)));
try { topic.setDeleteDate(Timestamp.valueOf(XMLUtil.getTextContent(rootChild))); } catch (Exception e) { topic.setDeleteDate(new Timestamp(System.currentTimeMillis())); }
private Topic initTopic(File file) { if (!file.exists()) return null; try { Topic topic = new Topic(); Document document = XMLUtil.parseXML(file, false); // get root node Node rootNode = document.getElementsByTagName(XML_TOPIC_ROOT).item(0); NodeList rootChildren = rootNode.getChildNodes(); Node rootChil...
viewLogin(request, next, "Special:Admin");
String redirect = "Special:Admin"; if (isTopic(request, "Special:Upgrade")) { redirect = "Special:Upgrade"; } viewLogin(request, next, redirect);
public ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) { ModelAndView next = new ModelAndView("wiki"); try { String function = request.getParameter("function"); if (function == null) function = ""; // FIXME - hard coding of "function" values if (!Utilities.isAdmin...
UiUtil.writeAttributes(out, attributes);
protected int doEndTag(Writer out) throws Exception { StringArrayRequestControl.ViewModel viewModel = ((StringArrayRequestControl.ViewModel) controlViewModel); UiUtil.writeOpenStartTag(out, "span"); UiUtil.writeAttribute(out, "class", getStyleClass()); UiUtil.writeAttribute(out, "style", getStyle(...
next.addObject("message", new WikiMessage("admin.caption.recentchanges"));
next.addObject("message", new WikiMessage("admin.message.recentchanges"));
private void recentChanges(HttpServletRequest request, ModelAndView next) throws Exception { try { // FIXME - database specific if (WikiBase.getHandler() instanceof DatabaseHandler) { WikiBase.getHandler().reloadRecentChanges(); next.addObject("message", new WikiMessage("admin.caption.recentchanges")); } ...
subBean = tmp;
public static void fillFieldValue(Object bean, String field, Object value) { Validate.notNull(field, "No field name specified"); if (bean == null) { return; } String[] fields = StringUtils.split(field, NESTED_DELIM); Object subBean = bean; for (int i = 0; i < fields.length - 1 && subBean != null; i++) { ...
subBean = tmp;
public static void fillFieldValue(Object bean, String field, Object value) { Validate.notNull(field, "No field name specified"); if (bean == null) { return; } String[] fields = StringUtils.split(field, NESTED_DELIM); Object subBean = bean; for (int i = 0; i < fields.length - 1 && subBean != null; i++) { ...
if (currentOpenStack.equals(listOpenStack)) {
if (this.listStackEquals(currentOpenStack, listOpenStack)) {
private String listItem(ParserInput parserInput, String raw) { Stack listOpenStack = retrieveStack(parserInput, LIST_OPEN_STACK); Stack listCloseStack = retrieveStack(parserInput, LIST_CLOSE_STACK); int count = 0; for (int i=0; i < raw.length(); i++) { if (!isListTag(raw.charAt(i))) break; count++; } String ...
output.append(currentItemCloseTag);
output.append(listCloseStack.pop()); listCloseStack.push(currentItemCloseTag);
private String listItem(ParserInput parserInput, String raw) { Stack listOpenStack = retrieveStack(parserInput, LIST_OPEN_STACK); Stack listCloseStack = retrieveStack(parserInput, LIST_CLOSE_STACK); int count = 0; for (int i=0; i < raw.length(); i++) { if (!isListTag(raw.charAt(i))) break; count++; } String ...
if (!listOpenStack.elementAt(pos).equals(currentOpenStack.elementAt(pos))) {
if (!this.listStackEquals(currentOpenStack.subList(0, pos), listOpenStack.subList(0, pos))) {
private String listItem(ParserInput parserInput, String raw) { Stack listOpenStack = retrieveStack(parserInput, LIST_OPEN_STACK); Stack listCloseStack = retrieveStack(parserInput, LIST_CLOSE_STACK); int count = 0; for (int i=0; i < raw.length(); i++) { if (!isListTag(raw.charAt(i))) break; count++; } String ...
out.write("<button type=\"button\">" + JspUtil.getResourceString(pageContext, "button.clear").toUpperCase(JspUtil.getLocalizationContext(pageContext).getLocale()) + "</button>");
out.write("<button type=\"button\">" + JspUtil.getResourceString(pageContext, "button.clear").toUpperCase(getLocalizationContext().getLocale()) + "</button>");
public int doStartTag(Writer out) throws Exception { addAttribute("style", getStyle()); super.doStartTag(out); out.write("<button type=\"button\">" + JspUtil.getResourceString(pageContext, "button.clear").toUpperCase(JspUtil.getLocalizationContext(pageContext).getLocale()) + "</button>"); return EVAL_...
category.setName(Utilities.decodeURL(files[i].getName()));
category.setName(Utilities.decodeFromURL(files[i].getName()));
public Collection getAllCategories(String virtualWiki) throws Exception { Collection results = new Vector(); File[] files = retrieveCategoryFiles(virtualWiki); if (files == null) return results; for (int i = 0; i < files.length; i++) { Properties categoryHash = new Properties(); FileInputStream fis = null; t...
topicName = Utilities.decodeURL(topicName);
topicName = Utilities.decodeFromURL(topicName);
public Collection getAllTopicNames(String virtualWiki) throws Exception { Vector all = new Vector(); File[] files = retrieveTopicFiles(virtualWiki); if (files == null) return all; for (int i = 0; i < files.length; i++) { String topicName = files[i].getName(); // strip extension int pos = topicName.lastIndexO...
topicName = Utilities.decodeURL(topicName);
topicName = Utilities.decodeFromURL(topicName);
protected Collection getAllWikiFileTopicNames(String virtualWiki) throws Exception { Vector all = new Vector(); File[] files = retrieveWikiFileFiles(virtualWiki); if (files == null) return all; for (int i = 0; i < files.length; i++) { String topicName = files[i].getName(); // strip extension int pos = topicN...
login = Utilities.decodeURL(login);
login = Utilities.decodeFromURL(login);
public Collection getAllWikiUserLogins() throws Exception { Vector all = new Vector(); File[] files = retrieveWikiUserFiles(); if (files == null) return all; for (int i = 0; i < files.length; i++) { String login = files[i].getName(); // strip extension int pos = login.lastIndexOf(EXT); if (pos != -1) login...
if (!WikiBase.getHandler().exists(virtualWiki, article, true)) {
if (WikiBase.getHandler().exists(virtualWiki, article, true)) {
protected void loadDefaults(HttpServletRequest request, ModelAndView next, WikiPageInfo pageInfo) { // load cached top area, nav bar, etc. try { this.buildLayout(request, next); // add link to user page and comments page WikiUser user = Utilities.currentUser(request); if (user != null) { next.addObject("u...
return (m.matches()) ? Utilities.decodeURL(m.group(1).trim()) : null;
return (m.matches()) ? Utilities.decodeFromURL(m.group(1).trim()) : null;
public String isRedirect(String content) { if (!StringUtils.hasText(content)) return null; Matcher m = REDIRECT_PATTERN.matcher(content.trim()); return (m.matches()) ? Utilities.decodeURL(m.group(1).trim()) : null; }
} if (!Environment.getValue(Environment.PROP_BASE_PERSISTENCE_TYPE).equals("FILE")) { try { if (oldVersion.before(0, 4, 2)) { messages = DatabaseUpgrades.upgrade042(messages); } } catch (Exception e) { String msg = "Unable to complete upgrade to new JAMWiki version."; logger.severe(msg, e); messages.add(msg + ": " + e...
private void upgrade(HttpServletRequest request, ModelAndView next, WikiPageInfo pageInfo) throws Exception { if (!this.login(request)) { next.addObject("error", new WikiMessage("error.login")); pageInfo.setAction(WikiPageInfo.ACTION_UPGRADE); pageInfo.setSpecial(true); pageInfo.setPageTitle(new WikiMessage("...
if (!StringUtils.hasText(Environment.getValue(Environment.PROP_BASE_FILE_DIR)) || !Environment.getBooleanValue(Environment.PROP_BASE_INITIALIZED)) { return false; }
public static synchronized boolean exists(String virtualWiki, String topicName) throws Exception { if (PseudoTopicHandler.isPseudoTopic(topicName)) { return true; } return handler.exists(virtualWiki, topicName); }
if (!StringUtils.hasText(Environment.getValue(Environment.PROP_BASE_FILE_DIR)) || !Environment.getBooleanValue(Environment.PROP_BASE_INITIALIZED)) { return null; }
public static PersistencyHandler getHandler() { return handler; }
String[] locations = tldLocationsCache.getLocation(uri);
ServletContext ctx = (ServletContext) getEnvironment().getEntry(ServletContext.class); String[] locations = TldLocationsCache.getInstance(ctx).getLocation(uri);
public Map getTagMap(String uri) { if (!taglibs.containsKey(uri)) { String[] locations = tldLocationsCache.getLocation(uri); if (locations != null) { URL realLoc = null; try { if (locations[1] == null) realLoc = new URL(locations[0]); else ...
if (tldLocationsCache == null) tldLocationsCache = new TldLocationsCache( (ServletContext) getEnvironment().getEntry(ServletContext.class));
protected void init() throws Exception { super.init(); if (tldLocationsCache == null) tldLocationsCache = new TldLocationsCache( (ServletContext) getEnvironment().getEntry(ServletContext.class)); loc = (LocalizationContext) getEnvironment().getEntry(LocalizationContext.class); }
Matcher nameMatcher = null;
int startPos = pos;
private void parseTemplateParameterValues(ParserInput parserInput, String raw) throws Exception { String content = ""; content = raw.substring("{{".length(), raw.length() - "}}".length()); // strip the template name int pos = content.indexOf("|"); if (pos == -1) return; pos++; Matcher nameMatcher = null; int e...
if (!StringUtils.hasText(name)) { nameMatcher = PARAM_NAME_PATTERN.matcher(substring); if (nameMatcher.matches()) { name = nameMatcher.group(2); pos += nameMatcher.group(1).length(); continue; } else { name = new Integer(count).toString(); } }
private void parseTemplateParameterValues(ParserInput parserInput, String raw) throws Exception { String content = ""; content = raw.substring("{{".length(), raw.length() - "}}".length()); // strip the template name int pos = content.indexOf("|"); if (pos == -1) return; pos++; Matcher nameMatcher = null; int e...
if (substring.startsWith("{{{")) {
if (content.charAt(pos) == '=' && !StringUtils.hasText(name)) { name = content.substring(startPos, pos).trim(); value = ""; pos++; continue; } else if (substring.startsWith("{{{")) {
private void parseTemplateParameterValues(ParserInput parserInput, String raw) throws Exception { String content = ""; content = raw.substring("{{".length(), raw.length() - "}}".length()); // strip the template name int pos = content.indexOf("|"); if (pos == -1) return; pos++; Matcher nameMatcher = null; int e...
startPos = pos;
private void parseTemplateParameterValues(ParserInput parserInput, String raw) throws Exception { String content = ""; content = raw.substring("{{".length(), raw.length() - "}}".length()); // strip the template name int pos = content.indexOf("|"); if (pos == -1) return; pos++; Matcher nameMatcher = null; int e...
File versionDirCheck = new File(fileBase("") + VERSION_DIR); versionDirCheck.mkdir();
File versionDirCheck = getPathFor(null, null, VERSION_DIR);
public void createDefaults(Locale locale) { // create wiki home if necessary File dirCheck = new File(fileBase("")); //logger.info( "Using filebase: " + dirCheck ); dirCheck.mkdir(); // create default virtual wiki versions directory if necessary File versionDirCheck = new File(fileBase("") + VERSION_DIR); versi...
File virtualList = new File(fileBase("") + VIRTUAL_WIKI_LIST);
File virtualList = getPathFor(null, null, VIRTUAL_WIKI_LIST);
public void createDefaults(Locale locale) { // create wiki home if necessary File dirCheck = new File(fileBase("")); //logger.info( "Using filebase: " + dirCheck ); dirCheck.mkdir(); // create default virtual wiki versions directory if necessary File versionDirCheck = new File(fileBase("") + VERSION_DIR); versi...
dummy = getPathFor(vWiki, ""); dummy.mkdir(); dummy = getPathFor(vWiki, VERSION_DIR); dummy.mkdir();
dummy = getPathFor(vWiki, null, ""); dummy = getPathFor(vWiki, null, VERSION_DIR);
public void createDefaults(Locale locale) { // create wiki home if necessary File dirCheck = new File(fileBase("")); //logger.info( "Using filebase: " + dirCheck ); dirCheck.mkdir(); // create default virtual wiki versions directory if necessary File versionDirCheck = new File(fileBase("") + VERSION_DIR); versi...
ex.printStackTrace();
public void createDefaults(Locale locale) { // create wiki home if necessary File dirCheck = new File(fileBase("")); //logger.info( "Using filebase: " + dirCheck ); dirCheck.mkdir(); // create default virtual wiki versions directory if necessary File versionDirCheck = new File(fileBase("") + VERSION_DIR); versi...
File checkFile = getPathFor(virtualWiki, topicName + ".txt");
File checkFile = getPathFor(virtualWiki, null, topicName + ".txt");
public boolean exists(String virtualWiki, String topicName) throws Exception { File checkFile = getPathFor(virtualWiki, topicName + ".txt"); return checkFile.exists(); }
File path = getPathFor(virtualWiki, "");
File path = getPathFor(virtualWiki, null, "");
public List getLockList(String virtualWiki) throws Exception { if (virtualWiki == null) virtualWiki = ""; List all = new ArrayList(); File path = getPathFor(virtualWiki, ""); File[] files = path.listFiles(new FileExtensionFilter(LOCK_EXTENSION)); for (int i = 0; i < files.length; i++) { File file = files[i]; ...
File roFile = getPathFor(virtualWiki, READ_ONLY_FILE);
File roFile = getPathFor(virtualWiki, null, READ_ONLY_FILE);
protected synchronized void loadReadOnlyTopics(String virtualWiki) { logger.debug("Loading read only topics for " + virtualWiki); Collection roTopics = new ArrayList(); File roFile = getPathFor(virtualWiki, READ_ONLY_FILE); if (!roFile.exists()) { logger.debug("Empty read only topics for " + virtualWiki); if (...
logger.debug("Locking " + topicName);
public synchronized boolean lockTopic(String virtualWiki, String topicName, String key) throws IOException { File lockFile = makeLockFile(virtualWiki, topicName); logger.debug("Locking " + topicName); Date currentDate = new Date(); logger.debug("Edit timeout in minutes is " + Environment.getIntValue(Environment.PR...
StringBuffer buffer = new StringBuffer(); if (virtualWiki.equals(WikiBase.DEFAULT_VWIKI)) virtualWiki = ""; buffer.append(fileBase(virtualWiki)); buffer.append(File.separator); buffer.append(Utilities.encodeSafeFileName(topicName)); buffer.append(LOCK_EXTENSION); return new File(buffer.toString());
return getPathFor(virtualWiki, null, topicName + LOCK_EXTENSION);
private File makeLockFile(String virtualWiki, String topicName) { StringBuffer buffer = new StringBuffer(); if (virtualWiki.equals(WikiBase.DEFAULT_VWIKI)) virtualWiki = ""; buffer.append(fileBase(virtualWiki)); buffer.append(File.separator); buffer.append(Utilities.encodeSafeFileName(topicName)); buffer.append(...
file = getPathFor(virtualWiki, "");
file = getPathFor(virtualWiki, null, "");
public Collection purgeDeletes(String virtualWiki) throws Exception { Collection all = new ArrayList(); file = getPathFor(virtualWiki, ""); File[] files = file.listFiles(new TextFileFilter()); for (int i = 0; i < files.length; i++) { BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputS...
File roFile = getPathFor(virtualWiki, READ_ONLY_FILE);
File roFile = getPathFor(virtualWiki, null, READ_ONLY_FILE);
protected synchronized void saveReadOnlyTopics(String virtualWiki) throws IOException { File roFile = getPathFor(virtualWiki, READ_ONLY_FILE); logger.debug("Saving read-only topics to " + roFile); Writer out = new OutputStreamWriter(new FileOutputStream(roFile), Environment.getValue(Environment.PROP_FILE_ENCODING))...
File dummy = getPathFor(vWiki, specialPage + ".txt");
File dummy = getPathFor(vWiki, null, specialPage + ".txt");
private void setupSpecialPage(String vWiki, String specialPage) throws Exception { File dummy = getPathFor(vWiki, specialPage + ".txt"); if (!dummy.exists()) { Writer writer = new OutputStreamWriter(new FileOutputStream(dummy), Environment.getValue(Environment.PROP_FILE_ENCODING)); writer.write(WikiBase.readDefa...
File lockFile = getPathFor(virtualWiki, topicName + LOCK_EXTENSION);
File lockFile = getPathFor(virtualWiki, null, topicName + LOCK_EXTENSION);
public synchronized void unlockTopic(String virtualWiki, String topicName) throws IOException { File lockFile = getPathFor(virtualWiki, topicName + LOCK_EXTENSION); if (!lockFile.exists()) { logger.warn("attempt to unlock topic by deleting lock file failed (file does not exist): " + lockFile); } lockFile.delete(...
next.addObject("notopic", new WikiMessage("topic.notcreated", topicName));
protected void viewTopic(HttpServletRequest request, ModelAndView next, String topicName) throws Exception { String virtualWiki = JAMWikiServlet.getVirtualWikiFromURI(request); if (!StringUtils.hasText(virtualWiki)) { virtualWiki = WikiBase.DEFAULT_VWIKI; } Topic topic = WikiBase.getHandler().lookupTopic(virtual...
viewTopic(request, next);
viewTopic(request, next, JAMWikiServlet.getTopicFromURI(request));
public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception { ModelAndView next = new ModelAndView("wiki"); if (isTopic(request, "Special:AllTopics")) { allTopics(request, next); } else if (isTopic(request, "Special:OrphanedTopics")) { orphanedTopics(request, nex...
this.maxScale = FloatControl.this.getMaxScale();
public ViewModel() { this.maxValue = FloatControl.this.getMaxValue(); this.minValue = FloatControl.this.getMinValue(); }
this.decimalFormat = Arrays.asList(new DecimalPattern[] {new DecimalPattern(null, null)}); this.currentNumberFormat = NumberFormat.getNumberInstance();
public FloatControl() { this.decimalFormat = Arrays.asList(new DecimalPattern[] {new DecimalPattern(null, null)}); this.currentNumberFormat = NumberFormat.getNumberInstance(); }
if (currentNumberFormat == null) { BigDecimal result = null; try { result = new BigDecimal(parameterValue); } catch (NumberFormatException e) { addError( ErrorUtil.localizeAndFormat( UiLibMessages.NOT_A_NUMBER, ErrorUtil.localize(getLabel(), getEnvironment()), getEnvironment())); } return result;
BigDecimal result = null; try { result = createBigDecimal(parameterValue);
protected Object fromRequest(String parameterValue) { if (currentNumberFormat == null) { BigDecimal result = null; try { result = new BigDecimal(parameterValue); } catch (NumberFormatException e) { addError( ErrorUtil.localizeAndFormat( UiLibMessages.NOT_A_NUMBER, ErrorUtil.locali...
ValidationUtil.ParsedNumber result = ValidationUtil.parseNumber(parameterValue, decimalFormat); if (result != null) { currentNumberFormat = result.getFormat(); return new BigDecimal(result.getNumber().toString());
catch (NumberFormatException e) { addError( ErrorUtil.localizeAndFormat( UiLibMessages.NOT_A_NUMBER, ErrorUtil.localize(getLabel(), getEnvironment()), getEnvironment()));
protected Object fromRequest(String parameterValue) { if (currentNumberFormat == null) { BigDecimal result = null; try { result = new BigDecimal(parameterValue); } catch (NumberFormatException e) { addError( ErrorUtil.localizeAndFormat( UiLibMessages.NOT_A_NUMBER, ErrorUtil.locali...
addError( ErrorUtil.localizeAndFormat( UiLibMessages.WRONG_DECIMAL_FORMAT, ErrorUtil.localize(getLabel(), getEnvironment()), decimalFormat.toString(), getEnvironment())); return null;
return result;
protected Object fromRequest(String parameterValue) { if (currentNumberFormat == null) { BigDecimal result = null; try { result = new BigDecimal(parameterValue); } catch (NumberFormatException e) { addError( ErrorUtil.localizeAndFormat( UiLibMessages.NOT_A_NUMBER, ErrorUtil.locali...
if (currentNumberFormat == null) { return ((BigDecimal) controlValue).toString(); } return currentNumberFormat.format(((BigDecimal) controlValue).doubleValue());
return toString((BigDecimal) controlValue);
protected String toResponse(Object controlValue) { if (currentNumberFormat == null) { return ((BigDecimal) controlValue).toString(); } return currentNumberFormat.format(((BigDecimal) controlValue).doubleValue()); }
}
} if (maxScale != null && ((BigDecimal) value).scale() > maxScale.intValue()) { addError( ErrorUtil.localizeAndFormat( UiLibMessages.SCALE_NOT_LESS, new Object[] { ErrorUtil.localize(getLabel(), getEnvironment()), maxScale.toString(), }, getEnvironment())); }
protected void validateNotNull() { if (minValue != null && maxValue != null && ((((BigDecimal) value).compareTo(minValue) == -1) || ((BigDecimal) value).compareTo(maxValue) == 1)) { addError( ErrorUtil.localizeAndFormat( UiLibMessages.NUMBER_NOT_BETWEEN, new Object[] { ErrorUtil.loc...
this.mapper = new BeanMapper(clazz);
this.mapper = new RecursiveBeanMapper(clazz, true);
public BeanVariableResolver(Class clazz) { this.mapper = new BeanMapper(clazz); }
createTables();
if (!DatabaseHandler.dbInitialized()) { createTables(); }
public void setDefaults(Locale locale) throws Exception { logger.debug("Setting defaults"); // resources for i18n ResourceBundle messages = ResourceBundle.getBundle("ApplicationResources", locale); //set up tables createTables(); Connection conn = null; try { conn = DatabaseConnection.getConnection(); Prepa...
props = Environment.loadProperties(SQL_PROPERTY_FILE_NAME); this.init(props);
protected DefaultQueryHandler() { }
String topic = JAMController.getTopicFromRequest(request);
String topicName = JAMController.getTopicFromRequest(request);
private void attach(HttpServletRequest request, ModelAndView next) throws Exception { String topic = JAMController.getTopicFromRequest(request); String virtualWiki = JAMController.getVirtualWikiFromURI(request); next.addObject(JAMController.PARAMETER_TITLE, "Attach Files to " + topic); next.addObject(JAMController...
next.addObject(JAMController.PARAMETER_TITLE, "Attach Files to " + topic); next.addObject(JAMController.PARAMETER_TOPIC, topic);
next.addObject(JAMController.PARAMETER_TITLE, "Attach Files to " + topicName); next.addObject(JAMController.PARAMETER_TOPIC, topicName);
private void attach(HttpServletRequest request, ModelAndView next) throws Exception { String topic = JAMController.getTopicFromRequest(request); String virtualWiki = JAMController.getVirtualWikiFromURI(request); next.addObject(JAMController.PARAMETER_TITLE, "Attach Files to " + topic); next.addObject(JAMController...
Topic t = new Topic(topic); if (t.isReadOnlyTopic(virtualWiki)) { logger.warn("Topic " + topic + " is read only");
Topic topic = WikiBase.getInstance().getHandler().lookupTopic(virtualWiki, topicName); if (topic == null) { throw new Exception("Topic does not exist: " + topicName + " / " + virtualWiki); } if (topic.getReadOnly()) { logger.warn("Topic " + topicName + " is read only");
private void attach(HttpServletRequest request, ModelAndView next) throws Exception { String topic = JAMController.getTopicFromRequest(request); String virtualWiki = JAMController.getVirtualWikiFromURI(request); next.addObject(JAMController.PARAMETER_TITLE, "Attach Files to " + topic); next.addObject(JAMController...
throw new Exception("Topic " + topic + " is read only"); } if (topic == null || topic.equals("")) { throw new Exception("Topic must be specified");
throw new Exception("Topic " + topicName + " is read only");
private void attach(HttpServletRequest request, ModelAndView next) throws Exception { String topic = JAMController.getTopicFromRequest(request); String virtualWiki = JAMController.getVirtualWikiFromURI(request); next.addObject(JAMController.PARAMETER_TITLE, "Attach Files to " + topic); next.addObject(JAMController...
if (!WikiBase.getInstance().lockTopic(virtualWiki, topic, key)) {
if (!WikiBase.getInstance().lockTopic(virtualWiki, topicName, key)) {
private void attach(HttpServletRequest request, ModelAndView next) throws Exception { String topic = JAMController.getTopicFromRequest(request); String virtualWiki = JAMController.getVirtualWikiFromURI(request); next.addObject(JAMController.PARAMETER_TITLE, "Attach Files to " + topic); next.addObject(JAMController...
throw new Exception("Topic " + topic + " is locked");
throw new Exception("Topic " + topicName + " is locked");
private void attach(HttpServletRequest request, ModelAndView next) throws Exception { String topic = JAMController.getTopicFromRequest(request); String virtualWiki = JAMController.getVirtualWikiFromURI(request); next.addObject(JAMController.PARAMETER_TITLE, "Attach Files to " + topic); next.addObject(JAMController...
logger.error("Failure while getting attachment topic info for " + topic, e);
logger.error("Failure while getting attachment topic info for " + topicName, e);
private void attach(HttpServletRequest request, ModelAndView next) throws Exception { String topic = JAMController.getTopicFromRequest(request); String virtualWiki = JAMController.getVirtualWikiFromURI(request); next.addObject(JAMController.PARAMETER_TITLE, "Attach Files to " + topic); next.addObject(JAMController...
throw new Exception("Failure while getting attachment topic info for " + topic + " " + e.getMessage());
throw new Exception("Failure while getting attachment topic info for " + topicName + " " + e.getMessage());
private void attach(HttpServletRequest request, ModelAndView next) throws Exception { String topic = JAMController.getTopicFromRequest(request); String virtualWiki = JAMController.getVirtualWikiFromURI(request); next.addObject(JAMController.PARAMETER_TITLE, "Attach Files to " + topic); next.addObject(JAMController...
UiUtil.writeAttributes(out, attributes);
protected int doStartTag(Writer out) throws Exception { super.doStartTag(out); assertControlType("DisplayControl"); displayControlViewModel = (DisplayControl.ViewModel) controlViewModel; if (getStyleClass() != null) { UiUtil.writeOpenStartTag(out, "span"); UiUtil.writeA...
String topic = null;
String topicName = null;
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { FileUpload upload = new FileUpload(); String tempDir = Utilities.relativeDirIfNecessary(Environment.getValue(Environment.PROP_ATTACH_TEMP_DIR)); File tempDirFile = new File(tempDir); tempDirFile.m...
Topic t = null;
Topic topic = null;
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { FileUpload upload = new FileUpload(); String tempDir = Utilities.relativeDirIfNecessary(Environment.getValue(Environment.PROP_ATTACH_TEMP_DIR)); File tempDirFile = new File(tempDir); tempDirFile.m...