Commits

mabe02  committed 7755655

* Replacing StringBuilder with StringBuffer
* Removes the ProcessBuilder

  • Participants
  • Parent commits a80b6a7
  • Branches jre142-branch

Comments (0)

Files changed (7)

File src/org/lantern/gui/Label.java

     }
 
     public String getText() {
-        StringBuilder sb = new StringBuilder();
+        StringBuffer sb = new StringBuffer();
         for(int i = 0; i < text.length; i++) {    
             String line = text[i];
             sb.append(line).append("\n");

File src/org/lantern/gui/TextGraphics.java

 
     public void fillRectangle(char character, TerminalPosition topLeft, TerminalSize rectangleSize)
     {
-        StringBuilder emptyLineBuilder = new StringBuilder();
+        StringBuffer emptyLineBuilder = new StringBuffer();
         for(int i = 0; i < rectangleSize.getColumns(); i++)
             emptyLineBuilder.append(character);
         String emptyLine = emptyLineBuilder.toString();

File src/org/lantern/screen/Screen.java

                 align = 8 - (x % 8);
                 break;
         }
-        StringBuilder replace = new StringBuilder();
+        StringBuffer replace = new StringBuffer();
         for(int i = 0; i < align; i++)
             replace.append(" ");
         return replace.toString();

File src/org/lantern/screen/ScreenWriter.java

     {
         int screenWidth = targetScreen.getWidth();
         int screenHeight = targetScreen.getHeight();
-        StringBuilder sb = new StringBuilder();
+        StringBuffer sb = new StringBuffer();
         for(int i = 0; i < screenWidth; i++)
             sb.append(c);
 

File src/org/lantern/terminal/ShellCommand.java

     static String exec(String[] cmd) throws LanternException
     {
         try {
-            ProcessBuilder pb = new ProcessBuilder(cmd);
-            Process process = pb.start();
+            Process process = Runtime.getRuntime().exec(cmd);
             ByteArrayOutputStream baos = new ByteArrayOutputStream();
             InputStream stdout = process.getInputStream();
             int readByte = stdout.read();
             }
             ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
             BufferedReader reader = new BufferedReader(new InputStreamReader(bais));
-            StringBuilder builder = new StringBuilder();
+            StringBuffer builder = new StringBuffer();
             while(reader.ready()) {
                 builder.append(reader.readLine());
             }

File src/org/lantern/test/TestShellCommand.java

         }
         ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
         BufferedReader reader = new BufferedReader(new InputStreamReader(bais));
-        StringBuilder builder = new StringBuilder();
+        StringBuffer builder = new StringBuffer();
         while(reader.ready()) {
             builder.append(reader.readLine());
         }

File src/org/lantern/test/gui/PanelTest.java

 
         public void repaint(TextGraphics graphics)
         {
-            StringBuilder sb = new StringBuilder();
+            StringBuffer sb = new StringBuffer();
             graphics.applyThemeItem(Category.DefaultDialog);
             for(int i = 0; i < graphics.getWidth(); i++)
                 sb.append(fillCharacter);