diff options
Diffstat (limited to 'scripting/java/org/openoffice/netbeans/editor/JavaKit.java')
-rw-r--r-- | scripting/java/org/openoffice/netbeans/editor/JavaKit.java | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/scripting/java/org/openoffice/netbeans/editor/JavaKit.java b/scripting/java/org/openoffice/netbeans/editor/JavaKit.java index 3f622927ed83..1a3b6abddd17 100644 --- a/scripting/java/org/openoffice/netbeans/editor/JavaKit.java +++ b/scripting/java/org/openoffice/netbeans/editor/JavaKit.java @@ -57,10 +57,10 @@ public class JavaKit extends ExtKit { public static final String JAVA_MIME_TYPE = "text/x-java"; // NOI18N - static final long serialVersionUID =-5445829962533684922L; + static final long serialVersionUID = -5445829962533684922L; static { - Settings.addInitializer( new JavaSettingsInitializer( JavaKit.class ) ); + Settings.addInitializer(new JavaSettingsInitializer(JavaKit.class)); Settings.reset(); URL skeleton = null, body = null; @@ -73,8 +73,8 @@ public class JavaKit extends ExtKit { new URLAccessor(body)); JCBaseFinder finder = new JCBaseFinder(); - finder.append( provider ); - JavaCompletion.setFinder( finder ); + finder.append(provider); + JavaCompletion.setFinder(finder); } } @@ -110,7 +110,7 @@ public class JavaKit extends ExtKit { protected void initDocument(BaseDocument doc) { doc.addLayer(new JavaDrawLayerFactory.JavaLayer(), - JavaDrawLayerFactory.JAVA_LAYER_VISIBILITY); + JavaDrawLayerFactory.JAVA_LAYER_VISIBILITY); doc.addDocumentListener(new JavaDrawLayerFactory.LParenWatcher()); } @@ -131,8 +131,7 @@ public class JavaKit extends ExtKit { /** Not implemented */ public void append(byte[] buffer, int off, int len) - throws IOException - { + throws IOException { throw new IllegalArgumentException("read only!"); } @@ -150,6 +149,7 @@ public class JavaKit extends ExtKit { */ public void read(byte[] buffer, int off, int len) throws IOException { InputStream str = getStream(actOff); + while (len > 0) { int count = str.read(buffer, off, len); streamOff += count; @@ -162,7 +162,7 @@ public class JavaKit extends ExtKit { * @param requestWrite if true, file is opened for read/write */ public void open(boolean requestWrite) throws IOException { - if(requestWrite) + if (requestWrite) throw new IllegalArgumentException("read only!"); } @@ -181,7 +181,7 @@ public class JavaKit extends ExtKit { * at which the next read or write occurs. */ public long getFilePointer() throws IOException { - return actOff; + return actOff; } /** Clears the file and sets the offset to 0 */ @@ -206,7 +206,7 @@ public class JavaKit extends ExtKit { stream = null; } - if(stream == null) { + if (stream == null) { stream = url.openStream(); streamOff = 0; } @@ -214,6 +214,7 @@ public class JavaKit extends ExtKit { while (streamOff < off) { long len = stream.skip(off - streamOff); streamOff += (int)len; + if (len == 0) throw new IOException("EOF"); } |