[JBoss JIRA] (JBOSGI-780) ManifestBuilder does not work on windows if line has 511 bytes
by Martin Basovnik (JIRA)
[ https://issues.jboss.org/browse/JBOSGI-780?page=com.atlassian.jira.plugin... ]
Martin Basovnik updated JBOSGI-780:
-----------------------------------
Description:
Lines on Windows OS end with {{CRLF}} ({{\r\n}}). Method [{{org.jboss.osgi.metadata.ManifestBuilder.getManifest()}}|https://github.com/jbosgi/jbosgi-metadata/blob/master/src/main/java/org/jboss/osgi/metadata/ManifestBuilder.java#L93] does not count with this fact. If {{bytes.length == 511}} then a line will have 513 bytes and method {{Manifest#read}} will throw {{IOException}} and the building of the manifest will fail.
Reason:
The following line will crop byte {{\n}}:
{code:java}
byte[] lbuf = new byte[512];
attr.read(fis, lbuf);
{code}
and then the following condition will fail because the value of {{lbuf\[--len\]}} expression is {{'\r'}}.
{code:java}
if (lbuf[--len] != '\n') {
throw new IOException("manifest line too long");
}
{code}
was:
Lines in Windows end with {{CRLF}} ({{\r\n}}). Method {{org.jboss.osgi.metadata.ManifestBuilder.getManifest()}} does not count with this fact. If a line has exactly {{(n*512)-1}} bytes + {{CRLF}} then method {{Manifest#read}} will throw {{IOException}} and the building of manifest will fail.
The following line will crop byte {{\n}}:
{code:java}
byte[] lbuf = new byte[512];
attr.read(fis, lbuf);
{code}
and then the following condition will fail because the value is {{\r}}.
{code:java}
if (lbuf[--len] != '\n') {
throw new IOException("manifest line too long");
}
{code}
> ManifestBuilder does not work on windows if line has 511 bytes
> --------------------------------------------------------------
>
> Key: JBOSGI-780
> URL: https://issues.jboss.org/browse/JBOSGI-780
> Project: JBoss OSGi
> Issue Type: Bug
> Components: other
> Environment: windows
> Reporter: Martin Basovnik
>
> Lines on Windows OS end with {{CRLF}} ({{\r\n}}). Method [{{org.jboss.osgi.metadata.ManifestBuilder.getManifest()}}|https://github.com/jbosgi/jbosgi-metadata/blob/master/src/main/java/org/jboss/osgi/metadata/ManifestBuilder.java#L93] does not count with this fact. If {{bytes.length == 511}} then a line will have 513 bytes and method {{Manifest#read}} will throw {{IOException}} and the building of the manifest will fail.
> Reason:
> The following line will crop byte {{\n}}:
> {code:java}
> byte[] lbuf = new byte[512];
> attr.read(fis, lbuf);
> {code}
> and then the following condition will fail because the value of {{lbuf\[--len\]}} expression is {{'\r'}}.
> {code:java}
> if (lbuf[--len] != '\n') {
> throw new IOException("manifest line too long");
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)
8 years, 12 months
[JBoss JIRA] (JBOSGI-780) ManifestBuilder does not work on windows if line has 511 bytes
by Martin Basovnik (JIRA)
[ https://issues.jboss.org/browse/JBOSGI-780?page=com.atlassian.jira.plugin... ]
Martin Basovnik updated JBOSGI-780:
-----------------------------------
Description:
Lines in Windows end with {{CRLF}} ({{\r\n}}). Method {{org.jboss.osgi.metadata.ManifestBuilder.getManifest()}} does not count with this fact. If a line has exactly {{(n*512)-1}} bytes + {{CRLF}} then method {{Manifest#read}} will throw {{IOException}} and the building of manifest will fail.
The following line will crop byte {{\n}}:
{code:java}
byte[] lbuf = new byte[512];
attr.read(fis, lbuf);
{code}
and then the following condition will fail because the value is {{\r}}.
{code:java}
if (lbuf[--len] != '\n') {
throw new IOException("manifest line too long");
}
{code}
was:
Windows lines end with {{CRLF}} ({{\r\n}}). Method {{org.jboss.osgi.metadata.ManifestBuilder.getManifest()}} does not count with this fact. If a line has exactly {{(n*512)-1}} bytes + {{CRLF}} then method {{Manifest#read}} will throw {{IOException}} and the building of manifest will fail.
The following line will crop byte {{\n}}:
{code:java}
byte[] lbuf = new byte[512];
attr.read(fis, lbuf);
{code}
and then the following condition will fail because the value is {{\r}}.
{code:java}
if (lbuf[--len] != '\n') {
throw new IOException("manifest line too long");
}
{code}
> ManifestBuilder does not work on windows if line has 511 bytes
> --------------------------------------------------------------
>
> Key: JBOSGI-780
> URL: https://issues.jboss.org/browse/JBOSGI-780
> Project: JBoss OSGi
> Issue Type: Bug
> Components: other
> Environment: windows
> Reporter: Martin Basovnik
>
> Lines in Windows end with {{CRLF}} ({{\r\n}}). Method {{org.jboss.osgi.metadata.ManifestBuilder.getManifest()}} does not count with this fact. If a line has exactly {{(n*512)-1}} bytes + {{CRLF}} then method {{Manifest#read}} will throw {{IOException}} and the building of manifest will fail.
> The following line will crop byte {{\n}}:
> {code:java}
> byte[] lbuf = new byte[512];
> attr.read(fis, lbuf);
> {code}
> and then the following condition will fail because the value is {{\r}}.
> {code:java}
> if (lbuf[--len] != '\n') {
> throw new IOException("manifest line too long");
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)
8 years, 12 months
[JBoss JIRA] (JBOSGI-780) ManifestBuilder does not work on windows if line has 511 bytes
by Martin Basovnik (JIRA)
Martin Basovnik created JBOSGI-780:
--------------------------------------
Summary: ManifestBuilder does not work on windows if line has 511 bytes
Key: JBOSGI-780
URL: https://issues.jboss.org/browse/JBOSGI-780
Project: JBoss OSGi
Issue Type: Bug
Components: other
Environment: windows
Reporter: Martin Basovnik
Windows lines end with {{CRLF}} ({{\r\n}}). Method {{org.jboss.osgi.metadata.ManifestBuilder.getManifest()}} does not count with this fact. If a line has exactly {{(n*512)-1}} bytes + {{CRLF}} then method {{Manifest#read}} will throw {{IOException}} and the building of manifest will fail.
The following line will crop byte {{\n}}:
{code:java}
byte[] lbuf = new byte[512];
attr.read(fis, lbuf);
{code}
and then the following condition will fail because the value is {{\r}}.
{code:java}
if (lbuf[--len] != '\n') {
throw new IOException("manifest line too long");
}
{code}
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)
8 years, 12 months