Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed redis data source.

  • Loading branch information...
commit 279381fe46793cbf206396a0133262a64258b55b 1 parent c4e756a
@LadyCailin LadyCailin authored
View
14 SPECIAL_LICENSE.txt
@@ -1,12 +1,12 @@
As a special restriction, by submitting code that modifies the core compiler,
the core functions (platform independent functions such as if, while, for, etc),
-language constructs, optimizer, exceptions, tools, PureUtilities, or any other
-portion that is unrelated to the Minecraft aware portions, you agree to release
-this code into the copyright of Layton Smith. Furthermore, the core language
-grammar is copyright Layton Smith, in all cases. Note that this does not affect
-the release license. All code is still released under MIT. In layman's terms,
-this means that you cannot submit code that adds Objects, for instance, and keep
-the copyright on it, you must release that to me.
+language constructs, optimizer, exceptions, tools, PureUtilities, Persistance and
+Persistance Network, or any other portion that is unrelated to the Minecraft
+aware portions, you agree to release this code into the copyright of Layton Smith.
+Furthermore, the core language grammar is copyright Layton Smith, in all cases.
+Note that this does not affect the release license. All code is still released
+under MIT. In layman's terms, this means that you cannot submit code that adds
+Objects, for instance, and keep the copyright on it, you must release that to me.
This is because I intend for MethodScript to live past Minecraft, and I do not
want to be burdened by license restrictions. In all likelihood, I will always
View
5 src/main/java/com/laytonsmith/PureUtilities/FileUtility.java
@@ -4,7 +4,6 @@
import java.util.HashMap;
import java.util.Map;
import org.apache.commons.io.FileUtils;
-import org.apache.commons.lang.mutable.MutableObject;
import org.mozilla.intl.chardet.nsDetector;
import org.mozilla.intl.chardet.nsICharsetDetectionObserver;
import org.mozilla.intl.chardet.nsPSMDetector;
@@ -383,7 +382,7 @@ public static String getFileCharset(File file) throws IOException {
det.Init(new nsICharsetDetectionObserver() {
public void Notify(String charset) {
- result.setValue(charset);
+ result.setObject(charset);
}
});
@@ -404,7 +403,7 @@ public void Notify(String charset) {
}
}
det.DataEnd();
- return (String)result.getValue();
+ return (String)result.getObject();
} finally {
if(imp != null){
imp.close();
View
70 src/main/java/com/laytonsmith/PureUtilities/MutableObject.java
@@ -0,0 +1,70 @@
+package com.laytonsmith.PureUtilities;
+
+/**
+ * This class wraps an object, which is mutable. Useful for places where
+ * you must be able to manipulate a final variable, for instance, in anonymous
+ * classes. The common Object methods are forwarded to the underlying object,
+ * unless it is null, in which case various defaults are returned.
+ */
+public final class MutableObject {
+ private Object obj = null;
+
+ /**
+ * Constructs a new MutableObject, which is null.
+ */
+ public MutableObject(){
+
+ }
+
+ /**
+ * Constructs a new MutableObject, wrapping the specified object.
+ * @param obj
+ */
+ public MutableObject(Object obj){
+ setObject(obj);
+ }
+
+ /**
+ * Sets the underlying object.
+ * @param obj
+ */
+ public void setObject(Object obj){
+ this.obj = obj;
+ }
+
+ /**
+ * Gets the underlying object.
+ * @return
+ */
+ public Object getObject(){
+ return obj;
+ }
+
+ @Override
+ @SuppressWarnings("EqualsWhichDoesntCheckParameterClass")
+ public boolean equals(Object obj) {
+ if(this.obj == null){
+ return obj == null;
+ } else {
+ return this.obj.equals(obj);
+ }
+ }
+
+ @Override
+ public int hashCode() {
+ if(this.obj == null){
+ return 0;
+ } else {
+ return this.obj.hashCode();
+ }
+ }
+
+ @Override
+ public String toString() {
+ if(this.obj == null){
+ return "null";
+ } else {
+ return this.obj.toString();
+ }
+ }
+}
View
2  src/main/java/com/laytonsmith/core/functions/Persistance.java
@@ -92,7 +92,7 @@ public Construct exec(Target t, Environment env, Construct... args) throws Cance
} catch(IllegalArgumentException e){
throw new ConfigRuntimeException(e.getMessage(), ExceptionType.FormatException, t);
} catch (Exception ex) {
- throw new ConfigRuntimeException(ex.getMessage(), ExceptionType.IOException, t);
+ throw new ConfigRuntimeException(ex.getMessage(), ExceptionType.IOException, t, ex);
}
return new CVoid(t);
}
View
2  src/main/java/com/laytonsmith/persistance/RedisDataSource.java
@@ -17,7 +17,7 @@
*
* @author lsmith
*/
-//@datasource("redis")
+@datasource("redis")
public class RedisDataSource extends AbstractDataSource {
private Jedis connection;
Please sign in to comment.
Something went wrong with that request. Please try again.