Thread: [Japi-cvs] SF.net SVN: japi:[826] progs/batcher/trunk/src/prj/net/sf/japi/progs/ batcher
Status: Beta
Brought to you by:
christianhujer
|
From: <chr...@us...> - 2009-02-14 23:02:12
|
Revision: 826
http://japi.svn.sourceforge.net/japi/?rev=826&view=rev
Author: christianhujer
Date: 2009-02-14 21:31:20 +0000 (Sat, 14 Feb 2009)
Log Message:
-----------
Updated copyright statements in source code.
Modified Paths:
--------------
progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/Main.java
progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/action.properties
Modified: progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/Main.java
===================================================================
--- progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/Main.java 2009-02-14 21:30:59 UTC (rev 825)
+++ progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/Main.java 2009-02-14 21:31:20 UTC (rev 826)
@@ -1,3 +1,20 @@
+/*
+ * Copyright (C) 2009 Christian Hujer
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
package net.sf.japi.progs.batcher;
import java.awt.Frame;
Modified: progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/action.properties
===================================================================
--- progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/action.properties 2009-02-14 21:30:59 UTC (rev 825)
+++ progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/action.properties 2009-02-14 21:31:20 UTC (rev 826)
@@ -1,3 +1,20 @@
+#
+# Copyright (C) 2009 Christian Hujer
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
window.title=Batcher
Main.menubar=file
file.menu=quit
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2009-05-23 23:22:03
|
Revision: 1334
http://japi.svn.sourceforge.net/japi/?rev=1334&view=rev
Author: christianhujer
Date: 2009-05-23 23:21:55 +0000 (Sat, 23 May 2009)
Log Message:
-----------
Fixed issues found by findbugs.
Modified Paths:
--------------
progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/Batch.java
progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/Job.java
progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/JobRun.java
progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/Project.java
progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/ShellPane.java
Modified: progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/Batch.java
===================================================================
--- progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/Batch.java 2009-05-23 22:31:01 UTC (rev 1333)
+++ progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/Batch.java 2009-05-23 23:21:55 UTC (rev 1334)
@@ -23,6 +23,9 @@
*/
public class Batch extends AbstractChangeable {
+ /** Serial version. */
+ private static final long serialVersionUID = 1L;
+
/** The title of this batch.
* @serial include
*/
Modified: progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/Job.java
===================================================================
--- progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/Job.java 2009-05-23 22:31:01 UTC (rev 1333)
+++ progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/Job.java 2009-05-23 23:21:55 UTC (rev 1334)
@@ -19,6 +19,7 @@
import java.io.File;
import java.io.IOException;
+import java.io.ObjectInputStream;
import java.util.ArrayList;
import java.util.Map;
import net.sf.japi.swing.misc.CollectionsListModel;
@@ -31,6 +32,9 @@
*/
public class Job extends AbstractChangeable {
+ /** Serial version. */
+ private static final long serialVersionUID = 1L;
+
/** The title.
* @serial include
*/
@@ -38,9 +42,9 @@
/** The environment.
* Inherited from parent if <code>null</code>.
- * @serial include
+ * @serial exclude
*/
- @Nullable private Map<String, String> env;
+ @Nullable private transient Map<String, String> env;
/** The command line with its arguments.
* @serial include
@@ -62,6 +66,13 @@
this.title = title;
}
+ /** {@inheritDoc} */
+ private void readObject(@NotNull final ObjectInputStream in) throws ClassNotFoundException, IOException {
+ in.defaultReadObject();
+ processBuilder = new ProcessBuilder(command);
+ env = processBuilder.environment();
+ }
+
/** Returns the current working directory.
* @return The current working directory.
*/
Modified: progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/JobRun.java
===================================================================
--- progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/JobRun.java 2009-05-23 22:31:01 UTC (rev 1333)
+++ progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/JobRun.java 2009-05-23 23:21:55 UTC (rev 1334)
@@ -42,12 +42,6 @@
/** The job that is run. */
private final Job job;
- /** The output of the job. */
- private String output;
-
- /** The return value of the job. */
- private int retVal;
-
/** Creates a JobRun.
* @param jobRunView JobRunView for displaying the job run.
* @param job Job to run.
@@ -60,13 +54,16 @@
/** {@inheritDoc} */
@Override
public Object doInBackground() {
- final StringBuilder sb = new StringBuilder();
try {
final Process p = job.start();
final Reader in = /*new BufferedReader*/(new InputStreamReader(p.getInputStream()));
- final char[] buf = new char[4096];
- for (int charsRead; (charsRead = in.read(buf)) != -1;) {
- publish(new String(buf, 0, charsRead));
+ try {
+ final char[] buf = new char[4096];
+ for (int charsRead; (charsRead = in.read(buf)) != -1;) {
+ publish(new String(buf, 0, charsRead));
+ }
+ } finally {
+ in.close();
}
} catch (final Throwable e) {
publish(e.toString());
Modified: progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/Project.java
===================================================================
--- progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/Project.java 2009-05-23 22:31:01 UTC (rev 1333)
+++ progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/Project.java 2009-05-23 23:21:55 UTC (rev 1334)
@@ -25,6 +25,9 @@
*/
public class Project implements Changeable {
+ /** Serial version. */
+ private static final long serialVersionUID = 1L;
+
/** List with all jobs.
* @serial include
*/
Modified: progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/ShellPane.java
===================================================================
--- progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/ShellPane.java 2009-05-23 22:31:01 UTC (rev 1333)
+++ progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/ShellPane.java 2009-05-23 23:21:55 UTC (rev 1334)
@@ -40,6 +40,9 @@
*/
public class ShellPane extends JPanel implements ActionListener {
+ /** Serial version. */
+ private static final long serialVersionUID = 1L;
+
/** The terminal screen. */
private final JTextArea textArea = new JTextArea(25, 80);
@@ -52,11 +55,15 @@
/** Button for stopping the current process. */
private final JButton stop = new JButton("stop");
- /** ProcessBuilder for starting processes. */
- private final ProcessBuilder processBuilder = new ProcessBuilder().redirectErrorStream(true);
+ /** ProcessBuilder for starting processes.
+ * @serial exclude
+ */
+ private transient ProcessBuilder processBuilder = new ProcessBuilder().redirectErrorStream(true);
- /** Running shell process. */
- private ShellWorker worker;
+ /** Running shell process.
+ * @serial exclude
+ */
+ private transient ShellWorker worker;
/** Create a ShellPane. */
public ShellPane() {
@@ -142,15 +149,19 @@
private Process p;
/** {@inheritDoc} */
- @Override public Object doInBackground() {
- final StringBuilder sb = new StringBuilder();
+ @Override
+ public Object doInBackground() {
try {
p = processBuilder.start();
try {
final Reader in = new InputStreamReader(p.getInputStream());
- final char[] buf = new char[4096];
- for (int charsRead; !isCancelled() && (charsRead = in.read(buf)) != -1;) {
- publish(new String(buf, 0, charsRead));
+ try {
+ final char[] buf = new char[4096];
+ for (int charsRead; !isCancelled() && (charsRead = in.read(buf)) != -1;) {
+ publish(new String(buf, 0, charsRead));
+ }
+ } finally {
+ in.close();
}
} finally {
p.destroy();
@@ -162,7 +173,8 @@
}
/** {@inheritDoc} */
- @Override public void process(final List<String> chunks) {
+ @Override
+ public void process(final List<String> chunks) {
for (final String s : chunks) {
textArea.append(s);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|