Java io utfdataformatexception malformed input around byte 2

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.io.UTFDataFormatException: malformed input around byte #2

java.io.UTFDataFormatException: malformed input around byte #2

Comments

Getting a nasty error when using Scala 2.12:

sbt:core> hepek
[error] java.lang.RuntimeException: java.io.UTFDataFormatException: malformed input around byte 21
[error] at classycle.Analyser.getClassGraph(Analyser.java:132)
[error] at ba.sake.hepek.core.ClassycleDependencyUtils.reverseDependencies(ClassycleDependencyUtils.java:44)
[error] at ba.sake.hepek.sbt.Tasks$.getClassNamesToRender(HepekPlugin.scala:84)
[error] at ba.sake.hepek.sbt.Tasks$.runHepek(HepekPlugin.scala:64)
[error] at ba.sake.hepek.sbt.HepekPlugin$.$anonfun$rawHepekSettings$1(HepekPlugin.scala:31)
[error] at ba.sake.hepek.sbt.HepekPlugin$.$anonfun$rawHepekSettings$1$adapted(HepekPlugin.scala:26)
[error] at scala.Function1.$anonfun$compose$1(Function1.scala:44)
[error] at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:42)
[error] at sbt.std.Transform$$anon$4.work(System.scala:64)
[error] at sbt.Execute.$anonfun$submit$2(Execute.scala:257)
[error] at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)
[error] at sbt.Execute.work(Execute.scala:266)
[error] at sbt.Execute.$anonfun$submit$1(Execute.scala:257)
[error] at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:167)
[error] at sbt.CompletionService$$anon$2.call(CompletionService.scala:32)
[error] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[error] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
[error] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
[error] at java.lang.Thread.run(Thread.java:748)
[error] (core/compile:hepek) java.io.UTFDataFormatException: malformed input around byte 21

Project: sake-ba-source
Note: Not happening when using Scala 2.11.
So, this could be related to classycle and Java 8 bytecode.

The text was updated successfully, but these errors were encountered:

Источник

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Читайте также:  Selenium open html file

Already on GitHub? Sign in to your account

malformed input around byte 2 #710

malformed input around byte 2 #710

Comments

Keep seeing this error spam by while rendering one of our oldest worlds:

12:43:00 [SEVERE] java.io.UTFDataFormatException: malformed input around byte 2
12:43:00 [SEVERE] at java.io.DataInputStream.readUTF(DataInputStream.java:656)
12:43:00 [SEVERE] at java.io.DataInputStream.readUTF(DataInputStream.java:564)
12:43:00 [SEVERE] at net.minecraft.server.NBTBase.b(SourceFile:73)
12:43:00 [SEVERE] at net.minecraft.server.NBTTagCompound.load(NBTTagCompound.java:53)
12:43:00 [SEVERE] at net.minecraft.server.NBTTagList.load(SourceFile:36)
12:43:00 [SEVERE] at net.minecraft.server.NBTBase.b(SourceFile:77)
12:43:00 [SEVERE] at net.minecraft.server.NBTTagCompound.load(NBTTagCompound.java:53)
12:43:00 [SEVERE] at net.minecraft.server.NBTBase.b(SourceFile:77)
12:43:00 [SEVERE] at net.minecraft.server.NBTTagCompound.load(NBTTagCompound.java:53)
12:43:00 [SEVERE] at net.minecraft.server.NBTBase.b(SourceFile:77)
12:43:00 [SEVERE] at net.minecraft.server.NBTCompressedStreamTools.a(SourceFile:75)
12:43:00 [SEVERE] at net.minecraft.server.ChunkRegionLoader.a(ChunkRegionLoader.java:49)
12:43:00 [SEVERE] at net.minecraft.server.ChunkProviderServer.loadChunk(ChunkProviderServer.java:135)
12:43:00 [SEVERE] at org.bukkit.craftbukkit.CraftWorld.loadChunk(CraftWorld.java:392)
12:43:00 [SEVERE] at org.dynmap.bukkit.NewMapChunkCache.loadChunks(NewMapChunkCache.java:781)
12:43:00 [SEVERE] at org.dynmap.MapManager$2.call(MapManager.java:1141)
12:43:00 [SEVERE] at org.dynmap.MapManager$2.call(MapManager.java:1136)
12:43:00 [SEVERE] at org.bukkit.craftbukkit.scheduler.CraftFuture.run(CraftFuture.java:34)
12:43:00 [SEVERE] at org.bukkit.craftbukkit.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:126)
12:43:00 [SEVERE] at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:588)
12:43:00 [SEVERE] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:506)
12:43:00 [SEVERE] at net.minecraft.server.ThreadServerApplication.run(SourceFile:492)

