You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by bl...@apache.org on 2002/02/12 15:54:25 UTC
cvs commit: jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/util/system Linux.java Windows95.java Windows98.java
bloritsch 02/02/12 06:54:25
Modified: src/scratchpad/org/apache/avalon/excalibur/util/system
Linux.java Windows95.java Windows98.java
Log:
fix some display errors in system architecture
Revision Changes Path
1.2 +12 -6 jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/util/system/Linux.java
Index: Linux.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/util/system/Linux.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Linux.java 12 Feb 2002 06:22:02 -0000 1.1
+++ Linux.java 12 Feb 2002 14:54:25 -0000 1.2
@@ -21,7 +21,7 @@
* CPU information.
*
* @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
- * @version CVS $Revision: 1.1 $ $Date: 2002/02/12 06:22:02 $
+ * @version CVS $Revision: 1.2 $ $Date: 2002/02/12 14:54:25 $
*/
public final class Linux implements CPUParser
{
@@ -43,15 +43,20 @@
while ( ( line = reader.readLine() ) != null )
{
- String[] args = StringUtil.split( line, ":" );
- props.setProperty( args[0].trim(), args[1].trim() );
- if ( args[0].trim().indexOf( "processor" ) >= 0 )
+ String[] args = StringUtil.split( line, ":\t" );
+
+ if (args.length > 1)
{
- procs++;
+ props.setProperty( args[0].trim(), args[1].trim() );
+ if ( args[0].trim().equals( "processor" ) )
+ {
+ procs++;
+ }
}
}
- StringBuffer buf = new StringBuffer( System.getProperty("os.arch") );
+ StringBuffer buf = new StringBuffer();
+ buf.append( props.getProperty( "model name" ) );
buf.append( " Family " );
buf.append( props.getProperty( "cpu family" ) );
buf.append( " Model " );
@@ -66,6 +71,7 @@
catch (Exception e)
{
procs = 1;
+ e.printStackTrace();
}
m_processors = procs;
1.3 +5 -13 jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/util/system/Windows95.java
Index: Windows95.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/util/system/Windows95.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Windows95.java 11 Feb 2002 21:51:12 -0000 1.2
+++ Windows95.java 12 Feb 2002 14:54:25 -0000 1.3
@@ -16,40 +16,32 @@
/**
* Parses the Windows 95 environment--the same class should work for other
- * Windows versions, but I only have one to test.
+ * Windows versions, but I only have one to test. Windows 9x environments
+ * can only use one processor--even if there are more installed in the system.
*
* @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
- * @version CVS $Revision: 1.2 $ $Date: 2002/02/11 21:51:12 $
+ * @version CVS $Revision: 1.3 $ $Date: 2002/02/12 14:54:25 $
*/
public final class Windows95 implements CPUParser
{
- private final int m_processors;
+ private final int m_processors = 1;
private final String m_cpuInfo;
public Windows95()
{
- int procs = 1;
String info = "";
try
{
- Runtime rt = Runtime.getRuntime();
- Process proc = rt.exec("command.com /C echo %NUMBER_OF_PROCESSORS%");
- BufferedReader reader = new BufferedReader(new InputStreamReader(
- proc.getInputStream() ) );
- String numProcs = reader.readLine();
-
+ // This is not the propper environment variable for Win 9x
proc = rt.exec("command.com /C echo %PROCESSOR_IDENTIFIER%");
reader = new BufferedReader(new InputStreamReader( proc.getInputStream() ) );
info = reader.readLine();
-
- procs = Integer.parseInt( numProcs );
}
catch (Exception e)
{
}
- m_processors = procs;
m_cpuInfo = info;
}
1.2 +5 -13 jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/util/system/Windows98.java
Index: Windows98.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/util/system/Windows98.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Windows98.java 12 Feb 2002 06:22:02 -0000 1.1
+++ Windows98.java 12 Feb 2002 14:54:25 -0000 1.2
@@ -16,40 +16,32 @@
/**
* Parses the Windows 98 environment--the same class should work for other
- * Windows versions, but I only have one to test. Needs to be updated....
+ * Windows versions, but I only have one to test. Windows 9x environments
+ * can only use one processor--even if there are more installed in the system.
*
* @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
- * @version CVS $Revision: 1.1 $ $Date: 2002/02/12 06:22:02 $
+ * @version CVS $Revision: 1.2 $ $Date: 2002/02/12 14:54:25 $
*/
public final class Windows98 implements CPUParser
{
- private final int m_processors;
+ private final int m_processors = 1;
private final String m_cpuInfo;
public Windows98()
{
- int procs = 1;
String info = "";
try
{
- Runtime rt = Runtime.getRuntime();
- Process proc = rt.exec("command.com /C echo %NUMBER_OF_PROCESSORS%");
- BufferedReader reader = new BufferedReader(new InputStreamReader(
- proc.getInputStream() ) );
- String numProcs = reader.readLine();
-
+ // This is not the propper environment variable for Win 9x
proc = rt.exec("command.com /C echo %PROCESSOR_IDENTIFIER%");
reader = new BufferedReader(new InputStreamReader( proc.getInputStream() ) );
info = reader.readLine();
-
- procs = Integer.parseInt( numProcs );
}
catch (Exception e)
{
}
- m_processors = procs;
m_cpuInfo = info;
}
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>