Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* Copyright (c) 1997, 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2026 Contributors to the Eclipse Foundation. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
Expand Down Expand Up @@ -55,13 +56,17 @@ public Writer openSource(JPackage pkg, String fileName) throws IOException {

// write prolog if this is a java source file
if( prolog != null ) {
out.println( "//" );
out.println("//");

String s = prolog;
int idx;
while( (idx=s.indexOf('\n'))!=-1 ) {
out.println("// "+ s.substring(0,idx) );
s = s.substring(idx+1);
out.println("// " + s.substring(0, idx));
s = s.substring(idx + 1);
}
// can have extra comment content after last newline
if (!s.isEmpty()) {
out.println("// " + s);
}
out.println("//");
out.println();
Expand Down
11 changes: 5 additions & 6 deletions jaxb-ri/xjc/src/test/java/com/sun/tools/xjc/OptionsJUTest.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2011, 2023 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2026 Contributors to the Eclipse Foundation. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
Expand Down Expand Up @@ -68,8 +69,7 @@ public void testCreateCodeWriter() throws JClassAlreadyExistsException, IOExcept
FileInputStream fis = new FileInputStream(cls);
//same string in UTF-8 is 1byte shorter on JDK6 than on JDK5
//therefore final check is for 'contains' and not for 'endsWith'
byte[] in = new byte[13];
fis.read(in);
byte[] in = fis.readAllBytes();
fis.close();
cls.delete();
String inStr = new String(in, StandardCharsets.UTF_8);
Expand All @@ -84,8 +84,7 @@ public void testCreateCodeWriter() throws JClassAlreadyExistsException, IOExcept
jcm.build(o.createCodeWriter());
cls = new File(o.targetDir, "test/TestClass.java");
fis = new FileInputStream(cls);
in = new byte[26];
fis.read(in);
in = fis.readAllBytes();
fis.close();
cls.delete();
inStr = new String(in, StandardCharsets.UTF_16);
Expand All @@ -98,12 +97,12 @@ public void testCreateCodeWriter() throws JClassAlreadyExistsException, IOExcept
cls = new File(o.targetDir, "test/TestClass.java");
fis = new FileInputStream(cls);
//this should handle also UTF-32...
in = new byte[84];
fis.read(in);
in = fis.readAllBytes();
fis.close();
cls.delete();
inStr = new String(in, Charset.defaultCharset().name());
assertTrue("Got: '" + inStr + "'", inStr.contains("// This f"));
assertTrue("Got: '" + inStr + "'", inStr.contains("// Generated on:"));
} finally {
Locale.setDefault(locale);
}
Expand Down
Loading