The text was updated successfully, but these errors were encountered:

Источник

java.io.UTFDataFormatException

UTFDataFormatException is described in the javadoc comments as:

Signals that a malformed string in modified UTF-8 format has been read in a data input stream or by any class that implements the data input interface. See the DataInput class description for the format in which modified UTF-8 strings are read and written.
author: Frank Yellin version: 1.13, 05/13/04 see: java.io.DataInput see: java.io.DataInputStream#readUTF(java.io.DataInput) see: java.io.IOException since: JDK1.0

Where is this exception thrown?

Following, is a list of exception messages cross-referenced to the source code responsible for throwing them. Click on the method link to view the code and see how the exception is thrown.

  • The message ‘java.io.UTFDataFormatException: encoded string too long: . bytes‘ is thrown within the method:
    java.io.DataOutputStream.writeUTF(String, DataOutput)
  • The message ‘java.io.UTFDataFormatException: malformed input around byte . ‘ is thrown within the method:
    java.io.DataInputStream.readUTF(DataInput)
  • The message ‘java.io.UTFDataFormatException: malformed input: partial character at end‘ is thrown within the method:
    java.io.DataInputStream.readUTF(DataInput)
  • The message ‘java.io.UTFDataFormatException: utflen > 65536!‘ is thrown within the method:
    javax.imageio.stream.ImageOutputStreamImpl.writeUTF(String)

How is this exception thrown?

The following sub-sections identify where this exception is thrown, and how (or why) the code is throwing the exception.

Any source code quoted in this section is subject to the Java Research License unless stated otherwise.

java.io.DataOutputStream.writeUTF(String, DataOutput)

