001/* 002 Licensed to the Apache Software Foundation (ASF) under one 003 or more contributor license agreements. See the NOTICE file 004 distributed with this work for additional information 005 regarding copyright ownership. The ASF licenses this file 006 to you under the Apache License, Version 2.0 (the 007 "License"); you may not use this file except in compliance 008 with the License. You may obtain a copy of the License at 009 010 http://www.apache.org/licenses/LICENSE-2.0 011 012 Unless required by applicable law or agreed to in writing, 013 software distributed under the License is distributed on an 014 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 015 KIND, either express or implied. See the License for the 016 specific language governing permissions and limitations 017 under the License. 018 */ 019package org.apache.wiki.providers; 020 021import org.apache.logging.log4j.LogManager; 022import org.apache.logging.log4j.Logger; 023import org.apache.wiki.InternalWikiException; 024import org.apache.wiki.api.core.Engine; 025import org.apache.wiki.api.core.Page; 026import org.apache.wiki.api.exceptions.NoRequiredPropertyException; 027import org.apache.wiki.api.exceptions.ProviderException; 028import org.apache.wiki.api.providers.PageProvider; 029import org.apache.wiki.api.providers.WikiProvider; 030import org.apache.wiki.api.spi.Wiki; 031import org.apache.wiki.util.FileUtil; 032import org.apache.wiki.util.Synchronizer; 033 034import java.io.BufferedInputStream; 035import java.io.BufferedOutputStream; 036import java.io.File; 037import java.io.IOException; 038import java.io.InputStream; 039import java.io.OutputStream; 040import java.nio.file.Files; 041import java.util.ArrayList; 042import java.util.Collection; 043import java.util.Date; 044import java.util.List; 045import java.util.Properties; 046import java.util.concurrent.atomic.AtomicReference; 047import java.util.concurrent.locks.ReentrantLock; 048 049/** 050 * Provides a simple directory based repository for Wiki pages. 051 * Pages are held in a directory structure: 052 * <PRE> 053 * Main.txt 054 * Foobar.txt 055 * OLD/ 056 * Main/ 057 * 1.txt 058 * 2.txt 059 * page.properties 060 * Foobar/ 061 * page.properties 062 * </PRE> 063 * 064 * In this case, "Main" has three versions, and "Foobar" just one version. 065 * <P> 066 * The properties file contains the necessary meta information (such as author) 067 * information of the page. DO NOT MESS WITH IT! 068 * 069 * <P> 070 * All files have ".txt" appended to make life easier for those 071 * who insist on using Windows or other software which makes assumptions 072 * on the files contents based on its name. 073 * 074 */ 075public class VersioningFileProvider extends AbstractFileProvider { 076 077 private static final Logger LOG = LogManager.getLogger( VersioningFileProvider.class ); 078 079 /** Name of the directory where the old versions are stored. */ 080 public static final String PAGEDIR = "OLD"; 081 082 /** Name of the property file which stores the metadata. */ 083 public static final String PROPERTYFILE = "page.properties"; 084 085 private CachedProperties m_cachedProperties; 086 087 /** 088 * A lock used to ensure thread safety when accessing shared resources. 089 * This lock provides more flexibility and capabilities than the intrinsic locking mechanism, 090 * such as the ability to attempt to acquire a lock with a timeout, or to interrupt a thread 091 * waiting to acquire a lock. 092 * 093 * @see java.util.concurrent.locks.ReentrantLock 094 */ 095 private final ReentrantLock lock = new ReentrantLock(); 096 097 /** 098 * {@inheritDoc} 099 */ 100 @Override 101 public void initialize( final Engine engine, final Properties properties ) throws NoRequiredPropertyException, IOException { 102 super.initialize( engine, properties ); 103 // some additional sanity checks: 104 final File oldpages = new File( getPageDirectory(), PAGEDIR ); 105 if( !oldpages.exists() ) { 106 if( !oldpages.mkdirs() ) { 107 throw new IOException( "Failed to create page version directory " + oldpages.getAbsolutePath() ); 108 } 109 } else { 110 if( !oldpages.isDirectory() ) { 111 throw new IOException( "Page version directory is not a directory: " + oldpages.getAbsolutePath() ); 112 } 113 if( !oldpages.canWrite() ) { 114 throw new IOException( "Page version directory is not writable: " + oldpages.getAbsolutePath() ); 115 } 116 } 117 LOG.info( "Using directory " + oldpages.getAbsolutePath() + " for storing old versions of pages" ); 118 } 119 120 /** 121 * Returns the directory where the old versions of the pages 122 * are being kept. 123 */ 124 private File findOldPageDir( final String page ) { 125 if( page == null ) { 126 throw new InternalWikiException( "Page may NOT be null in the provider!" ); 127 } 128 final File oldpages = new File( getPageDirectory(), PAGEDIR ); 129 return new File( oldpages, mangleName( page ) ); 130 } 131 132 /** 133 * Goes through the repository and decides which version is the newest one in that directory. 134 * 135 * @return Latest version number in the repository, or -1, if there is no page in the repository. 136 */ 137 138 // FIXME: This is relatively slow. 139 /* 140 private int findLatestVersion( String page ) 141 { 142 File pageDir = findOldPageDir( page ); 143 144 String[] pages = pageDir.list( new WikiFileFilter() ); 145 146 if( pages == null ) 147 { 148 return -1; // No such thing found. 149 } 150 151 int version = -1; 152 153 for( int i = 0; i < pages.length; i++ ) 154 { 155 int cutpoint = pages[i].indexOf( '.' ); 156 if( cutpoint > 0 ) 157 { 158 String pageNum = pages[i].substring( 0, cutpoint ); 159 160 try 161 { 162 int res = Integer.parseInt( pageNum ); 163 164 if( res > version ) 165 { 166 version = res; 167 } 168 } 169 catch( NumberFormatException e ) {} // It's okay to skip these. 170 } 171 } 172 173 return version; 174 } 175*/ 176 private int findLatestVersion( final String page ) { 177 int version = -1; 178 179 try { 180 final Properties props = getPageProperties( page ); 181 182 for( final Object o : props.keySet() ) { 183 final String key = ( String )o; 184 if( key.endsWith( ".author" ) ) { 185 final int cutpoint = key.indexOf( '.' ); 186 if( cutpoint > 0 ) { 187 final String pageNum = key.substring( 0, cutpoint ); 188 189 try { 190 final int res = Integer.parseInt( pageNum ); 191 192 if( res > version ) { 193 version = res; 194 } 195 } catch( final NumberFormatException e ) { 196 LOG.debug(e.getMessage(), e); 197 } // It's okay to skip these. 198 } 199 } 200 } 201 } catch( final IOException e ) { 202 LOG.error( "Unable to figure out latest version - dying...", e ); 203 } 204 205 return version; 206 } 207 208 /** 209 * Reads page properties from the file system. 210 */ 211 private Properties getPageProperties( final String page ) throws IOException { 212 final File propertyFile = new File( findOldPageDir(page), PROPERTYFILE ); 213 if( propertyFile.exists() ) { 214 final long lastModified = propertyFile.lastModified(); 215 216 // 217 // The profiler showed that when calling the history of a page the propertyfile 218 // was read just as much times as there were versions of that file. The loading 219 // of a propertyfile is a cpu-intensive job. So now hold on to the last propertyfile 220 // read because the next method will with a high probability ask for the same propertyfile. 221 // The time it took to show a historypage with 267 versions dropped with 300%. 222 // 223 224 CachedProperties cp = m_cachedProperties; 225 226 if( cp != null && cp.m_page.equals( page ) && cp.m_lastModified == lastModified ) { 227 return cp.m_props; 228 } 229 230 try( final InputStream in = new BufferedInputStream( Files.newInputStream( propertyFile.toPath() ) ) ) { 231 final Properties props = new Properties(); 232 props.load( in ); 233 cp = new CachedProperties( page, props, lastModified ); 234 m_cachedProperties = cp; // Atomic 235 236 return props; 237 } 238 } 239 240 return new Properties(); // Returns an empty object 241 } 242 243 /** 244 * Writes the page properties back to the file system. 245 * Note that it WILL overwrite any previous properties. 246 */ 247 private void putPageProperties( final String page, final Properties properties ) throws IOException { 248 final File propertyFile = new File( findOldPageDir(page), PROPERTYFILE ); 249 try( final OutputStream out = Files.newOutputStream( propertyFile.toPath() ) ) { 250 properties.store( out, " JSPWiki page properties for "+page+". DO NOT MODIFY!" ); 251 } 252 253 // The profiler showed the probability was very high that when calling for the history of 254 // a page the propertyfile would be read as much times as there were versions of that file. 255 // It is statistically likely the propertyfile will be examined many times before it is updated. 256 m_cachedProperties = new CachedProperties( page, properties, propertyFile.lastModified() ); // Atomic 257 } 258 259 /** 260 * Figures out the real version number of the page and also checks for its existence. 261 * 262 * @throws NoSuchVersionException if there is no such version. 263 */ 264 private int realVersion( final String page, final int requestedVersion ) throws NoSuchVersionException { 265 // Quickly check for the most common case. 266 if( requestedVersion == WikiProvider.LATEST_VERSION ) { 267 return -1; 268 } 269 270 final int latest = findLatestVersion(page); 271 272 if( requestedVersion == latest || (requestedVersion == 1 && latest == -1 ) ) { 273 return -1; 274 } else if( requestedVersion <= 0 || requestedVersion > latest ) { 275 throw new NoSuchVersionException( "Requested version " + requestedVersion + ", but latest is " + latest ); 276 } 277 278 return requestedVersion; 279 } 280 281 /** 282 * {@inheritDoc} 283 */ 284 @Override 285 public String getPageText(final String page, int version) throws ProviderException { 286 final AtomicReference<String> result = new AtomicReference<>(); 287 final int finalVersion = version; // Make it effectively final for use in lambda 288 289 Synchronizer.synchronize(lock, () -> { 290 final File dir = findOldPageDir(page); 291 int realVersion = realVersion(page, finalVersion); 292 293 if (realVersion == -1) { 294 // We can let the FileSystemProvider take care of these requests. 295 result.set(super.getPageText(page, PageProvider.LATEST_VERSION)); 296 return; 297 } 298 299 final File pageFile = new File(dir, "" + realVersion + FILE_EXT); 300 if (!pageFile.exists()) { 301 throw new NoSuchVersionException("Version " + realVersion + " does not exist."); 302 } 303 304 result.set(readFile(pageFile)); 305 }); 306 307 return result.get(); 308 } 309 310 311 // FIXME: Should this really be here? 312 private String readFile( final File pagedata ) throws ProviderException { 313 String result = null; 314 if( pagedata.exists() ) { 315 if( pagedata.canRead() ) { 316 try( final InputStream in = Files.newInputStream( pagedata.toPath() ) ) { 317 result = FileUtil.readContents( in, m_encoding ); 318 } catch( final IOException e ) { 319 LOG.error("Failed to read", e); 320 throw new ProviderException("I/O error: "+e.getMessage()); 321 } 322 } else { 323 LOG.warn("Failed to read page from '"+pagedata.getAbsolutePath()+"', possibly a permissions problem"); 324 throw new ProviderException("I cannot read the requested page."); 325 } 326 } else { 327 // This is okay. 328 // FIXME: is it? 329 LOG.debug("New page"); 330 } 331 332 return result; 333 } 334 335 // FIXME: This method has no rollback whatsoever. 336 337 /* 338 This is how the page directory should look like: 339 340 version pagedir olddir 341 none empty empty 342 1 Main.txt (1) empty 343 2 Main.txt (2) 1.txt 344 3 Main.txt (3) 1.txt, 2.txt 345 */ 346 /** 347 * {@inheritDoc} 348 */ 349 @Override 350 public void putPageText( final Page page, final String text ) throws ProviderException { 351 Synchronizer.synchronize(lock, () -> { 352 // This is a bit complicated. We'll first need to copy the old file to be the newest file. 353 final int latest = findLatestVersion( page.getName() ); 354 final File pageDir = findOldPageDir( page.getName() ); 355 if( !pageDir.exists() ) { 356 pageDir.mkdirs(); 357 } 358 359 try { 360 // Copy old data to safety, if one exists. 361 final File oldFile = findPage( page.getName() ); 362 363 // Figure out which version should the old page be? Numbers should always start at 1. 364 // "most recent" = -1 ==> 1 365 // "first" = 1 ==> 2 366 int versionNumber = (latest > 0) ? latest : 1; 367 final boolean firstUpdate = (versionNumber == 1); 368 369 if( oldFile != null && oldFile.exists() ) { 370 final File pageFile = new File( pageDir, versionNumber + FILE_EXT ); 371 try( final InputStream in = new BufferedInputStream( Files.newInputStream( oldFile.toPath() ) ); 372 final OutputStream out = new BufferedOutputStream( Files.newOutputStream( pageFile.toPath() ) ) ) { 373 FileUtil.copyContents( in, out ); 374 375 // We need also to set the date, since we rely on this. 376 pageFile.setLastModified( oldFile.lastModified() ); 377 378 // Kludge to make the property code to work properly. 379 versionNumber++; 380 } 381 } 382 383 // Let superclass handler writing data to a new version. 384 super.putPageText( page, text ); 385 386 // Finally, write page version data. 387 // FIXME: No rollback available. 388 final Properties props = getPageProperties( page.getName() ); 389 390 String authorFirst = null; 391 // if the following file exists, we are NOT migrating from FileSystemProvider 392 final File pagePropFile = new File(getPageDirectory() + File.separator + PAGEDIR + File.separator + mangleName(page.getName()) + File.separator + "page" + FileSystemProvider.PROP_EXT); 393 if( firstUpdate && ! pagePropFile.exists() ) { 394 // we might not yet have a versioned author because the old page was last maintained by FileSystemProvider 395 final Properties props2 = getHeritagePageProperties( page.getName() ); 396 397 // remember the simulated original author (or something) in the new properties 398 authorFirst = props2.getProperty( "1.author", "unknown" ); 399 props.setProperty( "1.author", authorFirst ); 400 } 401 402 String newAuthor = page.getAuthor(); 403 if ( newAuthor == null ) { 404 newAuthor = ( authorFirst != null ) ? authorFirst : "unknown"; 405 } 406 page.setAuthor(newAuthor); 407 props.setProperty( versionNumber + ".author", newAuthor ); 408 409 final String changeNote = page.getAttribute( Page.CHANGENOTE ); 410 if( changeNote != null ) { 411 props.setProperty( versionNumber + ".changenote", changeNote ); 412 } 413 414 // Get additional custom properties from page and add to props 415 getCustomProperties( page, props ); 416 putPageProperties( page.getName(), props ); 417 } catch( final IOException e ) { 418 LOG.error( "Saving failed", e ); 419 throw new ProviderException("Could not save page text: "+e.getMessage()); 420 } 421 }); 422 423 } 424 425 /** 426 * {@inheritDoc} 427 */ 428 @Override 429 public Page getPageInfo( final String page, final int version ) throws ProviderException { 430 final int latest = findLatestVersion( page ); 431 final int realVersion; 432 433 Page p = null; 434 435 if( version == PageProvider.LATEST_VERSION || version == latest || (version == 1 && latest == -1) ) { 436 // 437 // Yes, we need to talk to the top level directory to get this version. 438 // 439 // I am listening to Press Play On Tape's guitar version of the good old C64 "Wizardry" -tune at this moment. 440 // Oh, the memories... 441 // 442 realVersion = (latest >= 0) ? latest : 1; 443 444 p = super.getPageInfo( page, PageProvider.LATEST_VERSION ); 445 446 if( p != null ) { 447 p.setVersion( realVersion ); 448 } 449 } else { 450 // The file is not the most recent, so we'll need to find it from the deep trenches of the "OLD" directory structure. 451 realVersion = version; 452 final File dir = findOldPageDir( page ); 453 if( !dir.exists() || !dir.isDirectory() ) { 454 return null; 455 } 456 457 final File file = new File( dir, version + FILE_EXT ); 458 if( file.exists() ) { 459 p = Wiki.contents().page( m_engine, page ); 460 461 p.setLastModified( new Date( file.lastModified() ) ); 462 p.setVersion( version ); 463 } 464 } 465 466 // Get author and other metadata information (Modification date has already been set.) 467 if( p != null ) { 468 try { 469 final Properties props = getPageProperties( page ); 470 String author = props.getProperty( realVersion + ".author" ); 471 if( author == null ) { 472 // we might not have a versioned author because the old page was last maintained by FileSystemProvider 473 final Properties props2 = getHeritagePageProperties( page ); 474 author = props2.getProperty( Page.AUTHOR ); 475 } 476 if( author != null ) { 477 p.setAuthor( author ); 478 } 479 480 final String changenote = props.getProperty( realVersion + ".changenote" ); 481 if( changenote != null ) { 482 p.setAttribute( Page.CHANGENOTE, changenote ); 483 } 484 485 // Set the props values to the page attributes 486 setCustomProperties( p, props ); 487 } catch( final IOException e ) { 488 LOG.error( "Cannot get author for page" + page + ": ", e ); 489 } 490 } 491 492 return p; 493 } 494 495 /** 496 * {@inheritDoc} 497 */ 498 @Override 499 public boolean pageExists( final String pageName, final int version ) { 500 final int latest = findLatestVersion( pageName ); 501 // a page without history in OLD/ is version 1, see getPageInfo() 502 if( version == PageProvider.LATEST_VERSION || version == latest || ( version == 1 && latest == -1 ) ) { 503 return pageExists( pageName ); 504 } 505 506 final File dir = findOldPageDir( pageName ); 507 if( !dir.exists() || !dir.isDirectory() ) { 508 return false; 509 } 510 511 return new File( dir, version + FILE_EXT ).exists(); 512 } 513 514 /** 515 * {@inheritDoc} 516 */ 517 // FIXME: Does not get user information. 518 @Override 519 public List< Page > getVersionHistory( final String page ) throws ProviderException { 520 final ArrayList< Page > list = new ArrayList<>(); 521 final int latest = findLatestVersion( page ); 522 for( int i = latest; i > 0; i-- ) { 523 final Page info = getPageInfo( page, i ); 524 if( info != null ) { 525 list.add( info ); 526 } 527 } 528 529 return list; 530 } 531 532 /* 533 * Support for migration of simple properties created by the FileSystemProvider when coming under Versioning management. 534 * Simulate an initial version. 535 */ 536 private Properties getHeritagePageProperties( final String page ) throws IOException { 537 final File propertyFile = new File( getPageDirectory(), mangleName( page ) + FileSystemProvider.PROP_EXT ); 538 if ( propertyFile.exists() ) { 539 final long lastModified = propertyFile.lastModified(); 540 541 CachedProperties cp = m_cachedProperties; 542 if ( cp != null && cp.m_page.equals(page) && cp.m_lastModified == lastModified ) { 543 return cp.m_props; 544 } 545 546 try( final InputStream in = new BufferedInputStream( Files.newInputStream( propertyFile.toPath() ) ) ) { 547 final Properties props = new Properties(); 548 props.load( in ); 549 550 final String originalAuthor = props.getProperty( Page.AUTHOR ); 551 if ( !originalAuthor.isEmpty() ) { 552 // simulate original author as if already versioned but put non-versioned property in special cache too 553 props.setProperty( "1.author", originalAuthor ); 554 555 // The profiler showed the probability was very high that when calling for the history of a page the 556 // propertyfile would be read as much times as there were versions of that file. It is statistically 557 // likely the propertyfile will be examined many times before it is updated. 558 cp = new CachedProperties( page, props, propertyFile.lastModified() ); 559 m_cachedProperties = cp; // Atomic 560 } 561 562 return props; 563 } 564 } 565 566 return new Properties(); // Returns an empty object 567 } 568 569 /** 570 * Removes the relevant page directory under "OLD" -directory as well, but does not remove any extra subdirectories from it. 571 * It will only touch those files that it thinks to be WikiPages. 572 * 573 * @param page {@inheritDoc} 574 * @throws {@inheritDoc} 575 */ 576 @Override 577 public void deletePage( final String page ) throws ProviderException { 578 super.deletePage( page ); 579 final File dir = findOldPageDir( page ); 580 if( dir.exists() && dir.isDirectory() ) { 581 final File[] files = dir.listFiles( new WikiFileFilter() ); 582 for( final File file : files ) { 583 if (!file.delete()) { 584 LOG.warn("Failed to delete " + file.getAbsolutePath()); 585 } 586 } 587 588 final File propfile = new File( dir, PROPERTYFILE ); 589 if( propfile.exists() ) { 590 if (!propfile.delete()) { 591 LOG.warn("Failed to delete " + propfile.getAbsolutePath()); 592 } 593 } 594 595 dir.delete(); 596 } 597 } 598 599 /** 600 * {@inheritDoc} 601 * 602 * Deleting versions has never really worked, JSPWiki assumes that version histories are "not gappy". Using deleteVersion() is 603 * definitely not recommended. 604 */ 605 @Override 606 public void deleteVersion( final String page, final int version ) throws ProviderException { 607 final File dir = findOldPageDir( page ); 608 int latest = findLatestVersion( page ); 609 if( version == PageProvider.LATEST_VERSION || 610 version == latest || 611 (version == 1 && latest == -1) ) { 612 // Delete the properties 613 try { 614 final Properties props = getPageProperties( page ); 615 props.remove( ((latest > 0) ? latest : 1)+".author" ); 616 putPageProperties( page, props ); 617 } catch( final IOException e ) { 618 LOG.error("Unable to modify page properties",e); 619 throw new ProviderException("Could not modify page properties: " + e.getMessage()); 620 } 621 622 // We can let the FileSystemProvider take care of the actual deletion 623 super.deleteVersion( page, PageProvider.LATEST_VERSION ); 624 625 // Copy the old file to the new location 626 latest = findLatestVersion( page ); 627 628 final File pageDir = findOldPageDir( page ); 629 final File previousFile = new File( pageDir, latest + FILE_EXT ); 630 final File pageFile = findPage(page); 631 try( final InputStream in = new BufferedInputStream( Files.newInputStream( previousFile.toPath() ) ); 632 final OutputStream out = new BufferedOutputStream( Files.newOutputStream( pageFile.toPath() ) ) ) { 633 if( previousFile.exists() ) { 634 FileUtil.copyContents( in, out ); 635 // We need also to set the date, since we rely on this. 636 pageFile.setLastModified( previousFile.lastModified() ); 637 } 638 } catch( final IOException e ) { 639 LOG.fatal("Something wrong with the page directory - you may have just lost data!",e); 640 } 641 642 return; 643 } 644 645 final File pageFile = new File( dir, ""+version+FILE_EXT ); 646 if( pageFile.exists() ) { 647 if( !pageFile.delete() ) { 648 LOG.error("Unable to delete page." + pageFile.getPath() ); 649 } 650 } else { 651 throw new NoSuchVersionException("Page "+page+", version="+version); 652 } 653 } 654 655 /** 656 * {@inheritDoc} 657 */ 658 // FIXME: This is kinda slow, we should need to do this only once. 659 @Override 660 public Collection< Page > getAllPages() throws ProviderException { 661 final Collection< Page > pages = super.getAllPages(); 662 final Collection< Page > returnedPages = new ArrayList<>(); 663 for( final Page page : pages ) { 664 final Page info = getPageInfo( page.getName(), WikiProvider.LATEST_VERSION ); 665 returnedPages.add( info ); 666 } 667 668 return returnedPages; 669 } 670 671 /** 672 * {@inheritDoc} 673 */ 674 @Override 675 public String getProviderInfo() 676 { 677 return ""; 678 } 679 680 /** 681 * {@inheritDoc} 682 */ 683 @Override 684 public void movePage( final String from, final String to ) { 685 // Move the file itself 686 final File fromFile = findPage( from ); 687 final File toFile = findPage( to ); 688 fromFile.renameTo( toFile ); 689 690 // Move any old versions 691 final File fromOldDir = findOldPageDir( from ); 692 final File toOldDir = findOldPageDir( to ); 693 fromOldDir.renameTo( toOldDir ); 694 } 695 696 /* 697 * The profiler showed that when calling the history of a page, the propertyfile was read just as many 698 * times as there were versions of that file. The loading of a propertyfile is a cpu-intensive job. 699 * This Class holds onto the last propertyfile read, because the probability is high that the next call 700 * will with ask for the same propertyfile. The time it took to show a historypage with 267 versions dropped 701 * by 300%. Although each propertyfile in a history could be cached, there is likely to be little performance 702 * gain over simply keeping the last one requested. 703 */ 704 private static class CachedProperties { 705 String m_page; 706 Properties m_props; 707 long m_lastModified; 708 709 /** 710 * Because a Constructor is inherently synchronised, there is no need to synchronise the arguments. 711 * 712 * @param pageName page name 713 * @param props Properties to use for initialization 714 * @param lastModified last modified date 715 */ 716 public CachedProperties( final String pageName, final Properties props, final long lastModified ) { 717 if ( pageName == null ) { 718 throw new NullPointerException ( "pageName must not be null!" ); 719 } 720 this.m_page = pageName; 721 if ( props == null ) { 722 throw new NullPointerException ( "properties must not be null!" ); 723 } 724 m_props = props; 725 this.m_lastModified = lastModified; 726 } 727 } 728 729}