diff --git a/ccm-core/application.xml b/ccm-core/application.xml index 8ad4858ea..79c4b4b3f 100755 --- a/ccm-core/application.xml +++ b/ccm-core/application.xml @@ -9,7 +9,7 @@ buildHooks="build-hooks.xml"> - + diff --git a/ccm-core/etc/src/saxon-6.5.5-source.zip b/ccm-core/etc/src/saxon-6.5.5-source.zip new file mode 100644 index 000000000..216dcb4e8 Binary files /dev/null and b/ccm-core/etc/src/saxon-6.5.5-source.zip differ diff --git a/ccm-core/lib/saxon-6.5.5.jar b/ccm-core/lib/saxon-6.5.5.jar new file mode 100644 index 000000000..15aa83a54 Binary files /dev/null and b/ccm-core/lib/saxon-6.5.5.jar differ diff --git a/ccm-core/lib/saxon.jar b/ccm-core/lib/saxon.jar deleted file mode 100755 index 18405463e..000000000 Binary files a/ccm-core/lib/saxon.jar and /dev/null differ diff --git a/ccm-core/sql/ccm-core/default/kernel/index-users.sql b/ccm-core/sql/ccm-core/default/kernel/index-users.sql index 14b8d4bd0..375f9471e 100755 --- a/ccm-core/sql/ccm-core/default/kernel/index-users.sql +++ b/ccm-core/sql/ccm-core/default/kernel/index-users.sql @@ -19,3 +19,5 @@ -- $DateTime: 2004/08/16 18:10:38 $ create unique index users_name_id_idx on users(name_id); + +create unique index users_lower_screen_name_idx on users(lower(screen_name)); diff --git a/ccm-core/src/com/arsdigita/installer/LoadSQLPlusScript.java b/ccm-core/src/com/arsdigita/installer/LoadSQLPlusScript.java index 6dfb75432..220f2b589 100755 --- a/ccm-core/src/com/arsdigita/installer/LoadSQLPlusScript.java +++ b/ccm-core/src/com/arsdigita/installer/LoadSQLPlusScript.java @@ -88,7 +88,9 @@ public class LoadSQLPlusScript { } public void loadSQLPlusScript (String scriptFilename) { - loadScript(scriptFilename); + if (scriptFilename != null) { + loadScript(scriptFilename.replace('\\', '/')); + } } protected void loadScript(String scriptFilename) { @@ -100,6 +102,7 @@ public class LoadSQLPlusScript { try { return new FileReader(name); } catch (FileNotFoundException e) { + s_log.warn("File not found: " + name); return null; } } diff --git a/ccm-core/src/com/arsdigita/installer/SQLLoader.java b/ccm-core/src/com/arsdigita/installer/SQLLoader.java index 5e864c283..4315dd429 100755 --- a/ccm-core/src/com/arsdigita/installer/SQLLoader.java +++ b/ccm-core/src/com/arsdigita/installer/SQLLoader.java @@ -63,6 +63,7 @@ public abstract class SQLLoader { final InputStream is = cload.getResourceAsStream(resourceName); if (is == null) { + s_log.warn("Resource not found: " + resourceName); return null; } else { return new InputStreamReader(is); @@ -166,7 +167,7 @@ public abstract class SQLLoader { if (front == null) { resolved = back; } else { - resolved = front + File.separatorChar + back; + resolved = front + '/' + back; } if (s_log.isDebugEnabled()) { diff --git a/ccm-core/src/com/arsdigita/kernel/KernelConfig.java b/ccm-core/src/com/arsdigita/kernel/KernelConfig.java index 80ba57d45..3ae6cadf9 100755 --- a/ccm-core/src/com/arsdigita/kernel/KernelConfig.java +++ b/ccm-core/src/com/arsdigita/kernel/KernelConfig.java @@ -22,19 +22,13 @@ import com.arsdigita.runtime.AbstractConfig; import com.arsdigita.util.parameter.BooleanParameter; import com.arsdigita.util.parameter.EnumerationParameter; import com.arsdigita.util.parameter.Parameter; -import org.apache.log4j.Logger; /** * @author Justin Ross * @see com.arsdigita.kernel.Kernel + * @version $Id: KernelConfig.java 1233 2006-06-22 12:37:05Z apevec $ */ public final class KernelConfig extends AbstractConfig { - public static final String versionId = - "$Id: KernelConfig.java 1233 2006-06-22 12:37:05Z apevec $" + - "$Author: apevec $" + - "$DateTime: 2004/08/16 18:10:38 $"; - - private static final Logger s_log = Logger.getLogger(KernelConfig.class); private final Parameter m_debug; private final Parameter m_permissions; @@ -88,6 +82,14 @@ public final class KernelConfig extends AbstractConfig { return (String) get(m_identifier); } + public final boolean emailIsPrimaryIdentifier() { + return "email".equals(get(m_identifier)); + } + + public final boolean screenNameIsPrimaryIdentifier() { + return !emailIsPrimaryIdentifier(); + } + public final boolean isSSOenabled() { return ((Boolean) get(m_SSO)).booleanValue(); } diff --git a/ccm-core/src/com/arsdigita/kernel/User.java b/ccm-core/src/com/arsdigita/kernel/User.java index c0495226f..eb92e92fb 100755 --- a/ccm-core/src/com/arsdigita/kernel/User.java +++ b/ccm-core/src/com/arsdigita/kernel/User.java @@ -36,7 +36,6 @@ import com.arsdigita.persistence.OID; import com.arsdigita.persistence.PersistenceException; import com.arsdigita.persistence.SessionManager; import com.arsdigita.persistence.metadata.ObjectType; -import org.apache.log4j.Logger; /** * Represents a user. @@ -47,14 +46,12 @@ import org.apache.log4j.Logger; public class User extends Party { public static final String versionId = "$Id: User.java 1586 2007-05-31 13:05:10Z chrisgilbert23 $ by $Author: chrisgilbert23 $, $DateTime: 2004/08/16 18:10:38 $"; - private PersonName m_name; private boolean m_external; - - /** An attribute name for the underlying data object. */ - public static final String BANNED = "banned"; + /** An attribute name for the underlying data object. */ + public static final String BANNED = "banned"; /** * Every instance of group must encapsulate a data object whose @@ -84,9 +81,7 @@ public class User extends Party { * @see com.arsdigita.persistence.DataObject * @see com.arsdigita.persistence.OID **/ - public static User retrieve(BigDecimal id) - throws DataObjectNotFoundException - { + public static User retrieve(BigDecimal id) throws DataObjectNotFoundException { return retrieve(new OID(BASE_DATA_OBJECT_TYPE, id)); } @@ -108,11 +103,9 @@ public class User extends Party { * @see com.arsdigita.persistence.OID * @see DomainObjectFactory#newInstance(OID) **/ - public static User retrieve(OID oid) - throws DataObjectNotFoundException - { + public static User retrieve(OID oid) throws DataObjectNotFoundException { User user = (User) DomainObjectFactory.newInstance(oid); - if (user==null) { + if (user == null) { throw new DataObjectNotFoundException("Domain object factory " + "produced null user for OID " + @@ -133,7 +126,7 @@ public class User extends Party { public static User retrieve(DataObject userData) { User user = (User) DomainObjectFactory.newInstance(userData); - if (user==null) { + if (user == null) { throw new RuntimeException("Domain object factory produced " + "null user for data object " + userData); @@ -172,14 +165,12 @@ public class User extends Party { **/ public User(boolean external) { this(BASE_DATA_OBJECT_TYPE); - m_external = external; + m_external = external; } - - - + public User() { - this (false); - + this(false); + } /** @@ -201,8 +192,9 @@ public class User extends Party { } public User(String givenName, String familyName, String email) { - this (givenName, familyName, email, false); + this(givenName, familyName, email, false); } + /** * Constructor in which the contained DataObject is * initialized with a new DataObject with an @@ -220,7 +212,6 @@ public class User extends Party { super(typeName); } - /** * Constructor in which the contained DataObject is * initialized with a new DataObject with an @@ -287,7 +278,7 @@ public class User extends Party { m_name = new PersonName(); setAssociation("name", m_name); - set(BANNED, new Boolean(false)); + set(BANNED, new Boolean(false)); } } @@ -390,31 +381,28 @@ public class User extends Party { // If the domain object is new or the primary email has been changed, // validate it. - if ( (isNew() || isPropertyModified("primaryEmail")) && - KernelHelper.emailIsPrimaryIdentifier()) { + if ((isNew() || isPropertyModified("primaryEmail")) && Kernel.getConfig().emailIsPrimaryIdentifier()) { validatePrimaryEmail(); } - if ((isNew() || isPropertyModified("primaryEmail") - || isPropertyModified("screenName")) && - !KernelHelper.emailIsPrimaryIdentifier()) { + if ((isNew() || isPropertyModified("primaryEmail") || isPropertyModified("screenName")) + && !Kernel.getConfig().emailIsPrimaryIdentifier()) { - if (getPrimaryEmail() == null) { - throw new RuntimeException("Primary email must be specified"); - } - validateScreenName(); - } + if (getPrimaryEmail() == null) { + throw new RuntimeException("Primary email must be specified"); + } + validateScreenName(); + } } - protected void afterSave() { super.afterSave(); - // users have admin permissions on themselves (needed to change - // email, for instance). + // users have admin permissions on themselves (needed to change + // email, for instance). if (!m_external) { - PermissionDescriptor perm = new PermissionDescriptor(PrivilegeDescriptor.ADMIN, this, this); - PermissionService.grantPermission(perm); - } + PermissionDescriptor perm = new PermissionDescriptor(PrivilegeDescriptor.ADMIN, this, this); + PermissionService.grantPermission(perm); + } } /** @@ -444,35 +432,29 @@ public class User extends Party { } // Verify uniqueness of email - DataQuery query = SessionManager.getSession() - .retrieveQuery("com.arsdigita.kernel.UserPrimaryEmail"); - Filter f = - query.addFilter("primaryEmailAddress=:email " + - "and userID != :userID"); + DataQuery query = SessionManager.getSession().retrieveQuery("com.arsdigita.kernel.UserPrimaryEmail"); + Filter f = query.addFilter("primaryEmailAddress=:email " + "and userID != :userID"); f.set("email", email.getEmailAddress()); f.set("userID", getID()); - if (query.size()>0) { + if (query.size() > 0) { throw new RuntimeException("Primary email must be unique among users"); } } protected void validateScreenName() { - String sn = getScreenName().toLowerCase(); + String sn = getScreenName(); if (sn == null) { throw new RuntimeException("Screen Name must be specified"); } - + // Verify uniqueness of screen name - DataQuery query = SessionManager.getSession() - .retrieveQuery("com.arsdigita.kernel.UserPrimaryEmail"); - Filter f = - query.addFilter("lowerScreenName=:sn " + - "and userID != :userID"); - f.set("sn", sn); + DataQuery query = SessionManager.getSession().retrieveQuery("com.arsdigita.kernel.UserPrimaryEmail"); + Filter f = query.addFilter("lowerScreenName=:sn " + "and userID != :userID"); + f.set("sn", sn.toLowerCase()); f.set("userID", getID()); - if (query.size()>0) { + if (query.size() > 0) { throw new RuntimeException("Screen Name must be unique among users"); } } @@ -481,19 +463,18 @@ public class User extends Party { return SessionManager.getSession().retrieveDataOperation(name); } - /** - * Getter for the banned property, which is persisted to the database - */ - public boolean isBanned() { - return ((Boolean) get(BANNED)).booleanValue(); + /** + * Getter for the banned property, which is persisted to the database + */ + public boolean isBanned() { + return ((Boolean) get(BANNED)).booleanValue(); } - /** - * Setter for the banned property, which is persisted to the database - */ - public void setBanned(boolean b) { - set(BANNED, new Boolean(b)); - } + /** + * Setter for the banned property, which is persisted to the database + */ + public void setBanned(boolean b) { + set(BANNED, new Boolean(b)); + } } - diff --git a/ccm-core/src/com/arsdigita/ui/admin/CreateUserPane.java b/ccm-core/src/com/arsdigita/ui/admin/CreateUserPane.java index 4f7185d05..1d32c7475 100755 --- a/ccm-core/src/com/arsdigita/ui/admin/CreateUserPane.java +++ b/ccm-core/src/com/arsdigita/ui/admin/CreateUserPane.java @@ -37,6 +37,6 @@ class CreateUserPane extends SegmentedPanel } public void reset(PageState ps) { - // empty + ps.setValue(USER_ID_PARAM, null); } } diff --git a/ccm-core/src/com/arsdigita/ui/admin/UserAddForm.java b/ccm-core/src/com/arsdigita/ui/admin/UserAddForm.java index 40ee1702e..09a61f0a1 100755 --- a/ccm-core/src/com/arsdigita/ui/admin/UserAddForm.java +++ b/ccm-core/src/com/arsdigita/ui/admin/UserAddForm.java @@ -18,6 +18,8 @@ */ package com.arsdigita.ui.admin; +import javax.mail.internet.InternetAddress; + import com.arsdigita.bebop.FormProcessException; import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.event.FormInitListener; @@ -28,7 +30,6 @@ import com.arsdigita.kernel.EmailAddress; import com.arsdigita.kernel.PersonName; import com.arsdigita.kernel.User; import com.arsdigita.kernel.UserAuthentication; -import javax.mail.internet.InternetAddress; /** * Form used to add a new user to the system. @@ -58,8 +59,6 @@ class UserAddForm extends UserForm m_question.addValidationListener (new NotEmptyValidationListener()); - m_answer.addValidationListener - (new NotEmptyValidationListener()); } /** diff --git a/ccm-core/src/com/arsdigita/ui/admin/UserForm.java b/ccm-core/src/com/arsdigita/ui/admin/UserForm.java index be20fd4b3..e54cbdd57 100755 --- a/ccm-core/src/com/arsdigita/ui/admin/UserForm.java +++ b/ccm-core/src/com/arsdigita/ui/admin/UserForm.java @@ -35,10 +35,12 @@ import com.arsdigita.bebop.parameters.NotEmptyValidationListener; import com.arsdigita.bebop.parameters.StringLengthValidationListener; import com.arsdigita.bebop.parameters.StringParameter; import com.arsdigita.bebop.parameters.URLParameter; +import com.arsdigita.kernel.Kernel; import com.arsdigita.persistence.DataQuery; import com.arsdigita.persistence.Filter; import com.arsdigita.persistence.SessionManager; import com.arsdigita.ui.login.PasswordValidationListener; +import com.arsdigita.util.StringUtils; import java.math.BigDecimal; import javax.mail.internet.InternetAddress; @@ -130,7 +132,7 @@ class UserForm extends Form implements FormValidationListener, AdminConstants { // Password answer m_answer = new TextField(new StringParameter(USER_FORM_INPUT_ANSWER)); - m_answer.setSize(30); + m_answer.setSize(50); add(USER_FORM_LABEL_ANSWER); add(m_answer); @@ -140,6 +142,7 @@ class UserForm extends Form implements FormValidationListener, AdminConstants { (new EmailParameter(USER_FORM_INPUT_PRIMARY_EMAIL)); m_primaryEmail.addValidationListener (new NotEmptyValidationListener()); + m_primaryEmail.setSize(50); add(USER_FORM_LABEL_PRIMARY_EMAIL); add(m_primaryEmail); @@ -150,12 +153,16 @@ class UserForm extends Form implements FormValidationListener, AdminConstants { m_additionalEmail = new TextField (new EmailParameter(USER_FORM_INPUT_ADDITIONAL_EMAIL)); + m_additionalEmail.setSize(50); add(USER_FORM_LABEL_ADDITIONAL_EMAIL); add(m_additionalEmail); // Screen name m_screenName = new TextField (new StringParameter(USER_FORM_INPUT_SCREEN_NAME)); + if (Kernel.getConfig().screenNameIsPrimaryIdentifier()) { + m_screenName.addValidationListener(new NotEmptyValidationListener()); + } add(USER_FORM_LABEL_SCREEN_NAME); add(m_screenName); @@ -204,17 +211,11 @@ class UserForm extends Form implements FormValidationListener, AdminConstants { String password = (String) m_password.getValue(ps); String confirm = (String) m_confirmPassword.getValue(ps); - if (password != null && confirm != null) { + if (!StringUtils.emptyString(password) && !StringUtils.emptyString(confirm)) { if (!password.equals(confirm)) { data.addError(USER_FORM_INPUT_PASSWORD_CONFIRMATION, (String) USER_FORM_ERROR_PASSWORD_NOT_MATCH.localize(req)); } - } else { - if (password != null || confirm != null) { - // One of the field is null. - data.addError(USER_FORM_INPUT_PASSWORD_CONFIRMATION, - (String) USER_FORM_ERROR_PASSWORD_NOT_MATCH.localize(req)); - } } } diff --git a/ccm-core/src/com/redhat/persistence/pdl/adapters/BlobAd.java b/ccm-core/src/com/redhat/persistence/pdl/adapters/BlobAd.java index ecbbabfe4..b44e68cf1 100755 --- a/ccm-core/src/com/redhat/persistence/pdl/adapters/BlobAd.java +++ b/ccm-core/src/com/redhat/persistence/pdl/adapters/BlobAd.java @@ -18,28 +18,28 @@ */ package com.redhat.persistence.pdl.adapters; -import com.arsdigita.db.DbHelper; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.OutputStream; +import java.lang.reflect.InvocationTargetException; import java.sql.Blob; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Types; +import com.arsdigita.db.DbHelper; + /** * BlobAd * * @author Rafael H. Schloming <rhs@mit.edu> - * @version $Revision: #7 $ $Date: 2004/08/16 $ + * @version $Id: BlobAd.java 287 2005-02-22 00:29:02Z sskracic $ **/ public class BlobAd extends SimpleAdapter { - public final static String versionId = "$Id: BlobAd.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $"; - public BlobAd() { super("global.Blob", Types.BLOB); } @@ -75,11 +75,9 @@ public class BlobAd extends SimpleAdapter { return; } - /* Jens Pelzetter 2009-03-16 commented out to get rid of Netbeans errors */ - /*oracle.sql.BLOB blob = - (oracle.sql.BLOB) rs.getBlob(column); - OutputStream out = blob.getBinaryOutputStream(); + Blob blob = rs.getBlob(column); try { + OutputStream out = (OutputStream)(blob.getClass().getMethod("getBinaryOutputStream", new Class[0]).invoke(blob)); out.write((byte[]) value); out.flush(); out.close(); @@ -88,8 +86,18 @@ public class BlobAd extends SimpleAdapter { // persistence exception here breaks ant verify-pdl // because the classpath isn't set up to include // com.arsdigita.util.* - throw new Error("Unable to write LOB: " + e); - }*/ + throw new Error("Unable to write LOB", e); + } catch (IllegalArgumentException e) { + throw new RuntimeException("Unable to write BLOB", e); + } catch (SecurityException e) { + throw new RuntimeException("Unable to write BLOB", e); + } catch (IllegalAccessException e) { + throw new RuntimeException("Unable to write BLOB", e); + } catch (InvocationTargetException e) { + throw new RuntimeException("Unable to write BLOB", e); + } catch (NoSuchMethodException e) { + throw new RuntimeException("Unable to write BLOB", e); + } } } diff --git a/ccm-core/src/com/redhat/persistence/pdl/adapters/StringAd.java b/ccm-core/src/com/redhat/persistence/pdl/adapters/StringAd.java index 3d2d947eb..b12b8351d 100755 --- a/ccm-core/src/com/redhat/persistence/pdl/adapters/StringAd.java +++ b/ccm-core/src/com/redhat/persistence/pdl/adapters/StringAd.java @@ -18,9 +18,9 @@ */ package com.redhat.persistence.pdl.adapters; -import com.arsdigita.db.DbHelper; import java.io.IOException; import java.io.Writer; +import java.lang.reflect.InvocationTargetException; import java.sql.Clob; import java.sql.PreparedStatement; import java.sql.ResultSet; @@ -28,21 +28,19 @@ import java.sql.ResultSetMetaData; import java.sql.SQLException; import java.sql.Types; +import com.arsdigita.db.DbHelper; + /** * StringAd: StringAdapter class * * * @author Rafael H. Schloming <rhs@mit.edu> - * @version $Revision: #7 $ $Date: 2004/08/16 $ + * @version $Id: StringAd.java 287 2005-02-22 00:29:02Z sskracic $ **/ public class StringAd extends SimpleAdapter { - public final static String versionId = - "$Id: StringAd.java 287 2005-02-22 00:29:02Z sskracic $" + - " by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $"; - public StringAd() { super("global.String", Types.VARCHAR); } @@ -78,11 +76,9 @@ public class StringAd extends SimpleAdapter { return; } - /* Jens Pelzetter 2009-03-16 commented out to get rid of Netbeans errors */ - /*oracle.sql.CLOB clob = - (oracle.sql.CLOB) rs.getClob(column); - Writer out = clob.getCharacterOutputStream(); + Clob clob = rs.getClob(column); try { + Writer out = (Writer)clob.getClass().getMethod("getCharacterOutputStream", new Class[0]).invoke(clob); out.write(((String) value).toCharArray()); out.flush(); out.close(); @@ -92,6 +88,17 @@ public class StringAd extends SimpleAdapter { // because the classpath isn't set up to include // com.arsdigita.util.* throw new Error("Unable to write LOB: " + e); - }*/ + } catch (IllegalArgumentException e) { + throw new RuntimeException("Unable to write CLOB", e); + } catch (SecurityException e) { + throw new RuntimeException("Unable to write CLOB", e); + } catch (IllegalAccessException e) { + throw new RuntimeException("Unable to write CLOB", e); + } catch (InvocationTargetException e) { + throw new RuntimeException("Unable to write CLOB", e); + } catch (NoSuchMethodException e) { + throw new RuntimeException("Unable to write CLOB", e); + } } + } diff --git a/ccm-core/test/src/com/arsdigita/persistence/LobTest.java b/ccm-core/test/src/com/arsdigita/persistence/LobTest.java index 5ac106d67..8d35d1e96 100755 --- a/ccm-core/test/src/com/arsdigita/persistence/LobTest.java +++ b/ccm-core/test/src/com/arsdigita/persistence/LobTest.java @@ -18,28 +18,28 @@ */ package com.arsdigita.persistence; -import com.arsdigita.db.DbHelper; -import com.arsdigita.persistence.DataObject; -import com.arsdigita.persistence.OID; import java.io.Writer; +import java.lang.reflect.InvocationTargetException; import java.math.BigDecimal; import java.math.BigInteger; +import java.sql.Clob; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; + import org.apache.log4j.Logger; +import com.arsdigita.db.DbHelper; + /** * LobTest - for testing Blob and Clob datatype. * * @author Jeff Teeters - * @version $Revision: #17 $ $Date: 2004/08/16 $ + * @version $Id: LobTest.java 745 2005-09-02 10:50:34Z sskracic $ */ public class LobTest extends PersistenceTestCase { - public static final String versionId = "$Id: LobTest.java 745 2005-09-02 10:50:34Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $"; - private Logger s_cat = Logger.getLogger(LobTest.class); @@ -253,7 +253,6 @@ public class LobTest extends PersistenceTestCase { dt.save(); dt = getSession().retrieve(new OID("examples.Datatype", BigInteger.ZERO)); - String bar = (String) dt.get("string"); String foundString = (String) dt.get("clob"); dt.delete(); @@ -365,7 +364,7 @@ public class LobTest extends PersistenceTestCase { private void executeOracleUpdate(Connection conn, String testString, int id) - throws java.sql.SQLException, java.io.IOException { + throws java.sql.SQLException, java.io.IOException, IllegalArgumentException, SecurityException, IllegalAccessException, InvocationTargetException, NoSuchMethodException { PreparedStatement ps = conn.prepareStatement("insert into t_datatypes (id, j_clob) " + "values (?, EMPTY_CLOB())"); @@ -383,8 +382,8 @@ public class LobTest extends PersistenceTestCase { ps.setBigDecimal(1, new BigDecimal(BigInteger.valueOf(id))); ResultSet rs = ps.executeQuery(); rs.next(); - oracle.sql.CLOB Clob = (oracle.sql.CLOB)rs.getClob(1); - Writer char_stream = Clob.getCharacterOutputStream (); + Clob clob = rs.getClob(1); + Writer char_stream = (Writer)clob.getClass().getMethod("getCharacterOutputStream", new Class[0]).invoke(clob); char_stream.write(testString); char_stream.flush(); char_stream.close();