/** * Writes a string to the specified DataOutput using * modified UTF-8 * encoding in a machine-independent manner. * First, two bytes are written to out as if by the writeShort * method giving the number of bytes to follow. This value is the number of * bytes actually written out, not the length of the string. Following the * length, each character of the string is output, in sequence, using the * modified UTF-8 encoding for the character. If no exception is thrown, the * counter written is incremented by the total number of * bytes written to the output stream. This will be at least two * plus the length of str, and at most two plus * thrice the length of str. * @param str a string to be written. * @param out destination to write to * @return The number of bytes written out. * @exception IOException if an I/O error occurs. */ static int writeUTF(String str, DataOutput out) throws IOException < int strlen = str.length(); int utflen = 0; int c, count = 0; for (int i = 0; i < strlen; i++) < c = str.charAt(i); if ((c >= 0x0001) && (c else if (c > 0x07FF) < utflen += 3; >else < utflen += 2; >> if (utflen > 65535) throw new UTFDataFormatException('encoded string too long: ' + utflen + ' bytes'); byte[] bytearr = null; if (out instanceof DataOutputStream) < DataOutputStream dos = (DataOutputStream) out; if (dos.bytearr == null || (dos.bytearr.length < (utflen + 2))) dos.bytearr = new byte[(utflen * 2) + 2]; bytearr = dos.bytearr; >else < bytearr = new byte[utflen + 2]; >bytearr[count++] = (byte) ((utflen >>> 8) & 0xFF); bytearr[count++] = (byte) ((utflen >>> 0) & 0xFF); int i = 0; for (i = 0; i < strlen; i++) < c = str.charAt(i); if (!((c >= 0x0001) && (c for (; i < strlen; i++) < c = str.charAt(i); if ((c >= 0x0001) && (c else if (c > 0x07FF) < bytearr[count++] = (byte) (0xE0 | ((c >> 12) & 0x0F)); bytearr[count++] = (byte) (0x80 | ((c >> 6) & 0x3F)); bytearr[count++] = (byte) (0x80 | ((c >> 0) & 0x3F)); > else < bytearr[count++] = (byte) (0xC0 | ((c >> 6) & 0x1F)); bytearr[count++] = (byte) (0x80 | ((c >> 0) & 0x3F)); > > out.write(bytearr, 0, utflen + 2); return utflen + 2; >

Source: «Java SE Downloads: Java SE 6 JDK Source Code», at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

Читайте также:  Comment style in html

java.io.DataInputStream.readUTF(DataInput)

/** * Reads from the * stream in a representation * of a Unicode character string encoded in * modified UTF-8 format; * this string of characters is then returned as a String. * The details of the modified UTF-8 representation * are exactly the same as for the readUTF * method of DataInput. * @param in a data input stream. * @return a Unicode string. * @exception EOFException if the input stream reaches the end * before all the bytes. * @exception IOException if an I/O error occurs. * @exception UTFDataFormatException if the bytes do not represent a * valid modified UTF-8 encoding of a Unicode string. * @see java.io.DataInputStream#readUnsignedShort() */ public static final String readUTF(DataInput in) throws IOException < int utflen = in.readUnsignedShort(); byte[] bytearr = null; char[] chararr = null; if (in instanceof DataInputStream) < DataInputStream dis = (DataInputStream) in; if (dis.bytearr.length < utflen) < dis.bytearr = new byte[utflen * 2]; dis.chararr = new char[utflen * 2]; >chararr = dis.chararr; bytearr = dis.bytearr; > else < bytearr = new byte[utflen]; chararr = new char[utflen]; >int c, char2, char3; int count = 0; int chararr_count = 0; in.readFully(bytearr, 0, utflen); while (count < utflen) < c = (int) bytearr[count] & 0xff; if (c >127) break; count++; chararr[chararr_count++] = (char) c; > while (count < utflen) < c = (int) bytearr[count] & 0xff; switch(c >> 4) < case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: count++; chararr[chararr_count++] = (char) c; break; case 12: case 13: count += 2; if (count >utflen) throw new UTFDataFormatException('malformed input: partial character at end'); char2 = (int) bytearr[count - 1]; if ((char2 & 0xC0) != 0x80) throw new UTFDataFormatException('malformed input around byte ' + count); chararr[chararr_count++] = (char) (((c & 0x1F) utflen) throw new UTFDataFormatException('malformed input: partial character at end'); char2 = (int) bytearr[count - 2]; char3 = (int) bytearr[count - 1]; if (((char2 & 0xC0) != 0x80) || ((char3 & 0xC0) != 0x80)) throw new UTFDataFormatException('malformed input around byte ' + (count - 1)); chararr[chararr_count++] = (char) (((c & 0x0F) > return new String(chararr, 0, chararr_count); >

Source: «Java SE Downloads: Java SE 6 JDK Source Code», at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

Читайте также:  Kotlin кроссплатформенный или нет

javax.imageio.stream.ImageOutputStreamImpl.writeUTF(String)

public void writeUTF(String s) throws IOException < int strlen = s.length(); int utflen = 0; char[] charr = new char[strlen]; int c, boff = 0; s.getChars(0, strlen, charr, 0); for (int i = 0; i < strlen; i++) < c = charr[i]; if ((c >= 0x0001) && (c else if (c > 0x07FF) < utflen += 3; >else < utflen += 2; >> if (utflen > 65535) < throw new UTFDataFormatException('utflen >65536!'); > byte[] b = new byte[utflen + 2]; b[boff++] = (byte) ((utflen >>> 8) & 0xFF); b[boff++] = (byte) ((utflen >>> 0) & 0xFF); for (int i = 0; i < strlen; i++) < c = charr[i]; if ((c >= 0x0001) && (c else if (c > 0x07FF) < b[boff++] = (byte) (0xE0 | ((c >> 12) & 0x0F)); b[boff++] = (byte) (0x80 | ((c >> 6) & 0x3F)); b[boff++] = (byte) (0x80 | ((c >> 0) & 0x3F)); > else < b[boff++] = (byte) (0xC0 | ((c >> 6) & 0x1F)); b[boff++] = (byte) (0x80 | ((c >> 0) & 0x3F)); > > write(b, 0, utflen + 2); >

Source: «Java SE Downloads: Java SE 6 JDK Source Code», at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

  • Get link
  • Facebook
  • Twitter
  • Pinterest
  • Email
  • Other Apps

Источник

Оцените статью