Extra empty lines in java code
Hello
I am experiencing a strange behaviour of SJSC 2.1 (Windows XP) after insttalling the last performance fix
When manipulating components in a page, the .java file gets corrupted. An extra empty line is including after each line. Code still compiles but obviously the code becomes unreadable. This happens if you add a new component to the page o double-click in a component (to edit the action or valuechange methods
Editing-only (in the java window) works ok.
An additional problem found. International characters are not handled properly anymore by the design editor (or the properties window). Changes to them are translated to question marks in the JSP. Only wokaround is to directly edit the JSP
All this happened just after installing the hotfix.
I had the same problem, and pointed out to the Creator, who were able to reproduce it. So, they know about it now.
A very undesirable effect of this problem is that as the Java files grows in size, JSC becomes very slow, and can sometimes hang.
Also, I've noticed that this problem happens only with JSC1 created pages, not with JSC2 pages.
My workaround is the following:
1). Download and install the text editor - TextPad
2. Go to the folder containing the java files with the extra lines, select them all, and open with TextPad.
3). Fix the extra line problem with the following regex:
^[[:space:]]*\n
The above regular expression, will take care of the extra lines.
4). Do a search and replace all for all active documents, and save and close.
But obviously, this is a serious problem, and I urge the Creator team to please fix it at the earliest, so as not to cause further confusion and loss of time and effort!
Regards
Haroon
Similar Messages
-
Using Unix command lines in java code
I was wondering if there was a way to run a unix command in java code. I know in C++ there is popen, but i don't know of a way in java. The command i need to run is the whois "domain name" command. Any help would be great!
jaradtry something like this:
public static String whois(String domain) throws IOException {
BufferedReader is = null;
Process p = null;
String result = "";
p = Runtime.getRuntime().exec("whois " + domain);
is = new BufferedReader(new InputStreamReader(p.getInputStream()));
String line;
while((line = is.readLine()) != null)
result += line;
return result;
} -
Extra blank lines in source code
I have built a website in Dreamweaver CS4 and have a client editing pages in Contribute CS5. Both of us are working on Windows 7, and the site is hosted on Linux. When she makes edits to the page, something is introducing a GAZILLION blank lines in the source code. A typical page for this site is about 380 lines of code. The problem page is now more than 310,000 lines code with 100-200 blank lines between every "real" line of code. What the...?!
I need to know how to stop this and how to remove the blank lines from the source code using Dreamweaver.
The page in question lives here: http://www.alexandercitychamber.com/member-category.html
HELP!!!
JeffHello, Diane -
We've got two separate issues here, but I think we have the solution to both.
1. How to stop Contribute from adding blank lines in the code, and
2. How to clean up a GAZILLION lines of blank code in a document.
First, Number 1. I assume you're working in Dreamweaver. If not, I'm not sure how to guide you. But, when you define a Contribute Site, there is an area to specify administrative roles and permissions. Under each Role, at the bottom, you will see a popup for what kind of server the site is hosted on. The default is Windows. I had to change this to Unix (Linux) to match the hosting of our problem site. Find out what platform your host is using. You will have to specify this under each admistrative Role. After doing this, I had the client make some edits, then I opened the files in Dreamweaver. No new blank lines. I admit, I still have my fingers crossed somewhat.
Okay, now how to clean up your source code and remove blank lines. A developer friend found this on some forum I had not seen. I don't know where, but I am grateful to the person who wrote it. It didn't get all the blank lines in my files, but I think some of the others, which I removed manually, were probably from the client pasting content in from Word. Here's what to do:
1. Open the file in Dreamweaver
2. Click CTRL + F, or go to EDIT > FIND AND REPLACE
3. Select "Current document" in "Find In" (You can also select the folder if you have multiple files.
4. Search in "Source Code"
5. Check the box labeled "Use regular expression"
6. Type "[\r\n]{2,}" (without quotes) in "Find"
7. Type "\n" (without quotes) in "Replace"
8. Press "Replace All"
The operation chugged for a few minutes with my 301,000-line document. Yours may a take a little longer, but it did work. Good luck!
Jeff
[email protected] -
Compressing a large PDF document using command line or Java code without GUI operations
hi,
I have a programatically generated very large PDF file with lots of tables and cells in it. The size of the file is few MBs. Using Adobe pro, I am able to reduce the size of the PDF in KBs. I want to achive it either through a command line or using Java API without GUI interaction.
I am using JDK1.6.
Thanks.I think you need the scripting or SDK forums http://forums.adobe.com/community/acrobat
As far as I know, Acrobat does not have command line operation -
Running Shell Scripts within Java code!!!
Hi,
How do I run a shell script from my Java code???
Also I need to ensure my next line of Java code is executed only after the shell script has finished executing.
Since my shell script just cuts out some line for a txt file and then only my Java code parses the cut-out file section and processes certain info.
Please help!!!
Thanks!!!Runtime.exec and, if you need your Java to stop until the external executable is complete, Process.waitFor.
And you'll want to read this:
http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html -
Empty line at the end of SAP Java instance profile
I saw this today in help.sap.com, which says that an Java instance profile must have an empty line at the end of the file, would anyone know what is it for ?
The instance profile (/usr/sap/<SID>/SYS/profile/<SID>_<instance name>_<hostname>) u2013 this file contains settings that apply to the instance as a whole. For a Java-only installation, the file can be edited with any text editor (beware that the file must have an empty line at the end.);
http://help.sap.com/saphelp_nw04s/helpdata/en/2e/611724f410254ca12a3f396ec5ae85/frameset.htm
thank you
Jonu JoyI have heard many "explanations" for this, but never really any solid answers.
From experience, however, I can tell you that the SAP profiles (both ABAP and Java) will miss the last parameter if it is located on the bottom line of the file. I have always put in two or three blank spaces at the bottom of the profiles in order to avoid this. -
Help...empty lines in code Dreamweaver CS3
Wow, why are all adobe applications so messed up? No friend of mine to be sure but have to use this application because my company says so...
How can I remove empty lines of code from my pages? It's just endless P paragraph signs...I usually fix the bugs in adobe's wysiwyg via hand coding so the empty lines are really irritating to me. I miss macromedia's version of Dreamweaver
BTW...the servers are not the issue as far as I can see. And I've already tried to do the find and replace fix...just freezes the application.
Any fix for this bug would be greatly appreciated!
Thanks.function(){return A.apply(null,[this].concat($A(arguments)))}
function(){return A.apply(null,[this].concat($A(arguments)))}Wow, why are all adobe applications so messed up? No friend of mine to be sure but have to use this application because my company says so...
How can I remove empty lines of code from my pages? It's just endless P paragraph signs...I usually fix the bugs in adobe's wysiwyg via hand coding so the empty lines are really irritating to me.
Have you taken the time to learn to use Adobe apps correctly and understand how they work? In general, they're very well written and very powerful when used with skill and care.
Plenty of professionals and hobbyists around the world use them daily without seeing the issues you're seeing.
Endless p tags are there because you put them there: either via Code View or repeatedly pressing Enter for no reason in Design View. -
SAPNW2004s Java incorrect license key:empty line expected
i installed SAPNW2004s Java trial version.but WebAs shutdowns every 30 mins. I searched and found that reason is license problem.
When i try to upload license text (MBS.txt) with visual administrator.I get error say that "incorrect SAP license key :header or empty line expected".
How to get over this issue?
Best Regards...
MBS file like this
# Installation of the license key
# Script for release 4.5A and higher
# saplicense -install [ifile=...]
# Database: MSSQLSRV
# Release: SAP R/3 4.6C
SAPSYSTEM = MBS
CUSTOMER-KEY = XXXXXXXXXXX
INSTNO = DEMOSYSTEM
EXPIRATION = 20081020
LKEY = XXXXXXXXXXXXXXXXXXXXXXXXThat file is for MiniSAP version and not for NSP...NSP license is no longer provided on the licenses page...Must wait for Official SAP News.
Greetings,
Blag. -
Java Comiler - How to find out the Number of lines of Executable code
Hello,
Is there any option we have or could have to get the "Number of Lines of Executable Code" while we run the java compiler?
Technically Java is an interpreter. So in case the term is incorrect, please excuse me.
Since the compiler anyway traverses through the Java files, it is easy and correct to get the number from the compiler rather than having any external tool calculating the same.
It should remove the comments, blank lines and take care of java single sentence written in multiple lines.
Any suggestions or help is highly appreciated.
regards,
SabyasachiHow many lines of code are there in this program?
public class sabre20110211 {public static void main(String[] args) {for (int i = 0; i < 10; i++)System.out.println(i);}}And how many in this program?
public
class
sabre20110211
public
static
void
main(
String[]
args
for
(int i = 0;
i < 10;
i++
System.out.println(i);
} -
How to add DTD syntax line into XML using java code
Hi,
I am building xml file with java, usiing document.createElement()
and document.appendChild(element),
like that
now i need to add dtd file path and synatx in the top of the xml file,
how can i do it through java code
any body could help me
i appreciate your help.
thanks
DurgaHi Suneetha,
Thanks for your reply..
Now i am getting docType in xml file but not in the format of what i want
please look at my code
i need
<!DOCTYPE myRootElement SYSTEM "myXMLDTD.dtd" >
but i am getting
<!DOCTYPE myRootElement PUBLIC "" "myXMLDTD.dtd">
There is change i need to get the SYSTEM in place of PUBLIC and i need to get rid of "" code between dtd and PUBLIC
for this i am doing in my code as
DocumentType theDocType = new DocumentImpl().createDocumentType ("SYSTEM","","myXMLDTD.dtd");
Document theDoc = new DocumentImpl(theDocType);
i dn't know what is the wrong ? i dn't know what are the parameters at what place to pass if you know any thing just let me know
thanks in advance
and i apperciate you help.
Durga -
Hi all
I m facing problem to upload data through idoc.the scenario is like we receive electric meter reading in flat file format. And to upload that data JAVA code is written which will create an IDOC FILE this authorization is only give to 2-3 person in organization and to basis guy also as user changed its password in SAP and in JAVA the java code is not going to create the IDOC file and data is not going to upload. after changing user password in sap system ,user not able to upload the data.
ISU_MR_UPLOAD01 is the idoc file generated. So is there any authorization issue, password issue how to see and view IDOC IN SAP, can any one help me out into this.
The error with java throws is as;
1ST ERROR IN TRACE FILE
ERROR file opened at 20061109 133610 India Standard, SAP-REL 640,0,59 RFC-VER 3 MT-SL
T:2736 ======> User TR has no RFC authorization for function group SYST .
T:2736 <* RfcReceive [1] : returns 3:RFC_SYS_EXCEPTION
2ND ERROR ON COMMAND PROMT
C:\j2sdk1.4.2_07>cd bin
C:\j2sdk1.4.2_07\bin>java sandsupload
Creating IDoc...Exception in thread "main" com.sap.mw.idoc.IDoc$Exception: (2) I
DOC_ERROR_METADATA_UNAVAILABLE: The meta data for the IDoc type "ISU_MR_UPLOAD01
" is unavailable.
at com.sap.mw.idoc.jco.JCoIDoc$JCoDocument.<init>(JCoIDoc.java:233)
at com.sap.mw.idoc.jco.JCoIDoc$JCoDocument.<init>(JCoIDoc.java:187)
at com.sap.mw.idoc.jco.JCoIDoc.createDocument(JCoIDoc.java:10521)
at sandsupload.main(sandsupload.java:35)
the part of java code
try {
//create a JCo client pool
JCO.addClientPool( "MyPool", //pool name
3, //maximum pool connections
"333", //SAP client
" TR", //user ID
" XYZ", //password
"EN", //language
" 1.1.1.1 ", //app server host name
"00" ); //system number
//create an IDoc repository
IDoc.Repository idocRep = JCoIDoc.createRepository("MyIDocRepository", "MyPool");
//create a new and empty MATMAS02 document
System.out.print("Creating IDoc...");
Line where it shows error
IDoc.Document doc = JCoIDoc.createDocument(idocRep, "ISU_MR_UPLOAD01");
//get the root segment from the document
//The root segment does not contain any fields or data. It is only
//used as the standard parent segment and won't be transmitted when
//the document is sent to an SAP system.
IDoc.Segment segment = doc.getRootSegment();
//create and add a new and empty child segment of type E1MARAM
//and fill the segment dataHi Gaurav,
Same exception on the same line has been reported and marked as solved here :
IDOC_ERROR_METADATA_UNAVAILABLE:
Btw, I think this forum is not visited often by JCO and ABAP connectivity experts, so maybe you could get a faster response to your problems while posting in "Java Programming" or maybe in some forum under the category ABAP Development.
HTH
Peter -
Extra white lines in jdeveloper IDE (Strange Problem)
Hi,
we are working with clearcase as version control and some people in out team get "extra white lines" in
some java files that other people have created(and chekced in).
this makes the java file very ugly.
do u know any reason for this ? or any solution ?
this does not happen for all the java files.but some of them look differently in other computers using same IDE version.
for example i see :
try
catch
in my computer and in another machine this is seen as :
try
catch
thax
rezaHow does the file show up in notepad or vi? How does it show up in firefox?
You might want to evaluate the file with an ASCII reader to see if there are any extra line breaks in the code.
Also are some of the developers on linux/unix and some on windows? -
Empty lines at the end of the payload generated in FTP server
Hi All,
I am facing an issue in one of the use cases that I am trying to implement.
I am getting a purchase order from one of the trading partners through Oracle B2B.
B2B forwards this B2BM (B2B message ) to AIAB2BInterface. From AIAB2BInterface my BPEL process gets invoked, which in turn invokes the AdapterComposite which has a FTP adapter that writes the purchase order to a FTP server. PFB the end to end flow.
PurchaseOrder from ABC trading pertner--> Oracle B2B --> AIAB2BInterface --> TestInputProvABCS --> TestInputAdapter -> Host trading partner picks up the file from FTP location
In the ProvABCS I retrieve the actual payload from the B2BM and convert it into a string using ora:getContentasString. I am then invoking the adapter composite and sending the string as the input to FTP adapter. At the adapter composite I use a simple native schema (for validation of the input string) which has only one element PO_Info of the type string. But when the file gets generated in the FTP server there are empty lines and junk characters at the end of the file.
Need some advice on this. Why are the empty lines coming in the end of the file? Please help!
ThanksOK, I cannot figure out a way to modify the JTable (in an extended class) directly.
So, what I did was to add a wrapper around the TreeTableModel which shows an empty row at the end.
For those of you who are in a similar situation, the methods that I had to modify are
public boolean isCellEditable(Object node, int column);
public int getIndexOfChild(Object parent, Object child);
public int getChildCount(Object node);
public Object getChild(Object node, int i);
These other methods are required if you are using a TreeTable instead of just a table (see http://java.sun.com/products/jfc/tsc/articles/treetable2/index.html)
public Object getValueAt(Object node, int row, int column);
public Object getValueAt(Object node, int row, String columnName);
public void setValueAt(Object node, int row, int column, Object newValue);
public void setValueAt(Object node, int row, String columnName, Object newValue);
The signature of above methods is slightly different than the ones at: http://java.sun.com/products/jfc/tsc/articles/treetable2/src/TreeTableModel.java
This is due to the fact that, if you want to display the serial no. (as in row number), then getValue() can just return the row number. IndexedTreeTableModel is another wrapper around the TreeTableModel which can add an extra column to display the serial number. -
How to recognize empty lines in a source file
Hi to all
I want to count he empty lines in a source file. I've been using the methods provided by String such as "contains" ecc but for example
String line = new String();
line.startsWith(\r); in order to trace the carrage return in order to consider this as an empty line didn't work
I cut and paste here my code any hint is apreciable!
import java.io.*;
public class Filereader {
public Filereader() {
public static void main(String argv[]) {
File temp = new File("LOC.txt");
File list = new File("mylist.txt");
String line = new String();
String lineinternal = new String();
int linecounter = 0;
int sourcelines = 0;
int commentlines = 0;
int complexlines = 0;
boolean commentflag = false;
try {
FileReader fileinput = new FileReader(list);
BufferedReader buffinput = new BufferedReader(fileinput);
FileWriter fileout = new FileWriter(temp);
BufferedWriter out = new BufferedWriter(fileout);
out.append("NOME");
out.append(" \t");
out.append("LOC");
out.append(" \t");
out.append("LCom");
out.append(" \t");
out.append("Ltot");
out.newLine();
boolean eof = false;
boolean eofinternal;
while ( !eof ) {
eofinternal = false;
line = buffinput.readLine();
if ( line != null ) {
linecounter = 0;
sourcelines = 0;
commentlines = 0;
complexlines = 0;
FileReader fileinternal = new FileReader(line);
BufferedReader buffinternal = new BufferedReader(fileinternal);
while ( !eofinternal ) {
lineinternal = buffinternal.readLine();
if ( lineinternal != null ) {
linecounter++;
if ( lineinternal.contains("//") && (!commentflag) )
commentlines++;
if ( lineinternal.contains("/*") )
commentflag = true;
if ( commentflag )
commentlines++;
if ( lineinternal.contains("*/") )
commentflag = false;
if ( !commentflag ) {
if ( (lineinternal.contains(";")) && (lineinternal.contains("//")) && (!lineinternal.startsWith("//")) )
complexlines++;
else
if ( (lineinternal.contains(";")) && (lineinternal.contains("/*")) && (!lineinternal.startsWith("/*")) )
complexlines++;
else
if ( (lineinternal.contains(")")) && (lineinternal.contains("//")) && (!lineinternal.startsWith("//")) )
complexlines++;
else
if ( (lineinternal.contains(")")) && (lineinternal.contains("/*")) && (!lineinternal.startsWith("/*")) )
complexlines++;
else
if ( (lineinternal.contains("}")) && (lineinternal.contains("//")) && (!lineinternal.startsWith("//")) )
complexlines++;
else
if ( (lineinternal.contains("}")) && (lineinternal.contains("/*")) && (!lineinternal.startsWith("/*")) )
complexlines++;
else
eofinternal = true;
buffinternal.close();
sourcelines = (linecounter - commentlines) + complexlines;
Integer data1 = new Integer(sourcelines);
Integer data2 = new Integer(commentlines);
Integer data3 = new Integer(linecounter);
String f = data1.toString();
out.append(line);
out.append(" \t");
out.append(data1.toString());
out.append(" \t");
out.append(data2.toString());
out.append(" \t");
out.append(data3.toString());
out.newLine();
else {
eof = true;
buffinput.close();
out.close();
System.out.println("...end of try catch ");
catch (IOException e) {
System.out.println("Error..." + e.toString());
catch (Exception e) {
System.out.println("Error..." + e.toString());
Thanks in advance to all
MandyTry this:
String trimmedLine = lineFromFile.trim();
if ("".equals(trimmedLine))
// logic for trimmed line
}That's some ugly procedural code. Long "if/else if/else" is a very bad sign.
I'd advise that you at least move this mess out of main() and into a method that you could just call. I don't know if this will be reusable or not, but you won't have a chance of it being callable in another context if you leave it all in main().
% -
Removing the empty line during Receiver FCC!
Hi, Guys,
I used file content conversion in receive FCC. My data type is like this:
<TextFromSAP_DT>
<FileName>
<FileName>abc.txt</FileName>
</FileName>
<Record>
<TEXT>dasfafaf</TEXT>
</Record>
<Record>
<TEXT>qqqqqqqq</TEXT>
</Record>
<Record>
<TEXT>fgfffff</TEXT>
</Record>
</TextFromSAP_DT>
I need to get file name from <FileName> and output a flat file with the value in <TEXT>. But I always got an empty line at the file beginning. And I tried to move <FileName> to the end. And I got an empty line at the file end. My custom said they are having trouble to read the file with the empty line no matter it is in the beginning or end.
I followed sample as link below but does not work.
https://wiki.sdn.sap.com/wiki/display/profile/2007/07/30/Removing%20the%20empty%20line%20during%20Receiver%20FCC!
Does any body can give a help?
Thanks a lot!
Meiying
Edited by: Meiying Yang on Aug 14, 2009 11:16 PMHi Yang,
You create the value udf GetFileName with one input value say a. Add this code:
Imports: java.*;
Add this code:
//write your code here
DynamicConfiguration conf = (DynamicConfiguration)container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http:" + "/" + "/" + "sap.com/xi/XI/System/File", "FileName");
conf.put(key, a);
return "";
Map like this:
FileName --> GetFileName(udf) --> target_mt
Map other fields like:
Record --> Record
TEXT ---> TEXT
Save it and activate it. When you test in mapping you will get an error so dont worry. I go the error like:
RuntimeException in Message-Mapping transformation: Runtime exception during processing target field mapping /ns0:Target_MT. The message is: Exception:[java.lang.NullPointerException] in class com.sap.xi.tf._TestFileName_ method file1$[abc.txt, com.sap.aii.mappingtool.tf3.rt.Context@32dcebf1]
Dont worry about this activate and do the rest of the configuration.
In your receiver communication channel for file name put as FileName and check the file name in adapter specific message attributes. Then test it and it should work and you will get the file with file name abc.txt. I tested the whole end to end scenario and I am getting the file name abc.txt and the output what you want. If you still could not get it send me a m ail to my i d from my business card. I will send you the screen shots.
Regards,
---Satish
Maybe you are looking for
-
Home Sharing and multiple Users
We have one Mac with one user (me) and another Mac with two other users. If we have Home Sharing turned on for all three users, should each user be able to see the other two iTunes libraries, or will only the currently logged in user on the 2-user co
-
Join the two JInternalFrame into one
hi everybody, What can I do to join two JInternalFrame into one, like I have 2 floating panel then I join it into 1 by using JTappedPane. That you can drag to spit it out or join together ! thanks, Quin
-
JDeveloper BPEL/ESB Designer
I'm going spare trying to set up a version of JDeveloper with the BPEL / ESB plugin. I have found and tried to follow Oracle documentation fo the BPEL Process Manager which claims that JDeveloper with BPEL Designer is installed with BPEL Process Mana
-
Replaced hard drive in Mac book pro now what
I just replaced the hard drive now what?
-
Conncet oracle client on Windows XP/7 to oracle 10g RetHot Linux server
I have installed oracle 10g on Rethot Linux and oracle client 10g installed on windows 7 .how to connect oracle server from oracle client in different OS. Please give me step .